From 420fb5eb3e862974644433381ae95d73a9b1a349 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Thu, 19 Mar 2015 10:14:13 -0700 Subject: [PATCH] i2c/ww_ring: stop running programs before loading the new ones The two controllers on the ring are programmed independently, and if the second controller is running the old pattern while the first one was loaded with a new pattern, there is a window of when the two unrelated patterns might interact. To avoid this shut down execution on both controllers before starting downloading the new pattern code. BRANCH=storm BUG=chrome-os-partner:36059 TEST=verified recovery/wipeout LED ring behavior did not change. Change-Id: I163f2983d414fe839208054ae3e9025663a46aeb Signed-off-by: Patrick Georgi Original-Commit-Id: 3502ca6b119c033855b45388e7b782d35cfdd82b Original-Change-Id: I0f71f94a7e82f6c0e7f98d3aad1f93ece207248f Original-Signed-off-by: Vadim Bendebury Original-Reviewed-on: https://chromium-review.googlesource.com/261200 Original-Reviewed-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/9872 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/drivers/i2c/ww_ring/ww_ring.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/drivers/i2c/ww_ring/ww_ring.c b/src/drivers/i2c/ww_ring/ww_ring.c index 780d0db0bb..bfecc60f40 100644 --- a/src/drivers/i2c/ww_ring/ww_ring.c +++ b/src/drivers/i2c/ww_ring/ww_ring.c @@ -349,6 +349,18 @@ int ww_ring_display_pattern(unsigned i2c_bus, enum display_pattern pattern) if (wwr_prog->led_pattern == pattern) { int j; + /* + * First stop all running programs to avoid + * inerference between the controllers. + */ + for (j = 0; j < WW_RING_NUM_LED_CONTROLLERS; j++) { + if (!lp55231s[j].dev_addr) + continue; + ledc_write_engctrl2 + (lp55231s + j, + LP55231_ENGCTRL2_ALL_DISABLE); + } + for (j = 0; j < WW_RING_NUM_LED_CONTROLLERS; j++) { if (!lp55231s[j].dev_addr) continue;