diff options
-rw-r--r-- | common/lightbar.c | 21 | ||||
-rw-r--r-- | include/ec_commands.h | 11 | ||||
-rw-r--r-- | util/ectool.c | 3 |
3 files changed, 31 insertions, 4 deletions
diff --git a/common/lightbar.c b/common/lightbar.c index ea9ce9b6d4..d5d0d85231 100644 --- a/common/lightbar.c +++ b/common/lightbar.c @@ -1571,21 +1571,26 @@ void lightbar_sequence_f(enum lightbar_sequence num, const char *f) /****************************************************************************/ /* Get notifications from other parts of the system */ +static uint8_t manual_suspend_control; + static void lightbar_startup(void) { + manual_suspend_control = 0; lightbar_sequence(LIGHTBAR_S5S3); } DECLARE_HOOK(HOOK_CHIPSET_STARTUP, lightbar_startup, HOOK_PRIO_DEFAULT); static void lightbar_resume(void) { - lightbar_sequence(LIGHTBAR_S3S0); + if (!manual_suspend_control) + lightbar_sequence(LIGHTBAR_S3S0); } DECLARE_HOOK(HOOK_CHIPSET_RESUME, lightbar_resume, HOOK_PRIO_DEFAULT); static void lightbar_suspend(void) { - lightbar_sequence(LIGHTBAR_S0S3); + if (!manual_suspend_control) + lightbar_sequence(LIGHTBAR_S0S3); } DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, lightbar_suspend, HOOK_PRIO_DEFAULT); @@ -1687,6 +1692,18 @@ static int lpc_cmd_lightbar(struct host_cmd_handler_args *args) out->version.flags = LIGHTBAR_IMPLEMENTATION_FLAGS; args->response_size = sizeof(out->version); break; + case LIGHTBAR_CMD_MANUAL_SUSPEND_CTRL: + CPRINTS("LB_manual_suspend_ctrl"); + manual_suspend_control = in->manual_suspend_ctrl.enable; + break; + case LIGHTBAR_CMD_SUSPEND: + CPRINTS("LB_suspend"); + lightbar_sequence(LIGHTBAR_S0S3); + break; + case LIGHTBAR_CMD_RESUME: + CPRINTS("LB_resume"); + lightbar_sequence(LIGHTBAR_S3S0); + break; default: CPRINTS("LB bad cmd 0x%x", in->cmd); return EC_RES_INVALID_PARAM; diff --git a/include/ec_commands.h b/include/ec_commands.h index 55aef77a7a..898d502c6c 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -1073,7 +1073,7 @@ struct ec_params_lightbar { struct { /* no args */ } dump, off, on, init, get_seq, get_params_v0, get_params_v1, - version, get_brightness, get_demo; + version, get_brightness, get_demo, suspend, resume; struct { uint8_t num; @@ -1091,6 +1091,10 @@ struct ec_params_lightbar { uint8_t led; } get_rgb; + struct { + uint8_t enable; + } manual_suspend_ctrl; + struct lightbar_params_v0 set_params_v0; struct lightbar_params_v1 set_params_v1; struct lightbar_program set_program; @@ -1127,7 +1131,7 @@ struct ec_response_lightbar { /* no return params */ } off, on, init, set_brightness, seq, reg, set_rgb, demo, set_params_v0, set_params_v1, - set_program; + set_program, manual_suspend_ctrl, suspend, resume; }; } __packed; @@ -1152,6 +1156,9 @@ enum lightbar_command { LIGHTBAR_CMD_GET_PARAMS_V1 = 16, LIGHTBAR_CMD_SET_PARAMS_V1 = 17, LIGHTBAR_CMD_SET_PROGRAM = 18, + LIGHTBAR_CMD_MANUAL_SUSPEND_CTRL = 19, + LIGHTBAR_CMD_SUSPEND = 20, + LIGHTBAR_CMD_RESUME = 21, LIGHTBAR_NUM_CMDS }; diff --git a/util/ectool.c b/util/ectool.c index 4509951dbd..58d5a5c819 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -1714,6 +1714,9 @@ static const struct { LB_SIZES(get_params_v1), LB_SIZES(set_params_v1), LB_SIZES(set_program), + LB_SIZES(manual_suspend_ctrl), + LB_SIZES(suspend), + LB_SIZES(resume), }; #undef LB_SIZES |