* [PATCH] usb: typec: pd: mark usb_power_delivery sysfs devices as PM not required
@ 2026-09-14 9:39 Xu Yang
2026-09-18 7:58 ` Heikki Krogerus
0 siblings, 1 reply; 2+ messages in thread
From: Xu Yang @ 2026-09-14 9:39 UTC (permalink / raw)
To: heikki.krogerus, gregkh; +Cc: linux-usb, linux-kernel, imx, jun.li
From: Xu Yang <xu.yang_2@nxp.com>
The usb_power_delivery device tree (pd, capabilities, and pdo objects
created by usb_power_delivery_register()/_capabilities(), and add_pdo())
is a pure sysfs representation with no PM callbacks of its own.
TCPM's state machine runs in its own kthread and is not synchronized with
the system PM core's suspend/resume sequencing. A Type-C wakeup interrupt
can resume the system and let TCPM register a partner's source/sink
capabilities (and their PDOs) before the parent device's device_complete()
has cleared its power.is_prepared flag. When this happens, device_pm_add()
observes the parent's stale is_prepared state and prints a spurious:
source-capabilities: PM: parent pd1 should not be sleeping
This is harmless but confusing. Mark all three device (pd, cap and pdo)
types with device_set_pm_not_required() so PM core will skip dpm_list
tracking for them entirely.
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
drivers/usb/typec/pd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/typec/pd.c b/drivers/usb/typec/pd.c
index 766c76d63328..a200d1f50977 100644
--- a/drivers/usb/typec/pd.c
+++ b/drivers/usb/typec/pd.c
@@ -517,6 +517,7 @@ static int add_pdo(struct usb_power_delivery_capabilities *cap, u32 pdo, int pos
p->dev.parent = &cap->dev;
p->dev.type = type;
dev_set_name(&p->dev, "%u:%s", position + 1, name);
+ device_set_pm_not_required(&p->dev);
ret = device_register(&p->dev);
if (ret) {
@@ -579,6 +580,7 @@ usb_power_delivery_register_capabilities(struct usb_power_delivery *pd,
cap->dev.parent = &pd->dev;
cap->dev.type = &pd_capabilities_type;
dev_set_name(&cap->dev, "%s", cap_name[cap->role]);
+ device_set_pm_not_required(&cap->dev);
ret = device_register(&cap->dev);
if (ret) {
@@ -715,6 +717,7 @@ usb_power_delivery_register(struct device *parent, struct usb_power_delivery_des
pd->dev.type = &pd_type;
pd->dev.class = &pd_class;
dev_set_name(&pd->dev, "pd%d", pd->id);
+ device_set_pm_not_required(&pd->dev);
ret = device_register(&pd->dev);
if (ret) {
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] usb: typec: pd: mark usb_power_delivery sysfs devices as PM not required
2026-09-14 9:39 [PATCH] usb: typec: pd: mark usb_power_delivery sysfs devices as PM not required Xu Yang
@ 2026-09-18 7:58 ` Heikki Krogerus
0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2026-09-18 7:58 UTC (permalink / raw)
To: Xu Yang; +Cc: gregkh, linux-usb, linux-kernel, imx, jun.li
On Mon, Sep 14, 2026 at 05:39:23PM +0800, Xu Yang wrote:
> From: Xu Yang <xu.yang_2@nxp.com>
>
> The usb_power_delivery device tree (pd, capabilities, and pdo objects
> created by usb_power_delivery_register()/_capabilities(), and add_pdo())
> is a pure sysfs representation with no PM callbacks of its own.
>
> TCPM's state machine runs in its own kthread and is not synchronized with
> the system PM core's suspend/resume sequencing. A Type-C wakeup interrupt
> can resume the system and let TCPM register a partner's source/sink
> capabilities (and their PDOs) before the parent device's device_complete()
> has cleared its power.is_prepared flag. When this happens, device_pm_add()
> observes the parent's stale is_prepared state and prints a spurious:
>
> source-capabilities: PM: parent pd1 should not be sleeping
>
> This is harmless but confusing. Mark all three device (pd, cap and pdo)
> types with device_set_pm_not_required() so PM core will skip dpm_list
> tracking for them entirely.
>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/pd.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/typec/pd.c b/drivers/usb/typec/pd.c
> index 766c76d63328..a200d1f50977 100644
> --- a/drivers/usb/typec/pd.c
> +++ b/drivers/usb/typec/pd.c
> @@ -517,6 +517,7 @@ static int add_pdo(struct usb_power_delivery_capabilities *cap, u32 pdo, int pos
> p->dev.parent = &cap->dev;
> p->dev.type = type;
> dev_set_name(&p->dev, "%u:%s", position + 1, name);
> + device_set_pm_not_required(&p->dev);
>
> ret = device_register(&p->dev);
> if (ret) {
> @@ -579,6 +580,7 @@ usb_power_delivery_register_capabilities(struct usb_power_delivery *pd,
> cap->dev.parent = &pd->dev;
> cap->dev.type = &pd_capabilities_type;
> dev_set_name(&cap->dev, "%s", cap_name[cap->role]);
> + device_set_pm_not_required(&cap->dev);
>
> ret = device_register(&cap->dev);
> if (ret) {
> @@ -715,6 +717,7 @@ usb_power_delivery_register(struct device *parent, struct usb_power_delivery_des
> pd->dev.type = &pd_type;
> pd->dev.class = &pd_class;
> dev_set_name(&pd->dev, "pd%d", pd->id);
> + device_set_pm_not_required(&pd->dev);
>
> ret = device_register(&pd->dev);
> if (ret) {
> --
> 2.34.1
--
heikki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-18 7:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 9:39 [PATCH] usb: typec: pd: mark usb_power_delivery sysfs devices as PM not required Xu Yang
2026-09-18 7:58 ` Heikki Krogerus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®