summaryrefslogtreecommitdiff
path: root/driver/usb_mux/amd_fp5.c
Commit message (Collapse)AuthorAgeFilesLines
* USB Mux: Use polarity in safe modeJameson Thies2023-05-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, a handful of drivers look for the mux_state to be equal to USB_PD_MUX_SAFE_MODE when handling safe mode. This check requires that the polarity information be cleared before sending the mux_state to any drivers to correctly handle the safe state. But the same mux_state is sent to the kernel, which relies on polarity information from the EC when setting USB-C switches. This CL updates the retimer, tcpm and usb_mux drivers which check for mux_state to equal USB_PD_MUX_SAFE_MODE to instead only look for the safe mode bit to be set. This allows those drivers to function the same way in safe mode regardless of polarity information. It also updates usb_mux.c to preserve the polarity bit when sending mux_state to drivers in safe_state. LOW_COVERAGE_REASON=20 of the changed drivers have no emulators BUG=b:279733113 TEST=make -j buildall, confirmed that no remaining drivers check for mux state to equal USB_PD_MUX_SAFE_MODE. Checked on redrix that we are able to drive a monitor with inverted and normal polarity after losing Try.SRC. Change-Id: Ifc89d0ba1da0975436f93be102fadf725a5b8566 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4527219 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Tested-by: Jameson Thies <jthies@google.com> Commit-Queue: Jameson Thies <jthies@google.com>
* USB Mux: Unify drivers for safe modeDiana Z2022-09-191-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | When safe mode was first introduced, it was added only to drivers on the boards with virtual muxes and the mode wasn't sent to other drivers. Since safe mode is defined as an input for the mux API, ensure all drivers can handle this input. For now, set up all drivers which did not have handling to handle it the same as None, which was previously sent to them. LOW_COVERAGE_REASON=20 of the changed drivers have no emulators BRANCH=None BUG=b:234772074 TEST=make -j buildall; search for all files containing a usb_mux_driver without any reference to USB_PD_MUX_SAFE_MODE and ensure they are correct to not reference it Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ib927057bbf1638d09000bdad98bc096a6e103611 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3902611 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
* Update license boilerplate text in source code filesMike Frysinger2022-09-121-1/+1
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* driver/usb_mux/amd_fp5.c: Format with clang-formatJack Rosenthal2022-06-281-20/+20
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I069a0e995841c8df24b7363ffa789d8b8ec57567 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730151 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* gpio: cleanup header usage for i2cKeith Short2022-02-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | i2c.h only requires the enum gpio_signal, so use gpio_signal.h instead of gpio.h. The builld doesn't compare due to an ASSERT() calls in i2c-stm32f4.c because the line numbers changed. Before this change: 80068b2: f240 2332 movw r3, #562 80068b6: 48a4 ldr r0, [pc, #656] 80068b8: f7fc fb1a bl 8002ef0 <panic_assert_fail> After this change: 80068b2: f44f 730d mov.w r3, #564 80068b6: 48a4 ldr r0, [pc, #656] 80068b8: f7fc fb1a bl 8002ef0 <panic_assert_fail> BUG=b:218856245 BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I0f9f428d5c575c444b9df69f71a0ed6c4b3e378c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3489094 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* USB MUX: Generalize mux ACKDiana Z2021-08-141-2/+8
| | | | | | | | | | | | | | | | | | | | Currently, only the virtual mux driver uses the mux ACK feature, but the actual wait for the host command ACK is a part of the usb_mux general code. Generalize this mux ACK wait so it's available if needed in the future for more muxes. Additionally, moving this wait out of the mux set will allow us to lock the muxes intelligently between tasks, without keeping the muxes locked during the inactive ACK wait. BRANCH=None BUG=b:172222942,b:186777984 TEST=tast typec.Mode*.manual on voxel Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I61a043425a482cc6f3170548c888d91ec20c2a82 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3078411 Reviewed-by: Keith Short <keithshort@chromium.org>
* zork: Restore AP mux setting after rebootEdward Hill2020-07-241-0/+35
| | | | | | | | | | | | | 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>
* 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-281-24/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* usb_mux: cleanup: Replace mux state enums with ec_command bit flagVijay Hiremath2020-01-281-15/+18
| | | | | | | | | | | BUG=b:145796172 BRANCH=none TEST=make buildall -j Change-Id: Ie4ffaf208745764262931501f0dff77b525a4e59 Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2017569 Reviewed-by: Jett Rink <jettrink@chromium.org>
* zork: PS8802/PS8818 dynamic detection cleanupDenis Brockus2020-01-231-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Changed the method for detection to a non-destructive mechanism so it could be called from any of the interfaces. Added in switching to direct calling the detected driver once the hardware has been determined. The 8802 is the main mux when it is present and the fp5 mux should only select the lanes to send. Flip should not be sent to the FP5. It is a specialized form of a secondary MUX and currently being placed in as a retimer. In the future the retimers will all become MUXes and they will chain... just not today. BUG=b:147428570 BRANCH=none TEST=verify USB-C1 device with AP running Change-Id: I6b0eedd1dfcc91c3114f8dc481f5ca2841eb9e85 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2014311 Reviewed-by: Edward Hill <ecgh@chromium.org>
* usb_mux: Change AMD_FP5 mux driver to handle no powerDenis Brockus2019-11-131-6/+28
| | | | | | | | | | | | | | | Make sure if we are setting the mux to 0 and no power is applied, make sure to return back SUCCESS, Also when getting this with power off, we should return 0 and SUCCESS. BUG=none BRANCH=none TEST=plug in charger into USBC with no power to AP and verify no errors Change-Id: I3a63961a80c8ecd73dd21cf01e7d7e99b128e189 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1910485 Reviewed-by: Edward Hill <ecgh@chromium.org>
* usb_mux: Add driver for AMD FP5 USB/DP MuxEdward Hill2019-10-231-0/+97
BUG=b:138600585 BRANCH=none TEST=build Change-Id: I547309c7000e7d3ca8549a7e626a63789665305d Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1868921 Reviewed-by: Denis Brockus <dbrockus@chromium.org>