Commit Graph

18 Commits

Author SHA1 Message Date
Shawn Nematbakhsh
f08109522d charge_ramp: Specify port number in board_is_vbus_too_low()
charge_ramp needs to make a decision based upon the VBUS level on one
specific port - the port that is ramping. The VBUS level on any other
charge ports (if present) is not relevant.

BUG=chrome-os-partner:54099
BRANCH=reef, gru
TEST=With subsequent patches, verify charge_ramp success with a variety
of BC1.2 chargers.

Change-Id: Ie0a51a577e2b7491222560cd08dd5321ff3b7975
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/435561
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-02-02 19:09:52 -08:00
Martin Roth
897ce78bdd Fix various misspellings in comments
No functional changes.

BUG=none
BRANCH=none
TEST=make buildall passes

Change-Id: Ie852feb8e3951975d99dce5a49c17f5f0e8bc791
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403417
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2016-11-15 17:41:53 -08:00
Vijay Hiremath
b1462bf1f3 charger: BD99955: Get the VBUS level from the charger
Added code to get the VBUS level by reading the charger registers.

BUG=chrome-os-partner:55117
BRANCH=none
TEST=Manually tested on Amenia, VBUS_VAL (5Ch) & VCC_VAL (5Eh)
     registers are updated with the correct VBUS value on the
     respective ports.

Change-Id: I3b019b2d87e4c347f12596df387a2a659092ae25
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/359416
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-07-13 19:09:39 -07:00
Shawn Nematbakhsh
0af6e77a3a charger: Change unlocked battery level ignore conditions
x86 systems will auto-power-on when power is applied to the EC. When
the battery level is critically low, power-on is prevented, except when
the system is unlocked. So, when unlocked, some systems will
auto-power-on regardless of battery level, overcurrent the charger /
battery, and then repeat forever.

Prevent this reboot loop by ignoring auto-power-up when the battery is
critically low, regardless of system unlocked status.

BUG=chrome-os-partner:48339
TEST=Verify power-up is prevented on no-battery chell w/ donette. Then,
run 'powerbtn' on EC console and verify system powers on (and
overcurrents).
BRANCH=None

Change-Id: Ia631b5a8c45b42ec805e4a0c3f827929a0efd236
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/319187
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2016-01-06 18:48:11 -08:00
Alec Berg
75f740fa23 glados: isl9237: add HW charge ramping
Add HW charge ramping option and enable on glados.
Modify charge_manager to enable/disable HW charge ramping
when option is defined.

Unfortunately, the isl9237 doesn't have a way to determine
what the input current limit has settled on, so the EC will
always report the max input current for that supplier.

BUG=chrome-os-partner:47335
BRANCH=none
TEST=plug in CDP, SDP, DCP, type-C, and PD charger. Make sure
we ramp to a reasonable value for the correct suppliers.
Make sure we don't ramp for type-C and PD chargers.

Change-Id: Ib541fa0be48d8f4d261c71b853b0ee72b2adbf6b
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/311301
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-11-09 12:49:30 -08:00
Shawn Nematbakhsh
4578166a89 charger: Inhibit power-on until charger is initialized
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>
2015-07-22 22:30:00 +00:00
Alec Berg
ac1cba419a cleanup: remove board_discharge_on_ac() unless custom func needed
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>
2015-07-14 22:39:36 +00:00
Bill Richardson
65df2fd6e4 Add "debug" option to charge_state_v2.c
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>
2014-05-15 05:28:08 +00:00
Bill Richardson
9151377708 Add charger_get_params() function to query charger state.
This returns all the parameters of the charger that must be monitored
frequently. While some of the fields are charger-specific, all of the
parameters are present in all supported chargers.

Nothing uses this yet.

BUG=chrome-os-partner:20881
BRANCH=ToT
TEST=make buildall -j

All targets build; all tests pass.

Change-Id: Id3e00532469b193aeab3acf93e94afe3ffb8c6b6
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/191985
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-03-28 15:23:04 +00:00
Justin Chuang
fc91a7f7fd Support discharge on BQ24715 for Rambi and Squawks
BUG=chrome-os-partner:25031
BRANCH=rambi
TEST=Manually
  make BOARD=peppy
  make BOARD=falco
  make BOARD=rambi
  make BOARD=squawks
  On rambi and squawks, connect charger
     ectool chargecontrol discharge
     ectool i2cread 16 0 0x16 0x0a
     It should return 16-bit negative integer.

Change-Id: I8a8dfa90d2ad82595ac7a420c3c8ffc13b12cde6
Signed-off-by: Justin Chuang <jchuang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182586
Reviewed-by: Dave Parker <dparker@chromium.org>
2014-01-16 06:43:05 +00:00
Vic Yang
0492ff9204 Temporary OTG and external power support
This is only for initial bringup that requires OTG to boot kernel. Note
that we are expecting firmware for USB ID detection and hardware change
to charger chip, so this is likely going to be thrown away.

BUG=chrome-os-partner:21964
TEST=Plug in OTG dongle and check VBUS voltage is ~5V
TEST=Unplug and check it's ~0V.
BRANCH=None

Change-Id: Iee66bef117188fea14a76459945be3bf5afef0dd
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/167832
2013-09-05 07:20:13 +00:00
Dave Parker
c243537dda Constrain charging voltage to values chargers can provide.
BUG=chrome-os-partner:20863
BRANCH=falco,peppy,slippy,wolf
TEST=Manual. On Peppy, there should no longer be "Charging
Voltage" messages every second on the EC console. On other platforms
verify that V_Batt reported by the 'charger' command is divisible
by 16.

Change-Id: Idd775a1d8033ff3405d10919e1e15ddddebc6c23
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62699
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-19 18:01:48 -07:00
Bill Richardson
124b2f1492 Add support for TI's Smart Battery Charger BQ24707A
This is very similar to the BQ24725. There are just enough differences to
require a separate file.

BUG=chrome-os-partner:19976
BRANCH=none
TEST=none

Nothing to test until it's enabled.

Change-Id: I3247fcfde93ac75f5f9790acadc7feca28038608
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/57811
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-06-07 10:52:11 -07:00
Randall Spangler
8b592052ce Only ask the charger for current steps it can supply
This reduces oscillations in the charging algorithm.  This change also adds
more debug output so it's easier to see what the charging state machine is
doing.

BUG=chrome-os-partner:9572
BRANCH=link
TEST=discharge battery; charge battery; note infrequent but useful debug output

Change-Id: I4c8609c2ca8a6cab3eae151ecf2bb1520103fece
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/33811
Reviewed-by: Rong Chang <rongchang@chromium.org>
2012-09-24 10:56:50 -07:00
Randall Spangler
ee3edc0116 Clean up inits
We can clear the reset cause in system pre-init now because of a
previous change which preserves it across a sysjump.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=none
TEST=if it boots, it works

Change-Id: I1d8b99df5a0be0de9545d22ad1a6b7fb3140f813
2012-04-19 11:08:28 -07:00
Rong Chang
62df62ccd4 Add basic smart battery driver
This change adds a common part of smart battery driver. Following
features are not implemented, or in chip specific driver:
  Battery access control, authentication, factory mode
  Manufacturer access/data commands
  Block read/write, device name, flash data
  Chip specific features, per cell info/temp/capacity

Signed-off-by: Rong Chang <rongchang@google.com>
BUG=chrome-os-partner:7856
TEST=console command check battery staus
  [unplug power]
  > battery
  [check voltage,current,capacity,time to empty]
  [plug power]
  > charger voltage 8400
  > charger current 4250
  > battery
  [check current,time to full]
  > charger input 4032
  > battery
  [check current,time to full]
  [wait 130 seconds, charger watch dog timeout]
  > battery
  [check current]

Change-Id: Ifac17a0892f52e8f37eebc14b00e71f18360776c
Signed-off-by: Rong Chang <rongchang@chromium.org>
2012-02-10 16:12:56 -08:00
Rong Chang
812b3f8cb6 Initial bq24725 charger driver import
Battery charging state machine contains many file changes.
This is the 1st part of the break down. Refactor original
test code into board dummy driver. Normalize charger API.
And import link's charger IC driver.

Signed-off-by: Rong Chang <rongchang@google.com>
BUG=chrome-os-partner:7855
TEST=build without warning and error
  BOARD=bds make
  BOARD=link make
  BOARD=discovery make

Change-Id: I34b6e9862a45331378916bc77653d4adb22ca548
2012-02-07 12:54:28 -08:00
Vic Yang
000a6d5742 Refactor temperature sensor code and add support of Link I2C temp sensor.
Refactor board/chip-specific code into corresponding directories.
Add support of the four I2C temp sensor in Link.
Use table lookup to handle different types of temperature sensors.

BUG=chrome-os-partner:7527
TEST=Correctly read EC internal temperature on bds.
Compile for link succeeded.

Change-Id: I694cfa54e1545798d877fafdf18c5585ab5f03e2
2012-02-04 14:37:04 +08:00