Commit Graph

19 Commits

Author SHA1 Message Date
Shawn Nematbakhsh
b87fe062ec charge_ramp: Move ramp allowed / ilim callbacks to common code
The decision on whether to ramp (and how high) depends on the quirks of
charger identification, so move the decision out of board, into the
drivers that implement usb_charger.

Also, rename CONFIG_CHARGE_RAMP to CONFIG_CHARGE_RAMP_SW, to better
contrast with the existing CONFIG_CHARGE_RAMP_HW.

BUG=None
TEST=Manual on kevin, verify ramp occurs when port plugged into Z840
workstation.
BRANCH=None

Change-Id: I5b395274133837a18a4f4ac34b59b623287be175
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/702681
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-06 13:47:12 -07:00
Daisuke Nojiri
60d1bc7891 USB: Remove usb_charge_ports_enabled
usb_charge_ports_enabled is not used.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: I9465b65e9fab2603a4258adc4ae5f16d6bfc93c4
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/481076
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-04-20 13:09:07 -07:00
Shawn Nematbakhsh
48435ece3b bd99955: Improve interrupt / USB charger task wake scheme
Previously our charger ISR called a deferred task which woke our charger
task. We can skip the deferred task and just wake our charger task
directly.

The other meaningful change here is to assume that we're using the
charger for VBUS detection / BC1.2 if we have a usb_chg task, which
holds true for all of our current boards with this charger.

BUG=None
TEST=Manual on kevin with subsequent commit. Verify charger connect /
disconnect detection works properly on both ports, with zinger, donette
and generic DCP charger.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Iad4f3ea90947b50859c549b591675e325717209f
Reviewed-on: https://chromium-review.googlesource.com/352822
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: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-06-16 12:27:42 -07:00
Vijay Hiremath
4e3f5aa4a8 BD99955: Use only one USB charger task for both the ports
There is only one charger IC and one interrupt PIN for both the ports
and also from the ISR it's not possible to decode from which port the
interrupt is triggered hence a deferred function is used to trigger
the wake event for the ports. As there is no additional benefit of
having an extra task, added code to use only one USB charger task for
both the ports.

BUG=chrome-os-partner:54272
BRANCH=none
TEST=Manually tested on Amenia. BC1.2 detection is success
     and the battery can charge on both the ports (VBUS/VCC).

Change-Id: I2745a5a179662aaeef8d48c8c1763919e8853fd0
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/351752
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-06-14 14:12:03 -07:00
Vijay Hiremath
4a6967951f Driver: BD99955: Use Charger interrupt to detect VBUS activity
Added support to enable the BD99955 charger interrupt to detect
the VBUS activity. With this approach GPIO USB_Cx_VBUS_DET_N pin
can be removed.

BUG=chrome-os-partner:53688
BRANCH=none
TEST=Manually tested on Amenia. Type-C, DCP & SDP chargers can
     negotiate to desired current & voltage. Battery can charge.
     USB3.0 & USB2.0 sync devices are detected by the Kernel.

Change-Id: I5470092c5cd43026aafc1a638ba446d0037c71e7
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/343650
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-06-08 19:17:56 -07:00
Alec Berg
39c422597a usb_charge: fix custom event mask
Fix custom event mask, which should be a power of 2.

BUG=none
BRANCH=none
TEST=make -j buildall

Change-Id: Iaeacf9b07817ee94452c58beb6a794a5a9733355
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299262
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-09-11 13:51:07 -07:00
Rong Chang
229bac23f1 oak: handle USB BC 1.2 status change
Before oak rev4, BC 1.2 status change was polled on VBUS change. The
designed is changed to use a single interrupt pin for both ports.

BRANCH=none
BUG=chrome-os-partner:42610
TEST=manual
  make EXTRA_CFLAGS=-DBOARD_REV=3 BOARD=oak -j
  emerge-oak chromeos-ec
  load on oak rev3 and check BC 1.2 charging current

Change-Id: I9e6cdbb83468b5e4086cc86caadf7f2e3cbe6e48
Signed-off-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/294442
2015-09-03 04:24:34 -07:00
Alec Berg
feea8de21b usb_charger: move common usb charger code out of board directory
Move common USB charger code out of board directory including
setting VBUS supplier when VBUS changes, and initializing BC1.2
supplier types on init.

This also enables re-enabling of Pericom BC1.2 detection interrupts
when VBUS is changed on all boards that use USB_CHG task.

BUG=chrome-os-partner:42292
BRANCH=none
TEST=make -j buildall. Tested on glados and samus by plugging in
a few different chargers and making sure we charge.

Change-Id: Ib102fbf7a6aace998e6fcb6d35f3c97e5f03f5c2
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/290453
Reviewed-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
2015-08-05 16:50:46 +00:00
Alec Berg
d804e8fdbd usb_charger: cleanup: move setting usb 2 switches to usb_charger
Move function to set D+/D- switches from board directory to
usb_charger module.

BUG=none
BRANCH=strago
TEST=make -j buildall

Change-Id: I5c5997c799cecea90448444863167af860a8f3e1
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/290421
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-08-04 19:22:07 +00:00
Alec Berg
16d40b0b3c cleanup: define one set of USB charger voltage and min current
Remove duplicate definitions of USB charger min current across
boards and make one set of defines for standard USB charger voltage
and minimum USB charger current.

BUG=none
BRANCH=smaug
TEST=make -j buildall

Change-Id: Ib842fafb317417c8de9a67d314fdde4c1e47ad9d
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/284956
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-07-13 03:18:32 +00:00
Shawn Nematbakhsh
5b7cfac64e usb: pi3usb9281: Allow flexible chip configurations
Previously we supported using a single pi3usb9281 chip, or using two
chips on the same i2c bus behind a mux. Now that we need to support a
third configuration of multiple chips on different busses, it makes
sense to be able to configure the configuration freely at the board
level.

BUG=chrome-os-partner:40920
TEST=Manual on samus_pd. Plug USB charger, verify detection is correct
on both charge ports.
BRANCH=None

Change-Id: I120dcb1c3ceb6f013b92407effcd8cb66e7ffcce
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/276511
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-06-12 16:37:39 +00:00
Randall Spangler
75857e80d0 rambi: Leave 5V rail on in S3 if USB ports are powered
Previously, the 5V rail was disabled unconditionally in the S0->S3
transition.  Now, the rail is left powered if one or both of the USB
ports are powered.

BUG=chrome-os-partner:25178
BRANCH=rambi
TEST=Modify the OS to leave USB ports powered in S3.  Then suspend.  On
     the EC console, 'gpioget pp5000_en' should be 1.

Change-Id: I3c73f3fe228e940317c0da7330f117c7ab0a6d0c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/183548
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2014-01-23 19:32:27 +00:00
Bill Richardson
1ec5206a31 Slippy uses dumb USB ports, not smart ones.
BUG=chrome-os-partner:18825
BRANCH=slippy
TEST=manual

Change-Id: I87459c177b8ae41b68e7157f26843eaf5ed93c60
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49975
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-05-02 18:10:46 -07:00
Randall Spangler
7cf92c140d Clean up USB charging module
No functional changes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=plug in USB mouse; is powered when system is on

Change-Id: Icbad3035f384191daa2b6dfae61d78f18ece1d76
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36613
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-26 09:49:37 -07:00
Vic Yang
773e3c369f Revisit USB charge modes
"Auto" mode is observed to cause problems and thus is removed. This
leaves only three modes:
  - Standard downstream port. USB 2.0 mode. 500mA.
  - Charging downstream port. BC1.2. 1500mA.
  - Dedicated charging port. BC1.2. 1500mA.

BUG=chrome-os-partner:11550
TEST=Check all modes work as expected. Check no discharge between the
first two modes.
BRANCH=link
CQ-DEPEND=31639

Change-Id: I41102a8bc3ac34ff9a1bf4e47c89cdb93a2c4eb5
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/31616
2012-08-28 16:39:32 -07:00
Randall Spangler
1655c8727a Add hooks for chipset power transitions
This is cleaner than having x86_power explicitly know about everything
else in the system that cares about power transitions.

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

BUG=none
TEST=boot and shutdown system; still works.  Mouse powered to system is off in S5.

Change-Id: Ib673ca2d9edd5473334e7604e98b99b02b768419
2012-05-09 16:09:10 -07:00
Vic Yang
527eddedaa Automatically switch USB charging mode
Disable USB ports when system is down and set USB ports to standard
downstream mode when system is up or sleeping.

Signed-off-by: Vic Yang <victoryang@google.com>

BUG=chrome-os-partner:9249
TEST=Plug in a phone and see it charge when system is on.
Turn off the system and see it stop charging.

Change-Id: I02850dee7051ed6589e0f176a933069203f0efdf
2012-05-09 10:15:03 +08:00
Randall Spangler
f4e772708b Added HOOK_INIT for driver module inits
This covers modules which need to initialize before task_start(), but
don't particularly care in what order they're initialized.

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

BUG=none
TEST=if it boots, it works

Change-Id: I69829aac8d1c3c14ee04916a794b84bbf03a09eb
2012-04-19 13:08:58 -07:00
Vic Yang
af8026cdf9 USB Charging control
Implement TPS2543 USB charging control.
It contains routine for setting each USB port as dedicated charging port
or standard downstream port. To allow us controlling the current
distributed to each port, we can select whether to allow 500mA or 1500mA
for each port.

BUG=chrome-os-partner:7476
TEST=Added USB port definition for BDS and tested GPIO output voltage
level is correct for all modes.

Change-Id: I19bc4b30d333aa802f868ebfc3a398b30e99ba0f
2012-01-19 10:54:37 +08:00