summaryrefslogtreecommitdiff
path: root/include/usb_charge.h
Commit message (Collapse)AuthorAgeFilesLines
* include/usb_charge.h: Format with clang-formatJack Rosenthal2022-06-281-11/+11
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Ifc8e4d020bbe41adfcb80dd5a83375fb0f1f561f Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730429 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* zephyr: shim: add single charge task supportFabio Baltieri2022-06-031-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | Add an option to run the charger code in a single task. This is enabled by default in Zephyr builds, but explicitly disabled for a couple of platforms that currently have task dependent board code. Should be enough to start testing the configuration, will work on handling the remaining boards (corsola and nissa) later. BRANCH=none BUG=b:226411332 TEST=make buildall TEST=zmake testall TEST=cq dry run TEST=run on Brya, connect/disconnect usb devices Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I75a63f7b0a9545e6c824114de7f81b71924e0789 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3663748 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com>
* task: change task_set_event return type to voidFabio Baltieri2022-06-021-1/+1
| | | | | | | | | | | | | | | No implementation does nothing other than return 0 on task_set_event(), change the return type to void so that the API is clear. BRANCH=none BUG=none TEST=cq dry run Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I88b20f53aa6dffa291ce78f4776888b21985f57f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3683769 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* bc12: split task handler in init and eventFabio Baltieri2022-05-271-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Split the bc12 internal API from a task loop handler to an init and event handler pair of functions, moving the loop on the caller. This is to allow handling the events from a single task on a followup patch. Current driver behavior should be unchanged, just bringing the loop and wait in the generic code. For a couple of drivers (bd9995x and rt946x) this was not quite possible as they would need some more work to fit in that model, but then those two runs in single task mode already anyway (HAS_TASK_USB_CHG), so no point converting them to fit the model anyway, just running the whole driver in the init() keeps the existing behavior, code will never reach the outer loop. BRANCH=none BUG=b:226411332 TEST=make buildall TEST=zmake testall TEST=cq dry run Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I8e28ad8b5b52b002587aefb68116a14b709729fe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3663747 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* usbc: wrap task_set_event to have an explicit port argumentFabio Baltieri2022-05-271-0/+8
| | | | | | | | | | | | | | | | | Define an explicit function to set events for the usb charger tasks, so that the caller is not coupled to the internal task implementation, and we can use a single task on a later patch. BRANCH=none BUG=b:226411332 TEST=make buildall TEST=zmake testall TEST=cq dry run Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I7a1223642b800568bf4f9864f75b2b647c84d29f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3663746 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* usb_charge: fix various typos and doxygen tagsFabio Baltieri2022-05-231-4/+5
| | | | | | | | | | | | | Various typo/doxygen fixes in usb_charge.h. BRANCH=none BUG=none TEST=zmake testall Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I15b73a1533eb7be945d5c51a9c4b45e823c5ad2a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3661582 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* usb_charge: drop USB_CHG_TASK_COUNTFabio Baltieri2022-05-231-11/+0
| | | | | | | | | | | | | USB_CHG_TASK_COUNT is not used anywhere, drop it. BRANCH=none BUG=none TEST=zmake testall Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: Ia7fb4d0bbcdb6b6edaea1be96a0d5ada43bbcfba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3661581 Reviewed-by: Aaron Massey <aaronmassey@google.com>
* Add a common header for board_vbus_sink_enable()Simon Glass2021-03-311-0/+11
| | | | | | | | | | | | | | | | This function prototype is defined in quite a few files, none of which is visible to Zephyr. Add a prototype in one place and remove the others. BUG=b:183296099 BRANCH=none TEST=make buildall Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I2f3f1e08614408e7b8f6bb0633a478765c73beaa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789800 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Add a common header for board_is_sourcing_vbus()Simon Glass2021-03-311-0/+10
| | | | | | | | | | | | | | | | This function prototype is defined in lots of files, none of which is visible to Zephyr. Add a prototype in one place and remove the others. BUG=b:183296099 BRANCH=none TEST=make buildall Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ia324327a69b117483ab9ee5c85eba93c0fb5ad9c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2789799 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* guybrush: Implement bc12_interruptRob Barnes2021-01-111-0/+1
| | | | | | | | | | | | | | | Implement bc12_interrupt stub. Add task.h to usb_charge.h to fix build error. BUG=None BRANCH=None TEST=Build Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: I7d3d14326cf6973b131a6f575eb305039772df04 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2611518 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* ec: change usage of dummySam Hurst2020-08-051-1/+1
| | | | | | | | | | | | | | | | | | Google is working to change its source code to use more inclusive language. To that end, replace the term "dummy" with inclusive alternatives. BUG=b:162781382 BRANCH=None TEST=make -j buildall `grep -ir dummy *` The only results are in "private/nordic_keyboard/sdk8.0.0" which is not our code. Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: I6a42183d998e4db4bb61625f962867fda10722e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2335737 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* bc12: create bc12 driver structureTing Shen2020-05-291-4/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To support linking multiple bc12 drivers into ec binary, we have to remove the common symbols in drivers. This CL creates a bc12_drv structure to hold the original driver-specific usb_charger_* functions, and implements common usb_charger_* functions which whill dispatch the function call based on the information in bc12_drv table. Also add a CONFIG_BC12_SINGLE_DRIVER and enabled by default for backward compatibility. If CONFIG_BC12_SINGLE_DRIVER is defined, a default bc12_drv array with proper size and content will be created for the board. BUG=b:155611686 TEST=1) make buildall. 2) verify single driver mode on krane (rt946x) and juniper (pi3usb9201). 3) verify multiple driver works on asurada, see CL:2189624 for example usage. 4) verify single driver multi chip on blooglet. BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I8a96eda47c94aeb6cc150b498cfa1a6eefcc4a5b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2187080 Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* bc12: Limit max current to 1.5AAseda Aboagye2020-04-301-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | The Type-C specification now prohibits proprietary methods for BC 1.2 to be used over Type-C. In effect, this limits the maximum current for legacy chargers to be 1.5A. Technically, proprietary methods are not allowed, however we'll continue to allow them but limiting their maximum current to 1.5A. This commit changes the maximum current of our BC 1.2 detectors to be 1.5A for all suppliers that would have reported higher capabilities. For more information, see the USB Type-C Engineering Change Request titled "Removal of Proprietary Charging Methods". BUG=b:155337959 BRANCH=hatch,kukui,kevin TEST=Build and flash waddledee, verify that legacy supplier is limited to 1.5A. TEST=`make -j buildall` Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: Ifb8dbde519cd2efe17a27197460291708bef125c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2172777 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* usb_port_power: Add CONFIG_USB_PORT_ENABLE_DYNAMICEdward Hill2020-03-201-3/+11
| | | | | | | | | | | | | BUG=b:150349225 BRANCH=none TEST=none Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I06c2ceee818499eabf3a240d27151dbd1ff88653 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2108333 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Paul Ma <magf@bitland.corp-partner.google.com> Tested-by: Paul Ma <magf@bitland.corp-partner.google.com>
* usb_port_power: move usb_port_enable[] to headerEdward Hill2020-03-201-0/+10
| | | | | | | | | | | | | | BUG=b:150349225 BRANCH=none TEST=none Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I0342239dacf3bfb5f50e5fe873805921fa4723a6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2108332 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Paul Ma <magf@bitland.corp-partner.google.com> Tested-by: Paul Ma <magf@bitland.corp-partner.google.com> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* TCPMv2: Add BC1.2 trigger eventsDenis Brockus2020-01-081-2/+0
| | | | | | | | | | | | | | | The BC1.2 was holding the data lines so a USB SNK device would not be allowed to talk on the bus BUG=none BRANCH=none TEST=verify attached USB stick on BC1.2 enabled board Change-Id: I501a3d491241d00917d921c041b0567ec4ec55a1 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1967934 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-191-1/+1
| | | | | | | | | | | | | | | | 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>
* usb_port_power_smart: support a new usb_charge_mode - USB_CHARGE_MODE_DEFAULT.Marco Chen2019-05-241-22/+1
| | | | | | | | | | | | | | | | | | | | | OS can leverage `ectool usbchargemode` to control the usb_charge_mode in the EC. In this case, we might want to set mode back to the default one defined in the config of board level therefore the new usb_charge_mode is added for this purpose. BUG=b:130767435 BRANCH=octopus TEST=1. make -j buildall 2. ectool usbchargemode 0 0x5 0 3. usb charging mode is set to CDP in Octopus board Change-Id: Ib7397993fc49e6c744dc55b9adace95dd6b8bd3a Signed-off-by: Marco Chen <marcochen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1621452 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* PI3USB9281: Serialize mux setting and BC12 detectionDaisuke Nojiri2019-05-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Currently a PD task and a USB charger task can talk to PI3USB9281 to update mux setting and to get BC12 information interleavingly. We suspect this causes unreliable BC12 detection including detach detection. This patch makes the usb_charger_set_switches API schedule a mux update instead of changing the mux setting by itself wakes up a USB charger task. A USB charger task solely handles BC12 detection and mux setting. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/125176293 BRANCH=nami TEST=Verify BC1.2 and PD charger can be detected correctly and power_supply_info prints 'Discharging' when they're disconnected on Syndra. Change-Id: Iadaf9087be74a4ba0412dd08b95a40eac4e69ce1 Reviewed-on: https://chromium-review.googlesource.com/1622293 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* tasks: convert TASK_EVENT_CUSTOM macro to bitJett Rink2019-04-241-6/+6
| | | | | | | | | | | | | | | | | | | | | We should ensure that all custom task definition are non-zero and fit with the globally defined events. Add compile time check and change semantics to specify bit number (instead of making all callers use the BIT macro). This also fixes an error with TASK_EVENT_PHY_TX_DONE for ITE being 0. The bug that made that happen hasn't landed on any firmware branches that use it though. BRANCH=none BUG=none TEST=builds Cq-Depend:chrome-internal:1178968,chrome-internal:1178952 Change-Id: I5e1d1312382d200280c548e9128e53f4eddd3e61 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1570607 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
* usb_chg: Add USB_CHG events for data role set and CC openScott Collyer2019-03-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | The pi3usb9201 bc1.2 chip has both client and host mode support. Other bc1.2 detection chips support client mode and are triggered by VBUS detection events. To have better control of the pi3usb9201 and to prevent d+/d- data interruption, it's preferable to trigger bc1.2 mode on data role updates as the data role setting is what's most relevant to legacy bc1.2 modes. This CL adds 3 new USB_CHG events that can be set in the USB PD protocol layer when the data role is being set to sink or source and when a detach event occurs. BUG=b:124612788 BRANCH=none TEST=Tested both external chargers, adapters, and charge through hubs. Verfied that bc1.2 detection is triggered as expected when chargers are connected and verified that when the type C port is in source mode, then the pi3usb9201 is in host CDP mode. Change-Id: I9dbb441c6e226a7836220fc6abcf723a46b1a349 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1503953 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* usb_port_power_smart: turn on/off charging mode during system suspendZhuohao Lee2019-01-301-3/+12
| | | | | | | | | | | | | | | | This patch adds a feature to allow the userspace program turns on/off the usb type-a charging mode during system suspend. BUG=b:121438672 BRANCH=firmware-rammus-11275 TEST=make -j buildall ectool usbchargemode 0 0x2 0, CDP works in S0 and S0ix ectool usbchargemode 0 0x2 1, CDP works in S0 but not in S0ix Change-Id: Icb8ab1b3f1beb671fbd02f441bf40284ba74e097 Signed-off-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1424040 Reviewed-by: Jett Rink <jettrink@chromium.org>
* BC1.2: Add usb_charger_reset_charge APIDaisuke Nojiri2019-01-261-0/+8
| | | | | | | | | | | | | | | | | | | This patch adds the sub_charger_reset_charge API, which resets the voltage and the current for all BC 1.2 supplies. This reduces code duplication. There is no functionality changes. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=buildall Change-Id: I21afaff9a3c66b1a81ab5c907e6cdd1f1b3896a0 Reviewed-on: https://chromium-review.googlesource.com/1399204 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* 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