Skip to content

Commit 779771b

Browse files
committed
FROMLIST: usb: typec: hd3ss3220: Add wakeup support from system suspend
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. Link: https://lore.kernel.org/all/20260215183325.3836178-2-swati.agarwal@oss.qualcomm.com/ Signed-off-by: Swati Agarwal <swati.agarwal@oss.qualcomm.com>
1 parent 36fccfd commit 779771b

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

drivers/usb/typec/hd3ss3220.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,11 @@ static int hd3ss3220_probe(struct i2c_client *client)
501501
if (hd3ss3220->poll)
502502
schedule_delayed_work(&hd3ss3220->output_poll_work, HZ);
503503

504+
if (client->irq && device_property_read_bool(hd3ss3220->dev, "wakeup-source")) {
505+
device_init_wakeup(&client->dev, true);
506+
enable_irq_wake(client->irq);
507+
}
508+
504509
dev_info(&client->dev, "probed revision=0x%x\n", ret);
505510

506511
return 0;
@@ -525,6 +530,35 @@ static void hd3ss3220_remove(struct i2c_client *client)
525530
usb_role_switch_put(hd3ss3220->role_sw);
526531
}
527532

533+
static int __maybe_unused hd3ss3220_suspend(struct device *dev)
534+
{
535+
struct i2c_client *client = to_i2c_client(dev);
536+
537+
if (device_may_wakeup(dev))
538+
enable_irq_wake(client->irq);
539+
else
540+
disable_irq(client->irq);
541+
542+
return 0;
543+
}
544+
545+
static int __maybe_unused hd3ss3220_resume(struct device *dev)
546+
{
547+
struct i2c_client *client = to_i2c_client(dev);
548+
549+
if (device_may_wakeup(dev))
550+
disable_irq_wake(client->irq);
551+
else
552+
enable_irq(client->irq);
553+
554+
return 0;
555+
}
556+
557+
static const struct dev_pm_ops hd3ss3220_pm_ops = {
558+
.suspend = hd3ss3220_suspend,
559+
.resume = hd3ss3220_resume,
560+
};
561+
528562
static const struct of_device_id dev_ids[] = {
529563
{ .compatible = "ti,hd3ss3220"},
530564
{}
@@ -535,6 +569,7 @@ static struct i2c_driver hd3ss3220_driver = {
535569
.driver = {
536570
.name = "hd3ss3220",
537571
.of_match_table = dev_ids,
572+
.pm = &hd3ss3220_pm_ops,
538573
},
539574
.probe = hd3ss3220_probe,
540575
.remove = hd3ss3220_remove,

0 commit comments

Comments
 (0)