summaryrefslogtreecommitdiff
path: root/include/usb_charge.h
Commit message (Collapse)AuthorAgeFilesLines
* charge_ramp: Move ramp allowed / ilim callbacks to common codeShawn Nematbakhsh2017-10-061-0/+18
| | | | | | | | | | | | | | | | | | | | | 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>
* USB: Remove usb_charge_ports_enabledDaisuke Nojiri2017-04-201-8/+0
| | | | | | | | | | | | | 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>
* bd99955: Improve interrupt / USB charger task wake schemeShawn Nematbakhsh2016-06-161-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* BD99955: Use only one USB charger task for both the portsVijay Hiremath2016-06-141-0/+7
| | | | | | | | | | | | | | | | | | | | | 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>
* Driver: BD99955: Use Charger interrupt to detect VBUS activityVijay Hiremath2016-06-081-0/+13
| | | | | | | | | | | | | | | | | | | 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>
* usb_charge: fix custom event maskAlec Berg2015-09-111-1/+1
| | | | | | | | | | | | | 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>
* oak: handle USB BC 1.2 status changeRong Chang2015-09-031-0/+1
| | | | | | | | | | | | | | | | 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
* usb_charger: move common usb charger code out of board directoryAlec Berg2015-08-051-0/+11
| | | | | | | | | | | | | | | | | | | | 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>
* usb_charger: cleanup: move setting usb 2 switches to usb_chargerAlec Berg2015-08-041-0/+15
| | | | | | | | | | | | | | 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>
* cleanup: define one set of USB charger voltage and min currentAlec Berg2015-07-131-0/+5
| | | | | | | | | | | | | | | 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>
* usb: pi3usb9281: Allow flexible chip configurationsShawn Nematbakhsh2015-06-121-0/+8
| | | | | | | | | | | | | | | | | | 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>
* rambi: Leave 5V rail on in S3 if USB ports are poweredRandall Spangler2014-01-231-0/+8
| | | | | | | | | | | | | | | | | 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>
* Slippy uses dumb USB ports, not smart ones.Bill Richardson2013-05-021-0/+2
| | | | | | | | | | | 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>
* Clean up USB charging moduleRandall Spangler2012-10-261-2/+9
| | | | | | | | | | | | | 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>
* Revisit USB charge modesVic Yang2012-08-281-10/+6
| | | | | | | | | | | | | | | | | | "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
* Add hooks for chipset power transitionsRandall Spangler2012-05-091-4/+0
| | | | | | | | | | | | 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
* Automatically switch USB charging modeVic Yang2012-05-091-0/+4
| | | | | | | | | | | | | 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
* Added HOOK_INIT for driver module initsRandall Spangler2012-04-191-2/+0
| | | | | | | | | | | | 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
* USB Charging controlVic Yang2012-01-191-0/+34
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