The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Alexey Charkov <alchark@flipper.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Biju Das <biju.das.jz@bp.renesas.com>,
	linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] usb: typec: hd3ss3220: Add support for supply regulators
Date: Mon, 24 Aug 2026 14:56:54 +0200	[thread overview]
Message-ID: <aow_lhZd3etwHVzl@black.igk.intel.com> (raw)
In-Reply-To: <20260821-hd3ss3220-regulators-v1-2-405e5c4fb306@flipper.net>

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

      parent reply	other threads:[~2026-08-24 12:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aow_lhZd3etwHVzl@black.igk.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=alchark@flipper.net \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox