summaryrefslogtreecommitdiff
path: root/driver/usb_mux
Commit message (Collapse)AuthorAgeFilesLines
* anx3443: fix incorrect set_mux implementationTing Shen2021-05-121-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | Current driver code sets 0xF8 bit [1:0] to 0b00 when USB_PD_MUX_NONE. However, according to the programming guide (b/181282482#comment3). 0b00 means "power-off", not "disable both paths". This is not what we want because power-off mode blocks all subsequent i2c transactions. Since this mux does not have a "none" state, this CL maps USB_PD_MUX_NONE to USB enabled instead. BUG=b:181282482 TEST=Boot Cherry, verify that error messages like "mux config:0, port:1, rv:1" disappeared BRANCH=main Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I2c87c839242fa61e4ba0e1dfca54ebe5bb3beb37 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2870537 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* hayato: Modify HS Detector threshold of PS8743 setting valueMichael5 Chen12021-05-101-0/+11
| | | | | | | | | | | | | | | Modify HS detector threshold setting (0x3C) to 0x60 for USB-C C1 port signal quality. BUG=b:177980418 BRANCH=asurada TEST=manual Run command "ectool i2cread 8 4 0x20 0x3c" to check register value. Signed-off-by: Michael5 Chen1 <michael5_chen1@pegatron.corp-partner.google.com> Change-Id: I97b6bb16e7c5298ff42e35d936e0f9e60ec3b730 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2845564 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* virtual mux: Wait for mux config ACK from AP on disconnectAyushee Shah2021-05-011-5/+11
| | | | | | | | | | | | | | | | | | | | | | While switching from DP to Thunderbolt mode, EC sends a mux disconnect followed by a USB mux connect. Since these events are one behind the other, AP might miss the disconnect mux event. Hence, this CL waits for an ACK from AP, to synchronize the disconnect mux event between AP and EC. BUG=b:186609339 BRANCH=None TEST=1.Both the monitors behind the Tortilla based dock enumerate after coldboot. 2.Checked Disconnect-Connect with TBT/USB4 device in S0ix, they enumerate fine on full resume. 3.Checked coldboot with non-Tortilla based dock based dock. it enumerates fine. Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Change-Id: Ib32c3426c2b52b1af582729453d748902447900c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2857374 Reviewed-by: Keith Short <keithshort@chromium.org>
* cherry: Add ANX3443 mux/retimer driverParker Lin2021-04-292-0/+135
| | | | | | | | | | | | | | | Add basic support for ANX3443. Datasheets available in bug. BUG=b:181282482 BRANCH=None TEST=Build Signed-off-by: Parker Lin <parkerlin@google.com> Change-Id: Id779547704408b9563f803885cd755ae96d38ef7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2728001 Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* ANX7451: Set upstream AUX FLIPRob Barnes2021-04-272-0/+30
| | | | | | | | | | | | | | | | | AUX flip control must be enabled. Otherwise alternate mode will not work on ANX7451 when cable is flipped. The USB registers use a separate i2c address that must be dynamically configured. Since there may be multiple ANX74** parts on a board, this address must be dynamically configured using a board callback. BUG=b:185276137 TEST=Display works when cable is flipped on B2 BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: I144131b2f53985d97e0be960e202366f726dd90b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2854120 Reviewed-by: Diana Z <dzigterman@chromium.org>
* usb_mux/amd_fp6: Handle chipset_resetRob Barnes2021-04-221-1/+7
| | | | | | | | | | | | | | The driver was only handling chipset_resume. chipset_reset also needs to be handled. Otherwise mux won't be set on an apreset. BUG=None TEST=C1 display works after apreset BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: I0ec336a733e51d44be7ea95f8fcfeb8a606d50a1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2845269 Reviewed-by: Diana Z <dzigterman@chromium.org>
* ANX7451: Add power off and wake up routinesRob Barnes2021-04-222-10/+56
| | | | | | | | | | | | | | | | Add anx7451_power_off and anx7451_wake_up routines. ANX7451 is powered off whenever both USB and DP are disabled. ANX7451 is woken up via i2c before mux set or get. BUG=b:184907521 TEST=Mux is powering off when nothing is connected. Mux is waking up when cable is connected. BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: Idf1343735cb94eb8bbaebe93794195d2f115b086 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2840056 Reviewed-by: Diana Z <dzigterman@chromium.org>
* guybrush: Refactor FP6 mux driver to retry in S0Rob Barnes2021-04-161-74/+80
| | | | | | | | | | | | | | FP6 USB mux is not ready until sometime after S0. Refactor driver to keep trying every 1 second until mux is ready. BUG=b:184680878, b:184966860 TEST=C0 and C1 display connects on B1 and B2 BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: If744182879461d8452426deaf0e74a84dacfd510 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2819023 Reviewed-by: Diana Z <dzigterman@chromium.org>
* guybrush: Fix ANX7451 driverRob Barnes2021-04-122-26/+23
| | | | | | | | | | | | | | | | | | Correct i2c address of ANX7451 on guybrush. Do not attempt to read or write mux in Z1 since mux is not powered. The only required init step is to disable ultra low power. So init can be removed if ultra low power is always set inside set. Prevent disabling both DP and USB at the same time since this causes mux to fail. BUG=b:184907521, b:184908498 TEST=Display port works on Guybrush B2 BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: Icdcc2df6034680844635c8b8675402d0825f34a8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2816306 Reviewed-by: Diana Z <dzigterman@chromium.org>
* pi3usb3x532 : check vendor idYongBeum.Ha2021-04-092-0/+17
| | | | | | | | | | | | | Add read function to get vendor id BUG=b:182596801 BRANCH=none TEST=make -j BOARD=sasuke Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: Ie6afdfc630d52b53936b7fa1024f73d24ff0cfaa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809777 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* ps8743 : get chip IDYongBeum.Ha2021-04-092-0/+23
| | | | | | | | | | | | | Add read function to get chip id BUG=b:182596801 BRANCH=none TEST=make -j BOARD=sasuke Signed-off-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com> Change-Id: Icf33030a7f013a85fe27e8c8c54b8e4494a01817 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2801176 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* guybrush: Dynamically configure C1 muxRob Barnes2021-04-091-0/+2
| | | | | | | | | | | | | | | | | Two C1 muxes are currently supported for guybrush. Configure the correct C1 mux at runtime based on fw_config. Move board_c1_ps8818_mux_set to guybrush board.c since it's board specific tuning. BUG=b:184548806 TEST=Build and run on guybrush B2 BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: I6ff809a9cbd1ddc2a408d2ce84f75d6723b7844f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2809259 Reviewed-by: Diana Z <dzigterman@chromium.org>
* AMD FP6 Mux: Correct ready bitDiana Z2021-04-092-1/+3
| | | | | | | | | | | | | | Ready will actually be indicated by bit 6 in the status return. BRANCH=None BUG=b:184680878 TEST=on guybrush, confirm we see C1 mux as "ready" and try to set appropriate state Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ic522add422f06acddaf88a445398727a0e5be482 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2811940 Reviewed-by: Bhanu Prakash Maiya <bhanumaiya@google.com>
* usb_mux: ps8822: Add support to adjust rx DP EQ settingScott Collyer2021-04-022-10/+67
| | | | | | | | | | | | | | | | | | | | | | This CL modifies the PS8822 usb_mux driver to support multiple pages (there is a page 0, 1, and 2 for this chip). The usb_mux driver only needs access to page 0, but page 1 access is needed for DP EQ settings. In addition this CL adds a new driver function to allow setting of the DP Rx equalization gain value. BUG=b:178656398 BRANCH=None TEST=tested on quiche and verified the register is programmed when DP mode is active. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I65cb2fc2c982b01537eb60c0b9da30f4363419aa Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686918 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* tusb1064: Add full list of possible I2C device addressesScott Collyer2021-03-241-1/+24
| | | | | | | | | | | | | | | | | | The TUSB1064 has 16 possible I2C device addresses. This CL adds this full list to the tusb1064.h file. In addition, the TUSB1064 device address was updated to match the new macro. BUG=b:168621142 BRANCH=servo TEST=make -j buildall Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I1ee836ef0a88adab1af63901c2ec0be7cef7b232 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2267630 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Sam Hurst <shurst@google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* guybrush: Add ANX7451 mux/retimer driverRob Barnes2021-02-232-0/+129
| | | | | | | | | | | | | | Add basic support for ANX7451. Datasheets available in bug. Support for tuning can be added later if needed. BUG=b:179065240 BRANCH=None TEST=Build Change-Id: Ifafdec4412b73b0fd3f7de2131a8617bbfde6426 Signed-off-by: Rob Barnes <robbarnes@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2699667 Reviewed-by: Diana Z <dzigterman@chromium.org>
* Virtual mux: Set disconnect latch flag only in s3/s0ixAyushee Shah2021-02-221-2/+4
| | | | | | | | | | | | | | | | | | | | | When the AP comes up after G3 and since the disconnect flag is set, EC sends disconnect info to the AP probe functions. But the DUT is still in low power mode thus the AP doesn't receive the current mux state hence enumeration of USB4/TBT device fails when hotplugged at G3. This CL ensures that disconnect flag is only set in chipset suspend states i.e. s3 and s0ix BUG=b:180377259 BRANCH=None TEST=Connected USB4 device connect in G3 and checked enumeration Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Change-Id: I6992c528c7c39bf604d4e305b362ef04bc3c100e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2705561 Reviewed-by: Tanu Malhotra <tanu.malhotra@intel.com> Reviewed-by: Madhusudanarao Amara <madhusudanarao.amara@intel.corp-partner.google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* usb_mux: ps8822: Initial version of driverScott Collyer2021-02-092-0/+139
| | | | | | | | | | | | | | | | | | | | This CL adds the driver for the PS8822 usb demux. Currently, the driver only supports the expected usb mux driver methods. It is expected that any EQ setting functions would be board specific, though more register definitions would need to be added to the .h file. BUG=b:175660576 BRANCH=None TEST=Connect on host port and then read back mode register to confirm that it's been set as expected. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: Ic425ffe41f4653cee7f5500b081d7b5f6ad1a3df Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2247361 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* retimer: PD port retimer firmware update supportli feng2021-02-051-0/+19
| | | | | | | | | | | | | | | | Added one field to struct usb_mux_driver, which returns true if retimer update is supported. Moved query function from usb_retimer_fw_update.c to usb_mux.c. BUG=b:162528867 BRANCH=none TEST=Tested on Voxel, together with related coreboot and kernel changes. EC returns correct port information to kernel. Signed-off-by: li feng <li1.feng@intel.com> Change-Id: I5cab34a14adbf0470cffe6a13234ad53b6f6a90c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2651866 Reviewed-by: Keith Short <keithshort@chromium.org>
* guybrush: Add FP6 USB mux driverRob Barnes2021-02-042-0/+246
| | | | | | | | | | | | | | | | | FP6 USB mux driver is similar to the FP5 USB mux driver, but uses two addresses instead of an index to select the different USB ports. Also a low power bit has been added to the control register. Datasheet can be found in the bug. BUG=b:177057723 TEST=Build BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: I94a3db5f7d643a17dfdf89d721dd7f14cb75e402 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2654387 Reviewed-by: Diana Z <dzigterman@chromium.org>
* usb_mux: Use atomic_or when setting flag during muxer initPatryk Duda2021-01-281-1/+1
| | | | | | | | | | | | | | | | | CL:2633981 was created when flags in usb_mux was set using bitwise OR assignment. During review, all set and clear flag operations in usb_mux was changed to use atomic functions. This CL changes recently added flag set to atomic one. BUG=b:151155658 BRANCH=none TEST=make buildall Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I10813deaa8b9f4799d29f06f8fe482974257b715 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2656035 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org>
* COIL: Rename comments in PI3USB2x532 driverDiana Z2021-01-271-1/+1
| | | | | | | | | | | | | Rename i2c comments in PI3USB2x532 driver to match current naming. BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I08e7b94cc3c1cbe7b2f5e1a9dc9f0757a7cd85ea Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2649352 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* usb_mux: Check if muxer is initialized before taking actionPatryk Duda2021-01-271-0/+22
| | | | | | | | | | | | | | | | | | | | Current code allows setting or getting muxer state without initializing it. During mux initialization driver can prepare some internal structures for use by other driver functions. This patch implements checking if there was at least one mux initialization before performing action. BUG=b:151155658 BRANCH=none TEST=Flash ToT EC on octopus (eg. ampton) board. Make sure that muxer initialization is performed before performing any other muxer action. Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I2766305a49d377bd9a0ac91eea7988e58eb1059a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2633981 Reviewed-by: Diana Z <dzigterman@chromium.org>
* usb_mux: Send missed disconnect mode in S3/S0ixMadhusudanarao Amara2021-01-261-1/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the Type-C devices are connected in S0 and when DUT enters S3/S0ix, if the type-C devices are disconnected and re-connected, Kernel won't receive the disconnected state from EC once DUT boots to S0 as EC moves on and updates the new connected state to Kernel Mux driver. This leads to failure of Type-C device detection on resuming to S0 from S3/S0iX. To overcome this scenario, adding an explicit condition to send previous disconnect state to Kernel Mux driver once initial mux request is received upon resuming from S3/S0iX. Missing Disconnect mode Patch Details: Set disconnect latch flag for the init and disconnect requests For AP to EC PD command: EC_CMD_USB_PD_CONTROL -Check disconnect latch flag if it is true set pd.enabled = 0 For AP to EC mux command: EC_CMD_USB_PD_MUX_INFO -Check the disconnect latch flag if it is true then send disconnect mode -Reset the disconnect latch flag -Send host event EC_HOST_EVENT_USB_MUX for configuring the virtual mux with the latest Mux configuration BUG=b:176604380 BRANCH=None TEST=Type C devices in s0ix disconnect/connect or swapping across the ports scenarios tested Change-Id: Ic38d3632cb0fadb29393405e13ed3606a740c81e Signed-off-by: Madhusudanarao Amara <madhusudanarao.amara@intel.corp-partner.google.com> Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2632551 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* usb_mux: Use atomic operations for updating the flagMadhusudanarao Amara2021-01-261-4/+5
| | | | | | | | | | | | | | | | Atomic operations used in updating the LPM flag BUG=None BRANCH=None TEST=Disconnect typeC devices and then connect back, devices are detected Signed-off-by: Madhusudanarao Amara <madhusudanarao.amara@intel.corp-partner.google.com> Change-Id: I6c3fa4b9c63436a16465012fe715ce28995ed179 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2648145 Tested-by: Ayushee Shah <ayushee.shah@intel.com> Reviewed-by: Tanu Malhotra <tanu.malhotra@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* usb_mux: Correction in sending the Host event IRQ=0Madhusudanarao Amara2021-01-211-3/+1
| | | | | | | | | | | | | | | | | | | | | Retimer is the first mux and the virtual mux is the second Mux. Here the check should be for virtual Mux (second mux) instead checked for the first Mux. Because of that there is no IRQ=0 host events sent. Removed the condition check as it is taken care in side the usb_mux_hpd_update function. BUG=b:177876072 BRANCH=None TEST=HDMI MST HUB second port display also working Signed-off-by: Madhusudanarao Amara <madhusudanarao.amara@intel.corp-partner.google.com> Change-Id: I36205f2d442e9dcaf3d082151201e4c210878d8d Signed-off-by: Madhusudanarao Amara <madhusudanarao.amara@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2637153 Reviewed-by: Tanu Malhotra <tanu.malhotra@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
* usb_mux: add a full TUSB1064 driverNathan K2021-01-202-0/+214
| | | | | | | | | | | | | | | | | | | | | The TUSB1064 driver code is modified to implement a real usb_mux driver. This part is a UFP side (RX Equalizer) USB-C switch contrary to most other usb_mux part we have (used in the DFP). It is used in the servo_v4p1. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=b:168621142 BRANCH=servo TEST=use the sink mode enabled by 'cc pdsnk', connect to a USB-C Chromebook try both video output on USB-C->mini-DP and USB 3.0. Change-Id: Ie15d246ba7b6601db0d387e8ffda54f0ec36ba99 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2416764 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* usb_mux: Optimize reading mux state on unconnected portDivya Sasidharan2021-01-111-12/+2
| | | | | | | | | | | | | | | | | | | If Type-C port has nothing connected then the query of mux state should not power on the mux for reading the state. This helps reduce unnecessary power on/off retimer or mux for ports with no device attached to it. BUG=b:174240235 BRANCH=None TEST=Test enumeration of type-c devices is not affected. Also check on voxel if retimer init is not called periodically when device is not connected. Change-Id: I2f1c4093889164c0d47c3ac33e7a46ab524bcce0 Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2601679 Reviewed-by: Keith Short <keithshort@chromium.org>
* virtual mux:Check pd task before waiting on task eventAyushee Shah2020-12-171-3/+3
| | | | | | | | | | | | | | Booting with a DP/Thunderbolt/USB4 device, causes an assert. Hence, moving the check just before waiting on task event BUG=b:175806234 BRANCH=None TEST=Able to enter into tbt on reboot Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Change-Id: If7bfcad18a07bb2879da018847c1716a21ba5737 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2596426 Reviewed-by: Keith Short <keithshort@chromium.org>
* virtual mux: Wait for mux config ACK from the kernelDivya Sasidharan2020-12-152-2/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL: 1. Add a new config CONFIG_USB_MUX_AP_ACK_REQUEST to enable request for ACK from AP 1. Adds a new feature flag to inform the AP that an ACK is needed for boards supporting Burnside bridge retimer. 2. Adds a new host command for the EC to wait for mux config ACK for entering and exiting the safe mode. 3. Adds 12.5msec delay after configuring retimer and SoC as recommended. BUG=b:166300460,b:161327513 BRANCH=none TEST=Verify Type-C dock is functional with multiple hotplugs and flipped orientation. Verify USB3.0 is detected and not downgraded. Verify no regression with TBT3 and USB4 dock. Cq-Depend: chromium:2530517 Change-Id: I5b8224648f0fc36b30e24ca3e7254d708c676149 Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com> Signed-off-by: Ayushee Shah <ayushee.shah@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2366127 Commit-Queue: YH Lin <yueherngl@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* PD: Fix passing information about polarity when DTS is connectedPatryk Duda2020-11-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 7dec638eb577aaa3a00d0551d73c276b94ebacb2 introduced two polarity modes POLARITY_CC1_DTS, POLARITY_CC2_DTS in enum tcpc_cc_polarity, but in many places there was an assumption that value other than 0 means that cable is inverted, the most notable example is usb_mux_set(). As a result kernel sometimes was not reporting SuperSpeed depending on if cable was inverted or not. This patch adds mapping from polarity with DTS to polarity without DTS where necessary. BUG=b:162254118 BRANCH=none TEST=Connect ServoV4 to eve and run servod. Make sure that USB-C muxer is connects USB3.0 lines (servod should set it). Flash EC ToT on eve. Boot ChromeOS and go to Developer Console. Run 'dmesg -w', check if device (eg. ethernet adapter) is attached as SuperSpeed device. Unplug cable, invert and plug again. Kernel should report that device is attached as SuperSpeed. Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I354ef7047240cc8b5db01936b3780fae7387edb5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2555157 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* usb_mux: Remove ec host command dependencyScott Collyer2020-11-121-1/+2
| | | | | | | | | | | | | | | This CL removes EC host command dependency for the virtual type-c mux. BUG=None BRANCH=None TEST=make BOARD=quiche Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I7d5107b60310456cb23393a443fb4f303106954b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2441390 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* ps874x: fix incorrect parameter name in ps874x_tune_usb_eqTing Shen2020-10-284-6/+4
| | | | | | | | | | | | | | | | | | | First parameter was incorrectly named 'i2c_addr' in header file, but it's actually a 'port' in the implementation. Change the parameter to a usb_mux* to avoid confusion, and also align with other functions. BUG=b:170703310 TEST=make BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: Ic355b5fd03536423af841be731a93c818d87eb0d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2504973 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* usb_mux/it5205h: implement SBU controlTing Shen2020-09-152-2/+70
| | | | | | | | | | | | | BUG=b:167499422 TEST=able to trigger sbu interrupt on reworked asurada BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I457596ee938790736ebdd5bfbd22e13831d715b4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2402598 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* usb_mux: Retain mux's power state on readAyushee2020-07-241-3/+14
| | | | | | | | | | | | | | | | | | | | | | Following functions need to read the mux's current mode: 1. "usb_pd_control" host command and 2. "typec" console command For reading the current mode, mux needs to exit the low power mode. This commit ensures that the mux's power state is retained before and after the read by saving the status of low power mode and re-entering the low power mode depending on the status. BUG=b:161367077 BRANCH=None TEST=The retimer is held in low power mode when no device attached. Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: If63f7da816d58f7ff0a0a1d695e7e4fad2d14c07 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2314105 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* ps8743: use register control HPDZick Wei2020-07-242-2/+5
| | | | | | | | | | | | | | This patch add HPD control through register but not HW pin. BUG=b:152841287 BRANCH=none TEST=verify USBC can display without HW pin on berknip Signed-off-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Change-Id: I2399f12655096b805c04f26d8e0b510125394205 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2306893 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* zork: Restore AP mux setting after rebootEdward Hill2020-07-242-0/+52
| | | | | | | | | | | | | BUG=b:158960403 BRANCH=none TEST=USB3 works after AP reboot Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: Ia6ec65ad38933106e183747e78827d564be5aefd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2314033 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* bb_retimer: add power up timingKeith Short2020-07-011-3/+11
| | | | | | | | | | | | | | | | | Ensure the Burnside Bridge is held in reset when the AP is off and add a delay to reset de-assertion to meet Burnside Bridge requirements. BUG=b:159743964 BRANCH=none TEST=make buildall TEST=Verify BB initialization is skipped when the AP is off (verified with extra debug) TEST=Verify operation of USB, DP, and USB4 devices on Burnside bridge. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I4a4f05aaf84bf93b3c3032998bc811591c8fbf35 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2271697 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* usb_mux: Add check if port is available in every exposed functionPatryk Duda2020-06-231-0/+20
| | | | | | | | | | | | BUG=b:154602760 BRANCH=none TEST=make buildall -j Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I9a5097ed6746c917cb88a8e6bf5e98fa01267808 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2250681 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org>
* Zork: Switch PS8743 from IOEX_USB_C1_DATA_EN to I2CEdward Hill2020-06-031-1/+7
| | | | | | | | | | | | | | | | | Align all Zork devices on using I2C control of PS8743 mux mode, and stop using IOEX_USB_C1_DATA_EN signal/pin. This matches what we were already doing for Dalboz, and gives power savings in both S0 and S3 when nothing is plugged in and mux is set to none. BUG=b:157951317 BRANCH=none TEST=external display and i2ctrace on ezkinil Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: Id1c8b172a99bb25bed8b57e90686d933447432f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2227589 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* Virtual Mux: Send host events regardless of cached virtual mux stateAyushee2020-05-271-4/+2
| | | | | | | | | | | | | | Send host events on every virtual mux state update to avoid missed HPD events and role swap events in the kernel. BUG=b:157216436 BRANCH=None TEST=Able to see 5 consecutive HPD signals on the kernel console Signed-off-by: Ayushee <ayushee.shah@intel.com> Change-Id: Ifca3fbe3f04a08ad78daa3a562149e7ab075e078 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2212607 Reviewed-by: Keith Short <keithshort@chromium.org>
* USB: Fix handling of CONFIG_COMMON_RUNTIMEJan Dabros2020-05-261-0/+5
| | | | | | | | | | | | | Fix compilation error when building with CONFIG_COMMON_RUNTIME disabled. BUG=none BRANCH=none TEST=make buildall succeeds Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I19b4f620588a393f01ae97a3997d3fe6dd1cc009 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2203064 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
* move pi3usb9201.h to driver/bc12/Ting Shen2020-05-071-82/+0
| | | | | | | | | | | | | | | | | | | | | | | Currently pi3usb9281's header and implementation lives in different folder, header is in driver/usb_mux/, but implementation is in driver/bc12/. From the git log of these two files, this looks unintended. This CL moves header file into driver/bc12/ for consistency. Nothing else need to be changed since all references to this header does not hard-code its path. BUG=none TEST=make buildall BRANCH=none Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I4ca6046362b442dece0d277520bca149c743dcd7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2186859 Tested-by: Ting Shen <phoenixshen@chromium.org> Auto-Submit: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@chromium.org>
* PS8743: Clean up mode reg bit namesEdward Hill2020-04-202-11/+11
| | | | | | | | | | | | | Align names for PS8743_REG_MODE with similar PS8802_REG2_MODE. BUG=b:152736880 BRANCH=none TEST=none Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I8b8ebe41eb2bffad14cee8347549447d5583da47 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2151791 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* PS874x: Split PS8740 and PS8743Edward Hill2020-04-166-269/+421
| | | | | | | | | | | | | | | | | Split ps874x.[ch] into ps8740.[ch] and ps8743.[ch] since we need to support both at runtime for Dalboz. I left PS8742 in ps8740.[ch] since it is not very different. BUG=b:153454399 BRANCH=none TEST=make -j buildall Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I92b02e08f377d1781c130a0bbe1482a936ad7a4d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2151647 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Commit-Queue: Denis Brockus <dbrockus@chromium.org>
* ps8743: fix ps874_read/write for board accessDavid Huang2020-04-152-4/+6
| | | | | | | | | | | | | | | | Fix ps874x_read/ps8743_write can be used in board level. BUG=b:152736880 BRANCH=master TEST=make buildall -j Signed-off-by: David Huang <david.huang@quantatw.com> Change-Id: I321dea4fb95ccf62fbc21a17ece4b8a481b0c73e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2142849 Reviewed-by: Denis Brockus <dbrockus@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org>
* ps8742: Add support of PS8742 Type-C SS/DP demuxWai-Hong Tam2020-04-101-2/+18
| | | | | | | | | | | | | | Add PS8742 related definition to the PS874X series. Better reuse some common definition. Some following patches will it. BRANCH=servo BUG=b:137219603 TEST=make buildall -j Change-Id: I045fdf35f9b7c3aba2852140121e8c597465ddc7 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1829757 Reviewed-by: Brian Nemec <bnemec@chromium.org>
* PS8740: Allow 0xa or 0xb for REVISION_ID2Edward Hill2020-02-292-23/+30
| | | | | | | | | | | BUG=b:150384642 BRANCH=none TEST=ps874x_init succeeds on Dalboz Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: I9213a1f12d2412db4d38eaf75daaa27507787e90 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2080644 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* zork: Split mux/retimer for trembyle/dalbozEdward Hill2020-02-291-2/+2
| | | | | | | | | | | BUG=b:150099043 b:150384642 BRANCH=none TEST=none Signed-off-by: Edward Hill <ecgh@chromium.org> Change-Id: Ica9eda3f9d6a1332319b5c7ba56c0881d05eeebd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2079353 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* usb_mux: retimer: mux as chained mux and retimerDenis Brockus2020-02-288-160/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes retimers appear as generic muxes. By allowing a chain of muxes they can be stacked up to the new configurations that zork requires and will continue to work as they did before on configurations that only have a single mux. The code used to have two different arrays, 1) muxes and 2) retimers. On one of the zork configurations the processor MUX stopped being the primary mux and the retimer took its place. In a different configuration of that same platform it left the primary and secondary alone but the mux_set FLIP operation had to be ignored. Since the same interfaces needed to be available for both it stopped making sense to have two different structures and two different methods of handling them. This consolodates the two into one. The platforms that do not have retimers, this change will not make any difference. For platforms like zork, it will remove the retimers and make them chained muxes. So testing on trembyle makes sense to verify, BUG=b:147593660 BRANCH=none TEST=verify USB still works on trembyle Change-Id: I286cf1e302f9bd3dd7e81098ec08514a2a009fe3 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2066794 Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>