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 <pgeorgi@chromium.org>
Original-Commit-Id: 3502ca6b119c033855b45388e7b782d35cfdd82b
Original-Change-Id: I0f71f94a7e82f6c0e7f98d3aad1f93ece207248f
Original-Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/261200
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/9872
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Vadim Bendebury 2015-03-19 10:14:13 -07:00 committed by Patrick Georgi
parent 5fa5f99d47
commit 420fb5eb3e
1 changed files with 12 additions and 0 deletions

View File

@ -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;