| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, the battery_manufacturer_name API is implemented individually
by each chip.
This patch consolidate the definitions. It also allows a board to
return custom manufacturer names.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=b/129599895
BRANCH=none
TEST=buildall
Change-Id: Ib0f60c9be71fea31658ab284a915d73341b9145e
Reviewed-on: https://chromium-review.googlesource.com/1590039
Commit-Ready: YH Lin <yueherngl@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: YH Lin <yueherngl@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Requested for linux integration, use BIT instead of 1 <<
First step replace bit operation with operand containing only digits.
Fix an error in motion_lid try to set bit 31 of a signed integer.
BUG=None
BRANCH=None
TEST=compile
Change-Id: Ie843611f2f68e241f0f40d4067f7ade726951d29
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1518659
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since pretty much always, we've declared console commands to take
a "longhelp" argument with detailed explanations of what the
command does. But since almost as long, we've never actually used
that argument for anything - we just silently throw it away in
the macro. There's only one command (usbchargemode) that even
thinks it defines that argument.
We're never going to use this, let's just get rid of it.
BUG=none
BRANCH=none
CQ-DEPEND=CL:*279060
CQ-DEPEND=CL:*279158
CQ-DEPEND=CL:*279037
TEST=make buildall; tested on Cr50 hardware
Everything builds. Since we never used this arg anyway, there had
better not be any difference in the result.
Change-Id: Id3f71a53d02e3dc625cfcc12aa71ecb50e35eb9f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/374163
Reviewed-by: Myles Watson <mylesgw@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This moves battfake console command to the battery driver.
This fixes a race condition with using the 'battfake' command
where charge_state_v2 could return the real battery percentage
even when a faked percentage is specified, if a higher priority
task uses the battery state of charge in between when the
battery is read, and when the fake state of charge overwrites
the battery parameter.
BUG=chrome-os-partner:45878
BRANCH=none
TEST=use tap for battery with a faked state of charge. the tap
for battery queries the battery percentage a lot, so without
this CL, the tap sequence often temporarily jumps to different
percentages and colors. with this CL, the tap sequence works
great.
Change-Id: I3ae0866d1ff7bb8d0c51355cd6b958310766f19e
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/302711
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Contrary to the BQ2751 and BQ27741 it is sharing code with, BQ27742 does
not have a "device name" register. So we need to skip the I2C reads else
the battery_device_name() function returns an I2C error and the charge
code retries until the end-of-time to read it hogging the CPU.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=chrome-os-partner:38401
TEST=run on Ryu P4 and verify that we are no longer seeing 20ms of I2C
transactions every 100ms on the battery I2C bus.
Change-Id: I961af54017f661ee928058b346a42b7206ad8217
Reviewed-on: https://chromium-review.googlesource.com/262449
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The battery driver is not reporting battery present state, and as a
result, is_present flag always remain NOT_SURE. Fix it.
BRANCH=Ryu
BUG=None
TEST=On Ryu, 'chgstate' and see 'is_present = YES'.
Change-Id: I84bedc390158797bf1e67e612d0bb3f526292dfa
Signed-off-by: Vic Yang <victoryang@google.com>
Reviewed-on: https://chromium-review.googlesource.com/242970
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reuses most of the existing BQ27541 driver, but changed necessary
parts to make it work.
BUG=none
TEST=Boot on Ryu. See battery charging.
BRANCH=factory-ryu-6212.B
Change-Id: I3a7325a821c81f84396bcc328036b6a5e7749a2e
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/217198
Reviewed-by: Alec Berg <alecaberg@chromium.org>
(cherry picked from commit f44593e20bf61a2243d7baaae901c912ca798d75)
Reviewed-on: https://chromium-review.googlesource.com/218413
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
During flash erase operation, read is stalled and thus interrupt might
be serviced later. This can cause PD communication to fail and thus the
board reboots if there is no battery. Print a warning message in this
case.
BUG=chrome-os-partner:31127,chrome-os-partner:31207,chrome-os-partner:31362
TEST=Boot Ryu, on software sync, see warning message before board
reboots.
BRANCH=None
Change-Id: If327a4f533fd2dfa83f92531148bd52ace927e03
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/212264
Reviewed-by: Alec Berg <alecaberg@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Update the code to be compatible with charge v2 expectations :
never return EC_ERROR_UNIMPLEMENTED for battery information else the
charge code continuously tries to read them again.
Fix the State Of Charge reading : on BQ27741 the gas gauge gets confused
if we do a 16-bit I2C read while a 8-bit read works perfectly.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=none
TEST=run a Ryu connected to a Kirby battery and check the output of the
"battery" command.
Change-Id: Ic1d6128dc02efa47662fa5ca5b9e5de62420ebe8
Reviewed-on: https://chromium-review.googlesource.com/207273
Reviewed-by: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vic Yang <victoryang@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Like Samus, the battery can be placed into a disconnect state. This CL
implements the necessary function to determine if it is so and kick it
out of this state when possible.
BUG=chrome-os-partner:30633
TEST=Put a battery in this state. Plug in AC. Verify the battery is
revived.
BRANCH=None
Change-Id: I074a72a2efe3844cbdfb0eda16a25fd8d1755a9b
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/209634
Reviewed-by: Alec Berg <alecaberg@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds two battery parameters that need to be monitored constantly:
remaining_capacity and full_capacity (that one only changes occasionally,
but we have to notify the AP when it does).
It also adds the is_present field to indicate whether the battery is
physically present or not (when we can tell), so we know whether to try to
wake up a deep-discharged battery.
Along with that, we clean up the error flags to provide indication of which
fields were unable to be read, and replace the manual logical-or of all
errors as they were set with a bitmask (BATT_FLAG_BAD_ANY).
No functionality is changed, only new & better information is provided for
use in the upcoming cleanup of the charge state machine.
BUG=chrome-os-partner:20881
BRANCH=ToT
TEST=make buildall -j
All targets build; all tests pass.
Change-Id: I4312c2fdd3cf2dd9570718e90571eff796b269db
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/191917
Reviewed-by: Randall Spangler <rspangler@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Smart batteries can report capacity in mAh or 10mW units. We forced
the units to mAh in charge_state.c's main loop, but that doesn't
guarantee that they're actually set before the capacity is read. It's
cleaner to check the capacity reporting mode when actually reading the
capacity.
BUG=chrome-os-partner:20881
BRANCH=none
TEST=battery command reports the same capacity data before/after change
(on rambi, design=2940 mAh)
Change-Id: I4a4c80eaade72bb09627d5d65693c097e264a992
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/176154
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The charge state machine asks for all of this stuff at the same time
anyway. Bundling it into a single function removes a number of
redundant (and painfully slow) I2C reads.
Also refactor the battery debug command so it doesn't have so many
local variables all in one function; it was consuming considerably
more stack space than any other debug command.
Spring still needs low-level access to the smart battery, so move the
two functions it needs directly into the Spring implementation.
BUG=chrome-os-partner:20881
BRANCH=none
TEST=charge/discharge rambi, pit and spring; watch debug messages and
LED and output of 'battery' debug command. All should behave the
same as before. Then run 'taskinfo' and see that the console task
has at least 20 bytes unused.
Change-Id: I951b569542e28bbbb58853d62b57b0aaaf183e3f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177797
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The smart battery status register holds some useful info. This displays it
along with all the other stuff.
This decodes the alarm and status bits, but not the error code, since that
field is only valid immediately after a failed i2c transaction (that's how
the battery indicates error). Since we do all sorts of automatic battery
probing in other threads, that value will never be reliable when we run the
"battery" console command.
BUG=none
BRANCH=none
TEST=manual
Run "battery". You should see a new line amongst the output:
Status: 0x00c0 DCHG INIT
Change-Id: I5e684198af2cf7767f89786c91a7d946ad95d4c2
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175659
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, it was really confusing whether I2C_PORT_HOST meant the
port where the EC was the master, or the port used to talk to the AP.
No functional changes, just a global find/replace and some tidying of
unused comments.
BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms; pass unit tests
Change-Id: Ia591ba4577d3399729556e0234ba0db3a0e3c5ea
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/174546
Reviewed-by: Alec Berg <alecaberg@chromium.org>
|
|
The common/ subdir was getting cluttered. Move drivers for external
components to a new driver/ tree, and move what used to be called
chipset_*.c to a new power/ directory.
This does not move/rename header files or CONFIG options. That will
be done in subsequent steps, since moving and modifying .c files in
the same CL is harder to review.
BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all boards; pass unit tests
Change-Id: I67a3003dc8564783a320335cf0e9620a21982d5e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/173601
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
|