The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 0/2] usb: typec: hd3ss3220: Add support for supply regulators
@ 2026-08-21 16:16 Alexey Charkov
  2026-08-21 16:16 ` [PATCH 1/2] dt-bindings: usb: ti,hd3ss3220: " Alexey Charkov
  2026-08-21 16:16 ` [PATCH 2/2] usb: typec: hd3ss3220: " Alexey Charkov
  0 siblings, 2 replies; 7+ messages in thread
From: Alexey Charkov @ 2026-08-21 16:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Biju Das, Heikki Krogerus
  Cc: linux-usb, devicetree, linux-kernel, Alexey Charkov

The TI HD3SS3220 Type-C muxer has two power supply pins, VCC33 and VDD5.
Add support for both in the DT binding and the driver to enable their
correct power-up sequencing.

Signed-off-by: Alexey Charkov <alchark@flipper.net>
---
Alexey Charkov (2):
      dt-bindings: usb: ti,hd3ss3220: Add support for supply regulators
      usb: typec: hd3ss3220: Add support for supply regulators

 .../devicetree/bindings/usb/ti,hd3ss3220.yaml      | 11 ++++++++
 drivers/usb/typec/hd3ss3220.c                      | 32 ++++++++++++++++++++++
 2 files changed, 43 insertions(+)
---
base-commit: 903c1cf6dff9964e71eda98a39e2e5d442050472
change-id: 20260821-hd3ss3220-regulators-7777cdb50fb3

Best regards,
--  
Alexey Charkov <alchark@flipper.net>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] dt-bindings: usb: ti,hd3ss3220: Add support for supply regulators
  2026-08-21 16:16 [PATCH 0/2] usb: typec: hd3ss3220: Add support for supply regulators Alexey Charkov
@ 2026-08-21 16:16 ` Alexey Charkov
  2026-08-21 16:37   ` Conor Dooley
  2026-08-21 16:16 ` [PATCH 2/2] usb: typec: hd3ss3220: " Alexey Charkov
  1 sibling, 1 reply; 7+ messages in thread
From: Alexey Charkov @ 2026-08-21 16:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Biju Das, Heikki Krogerus
  Cc: linux-usb, devicetree, linux-kernel, Alexey Charkov

HD3SS3220 requires two supply regulators to operate. It also strictly
requires that 5V is present before 3.3V, otherwise it gets backpowered
in a non-functional state through the 3.3V rail and kills the I2C bus.

Add both supply regulators to enable their explicit description in board
device trees.

Signed-off-by: Alexey Charkov <alchark@flipper.net>
---
 Documentation/devicetree/bindings/usb/ti,hd3ss3220.yaml | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ti,hd3ss3220.yaml b/Documentation/devicetree/bindings/usb/ti,hd3ss3220.yaml
index 06099e93c6c3..654a982666dd 100644
--- a/Documentation/devicetree/bindings/usb/ti,hd3ss3220.yaml
+++ b/Documentation/devicetree/bindings/usb/ti,hd3ss3220.yaml
@@ -25,6 +25,15 @@ properties:
   interrupts:
     maxItems: 1
 
+  vcc33-supply:
+    description: 3.3V supply (VCC33 pin), powering the SuperSpeed 2:1 MUX.
+
+  vdd5-supply:
+    description:
+      5V supply (VDD5 pin), powering the CC controller and sourcing VCONN.
+      VDD5 has to be stable for at least tVDD5V_PG (2ms) before VCC33 starts
+      ramping up, unless ENn_CC is held high while both rails ramp up.
+
   id-gpios:
     description:
       An input gpio for USB ID pin. Upon detecting a UFP device, HD3SS3220
@@ -68,6 +77,8 @@ examples:
             reg = <0x47>;
             interrupt-parent = <&gpio6>;
             interrupts = <3>;
+            vcc33-supply = <&vcc3v3_control>;
+            vdd5-supply = <&vcc5v0_device_s0>;
 
             ports {
                 #address-cells = <1>;

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] usb: typec: hd3ss3220: Add support for supply regulators
  2026-08-21 16:16 [PATCH 0/2] usb: typec: hd3ss3220: Add support for supply regulators Alexey Charkov
  2026-08-21 16:16 ` [PATCH 1/2] dt-bindings: usb: ti,hd3ss3220: " Alexey Charkov
@ 2026-08-21 16:16 ` Alexey Charkov
  2026-08-21 17:02   ` Biju Das
  2026-08-24 12:56   ` Heikki Krogerus
  1 sibling, 2 replies; 7+ messages in thread
From: Alexey Charkov @ 2026-08-21 16:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Biju Das, Heikki Krogerus
  Cc: linux-usb, devicetree, linux-kernel, Alexey Charkov

HD3SS3220 requires VDD5 input to be present 2ms before VCC33 is applied,
or else it gets backpowered via the 3.3V rail in a non-functional state
and wedges the I2C bus, bringing down all devices on it.

Enable both regulators in the datasheet prescribed sequence if provided.

Signed-off-by: Alexey Charkov <alchark@flipper.net>
---
 drivers/usb/typec/hd3ss3220.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c
index d0de5a2488f9..b53455abc048 100644
--- a/drivers/usb/typec/hd3ss3220.c
+++ b/drivers/usb/typec/hd3ss3220.c
@@ -49,6 +49,9 @@
 #define HD3SS3220_REG_GEN_CTRL_MODE_SELECT_UFP		BIT(4)
 #define HD3SS3220_REG_GEN_CTRL_MODE_SELECT_DRP		(BIT(5) | BIT(4))
 
+/* Minimum time VDD5 has to be stable before VCC33 starts ramping up */
+#define HD3SS3220_TVDD5V_PG_US				2000
+
 struct hd3ss3220 {
 	struct device *dev;
 	struct regmap *regmap;
@@ -358,6 +361,31 @@ static irqreturn_t hd3ss3220_id_isr(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+/*
+ * Bring both supplies up in the order the datasheet asks for. Powering VCC33
+ * first can back-power the device in a non-functioning state, which grounds
+ * the I2C bus and takes both this device and any others on the same bus down
+ */
+static int hd3ss3220_power_up(struct device *dev)
+{
+	int ret;
+
+	ret = devm_regulator_get_enable(dev, "vdd5");
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to enable VDD5\n");
+
+	/* Nothing to stagger against unless the board describes both rails */
+	if (device_property_present(dev, "vdd5-supply") &&
+	    device_property_present(dev, "vcc33-supply"))
+		fsleep(HD3SS3220_TVDD5V_PG_US);
+
+	ret = devm_regulator_get_enable(dev, "vcc33");
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to enable VCC33\n");
+
+	return 0;
+}
+
 static int hd3ss3220_probe(struct i2c_client *client)
 {
 	struct typec_capability typec_cap = { };
@@ -379,6 +407,10 @@ static int hd3ss3220_probe(struct i2c_client *client)
 	if (IS_ERR(hd3ss3220->regmap))
 		return PTR_ERR(hd3ss3220->regmap);
 
+	ret = hd3ss3220_power_up(hd3ss3220->dev);
+	if (ret)
+		return ret;
+
 	/* For backward compatibility check the connector child node first */
 	connector = device_get_named_child_node(hd3ss3220->dev, "connector");
 	if (connector) {

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dt-bindings: usb: ti,hd3ss3220: Add support for supply regulators
  2026-08-21 16:16 ` [PATCH 1/2] dt-bindings: usb: ti,hd3ss3220: " Alexey Charkov
@ 2026-08-21 16:37   ` Conor Dooley
  0 siblings, 0 replies; 7+ messages in thread
From: Conor Dooley @ 2026-08-21 16:37 UTC (permalink / raw)
  To: Alexey Charkov
  Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Biju Das, Heikki Krogerus, linux-usb, devicetree,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 75 bytes --]

Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 2/2] usb: typec: hd3ss3220: Add support for supply regulators
  2026-08-21 16:16 ` [PATCH 2/2] usb: typec: hd3ss3220: " Alexey Charkov
@ 2026-08-21 17:02   ` Biju Das
  2026-08-21 17:17     ` Alexey Charkov
  2026-08-24 12:56   ` Heikki Krogerus
  1 sibling, 1 reply; 7+ messages in thread
From: Biju Das @ 2026-08-21 17:02 UTC (permalink / raw)
  To: Alexey Charkov, Greg Kroah-Hartman, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Heikki Krogerus
  Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org


Hi Alexey Charkov,

Thanks for the patch.

> -----Original Message-----
> From: Alexey Charkov <alchark@flipper.net>
> Sent: 21 August 2026 17:17
> Subject: [PATCH 2/2] usb: typec: hd3ss3220: Add support for supply regulators
> 
> HD3SS3220 requires VDD5 input to be present 2ms before VCC33 is applied, or else it gets backpowered via
> the 3.3V rail in a non-functional state and wedges the I2C bus, bringing down all devices on it.
> 
> Enable both regulators in the datasheet prescribed sequence if provided.
> 
> Signed-off-by: Alexey Charkov <alchark@flipper.net>
> ---
>  drivers/usb/typec/hd3ss3220.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c index
> d0de5a2488f9..b53455abc048 100644
> --- a/drivers/usb/typec/hd3ss3220.c
> +++ b/drivers/usb/typec/hd3ss3220.c
> @@ -49,6 +49,9 @@
>  #define HD3SS3220_REG_GEN_CTRL_MODE_SELECT_UFP		BIT(4)
>  #define HD3SS3220_REG_GEN_CTRL_MODE_SELECT_DRP		(BIT(5) | BIT(4))
> 
> +/* Minimum time VDD5 has to be stable before VCC33 starts ramping up */
> +#define HD3SS3220_TVDD5V_PG_US				2000
> +
>  struct hd3ss3220 {
>  	struct device *dev;
>  	struct regmap *regmap;
> @@ -358,6 +361,31 @@ static irqreturn_t hd3ss3220_id_isr(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
> 
> +/*
> + * Bring both supplies up in the order the datasheet asks for. Powering
> +VCC33
> + * first can back-power the device in a non-functioning state, which
> +grounds
> + * the I2C bus and takes both this device and any others on the same
> +bus down  */ static int hd3ss3220_power_up(struct device *dev) {
> +	int ret;
> +
> +	ret = devm_regulator_get_enable(dev, "vdd5");

Maybe use optional API as existing dt users don't have this property defined in DT.

> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to enable VDD5\n");
> +
> +	/* Nothing to stagger against unless the board describes both rails */
> +	if (device_property_present(dev, "vdd5-supply") &&
> +	    device_property_present(dev, "vcc33-supply"))
> +		fsleep(HD3SS3220_TVDD5V_PG_US);

No need for fsleep for the consumers that does not have vdd5 and vcc33.

> +
> +	ret = devm_regulator_get_enable(dev, "vcc33");

Same here.

Cheers,
Biju

> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to enable VCC33\n");
> +
> +	return 0;
> +}
> +
>  static int hd3ss3220_probe(struct i2c_client *client)  {
>  	struct typec_capability typec_cap = { }; @@ -379,6 +407,10 @@ static int hd3ss3220_probe(struct
> i2c_client *client)
>  	if (IS_ERR(hd3ss3220->regmap))
>  		return PTR_ERR(hd3ss3220->regmap);
> 
> +	ret = hd3ss3220_power_up(hd3ss3220->dev);
> +	if (ret)
> +		return ret;
> +
>  	/* For backward compatibility check the connector child node first */
>  	connector = device_get_named_child_node(hd3ss3220->dev, "connector");
>  	if (connector) {
> 
> --
> 2.54.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] usb: typec: hd3ss3220: Add support for supply regulators
  2026-08-21 17:02   ` Biju Das
@ 2026-08-21 17:17     ` Alexey Charkov
  0 siblings, 0 replies; 7+ messages in thread
From: Alexey Charkov @ 2026-08-21 17:17 UTC (permalink / raw)
  To: Biju Das
  Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Heikki Krogerus, linux-usb@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Mark Brown

Hi Biju,

On Fri, Aug 21, 2026 at 9:03 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
>
>
> Hi Alexey Charkov,
>
> Thanks for the patch.
>
> > -----Original Message-----
> > From: Alexey Charkov <alchark@flipper.net>
> > Sent: 21 August 2026 17:17
> > Subject: [PATCH 2/2] usb: typec: hd3ss3220: Add support for supply regulators
> >
> > HD3SS3220 requires VDD5 input to be present 2ms before VCC33 is applied, or else it gets backpowered via
> > the 3.3V rail in a non-functional state and wedges the I2C bus, bringing down all devices on it.
> >
> > Enable both regulators in the datasheet prescribed sequence if provided.
> >
> > Signed-off-by: Alexey Charkov <alchark@flipper.net>
> > ---
> >  drivers/usb/typec/hd3ss3220.c | 32 ++++++++++++++++++++++++++++++++
> >  1 file changed, 32 insertions(+)
> >
> > diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c index
> > d0de5a2488f9..b53455abc048 100644
> > --- a/drivers/usb/typec/hd3ss3220.c
> > +++ b/drivers/usb/typec/hd3ss3220.c
> > @@ -49,6 +49,9 @@
> >  #define HD3SS3220_REG_GEN_CTRL_MODE_SELECT_UFP               BIT(4)
> >  #define HD3SS3220_REG_GEN_CTRL_MODE_SELECT_DRP               (BIT(5) | BIT(4))
> >
> > +/* Minimum time VDD5 has to be stable before VCC33 starts ramping up */
> > +#define HD3SS3220_TVDD5V_PG_US                               2000
> > +
> >  struct hd3ss3220 {
> >       struct device *dev;
> >       struct regmap *regmap;
> > @@ -358,6 +361,31 @@ static irqreturn_t hd3ss3220_id_isr(int irq, void *dev_id)
> >       return IRQ_HANDLED;
> >  }
> >
> > +/*
> > + * Bring both supplies up in the order the datasheet asks for. Powering
> > +VCC33
> > + * first can back-power the device in a non-functioning state, which
> > +grounds
> > + * the I2C bus and takes both this device and any others on the same
> > +bus down  */ static int hd3ss3220_power_up(struct device *dev) {
> > +     int ret;
> > +
> > +     ret = devm_regulator_get_enable(dev, "vdd5");
>
> Maybe use optional API as existing dt users don't have this property defined in DT.

The optional API is explicitly for devices that can function without
the respective supply entirely, which is not the case here (both lines
have to be wired for the chip to work). If a board doesn't define this
supply in its DT the "normal" API will auto-assign a dummy regulator
and proceed.

I got called out by Mark once [1] trying to shoehorn the _optional
functions where they don't belong :)

[1] https://lore.kernel.org/all/agUoq2N_nE_Sz0Z_@sirena.co.uk/

> > +     if (ret)
> > +             return dev_err_probe(dev, ret, "failed to enable VDD5\n");
> > +
> > +     /* Nothing to stagger against unless the board describes both rails */
> > +     if (device_property_present(dev, "vdd5-supply") &&
> > +         device_property_present(dev, "vcc33-supply"))
> > +             fsleep(HD3SS3220_TVDD5V_PG_US);
>
> No need for fsleep for the consumers that does not have vdd5 and vcc33.

Correct, hence the conditional.

> > +     ret = devm_regulator_get_enable(dev, "vcc33");
>
> Same here.

Best regards,
Alexey

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] usb: typec: hd3ss3220: Add support for supply regulators
  2026-08-21 16:16 ` [PATCH 2/2] usb: typec: hd3ss3220: " Alexey Charkov
  2026-08-21 17:02   ` Biju Das
@ 2026-08-24 12:56   ` Heikki Krogerus
  1 sibling, 0 replies; 7+ messages in thread
From: Heikki Krogerus @ 2026-08-24 12:56 UTC (permalink / raw)
  To: Alexey Charkov
  Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Biju Das, linux-usb, devicetree, linux-kernel

On Fri, Aug 21, 2026 at 08:16:35PM +0400, Alexey Charkov wrote:
> HD3SS3220 requires VDD5 input to be present 2ms before VCC33 is applied,
> or else it gets backpowered via the 3.3V rail in a non-functional state
> and wedges the I2C bus, bringing down all devices on it.
> 
> Enable both regulators in the datasheet prescribed sequence if provided.
> 
> Signed-off-by: Alexey Charkov <alchark@flipper.net>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/hd3ss3220.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c
> index d0de5a2488f9..b53455abc048 100644
> --- a/drivers/usb/typec/hd3ss3220.c
> +++ b/drivers/usb/typec/hd3ss3220.c
> @@ -49,6 +49,9 @@
>  #define HD3SS3220_REG_GEN_CTRL_MODE_SELECT_UFP		BIT(4)
>  #define HD3SS3220_REG_GEN_CTRL_MODE_SELECT_DRP		(BIT(5) | BIT(4))
>  
> +/* Minimum time VDD5 has to be stable before VCC33 starts ramping up */
> +#define HD3SS3220_TVDD5V_PG_US				2000
> +
>  struct hd3ss3220 {
>  	struct device *dev;
>  	struct regmap *regmap;
> @@ -358,6 +361,31 @@ static irqreturn_t hd3ss3220_id_isr(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> +/*
> + * Bring both supplies up in the order the datasheet asks for. Powering VCC33
> + * first can back-power the device in a non-functioning state, which grounds
> + * the I2C bus and takes both this device and any others on the same bus down
> + */
> +static int hd3ss3220_power_up(struct device *dev)
> +{
> +	int ret;
> +
> +	ret = devm_regulator_get_enable(dev, "vdd5");
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to enable VDD5\n");
> +
> +	/* Nothing to stagger against unless the board describes both rails */
> +	if (device_property_present(dev, "vdd5-supply") &&
> +	    device_property_present(dev, "vcc33-supply"))
> +		fsleep(HD3SS3220_TVDD5V_PG_US);
> +
> +	ret = devm_regulator_get_enable(dev, "vcc33");
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to enable VCC33\n");
> +
> +	return 0;
> +}
> +
>  static int hd3ss3220_probe(struct i2c_client *client)
>  {
>  	struct typec_capability typec_cap = { };
> @@ -379,6 +407,10 @@ static int hd3ss3220_probe(struct i2c_client *client)
>  	if (IS_ERR(hd3ss3220->regmap))
>  		return PTR_ERR(hd3ss3220->regmap);
>  
> +	ret = hd3ss3220_power_up(hd3ss3220->dev);
> +	if (ret)
> +		return ret;
> +
>  	/* For backward compatibility check the connector child node first */
>  	connector = device_get_named_child_node(hd3ss3220->dev, "connector");
>  	if (connector) {
> 
> -- 
> 2.54.0

-- 
heikki

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-08-24 12:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21 16:16 [PATCH 0/2] usb: typec: hd3ss3220: Add support for supply regulators Alexey Charkov
2026-08-21 16:16 ` [PATCH 1/2] dt-bindings: usb: ti,hd3ss3220: " Alexey Charkov
2026-08-21 16:37   ` Conor Dooley
2026-08-21 16:16 ` [PATCH 2/2] usb: typec: hd3ss3220: " Alexey Charkov
2026-08-21 17:02   ` Biju Das
2026-08-21 17:17     ` Alexey Charkov
2026-08-24 12:56   ` Heikki Krogerus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox