| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the interest of making long-term branch maintenance incur as little
technical debt on us as possible, we should not maintain any files on
the branch we are not actually using.
This has the added effect of making it extremely clear when merging CLs
from the main branch when changes have the possibility to affect us.
The follow-on CL adds a convenience script to actually pull updates from
the main branch and generate a CL for the update.
BUG=b:204206272
BRANCH=ish
TEST=make BOARD=arcada_ish && make BOARD=drallion_ish
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch makes the battfake command apply the fake SoC to the
display SoC as well as the raw battery SoC.
This patch also cleans up battery_compensate_params.
BUG=None
BRANCH=None
TEST=Atlas
Change-Id: Ifbdaa81204d27501df8a4f5e025c19a79d62feff
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2994748
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
|
|
|
|
|
|
|
|
|
|
| |
BUG=none
BRANCH=none
TEST=buildall
Change-Id: Iebf0817c1b605d74348c9b20c01df74bd69468d2
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2929338
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add Smart Battery emulator which is emulated device on i2c bus. Emulated
battery properties are defined through device tree, but they can be
changed in runtime through Smart Battery emulator API. It allows to set
custom handlers for write and read messages to emulate more complex
scenarios or malfunctioning device.
BUG=b:184855975
BRANCH=none
TEST=none
Signed-off-by: Tomasz Michalec <tm@semihalf.com>
Change-Id: Ia94a0a122123e3259882dfdc80d067c61c98379b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2903206
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Queue: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix a bug from CL:2747559, virtual battery returns an error
for SB_AVERAGE_CURRENT. virtual battery handler should call
battery_get_avg_current(), not battery_get_avg_voltage().
BRANCH=none
BUG=b:170921599
TEST=read current_avg knob in kukui
Signed-off-by: Ikjoon Jang <ikjn@chromium.org>
Change-Id: I90c26a8e1d4fa6faccc0166b9f7b63fca9baef51
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2751320
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix the battery charging status for gauge bq27542.
BUG=b:174725434
BRANCH=master
TEST=1.make -j BOARD=kakadu
2.verified the battery charging status and the result is OK.
Change-Id: Ie3a926dd96b967679d2c51856afc3d1c157835f5
Signed-off-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2576196
Reviewed-by: Chen-Tsung Hsieh <chentsung@chromium.org>
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix the battery is_present status for gauge bq27542.
BUG=b:174802149
BRANCH=master
TEST=1.make -j BOARD=kakadu
2.verified the battery present status and the result is OK.
Change-Id: Ic8d9d503bc2f7d9648df56c150018f304aacfb18
Signed-off-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2571145
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Configure battery parameter and driver for gauge bq27542 on kakadu.
BUG=b:172197008, b:171456201
BRANCH=master
TEST=1.make -j BOARD=kakadu
2.verified the battery parameter and the result is OK.
Change-Id: I4c2cc11df1e13cb7313280afca717a7f1e2461ff
Signed-off-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2531765
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, only the state of charge is modified by battfake command.
This patch applies the faked state of charge to the remaining capacity
as well.
BUG=b:163721887
BRANCH=Octopus
TEST=Verified Fleex wakes up host on BATTERY_LEVEL_CRITICAL.
TEST=Verified powerd reports faked state of charge.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: I34eb409bab129804a983abbe2a1d021298ce044e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2432865
Reviewed-by: Todd Broch <tbroch@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The newer kernels request this data.
Add the battery_manufacture_date() as a new API.
Checked the TRMs of the following batteries. They don't have any way to
query the manufacture date, so return EC_ERROR_UNIMPLEMENTED.
* bq27541
* bq27621_g1
* max17055
* mm8013
BRANCH=None
BUG=b:160784792
TEST=Hacked to print the manufacture date, on both battery present and not.
Change-Id: I1deefb64f6cc594828d6c10c42fa7107dadd7559
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2300689
Commit-Queue: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix the typo: should be SB_MANUFACTURE_DATE (manufacture without r)
* Fix the register, i.e. SB_MANUFACTURE_DATE, not SB_SPECIFICATION_INFO
* Fix the format parsing. The LSB of year is bit-9, not bit-8.
BRANCH=None
BUG=b:160784792
TEST=With the later CL, checked the manufacture date.
Change-Id: I5b5f2bfefec4bbe700bb1ec0d9d6048123f4ad16
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2300688
Reviewed-by: Douglas Anderson <dianders@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It only enables smart battery pass-through host commands,
and has no effect on EC_CMD_I2C_PASSTHRU.
BUG=none
BRANCH=none
TEST=none
Signed-off-by: Edward Hill <ecgh@chromium.org>
Change-Id: If391545623d28fb7ef772fca7c38d7b0afafcb06
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2136527
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Kodama's bitbang driver fails randomly, and there's no way to notify
kernel side that bitbang read failed (batt->flags does not propagate
into kernel).
Thus, if any value in batt_params is bad, replace it with a cached
good value, to make sure we never send random numbers to kernel side.
BUG=b:144195782
TEST=Modify smart battery driver to make sb_read has 50% fail rate,
and monitor /sys/class/power_supply/sbs*/*, make sure the bad values
does not observable in kernel.
BRANCH=kukui
Change-Id: Idf4691eb743f1ef785593b308b8f07a34e5ea642
Signed-off-by: Ting Shen <phoenixshen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1943637
Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a reland of daccb3adea9394116d7ab2c807e4a360cb5a93a1
Original change's description:
> smart_battery: add smbus error checking support
>
> Jacuzzi/Kodama has a unstable software controlled i2c bus, its data
> transmission may be interrupted by other higher priority tasks and
> causes device timeout.
>
> If timeout happens when ec is reading data, it has no knowledge about
> what's happening on slave, and keep receiving bad data (0xFF's) until
> end. The standard i2c/smbus error handling mechanism can not handle this
> case, so we need the error checking feature from smbus 1.1 to ensure our
> received data is correct.
>
> This CL adds the error checking (PEC) functions to i2c and smart battery
> module.
>
> BUG=b:138415463
> TEST=On kodama, enable CONFIG_CMD_I2C_STRESS_TEST,
> no failure after 100k read/writes.
> test code at CL:1865054
> BRANCH=master
>
> Change-Id: Ibb9ad3aa03d7690a08f59c617c2cd9c1b9cb0ff3
> Signed-off-by: Ting Shen <phoenixshen@google.com>
> Reviewed-on: http://crrev.com/c/1827138
> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
> Tested-by: Ting Shen <phoenixshen@chromium.org>
> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
BUG=b:138415463
TEST=in addition to the TESTs above, verified this CL boots on
hatch(npcx chips), and reef_it8320(it83xx chips).
BRANCH=master
Change-Id: I67975eee677cfd6e383742d48103662372cac061
Signed-off-by: Ting Shen <phoenixshen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1913940
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It takes 850ms~950ms to get valid RSOC after battery wake-up.
Sometimes battery FG returns garbage data(1%)
as RSOC and 0 value of desired current / voltage.
Add CONFIG_BATTERY_DEAD_UNTIL_VALUE to continue charging.
BUG=b:138413964
BRANCH=None
TEST=build & flash, check battery charging with dead battery
Change-Id: I0cbe30aa973499b0c27faf9b6da03a0344ad1065
Signed-off-by: YongBeum Ha <ybha@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1918985
Reviewed-by: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The 'batttempfake' command allows overriding the battery temperature
reading, to test scenarios where the battery temperature affects the
charging operations.
BUG=None
BRANCH=None
TEST=Set GBB flags to disable software sync and disable rollback checks
$ make -j BOARD=kohaku
$ ./util/flash_ec --board=kohaku
When the system reboots, open the EC console and execute the commands:
> help batttempfake
Usage: batttempfake temperature (-1 = use real temperature)
Set fake battery temperature in deciKelvin (2731 = 273.1 K = 0 deg C)
> batttempfake 2731
Fake batt temperature 273.1 K
> battery
...
Temp: 0x0aab = 273.1 K (0.0 C)
...
> batttempfake -1
> battery
...
Temp: 0x0bc9 = 301.7 K (28.6 C)
...
Change-Id: I4c1fff13f3fec34e9e20d0016f66bd5c693e1537
Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1910582
Reviewed-by: Justin TerAvest <teravest@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit daccb3adea9394116d7ab2c807e4a360cb5a93a1.
Reason for revert: <INSERT REASONING HERE>
broke USB-C charging. all we get now is:
2019-10-30 01:26:15 New chg p0[49.441303 CL: p0 s2 i500 v5000]
2019-10-30 01:26:16 C0 st5
2019-10-30 01:26:16 C0 Req [1] 5000mV 3000mA
2019-10-30 01:26:16 New chg p0[50.305144 CL: p0 s0 i500 v5000]
2019-10-30 01:26:16 C0 HARD RST RX
2019-10-30 01:26:16 C0 st4
2019-10-30 01:26:16 New chg p0[50.354280 CL: p0 s2 i500 v5000]
2019-10-30 01:26:17 C0 st5
2019-10-30 01:26:17 C0 Req [1] 5000mV 3000mA
...
Original change's description:
> smart_battery: add smbus error checking support
>
> Jacuzzi/Kodama has a unstable software controlled i2c bus, its data
> transmission may be interrupted by other higher priority tasks and
> causes device timeout.
>
> If timeout happens when ec is reading data, it has no knowledge about
> what's happening on slave, and keep receiving bad data (0xFF's) until
> end. The standard i2c/smbus error handling mechanism can not handle this
> case, so we need the error checking feature from smbus 1.1 to ensure our
> received data is correct.
>
> This CL adds the error checking (PEC) functions to i2c and smart battery
> module.
>
> BUG=b:138415463
> TEST=On kodama, enable CONFIG_CMD_I2C_STRESS_TEST,
> no failure after 100k read/writes.
> test code at CL:1865054
> BRANCH=master
>
> Change-Id: Ibb9ad3aa03d7690a08f59c617c2cd9c1b9cb0ff3
> Signed-off-by: Ting Shen <phoenixshen@google.com>
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1827138
> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
> Tested-by: Ting Shen <phoenixshen@chromium.org>
> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Bug: b:138415463
Change-Id: Ibd8a512dd6d43cca95628f698e7a66a695b7fc59
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1889435
Reviewed-by: Caveh Jalali <caveh@google.com>
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Commit-Queue: Caveh Jalali <caveh@google.com>
Tested-by: Caveh Jalali <caveh@google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
battery_flag()'s return code is 0 on success.
TEST=see allowing charge in command battery
BUG=None
BRANCH=kukui
Change-Id: I26d6a69deadca1ad5a0f5d7faaa031ed0dffe78d
Signed-off-by: Yilun Lin <yllin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1888004
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Jacuzzi/Kodama has a unstable software controlled i2c bus, its data
transmission may be interrupted by other higher priority tasks and
causes device timeout.
If timeout happens when ec is reading data, it has no knowledge about
what's happening on slave, and keep receiving bad data (0xFF's) until
end. The standard i2c/smbus error handling mechanism can not handle this
case, so we need the error checking feature from smbus 1.1 to ensure our
received data is correct.
This CL adds the error checking (PEC) functions to i2c and smart battery
module.
BUG=b:138415463
TEST=On kodama, enable CONFIG_CMD_I2C_STRESS_TEST,
no failure after 100k read/writes.
test code at CL:1865054
BRANCH=master
Change-Id: Ibb9ad3aa03d7690a08f59c617c2cd9c1b9cb0ff3
Signed-off-by: Ting Shen <phoenixshen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1827138
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the host command handler callback function returns an int, it's easy
to accidentally mix up the enum ec_error_list and enum ec_status types.
The host commands always expect an enum ec_status type, so we change the
return value to be of that explicit type. Compilation will then fail if
you accidentally try to return an enum ec_error_list value.
Ran the following commands and then manually fixed up a few remaining
instances that were not caught:
git grep --name-only 'static int .*(struct host_cmd_handler_args \*args)' |\
xargs sed -i 's#static int \(.*\)(struct host_cmd_handler_args \*args)#\
static enum ec_status \1(struct host_cmd_handler_args \*args)##'
git grep --name-only 'int .*(struct host_cmd_handler_args \*args)' |\
xargs sed -i 's#int \(.*\)(struct host_cmd_handler_args \*args)#\
enum ec_status \1(struct host_cmd_handler_args \*args)##'
BRANCH=none
BUG=chromium:1004831
TEST=make buildall -j
Cq-Depend: chrome-internal:1872675
Change-Id: Id93df9387ac53d016a1594dba86c6642babbfd1e
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1816865
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Tighter battery present status by returning BP_NO.
charger task will try to charge battery when battery present
status is BP_NOT_SURE, and this would put PD and charger
tasks in a weird state (and keep resetting) if the battery is
actually not present.
TEST=boot krane w/o battery and w/ PD charger, and see it doesn't
reset for over 5 mins.
BUG=b:139509751
BRANCH=none
Change-Id: I3e3d818b80ffcfdb12fbd83daafa792d837a0fe0
Signed-off-by: Yilun Lin <yllin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1765108
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The extentions were added to make the compiler perform most
of the verification that the conversion was being done correctly
to remove 8bit addressing as the standard I2C/SPI address type.
Now that the compiler has verified the code, the extra
extentions are being removed
BUG=chromium:971296
BRANCH=none
TEST=make buildall -j
TEST=verify sensor functionality on arcada_ish
Change-Id: I36894f8bb9daefb5b31b5e91577708f6f9af2a4f
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704792
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Opt for 7bit slave addresses in EC code. If 8bit is
expected by a driver, make it local and show this in
the naming.
Use __7b, __7bf and __8b as name extensions for i2c/spi
addresses used in the EC codebase. __7b indicates a
7bit address by itself. __7bf indicates a 7bit address
with optional flags attached. __8b indicates a 8bit
address by itself.
Allow space for 10bit addresses, even though this is
not currently being used by any of our attached
devices.
These extensions are for verification purposes only and
will be removed in the last pass of this ticket. I want
to make sure the variable names reflect the type to help
eliminate future 7/8/7-flags confusion.
BUG=chromium:971296
BRANCH=none
TEST=make buildall -j
Change-Id: I2fc3d1b52ce76184492b2aaff3060f486ca45f45
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699893
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
CONFIG_SMBUS is not used. Cleaning up the code by
removing this.
Added a comment to document the removal and why. This will
give a way to find the code if we ever needed to bring it back
BUG=chromium:982316
BRANCH=none
TEST=make buildall
Change-Id: I40703a95bc849538e1aee32f6f96beab811285bd
Signed-off-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704279
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ran the following command:
git grep -l 'Copyright (c)' | \
xargs sed -i 's/Copyright (c)/Copyright/g'
BRANCH=none
BUG=none
TEST=make buildall -j
Change-Id: I6cc4a0f7e8b30d5b5f97d53c031c299f3e164ca7
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663262
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds the full model driver for MAX17055. The full model of
MAX17055 provides more accurate soc estimation than the short model or
ez model.
BUG=b:130979269
BRANCH=none
TEST=Do a full charge test
Change-Id: I4cf249cf0c47fd30f75f4e38b74c7995285603e6
Signed-off-by: YH Lin <yueherngl@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1577387
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Return ERROR_UNIMPLEMENTED causes "ectool battery" to fail.
Need to return some dummy value.
BUG=b:131034963
TEST=ectool battery
BRANCH=None
Change-Id: I66df131db3b532efd56afab87e97bb3def2fb01f
Signed-off-by: Ting Shen <phoenixshen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1575350
Commit-Ready: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As requested in b:128393179, set the device name to '0x4010' for HWID
probing.
BUG=b:128393179
TEST=Verify 'Device: 0x4010' appears in 'battery' console command.
BRANCH=None
Signed-off-by: Ting Shen <phoenixshen@google.com>
Change-Id: Icf4dad3296a5e14d77cc8254146f8d149fade90c
Reviewed-on: https://chromium-review.googlesource.com/1520566
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Zhuohao Lee <zhuohao@chromium.org>
Reviewed-by: Yilun Lin <yllin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Revert CL:982334 since we might want a smoother battery life prediction
curve.
BUG=b:125946757
TEST=Run a full battery cycle and observe the values reported by ec.
BRANCH=none
Change-Id: I32d0f05377580df5dc4ff4bce97b6214e5698c2f
Signed-off-by: Ting Shen <phoenixshen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1485041
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implements battery-cutoff SMBus write block function
BUG=b:122944526
BRANCH=None
TEST=Verify battery cuff on fleex via SMBus block write.
Change-Id: Ib52146cd3042c4a6d2dbafadd430591936230891
Signed-off-by: matt_wang <matt_wang@compal.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/1470462
Commit-Ready: Justin TerAvest <teravest@chromium.org>
Tested-by: Justin TerAvest <teravest@chromium.org>
Tested-by: Elmo Lan <elmo_lan@compal.corp-partner.google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
Reviewed-by: Elmo Lan <elmo_lan@compal.corp-partner.google.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implements basic functions that makes mm8013 looks like a battery on ec
side.
BUG=b:123267889
TEST=Build a kukui ec with CONFIG_BATTERY_MM8013 defined, verify the
battery readings are sane.
BRANCH=None
Change-Id: Ica5237b5425681447f3cac0f0889a0ebdc35bf8f
Signed-off-by: Ting Shen <phoenixshen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1469192
Commit-Ready: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Yilun Lin <yllin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clearing batt_param everytime when calling battery_get_params may cause
AP getting weird battery information through host_command due to
preemption. We should update the batt_param as a whole.
BUG=b:119322063, b:73347743, b:117061273
TEST=on kukui, remove batt, connect pd, see battery output in console
> batt
Status: 0x0040 DCHG
Param flags:00000000
Temp: 0x0000 = 0.0 K (-273.1 C)
V: 0x0000 = 0 mV
V-desired: 0x0000 = 0 mV
I: 0x0000 = 0 mA
I-desired: 0x0000 = 0 mA
Charging: Not Allowed
Charge: 0 %
Manuf: <unkn>
Device: <BATT>
Chem: <unkn>
Serial: 0xffffffff
V-design: 0x0f14 = 3860 mV
Mode: (unsupported)
Abs charge:(unsupported)
Remaining: 6355 mAh
Cap-full: 6910 mAh (6771 mAh with 98 % compensation)
Display: 0.0 %
Design: 6910 mAh
Time-full: 102h:23
Empty: 102h:23
TEST=on connect batt, connect pd, see battery output in console
> batt
Status: 0x0000
Param flags:00000003
Temp: 0x0bae = 299.0 K (25.9 C)
V: 0x0ef4 = 3828 mV
V-desired: 0x1130 = 4400 mV
I: 0x0067 = 103 mA(CHG)
I-desired: 0x07d0 = 2000 mA
Charging: Allowed
Charge: 49 %
Manuf: <unkn>
Device: <BATT>
Chem: <unkn>
Serial: 0xffffffff
V-design: 0x0f14 = 3860 mV
Mode: (unsupported)
Abs charge:(unsupported)
Remaining: 3440 mAh
Cap-full: 6910 mAh (6771 mAh with 98 % compensation)
Display: 0.0 %
Design: 6910 mAh
Time-full: 0h:0
Empty: 102h:23
BRANCH=None
Change-Id: I752a3842e6ca54dc8cad98a1099387e0088cc48d
Signed-off-by: Yilun Lin <yllin@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1345551
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Yilun Lin <yllin@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The full capacity known by the host may slightly differ from the full
capacity known by the EC because we notify the host of the new
capacity only if the difference is larger than 5 mAh.
This patch makes the EC use the host's full capacity instead of the
local full capacity to compute the display percentage.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=b:109954565,b:80270446
BRANCH=none
TEST=Verify display percentages printed by EC and power_supply_info
move up synchronously on charge and the LED and the taskbar icon
turn to full at the same time.
TEST=buildall
Change-Id: Ie695a9937a22fc7a769b82448f4600d4491935b3
Reviewed-on: https://chromium-review.googlesource.com/1330101
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If remaining charge is more than x% of the full capacity, the
remaining charge is raised to the full capacity before it's
reported to the rest of the system.
Some batteries don't update full capacity timely or don't update it
at all. On such systems, compensation is required to guarantee
the remaining charge will be equal to the full capacity eventually.
On some systems, Rohm charger generates audio noise when the battery
is fully charged and AC is plugged. A workaround is to do charge-
discharge cycles between 93 and 100%. On such systems, compensation
was also applied to mask this cycle from users.
This used to be done in ACPI, thus, all software components except EC
was able to see the compensated charge. This patch is moving the logic
to EC. With this and the following changes, EC can see what the rest
of the system sees, thus, can control LEDs synchronously (to the
display percentage).
Another rationale of this move is EC can perform more granular and
precise compensation than ACPI since it has more knowledge about the
battery and the charger.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
CQ-DEPEND=CL:1320195
BUG=b:109954565,b:80270446
BRANCH=none
TEST=Verify charge LED changes to white (full) on Sona synchronously
to the display percentage.
TEST=Verify charge LED changes to blinking white (low) on Sona
within 30 seconds synchronously to the display percentage.
Change-Id: I4e3f70efa39e62c91cb8894b603c551cd23511aa
Reviewed-on: https://chromium-review.googlesource.com/1312204
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MAX17055 support 4 kinds of alert: voltage, current, state-of-charge,
and temperatore. This CL enables this functionality.
datasheet: https://datasheets.maximintegrated.com/en/ds/MAX17055.pdf
TEST=manually test on Kukui.
BUG=b:111378620
BRANCH=None
Change-Id: I94126fdc541f9456c8f48f42383bc6e2188257e2
Signed-off-by: Yilun Lin <yllin@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1276006
Commit-Ready: Yilun Lin <yllin@chromium.org>
Tested-by: Yilun Lin <yllin@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
BUG=b:117061273
TEST=on kukui, remove batt, connect pd, see battery output in console
> battery
Status: 0x0000
Param flags:000007fc
Temp: 0x0000 = 0.0 K (-273.1 C)
V: 0x0000 = 0 mV
V-desired: 0x0000 = 0 mV
I: 0x0000 = 0 mA
I-desired: 0x0000 = 0 mA
Charging: Not Allowed
Charge: 0 %
Manuf: <unkn>
Device: <BATT>
Chem: <unkn>
Serial: 0xffffffff
V-design: 0x0f14 = 3860 mV
Mode: (unsupported)
Abs charge:(unsupported)
Remaining: 6334 mAh
Cap-full: 6910 mAh
Design: 6910 mAh
Time-full: 0h:0
Empty: 102h:23
TEST=on connect batt, connect pd, see battery output in console
BRANCH=None
Change-Id: Ied338266fa0f7713da408438460bc97d4db01e6f
Signed-off-by: Yilun Lin <yllin@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1253372
Commit-Ready: Yilun Lin <yllin@chromium.org>
Tested-by: Yilun Lin <yllin@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These are two of the three batteries for Liara. Retain the Grunt
reference design battery for testing purposes only.
BUG=b:113823864
TEST=buildall
BRANCH=none
Change-Id: Ibfdfa08298ec142504b24477746ebb87aebc913c
Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1204696
Reviewed-by: Jett Rink <jettrink@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Measure the cell imbalance with method dispatch to a per-battery
method, such that families with a plurality of configurable batteries
can support them all. By default, cell imbalance is taken to be 'zero'
in case we don't support that battery's management IC. Provide a driver
for reading cell voltages for the TI BQ4050 family. This IC is quite
popular, but by no means universal.
BUG=b:111214767
BRANCH=none
TEST=Boot on Careena with a custom debug print statement, showing that
we can measure the typical battery voltages during and after the boot at
the battery status polling interval.
Change-Id: I235389b252ac9c373aa9706dbd1066f7c0bbce71
Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1162663
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the wrong battery profile is loaded into max17055, we need
to be able to recover it after EC POR by reloading the correct profile.
BUG=b:77491650
BRANCH=scarlet
TEST=First, unplug/replug battery many times until I see
the battery profile loaded is wrong (1/20).
Second, make sure after a hard reset the correct battery profile
is loaded.
Change-Id: Iabb24fc75d31b9ce87bfb835e03549f4726903ed
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/991192
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
After a POR, max17055 takes ~2.5 seconds to finish the detection
for battery absence.
Let's report BP_NOT_SURE instead of the default BP_YES when the battery
detection result is not settled yet.
BUG=b:72697658
BRANCH=scarlet
TEST=boot scarlet w/o battery and confirm battery_is_present()
never return BP_YES before reporting BP_NO
Change-Id: Ia549b4b78a7403ce2c82802841b78bdd514c6200
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/989313
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
BUG=b:74321682
BRANCH=scarlet
TEST=battery command shows current change instantaneously when
AC charger is plugged/unplugged
Change-Id: Ic47efbdfc861355325ee2c69be09fbcfa1394654
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/977022
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
BUG=b:74841068
BRANCH=scarlet
TEST='/sys/class/power_supply/sbs-9-000b/status' shows
discharging/charging/full status correctly
Change-Id: I4216ba2d95ac82a9f600d8685d993cb5b37206d8
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/969747
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The cycle counts we get from battery_cycle_count()
is in the unit of 1%.
But we should convert it to absolute count to match
the behavior of a smart battery.
BUG=b:74576000
BRANCH=scarlet
TEST='ectool battery' shows reasonable cycle counts
Change-Id: I9d351f8766c90e0addb72a088917ddadfa6c840a
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/961303
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For boards using max17055 and dumb battery, we can always
read battery parameters from max17055 regs, even if the
read values are out of whack.
So it doesn't make sense to determine battery is present
because we can read these parameters from max17055.
Meanwhile, we have to set CONFIG.TSEL on max17055 as early
as possible because this is required for max17055 to detect
battery presense.
BUG=b:72697658
BRANCH=scarlet
TEST=boot scarlet rev3 w/o battery on Type-C/PD chargers
Change-Id: Id190f0c2aa5bcd62dbe3edccca6460bf145cff01
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/933702
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
pwr_avg provides an average voltage, current, and power over the last
1 minute. It's up to the battery drivers to implement this
functionality.
This change allows us to have better power tracking while minimizing
the power impact on the EC, because
- the pwr_avg command only needs to be called once every minute, and is
short, thus less expensive to parse on ECs without a UART buffer
- the work done to keep the avg is partially done by the batteries
already and it's just a question of retrieving it.
undefined on wheatley since no power debugging planned on that board.
usage:
> pwr_avg
mv = 7153
ma = -605
mw = -4327
BUG=chromium:752320
BRANCH=None
TEST=make buildall -j
Change-Id: Id1a3479d277aedf90dfa965afb4ee9136654b1cf
Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/823884
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We've been using the basic configuration (EZ config) to
initialize max17055.
It doesn't require battery profile, but the accuracy of fuel gauge
is not the best.
With a full battery profile in place, we should extend our driver
to import the battery profile for advanced config.
It should boost the accuracy.
BUG=b:69634899
CQ-DEPEND=CL:812481
BRANCH=none
TEST=manually test on Scarlet rev2, 'battery' command shows reasonable
reading no matter is_ez_config is set as 0 or not.
Change-Id: Iaea2d3e20f5de4207a86d4fff5f1561aaba4d362
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/813038
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
CONFIG_SB_FIRMWARE_UPDATE is dead on ToT. So, get rid it completely.
BUG=b:69695376
BRANCH=None
TEST=make -j buildall
Change-Id: Ic1eedff21d82f729a73ec9a7c1d554b6b571e827
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/792013
Reviewed-by: Shawn N <shawnn@chromium.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We didn't set BATT_FLAG_WANT_CHARGE in battery_get_params(), so
battery command always shows 'charging not allowed'.
Let's set the flag in the same condition as it is set in
battery/smart.c.
BUG=b:68027469
BRANCH=none
TEST='battery' on EC console shows 'Charging: Allowed'
Change-Id: Ifbdb6aee2572c8fc5f67103ca940738fb221ce5d
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/749025
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
|