summaryrefslogtreecommitdiff
path: root/common/lightbar.c
diff options
context:
space:
mode:
authorEric Caruso <ejcaruso@chromium.org>2015-01-07 10:42:23 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-10 00:51:14 +0000
commit0c95dc3022e65428188403715513a7d5fc77a1f1 (patch)
treeeaa3102b544523b66c0589e004405ebe2ca84245 /common/lightbar.c
parent8c8f66197f80f94fa9de9d2166084c81ee368e3e (diff)
downloadchrome-ec-0c95dc3022e65428188403715513a7d5fc77a1f1.tar.gz
lightbar: Don't let EC control suspend/resume sequence
If the EC controls the lightbar and sets the sequence when it notices the chipset transitioning between states, we can't make exceptions for cases where we don't want to activate the lightbar, such as in dark resume. Instead, let's make it a separate command that we expect from the kernel. BUG=chrome-os-partner:32181 TEST=build on samus, verify lightbar does correct thing with manual control set BRANCH=ToT Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Change-Id: I5dc619cbbf2498e2ef03ce622831b33e14c7c495 Reviewed-on: https://chromium-review.googlesource.com/239215 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'common/lightbar.c')
-rw-r--r--common/lightbar.c21
1 files changed, 19 insertions, 2 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;