From: Xu Yang <xu.yang_2@nxp.com> Date: 2026-02-02 07:46:11
Current design will power off all dependent GPC power domains in
imx8mp_blk_ctrl_suspend(), even though the user device has enabled
wakeup capability. The result is that wakeup function never works
for such device.
An example will be USB wakeup on i.MX8MP. PHY device '382f0040.usb-phy'
is attached to power domain 'hsioblk-usb-phy2' which is spawned by hsio
block control. A virtual power domain device 'genpd:3:32f10000.blk-ctrl'
is created to build connection with 'hsioblk-usb-phy2' and it depends on
GPC power domain 'usb-otg2'. If device '382f0040.usb-phy' enable wakeup,
only power domain 'hsioblk-usb-phy2' keeps on during system suspend,
power domain 'usb-otg2' is off all the time. So the wakeup event can't
happen.
Let's propagate wakeup path to virtual power domain device so the wakeup
event can happen properly.
Fixes: 556f5cf9568a ("soc: imx: add i.MX8MP HSIO blk-ctrl")
Cc: stable@kernel.org
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
drivers/pmdomain/imx/imx8mp-blk-ctrl.c | 8 ++++++++
1 file changed, 8 insertions(+)
From: Xu Yang <xu.yang_2@nxp.com> Date: 2026-02-02 07:46:16
USB remote wakeup need its PHY on, so add USB PHY power domain
on active flag.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Li Jun <redacted>
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
drivers/pmdomain/imx/gpcv2.c | 2 ++
1 file changed, 2 insertions(+)
On Mon, 2 Feb 2026 at 08:46, Xu Yang [off-list ref] wrote:
quoted hunk
Current design will power off all dependent GPC power domains in
imx8mp_blk_ctrl_suspend(), even though the user device has enabled
wakeup capability. The result is that wakeup function never works
for such device.
An example will be USB wakeup on i.MX8MP. PHY device '382f0040.usb-phy'
is attached to power domain 'hsioblk-usb-phy2' which is spawned by hsio
block control. A virtual power domain device 'genpd:3:32f10000.blk-ctrl'
is created to build connection with 'hsioblk-usb-phy2' and it depends on
GPC power domain 'usb-otg2'. If device '382f0040.usb-phy' enable wakeup,
only power domain 'hsioblk-usb-phy2' keeps on during system suspend,
power domain 'usb-otg2' is off all the time. So the wakeup event can't
happen.
Let's propagate wakeup path to virtual power domain device so the wakeup
event can happen properly.
Fixes: 556f5cf9568a ("soc: imx: add i.MX8MP HSIO blk-ctrl")
Cc: stable@kernel.org
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
drivers/pmdomain/imx/imx8mp-blk-ctrl.c | 8 ++++++++
1 file changed, 8 insertions(+)
@@ -804,12 +804,20 @@ static int imx8mp_blk_ctrl_suspend(struct device *dev)for(i=0;i<bc->onecell_data.num_domains;i++){structimx8mp_blk_ctrl_domain*domain=&bc->domains[i];+structpm_domain_data*pdd;ret=pm_runtime_get_sync(domain->power_dev);if(ret<0){pm_runtime_put_noidle(domain->power_dev);gotoout_fail;}++list_for_each_entry(pdd,&domain->genpd.dev_list,list_node){+if(device_awake_path(pdd->dev)){+device_set_awake_path(domain->power_dev);+break;+}+}
This is really messy in my opinion. Ideally the above should not be
used by a genpd provider as it's internal data structures are managed
by genpd itself.
If I understand correctly, this problem boils down to the fact that we
should have tried harder to model child/parent domains, rather than
using runtime PM to manage the parent domains. I understand there are
problems with that, due to specific power on/off sequences we have for
imx power-domains, but I wonder if those could be managed better by
using genpd on/off notifiers?
Anyway, that said. Rather than walking through the list of devices as
above, I suggest that you use the ->power_off() callback for the
corresponding genpd(s) to dev in combination with a genpd power on/off
notifier for the corresponding genpd that the power_dev is attached
to.
More precisely, if the "child domain(s)" that corresponds to "dev" has
not been powered-off (because device_awake_path() is set for some
device) during system suspend, the power-off notifier should return
NOTIFY_BAD to prevent the "parent domain" that corresponds to
power_dev from being powered-off.
Would that work, you think?
Kind regards
Uffe
This is really messy in my opinion. Ideally the above should not be
used by a genpd provider as it's internal data structures are managed
by genpd itself.
If I understand correctly, this problem boils down to the fact that we
should have tried harder to model child/parent domains, rather than
using runtime PM to manage the parent domains. I understand there are
problems with that, due to specific power on/off sequences we have for
imx power-domains, but I wonder if those could be managed better by
using genpd on/off notifiers?
Indeed. I have tried using subdomain will resolve the wakeup issue because
the parent domain will manage the child domain. But I shouldn't use
subdomain and runtime PM way together to avoid any unexpected behaviors
according to my understanding.
Anyway, that said. Rather than walking through the list of devices as
above, I suggest that you use the ->power_off() callback for the
corresponding genpd(s) to dev in combination with a genpd power on/off
notifier for the corresponding genpd that the power_dev is attached
to.
More precisely, if the "child domain(s)" that corresponds to "dev" has
not been powered-off (because device_awake_path() is set for some
device) during system suspend, the power-off notifier should return
NOTIFY_BAD to prevent the "parent domain" that corresponds to
power_dev from being powered-off.
Would that work, you think?
Thank you for the suggestion. It works for me.
With this way the rejected count is increasing. Does this have any impact?
The count is just used for statistics, right?
# cat /sys/kernel/debug/pm_genpd/usb-otg2/idle_states
State Time Spent(ms) Usage Rejected Above Below
S0 1203 0 1 0 0
Thanks,
Xu Yang
This is really messy in my opinion. Ideally the above should not be
used by a genpd provider as it's internal data structures are managed
by genpd itself.
If I understand correctly, this problem boils down to the fact that we
should have tried harder to model child/parent domains, rather than
using runtime PM to manage the parent domains. I understand there are
problems with that, due to specific power on/off sequences we have for
imx power-domains, but I wonder if those could be managed better by
using genpd on/off notifiers?
Indeed. I have tried using subdomain will resolve the wakeup issue because
the parent domain will manage the child domain. But I shouldn't use
subdomain and runtime PM way together to avoid any unexpected behaviors
according to my understanding.
Well, there is nothing wrong with using child/parent domain in
combination with runtime PM.
Although in general using runtime PM to manage parents domains from
child domains, should be better managed by genpd itself.
quoted
Anyway, that said. Rather than walking through the list of devices as
above, I suggest that you use the ->power_off() callback for the
corresponding genpd(s) to dev in combination with a genpd power on/off
notifier for the corresponding genpd that the power_dev is attached
to.
More precisely, if the "child domain(s)" that corresponds to "dev" has
not been powered-off (because device_awake_path() is set for some
device) during system suspend, the power-off notifier should return
NOTIFY_BAD to prevent the "parent domain" that corresponds to
power_dev from being powered-off.
Would that work, you think?
Thank you for the suggestion. It works for me.
Great!
With this way the rejected count is increasing. Does this have any impact?
The count is just used for statistics, right?
Yes, it's used for statistics.
# cat /sys/kernel/debug/pm_genpd/usb-otg2/idle_states
State Time Spent(ms) Usage Rejected Above Below
S0 1203 0 1 0 0
Thanks,
Xu Yang