Re: [RFC PATCH 1/2] usb: typec: hd3ss3220: Add wakeup support from system suspend

From: Dmitry Baryshkov

Date: Tue Feb 24 2026 - 02:51:06 EST


On Mon, Feb 16, 2026 at 12:03:24AM +0530, Swati Agarwal wrote:
> The HD3SS3220's interrupt is disabled during system suspend, so a USB‑C
> cable connect/attach event cannot wake the system. This prevents resume
> from low‑power modes when the port controller is expected to act as a
> wakeup source.
>
> Add wakeup support by:
>
> - Initialize the device as wakeup‑capable.
> - Enable the HD3SS3220 IRQ as a wakeup interrupt.
> - Add suspend/resume callbacks to enable or disable the IRQ for wakeup
> depending on the device's wakeup configuration.
>
> With this, USB‑C cable insertion correctly wakes the system from suspend.
>
> Signed-off-by: Swati Agarwal <swati.agarwal@xxxxxxxxxxxxxxxx>
> ---
> drivers/usb/typec/hd3ss3220.c | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/drivers/usb/typec/hd3ss3220.c b/drivers/usb/typec/hd3ss3220.c
> index 3e39b800e6b5..b56df9349f89 100644
> --- a/drivers/usb/typec/hd3ss3220.c
> +++ b/drivers/usb/typec/hd3ss3220.c
> @@ -501,6 +501,11 @@ static int hd3ss3220_probe(struct i2c_client *client)
> if (hd3ss3220->poll)
> schedule_delayed_work(&hd3ss3220->output_poll_work, HZ);
>
> + if (client->irq && device_property_read_bool(hd3ss3220->dev, "wakeup-source")) {
> + device_init_wakeup(&client->dev, true);
> + enable_irq_wake(client->irq);

I think this call must be dropped.

> + }
> +
> dev_info(&client->dev, "probed revision=0x%x\n", ret);
>
> return 0;
> @@ -525,6 +530,35 @@ static void hd3ss3220_remove(struct i2c_client *client)
> usb_role_switch_put(hd3ss3220->role_sw);
> }
>
> +static int __maybe_unused hd3ss3220_suspend(struct device *dev)
> +{
> + struct i2c_client *client = to_i2c_client(dev);
> +
> + if (device_may_wakeup(dev))
> + enable_irq_wake(client->irq);
> + else
> + disable_irq(client->irq);
> +
> + return 0;
> +}
> +
> +static int __maybe_unused hd3ss3220_resume(struct device *dev)
> +{
> + struct i2c_client *client = to_i2c_client(dev);
> +
> + if (device_may_wakeup(dev))
> + disable_irq_wake(client->irq);
> + else
> + enable_irq(client->irq);
> +
> + return 0;
> +}
> +
> +static const struct dev_pm_ops hd3ss3220_pm_ops = {
> + .suspend = hd3ss3220_suspend,
> + .resume = hd3ss3220_resume,
> +};
> +
> static const struct of_device_id dev_ids[] = {
> { .compatible = "ti,hd3ss3220"},
> {}
> @@ -535,6 +569,7 @@ static struct i2c_driver hd3ss3220_driver = {
> .driver = {
> .name = "hd3ss3220",
> .of_match_table = dev_ids,
> + .pm = &hd3ss3220_pm_ops,
> },
> .probe = hd3ss3220_probe,
> .remove = hd3ss3220_remove,
> --
> 2.34.1
>

--
With best wishes
Dmitry