summaryrefslogtreecommitdiff
path: root/common/lightbar.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-09-12 00:29:49 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-09-19 12:27:21 -0700
commite24cca580ef0b83ff86cbf9273653a821b6f8f14 (patch)
tree21c914aba10102c46c5fee3d92c3638210de33d2 /common/lightbar.c
parentd341615383f1ea5d3a540a67bcec777ba902bdfb (diff)
downloadchrome-ec-e24cca580ef0b83ff86cbf9273653a821b6f8f14.tar.gz
common: lightbar: put multiple commands under i2c_lock
If other i2c traffic happens around the time the light bar is initialized, the i2c bus is wedged. Instead of waiting 500ms in the motion task loop for the tap sequence to complete, set under i2c lock the lp power and init sequence. BRANCH=smaug, samus BUG=chrome-os-partner:45223 TEST=With msleep(500) removed and With lb_power + lb_init + 100ms, I don't see the wedge at TAP sequence. Change-Id: I931eb25bcc5e3237b6c569f2330f72f9fc415964 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/299543 Reviewed-by: Bill Richardson <wfrichar@google.com>
Diffstat (limited to 'common/lightbar.c')
-rw-r--r--common/lightbar.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/common/lightbar.c b/common/lightbar.c
index 27749c5faf..b7f7bcf680 100644
--- a/common/lightbar.c
+++ b/common/lightbar.c
@@ -429,7 +429,7 @@ static uint32_t sequence_S3S0(void)
int ci;
uint32_t res;
- lb_init();
+ lb_init(1);
lb_on();
get_battery_level();
@@ -623,7 +623,7 @@ static uint32_t sequence_S3(void)
int ci;
lb_off();
- lb_init();
+ lb_init(1);
lb_set_rgb(NUM_LEDS, 0, 0, 0);
while (1) {
WAIT_OR_RET(st.p.s3_sleep_for);
@@ -669,7 +669,7 @@ static uint32_t sequence_S5S3(void)
* respond. Don't return early, because we still want to initialize the
* lightbar even if another message comes along while we're waiting. */
usleep(100);
- lb_init();
+ lb_init(1);
lb_set_rgb(NUM_LEDS, 0, 0, 0);
lb_on();
/* next sequence */
@@ -732,7 +732,6 @@ static uint32_t sequence_S5(void)
#ifdef CONFIG_LIGHTBAR_POWER_RAILS
/* Request that lightbar power rails be turned on. */
if (lb_power(1)) {
- lb_init();
lb_set_rgb(NUM_LEDS, 0, 0, 0);
}
#endif
@@ -788,7 +787,7 @@ static uint32_t sequence_RUN(void)
*/
static uint32_t sequence_ERROR(void)
{
- lb_init();
+ lb_init(1);
lb_on();
lb_set_rgb(0, 255, 255, 255);
@@ -1062,7 +1061,6 @@ static uint32_t sequence_TAP(void)
#ifdef CONFIG_LIGHTBAR_POWER_RAILS
/* Request that the lightbar power rails be turned on. */
if (lb_power(1)) {
- lb_init();
lb_set_rgb(NUM_LEDS, 0, 0, 0);
}
#endif
@@ -1667,7 +1665,7 @@ static int lpc_cmd_lightbar(struct host_cmd_handler_args *args)
lb_on();
break;
case LIGHTBAR_CMD_INIT:
- lb_init();
+ lb_init(1);
break;
case LIGHTBAR_CMD_SET_BRIGHTNESS:
lb_set_brightness(in->set_brightness.num);
@@ -1905,7 +1903,7 @@ static int command_lightbar(int argc, char **argv)
}
if (!strcasecmp(argv[1], "init")) {
- lb_init();
+ lb_init(1);
return EC_SUCCESS;
}