| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
This reverts commit f4ba3b2fa32a4dd34570c2bc9b5a592727997eae.
Change-Id: I97fde95480f27f80c9ec64add89fd9ab3476e4cd
Reviewed-on: https://chromium-review.googlesource.com/293462
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
Commit-Queue: Eric Caruso <ejcaruso@chromium.org>
Tested-by: Eric Caruso <ejcaruso@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If we have a lightbar, but no PD, then plugging the device in will
not trigger the battery-level pattern. This allows us to trigger
it from the charger task instead if we change AC status and don't
have a PD.
BRANCH=ToT
BUG=None
TEST=plug and unplug charger from device, make sure the lightbar
plays the right pattern
Change-Id: I8f37aaff2ddb9d936e13489cb404caee822418a1
Signed-off-by: Eric Caruso <ejcaruso@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/292943
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For multi-byte ACPI memmap reads, we previously had a mutex to ensure
data continuity. A better approach is to use a read cache. Since the
kernel will enable burst mode before reading a multi-byte memmap
variable and disable it afterward, we can populate the cache on the
first read after enabling burst. This solution removes deadlock bugs, is
contained entirely in acpi.c, and saves a deferred function.
BUG=chromium:514283
TEST=Manual on Glados. Add prints in acpi_read, verify that multi-byte
reads come from cache and non-burst reads continue to function as
before.
BRANCH=Cyan
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I74e4927bf2b433e31a9ff65d72820fa087c51722
Reviewed-on: https://chromium-review.googlesource.com/288871
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's sometimes desirable to boot without a battery, but we may brown out
if we don't have sufficient current. Inhibit AP power-on, even if the system
is unprotected, until our charger and current limit are initialized.
BUG=chrome-os-partner:41258
TEST=Manual on reworked glados with subsequent commit. Remove battery and
attach Zinger. Verify EC powers on and AP doesn't boot. Run `powerbtn`,
verify that AP boots. Remove all power and attach battery, verify that EC
powers on and AP boots.
BRANCH=None
Change-Id: Ifc3d16f8288a035854e9fd05812ce6de33170d6a
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/280563
Reviewed-by: Alec Berg <alecaberg@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove duplicate board_discharge_on_ac() functions and create
CONFIG_CHARGER_DISCHARGE_ON_AC_CUSTOM for boards that have a
unique implementation of board_discharge_on_ac().
BUG=chrome-os-partner:42294
BRANCH=none
TEST=make -j buildall.
load on samus and test 'ectool chargecontrol discharge' forces
discharging on AC, and 'ectool chargecontrol normal' resumes normal
charging.
Change-Id: I2b7c04b9278d07748d6d41798ceab1a7e90684e4
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/284911
Reviewed-by: Randall Spangler <rspangler@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add workaround to limit the max input current to 1.5A due to
i2c communication problems at higher currents. Note that this
max should be removed when possible.
This introduces a new CONFIG option to define the maximum input
current limit for a board, as opposed to the already existing
default input current limit.
BUG=none
BRANCH=none
TEST=load on glados, charge with zinger, make sure input current
is set to 1.5A and no recurring i2c errors talking to battery
and charger.
Change-Id: Ib7070772e1bf5475e98a2dc946ae75bf08047b70
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276169
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clear curr.batt_is_charging when the battery is not present.
Add a new batt_was_removed flag to track when the battery has been
removed. This causes PWR_STATE_ERROR so the LED shows error state,
and triggers re-reading the static parameters from the battery when
it's reattached.
BUG=chrome-os-partner:38235
TEST=check the LED state on mighty
BRANCH=veyron
Change-Id: I400c22eda4bc0043adf7217166bd9f80c557d991
Signed-off-by: ZhengShunQian <zhengsq@rock-chips.com>
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/262007
Commit-Queue: Gediminas Ramanauskas <gedis@chromium.org>
Tested-by: Gediminas Ramanauskas <gedis@chromium.org>
(cherry picked from commit 6727e1dba2aafa81fa9572145413545106ae9626)
Reviewed-on: https://chromium-review.googlesource.com/262140
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When calling problem() with 0 as value, it's never printed on the EC
console since the problem() function is de-duplicating the messages by
checking against the last value (which is initialized at zero).
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=chrome-os-partner:38401
TEST=run on the current Ryu code (which has a faulty BQ27742 driver) and
see the "charge problem: static update [...]" message.
Change-Id: Iedfbc95e3751bc5b22452187b404a09b633160d7
Reviewed-on: https://chromium-review.googlesource.com/262448
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some platforms are unable to access the 900h-9ffh region over LPC and
must instead access memmap data through the ACPI CMD / DATA ports. To
avoid racing with data updates, disallow changes to multi-byte memmap
data while in burst mode.
Linux currently enables burst mode when accessing multi-byte data and
disables it immediately afterward, though the ACPI spec defines burst mode
in a more general way.
BUG=chrome-os-partner:38224
TEST=Manual on Samus. Undefine LPC_MEMMAP and modify asl to move memmap
data to ERAM at offset 0x20. Verify system boots cleanly and battery
status is updated immediately on plug / unplug.
BRANCH=None
Change-Id: Ib848bdb491fdfece96ad0cee7a44ba85b4a1a50b
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/262072
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add battfake console command to charge_state_v2.
BUG=none
BRANCH=samus
TEST=load onto samus and use battfake console command to make
sure it works:
> battfake 100
Reporting fake battery level 100%
> battfake -1
Reporting real battery level
Change-Id: I038db92a4859d460b33b1c7e546bc08d5e21582b
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/256070
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Return host command error codes for EC_CMD_CHARGE_CONTROL instead
of returning the result of EC functions which typically return
element from enum ec_error_list, which is a different error list.
BUG=chrome-os-partner:37171
BRANCH=samus
TEST=make -j buildall
Change-Id: Ia13cc8a2f747ddeafdc059c6e575dcc2f5b20b8d
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/254721
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently we set the input current limit to its maximum when the system
is unlocked, so that we can boot the system with a powerful charger when
the battery is absent. However, with a low power charger, we risk
browning out the charger. If the battery is present, reduce the input
current limit so that low power chargers work in this case.
BRANCH=None
BUG=None
TEST=On Ryu, reboot EC when the a low power charger is used. Without
this change, the charger browns out right after the reboot. With this
fix, the problem doesn't happen anymore.
Change-Id: I9d491cbe45e77f864198c97a47624918e6c272db
Signed-off-by: Vic Yang <victoryang@google.com>
Reviewed-on: https://chromium-review.googlesource.com/248442
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Occasionally the charge circuit on samus gets wedged and will not
charge. This change detects when the charge circuit has failed
and automatically recovers from it. It uses the BQ PROCHOT warning
to detect the failure by setting PROCHOT to trigger when the BQ
thinks input current is higher than the input current limit. When
the failure is detected, the EC disables charging and tells PD MCU
to disable CHARGE_EN, then a couple seconds later, it re-enables
charging.
This CL also adds more communication between EC and PD for the EC
to be able to set the charge state for the PD. Valid charge states
are: No charging allowed, 5V charging only, and max charging. The
EC uses this as such:
- When the EC gets AC present interrupt, it sets off a deferred
function to change charge state to max charging after some delay
to give time for the charge circuit to settle down.
- When the EC gets AC disconnect interrupt, it disables charging
briefly, enables learn mode, and then sets 5V charging allowed.
This allows for the same starting conditions in the charge circuit
for every AC attach.
- When the EC detects a wedged charge circuit, it disables charging
and waits a few seconds before re-enabling 5V only charging.
Additionally, this change moves the charging cutoff in S3/S5/G3 when
the battery is full to the EC. With the added control for the EC
to set the PD charging state, it is more convenient for the EC to
manage cutting off charging when battery is full.
BUG=chrome-os-partner:36081
BRANCH=samus
TEST=test the basics:
- connect/disconnect zinger a bunch of times
- connect and disconnect two zingers in different order
- connect two zingers and charge override between the two
test the automatic charge wedge recover:
- wedge the charge circuit by setting charger voltage under battery
voltage: "charger voltage 7000"
- wait a few seconds for the system to recover and check it is charging
with "battery" command
test full battery charge cutoff:
- added console command to change battery soc in board/samus/extpower.c:
static int cmd_battfake(int argc, char **argv)
{
char *e;
battery_soc = strtoi(argv[1], &e, 10);
batt_soc_change();
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(battfake, cmd_battfake, "", "", NULL);
- in S0, tested "battfake 100" does not disable charging.
- in G3, tested "battfake 100" disables charging and "battfake 99"
re-enables charging.
- set "battfake 100" and tested transitioning to S0 enables charging and
transitioning to S5 disables charging.
- attached two chargers and used charge override to select active port.
then toggled "battfake 100" to "battfake 99" back and forth and verified
charge override port is still the same.
test third-party 12V charger:
- plug in a bunch of times and make sure we stay at 5V for 500ms and then
transition to 12V
test with no battery:
- tested five different units with no battery and just zinger. 3/5 boot,
while the other 2 don't. But, the 2 that don't boot without battery also
can't boot w/o battery when this CL is reverted, so I don't think this
change is causing the problem, I think there is an electrical limitation.
test with EVT zinger:
- EVT zingers (P2 - C2) negotiate very quickly after connection, which
can cause INA problems w/o this CL. Tested an EVT zinger with samus and
did a bunch of connections and disconnections and verified that we always
wait at 5V for 500ms and that we don't wedge the INA circuit on connect.
test backwards compatibility:
- test new PD with old EC and make sure we can charge with zinger.
(note that if the charge circuit wedges, we won't be able to unwedge it).
- test old PD with new EC and make sure we can charge with zinger.
Change-Id: I7703b7a2ab1209d7f559b265b03517e79c74b16a
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/245253
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add hook for battery state of charge change. Hook will be used
to cleanup the samus charging workarounds to follow.
BUG=none
BRANCH=samus
TEST=make -j buildall
Change-Id: I99cbb8264783802139cac689804b056623063695
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/245252
Reviewed-by: Shawn N <shawnn@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ignore battery readings over 100%. This fixes a samus bug
where a false battery SOC reading causes charging to
stop.
BUG=chrome-os-partner:36115, chrome-os-partner:36081
BRANCH=samus
TEST=add following code to common/smart.c:
static int reset_soc;
in battery_get_params():
if (reset_soc) {
batt_new.state_of_charge = 65535;
reset_soc = 0;
}
after battery_get_params():
static int command_battsoc(int argc, char **argv)
{
reset_soc = 1;
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(battsoc, command_battsoc,
"",
"",
NULL);
This changes the battery state of charge to 65535% for one
loop through charge state machine. w/o this CL, on samus the
battery stops charging when you call this, but with this CL
it is fixed.
Change-Id: I44f054a4e84260bd7cd7b77e44b1698645ab6c35
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/244346
Reviewed-by: Shawn N <shawnn@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Several modifications to samus fast charging to fix bug where
charging circuit stops charging the battery.
- Fix bug: if we have a bad temperature reading, fast charging should
ignore it.
- Change the fast charging high temperature profile to set a charging
voltage equal to the maximum of 8.3V and the current battery voltage.
- Divide the normal temperature profile into two phases, low voltage
charging and high voltage charging. Once we transition to second
phase, don't allow it to go back to phase 1 unless AC is removed.
On samus, we have to make sure we never command the BQ to a charging
voltage that is below the present battery voltage or else the INA will
lose power and we will not be able to charge the battery until AC
is disconnected.
This also changes charge_state_v2 so that the fast charging profile
override is called even when AC is disconnected to avoid jumps in
temperature as seen by the fast charging code.
Also changes the voltage threshold for transitioning from phase 1 to
phase 2 of normal temp charging so that the transition is taken a little
earlier to match the desired profile slightly better.
BUG=chrome-os-partner:35491
BRANCH=samus
TEST=Added custom console command to be able to directly control the
battery temperature that charger_profile_override() uses:
static int command_chgtemp(int argc, char **argv)
{
char *e;
if (argc < 2)
return EC_ERROR_PARAM_COUNT;
chg_temp = strtoi(argv[1], &e, 10);
if (*e)
return EC_ERROR_PARAM1;
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(chgtemp, command_chgtemp,
"",
"",
NULL);
Using this command, I jumped back and forth between all three temperature
fast charging regions and made sure that (1) we never set a charging voltage
below the present battery voltage and (2) we never stop charging the battery.
I ran this test at low battery and high battery percentage and with low load
(G3) and high load (S0 with webgl aquarium).
Change-Id: I035603a4ab48a156ab43f8c93f21200c4b664aab
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/243143
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If our battery params seem uninitialized when calling
charge_prevent_power_on, try to retrieve them and make a decision based
upon the retrieved data. This should prevent the case where power-up is
incorrectly prevented early in the boot process.
BUG=chrome-os-partner:35762
TEST=Manual on Samus. Write protect unit and run "reboot" from the
console, verify that unit powers up. Verify that unit still correctly
prevents low-power power-on and correctly allows non-low-power power-on.
BRANCH=Samus
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I9030a2d5e526f4b03996a89bf2c801533683bb67
Reviewed-on: https://chromium-review.googlesource.com/242560
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change charge_state_v2 to set the maximum input current limit when
there is no battery present AND the system is not locked. This allows
us to boot without a battery.
Note that using the max input current limit may cause us to overcurrent
our charger, but that's no worse than putting a limit on it and having
the system brownout. Either way you must have a high enough power
charger to boot without a battery.
BUG=chrome-os-partner:35570
BRANCH=samus
TEST=load on samus, remove battery and plug in zinger. check "charger"
has input current limit of 8128mA, and on PD MCU jump back and forth
between RO and RW and make sure system doesn't power off. Note that
without this CL, if you sysjump on the PD MCU it causes input current
limit to reset to 500mA and causes AP to shutoff.
Change-Id: Ie13d97a6b5c0937510cff0cf05fb032898c3b131
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/241762
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix some issues with how the battery present flag is reported
up to the host.
If there is no battery presence GPIO or custom function then
errors updating the smart battery info can result in the
battery present flag reporting BP_NOT_SURE and indicating to the
host that the battery is missing. In order to prevent spurious
events require a second back-to-back read of a missing battery
before the host is notified.
When the battery presence does change, the host needs to be told
to re-read the static battery info with EC_HOST_EVENT_BATTERY,
passed to the OS via Notify command to tell the OS to re-execute
_BIF/_BIX method on the ACPI battery device.
When sending these events to the host the battery flags should
first be updated in LPC shared memory so if the host handles
the event quickly it will read the correct updated flags value.
BUG=chrome-os-partner:34011
BRANCH=broadwell
TEST=manual testing on samus:
1) add a console command that allows the smart battery update
function to set batt.is_present to BP_NOT_SURE for a specified
number of update cycles.
2) ensure that when the smart battery update only returns the
battery missing for one update cycle that it does not result in
an event to the host.
3) ensure that if the smart battery update indicates the battery
is missing for more than one update cycle, such that the host is
notified the battery is missing, that it correctly gets an event
to re-read the battery info when it is indicated as present again.
Change-Id: I0da004b991ea1a89b34cd7c0f8f3628b813ffe44
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/241763
Reviewed-by: Alec Berg <alecaberg@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some batteries report 0 charge when their charge level is very low.
powerd has a special interpretation of 0 charge, which causes
low-battery shutdown to not occur. Work-around this powerd behavior by
never reporting 0 charge if our battery is discharging.
BUG=chrome-os-partner:35188
TEST=Manual on Samus. Drain battery to critically low level, verify that
powerd correctly shuts down system.
BRANCH=Samus
Change-Id: I6bd50e038f0e22de7e7de754fa2ea459dc662f35
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/241101
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Certain platforms may wish to have a longer shutdown timeout, so make
the timeout a config option.
BUG=chrome-os-partner:35188
TEST=Manual on Samus with subsequent CL. Set config option to increase
timeout, verify that timeout is extended.
BRANCH=Samus
Change-Id: I69feb0d31fdc53e533671dec1e88ba96cc4553c2
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/240815
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
prevent_hot_discharge and prevent_deep_discharge are near-identical
copies of one another, and can be combined without the loss of any
useful functionality.
BUG=chrome-os-partner:35188
TEST=Manual on Samus. Charge to 2% and boot system with 5V power supply.
Verify that warnings print to console and AP powers down after 30s. Also
pass unit tests.
BRANCH=Samus
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I0f1da5248825a3884f7910babc742dfa7eadf5a3
Reviewed-on: https://chromium-review.googlesource.com/240033
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When battery is full and system is not in S0, then stop charging
and allow battery to power the system. Once battery is no longer
full and requests current, allow charging again. This is to work
around power consumption issues in our AC input path. The charge
override port is stored upon entering S3 and restored going back
to S0 so that the charge override port is not affected by this.
This also fixes lightbar so lightbar checks if battery is full
instead of checking raw percentage. The lightbar is also changed
to use the last tap direction if no charger is plugged in. And
the lightbar tap for battery threshold for turning green is
lowered to 95%.
This also moves some samus_pd board code out of interrupt handlers
and in to deferred functions to minimize time in interrupts.
BUG=chrome-os-partner:34640, chrome-os-partner:34847
BRANCH=samus
TEST=load onto samus. use battfake command from pd console to
set battery percentage. when system is in G3, see that
batt = 100% stops charging, and when batt < 100% it starts
charging again.
tested that we receive host command from EC with battery
information every time battery changes SOC.
Change-Id: Ia8e0721508e34ee3630f5e5b0c2f431a00329caf
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/236411
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Set charge state machine voltage to just above the battery voltage
when AC is disconnected. Also send new current before sending new
voltage to charger when there is a change. These changes reduce
input current spikes caused by current inrush into the battery and
thereby decrease chance of overcurrenting power supply on connect.
BUG=chrome-os-partner:33862
BRANCH=samus
TEST=load onto samus instrumented with input current probe. when
AC is attached note that initial current spike is much lower with
this change.
Change-Id: I7760cd2b709c6b3536cf2a9449bb1f46800ce10a
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/237245
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON to be defined at the board
level to be the minimum battery percentage required for power-on. If the
battery level is below the threshold, or if the battery is missing,
power button presses will be ignored.
BUG=chrome-os-partner:31127
TEST=Manual on Samus with subsequent commit. Verify that AP continues
to boot normally when charge level exceeds
CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON. Verify that power button
presses are ignored when the charge level is below the threshold, and
we return to G3.
BRANCH=Samus
Change-Id: I0ff3f7ddabf38080332470e172c8b2e307bf1655
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/236021
Reviewed-by: Alec Berg <alecaberg@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add high (and low) battery temperature warning which sends host
event to AP. After 30 seconds of out of range temp readings force
shut off AP and hibernate the EC.
BUG=chrome-os-partner:27641, chrome-os-partner:33111
BRANCH=samus
TEST=make buildall, and write unit tests to test this condition.
Change-Id: I95b7d9d753c17e4b76218a9845aa63dd1b96a500
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/235645
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On samus it is possible to have AC plugged in but have the battery
discharging. So, add a new variable to charge state machine for
battery charging status and use that where necessary. For example,
the low battery shutdown code should now be based on whether or
not battery is charging rather than if AC is present.
This also changes the hibernate behavior when battery is low. The
change is to wait 30 seconds in G3 of low battery with no charging
before hibernating because for some chargers, like a USB PD charger,
the charger may increase it's current limit after a little bit of
time.
BUG=chrome-os-partner:34485
BRANCH=samus
TEST=test on samus. use low power charger and make sure that
ectool battery shows the "DISCHARGING" flag. use zinger and see
"CHARGING" flag. also use power_supply_info to make sure that
the battery state accurately reflects reality.
Change-Id: I8ac0267dd393071c4ca1fa24fbc9a13bf27848a9
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/235491
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the battery cut-off command is issued with external power present,
the battery can end up in one of the following two states:
1. The battery stays responsive but is waiting for the external power
to go away.
2. The battery decides to cut itself off right away.
In case 1, we are already avoiding charging the battery again, so we're
good. However, in case 2, the charge state machine mistakenly thinks the
battery is dead and tries to revive it. Fix this by checking if the
battery is cut off before starting to revive it.
BRANCH=None
BUG=chrome-os-partner:33372
TEST=Cut off the battery with external power connected. Wait for a while
and then disconnect external power. Check the battery is sure cut off.
Repeat for several times.
Change-Id: Icf343b168a556a490bc1786802a8a6e230863a28
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/227521
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix bug causing unit to falsely shutdown due to low battery.
The shutdown warning time was not getting reset, so two false
readings of battery SOC or voltage, seperated by more than 30
seconds in time would cause "charge force shutdown due to low
battery"
BUG=chrome-os-partner:33111, chrome-os-partner:33144
BRANCH=samus
TEST=make buildall
Change-Id: I6f00187516d23aa78139e5c1565febca34176ecc
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/224765
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If CONFIG_HIBERNATE is explicitly undefined for a board, the EC
shouldn't hibernate when the battery is running low. Otherwise, the EC
reboots because of the lack of hibernate support, and this actually
burns more power.
BUG=chrome-os-partner:32727, chrome-os-partner:32779
TEST=Drain the battery to 2% and verify the EC is behaving.
BRANCH=None
Change-Id: I2f9f5fd8fb4b5be4d8da113da4ef26c062869a07
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/222615
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If there is any delay between AC status and the battery charge status
it is possible for the power_manager to read the battery state when
the AC status event is sent and still see that the battery is not
yet charging. This can cause lag in the UI battery icon because the
AP is not notified when the battery charge state changes.
In order for the host to be able to differentiate the dynamic battery
state changing (re-read ACPI _BST by sending Notify 0x80) from the
static battery info (re-read ACPI _BIX/_BIF by sending Notify 0x81)
it needs a separate host event.
BUG=chrome-os-partner:32196
BRANCH=samus
TEST=Test AC instertion and removal while watching state on the host
to ensure that an event is sent to the host which triggers power
manager to re-read the battery status and notice that the charge
state has changed if there is any delay after the AC status event:
watch -n 0.1 "cat /sys/class/power_supply/AC/online;
cat /sys/class/power_supply/BAT0/status;
tail -10 /var/log/power_manager/powerd.LATEST"
Change-Id: I18ce70719dc231c43c474cefad2068f949675a2b
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/220257
Reviewed-by: Alec Berg <alecaberg@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On boot, the EC should send host command to exchange status with
PD MCU. This allows EC to get the correct input current limit
when EC reboots and PD does not.
Also had to move some of the charger state machine initialization
to run with HOOK_INIT so that it runs before the tasks run.
BUG=none
BRANCH=none
TEST=tested on EVT samus. Without this change, if you reboot
EC, and run charger command, the charger input current limit
is 512mA. with this change, when the EC reboots, it sends host
command to PD MCU to get current limit and sets it appropriately.
Change-Id: I5426f0fc3a62b6cd7a73f55cb11b895902a54903
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/216879
Reviewed-by: Todd Broch <tbroch@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ref: Common Smart Battery System Inferface Specification v8.0.
- Added 2 new AP->EC Command APIs
EC_CMD_SB_FW_UPDATE, EC_CMD_ENTERING_MODE
- Implemented common smart battery update drivers.
BUG=chrome-os-partner:24741
CQ-DEPEND=CL:210032
CQ-DEPEND=CL:210033
CQ-DEPEND=CL:215720
BRANCH=ToT,glimmer
TEST=Verified on LGC & Simplo smart battery
Change-Id: Ice6e60b1b04762217ae7613356d6925777c06abf
Signed-off-by: Sheng-Liang Song <ssl@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/205323
Reviewed-by: Randall Spangler <rspangler@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds a small threshold for sending a host event to battery whenever
the full capacity changes. This helps avoid constant host events
when the battery decides the capacity is going back and forth 1mAh
BUG=none
BRANCH=none
TEST=load on samus. set LFCC_EVENT_THRESHOLD to 1 and see host
events very often. set LFCC_EVENT_THRESHOLD to 5 and see no host
events.
Change-Id: I2dc38f04e1a634539837dfed19b10ccfcfd0a8a3
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/213668
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently charge state machine resets input current limit to default
every time AC is connected. Problem is by the time charge state machine
gets around to setting input current, it could have already been set
by successful PD negotiation, and this ends up overriding that value.
This fix has the state machine store desired input current limit, as
determined from PD negotation or any other place, and send last desired
input current limit on AC connect.
BUG=chrome-os-partner:24461
BRANCH=none
TEST=load on samus, test toggling between "pd 0 dev 5" and "pd 0 dev 20",
and test plugging and unplugging zinger numerous times, and verify charger
command always gives the expected input current limit based on PD
negotiation.
Change-Id: I18d8acc9e2085739e783c9c70c682d46bcce7fdb
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/211639
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a battery is found in disconnect state, we need to apply a charge
current to get it out of that state, even if the battery is full.
BUG=chrome-os-partner:29465
TEST=Manual on Samus. Put full battery into disconnect state then
power-on the EC. Pull AC and verify that the battery is no longer
disconnected.
BRANCH=None
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I43e872e225dc5a651f566d7b190cff85a487805e
Reviewed-on: https://chromium-review.googlesource.com/210343
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Samus battery can be placed into a disconnect state by asserting a
disconnect input signal. In this state, the battery will not function
until a charging current is applied. This patch adds detection of the
disconnect state. If a battery in disconnect state is found, a current
is force-applied to the battery to kick it out of disconnect.
BRANCH=None
TEST=Manual on Samus.
1. Put battery into disconnect state
2. Pull AC, then reattach AC
3. Verify "found battery in disconnect state" is seen on the
EC console.
4. Pull AC and verify that EC console is still accessable
Also verify that battery gets out of reset state:
1. Pull AC
2. Issue "i2cxfer w16 0 0x16 0x0 0x12" command on EC console
3. Re-attach AC
4. Pull AC and verify that EC console is still accessable
BUG=chrome-os-partner:29465
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ib4268887fb483094ac4e641749200268160d3014
Reviewed-on: https://chromium-review.googlesource.com/209013
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Alec Berg <alecaberg@chromium.org>
Tested-by: Alec Berg <alecaberg@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Revert
- https://chromium-review.googlesource.com/#/c/205145/2
- https://chromium-review.googlesource.com/#/c/205147/4
Now using the real AC_PRESENT gpio signal instead of whether or
not the PD MCU negotiated for 20V.
BUG=chrome-os-partner:29841, chrome-os-partner:29842
BRANCH=none
TEST=tested on a board with reworked AC_PRESENT signal. Verified
that gpio is correctly reporting state of AC and is charging when
AC is plugged in. Tested the no battery case to make sure
board powers on and stays on with just a charger. Also tested the
dead battery case by plugging in a dead battery, then plugging in
a charger and making sure system powers on and starts charging.
Change-Id: I4424771c91c8a2aa19eda68a8b5194e9265d529c
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/206598
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(cherry-pick back to ToT)
Clear the CHARGE_INHIBIT bit when requesting non-zero current/voltage
and set it when charging should be disabled. On Blaze with the
BQ24725 charger, setting this bit saves 10-15mW when we're not on AC.
This also fixes an issue where battery charging would not get enabled
when the charger is connected while the machine is in S3/S5. This is
because the kernel driver would inhibit charging when the charger was
removed and then the EC would not enable it when the charger was
re-connected while the host was off, such as in S3/S5.
BRANCH=nyan
BUG=chrome-os-partner:29386
TEST=Boot Blaze, disconnect charger, suspend, connect charger and
observe that the battery now starts charging.
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/203163
Reviewed-by: Randall Spangler <rspangler@chromium.org>
(cherry picked from commit bd4469ae4ffbbd6f2cd5549bdb8809838e55d6f7)
Change-Id: Ibcb635b01a2292f214f71ab400ec34cd12e7536f
Original-Change-Id: I2efaf02296dc08c0de85950a70ad2592f4428241
Reviewed-on: https://chromium-review.googlesource.com/206909
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Yung-chieh Lo <yjlou@chromium.org>
Tested-by: Yung-chieh Lo <yjlou@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a temporary workaround to allow dead battery charging without
an AC PRESENT signal by delaying going into hibernate with an extremely
low value in order to check if AC is present by waiting for PD MCU.
BUG=chrome-os-partner:29842
BRANCH=none
TEST=Test with a dead battery that when you plug in AC and reboot, it
is able to charge. Previous to this change with a dead battery and AC
plugged in the EC would boot and almost immediately go back into hibernate
Change-Id: I338a0cc9ee37dab3e6caf29369ac6e819772ca91
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/205147
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ACOK input to the EC is not connected to the charger so
that signal cannot be relied on for AC presence. Instead
have the PD report when it negotiates to 20V and when it
disconnects and have the EC use that for AC presence.
BUG=chrome-os-partner:29841
BRANCH=none
TEST=test charging with zinger on samus system.
Change-Id: Ia9096a24ab05d110e31910218dc8c214a846a9a4
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/205145
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use a EC to PD host command to notify the PD MCU when a battery
is present and charged enough that it is ok to negotiate for a
higher power. The PD MCU will not negotiate until the host command
is received, which allows the system to be powered without a
battery or with a dead battery with 5V.
BUG=chrome-os-partner:28611
BRANCH=none
TEST=Tested on a samus:
1) Tested the normal case of battery charged and plugged in. When
charger is plugged in, the device immediately starts negotiating
for 20V and starts charging.
2) Tested with no battery. Plug in a charger, samus boots and stays
alive. VBUS measured at 5V. When a battery is plugged in, device
negotiates for 20V and starts charging.
3) Tested dead battery by taking a battery with no charge, and
plugging in zinger. Everything boots, but PD does not negotiate
for power. Then when battery reaches 1%, PD negotiates and zinger
switches to 20V without causing a reboot.
Change-Id: Iaa451403674e86cddbd3fe80e9503584910be576
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/201958
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On samus battery, when the battery is dead it reports 0 for desired
voltage, current, and state of charge. In this case we should allow
charging.
Added a CONFIG option for this that should be removed as soon as
the battery side is fixed.
With this CL, when a dead samus battery is used and a charger is
connected, we attempt to charge it.
BUG=chrome-os-partner:29465
BRANCH=none
TEST=test on a samus with a dead battery. w/o this CL, the battery
never charges because the charging not allowed flag is set. With this
CL, the battery charges.
Change-Id: Ic61f27a27237166d33cb9ea5f024d3ef6360ce82
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/202603
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Our code base contains a lot of debug messages in this pattern:
CPRINTF("[%T xxx]\n") or ccprintf("[%T xxx]\n")
The strings are taking up spaces in the EC binaries, so let's refactor
this by adding cprints() and ccprints().
cprints() is just like cprintf(), except that it adds the brackets
and the timestamp. ccprints() is equivalent to cprints(CC_CONSOLE, ...)
This saves us hundreds of bytes in EC binaries.
BUG=chromium:374575
TEST=Build and check flash size
BRANCH=None
Change-Id: Ifafe8dc1b80e698b28ed42b70518c7917b49ee51
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200490
Reviewed-by: Randall Spangler <rspangler@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove redudant struct names. Replace 2 spaces with a tab char.
This reduces 128 bytes in flash size.
BUG=chromium:374575
BRANCH=tot,nyan
TEST=Built and verified on big
% grep hey build/big/ec.RO.map
0x000000000000ef48
After shrink:
0x000000000000eec8
The output still is easy to read.
> chg
state = charge
ac = 1
chg.*:
voltage = 13040mV
current = 256mA
input_current = 2048mA
status = 0x10
option = 0xf912
flags = 0x0
batt.*:
temperature = 20C
state_of_charge = 0%
voltage = 8253mV
current = 274mA
desired_voltage = 13050mV
desired_current = 256mA
flags = 0x3
remaining_capacity = 0mAh
full_capacity = 4026mAh
is_present = YES
requested_voltage = 13040mV
requested_current = 256mA
force_idle = 0
manual_mode = 0
user_current_limit = -1mA
battery_seems_to_be_dead = 0
debug output = off
Change-Id: I82a3a5cda3fa96e247355dc90431691015eece6c
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/200470
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is useful for testing battery charge profiles. When enabled, a dump of
all battery, charger, and charge state information will be printed whenever
the battery charge percentage changes.
BUG=none
BRANCH=ToT
TEST=make buildall -j
On the EC console:
chg debug on
then watch the console while either charging or discharging the battery.
Disable with
chg debug off
Change-Id: I6725c461461f90fcd812873f97490e980ab47bc6
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/199816
Reviewed-by: Alec Berg <alecaberg@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a shortcut in smart battery driver and i2c passthru. Once
the battery cut-off order is submitted (in the factory line),
the EC will no longer talk to battery.
BUG=chrome-os-partner:28248
BRANCH=tot,nyan
TEST=See below
> remove AC, cutoff: expect system is off.
> cutoff, then remove AC: expect system is off.
> cutoff, wait for 1 min, then remove AC: expect system is off.
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Change-Id: Ied963c19d17d581ce99e4543469cf2fa165f0439
Reviewed-on: https://chromium-review.googlesource.com/196657
Tested-by: Yung-chieh Lo <yjlou@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Yung-chieh Lo <yjlou@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The CL fcf26a4 enabled periodically charge_request(). However, that
could fail and generates lots of error message in the EC console if
the AC is not on and charger refuses the request (even it is 0v/0mA).
BUG=none
BRANCH=tot,nyan
TEST=make runtests. Tested on big. Expect NO below annoying error message
[1.353104 charge_request(0mV, 0mA)]
[1.453170 charge_request(0mV, 0mA)]
[1.553281 charge_request(0mV, 0mA)]
[1.653317 charge_request(0mV, 0mA)]
in the follwing cases:
AC on, battery attached, power on, then remove/plug in AC.
AC on, battery attached, power on, then remove/plug in battery.
AC on, battery removed, power on, then plug in and remove battery.
AC off, battery attached, power on, then plug in and remove AC.
'chgstate' also shows good state. At final, charge for 10 mins.
Change-Id: Icc729c52246df1ecfb7f289b5078dbc122b20a74
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/196678
Reviewed-by: Lin Cloud <cloud_lin@compal.com>
Tested-by: Lin Cloud <cloud_lin@compal.com>
Reviewed-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some chargers support a timeout mechanism that it would stop charging
if no voltage/current setting comes from battery or EC. This is designed
for safety.
In charger v1, it always updates charger periodically. But in v2, old code
only updates charger when needed. New code updates the charger periodically.
Also keep the ability for debugging. A manual mode is introduced so that
any requested volt/curr from host and force idle mode request would trigger
this mode. To leave this mode, just disable the force idle mode.
BUG=chrome-os-partner:28201,chrome-os-partner:28208
BRANCH=nyan
TEST=See below.
Plug AC and battery. Wait for 10 mins and the battery is charged normally.
'chgstate idle on': the charger doesn't charge the battery.
'chgstate idle off': charge again.
Plug in AC and remove battery: No annoying repeated message and works fine.
Plug in battery and remove AC: No annoying repeated message and works fine.
Power up machine with battery only: No annoying repeated message and works fine.
Power up machine with AC only: No annoying repeated message and works fine.
Change-Id: I00d62f8afa2fe2627ea9259f11679ced02af897a
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/196385
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Charger v2 assumes the battery_get_info() always returns non-NULL even
if the battery is not detected, for example, in the over-drained
situation. Thus, add a new struct so that we know what the conservative
setting is to pre-charge the unknown battery.
BUG=chrome-os-partner:28112
BRANCH=nyan,big,blaze
TEST=See issue tracker for the test procedure.
Change-Id: Ica4fe75d154e2f195eb1da19ba045346da383b6c
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/195596
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Devin Lu <Devin.Lu@quantatw.com>
Tested-by: Devin Lu <Devin.Lu@quantatw.com>
|