usb: typec: Add new driver for Parade PS8830 Type-C Retimer
Subsystems (5)
v5 cover usb: typec: Add new driver for Parade PS8830 Type-C Retimer
The Parade PS8830 is a Type-C multi-protocol retimer that is controlled via I2C. It provides altmode and orientation handling and usually sits between the Type-C port and the PHY.
It is currently used alongside Qualcomm Snapdragon X Elite SoCs on quite a few laptops already.
This new driver adds support for the following 3 modes:
- DP 4lanes (pin assignments C and E)
- DP 2lanes + USB3 (pin assignment D)
- USB3
This retimer is a LTTPR (Link-Training Tunable PHY Repeater) which means it can support link training from source to itself. This means that the DP driver needs to be aware of the repeater presence and to handle the link training accordingly. This is currently missing from msm dp driver, but there is already a patchset [1] on the list that adds it. Once done, full external DP will be working on all X1E laptops that make use of this retimer.
NOTE: Currently, due to both LTTPR missing support in msm DP and a reported crash that can happen on DP unplug, the DP DT patches are not supposed to be merged yet. That patch is only shared for testing purposes. Once those 2 issues have been resolved, the MDSS DP 0-2 enablement patch will be respun.
The LTTPR patchset is already on the list:
[1] https://lore.kernel.org/all/20241031-drm-dp-msm-add-lttpr-transparent-mode-set-v1-0-cafbb9855f40@linaro.org/
---
Changes in v5:
- Renamed binding schema to be the same as the compatible.
- Dropped the ps8830,boot-on from the schema.
- Added register offsets and bits names to the driver, like Konrad
suggested.
- Reordered the vregs and clocks enabling, as per Johan's request.
- Used the dev_err_probe for regmap init failure and dropped the
multiple regulator disable calls, replacing it with single call to
helper, as Christophe suggested. Also replaced dev_err with
dev_err_probe on typec_switch_register and typec_mux_register failure.
- Added some new pinctrl specific properties to all pmic provided
gpios that control retimer vregs.
- Re-ordered alphabetically the retimers default state pinconfs.
- Added the T14s patches with same exact support, as per Johan's
request.
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- Renamed the driver and bindings schema to ps883x to allow future
support for the PS8833.
- Dropped the dedicated DT property for keeping the retimers from
resetting on probe, and replaced that with a read to figure out
if it has been already configured or not. This involves leaving the
reset gpio as-is on probe if the retimer has been already configured.
- Replaced the fwnode_typec_switch_get() call with typec_switch_get()
- Replaced the fwnode_typec_mux_get() call with typec_mux_get()
- Dropped the clock name, as there is only one clock. As per Bjorn's suggestion.
- Dropped regcache as it seems it is not needed.
- Re-worded all commit messages to explain better the problem and the
proposed changes.
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Reworked the schema binding by using the usb/usb-switch.yaml defined
port graph and properties. Addressed all comments from Johan and
Dmitry.
- Dropped the manual caching of the config values on regmap write in the driver.
- Reordered the DP pin assignment states within the switch clause, as
Dmitry suggested.
- Added SVID check to not allow any altmode other than DP.
- Added DT patches (retimer for USB orientation handling and DP
enablement). Did this in order to offer a full picture of how it all
fits together.
- Split the DP enablement in DT in a separate patchset so the USB
handling can be merged separately.
- Added ps8830,boot-on to let the driver know it is supposed to skip
resetting the retimer on driver probe, as the bootloader might already
let it in a pre-configured state.
- Marked all retimer voltage regulators as boot-on since we want to
maintain the state for coldplug orientation.
- Added pinconf for all retimer0 gpios.
- Didn't pick up Konrad's T-b tags and Krzysztof's R-b tag as the rework
is quite extensive. Especially because of the ps8830,boot-on and what
it does.
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Addressed all comments from Johan and Konrad.
- Reworked the handling of the vregs so it would be more cleaner.
Dropped the usage of bulk regulators API and handled them separately.
Also discribed all regulators according to data sheet.
- Added all delays according to data sheet.
- Fixed coldplug (on boot) orientation detection.
- Didn't pick Krzysztof's R-b tag because the bindings changed w.r.t
supplies.
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Abel Vesa (6):
dt-bindings: usb: Add Parade PS8830 Type-C retimer bindings
usb: typec: Add support for Parade PS8830 Type-C Retimer
arm64: dts: qcom: x1e80100-crd: Describe the Parade PS8830 retimers
arm64: dts: qcom: x1e80100-crd: Enable external DisplayPort support
arm64: dts: qcom: x1e80100-t14s: Describe the Parade PS8830 retimers
arm64: dts: qcom: x1e80100-t14s: Enable external DisplayPort support
.../devicetree/bindings/usb/parade,ps8830.yaml | 119 ++++++ .../dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts | 321 +++++++++++++- arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 474 ++++++++++++++++++++- drivers/usb/typec/mux/Kconfig | 10 + drivers/usb/typec/mux/Makefile | 1 + drivers/usb/typec/mux/ps883x.c | 437 +++++++++++++++++++ 6 files changed, 1352 insertions(+), 10 deletions(-)
---
base-commit: 28955f4fa2823e39f1ecfb3a37a364563527afbc
change-id: 20240521-x1e80100-ps8830-d5ccca95b557
Best regards,
Signature · 1 line
Abel Vesa <[email protected]>
PATCH v5 1/6 dt-bindings: usb: Add Parade PS8830 Type-C retimer bindings
The Parade PS8830 is a USB4, DisplayPort and Thunderbolt 4 retimer, controlled over I2C. It usually sits between a USB/DisplayPort PHY and the Type-C connector, and provides orientation and altmode handling.
Currently, it is found on all boards featuring the Qualcomm Snapdragon X Elite SoCs.
Document bindings for its new driver. Future-proof the schema for the PS8833 variant, which seems to be similar to PS8830.
--- .../devicetree/bindings/usb/parade,ps8830.yaml | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+)
Documentation/devicetree/bindings/usb/parade,ps8830.yaml new file +119 -0
@@ -0,0 +1,119 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/parade,ps8830.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Parade PS883x USB and DisplayPort Retimer + +maintainers: + - Abel Vesa <[email protected]> + +properties: + compatible: + enum: + - parade,ps8830 + + reg: + maxItems: 1 + + clocks: + items: + - description: XO Clock + + reset-gpios: + maxItems: 1 + + vdd-supply: + description: power supply (1.07V) + + vdd33-supply: + description: power supply (3.3V) + + vdd33-cap-supply: + description: power supply (3.3V) + + vddar-supply: + description: power supply (1.07V) + + vddat-supply: + description: power supply (1.07V) + + vddio-supply: + description: power supply (1.2V or 1.8V) + +required: + - compatible + - reg + - clocks + - reset-gpios + - vdd-supply + - vdd33-supply + - vdd33-cap-supply + - vddat-supply + - vddio-supply + - orientation-switch + - retimer-switch + +allOf: + - $ref: usb-switch.yaml# + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + typec-mux@8 { + compatible = "parade,ps8830"; + reg = <0x8>; + + clocks = <&clk_rtmr_xo>; + + vdd-supply = <&vreg_rtmr_1p15>; + vdd33-supply = <&vreg_rtmr_3p3>; + vdd33-cap-supply = <&vreg_rtmr_3p3>; + vddar-supply = <&vreg_rtmr_1p15>; + vddat-supply = <&vreg_rtmr_1p15>; + vddio-supply = <&vreg_rtmr_1p8>; + + reset-gpios = <&tlmm 10 GPIO_ACTIVE_LOW>; + + retimer-switch; + orientation-switch; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + endpoint { + remote-endpoint = <&typec_con_ss>; + }; + }; + + port@1 { + reg = <1>; + + endpoint { + remote-endpoint = <&usb_phy_ss>; + }; + }; + + port@2 { + reg = <2>; + + endpoint { + remote-endpoint = <&typec_dp_aux>; + }; + }; + }; + }; + }; +...
Signature · 1 line
2.34.1
Rob Herring
maintainerRe: [PATCH v5 1/6] dt-bindings: usb: Add Parade PS8830 Type-C retimer bindings
Quoted 120 lines · Abel Vesa
The Parade PS8830 is a USB4, DisplayPort and Thunderbolt 4 retimer, controlled over I2C. It usually sits between a USB/DisplayPort PHY and the Type-C connector, and provides orientation and altmode handling.
Currently, it is found on all boards featuring the Qualcomm Snapdragon X Elite SoCs.
Document bindings for its new driver. Future-proof the schema for the PS8833 variant, which seems to be similar to PS8830.
Signed-off-by Abel Vesa <[email protected]>--- .../devicetree/bindings/usb/parade,ps8830.yaml | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+)Documentation/devicetree/bindings/usb/parade,ps8830.yaml new file +99
-0@@ -0,0 +1,119 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/usb/parade,ps8830.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Parade PS883x USB and DisplayPort Retimer + +maintainers: + - Abel Vesa <[email protected]> + +properties: + compatible: + enum: + - parade,ps8830 + + reg: + maxItems: 1 + + clocks: + items: + - description: XO Clock + + reset-gpios: + maxItems: 1 + + vdd-supply: + description: power supply (1.07V) + + vdd33-supply: + description: power supply (3.3V) + + vdd33-cap-supply: + description: power supply (3.3V) + + vddar-supply: + description: power supply (1.07V) + + vddat-supply: + description: power supply (1.07V) + + vddio-supply: + description: power supply (1.2V or 1.8V) + +required: + - compatible + - reg + - clocks + - reset-gpios + - vdd-supply + - vdd33-supply + - vdd33-cap-supply + - vddat-supply + - vddio-supply + - orientation-switch + - retimer-switch + +allOf: + - $ref: usb-switch.yaml# + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + typec-mux@8 { + compatible = "parade,ps8830"; + reg = <0x8>; + + clocks = <&clk_rtmr_xo>; + + vdd-supply = <&vreg_rtmr_1p15>; + vdd33-supply = <&vreg_rtmr_3p3>; + vdd33-cap-supply = <&vreg_rtmr_3p3>; + vddar-supply = <&vreg_rtmr_1p15>; + vddat-supply = <&vreg_rtmr_1p15>; + vddio-supply = <&vreg_rtmr_1p8>; + + reset-gpios = <&tlmm 10 GPIO_ACTIVE_LOW>; + + retimer-switch; + orientation-switch; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + endpoint { + remote-endpoint = <&typec_con_ss>; + }; + };
Documentation/devicetree/bindings/usb/parade,ps8830.yaml line 109
Quoted 10 lines
Documentation/devicetree/bindings/usb/parade,ps8830.yaml new file +10
-0+ + port@1 { + reg = <1>; + + endpoint { + remote-endpoint = <&usb_phy_ss>; + }; + }; + + port@2 {
No such port defined in usb-switch.yaml and you didn't define it here.
Quoted 14 lines
Documentation/devicetree/bindings/usb/parade,ps8830.yaml new file +10
-0+ reg = <2>; + + endpoint { + remote-endpoint = <&typec_dp_aux>; + }; + }; + }; + }; + }; +...Signature · 2 lines
-- 2.34.1
PATCH v5 2/6 usb: typec: Add support for Parade PS8830 Type-C Retimer
In reply to Abel VesaThe Parade PS8830 is a USB4, DisplayPort and Thunderbolt 4 retimer, controlled over I2C. It usually sits between a USB/DisplayPort PHY and the Type-C connector, and provides orientation and altmode handling.
The boards that use this retimer are the ones featuring the Qualcomm Snapdragon X Elite SoCs.
Add a driver with support for the following modes:
- DisplayPort 4-lanes
- DisplayPort 2-lanes + USB3
- USB3
There is another variant of this retimer which is called PS8833. It seems to be really similar to the PS8830, so future-proof this driver by naming it ps883x.
--- drivers/usb/typec/mux/Kconfig | 10 + drivers/usb/typec/mux/Makefile | 1 + drivers/usb/typec/mux/ps883x.c | 437 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 448 insertions(+)
drivers/usb/typec/mux/Kconfig +10 -0
@@ -56,6 +56,16 @@ config TYPEC_MUX_NB7VPQ904M Say Y or M if your system has a On Semiconductor NB7VPQ904M Type-C redriver chip found on some devices with a Type-C port. +config TYPEC_MUX_PS883X + tristate "Parade PS883x Type-C retimer driver" + depends on I2C + depends on DRM || DRM=n + select DRM_AUX_BRIDGE if DRM_BRIDGE && OF + select REGMAP_I2C + help + Say Y or M if your system has a Parade PS883x Type-C retimer chip + found on some devices with a Type-C port. + config TYPEC_MUX_PTN36502 tristate "NXP PTN36502 Type-C redriver driver" depends on I2C
drivers/usb/typec/mux/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_TYPEC_MUX_PI3USB30532) += pi3usb30532.o obj-$(CONFIG_TYPEC_MUX_INTEL_PMC) += intel_pmc_mux.o obj-$(CONFIG_TYPEC_MUX_IT5205) += it5205.o obj-$(CONFIG_TYPEC_MUX_NB7VPQ904M) += nb7vpq904m.o +obj-$(CONFIG_TYPEC_MUX_PS883X) += ps883x.o obj-$(CONFIG_TYPEC_MUX_PTN36502) += ptn36502.o obj-$(CONFIG_TYPEC_MUX_TUSB1046) += tusb1046.o obj-$(CONFIG_TYPEC_MUX_WCD939X_USBSS) += wcd939x-usbss.o
drivers/usb/typec/mux/ps883x.c new file +437 -0
437 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v5 2/6] usb: typec: Add support for Parade PS8830 Type-C Retimer
Quoted 19 lines · Abel Vesa
The Parade PS8830 is a USB4, DisplayPort and Thunderbolt 4 retimer, controlled over I2C. It usually sits between a USB/DisplayPort PHY and the Type-C connector, and provides orientation and altmode handling.
The boards that use this retimer are the ones featuring the Qualcomm Snapdragon X Elite SoCs.
drivers/usb/typec/mux/ps883x.c new file +12
-0+static int ps883x_sw_set (struct typec_switch_dev *sw, +enum typec_orientation orientation) +{ +struct ps883x_retimer *retimer =typec_switch_get_drvdata (sw); +int ret =0 ; + + ret =typec_switch_set (retimer->typec_switch, orientation); +if (ret) +return ret; + +mutex_lock (&retimer->lock); +
drivers/usb/typec/mux/ps883x.c line 142
Quoted 10 lines
drivers/usb/typec/mux/ps883x.c new file +10
-0+if (retimer->orientation != orientation) { + retimer->orientation = orientation; + + ret =ps883x_set (retimer); + } + +mutex_unlock (&retimer->lock); + +return ret; +}
This seems to indicate a bigger problem, but I see this function called during early resume while the i2c controller is suspended:
[ 54.213900] ------------[ cut here ]------------ [ 54.213942] i2c i2c-2: Transfer while suspended [ 54.214125] WARNING: CPU: 0 PID: 126 at drivers/i2c/i2c-core.h:56 __i2c_transfer+0x874/0x968 [i2c_core] ... [ 54.214833] CPU: 0 UID: 0 PID: 126 Comm: kworker/0:2 Not tainted 6.13.0-rc1 #11 [ 54.214844] Hardware name: Qualcomm CRD, BIOS 6.0.231221.BOOT.MXF.2.4-00348.1-HAMOA-1 12/21/2023 [ 54.214852] Workqueue: events pmic_glink_altmode_worker [pmic_glink_altmode] ... [ 54.215090] Call trace: [ 54.215097] __i2c_transfer+0x874/0x968 [i2c_core] (P) [ 54.215112] __i2c_transfer+0x874/0x968 [i2c_core] (L) [ 54.215126] i2c_transfer+0x94/0xf0 [i2c_core] [ 54.215140] i2c_transfer_buffer_flags+0x5c/0x90 [i2c_core] [ 54.215153] regmap_i2c_write+0x20/0x58 [regmap_i2c] [ 54.215166] _regmap_raw_write_impl+0x740/0x894 [ 54.215184] _regmap_bus_raw_write+0x60/0x7c [ 54.215192] _regmap_write+0x60/0x1b4 [ 54.215200] regmap_write+0x4c/0x78 [ 54.215207] ps883x_set+0xb0/0x10c [ps883x] [ 54.215219] ps883x_sw_set+0x74/0x98 [ps883x] [ 54.215227] typec_switch_set+0x58/0x90 [typec] [ 54.215248] pmic_glink_altmode_worker+0x3c/0x23c [pmic_glink_altmode] [ 54.215257] process_one_work+0x20c/0x610 [ 54.215274] worker_thread+0x23c/0x378 [ 54.215283] kthread+0x124/0x128 [ 54.215291] ret_from_fork+0x10/0x20 [ 54.215303] irq event stamp: 28140 [ 54.215309] hardirqs last enabled at (28139): [<ffffd15e3bc2a434>] __up_console_sem+0x6c/0x80 [ 54.215325] hardirqs last disabled at (28140): [<ffffd15e3c596aa4>] el1_dbg+0x24/0x8c [ 54.215341] softirqs last enabled at (28120): [<ffffd15e3bb9b82c>] handle_softirqs+0x4c4/0x4dc [ 54.215355] softirqs last disabled at (27961): [<ffffd15e3bb501ec>] __do_softirq+0x14/0x20 [ 54.215363] ---[ end trace 0000000000000000 ]--- [ 54.216889] Enabling non-boot CPUs ...
This can be reproduced on the CRD (or T14s) by disconnecting, for example, a mass storage device while the laptop is suspended.
Quoted 6 lines
drivers/usb/typec/mux/ps883x.c new file +6
-0+static int ps883x_retimer_set (struct typec_retimer *rtmr, +struct typec_retimer_state *state) +{ +struct ps883x_retimer *retimer =typec_retimer_get_drvdata (rtmr); +struct typec_mux_state mux_state; +int ret =0 ;
drivers/usb/typec/mux/ps883x.c line 159
Quoted 10 lines
drivers/usb/typec/mux/ps883x.c new file +10
-0+ +mutex_lock (&retimer->lock); + +if (state->mode != retimer->mode) { + retimer->mode = state->mode; + +if (state->alt) + retimer->svid = state->alt->svid; +else + retimer->svid =0 ;// No SVID
Nit: I'd prefer if you avoid c99 comments for consistency.
Quoted 36 lines
drivers/usb/typec/mux/ps883x.c new file +35
-0+ ret =ps883x_set (retimer); + } + +mutex_unlock (&retimer->lock); + +if (ret) +return ret; + + mux_state.alt = state->alt; + mux_state.data = state->data; + mux_state.mode = state->mode; + +return typec_mux_set (retimer->typec_mux, &mux_state); +} +static int ps883x_retimer_probe (struct i2c_client *client) +{ +struct device *dev = &client->dev; +struct typec_switch_desc sw_desc = { }; +struct typec_retimer_desc rtmr_desc = { }; +struct ps883x_retimer *retimer; +int ret; + + retimer =devm_kzalloc (dev,sizeof (*retimer),GFP_KERNEL ); +if (!retimer) +return -ENOMEM ; + + retimer->client = client; + +mutex_init (&retimer->lock); + + retimer->regmap =devm_regmap_init_i2c (client, &ps883x_retimer_regmap); +if (IS_ERR (retimer->regmap)) +return dev_err_probe (dev,PTR_ERR (retimer->regmap), +"failed to allocate register map\n" ); +
drivers/usb/typec/mux/ps883x.c
Quoted 10 lines
drivers/usb/typec/mux/ps883x.c new file +10
-0+ ret =ps883x_get_vregs (retimer); +if (ret) +return ret; + + retimer->xo_clk =devm_clk_get (dev,NULL ); +if (IS_ERR (retimer->xo_clk)) +return dev_err_probe (dev,PTR_ERR (retimer->xo_clk), +"failed to get xo clock\n" ); + + retimer->reset_gpio =devm_gpiod_get (dev,"reset" ,GPIOD_ASIS );
GPIOD_ASIS is documented as requiring you to later set the direction, but this does not happen unconditionally below.
Quoted 41 lines
drivers/usb/typec/mux/ps883x.c new file +41
-0+if (IS_ERR (retimer->reset_gpio)) +return dev_err_probe (dev,PTR_ERR (retimer->reset_gpio), +"failed to get reset gpio\n" ); + + retimer->typec_switch =typec_switch_get (dev); +if (IS_ERR (retimer->typec_switch)) +return dev_err_probe (dev,PTR_ERR (retimer->typec_switch), +"failed to acquire orientation-switch\n" ); + + retimer->typec_mux =typec_mux_get (dev); +if (IS_ERR (retimer->typec_mux)) { + ret =dev_err_probe (dev,PTR_ERR (retimer->typec_mux), +"failed to acquire mode-mux\n" ); + goto err_switch_put; + } + + ret =drm_aux_bridge_register (dev); +if (ret) + goto err_mux_put; + + ret =ps883x_enable_vregs (retimer); +if (ret) + goto err_mux_put; + + ret =clk_prepare_enable (retimer->xo_clk); +if (ret) { +dev_err (dev,"failed to enable XO: %d\n" , ret); + goto err_vregs_disable; + } + + sw_desc.drvdata = retimer; + sw_desc.fwnode =dev_fwnode (dev); + sw_desc.set = ps883x_sw_set; + + retimer->sw =typec_switch_register (dev, &sw_desc); +if (IS_ERR (retimer->sw)) { + ret =dev_err_probe (dev,PTR_ERR (retimer->sw), +"failed to register typec switch\n" ); + goto err_clk_disable; + } +
drivers/usb/typec/mux/ps883x.c line 369
Quoted 10 lines
drivers/usb/typec/mux/ps883x.c new file +10
-0+ rtmr_desc.drvdata = retimer; + rtmr_desc.fwnode =dev_fwnode (dev); + rtmr_desc.set = ps883x_retimer_set; + + retimer->retimer =typec_retimer_register (dev, &rtmr_desc); +if (IS_ERR (retimer->retimer)) { + ret =dev_err_probe (dev,PTR_ERR (retimer->sw), +"failed to register typec retimer\n" ); + goto err_switch_unregister; + }
The registration functions do not return -EPROBE_DEFER so I'd prefer if you switch back to dev_err() here as we already discussed. A driver must not probe defer after having registered child devices so it's important to document which functions can actually trigger a probe deferral.
I know there's been a recent change to the dev_err_probe() suggesting that it could be used anyway, but I think that's a really bad idea and I'm considering sending a revert for that.
drivers/usb/typec/mux/ps883x.c line 374
Quoted 5 lines
drivers/usb/typec/mux/ps883x.c new file +5
-0+ +/* skip resetting if already configured */ +if (regmap_test_bits (retimer->regmap,REG_USB_PORT_CONN_STATUS_0 , +CONN_STATUS_0_CONNECTION_PRESENT )) +return 0 ;
What if the device is held in reset? This looks like it only works if the boot firmware has already enabled the retimer. Otherwise you may return success from probe here with the retimer still in reset.
Quoted 32 lines
drivers/usb/typec/mux/ps883x.c new file +32
-0+gpiod_direction_output (retimer->reset_gpio,1 ); + +/* VDD IO supply enable to reset release delay */ +usleep_range (4000 ,14000 ); + +gpiod_set_value (retimer->reset_gpio,0 ); + +/* firmware initialization delay */ +msleep (60 ); + +return 0 ; + +err_switch_unregister: +typec_switch_unregister (retimer->sw); +err_vregs_disable: +ps883x_disable_vregs (retimer); +err_clk_disable: +clk_disable_unprepare (retimer->xo_clk); +err_mux_put: +typec_mux_put (retimer->typec_mux); +err_switch_put: +typec_switch_put (retimer->typec_switch); + +return ret; +} + +static void ps883x_retimer_remove (struct i2c_client *client) +{ +struct ps883x_retimer *retimer =i2c_get_clientdata (client); + +typec_retimer_unregister (retimer->retimer); +typec_switch_unregister (retimer->sw);
drivers/usb/typec/mux/ps883x.c line 417
Quoted 10 lines
drivers/usb/typec/mux/ps883x.c new file +10
-0+ +gpiod_set_value (retimer->reset_gpio,1 ); + +clk_disable_unprepare (retimer->xo_clk); + +ps883x_disable_vregs (retimer); + +typec_mux_put (retimer->typec_mux); +typec_switch_put (retimer->typec_switch); +}
Johan
Bjorn Andersson
maintainerRe: [PATCH v5 2/6] usb: typec: Add support for Parade PS8830 Type-C Retimer
Quoted 68 lines · Johan Hovold
Quoted 19 lines · Abel Vesa
The Parade PS8830 is a USB4, DisplayPort and Thunderbolt 4 retimer, controlled over I2C. It usually sits between a USB/DisplayPort PHY and the Type-C connector, and provides orientation and altmode handling.
The boards that use this retimer are the ones featuring the Qualcomm Snapdragon X Elite SoCs.
drivers/usb/typec/mux/ps883x.c new file +12
-0+static int ps883x_sw_set (struct typec_switch_dev *sw, +enum typec_orientation orientation) +{ +struct ps883x_retimer *retimer =typec_switch_get_drvdata (sw); +int ret =0 ; + + ret =typec_switch_set (retimer->typec_switch, orientation); +if (ret) +return ret; + +mutex_lock (&retimer->lock); +drivers/usb/typec/mux/ps883x.c line 142
Quoted 10 lines
drivers/usb/typec/mux/ps883x.c new file +10
-0+if (retimer->orientation != orientation) { + retimer->orientation = orientation; + + ret =ps883x_set (retimer); + } + +mutex_unlock (&retimer->lock); + +return ret; +}This seems to indicate a bigger problem, but I see this function called during early resume while the i2c controller is suspended:
[ 54.213900] ------------[ cut here ]------------ [ 54.213942] i2c i2c-2: Transfer while suspended [ 54.214125] WARNING: CPU: 0 PID: 126 at drivers/i2c/i2c-core.h:56 __i2c_transfer+0x874/0x968 [i2c_core] ... [ 54.214833] CPU: 0 UID: 0 PID: 126 Comm: kworker/0:2 Not tainted 6.13.0-rc1 #11 [ 54.214844] Hardware name: Qualcomm CRD, BIOS 6.0.231221.BOOT.MXF.2.4-00348.1-HAMOA-1 12/21/2023 [ 54.214852] Workqueue: events pmic_glink_altmode_worker [pmic_glink_altmode] ... [ 54.215090] Call trace: [ 54.215097] __i2c_transfer+0x874/0x968 [i2c_core] (P) [ 54.215112] __i2c_transfer+0x874/0x968 [i2c_core] (L) [ 54.215126] i2c_transfer+0x94/0xf0 [i2c_core] [ 54.215140] i2c_transfer_buffer_flags+0x5c/0x90 [i2c_core] [ 54.215153] regmap_i2c_write+0x20/0x58 [regmap_i2c] [ 54.215166] _regmap_raw_write_impl+0x740/0x894 [ 54.215184] _regmap_bus_raw_write+0x60/0x7c [ 54.215192] _regmap_write+0x60/0x1b4 [ 54.215200] regmap_write+0x4c/0x78 [ 54.215207] ps883x_set+0xb0/0x10c [ps883x] [ 54.215219] ps883x_sw_set+0x74/0x98 [ps883x] [ 54.215227] typec_switch_set+0x58/0x90 [typec] [ 54.215248] pmic_glink_altmode_worker+0x3c/0x23c [pmic_glink_altmode] [ 54.215257] process_one_work+0x20c/0x610 [ 54.215274] worker_thread+0x23c/0x378 [ 54.215283] kthread+0x124/0x128 [ 54.215291] ret_from_fork+0x10/0x20 [ 54.215303] irq event stamp: 28140 [ 54.215309] hardirqs last enabled at (28139): [<ffffd15e3bc2a434>] __up_console_sem+0x6c/0x80 [ 54.215325] hardirqs last disabled at (28140): [<ffffd15e3c596aa4>] el1_dbg+0x24/0x8c [ 54.215341] softirqs last enabled at (28120): [<ffffd15e3bb9b82c>] handle_softirqs+0x4c4/0x4dc [ 54.215355] softirqs last disabled at (27961): [<ffffd15e3bb501ec>] __do_softirq+0x14/0x20 [ 54.215363] ---[ end trace 0000000000000000 ]--- [ 54.216889] Enabling non-boot CPUs ...
Quoted 3 lines
This can be reproduced on the CRD (or T14s) by disconnecting, for example, a mass storage device while the laptop is suspended.
I wonder if this is because drivers/rpmsg/qcom_glink_smem.c line 309 registers the GLINK interrupt as IRQF_NO_SUSPEND as a remnant from being used for rpm communication...
This is no longer needed (glink/rpm code path is now different), but iirc the cleanup got stuck in the question of dealing with wakeup capabilities (and priorities).
Regards,
Bjorn
Re: [PATCH v5 2/6] usb: typec: Add support for Parade PS8830 Type-C Retimer
Quoted 69 lines · Bjorn Andersson
Quoted 68 lines · Johan Hovold
Quoted 19 lines · Abel Vesa
The Parade PS8830 is a USB4, DisplayPort and Thunderbolt 4 retimer, controlled over I2C. It usually sits between a USB/DisplayPort PHY and the Type-C connector, and provides orientation and altmode handling.
The boards that use this retimer are the ones featuring the Qualcomm Snapdragon X Elite SoCs.
drivers/usb/typec/mux/ps883x.c new file +12
-0+static int ps883x_sw_set (struct typec_switch_dev *sw, +enum typec_orientation orientation) +{ +struct ps883x_retimer *retimer =typec_switch_get_drvdata (sw); +int ret =0 ; + + ret =typec_switch_set (retimer->typec_switch, orientation); +if (ret) +return ret; + +mutex_lock (&retimer->lock); +drivers/usb/typec/mux/ps883x.c line 142
Quoted 10 lines
drivers/usb/typec/mux/ps883x.c new file +10
-0+if (retimer->orientation != orientation) { + retimer->orientation = orientation; + + ret =ps883x_set (retimer); + } + +mutex_unlock (&retimer->lock); + +return ret; +}This seems to indicate a bigger problem, but I see this function called during early resume while the i2c controller is suspended:
[ 54.213900] ------------[ cut here ]------------ [ 54.213942] i2c i2c-2: Transfer while suspended [ 54.214125] WARNING: CPU: 0 PID: 126 at drivers/i2c/i2c-core.h:56 __i2c_transfer+0x874/0x968 [i2c_core] ... [ 54.214833] CPU: 0 UID: 0 PID: 126 Comm: kworker/0:2 Not tainted 6.13.0-rc1 #11 [ 54.214844] Hardware name: Qualcomm CRD, BIOS 6.0.231221.BOOT.MXF.2.4-00348.1-HAMOA-1 12/21/2023 [ 54.214852] Workqueue: events pmic_glink_altmode_worker [pmic_glink_altmode] ... [ 54.215090] Call trace: [ 54.215097] __i2c_transfer+0x874/0x968 [i2c_core] (P) [ 54.215112] __i2c_transfer+0x874/0x968 [i2c_core] (L) [ 54.215126] i2c_transfer+0x94/0xf0 [i2c_core] [ 54.215140] i2c_transfer_buffer_flags+0x5c/0x90 [i2c_core] [ 54.215153] regmap_i2c_write+0x20/0x58 [regmap_i2c] [ 54.215166] _regmap_raw_write_impl+0x740/0x894 [ 54.215184] _regmap_bus_raw_write+0x60/0x7c [ 54.215192] _regmap_write+0x60/0x1b4 [ 54.215200] regmap_write+0x4c/0x78 [ 54.215207] ps883x_set+0xb0/0x10c [ps883x] [ 54.215219] ps883x_sw_set+0x74/0x98 [ps883x] [ 54.215227] typec_switch_set+0x58/0x90 [typec] [ 54.215248] pmic_glink_altmode_worker+0x3c/0x23c [pmic_glink_altmode] [ 54.215257] process_one_work+0x20c/0x610 [ 54.215274] worker_thread+0x23c/0x378 [ 54.215283] kthread+0x124/0x128 [ 54.215291] ret_from_fork+0x10/0x20 [ 54.215303] irq event stamp: 28140 [ 54.215309] hardirqs last enabled at (28139): [<ffffd15e3bc2a434>] __up_console_sem+0x6c/0x80 [ 54.215325] hardirqs last disabled at (28140): [<ffffd15e3c596aa4>] el1_dbg+0x24/0x8c [ 54.215341] softirqs last enabled at (28120): [<ffffd15e3bb9b82c>] handle_softirqs+0x4c4/0x4dc [ 54.215355] softirqs last disabled at (27961): [<ffffd15e3bb501ec>] __do_softirq+0x14/0x20 [ 54.215363] ---[ end trace 0000000000000000 ]--- [ 54.216889] Enabling non-boot CPUs ...
Quoted 7 lines
Quoted 3 lines
This can be reproduced on the CRD (or T14s) by disconnecting, for example, a mass storage device while the laptop is suspended.
I wonder if this is because
drivers/rpmsg/qcom_glink_smem.cline 309 registers the GLINK interrupt asIRQF_NO_SUSPENDas a remnant from being used for rpm communication...
Yes. Seems like dropping the flag fixes this.
Quoted 4 lines
This is no longer needed (glink/rpm code path is now different), but iirc the cleanup got stuck in the question of dealing with wakeup capabilities (and priorities).
I'll send a patch to drop the flag and we then can debate there if it's the right thing to do w.r.t. wakeup.
Quoted 3 lines
Regards,
Bjorn
Re: [PATCH v5 2/6] usb: typec: Add support for Parade PS8830 Type-C Retimer
In reply to Johan HovoldQuoted 68 lines · Johan Hovold
Quoted 19 lines · Abel Vesa
The Parade PS8830 is a USB4, DisplayPort and Thunderbolt 4 retimer, controlled over I2C. It usually sits between a USB/DisplayPort PHY and the Type-C connector, and provides orientation and altmode handling.
The boards that use this retimer are the ones featuring the Qualcomm Snapdragon X Elite SoCs.
drivers/usb/typec/mux/ps883x.c new file +12
-0+static int ps883x_sw_set (struct typec_switch_dev *sw, +enum typec_orientation orientation) +{ +struct ps883x_retimer *retimer =typec_switch_get_drvdata (sw); +int ret =0 ; + + ret =typec_switch_set (retimer->typec_switch, orientation); +if (ret) +return ret; + +mutex_lock (&retimer->lock); +drivers/usb/typec/mux/ps883x.c line 142
Quoted 10 lines
drivers/usb/typec/mux/ps883x.c new file +10
-0+if (retimer->orientation != orientation) { + retimer->orientation = orientation; + + ret =ps883x_set (retimer); + } + +mutex_unlock (&retimer->lock); + +return ret; +}This seems to indicate a bigger problem, but I see this function called during early resume while the i2c controller is suspended:
[ 54.213900] ------------[ cut here ]------------ [ 54.213942] i2c i2c-2: Transfer while suspended [ 54.214125] WARNING: CPU: 0 PID: 126 at drivers/i2c/i2c-core.h:56 __i2c_transfer+0x874/0x968 [i2c_core] ... [ 54.214833] CPU: 0 UID: 0 PID: 126 Comm: kworker/0:2 Not tainted 6.13.0-rc1 #11 [ 54.214844] Hardware name: Qualcomm CRD, BIOS 6.0.231221.BOOT.MXF.2.4-00348.1-HAMOA-1 12/21/2023 [ 54.214852] Workqueue: events pmic_glink_altmode_worker [pmic_glink_altmode] ... [ 54.215090] Call trace: [ 54.215097] __i2c_transfer+0x874/0x968 [i2c_core] (P) [ 54.215112] __i2c_transfer+0x874/0x968 [i2c_core] (L) [ 54.215126] i2c_transfer+0x94/0xf0 [i2c_core] [ 54.215140] i2c_transfer_buffer_flags+0x5c/0x90 [i2c_core] [ 54.215153] regmap_i2c_write+0x20/0x58 [regmap_i2c] [ 54.215166] _regmap_raw_write_impl+0x740/0x894 [ 54.215184] _regmap_bus_raw_write+0x60/0x7c [ 54.215192] _regmap_write+0x60/0x1b4 [ 54.215200] regmap_write+0x4c/0x78 [ 54.215207] ps883x_set+0xb0/0x10c [ps883x] [ 54.215219] ps883x_sw_set+0x74/0x98 [ps883x] [ 54.215227] typec_switch_set+0x58/0x90 [typec] [ 54.215248] pmic_glink_altmode_worker+0x3c/0x23c [pmic_glink_altmode] [ 54.215257] process_one_work+0x20c/0x610 [ 54.215274] worker_thread+0x23c/0x378 [ 54.215283] kthread+0x124/0x128 [ 54.215291] ret_from_fork+0x10/0x20 [ 54.215303] irq event stamp: 28140 [ 54.215309] hardirqs last enabled at (28139): [<ffffd15e3bc2a434>] __up_console_sem+0x6c/0x80 [ 54.215325] hardirqs last disabled at (28140): [<ffffd15e3c596aa4>] el1_dbg+0x24/0x8c [ 54.215341] softirqs last enabled at (28120): [<ffffd15e3bb9b82c>] handle_softirqs+0x4c4/0x4dc [ 54.215355] softirqs last disabled at (27961): [<ffffd15e3bb501ec>] __do_softirq+0x14/0x20 [ 54.215363] ---[ end trace 0000000000000000 ]--- [ 54.216889] Enabling non-boot CPUs ...
Quoted 2 lines
This can be reproduced on the CRD (or T14s) by disconnecting, for example, a mass storage device while the laptop is suspended.
Sorry for the late reply.
According to Bjorn's reply, this needs to be fixed in qcom-glink-smem driver due to the IRQF_NO_SUSPEND flag for the glink-smem interrupt.
TBF, this whole series is going to be delayed by that fix being needed anyway.
Quoted 11 lines
Quoted 11 lines
drivers/usb/typec/mux/ps883x.c new file +10
-0+static int ps883x_retimer_set (struct typec_retimer *rtmr, +struct typec_retimer_state *state) +{ +struct ps883x_retimer *retimer =typec_retimer_get_drvdata (rtmr); +struct typec_mux_state mux_state; +int ret =0 ; + +mutex_lock (&retimer->lock); + +if (state->mode != retimer->mode) {
Quoted 8 lines
drivers/usb/typec/mux/ps883x.c line 159
Quoted 6 lines
drivers/usb/typec/mux/ps883x.c new file +6
-0+ retimer->mode = state->mode; + +if (state->alt) + retimer->svid = state->alt->svid; +else + retimer->svid =0 ;// No SVID Nit: I'd prefer if you avoid c99 comments for consistency.
Yes, will drop.
Quoted 42 lines
Quoted 42 lines
drivers/usb/typec/mux/ps883x.c new file +40
-0+ ret =ps883x_set (retimer); + } + +mutex_unlock (&retimer->lock); + +if (ret) +return ret; + + mux_state.alt = state->alt; + mux_state.data = state->data; + mux_state.mode = state->mode; + +return typec_mux_set (retimer->typec_mux, &mux_state); +} +static int ps883x_retimer_probe (struct i2c_client *client) +{ +struct device *dev = &client->dev; +struct typec_switch_desc sw_desc = { }; +struct typec_retimer_desc rtmr_desc = { }; +struct ps883x_retimer *retimer; +int ret; + + retimer =devm_kzalloc (dev,sizeof (*retimer),GFP_KERNEL ); +if (!retimer) +return -ENOMEM ; + + retimer->client = client; + +mutex_init (&retimer->lock); + + retimer->regmap =devm_regmap_init_i2c (client, &ps883x_retimer_regmap); +if (IS_ERR (retimer->regmap)) +return dev_err_probe (dev,PTR_ERR (retimer->regmap), +"failed to allocate register map\n" ); + + ret =ps883x_get_vregs (retimer); +if (ret) +return ret; + + retimer->xo_clk =devm_clk_get (dev,NULL );
Quoted 8 lines
drivers/usb/typec/mux/ps883x.c line 318
Quoted 5 lines
drivers/usb/typec/mux/ps883x.c new file +5
-0+if (IS_ERR (retimer->xo_clk)) +return dev_err_probe (dev,PTR_ERR (retimer->xo_clk), +"failed to get xo clock\n" ); + + retimer->reset_gpio =devm_gpiod_get (dev,"reset" ,GPIOD_ASIS );
GPIOD_ASISis documented as requiring you to later set the direction, but this does not happen unconditionally below.
Yes. Will do that after the read that figures out if the retimer is already left configured or not.
Quoted 58 lines
Quoted 42 lines
drivers/usb/typec/mux/ps883x.c new file +41
-0+if (IS_ERR (retimer->reset_gpio)) +return dev_err_probe (dev,PTR_ERR (retimer->reset_gpio), +"failed to get reset gpio\n" ); + + retimer->typec_switch =typec_switch_get (dev); +if (IS_ERR (retimer->typec_switch)) +return dev_err_probe (dev,PTR_ERR (retimer->typec_switch), +"failed to acquire orientation-switch\n" ); + + retimer->typec_mux =typec_mux_get (dev); +if (IS_ERR (retimer->typec_mux)) { + ret =dev_err_probe (dev,PTR_ERR (retimer->typec_mux), +"failed to acquire mode-mux\n" ); + goto err_switch_put; + } + + ret =drm_aux_bridge_register (dev); +if (ret) + goto err_mux_put; + + ret =ps883x_enable_vregs (retimer); +if (ret) + goto err_mux_put; + + ret =clk_prepare_enable (retimer->xo_clk); +if (ret) { +dev_err (dev,"failed to enable XO: %d\n" , ret); + goto err_vregs_disable; + } + + sw_desc.drvdata = retimer; + sw_desc.fwnode =dev_fwnode (dev); + sw_desc.set = ps883x_sw_set; + + retimer->sw =typec_switch_register (dev, &sw_desc); +if (IS_ERR (retimer->sw)) { + ret =dev_err_probe (dev,PTR_ERR (retimer->sw), +"failed to register typec switch\n" ); + goto err_clk_disable; + } +drivers/usb/typec/mux/ps883x.c line 369
Quoted 10 lines
drivers/usb/typec/mux/ps883x.c new file +10
-0+ rtmr_desc.drvdata = retimer; + rtmr_desc.fwnode =dev_fwnode (dev); + rtmr_desc.set = ps883x_retimer_set; + + retimer->retimer =typec_retimer_register (dev, &rtmr_desc); +if (IS_ERR (retimer->retimer)) { + ret =dev_err_probe (dev,PTR_ERR (retimer->sw), +"failed to register typec retimer\n" ); + goto err_switch_unregister; + }The registration functions do not return -EPROBE_DEFER so I'd prefer if you switch back to
dev_err()here as we already discussed. A driver must not probe defer after having registered child devices so it's important to document which functions can actually trigger a probe deferral.
Quoted 3 lines
I know there's been a recent change to the
dev_err_probe()suggesting that it could be used anyway, but I think that's a really bad idea and I'm considering sending a revert for that.
Makes sense to me. Will switch back to dev_err().
Quoted 10 lines
drivers/usb/typec/mux/ps883x.c line 374
Quoted 6 lines
drivers/usb/typec/mux/ps883x.c new file +5
-0+ +/* skip resetting if already configured */ +if (regmap_test_bits (retimer->regmap,REG_USB_PORT_CONN_STATUS_0 , +CONN_STATUS_0_CONNECTION_PRESENT )) +return 0 ;What if the device is held in reset? This looks like it only works if the boot firmware has already enabled the retimer. Otherwise you may return success from probe here with the retimer still in reset.
Please correct me if I'm wrong, but if the read above fails or reads anything else than "connection present", then below we go through the resetting sequence. If it reads "connection present", then retimer can't be in reset.
And here is where the direction setting mentioned above would have to happen if the "connection is present" as well, not just for when the repeater is in reset, which is handled below.
Quoted 37 lines
Quoted 37 lines
drivers/usb/typec/mux/ps883x.c new file +36
-0+gpiod_direction_output (retimer->reset_gpio,1 ); + +/* VDD IO supply enable to reset release delay */ +usleep_range (4000 ,14000 ); + +gpiod_set_value (retimer->reset_gpio,0 ); + +/* firmware initialization delay */ +msleep (60 ); + +return 0 ; + +err_switch_unregister: +typec_switch_unregister (retimer->sw); +err_vregs_disable: +ps883x_disable_vregs (retimer); +err_clk_disable: +clk_disable_unprepare (retimer->xo_clk); +err_mux_put: +typec_mux_put (retimer->typec_mux); +err_switch_put: +typec_switch_put (retimer->typec_switch); + +return ret; +} + +static void ps883x_retimer_remove (struct i2c_client *client) +{ +struct ps883x_retimer *retimer =i2c_get_clientdata (client); + +typec_retimer_unregister (retimer->retimer); +typec_switch_unregister (retimer->sw); + +gpiod_set_value (retimer->reset_gpio,1 ); + +clk_disable_unprepare (retimer->xo_clk);
Quoted 8 lines
drivers/usb/typec/mux/ps883x.c line 417
Quoted 6 lines
drivers/usb/typec/mux/ps883x.c new file +6
-0+ +ps883x_disable_vregs (retimer); + +typec_mux_put (retimer->typec_mux); +typec_switch_put (retimer->typec_switch); +}Johan
Thanks for reviewing,
Abel
Re: [PATCH v5 2/6] usb: typec: Add support for Parade PS8830 Type-C Retimer
Quoted 12 lines · Abel Vesa
Quoted 10 lines · Johan Hovold
drivers/usb/typec/mux/ps883x.c line 374
Quoted 4 lines · Abel Vesa
drivers/usb/typec/mux/ps883x.c new file +4
-0+/* skip resetting if already configured */ +if (regmap_test_bits (retimer->regmap,REG_USB_PORT_CONN_STATUS_0 , +CONN_STATUS_0_CONNECTION_PRESENT )) +return 0 ;What if the device is held in reset? This looks like it only works if the boot firmware has already enabled the retimer. Otherwise you may return success from probe here with the retimer still in reset.
Quoted 4 lines
Please correct me if I'm wrong, but if the read above fails or reads anything else than "connection present", then below we go through the resetting sequence. If it reads "connection present", then retimer can't be in reset.
regmap_test_bits() returns a negative errno if the read fails, so you need to check that the return value is 1 here to avoid returning success from probe on failure.
Johan
PATCH v5 3/6 arm64: dts: qcom: x1e80100-crd: Describe the Parade PS8830 retimers
In reply to Abel VesaThe X Elite CRD board comes with 3 Parade PS8830 retimers, one for each Type-C port. These handle the orientation and altmode switching and are controlled over I2C. In the connection chain, they sit between the USB/DisplayPort combo PHY and the Type-C connector.
Describe the retimers and all gpio controlled voltage regulators used by each retimer. Also, modify the pmic glink graph to include the retimers in between the SuperSpeed/Sideband in endpoints and the QMP PHY out endpoints.
--- arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 450 +++++++++++++++++++++++++++++- 1 file changed, 444 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/x1e80100-crd.dts +444 -6
@@ -100,7 +100,15 @@ port@1 { reg = <1>; pmic_glink_ss0_ss_in: endpoint { - remote-endpoint = <&usb_1_ss0_qmpphy_out>; + remote-endpoint = <&retimer_ss0_ss_out>; + }; + }; + + port@2 { + reg = <2>; + + pmic_glink_ss0_con_sbu_in: endpoint { + remote-endpoint = <&retimer_ss0_con_sbu_out>; }; }; };
@@ -129,7 +137,15 @@ port@1 { reg = <1>; pmic_glink_ss1_ss_in: endpoint { - remote-endpoint = <&usb_1_ss1_qmpphy_out>; + remote-endpoint = <&retimer_ss1_ss_out>; + }; + }; + + port@2 { + reg = <2>; + + pmic_glink_ss1_con_sbu_in: endpoint { + remote-endpoint = <&retimer_ss1_con_sbu_out>; }; }; };
@@ -158,7 +174,15 @@ port@1 { reg = <1>; pmic_glink_ss2_ss_in: endpoint { - remote-endpoint = <&usb_1_ss2_qmpphy_out>; + remote-endpoint = <&retimer_ss2_ss_out>; + }; + }; + + port@2 { + reg = <2>; + + pmic_glink_ss2_con_sbu_in: endpoint { + remote-endpoint = <&retimer_ss2_con_sbu_out>; }; }; };
@@ -311,6 +335,150 @@ vreg_nvme: regulator-nvme { regulator-boot-on; }; + vreg_rtmr0_1p15: regulator-rtmr0-1p15 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR0_1P15"; + regulator-min-microvolt = <1150000>; + regulator-max-microvolt = <1150000>; + + gpio = <&pmc8380_5_gpios 8 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb0_pwr_1p15_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_rtmr0_1p8: regulator-rtmr0-1p8 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR0_1P8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + gpio = <&pm8550ve_9_gpios 8 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb0_1p8_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_rtmr0_3p3: regulator-rtmr0-3p3 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR0_3P3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + gpio = <&pm8550_gpios 11 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb0_3p3_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_rtmr1_1p15: regulator-rtmr1-1p15 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR1_1P15"; + regulator-min-microvolt = <1150000>; + regulator-max-microvolt = <1150000>; + + gpio = <&tlmm 188 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb1_pwr_1p15_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_rtmr1_1p8: regulator-rtmr1-1p8 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR1_1P8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + gpio = <&tlmm 175 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb1_pwr_1p8_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_rtmr1_3p3: regulator-rtmr1-3p3 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR1_3P3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + gpio = <&tlmm 186 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb1_pwr_3p3_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_rtmr2_1p15: regulator-rtmr2-1p15 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR2_1P15"; + regulator-min-microvolt = <1150000>; + regulator-max-microvolt = <1150000>; + + gpio = <&tlmm 189 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb2_pwr_1p15_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_rtmr2_1p8: regulator-rtmr2-1p8 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR2_1P8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + gpio = <&tlmm 126 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb2_pwr_1p8_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_rtmr2_3p3: regulator-rtmr2-3p3 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR2_3P3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + gpio = <&tlmm 187 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb2_pwr_3p3_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + vph_pwr: regulator-vph-pwr { compatible = "regulator-fixed";
@@ -735,6 +903,178 @@ keyboard@3a { }; }; +&i2c1 { + clock-frequency = <400000>; + + status = "okay"; + + typec-mux@8 { + compatible = "parade,ps8830"; + reg = <0x08>; + + clocks = <&rpmhcc RPMH_RF_CLK5>; + + vdd-supply = <&vreg_rtmr2_1p15>; + vdd33-supply = <&vreg_rtmr2_3p3>; + vdd33-cap-supply = <&vreg_rtmr2_3p3>; + vddar-supply = <&vreg_rtmr2_1p15>; + vddat-supply = <&vreg_rtmr2_1p15>; + vddio-supply = <&vreg_rtmr2_1p8>; + + reset-gpios = <&tlmm 185 GPIO_ACTIVE_LOW>; + + pinctrl-0 = <&rtmr2_default>; + pinctrl-names = "default"; + + orientation-switch; + retimer-switch; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + retimer_ss2_ss_out: endpoint { + remote-endpoint = <&pmic_glink_ss2_ss_in>; + }; + }; + + port@1 { + reg = <1>; + + retimer_ss2_ss_in: endpoint { + remote-endpoint = <&usb_1_ss2_qmpphy_out>; + }; + }; + + port@2 { + reg = <2>; + + retimer_ss2_con_sbu_out: endpoint { + remote-endpoint = <&pmic_glink_ss2_con_sbu_in>; + }; + }; + }; + }; +}; + +&i2c3 { + clock-frequency = <400000>; + + status = "okay"; + + typec-mux@8 { + compatible = "parade,ps8830"; + reg = <0x08>; + + clocks = <&rpmhcc RPMH_RF_CLK3>; + + vdd-supply = <&vreg_rtmr0_1p15>; + vdd33-supply = <&vreg_rtmr0_3p3>; + vdd33-cap-supply = <&vreg_rtmr0_3p3>; + vddar-supply = <&vreg_rtmr0_1p15>; + vddat-supply = <&vreg_rtmr0_1p15>; + vddio-supply = <&vreg_rtmr0_1p8>; + + reset-gpios = <&pm8550_gpios 10 GPIO_ACTIVE_LOW>; + + pinctrl-0 = <&rtmr0_default>; + pinctrl-names = "default"; + + retimer-switch; + orientation-switch; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + retimer_ss0_ss_out: endpoint { + remote-endpoint = <&pmic_glink_ss0_ss_in>; + }; + }; + + port@1 { + reg = <1>; + + retimer_ss0_ss_in: endpoint { + remote-endpoint = <&usb_1_ss0_qmpphy_out>; + }; + }; + + port@2 { + reg = <2>; + + retimer_ss0_con_sbu_out: endpoint { + remote-endpoint = <&pmic_glink_ss0_con_sbu_in>; + }; + }; + }; + }; +}; + +&i2c7 { + clock-frequency = <400000>; + + status = "okay"; + + typec-mux@8 { + compatible = "parade,ps8830"; + reg = <0x8>; + + clocks = <&rpmhcc RPMH_RF_CLK4>; + + vdd-supply = <&vreg_rtmr1_1p15>; + vdd33-supply = <&vreg_rtmr1_3p3>; + vdd33-cap-supply = <&vreg_rtmr1_3p3>; + vddar-supply = <&vreg_rtmr1_1p15>; + vddat-supply = <&vreg_rtmr1_1p15>; + vddio-supply = <&vreg_rtmr1_1p8>; + + reset-gpios = <&tlmm 176 GPIO_ACTIVE_LOW>; + + pinctrl-0 = <&rtmr1_default>; + pinctrl-names = "default"; + + retimer-switch; + orientation-switch; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + retimer_ss1_ss_out: endpoint { + remote-endpoint = <&pmic_glink_ss1_ss_in>; + }; + }; + + port@1 { + reg = <1>; + + retimer_ss1_ss_in: endpoint { + remote-endpoint = <&usb_1_ss1_qmpphy_out>; + }; + }; + + port@2 { + reg = <2>; + + retimer_ss1_con_sbu_out: endpoint { + remote-endpoint = <&pmic_glink_ss1_con_sbu_in>; + }; + }; + + }; + }; +}; + &i2c8 { clock-frequency = <400000>;
@@ -883,6 +1223,26 @@ &pcie6a_phy { status = "okay"; }; +&pm8550_gpios { + rtmr0_default: rtmr0-reset-n-active-state { + pins = "gpio10"; + function = "normal"; + power-source = <1>; /* 1.8V */ + bias-disable; + input-disable; + output-enable; + }; + + usb0_3p3_reg_en: usb0-3p3-reg-en-state { + pins = "gpio11"; + function = "normal"; + power-source = <1>; /* 1.8V */ + bias-disable; + input-disable; + output-enable; + }; +}; + &pm8550ve_8_gpios { misc_3p3_reg_en: misc-3p3-reg-en-state { pins = "gpio6";
@@ -896,6 +1256,17 @@ misc_3p3_reg_en: misc-3p3-reg-en-state { }; }; +&pm8550ve_9_gpios { + usb0_1p8_reg_en: usb0-1p8-reg-en-state { + pins = "gpio8"; + function = "normal"; + power-source = <1>; /* 1.8V */ + bias-disable; + input-disable; + output-enable; + }; +}; + &pmc8380_3_gpios { edp_bl_en: edp-bl-en-state { pins = "gpio4";
@@ -906,6 +1277,17 @@ edp_bl_en: edp-bl-en-state { }; }; +&pmc8380_5_gpios { + usb0_pwr_1p15_reg_en: usb0-pwr-1p15-reg-en-state { + pins = "gpio8"; + function = "normal"; + power-source = <1>; /* 1.8V */ + bias-disable; + input-disable; + output-enable; + }; +}; + &qupv3_0 { status = "okay"; };
@@ -1135,6 +1517,20 @@ wake-n-pins { }; }; + rtmr1_default: rtmr1-reset-n-active-state { + pins = "gpio176"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + rtmr2_default: rtmr2-reset-n-active-state { + pins = "gpio185"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + tpad_default: tpad-default-state { pins = "gpio3"; function = "gpio";
@@ -1156,6 +1552,48 @@ reset-n-pins { }; }; + usb1_pwr_1p15_reg_en: usb1-pwr-1p15-reg-en-state { + pins = "gpio188"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + usb1_pwr_1p8_reg_en: usb1-pwr-1p8-reg-en-state { + pins = "gpio175"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + usb1_pwr_3p3_reg_en: usb1-pwr-3p3-reg-en-state { + pins = "gpio186"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + usb2_pwr_1p15_reg_en: usb2-pwr-1p15-reg-en-state { + pins = "gpio189"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + usb2_pwr_1p8_reg_en: usb2-pwr-1p8-reg-en-state { + pins = "gpio126"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + usb2_pwr_3p3_reg_en: usb2-pwr-3p3-reg-en-state { + pins = "gpio187"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + wcd_default: wcd-reset-n-active-state { pins = "gpio191"; function = "gpio";
@@ -1202,7 +1640,7 @@ &usb_1_ss0_dwc3_hs { }; &usb_1_ss0_qmpphy_out { - remote-endpoint = <&pmic_glink_ss0_ss_in>; + remote-endpoint = <&retimer_ss0_ss_in>; }; &usb_1_ss1_hsphy {
@@ -1230,7 +1668,7 @@ &usb_1_ss1_dwc3_hs { }; &usb_1_ss1_qmpphy_out { - remote-endpoint = <&pmic_glink_ss1_ss_in>; + remote-endpoint = <&retimer_ss1_ss_in>; }; &usb_1_ss2_hsphy {
@@ -1258,5 +1696,5 @@ &usb_1_ss2_dwc3_hs { }; &usb_1_ss2_qmpphy_out { - remote-endpoint = <&pmic_glink_ss2_ss_in>; + remote-endpoint = <&retimer_ss2_ss_in>; };
Signature · 1 line
2.34.1
PATCH v5 4/6 arm64: dts: qcom: x1e80100-crd: Enable external DisplayPort support
In reply to Abel VesaThe X Elite CRD provides external DisplayPort on all 3 USB Type-C ports. Each one of this ports is connected to a dedicated DisplayPort controller.
Due to support missing in the USB/DisplayPort combo PHY driver, the external DisplayPort is limited to 2 lanes.
So enable all 3 remaining DisplayPort controllers and limit their data lanes number to 2.
--- arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/arm64/boot/dts/qcom/x1e80100-crd.dts +24 -0
@@ -1125,6 +1125,30 @@ &mdss { status = "okay"; }; +&mdss_dp0 { + status = "okay"; +}; + +&mdss_dp0_out { + data-lanes = <0 1>; +}; + +&mdss_dp1 { + status = "okay"; +}; + +&mdss_dp1_out { + data-lanes = <0 1>; +}; + +&mdss_dp2 { + status = "okay"; +}; + +&mdss_dp2_out { + data-lanes = <0 1>; +}; + &mdss_dp3 { compatible = "qcom,x1e80100-dp"; /delete-property/ #sound-dai-cells;
Signature · 1 line
2.34.1
Re: [PATCH v5 4/6] arm64: dts: qcom: x1e80100-crd: Enable external DisplayPort support
Quoted 11 lines · Abel Vesa
The X Elite CRD provides external DisplayPort on all 3 USB Type-C ports. Each one of this ports is connected to a dedicated DisplayPort controller.
Due to support missing in the USB/DisplayPort combo PHY driver, the external DisplayPort is limited to 2 lanes.
So enable all 3 remaining DisplayPort controllers and limit their data lanes number to 2.
Signed-off-by Abel Vesa <[email protected]>
Please do not merge this specific patch.
It is provided just for context and testing purposes.
See the cover note for more details.
Quoted 43 lines
--- arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)arch/arm64/boot/dts/qcom/x1e80100-crd.dts +24
-0@@ -1125,6 +1125,30 @@ &mdss { status = "okay"; }; +&mdss_dp0 { + status = "okay"; +}; + +&mdss_dp0_out { + data-lanes = <0 1>; +}; + +&mdss_dp1 { + status = "okay"; +}; + +&mdss_dp1_out { + data-lanes = <0 1>; +}; + +&mdss_dp2 { + status = "okay"; +}; + +&mdss_dp2_out { + data-lanes = <0 1>; +}; + &mdss_dp3 { compatible = "qcom,x1e80100-dp"; /delete-property/ #sound-dai-cells;Signature · 2 lines
-- 2.34.1
Greg Kroah-Hartman
maintainerRe: [PATCH v5 4/6] arm64: dts: qcom: x1e80100-crd: Enable external DisplayPort support
Quoted 8 lines · Abel Vesa
Quoted 7 lines · Abel Vesa
The X Elite CRD provides external DisplayPort on all 3 USB Type-C ports. Each one of this ports is connected to a dedicated DisplayPort controller.
Due to support missing in the USB/DisplayPort combo PHY driver, the external DisplayPort is limited to 2 lanes.
Quoted 6 lines
Quoted 4 lines
So enable all 3 remaining DisplayPort controllers and limit their data lanes number to 2.
Signed-off-by Abel Vesa <[email protected]>Please do not merge this specific patch.
Please do not mix patches that should, and should not, be applied in the same series as that plays havoc with our tools that want to take a whole series at once. Stuff like this just makes me delete the whole series from my review queue, and if you got sent something like this, I imagine you would do the same :(
thanks,
greg k-h
Re: [PATCH v5 4/6] arm64: dts: qcom: x1e80100-crd: Enable external DisplayPort support
Quoted 14 lines · Greg Kroah-Hartman
Quoted 13 lines · Abel Vesa
Quoted 11 lines · Abel Vesa
The X Elite CRD provides external DisplayPort on all 3 USB Type-C ports. Each one of this ports is connected to a dedicated DisplayPort controller.
Due to support missing in the USB/DisplayPort combo PHY driver, the external DisplayPort is limited to 2 lanes.
So enable all 3 remaining DisplayPort controllers and limit their data lanes number to 2.
Signed-off-by Abel Vesa <[email protected]>
Quoted 7 lines
Quoted 1 line
Please do not merge this specific patch.
Please do not mix patches that should, and should not, be applied in the same series as that plays havoc with our tools that want to take a whole series at once. Stuff like this just makes me delete the whole series from my review queue, and if you got sent something like this, I imagine you would do the same :(
Sorry about that and for the late reply.
Will send the patches that are for testing purposes only as a separate patchset.
Quoted 4 lines
thanks,
greg k-h
Thanks for reviewing,
Abel
PATCH v5 5/6 arm64: dts: qcom: x1e80100-t14s: Describe the Parade PS8830 retimers
In reply to Abel VesaThe Lenovo ThinkPad T14s Gen6 laptop comes with 3 Parade PS8830 retimers, one for each Type-C port. These handle the orientation and altmode switching and are controlled over I2C. In the connection chain, they sit between the USB/DisplayPort combo PHY and the Type-C connector.
Describe the retimers and all gpio controlled voltage regulators used by each retimer. Also, modify the pmic glink graph to include the retimers in between the SuperSpeed/Sideband in endpoints and the QMP PHY out endpoints.
--- .../dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts | 305 ++++++++++++++++++++- 1 file changed, 301 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts +301 -4
@@ -66,7 +66,15 @@ port@1 { reg = <1>; pmic_glink_ss0_ss_in: endpoint { - remote-endpoint = <&usb_1_ss0_qmpphy_out>; + remote-endpoint = <&retimer_ss0_ss_out>; + }; + }; + + port@2 { + reg = <2>; + + pmic_glink_ss0_con_sbu_in: endpoint { + remote-endpoint = <&retimer_ss0_con_sbu_out>; }; }; };
@@ -95,7 +103,15 @@ port@1 { reg = <1>; pmic_glink_ss1_ss_in: endpoint { - remote-endpoint = <&usb_1_ss1_qmpphy_out>; + remote-endpoint = <&retimer_ss1_ss_out>; + }; + }; + + port@2 { + reg = <2>; + + pmic_glink_ss1_con_sbu_in: endpoint { + remote-endpoint = <&retimer_ss1_con_sbu_out>; }; }; };
@@ -143,6 +159,102 @@ vreg_nvme: regulator-nvme { regulator-boot-on; }; + vreg_rtmr0_1p15: regulator-rtmr0-1p15 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR0_1P15"; + regulator-min-microvolt = <1150000>; + regulator-max-microvolt = <1150000>; + + gpio = <&pmc8380_5_gpios 8 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb0_pwr_1p15_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_rtmr0_1p8: regulator-rtmr0-1p8 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR0_1P8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + gpio = <&pm8550ve_9_gpios 8 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb0_1p8_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_rtmr0_3p3: regulator-rtmr0-3p3 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR0_3P3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + gpio = <&pm8550_gpios 11 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb0_3p3_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_rtmr1_1p15: regulator-rtmr1-1p15 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR1_1P15"; + regulator-min-microvolt = <1150000>; + regulator-max-microvolt = <1150000>; + + gpio = <&tlmm 188 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb1_pwr_1p15_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_rtmr1_1p8: regulator-rtmr1-1p8 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR1_1P8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + + gpio = <&tlmm 175 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb1_pwr_1p8_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + + vreg_rtmr1_3p3: regulator-rtmr1-3p3 { + compatible = "regulator-fixed"; + + regulator-name = "VREG_RTMR1_3P3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + + gpio = <&tlmm 186 GPIO_ACTIVE_HIGH>; + enable-active-high; + + pinctrl-0 = <&usb1_pwr_3p3_reg_en>; + pinctrl-names = "default"; + + regulator-boot-on; + }; + vph_pwr: regulator-vph-pwr { compatible = "regulator-fixed";
@@ -495,6 +607,121 @@ keyboard@3a { }; }; +&i2c3 { + clock-frequency = <400000>; + + status = "okay"; + + typec-mux@8 { + compatible = "parade,ps8830"; + reg = <0x08>; + + clocks = <&rpmhcc RPMH_RF_CLK3>; + + vdd-supply = <&vreg_rtmr0_1p15>; + vdd33-supply = <&vreg_rtmr0_3p3>; + vdd33-cap-supply = <&vreg_rtmr0_3p3>; + vddar-supply = <&vreg_rtmr0_1p15>; + vddat-supply = <&vreg_rtmr0_1p15>; + vddio-supply = <&vreg_rtmr0_1p8>; + + reset-gpios = <&pm8550_gpios 10 GPIO_ACTIVE_LOW>; + + pinctrl-0 = <&rtmr0_default>; + pinctrl-names = "default"; + + orientation-switch; + retimer-switch; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + retimer_ss0_ss_out: endpoint { + remote-endpoint = <&pmic_glink_ss0_ss_in>; + }; + }; + + port@1 { + reg = <1>; + + retimer_ss0_ss_in: endpoint { + remote-endpoint = <&usb_1_ss0_qmpphy_out>; + }; + }; + + port@2 { + reg = <2>; + + retimer_ss0_con_sbu_out: endpoint { + remote-endpoint = <&pmic_glink_ss0_con_sbu_in>; + }; + }; + }; + }; +}; + +&i2c7 { + clock-frequency = <400000>; + + status = "okay"; + + typec-mux@8 { + compatible = "parade,ps8830"; + reg = <0x8>; + + clocks = <&rpmhcc RPMH_RF_CLK4>; + + vdd-supply = <&vreg_rtmr1_1p15>; + vdd33-supply = <&vreg_rtmr1_3p3>; + vdd33-cap-supply = <&vreg_rtmr1_3p3>; + vddar-supply = <&vreg_rtmr1_1p15>; + vddat-supply = <&vreg_rtmr1_1p15>; + vddio-supply = <&vreg_rtmr1_1p8>; + + reset-gpios = <&tlmm 176 GPIO_ACTIVE_LOW>; + + pinctrl-0 = <&rtmr1_default>; + pinctrl-names = "default"; + + retimer-switch; + orientation-switch; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + retimer_ss1_ss_out: endpoint { + remote-endpoint = <&pmic_glink_ss1_ss_in>; + }; + }; + + port@1 { + reg = <1>; + + retimer_ss1_ss_in: endpoint { + remote-endpoint = <&usb_1_ss1_qmpphy_out>; + }; + }; + + port@2 { + reg = <2>; + + retimer_ss1_con_sbu_out: endpoint { + remote-endpoint = <&pmic_glink_ss1_con_sbu_in>; + }; + }; + + }; + }; +}; + &i2c8 { clock-frequency = <400000>;
@@ -599,6 +826,37 @@ &pcie6a_phy { status = "okay"; }; +&pm8550_gpios { + rtmr0_default: rtmr0-reset-n-active-state { + pins = "gpio10"; + function = "normal"; + power-source = <1>; /* 1.8V */ + bias-disable; + input-disable; + output-enable; + }; + + usb0_3p3_reg_en: usb0-3p3-reg-en-state { + pins = "gpio11"; + function = "normal"; + power-source = <1>; /* 1.8V */ + bias-disable; + input-disable; + output-enable; + }; +}; + +&pm8550ve_9_gpios { + usb0_1p8_reg_en: usb0-1p8-reg-en-state { + pins = "gpio8"; + function = "normal"; + power-source = <1>; /* 1.8V */ + bias-disable; + input-disable; + output-enable; + }; +}; + &pmc8380_3_gpios { edp_bl_en: edp-bl-en-state { pins = "gpio4";
@@ -609,6 +867,17 @@ edp_bl_en: edp-bl-en-state { }; }; +&pmc8380_5_gpios { + usb0_pwr_1p15_reg_en: usb0-pwr-1p15-reg-en-state { + pins = "gpio8"; + function = "normal"; + power-source = <1>; /* 1.8V */ + bias-disable; + input-disable; + output-enable; + }; +}; + &qupv3_0 { status = "okay"; };
@@ -744,6 +1013,34 @@ wake-n-pins { }; }; + rtmr1_default: rtmr1-reset-n-active-state { + pins = "gpio176"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + usb1_pwr_1p15_reg_en: usb1-pwr-1p15-reg-en-state { + pins = "gpio188"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + usb1_pwr_1p8_reg_en: usb1-pwr-1p8-reg-en-state { + pins = "gpio175"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + + usb1_pwr_3p3_reg_en: usb1-pwr-3p3-reg-en-state { + pins = "gpio186"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + wcd_default: wcd-reset-n-active-state { pins = "gpio191"; function = "gpio";
@@ -778,7 +1075,7 @@ &usb_1_ss0_dwc3_hs { }; &usb_1_ss0_qmpphy_out { - remote-endpoint = <&pmic_glink_ss0_ss_in>; + remote-endpoint = <&retimer_ss0_ss_in>; }; &usb_1_ss1_hsphy {
@@ -806,5 +1103,5 @@ &usb_1_ss1_dwc3_hs { }; &usb_1_ss1_qmpphy_out { - remote-endpoint = <&pmic_glink_ss1_ss_in>; + remote-endpoint = <&retimer_ss1_ss_in>; };
Signature · 1 line
2.34.1
PATCH v5 6/6 arm64: dts: qcom: x1e80100-t14s: Enable external DisplayPort support
In reply to Abel VesaThe Lenovo ThinkPad T14s Gen6 provides external DisplayPort on all 2 USB Type-C ports. Each one of this ports is connected to a dedicated DisplayPort controller.
Due to support missing in the USB/DisplayPort combo PHY driver, the external DisplayPort is limited to 2 lanes.
So enable the first and second DisplayPort controllers and limit their data lanes number to 2.
--- .../boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts +16 -0
@@ -746,6 +746,22 @@ &mdss { status = "okay"; }; +&mdss_dp0 { + status = "okay"; +}; + +&mdss_dp0_out { + data-lanes = <0 1>; +}; + +&mdss_dp1 { + status = "okay"; +}; + +&mdss_dp1_out { + data-lanes = <0 1>; +}; + &mdss_dp3 { compatible = "qcom,x1e80100-dp"; /delete-property/ #sound-dai-cells;
Signature · 1 line
2.34.1
Re: [PATCH v5 6/6] arm64: dts: qcom: x1e80100-t14s: Enable external DisplayPort support
Quoted 11 lines · Abel Vesa
The Lenovo ThinkPad T14s Gen6 provides external DisplayPort on all 2 USB Type-C ports. Each one of this ports is connected to a dedicated DisplayPort controller.
Due to support missing in the USB/DisplayPort combo PHY driver, the external DisplayPort is limited to 2 lanes.
So enable the first and second DisplayPort controllers and limit their data lanes number to 2.
Signed-off-by Abel Vesa <[email protected]>
Please do not merge this specific patch.
It is provided just for context and testing purposes.
See the cover note for more details.
Quoted 35 lines
--- .../boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts +16
-0@@ -746,6 +746,22 @@ &mdss { status = "okay"; }; +&mdss_dp0 { + status = "okay"; +}; + +&mdss_dp0_out { + data-lanes = <0 1>; +}; + +&mdss_dp1 { + status = "okay"; +}; + +&mdss_dp1_out { + data-lanes = <0 1>; +}; + &mdss_dp3 { compatible = "qcom,x1e80100-dp"; /delete-property/ #sound-dai-cells;Signature · 2 lines
-- 2.34.1
Rob Herring (Arm)
maintainerQuoted 116 lines · Abel Vesa
The Parade PS8830 is a Type-C multi-protocol retimer that is controlled via I2C. It provides altmode and orientation handling and usually sits between the Type-C port and the PHY.
It is currently used alongside Qualcomm Snapdragon X Elite SoCs on quite a few laptops already.
This new driver adds support for the following 3 modes:
- DP 4lanes (pin assignments C and E)
- DP 2lanes + USB3 (pin assignment D)
- USB3This retimer is a LTTPR (Link-Training Tunable PHY Repeater) which means it can support link training from source to itself. This means that the DP driver needs to be aware of the repeater presence and to handle the link training accordingly. This is currently missing from msm dp driver, but there is already a patchset [1] on the list that adds it. Once done, full external DP will be working on all X1E laptops that make use of this retimer.
NOTE: Currently, due to both LTTPR missing support in msm DP and a reported crash that can happen on DP unplug, the DP DT patches are not supposed to be merged yet. That patch is only shared for testing purposes. Once those 2 issues have been resolved, the MDSS DP 0-2 enablement patch will be respun.
The LTTPR patchset is already on the list:
[1] https://lore.kernel.org/all/20241031-drm-dp-msm-add-lttpr-transparent-mode-set-v1-0-cafbb9855f40@linaro.org/Signed-off-by Abel Vesa <[email protected]>---
Changes in v5:
- Renamed binding schema to be the same as the compatible.
- Dropped the ps8830,boot-on from the schema.
- Added register offsets and bits names to the driver, like Konrad
suggested.
- Reordered the vregs and clocks enabling, as per Johan's request.
- Used thedev_err_probefor regmap init failure and dropped the
multiple regulator disable calls, replacing it with single call to
helper, as Christophe suggested. Also replaceddev_errwith
dev_err_probeontypec_switch_registerandtypec_mux_registerfailure.
- Added some new pinctrl specific properties to all pmic provided
gpios that control retimer vregs.
- Re-ordered alphabetically the retimers default state pinconfs.
- Added the T14s patches with same exact support, as per Johan's
request.
- Link to v4: https://lore.kernel.org/r/[email protected]Changes in v4:
- Renamed the driver and bindings schema to ps883x to allow future
support for the PS8833.
- Dropped the dedicated DT property for keeping the retimers from
resetting on probe, and replaced that with a read to figure out
if it has been already configured or not. This involves leaving the
reset gpio as-is on probe if the retimer has been already configured.
- Replaced thefwnode_typec_switch_get()call withtypec_switch_get()
- Replaced thefwnode_typec_mux_get()call withtypec_mux_get()
- Dropped the clock name, as there is only one clock. As per Bjorn's suggestion.
- Dropped regcache as it seems it is not needed.
- Re-worded all commit messages to explain better the problem and the
proposed changes.
- Link to v3: https://lore.kernel.org/r/[email protected]Changes in v3:
- Reworked the schema binding by using theusb/usb-switch.yamldefined
port graph and properties. Addressed all comments from Johan and
Dmitry.
- Dropped the manual caching of the config values on regmap write in the driver.
- Reordered the DP pin assignment states within the switch clause, as
Dmitry suggested.
- Added SVID check to not allow any altmode other than DP.
- Added DT patches (retimer for USB orientation handling and DP
enablement). Did this in order to offer a full picture of how it all
fits together.
- Split the DP enablement in DT in a separate patchset so the USB
handling can be merged separately.
- Added ps8830,boot-on to let the driver know it is supposed to skip
resetting the retimer on driver probe, as the bootloader might already
let it in a pre-configured state.
- Marked all retimer voltage regulators as boot-on since we want to
maintain the state for coldplug orientation.
- Added pinconf for all retimer0 gpios.
- Didn't pick up Konrad's T-b tags and Krzysztof's R-b tag as the rework
is quite extensive. Especially because of the ps8830,boot-on and what
it does.
- Link to v2: https://lore.kernel.org/r/[email protected]Changes in v2:
- Addressed all comments from Johan and Konrad.
- Reworked the handling of the vregs so it would be more cleaner.
Dropped the usage of bulk regulators API and handled them separately.
Also discribed all regulators according to data sheet.
- Added all delays according to data sheet.
- Fixed coldplug (on boot) orientation detection.
- Didn't pick Krzysztof's R-b tag because the bindings changed w.r.t
supplies.
- Link to v1: https://lore.kernel.org/r/[email protected]---
Abel Vesa (6):
dt-bindings: usb: Add Parade PS8830 Type-C retimer bindings
usb: typec: Add support for Parade PS8830 Type-C Retimer
arm64: dts: qcom: x1e80100-crd: Describe the Parade PS8830 retimers
arm64: dts: qcom: x1e80100-crd: Enable external DisplayPort support
arm64: dts: qcom: x1e80100-t14s: Describe the Parade PS8830 retimers
arm64: dts: qcom: x1e80100-t14s: Enable external DisplayPort support.../devicetree/bindings/usb/parade,ps8830.yaml | 119 ++++++ .../dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts | 321 +++++++++++++- arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 474 ++++++++++++++++++++- drivers/usb/typec/mux/Kconfig | 10 + drivers/usb/typec/mux/Makefile | 1 + drivers/usb/typec/mux/ps883x.c | 437 +++++++++++++++++++ 6 files changed, 1352 insertions(+), 10 deletions(-)
Quoted 10 lines
---
base-commit:28955f4fa2823e39f1ecfb3a37a364563527afbc
change-id: 20240521-x1e80100-ps8830-d5ccca95b557Best regards,
--
Abel Vesa <[email protected]>
My bot found new DTB warnings on the .dts files added or changed in this series.
Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.
If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:
pip3 install dtschema --upgrade
New warnings running 'make CHECK_DTBS=y qcom/x1e78100-lenovo-thinkpad-t14s.dtb qcom/x1e80100-crd.dtb' for [email protected]:
arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dtb: usb@a2f8800: interrupt-names: ['pwr_event', 'dp_hs_phy_irq', 'dm_hs_phy_irq'] is too short
from schema $id: http://devicetree.org/schemas/usb/qcom,dwc3.yaml#arch/arm64/boot/dts/qcom/x1e80100-crd.dtb: usb@a2f8800: interrupt-names: ['pwr_event', 'dp_hs_phy_irq', 'dm_hs_phy_irq'] is too short
from schema $id: http://devicetree.org/schemas/usb/qcom,dwc3.yaml#