diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2015-03-18 22:54:04 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-04-22 19:57:37 +0200 |
commit | 89994226e8bdc4a36152d53e9590f2f3c1b1e7cc (patch) | |
tree | 4078a05ddb51a0d75e699fb0f196ece30cf65fd0 /src/drivers/i2c | |
parent | 420fb5eb3e862974644433381ae95d73a9b1a349 (diff) | |
download | coreboot-89994226e8bdc4a36152d53e9590f2f3c1b1e7cc.tar.xz |
i2c/ww_ring: use shorter blinking program
The originally loaded blinking program was written to allow gradual
change in LED brightness, which required controlling each LED with its
own engine. In fact there is no need in gradual brightness changes
when the firmware is controlling the ring. This allows to control all
LEDs by one engine, making the code simpler and more robust (no need
to synchronize the three engines any more).
BRANCH=storm
BUG=chrome-os-partner:36059
TEST=verified that recovery boot WW ring patterns work as expected.
Change-Id: I89d231fb61693f4e834d8d9323ae5a7ddd149525
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 19809cf8120df8865da9b5b9e7b8e932334bf4b5
Original-Change-Id: I41038fd976dc9600f223dc0e9c9602331baf68f9
Original-Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/261026
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/9873
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/drivers/i2c')
-rw-r--r-- | src/drivers/i2c/ww_ring/ww_ring_programs.c | 229 |
1 files changed, 95 insertions, 134 deletions
diff --git a/src/drivers/i2c/ww_ring/ww_ring_programs.c b/src/drivers/i2c/ww_ring/ww_ring_programs.c index 81c18915ad..8f32a76c44 100644 --- a/src/drivers/i2c/ww_ring/ww_ring_programs.c +++ b/src/drivers/i2c/ww_ring/ww_ring_programs.c @@ -95,7 +95,7 @@ static const TiLp55231Program solid_000000_program = { }; /* - * Blinking patterns are much tricker then solid ones. + * Blinking patterns are trickier then solid ones. * * The three internal engines seem to be competing for resources and get out * of sync in seconds if left running asynchronously. @@ -104,209 +104,170 @@ static const TiLp55231Program solid_000000_program = { * run away from each other in no time, resulting in some completely chaotic * LED behavior. * - * To keep the ring in check internal and external triggers are used which - * makes programs for controller1 and controller2 sligtly different. + * When solid patterns are deployed with instanteneous color intensity + * changes, all three LEDs can be controlled by one engine in sequential + * accesses. But the controllers still neeed to be synchronized. * * The first controller is loaded and started first, but it sits waiting for - * the trigger from the second controller to actually start the cycle. - * - * In the middle of the cycle the first controller sends a sync back to the - * second one. Both controllers' engine1 also synchs up their respective - * engines 2 and 3. + * the trigger from the second controller to actually start the cycle. Once + * both controllers start running, the first controller is the master, sending + * sych triggers to the second one each time the LED is supposed to be turned + * on or off. * * The maximum timer duration of lp55231 is .48 seconds. To achieve longer - * blinking intervals the loops delays are deployed. + * blinking intervals the loops delays are deployed. Only the first controller + * intervals need to be changed, as the second one is in lockstep with the + * first. * - * The granularity is set at .1 second (see commands 'wait 0.1' in the code, - * and then the loop counters can be set up to 63 (registers rb and rc), which - * allows to generate intervals up to 6.3 seconds in .1 second increments. + * The time granularity is set at .1 second (see commands 'wait 0.1' in the + * code), and then the loop counters can be set up to 63 (registers rb and rc), + * which allows to generate intervals up to 6.3 seconds in .1 second + * increments. */ -/* blink_solid1.src +/* + * blink_solid1.src row_red: dw 0000000001001001b row_green: dw 0000000010010010b row_blue: dw 0000000100100100b .segment program1 - ld ra, 255 ; red intensity - ld rb, 2 ; up time 200 ms - ld rc, 2 ; down time 200 ms - + ld ra, 2 # LED on duration + ld rb, 10 # LED off duration mux_map_addr row_red -loop1: trigger w{e} ; wait for external trigger from 2nd controller - trigger s{2|3} - set_pwm ra -common1: - wait 0.1 - branch rb, common1 - trigger s{2|3|e} - set_pwm 0 + trigger w{e} +loop: + trigger s{e} + ld rc, 98 ; red intensity + set_pwm rc + mux_map_addr row_green + ld rc, 0 ; green intensity + set_pwm rc + mux_map_addr row_blue + ld rc, 234 ; blue intensity + set_pwm rc wait1: wait 0.1 - branch rc, wait1 - branch 0, loop1 - - -.segment program2 + branch ra, wait1 + trigger s{e} + set_pwm 0 mux_map_addr row_green - ld ra, 255 ; green intensity -loop2: trigger w{1} - set_pwm ra -common2: - ; engine 2 and 3 intervals are controlled by sync with engine 1 - wait 0.1 - branch 1, common2 - trigger w{1} + set_pwm 0 + mux_map_addr row_red set_pwm 0 wait2: wait 0.1 - branch 1, wait2 - branch 0, loop2 + branch rb, wait2 + branch 0, loop +.segment program2 + end .segment program3 - ld ra, 0 ; blue intensity -loop3: trigger w{1} - set_pwm ra -common3: - wait 0.1 - branch 1, common3 - trigger w{1} - set_pwm 0 -wait3: - wait 0.1 - branch 1, wait3 - branch 0, loop3 -*/ -/* blink_solid2.src + end*/ +/* + * blink_solid2.src + row_red: dw 0000000001001001b row_green: dw 0000000010010010b row_blue: dw 0000000100100100b .segment program1 - ld ra, 255 ; red intensity - ld rb, 2 ; up time - ld rc, 2 ; down time + ld ra, 98 + ld rb, 0 + ld rc, 234 + trigger s{e} mux_map_addr row_red -loop1: trigger s{2|3|e} ; send trigger to own engines and the first controller - set_pwm ra -common1: - wait 0.1 - branch rb, common1 +loop: trigger w{e} - trigger s{2|3} - set_pwm 0 + set_pwm ra ; red intensity + mux_map_addr row_green + set_pwm rb ; green intensity + mux_map_addr row_blue + set_pwm rc ; blue intensity wait1: wait 0.1 - branch rc, wait1 - branch 0, loop1 - - -.segment program2 + branch 1, wait1 + trigger w{e} + set_pwm 0 mux_map_addr row_green - ld ra, 255 -loop2: trigger w{1} - set_pwm ra -common2: - wait 0.1 - branch 1, common2 - trigger w{1} + set_pwm 0 + mux_map_addr row_red set_pwm 0 wait2: wait 0.1 branch 1, wait2 - branch 0, loop2 + branch 0, loop +.segment program2 + end .segment program3 - mux_map_addr row_blue - ld ra, 0 -loop3: trigger w{1} - set_pwm ra -common3: - wait 0.1 - branch 1, common3 - trigger w{1} - set_pwm 0 -wait3: - wait 0.1 - branch 1, wait3 - branch 0, loop3 - */ + end +*/ static const uint8_t blink_wipeout1_text[] = { - 0x00, 0x49, 0x00, 0x92, 0x01, 0x24, 0x90, 0xff, - 0x94, 0x02, 0x98, 0x02, 0x9f, 0x80, 0xf0, 0x00, - 0xe0, 0x0c, 0x84, 0x60, 0x4c, 0x00, 0x86, 0x1d, - 0xe0, 0x4c, 0x40, 0x00, 0x4c, 0x00, 0x86, 0x2e, - 0xa0, 0x04, 0x9f, 0x81, 0x90, 0xff, 0xe0, 0x80, - 0x84, 0x60, 0x4c, 0x00, 0xa0, 0x84, 0xe0, 0x80, - 0x40, 0x00, 0x4c, 0x00, 0xa0, 0x88, 0xa0, 0x02, - 0x9f, 0x82, 0x90, 0x00, 0xe0, 0x80, 0x84, 0x60, - 0x4c, 0x00, 0xa0, 0x84, 0xe0, 0x80, 0x40, 0x00, - 0x4c, 0x00, 0xa0, 0x88, 0xa0, 0x02, 0x00, 0x00, + 0x00, 0x49, 0x00, 0x92, 0x01, 0x24, 0x90, 0x02, + 0x94, 0x02, 0x9f, 0x80, 0xf0, 0x00, 0xe0, 0x40, + 0x98, 0xff, 0x84, 0x62, 0x9f, 0x81, 0x98, 0xff, + 0x84, 0x62, 0x9f, 0x82, 0x98, 0x00, 0x84, 0x62, + 0x4c, 0x00, 0x86, 0x34, 0xe0, 0x40, 0x40, 0x00, + 0x9f, 0x81, 0x40, 0x00, 0x9f, 0x80, 0x40, 0x00, + 0x4c, 0x00, 0x86, 0x55, 0xa0, 0x04, 0xc0, 0x00, + 0xc0, 0x00, 0x00, }; static const uint8_t blink_wipeout2_text[] = { 0x00, 0x49, 0x00, 0x92, 0x01, 0x24, 0x90, 0xff, - 0x94, 0x02, 0x98, 0x02, 0x9f, 0x80, 0xe0, 0x4c, - 0x84, 0x60, 0x4c, 0x00, 0x86, 0x19, 0xf0, 0x00, - 0xe0, 0x0c, 0x40, 0x00, 0x4c, 0x00, 0x86, 0x2e, - 0xa0, 0x04, 0x9f, 0x81, 0x90, 0xff, 0xe0, 0x80, - 0x84, 0x60, 0x4c, 0x00, 0xa0, 0x84, 0xe0, 0x80, - 0x40, 0x00, 0x4c, 0x00, 0xa0, 0x88, 0xa0, 0x02, - 0x9f, 0x82, 0x90, 0x00, 0xe0, 0x80, 0x84, 0x60, - 0x4c, 0x00, 0xa0, 0x84, 0xe0, 0x80, 0x40, 0x00, - 0x4c, 0x00, 0xa0, 0x88, 0xa0, 0x02, 0x00, 0x00, + 0x94, 0xff, 0x98, 0x00, 0xe0, 0x40, 0x9f, 0x80, + 0xf0, 0x00, 0x84, 0x60, 0x9f, 0x81, 0x84, 0x61, + 0x9f, 0x82, 0x84, 0x62, 0x4c, 0x00, 0xa0, 0x8b, + 0xf0, 0x00, 0x40, 0x00, 0x9f, 0x81, 0x40, 0x00, + 0x9f, 0x80, 0x40, 0x00, 0x4c, 0x00, 0xa0, 0x93, + 0xa0, 0x05, 0xc0, 0x00, 0xc0, 0x00, 0x00, }; static const TiLp55231Program blink_wipeout1_program = { blink_wipeout1_text, sizeof(blink_wipeout1_text), 0, - { 3, 17, 28, } + { 3, 27, 28, } }; static const TiLp55231Program blink_wipeout2_program = { blink_wipeout2_text, sizeof(blink_wipeout2_text), 0, - { 3, 17, 28, } + { 3, 26, 26, } }; static const uint8_t blink_recovery1_text[] = { - 0x00, 0x49, 0x00, 0x92, 0x01, 0x24, 0x90, 0xff, - 0x94, 0x02, 0x98, 0x02, 0x9f, 0x80, 0xf0, 0x00, - 0xe0, 0x0c, 0x84, 0x60, 0x4c, 0x00, 0x86, 0x1d, - 0xe0, 0x4c, 0x40, 0x00, 0x4c, 0x00, 0x86, 0x2e, - 0xa0, 0x04, 0x9f, 0x81, 0x90, 0x3d, 0xe0, 0x80, - 0x84, 0x60, 0x4c, 0x00, 0xa0, 0x84, 0xe0, 0x80, - 0x40, 0x00, 0x4c, 0x00, 0xa0, 0x88, 0xa0, 0x02, - 0x90, 0x00, 0xe0, 0x80, 0x84, 0x60, 0x4c, 0x00, - 0xa0, 0x83, 0xe0, 0x80, 0x40, 0x00, 0x4c, 0x00, - 0xa0, 0x87, 0xa0, 0x01, 0x00, 0x00, 0x00, + 0x00, 0x49, 0x00, 0x92, 0x01, 0x24, 0x90, 0x02, + 0x94, 0x02, 0x9f, 0x80, 0xf0, 0x00, 0xe0, 0x40, + 0x98, 0xff, 0x84, 0x62, 0x9f, 0x81, 0x98, 0x3d, + 0x84, 0x62, 0x9f, 0x82, 0x98, 0x00, 0x84, 0x62, + 0x4c, 0x00, 0x86, 0x34, 0xe0, 0x40, 0x40, 0x00, + 0x9f, 0x81, 0x40, 0x00, 0x9f, 0x80, 0x40, 0x00, + 0x4c, 0x00, 0x86, 0x55, 0xa0, 0x04, 0xc0, 0x00, + 0xc0, 0x00, 0x00, }; static const TiLp55231Program blink_recovery1_program = { blink_recovery1_text, sizeof(blink_recovery1_text), 0, - { 3, 17, 28, } + { 3, 27, 28, } }; static const uint8_t blink_recovery2_text[] = { 0x00, 0x49, 0x00, 0x92, 0x01, 0x24, 0x90, 0xff, - 0x94, 0x02, 0x98, 0x02, 0x9f, 0x80, 0xe0, 0x4c, - 0x84, 0x60, 0x4c, 0x00, 0x86, 0x19, 0xf0, 0x00, - 0xe0, 0x0c, 0x40, 0x00, 0x4c, 0x00, 0x86, 0x2e, - 0xa0, 0x04, 0x9f, 0x81, 0x90, 0x3d, 0xe0, 0x80, - 0x84, 0x60, 0x4c, 0x00, 0xa0, 0x84, 0xe0, 0x80, - 0x40, 0x00, 0x4c, 0x00, 0xa0, 0x88, 0xa0, 0x02, - 0x9f, 0x82, 0x90, 0x00, 0xe0, 0x80, 0x84, 0x60, - 0x4c, 0x00, 0xa0, 0x84, 0xe0, 0x80, 0x40, 0x00, - 0x4c, 0x00, 0xa0, 0x88, 0xa0, 0x02, 0x00, 0x00, - 0x00, + 0x94, 0x3d, 0x98, 0x00, 0xe0, 0x40, 0x9f, 0x80, + 0xf0, 0x00, 0x84, 0x60, 0x9f, 0x81, 0x84, 0x61, + 0x9f, 0x82, 0x84, 0x62, 0x4c, 0x00, 0xa0, 0x8b, + 0xf0, 0x00, 0x40, 0x00, 0x9f, 0x81, 0x40, 0x00, + 0x9f, 0x80, 0x40, 0x00, 0x4c, 0x00, 0xa0, 0x93, + 0xa0, 0x05, 0xc0, 0x00, 0xc0, 0x00, 0x00, }; static const TiLp55231Program blink_recovery2_program = { blink_recovery2_text, sizeof(blink_recovery2_text), 0, - { 3, 17, 28, } + { 3, 26, 26, } }; |