public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] Add wakeup support from system suspend
@ 2026-02-15 18:33 Swati Agarwal
  2026-02-15 18:33 ` [RFC PATCH 1/2] usb: typec: hd3ss3220: " Swati Agarwal
  2026-02-15 18:33 ` [RFC PATCH 2/2] arm64: dts: qcom: lemans-evk: Enable wakeup for primary USB controller Swati Agarwal
  0 siblings, 2 replies; 7+ messages in thread
From: Swati Agarwal @ 2026-02-15 18:33 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Bjorn Andersson,
	Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-usb, linux-kernel, linux-arm-msm, devicetree, Swati Agarwal

Add wakeup support from system suspend for primary USB controller on lemans
EVK platform by making interrupt wakeup capable for HD3ss3220 port
controller.

Swati Agarwal (2):
  usb: typec: hd3ss3220: Add wakeup support from system suspend
  arm64: dts: qcom: lemans-evk: Enable wakeup for primary USB controller

 arch/arm64/boot/dts/qcom/lemans-evk.dts |  2 ++
 drivers/usb/typec/hd3ss3220.c           | 35 +++++++++++++++++++++++++
 2 files changed, 37 insertions(+)

-- 
2.34.1


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

* [RFC PATCH 1/2] usb: typec: hd3ss3220: Add wakeup support from system suspend
  2026-02-15 18:33 [RFC PATCH 0/2] Add wakeup support from system suspend Swati Agarwal
@ 2026-02-15 18:33 ` Swati Agarwal
  2026-02-16 12:57   ` Krzysztof Kozlowski
  2026-02-24  7:50   ` Dmitry Baryshkov
  2026-02-15 18:33 ` [RFC PATCH 2/2] arm64: dts: qcom: lemans-evk: Enable wakeup for primary USB controller Swati Agarwal
  1 sibling, 2 replies; 7+ messages in thread
From: Swati Agarwal @ 2026-02-15 18:33 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Bjorn Andersson,
	Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-usb, linux-kernel, linux-arm-msm, devicetree, Swati Agarwal

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@oss.qualcomm.com>
---
 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);
+	}
+
 	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


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

* [RFC PATCH 2/2] arm64: dts: qcom: lemans-evk: Enable wakeup for primary USB controller
  2026-02-15 18:33 [RFC PATCH 0/2] Add wakeup support from system suspend Swati Agarwal
  2026-02-15 18:33 ` [RFC PATCH 1/2] usb: typec: hd3ss3220: " Swati Agarwal
@ 2026-02-15 18:33 ` Swati Agarwal
  2026-02-16 11:22   ` Konrad Dybcio
  2026-02-16 12:57   ` Krzysztof Kozlowski
  1 sibling, 2 replies; 7+ messages in thread
From: Swati Agarwal @ 2026-02-15 18:33 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Bjorn Andersson,
	Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-usb, linux-kernel, linux-arm-msm, devicetree, Swati Agarwal

Add the "wakeup-source" property to the primary port controller node so its
interrupt can wake the system from low‑power states on lemans EVK
platform.

Signed-off-by: Swati Agarwal <swati.agarwal@oss.qualcomm.com>
---
 arch/arm64/boot/dts/qcom/lemans-evk.dts | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/lemans-evk.dts b/arch/arm64/boot/dts/qcom/lemans-evk.dts
index 90fce947ca7e..50620b557404 100644
--- a/arch/arm64/boot/dts/qcom/lemans-evk.dts
+++ b/arch/arm64/boot/dts/qcom/lemans-evk.dts
@@ -515,6 +515,8 @@ usb-typec@67 {
 		pinctrl-0 = <&usb_id>, <&usb0_intr_state>;
 		pinctrl-names = "default";
 
+		wakeup-source;
+
 		ports {
 			#address-cells = <1>;
 			#size-cells = <0>;
-- 
2.34.1


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

* Re: [RFC PATCH 2/2] arm64: dts: qcom: lemans-evk: Enable wakeup for primary USB controller
  2026-02-15 18:33 ` [RFC PATCH 2/2] arm64: dts: qcom: lemans-evk: Enable wakeup for primary USB controller Swati Agarwal
@ 2026-02-16 11:22   ` Konrad Dybcio
  2026-02-16 12:57   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 7+ messages in thread
From: Konrad Dybcio @ 2026-02-16 11:22 UTC (permalink / raw)
  To: Swati Agarwal, Heikki Krogerus, Greg Kroah-Hartman,
	Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: linux-usb, linux-kernel, linux-arm-msm, devicetree

On 2/15/26 7:33 PM, Swati Agarwal wrote:
> Add the "wakeup-source" property to the primary port controller node so its
> interrupt can wake the system from low‑power states on lemans EVK
> platform.
> 
> Signed-off-by: Swati Agarwal <swati.agarwal@oss.qualcomm.com>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad

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

* Re: [RFC PATCH 2/2] arm64: dts: qcom: lemans-evk: Enable wakeup for primary USB controller
  2026-02-15 18:33 ` [RFC PATCH 2/2] arm64: dts: qcom: lemans-evk: Enable wakeup for primary USB controller Swati Agarwal
  2026-02-16 11:22   ` Konrad Dybcio
@ 2026-02-16 12:57   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2026-02-16 12:57 UTC (permalink / raw)
  To: Swati Agarwal, Heikki Krogerus, Greg Kroah-Hartman,
	Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: linux-usb, linux-kernel, linux-arm-msm, devicetree

On 15/02/2026 19:33, Swati Agarwal wrote:
> Add the "wakeup-source" property to the primary port controller node so its
> interrupt can wake the system from low‑power states on lemans EVK
> platform.
> 
> Signed-off-by: Swati Agarwal <swati.agarwal@oss.qualcomm.com>
> ---
>  arch/arm64/boot/dts/qcom/lemans-evk.dts | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/lemans-evk.dts b/arch/arm64/boot/dts/qcom/lemans-evk.dts
> index 90fce947ca7e..50620b557404 100644
> --- a/arch/arm64/boot/dts/qcom/lemans-evk.dts
> +++ b/arch/arm64/boot/dts/qcom/lemans-evk.dts
> @@ -515,6 +515,8 @@ usb-typec@67 {
>  		pinctrl-0 = <&usb_id>, <&usb0_intr_state>;
>  		pinctrl-names = "default";
>  
> +		wakeup-source;

I don't think this was tested. Please read internal guideline which asks
you about specific steps YOU MUST do.

Best regards,
Krzysztof

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

* Re: [RFC PATCH 1/2] usb: typec: hd3ss3220: Add wakeup support from system suspend
  2026-02-15 18:33 ` [RFC PATCH 1/2] usb: typec: hd3ss3220: " Swati Agarwal
@ 2026-02-16 12:57   ` Krzysztof Kozlowski
  2026-02-24  7:50   ` Dmitry Baryshkov
  1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2026-02-16 12:57 UTC (permalink / raw)
  To: Swati Agarwal, Heikki Krogerus, Greg Kroah-Hartman,
	Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley
  Cc: linux-usb, linux-kernel, linux-arm-msm, devicetree

On 15/02/2026 19:33, Swati Agarwal wrote:
> 
> 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")) {

Looks like undocumented ABI.

Best regards,
Krzysztof

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

* Re: [RFC PATCH 1/2] usb: typec: hd3ss3220: Add wakeup support from system suspend
  2026-02-15 18:33 ` [RFC PATCH 1/2] usb: typec: hd3ss3220: " Swati Agarwal
  2026-02-16 12:57   ` Krzysztof Kozlowski
@ 2026-02-24  7:50   ` Dmitry Baryshkov
  1 sibling, 0 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2026-02-24  7:50 UTC (permalink / raw)
  To: Swati Agarwal
  Cc: Heikki Krogerus, Greg Kroah-Hartman, Bjorn Andersson,
	Konrad Dybcio, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-usb, linux-kernel, linux-arm-msm, devicetree

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@oss.qualcomm.com>
> ---
>  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

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

end of thread, other threads:[~2026-02-24  7:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-15 18:33 [RFC PATCH 0/2] Add wakeup support from system suspend Swati Agarwal
2026-02-15 18:33 ` [RFC PATCH 1/2] usb: typec: hd3ss3220: " Swati Agarwal
2026-02-16 12:57   ` Krzysztof Kozlowski
2026-02-24  7:50   ` Dmitry Baryshkov
2026-02-15 18:33 ` [RFC PATCH 2/2] arm64: dts: qcom: lemans-evk: Enable wakeup for primary USB controller Swati Agarwal
2026-02-16 11:22   ` Konrad Dybcio
2026-02-16 12:57   ` Krzysztof Kozlowski

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