This is part one of a series to merge the keyboard scan interface to
be common across all platforms.
This change just moves and renames files and APIs and removes some
read code, and sets up protocol-specific CONFIG options. It makes the
next CL which actually merges keyboard scanning easier to parse.
BUG=chrome-os-partner:18360
BRANCH=none
TEST=compile all boards; test keyboard on spring and link
Change-Id: I815a40aae4e5d5f333b8501aff9656080533d913
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46549
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This mode was disabled initially to make sure it didn't side-effect
things during early development. Now that branch is cut lets
re-enable and backport when stability is proven.
Signed-off-by: Todd Broch <tbroch@chromium.org>
BRANCH=spring
BUG=chrome-os-partner:17587
TEST=manual, install & run on Spring ... system functions.
When device is plugged stays awake regardless of battery state.
When device is unplugged sleeps and power is saved.
When device is re-plugged awakes.
Change-Id: I9a85fa7376d1a94c9864beed3d053e8b49480959
Reviewed-on: https://gerrit.chromium.org/gerrit/45594
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
This more closely emulates what LM4 does if it hibernates and then
immediately wakes. Keeps the system from becoming silently
unresponsive if a hibernate is triggered on STM32.
BUG=chrome-os-partner:18371
BRANCH=none
TEST=from ec console, 'hibernate' reboots instead of hanging
Change-Id: I031f79239725d69ba054323e4fbf8f59133f2093
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46286
Reviewed-by: Vic Yang <victoryang@chromium.org>
These were previously duplicated between multiple keyboard_scan.c and
board.c files, and there were a bunch of different constants #defined
to be 13.
BUG=chrome-os-partner:18360
BRANCH=none
TEST=compile all boards; test keyboard on spring and link
Change-Id: I91bf9d56d2a56ff25ff307ff10883ca87b6937e5
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46165
This is the low-level platform-dependent interface to drive keyboard
columns, read rows, and handle keyboard interrupts.
Both lm4 and stm32 had something like this before, but the interfaces
weren't fully explicit or compatible.
BUG=chrome-os-partner:18360
BRANCH=none
TEST=manual
- Build all platforms.
- Boot system and test typing on keyboard.
- Hold power+refresh+esc to test boot key detection; should go to recovery.
Change-Id: Ie3bcc1d066a4da5204f0e236daeb52c4064a6213
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46156
Now that PMU task is waken not only by timer, we shouldn't depend on
retry count anymore. This moves pre-charging timeout to actually use
timestamp.
BUG=none
TEST=Remove battery and boot. See charge state goes to error after 15
seconds.
BRANCH=spring
Change-Id: Iff587bc824ffee93650184c14f1fc403d26ebc06
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45957
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
No functionality change.
This includes:
- Breaking the way-too-long function into multiple functions
- Less verbose logging code
BUG=none
TEST=Build and check USB charging still works.
BRANCH=spring
Change-Id: I8524cb3da9a0e90427664e839ce33d3abe0263a0
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45842
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
When AP is off and no charger is attached, we can safely disable boost
to save power.
BUG=chrome-os-partner:18305
TEST=1. AP off, no charger -> BOOST_EN 0
2. AP off, with charger -> BOOST_EN 1
3. AP on, no charger -> BOOST_EN 1
4. AP on, with charger -> BOOST_EN 1
5. AP on->off, no charger -> BOOST_EN 1->0
6. AP off->on, no charger -> BOOST_EN 0->1
BRANCH=spring
Change-Id: I7ff49e51057126490d09a3f0b1be2c60ca6a9bd3
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45830
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
When battery level is too low, we want to keep the AP off even when a
power on event is received. Current threshold is set to 1 mAh.
Note that after this change, a board without a battery will need to wait
for 15 seconds before it can boot up.
BUG=chrome-os-partner:18318
TEST=Press power button and see power on event ignored. Charge battery
to over AP off threshold and check we can power on the system.
BRANCH=spring
Change-Id: If32a1935a69be102778bde7ad8976eea0921f87e
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45825
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
The implementation is identical on all stm32 hardware, so remove all
the duplicate copies from board.c files. mccrosskey doesn't have
GPIO_EC_INT so stub it out like we do on bds.
No functional change, just moving code.
BUG=none
BRANCH=none
TEST=build mccrosskey,daisy,snow,spring
Change-Id: I7d4378650d7b4c640c15180c41459a41620f5bd3
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45920
It's not board-specific, so move it out of board.c.
No functional changes; this is just moving code and renaming a few functions.
BUG=chrome-os-partner:18256
BRANCH=none
TEST=build spring
Change-Id: Ib004066aed93745cb0c96d3cb45d70b728545492
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45918
We have a common chipset interface for performing a warm reset of the
AP, so move the implementation from system_warm_reboot() there. (It
was never a system function anyway; system = EC+AP; chipset = AP)
No functional change; just renaming functions.
BUG=chrome-os-partner:18343
BRANCH=none
TEST=build daisy,snow,spring,mccroskey
Change-Id: Ibc2c5efced5660c4335cd1868470184397800acd
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45891
It's only board-specific in that we've only needed it on snow so far.
But by that logic, x86_power would be board specific because we've
only needed it on link.
No functionality change, just moving code between files and renaming
the interface to indicate it's not board-specific.
BUG=chrome-os-partner:18343
BRANCH=none
TEST=build daisy,snow,spring
Change-Id: I35debdaa71829d55a2fbc5d3c62b2aaf6e467633
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45879
When Toad's ID changes, VBUS goes low for 10ms. This, however, is not
picked up by TSU6721 and thus we need to monitor VBUS and reset TSU6721
when necessary. By resetting TSU6721, we can force it to update device
type.
BUG=chrome-os-partner:18292
TEST=manual
BRANCH=spring
Change-Id: Ib96bbb0f101c8c5f5371591603af2dee27f01cc8
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45727
Apparently the presubmit queue isn't building Spring firmware? My
change and Vic's collided and TOT doesn't compile. This fixes it.
BUG=none
BRANCH=none
TEST=build spring
Change-Id: I3903c7dce741d4395d0d71585da4332b47f62aba
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45901
This includes:
- Discharging with AC present now recognized as battery assist mode
- Trigger LED update every second instead of from PMU task
- Minor breathing effect optimization
- Control LED power and color from the same task to prevent
simultaneous access to LED driver
BUG=chrome-os-partner:18244
TEST=Manual
BRANCH=spring
Change-Id: I9b34934f46cd4f04aaa7ca30cbe90316aec3e61e
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45632
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Code cleanup: declare keyboard_scan_interrupt() once, not per board;
the implementation is common anyway.
No functional changes; just renaming.
BUG=none
BRANCH=none
TEST=build daisy,snow,spring,mccrosskey
Change-Id: I1e33cbe2c868bc47b641d36d26f07c3b5a7ba3c7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45874
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Code cleanup; use the same function names to mean the same thing
across boards. No functional changes; just renaming.
BUG=none
BRANCH=none
TEST=build daisy,snow,spring
Change-Id: Icbb4cfda5f5f9ba0cbbc07fee622e9c21af3f8cd
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45867
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
Rename tasks
TICK -> HOOKS
The hooks task handles more than just the TICK hook now.
X86POWER -> CHIPSET
GAIAPOWER -> CHIPSET
Kinda kludgy that the name of the task controls which chipset source gets
included. Change this to a CONFIG_CHIPSET_{X86,GAIA} #define to make it
easier to support future chipsets. Also, rename the task function to
chipset_task() so ec.tasklist is chipset-agnostic.
No code changes, just renaming constants and functions.
BUG=none
BRANCH=none
TEST=build bds,link,daisy,snow,spring
Change-Id: I163ce1cd27b2d8d030d42bb1f7eb46b880c244fb
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45805
Now that it doesn't need to leverage SWITCH_TASK to send the AC_CHANGE
notification, pure GPIO-based external power detection can move from
switch.c to its own file.
BUG=chrome-os-partner:18256
BRANCH=none
TEST=add AC power, UI shows charging indicator; remove AC, indicator goes away
Change-Id: Id495f34185b7d971c241ac6d0a8311a6bf544507
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45789
Using code like this, modules which service interrupts and notify
hooks will no longer need to have their own tasks to call
hook_notify() from. They can share the hook task as long as they
don't mind the notification possibly being deferred.
BUG=chrome-os-partner:18256
BRANCH=none
TEST=add AC power, UI shows charging indicator; remove AC, indicator goes away
Change-Id: I1bc32d21b2202c3242d39e0fc533198cd5bb9c66
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45780
Push the PWM frequency outside the audio band to avoid audible whining.
Also fix the off-by-one in the PWM frequency computation.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=spring
BUG=chrome-os-partner:17583
TEST=manual : probe the PWM output with a scope.
Change-Id: Ie1c8c5aed72bef46c8bac16c1bf3007e8e9573bb
Reviewed-on: https://gerrit.chromium.org/gerrit/45584
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Modules that need to find out about charge/power state no longer need
to use the lower-level switch API.
(This will matter more in future CLs which handle conditions like
"external power present, but at low power so we're doing battery
assist" - that can simply be state=discharging,flags=external_power_present.
BUG=chrome-os-partner:18256
BRANCH=none
TEST=add AC power, UI shows charging indicator; remove AC, indicator goes away
Change-Id: I62130a4e089297fa47ab03f6a76082593c936761
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45515
Reviewed-by: Vic Yang <victoryang@chromium.org>
No code changes, just renaming to make the filename more useful.
BUG=chromium-os:18256
BRANCH=none
TEST=build link. Plug in AC. See plug LED come on.
Change-Id: I00d9f222de0b097bb68ef235bc6b0015e4c62f7e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45494
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
The power LED now has its own tick-based handler which knows how to
blink the LED and resend the desired LED state to work around the
flaky 1-wire connection.
Removes a bunch of LED state code from charge_state.c.
No user-visible impact. Does not need to go into link branch.
BUG=chromium-os:18256
BRANCH=none
TEST=manual
1) Discharge battery to <97%
2) Plug in AC. LED=yellow
3) 'ectool chargeforceidle 1' from root shell. LED=blinking green/off.
4) 'ectool chargeforceidle 0' from root shell. LED=yellow.
5) Wait for battery >= 97% (or 'battfake 98' from EC console). LED=green.
6) Unplug battery. LED=red (may take 10 sec).
7) Replug battery. LED=green.
Change-Id: I999ee3e1abe269bb3f737bbc75e0b872316605ce
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45469
Reviewed-by: Vic Yang <victoryang@chromium.org>
When leaving breathing mode, we should switch yellow LED from lighting
engine back to PWM control.
BUG=chrome-os-partner:18244
TEST=Check yellow LED leaves breathing mode
BRANCH=spring
Change-Id: I39260ac9040baaf193ce95eec7941aeb6d97e7e8
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45436
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This adds a board target for McCroskey. It is loosely based on
Snow.
The clock will be set up differently and the keyboard GPIOs are
not the same, so some stm32 code needed to be updated.
BUG=none
BRANCH=none
TEST=tested on McCroskey (we get to the serial console)
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Change-Id: I5e11a3257fed1797f4cc4dcccf3530585b78da82
Reviewed-on: https://gerrit.chromium.org/gerrit/43414
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
This re-factors read_raw_input_state() to use GPIO port and mask
values from the board's gpio_list array. This eliminates the reliance
on hard-coded bit mask values and ports, thus making the code
adaptable for future designs.
As a slight optimization, the GPIO input data register is re-read
only if the port changes from the previous iteration. Thus, it's best
if the GPIOs are listed such that changes to the port address are
minimized.
BUG=none
BRANCH=none
TEST=Tested on Snow by running finger across keys.
Change-Id: I4a79363f060f37690bfebfd6763f7bfe6cb7991a
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44993
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
For chromeos devices with the stm32 EC we write the firmware via
uart. Often developers are connected to this UART for console I/O
which causes flash_ec to fail.
This change looks for any pids currently attached to the UART and
forcibly kills them prior to attempting to write the firmware.
Signed-off-by: Todd Broch <tbroch@chromium.org>
BRANCH=spring
BUG=none
TEST=manual,
./util/flash_ec --board spring ...
Forcibly grabs UART from both:
cu -l /dev/pts/<num>
minicom -p /dev/pts/<num>
Change-Id: Ie2a2b7aaf437c2cedd1d16e399c63068f2b02da3
Reviewed-on: https://gerrit.chromium.org/gerrit/45217
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
This adds some documentation explaining the method to the madness
involving the board's gpio_list array.
BUG=none
BRANCH=none
TEST=it's just comments.
Change-Id: I30731555bbc358b0bebd75f906cbbb3116206146
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44994
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This CL moves the keyboard port listing to board.h for each mainboard
to reduce board-specific clutter in keyboard_scan.c. Since the info
is now exposed outside of keyboard_scan.c, a more descriptive name was
chosen.
Note: GPIO_D does not need to be included in this list for any current
platform.
BUG=none
BRANCH=none
Test=tested on Snow by pressing all number and letter keys
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Change-Id: I1ce924a41cafae557467997ecba9c5abeed86211
Reviewed-on: https://gerrit.chromium.org/gerrit/45284
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
This makes it possible to have ADC module monitor an input voltage and
trigger interrupt when it goes out of accepted range.
BUG=chrome-os-partner:18171
TEST=Manual
BRANCH=spring
Change-Id: Ia0c981fadd9bcaa40afe30ca2624c2f3644b95fe
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45277
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
In order to update charger status we have added a virtual keystroke to
signal change to the kernel via the MKBP interface.
CL creates the virtual key press and calls it from within the
USB charging code.
Signed-off-by: Todd Broch <tbroch@chromium.org>
BUG=chrome-os-partner:17927
BRANCH=spring
TEST=manual
1. Compile for daisy,snow,spring.
2. Test on spring.
Change-Id: I0afa0fc82c96fa3fd8119523a113b5028c8f64a3
Reviewed-on: https://gerrit.chromium.org/gerrit/45126
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
BUG=none
BRANCH=none
TEST=manual
Build it manually, copy lbplay to DUT, run lbplay & ectool simultaneously.
cd /mnt/stateful_partition
mount -o remount,exec .
scp USER@SOMEWHERE:/SOME/PATH/TO/lbplay .
./lbplay &
ectool lightbar params
ectool lightbar params
ectool lightbar params
The lbplay program should cause the lightbar to slowly ramp up to green and
down to red. Meanwhile, the ectool command should work and not hang.
Change-Id: I4f26b0530ceaacbc18f8b9f38d7cbdfdabf78015
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45257
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This moves KB_INPUTS from keyboard_scan.c to board.h where KB_OUTPUTS
is #defined. Although we use the same 13x8 keyboard matrix on all
platforms, KB_OUTPUTS is defined on a per-board basis due to its usage
in keyboard_test.
BUG=none
BRANCH=none
TEST=locally compiled
Change-Id: I0d66705d2959c7824b96cc8aae55368eca39a21a
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44970
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This is a purely cosmetic change that removes any remaining
references of rows/columns in favor of inputs/outputs since the
former is inconsistent across platforms.
Higher-level code (such as MKBP) may still refer to logical rows
and columns, but low-level GPIO handling code will refer to GPIOs
by their input/output function.
BUG=none
BRANCH=none
TEST=Tested on Snow (ran finger across all numbers and letters)
Change-Id: Idb8b76e8d013568505d826c3a54a1ed8ce143d12
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44982
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This replaces the hard-coded IRQ mask which has so far worked on
Chrome platforms with a variable that gets set in the initialization
part of keyboard_scan_task(). A simple loop is used to OR the GPIO
mask for each keyboard input provided by the board's gpio_list array.
This will make it easier to adapt the code to future targets with
different pin mappings.
BUG=none
BRANCH=none
TEST=Tested on Snow
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Change-Id: I848ab3c7e8d276dbb807a97c6b26c5b3c05af166
Reviewed-on: https://gerrit.chromium.org/gerrit/44952
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This adds initial support for the other chips in the stm32f10x
series: stm32f101, stm32f102x, stm32f103x, stm32f105x, stm32f107x.
The main difference is in the register definitions. Clock, flash,
GPIO, and JTAG modules are similar enough that for now we can symlink
the existing source for stm32f100.
BRANCH=none
BUG=none
TEST=Tested on McCroskey (follow-up CL)
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Change-Id: I67363d02578e21be51d842b6bd8b5e4848720993
Reviewed-on: https://gerrit.chromium.org/gerrit/43412
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
This enables the EC to switch the signals to ANX7808 properly.
BUG=chrome-os-partner:18165
TEST=Manual on reworked Spring board
BRANCH=none
Change-Id: Ib3ff57e17afab9ba8fc78fdb037e65aae844f38b
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44897
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
To avoid AC bad condition when system load suddenly increase, we should:
- Keep VBUS voltage at reasonable level on battery assist
- Allow PWM to bring VBUS voltage up before asserting AC bad
BUG=chrome-os-partner:14319
TEST=Manual
BRANCH=none
Change-Id: I8058ffba9f91550f22408ea25911a1dded835584
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44612
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Measurement result for aggressive mode looks good. Let's switch to it by
default.
BUG=chrome-os-partner:14319
TEST=Boot and check current limit mode.
BRANCH=none
Change-Id: I117170aaea8c3a3304dc27815ffb429fff2f22c7
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44607
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This allows the AP to shut down cleanly. If it doesn't shut down in
that time period, the EC will forcibly shut it down.
BUG=chrome-os-partner:17124
BRANCH=link
TEST=manual
1. With system off,
- battfake 2 -> EC hibernates immediately
2. With system on,
- battfake 2 -> battery shutdown event posted to AP
- power off system manually within 30 sec -> EC hibernates
3. With system on,
- battfake 2 -> battery shutdown event posted to AP
- do not power off AP
- after 30 sec, EC shuts down AP then hibernates
4. With system on,
- battfake 2 -> battery shutdown event posted to AP
- after 15 sec, apply AC power
- system does NOT shut down
- remove AC power -> battery shutdown event posted to AP
(because battfake 2 is still faking 2% battery left)
- after 30 sec, EC shuts down AP then hibernates
(check to make sure the full 30 sec elapses; the timer
should have been restarted when AC power was removed;
if the EC shuts down the AP immediately this is a
failure indicating the timer is still running from
the first shutdown event)
Change-Id: I1a13765f501d705d3a580b2acbbb173d47e020ff
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44413
This preserves more battery for the real-time clock. It also gets rid
of one battery level/state, since the EC will now shut down at the
same level (2%) as the AP.
Having the EC hibernate at the same level as the AP shuts down also
prevents the following weird scenario:
- EC powers on at 2% battery.
- EC won't power on the AP to do software sync because battery is low.
- But the charge state machine won't actually hibernate the EC until 1%.
- Between 2% and 1%, AC is inserted and system starts charging.
- But EC-RO is what's doing the charging; we should go through software sync
before charging.
BUG=chrome-os-partner:17124
BRANCH=link
TEST=manual
On battery power,
1) With system on, battfake 2 -> system shuts down and EC hibernates
2) With system off, battfake 2 -> EC hibernates
Change-Id: I87d17f70d60673f3e3f1c6eb88f3f00a8c9ed4e7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44314
This prevents the system from waking from hibernate at very low
battery, then powering on the AP to do software sync only to find that
the charge state machine shuts down the AP before software sync can
complete.
BUG=chrome-os-partner:17124
BRANCH=link
TEST=manual
On both AC and mostly-charged battery:
- With lid open, reboot EC -> on
- With lid open, reboot EC with power held down -> on
- With lid closed, reboot EC -> system boots and does EC software sync
- With system on -> battfake 2 shuts system down
(and at that point, opening lid or pressing power does nothing)
With a hacked charge_state.c so fake_state_of_charge starts at 2:
- With lid open or closed, reboot EC -> off
- Opening lid does not turn on system
- Pressing power button does not turn on system
- Plug power back in and press power -> system turns on
Change-Id: Ie1f2933060fac87b1afe68718f374d51cb8994de
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44313
When in battery assit mode, show breathing yellow on battery LED slowly
to indicate battery is actually discharging.
BUG=chrome-os-partner:17561
TEST=Manual
BRANCH=none
Change-Id: I688470d8870b181bf2dd20b5ebcbd6e2d861c5b0
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/44514
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>