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>
This commit is contained in:
parent
420fb5eb3e
commit
89994226e8
|
@ -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
|
* The three internal engines seem to be competing for resources and get out
|
||||||
* of sync in seconds if left running asynchronously.
|
* 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
|
* run away from each other in no time, resulting in some completely chaotic
|
||||||
* LED behavior.
|
* LED behavior.
|
||||||
*
|
*
|
||||||
* To keep the ring in check internal and external triggers are used which
|
* When solid patterns are deployed with instanteneous color intensity
|
||||||
* makes programs for controller1 and controller2 sligtly different.
|
* 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 first controller is loaded and started first, but it sits waiting for
|
||||||
* the trigger from the second controller to actually start the cycle.
|
* the trigger from the second controller to actually start the cycle. Once
|
||||||
*
|
* both controllers start running, the first controller is the master, sending
|
||||||
* In the middle of the cycle the first controller sends a sync back to the
|
* sych triggers to the second one each time the LED is supposed to be turned
|
||||||
* second one. Both controllers' engine1 also synchs up their respective
|
* on or off.
|
||||||
* engines 2 and 3.
|
|
||||||
*
|
*
|
||||||
* The maximum timer duration of lp55231 is .48 seconds. To achieve longer
|
* 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,
|
* The time granularity is set at .1 second (see commands 'wait 0.1' in the
|
||||||
* and then the loop counters can be set up to 63 (registers rb and rc), which
|
* code), and then the loop counters can be set up to 63 (registers rb and rc),
|
||||||
* allows to generate intervals up to 6.3 seconds in .1 second increments.
|
* 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_red: dw 0000000001001001b
|
||||||
row_green: dw 0000000010010010b
|
row_green: dw 0000000010010010b
|
||||||
row_blue: dw 0000000100100100b
|
row_blue: dw 0000000100100100b
|
||||||
|
|
||||||
.segment program1
|
.segment program1
|
||||||
ld ra, 255 ; red intensity
|
ld ra, 2 # LED on duration
|
||||||
ld rb, 2 ; up time 200 ms
|
ld rb, 10 # LED off duration
|
||||||
ld rc, 2 ; down time 200 ms
|
|
||||||
|
|
||||||
mux_map_addr row_red
|
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
|
|
||||||
wait1:
|
|
||||||
wait 0.1
|
|
||||||
branch rc, wait1
|
|
||||||
branch 0, loop1
|
|
||||||
|
|
||||||
|
|
||||||
.segment program2
|
|
||||||
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
|
|
||||||
wait2:
|
|
||||||
wait 0.1
|
|
||||||
branch 1, wait2
|
|
||||||
branch 0, loop2
|
|
||||||
|
|
||||||
|
|
||||||
.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
|
|
||||||
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
|
|
||||||
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
|
|
||||||
trigger w{e}
|
trigger w{e}
|
||||||
trigger s{2|3}
|
loop:
|
||||||
set_pwm 0
|
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:
|
wait1:
|
||||||
wait 0.1
|
wait 0.1
|
||||||
branch rc, wait1
|
branch ra, wait1
|
||||||
branch 0, loop1
|
trigger s{e}
|
||||||
|
set_pwm 0
|
||||||
|
mux_map_addr row_green
|
||||||
|
set_pwm 0
|
||||||
|
mux_map_addr row_red
|
||||||
|
set_pwm 0
|
||||||
|
wait2:
|
||||||
|
wait 0.1
|
||||||
|
branch rb, wait2
|
||||||
|
branch 0, loop
|
||||||
|
|
||||||
.segment program2
|
.segment program2
|
||||||
|
end
|
||||||
|
|
||||||
|
.segment program3
|
||||||
|
end*/
|
||||||
|
/*
|
||||||
|
* blink_solid2.src
|
||||||
|
|
||||||
|
row_red: dw 0000000001001001b
|
||||||
|
row_green: dw 0000000010010010b
|
||||||
|
row_blue: dw 0000000100100100b
|
||||||
|
|
||||||
|
.segment program1
|
||||||
|
ld ra, 98
|
||||||
|
ld rb, 0
|
||||||
|
ld rc, 234
|
||||||
|
trigger s{e}
|
||||||
|
mux_map_addr row_red
|
||||||
|
loop:
|
||||||
|
trigger w{e}
|
||||||
|
set_pwm ra ; red intensity
|
||||||
mux_map_addr row_green
|
mux_map_addr row_green
|
||||||
ld ra, 255
|
set_pwm rb ; green intensity
|
||||||
loop2: trigger w{1}
|
mux_map_addr row_blue
|
||||||
set_pwm ra
|
set_pwm rc ; blue intensity
|
||||||
common2:
|
wait1:
|
||||||
wait 0.1
|
wait 0.1
|
||||||
branch 1, common2
|
branch 1, wait1
|
||||||
trigger w{1}
|
trigger w{e}
|
||||||
|
set_pwm 0
|
||||||
|
mux_map_addr row_green
|
||||||
|
set_pwm 0
|
||||||
|
mux_map_addr row_red
|
||||||
set_pwm 0
|
set_pwm 0
|
||||||
wait2:
|
wait2:
|
||||||
wait 0.1
|
wait 0.1
|
||||||
branch 1, wait2
|
branch 1, wait2
|
||||||
branch 0, loop2
|
branch 0, loop
|
||||||
|
|
||||||
|
.segment program2
|
||||||
|
end
|
||||||
|
|
||||||
.segment program3
|
.segment program3
|
||||||
mux_map_addr row_blue
|
end
|
||||||
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
|
|
||||||
*/
|
|
||||||
static const uint8_t blink_wipeout1_text[] = {
|
static const uint8_t blink_wipeout1_text[] = {
|
||||||
0x00, 0x49, 0x00, 0x92, 0x01, 0x24, 0x90, 0xff,
|
0x00, 0x49, 0x00, 0x92, 0x01, 0x24, 0x90, 0x02,
|
||||||
0x94, 0x02, 0x98, 0x02, 0x9f, 0x80, 0xf0, 0x00,
|
0x94, 0x02, 0x9f, 0x80, 0xf0, 0x00, 0xe0, 0x40,
|
||||||
0xe0, 0x0c, 0x84, 0x60, 0x4c, 0x00, 0x86, 0x1d,
|
0x98, 0xff, 0x84, 0x62, 0x9f, 0x81, 0x98, 0xff,
|
||||||
0xe0, 0x4c, 0x40, 0x00, 0x4c, 0x00, 0x86, 0x2e,
|
0x84, 0x62, 0x9f, 0x82, 0x98, 0x00, 0x84, 0x62,
|
||||||
0xa0, 0x04, 0x9f, 0x81, 0x90, 0xff, 0xe0, 0x80,
|
0x4c, 0x00, 0x86, 0x34, 0xe0, 0x40, 0x40, 0x00,
|
||||||
0x84, 0x60, 0x4c, 0x00, 0xa0, 0x84, 0xe0, 0x80,
|
0x9f, 0x81, 0x40, 0x00, 0x9f, 0x80, 0x40, 0x00,
|
||||||
0x40, 0x00, 0x4c, 0x00, 0xa0, 0x88, 0xa0, 0x02,
|
0x4c, 0x00, 0x86, 0x55, 0xa0, 0x04, 0xc0, 0x00,
|
||||||
0x9f, 0x82, 0x90, 0x00, 0xe0, 0x80, 0x84, 0x60,
|
0xc0, 0x00, 0x00,
|
||||||
0x4c, 0x00, 0xa0, 0x84, 0xe0, 0x80, 0x40, 0x00,
|
|
||||||
0x4c, 0x00, 0xa0, 0x88, 0xa0, 0x02, 0x00, 0x00,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t blink_wipeout2_text[] = {
|
static const uint8_t blink_wipeout2_text[] = {
|
||||||
0x00, 0x49, 0x00, 0x92, 0x01, 0x24, 0x90, 0xff,
|
0x00, 0x49, 0x00, 0x92, 0x01, 0x24, 0x90, 0xff,
|
||||||
0x94, 0x02, 0x98, 0x02, 0x9f, 0x80, 0xe0, 0x4c,
|
0x94, 0xff, 0x98, 0x00, 0xe0, 0x40, 0x9f, 0x80,
|
||||||
0x84, 0x60, 0x4c, 0x00, 0x86, 0x19, 0xf0, 0x00,
|
0xf0, 0x00, 0x84, 0x60, 0x9f, 0x81, 0x84, 0x61,
|
||||||
0xe0, 0x0c, 0x40, 0x00, 0x4c, 0x00, 0x86, 0x2e,
|
0x9f, 0x82, 0x84, 0x62, 0x4c, 0x00, 0xa0, 0x8b,
|
||||||
0xa0, 0x04, 0x9f, 0x81, 0x90, 0xff, 0xe0, 0x80,
|
0xf0, 0x00, 0x40, 0x00, 0x9f, 0x81, 0x40, 0x00,
|
||||||
0x84, 0x60, 0x4c, 0x00, 0xa0, 0x84, 0xe0, 0x80,
|
0x9f, 0x80, 0x40, 0x00, 0x4c, 0x00, 0xa0, 0x93,
|
||||||
0x40, 0x00, 0x4c, 0x00, 0xa0, 0x88, 0xa0, 0x02,
|
0xa0, 0x05, 0xc0, 0x00, 0xc0, 0x00, 0x00,
|
||||||
0x9f, 0x82, 0x90, 0x00, 0xe0, 0x80, 0x84, 0x60,
|
|
||||||
0x4c, 0x00, 0xa0, 0x84, 0xe0, 0x80, 0x40, 0x00,
|
|
||||||
0x4c, 0x00, 0xa0, 0x88, 0xa0, 0x02, 0x00, 0x00,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const TiLp55231Program blink_wipeout1_program = {
|
static const TiLp55231Program blink_wipeout1_program = {
|
||||||
blink_wipeout1_text,
|
blink_wipeout1_text,
|
||||||
sizeof(blink_wipeout1_text),
|
sizeof(blink_wipeout1_text),
|
||||||
0,
|
0,
|
||||||
{ 3, 17, 28, }
|
{ 3, 27, 28, }
|
||||||
};
|
};
|
||||||
static const TiLp55231Program blink_wipeout2_program = {
|
static const TiLp55231Program blink_wipeout2_program = {
|
||||||
blink_wipeout2_text,
|
blink_wipeout2_text,
|
||||||
sizeof(blink_wipeout2_text),
|
sizeof(blink_wipeout2_text),
|
||||||
0,
|
0,
|
||||||
{ 3, 17, 28, }
|
{ 3, 26, 26, }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t blink_recovery1_text[] = {
|
static const uint8_t blink_recovery1_text[] = {
|
||||||
0x00, 0x49, 0x00, 0x92, 0x01, 0x24, 0x90, 0xff,
|
0x00, 0x49, 0x00, 0x92, 0x01, 0x24, 0x90, 0x02,
|
||||||
0x94, 0x02, 0x98, 0x02, 0x9f, 0x80, 0xf0, 0x00,
|
0x94, 0x02, 0x9f, 0x80, 0xf0, 0x00, 0xe0, 0x40,
|
||||||
0xe0, 0x0c, 0x84, 0x60, 0x4c, 0x00, 0x86, 0x1d,
|
0x98, 0xff, 0x84, 0x62, 0x9f, 0x81, 0x98, 0x3d,
|
||||||
0xe0, 0x4c, 0x40, 0x00, 0x4c, 0x00, 0x86, 0x2e,
|
0x84, 0x62, 0x9f, 0x82, 0x98, 0x00, 0x84, 0x62,
|
||||||
0xa0, 0x04, 0x9f, 0x81, 0x90, 0x3d, 0xe0, 0x80,
|
0x4c, 0x00, 0x86, 0x34, 0xe0, 0x40, 0x40, 0x00,
|
||||||
0x84, 0x60, 0x4c, 0x00, 0xa0, 0x84, 0xe0, 0x80,
|
0x9f, 0x81, 0x40, 0x00, 0x9f, 0x80, 0x40, 0x00,
|
||||||
0x40, 0x00, 0x4c, 0x00, 0xa0, 0x88, 0xa0, 0x02,
|
0x4c, 0x00, 0x86, 0x55, 0xa0, 0x04, 0xc0, 0x00,
|
||||||
0x90, 0x00, 0xe0, 0x80, 0x84, 0x60, 0x4c, 0x00,
|
0xc0, 0x00, 0x00,
|
||||||
0xa0, 0x83, 0xe0, 0x80, 0x40, 0x00, 0x4c, 0x00,
|
|
||||||
0xa0, 0x87, 0xa0, 0x01, 0x00, 0x00, 0x00,
|
|
||||||
};
|
};
|
||||||
static const TiLp55231Program blink_recovery1_program = {
|
static const TiLp55231Program blink_recovery1_program = {
|
||||||
blink_recovery1_text,
|
blink_recovery1_text,
|
||||||
sizeof(blink_recovery1_text),
|
sizeof(blink_recovery1_text),
|
||||||
0,
|
0,
|
||||||
{ 3, 17, 28, }
|
{ 3, 27, 28, }
|
||||||
};
|
};
|
||||||
static const uint8_t blink_recovery2_text[] = {
|
static const uint8_t blink_recovery2_text[] = {
|
||||||
0x00, 0x49, 0x00, 0x92, 0x01, 0x24, 0x90, 0xff,
|
0x00, 0x49, 0x00, 0x92, 0x01, 0x24, 0x90, 0xff,
|
||||||
0x94, 0x02, 0x98, 0x02, 0x9f, 0x80, 0xe0, 0x4c,
|
0x94, 0x3d, 0x98, 0x00, 0xe0, 0x40, 0x9f, 0x80,
|
||||||
0x84, 0x60, 0x4c, 0x00, 0x86, 0x19, 0xf0, 0x00,
|
0xf0, 0x00, 0x84, 0x60, 0x9f, 0x81, 0x84, 0x61,
|
||||||
0xe0, 0x0c, 0x40, 0x00, 0x4c, 0x00, 0x86, 0x2e,
|
0x9f, 0x82, 0x84, 0x62, 0x4c, 0x00, 0xa0, 0x8b,
|
||||||
0xa0, 0x04, 0x9f, 0x81, 0x90, 0x3d, 0xe0, 0x80,
|
0xf0, 0x00, 0x40, 0x00, 0x9f, 0x81, 0x40, 0x00,
|
||||||
0x84, 0x60, 0x4c, 0x00, 0xa0, 0x84, 0xe0, 0x80,
|
0x9f, 0x80, 0x40, 0x00, 0x4c, 0x00, 0xa0, 0x93,
|
||||||
0x40, 0x00, 0x4c, 0x00, 0xa0, 0x88, 0xa0, 0x02,
|
0xa0, 0x05, 0xc0, 0x00, 0xc0, 0x00, 0x00,
|
||||||
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,
|
|
||||||
};
|
};
|
||||||
static const TiLp55231Program blink_recovery2_program = {
|
static const TiLp55231Program blink_recovery2_program = {
|
||||||
blink_recovery2_text,
|
blink_recovery2_text,
|
||||||
sizeof(blink_recovery2_text),
|
sizeof(blink_recovery2_text),
|
||||||
0,
|
0,
|
||||||
{ 3, 17, 28, }
|
{ 3, 26, 26, }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue