mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-16 01:51:11 +00:00
Nami: Add host command handler for keyboard backlight control
This patch adds host command handlers for EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT and CMD_PWM_GET_KEYBOARD_BACKLIGHT. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:74176833 BRANCH=none TEST=Verify ectool pwmsetkblight works. Verify kblight console command returns the value set by ectool and vice versa. Change-Id: I1929c6a3772ab22cb4b3c68638da23aa23727596 Reviewed-on: https://chromium-review.googlesource.com/1022961 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
3fbf2c47ae
commit
02b42b78b3
@@ -8,6 +8,7 @@
|
||||
#include "console.h"
|
||||
#include "cros_board_info.h"
|
||||
#include "hooks.h"
|
||||
#include "host_command.h"
|
||||
#include "lid_switch.h"
|
||||
#include "lm3509.h"
|
||||
#include "pwm.h"
|
||||
@@ -105,6 +106,32 @@ static void kblight_lid_change(void)
|
||||
}
|
||||
DECLARE_HOOK(HOOK_LID_CHANGE, kblight_lid_change, HOOK_PRIO_DEFAULT);
|
||||
|
||||
static int hc_set_kblight(struct host_cmd_handler_args *args)
|
||||
{
|
||||
const struct ec_params_pwm_set_keyboard_backlight *p = args->params;
|
||||
/* Assume already enabled */
|
||||
if (!kblight_set)
|
||||
return EC_RES_UNAVAILABLE;
|
||||
kblight_set(p->percent);
|
||||
return EC_RES_SUCCESS;
|
||||
}
|
||||
DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_KEYBOARD_BACKLIGHT,
|
||||
hc_set_kblight, EC_VER_MASK(0));
|
||||
|
||||
static int hc_get_kblight(struct host_cmd_handler_args *args)
|
||||
{
|
||||
struct ec_response_pwm_get_keyboard_backlight *r = args->response;
|
||||
if (!kblight_get)
|
||||
return EC_RES_UNAVAILABLE;
|
||||
r->percent = kblight_get();
|
||||
/* Assume always enabled */
|
||||
r->enabled = 1;
|
||||
args->response_size = sizeof(*r);
|
||||
return EC_RES_SUCCESS;
|
||||
}
|
||||
DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_KEYBOARD_BACKLIGHT,
|
||||
hc_get_kblight, EC_VER_MASK(0));
|
||||
|
||||
static int cc_kblight(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
Reference in New Issue
Block a user