summaryrefslogtreecommitdiff
path: root/driver/pi3usb9281.h
Commit message (Collapse)AuthorAgeFilesLines
* cleanup: Segregate USB MUX related drivers in usb_mux folderVijay Hiremath2019-07-171-82/+0
| | | | | | | | | | | BUG=none BRANCH=none TEST=make buildall -j Change-Id: If44a363d1288cbfabe5c6545e550f2b8fc623227 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1700793 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>
* common: replace 1 << digits, with BIT(digits)Gwendal Grignou2019-03-261-20/+20
| | | | | | | | | | | | | | | | 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>
* PI3USB9238: Read device type and charge registers after INTB assertionstabilize-11647.70.Bstabilize-11647.104.Brelease-R73-11647.BDaisuke Nojiri2019-01-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | PI3USB9238 can fail to detect BC 1.2 charger because the initialization timing after reset differs chip to chip. This patch checks the interrupt register in a loop to wait until device type and charger status registers are ready. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/119166282 BRANCH=nami TEST=Verify BC 1.2 chargers are reliably detected as DCP (wall-charger), CDP (type-A port on chromebook), and SDP (type-c port on chromebook) by type-c port of Vayne (via A-to-C cable). Change-Id: I970007723fcff5e2818765705d534d1a581b33e7 Reviewed-on: https://chromium-review.googlesource.com/1399202 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* cheza: Mux the 1st-plugged UFP port which is not a chargerWai-Hong Tam2018-12-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are 2 USB-C ports. A user may plug a USB-C to USB-A male cable to one of the ports; then EC should mux the port from USB hub to AP's primary USB controller, which is configured to do USB peripheral mode only. The policy is to mux the first-plugged UFP port to AP, with the following exception: * If the partner port does PD and it advertises the USB communications capable bit unset in the fixed-supply PDO, we believe the partner port is a pure charger. * If the BC1.2 chip detects the partner is not a SDP or CDP , we believe the partner port is not a workstation. Check the design doc at: http://go/cheza-hs-mux BRANCH=none BUG=b:74395451, b:110803836 TEST=Check the following scenario: * Plug charger w/ PD to P0, plug C-to-A to P1, check P1 mux to AP. * Plug charger through hub to P0, plug C-to-A to P1, check P1 mux to AP. * Continue the above case, boot into kernel and check USB peripheral mode. * Plug BC1.2 charger to P0, plug C-to-A to P1, check P1 mux to AP. * Plug charger w/o PD to P0, plug C-to-A to P1, check P0 mux to AP. * Swap P0 and P1 for the above cases and check the results. Change-Id: I4034fa66c0b27cc48d0959bb3f1750690ad5e3f7 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/1105404 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* driver/bc12/pi3usb9281: Make a few functions staticNicolas Boichat2018-01-031-16/+0
| | | | | | | | | | | | | | | Old oak boards that still use these functions have long been deprecated, let's make the unneeded functions static. BRANCH=none BUG=b:35573263 TEST=make buildall -j => makes newsizes: up to 64 bytes saved on a few boards. Change-Id: I8f2503ce324e34b87b3bbfa3c509079357880c9e Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/848574 Reviewed-by: Shawn N <shawnn@chromium.org>
* usb_charger: Move part-specific code to usb_switch driverShawn Nematbakhsh2016-05-131-18/+1
| | | | | | | | | | | | | | | | | | | | | | | Previously usb_charger.c supported only pi3usb9281, but now support for additional parts is required. Move pericom-specific code (including the usb_charger tasks that handles various quirks of that part) to the pi3usb9281 usb_switch driver. Going forward, usb_switch drivers must implement usb_charger_set_switches() and must have some method (such as a task or interrupt handler) to update charge_manager with information about attached chargers. BUG=chrome-os-partner:53363 BRANCH=None TEST=`make buildall -j` Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I4df74e043d8cf2e532d48c39c73b7dc2930f7d3b Reviewed-on: https://chromium-review.googlesource.com/344289 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* cleanup: fix all the header guardsBill Richardson2015-06-181-3/+3
| | | | | | | | | | | | | | | This unifies all the EC header files to use __CROS_EC_FILENAME_H as the include guard. Well, except for test/ util/ and extra/ which use __TEST_ __UTIL_ and __EXTRA_ prefixes respectively. BUG=chromium:496895 BRANCH=none TEST=make buildall -j Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Iea71b3a08bdec94a11239de810a2b2e152b15029 Reviewed-on: https://chromium-review.googlesource.com/278121 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* usb: pi3usb9281: Allow flexible chip configurationsShawn Nematbakhsh2015-06-121-18/+27
| | | | | | | | | | | | | | | | | | 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>
* pi3usb9281: Always set reserved control bitsShawn Nematbakhsh2015-03-041-0/+2
| | | | | | | | | | | | | | | | Bits 1 and 3 of the control register are read 1, write 1, but RO firmware may have zero'd these bits. Therefore, always set the bits high, ignoring the read value. TEST=Manual on Samus. Starting from .90 RO, flash new RW and verify BC1.2 charger detection is working. BUG=chrome-os-partner:37241 BRANCH=Samus Change-Id: I2f71718f74e50fe9b664dbe3da1578ee4c995136 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/254880 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* pi3usb9281: Fix handling of REG_CONTROL (02H) reserved bitsShawn Nematbakhsh2015-02-051-1/+3
| | | | | | | | | | | | | | | | | REG_CONTROL has two sets of reserved bits: - Bits 5 thru 7 are read x, write 0. - Bits 1 and 3 have undocumented function and should not be changed from read value. BUG=chrome-os-partner:36360 TEST=Manual on Samus. Cold boot unit and insert 2.4A charger. Verify that charger is correctly detected. BRANCH=Samus Change-Id: I240d352817910eda404b72be13e2c913a4b76079 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/246560 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* pi3usb9281: Accept alternate device idShawn Nematbakhsh2015-01-181-0/+3
| | | | | | | | | | | | | | | | PI3USB9281A is compatible with our existing driver but has a different device ID. BUG=chrome-os-partner:35567 TEST=Manual on samus_pd. Verify that "invalid ID 0x18" prints are not seen on console. BRANCH=Samus Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I275ed50fcbcb3c2e385292408be6de51055903fb Reviewed-on: https://chromium-review.googlesource.com/241764 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* samus_pd: Open USB data switches in UFP modeShawn Nematbakhsh2014-12-091-1/+4
| | | | | | | | | | | | | | | | Samus USB ports can't actually act as UFPs, so open switches when in UFP mode. BUG=chrome-os-partner:32003 TEST=Manual on Samus. Connect two Samus units, run `pd 1 swap data`, verify that switches are opened on switch to UFP. Unplug samus and connect a USB 2.0 device instead, verify that ports are again closed. BRANCH=samus Change-Id: I9e1ca58089caf29e419698c8426bf8b72500833a Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/233711 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* samus_pd: add host command to get type-c port power infoAlec Berg2014-10-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Get type-c port power info including power role, charger type, and charging info. Also added host command to get number of type-c ports. Also adds new charging suppliers for pericom identified chargers including DCP, CDP, SDP, proprietary, and other chargers. Priority of these for charging is set in samus board file. BUG=chrome-os-partner:32650 BRANCH=samus TEST=run 'ectool --name=cros_pd usbpdpower' and verify correct status with minimuffin, zinger, and type-C to type-A adapter. Change-Id: I1dabbe7de4185a23df5684a5ea9a2d944f1f6ff5 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/223523 Tested-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pi3usb9281: Add function for translating registers to current limitShawn Nematbakhsh2014-10-101-0/+3
| | | | | | | | | | | | | | Decode Pericom registers to current limits. BUG=chrome-os-partner:32003 TEST=Manual on samus_pd. Insert 1A Apple charger, verify current limit is correctly detected as 1A. BRANCH=samus Change-Id: I310d9f22cef80e97c1734e6a56f0034ebe01df31 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/222638 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* pi3usb9281: Implement driver for Pericom USB switchDominic Chen2014-08-131-0/+86
BRANCH=none BUG=none TEST=verify that usb switch funcitons Change-Id: Ie897a2ae94042abefbb349d30dfa183caaec9ed0 Signed-off-by: Dominic Chen <ddchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/209846 Reviewed-by: Vic Yang <victoryang@chromium.org>