When an external charger is connected, only the LED on the side the
charger is connected should be on, the other side should be off. The
existing LED behavior was incorrect in that only the side that was
charging was being updated and the other side would remain in its
previous state.
This CL adds a fix so that if only one LED is being controlled, the
other side is always turned off. In addition, the logic for double tap
events was changed slightly so that if a double tap event is in
progress and a charger is connected, the new state will be updated as
soon as the charge state is changed instead of waiting for the double
tap event to complete.
BUG=b:62481906
BRANCH=eve
TEST=Manual With battery level < 15% so that both LEDs are red when
the charger isn't connected, connect charger and verified that the LED
on the side the charger is connected turns white and the LED on the
other side turns off.
Change-Id: I7462629409496383adb43445e732dd6ca2f9f589
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/537960
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
The previous LED implementation was modelled on Kevin and enhanced to
give developer feedback. This CL implements the Eve specific LED
operation.
BUG=b:35584895
BRANCH=none
TEST=Manual
Used EC console command 'battfake' to force different charge levels
and verified that the expected LED patterns were generated.
Change-Id: I46bc2889540f320e8aadf3d9d634c36dbc38c161
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/516548
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
The led_get_brightness_range and led_set_brightness functions are only
used by the led control host command and exercised via ectool for
factory testing.
Currently the ectool inputs must be inverted to get expected behavior:
ectool led power red=100 green=100 blue=20 << blue
Instead we can invert them in the EC to get more intuitive behavior for
the user input values, and use the led_id parameter to split the control
so they can be addressed individually for testing:
ectool led left red=0 green=0 blue=80 << blue
ectool led right red=100 green=13 blue=0 << amber
BUG=b:36150361
BRANCH=none
TEST=Tested manual control of indivual LEDs using ectool
Change-Id: I6551656f3faf26930749d1e9d45a176088c6646c
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/453303
Reviewed-by: Scott Collyer <scollyer@chromium.org>
In order to prevent noise when using the system with a full
battery the EC can disable charging at full until it reaches
97% and then turn on charging again.
However this needs additional LED handling to ensure that the
charging LED is shown green in this state.
BUG=b:36024657
BRANCH=none
TEST=manual test with full battery on Eve P1b, ensure that the
LED is still green when battery is full and discharging.
Change-Id: Iad2b1462ad85163dc9702ff1154f3ff10eb0f7ca
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/450953
Reviewed-by: Scott Collyer <scollyer@chromium.org>
When debugging PWM on eve I noticed that every tick was adjusting
the pwm duty cycles for all LEDs, even if nothing changed. To keep
that from happening keep track of the current led state and only
adjust if it changes.
This also modifies the "on+charging" state to not set both LEDs to
blue and then change on to amber, but keep track of which side is
charging and set both LEDs to their expected colors.
Finally it fixes a bug with suspend and a full battery not blinking
the other side white to indicate suspend state.
BUG=chrome-os-partner:58666
BRANCH=none
TEST=ensure LEDs still behave as expected with charging and full
battery while in S0, S3, S5 states.
Change-Id: I98e5d5ad04b3e71da6fa4056e95f3661a9271ecf
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/446593
Reviewed-by: Scott Collyer <scollyer@chromium.org>
- Use amber for charge when in suspend/off states and leave red
to indicate something is wrong.
- Blink non-charging LED in S0ix/S3 states.
BUG=chrome-os-partner:60797
BRANCH=none
TEST=verify led operation in s3/s5 while charging
Change-Id: I16660942bf93f7cf6c951c19548c1c6838aabb72
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/438707
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Eve has two charge LEDs. This CL adds support to set a given color for
either left, right, or both LEDs. In addition, the LED policy for Eve
has been enhanced to accommodate separate charge LEDs.
Added amber and white color option plus console command 'led' can
choose the left/right side by adding 0|1 after the color.
S0: Default both LEDs are blue. If charger is connected, then the
active charging port's LED will be amber or green based on battery
level.
S3: If not charging, then both LEDs are blinking white. If charging
then follow same policy as S5.
S5: If not charging, then both LEDs are off. If charging then follow
previous policy, but applied only to the charging port's LED. The port
that isn't actively charging will have its LED off.
BRANCH=none
BUG=chrome-os-partner:60797
TEST=manual Verified the LEDs follow the operation as defined above.
Change-Id: I6f91d8a28999360aa620c7178d48c41625a1fa54
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/437404
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Eve has two 3 color PWM controlled LEDs. This CL adds basic support
for these LEDs so that they can be set to off, red, green, or blue. In
addition, the LED policy from Kevin is appropriated.
In S0 the LEDs will be blue.
In S3/S5 if no charger is connected, then the LEDs are off
If a charger is connected and the charge level is less than a
threshold, both LEDs are set to red. When the charge level gets above
a certain level or if the charge state is idle, then the LEDs are set
to green.
BRANCH=none
BUG=chrome-os-partner:60797
TEST=manual
Turn the system on so it's in S0, verify both LEDs are blue.
Close the lid with no external charger and verify that the LEDs are
both off. Connect the charger, and using battfake <> EC command verify
that when the charge level is less than the threshold the LEDs are
red, otherwise they are green. Set battfake to 0, and verified
flashing red.
Change-Id: I556ccdafde03cd5f5205e8948d5737dcbdc09d6d
Signed-off-by: Scott <scollyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/434146
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
Reviewed-by: Todd Broch <tbroch@chromium.org>