Re: [PATCH v7 2/2] usb: typec: hd3ss3220: Enable VBUS based on ID pin state

From: Andy Shevchenko

Date: Wed Nov 26 2025 - 07:27:14 EST


On Tue, Nov 11, 2025 at 12:50:25PM +0530, Krishna Kurapati wrote:
> There is a ID pin present on HD3SS3220 controller that can be routed
> to SoC. As per the datasheet:
>
> "Upon detecting a UFP device, HD3SS3220 will keep ID pin high if VBUS is
> not at VSafe0V. Once VBUS is at VSafe0V, the HD3SS3220 will assert ID pin
> low. This is done to enforce Type-C requirement that VBUS must be at
> VSafe0V before re-enabling VBUS"
>
> Add support to read the ID pin state and enable VBUS accordingly.

...

> + if (hd3ss3220->vbus) {
> + hd3ss3220->id_gpiod = devm_gpiod_get_optional(hd3ss3220->dev,
> + "id",
> + GPIOD_IN);

Can be also

ret = PTR_ERR_OR_ZERO(hd3ss3220->id_gpiod);
if (IS_ERR(hd3ss3220->id_gpiod))
goto err_put_fwnode;

> + if (IS_ERR(hd3ss3220->id_gpiod)) {

> + if (IS_ERR(hd3ss3220->id_gpiod)) {
> + ret = PTR_ERR(hd3ss3220->id_gpiod);
> + goto err_put_fwnode;
> + }
> + }

...

> + ret = devm_request_threaded_irq(hd3ss3220->dev,
> + hd3ss3220->id_irq, NULL,
> + hd3ss3220_id_isr,
> + IRQF_TRIGGER_RISING |
> + IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> + dev_name(hd3ss3220->dev), hd3ss3220);
> + if (ret < 0) {
> + dev_err(hd3ss3220->dev, "failed to get ID irq: %d\n", ret);

The above call already prints an error message, no need to repeat it here.

> + goto err_put_fwnode;
> + }

Since the patch is already applied, please send a followup for the second one
(the first one is up to you, just a hint for the future code contributions).

--
With Best Regards,
Andy Shevchenko