[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAPDyKFpqfo1R8Qkq284L9DTURjZnvm_n8W3a6KQTomg7A-M_Ug@mail.gmail.com>
Date: Tue, 3 Feb 2026 12:06:28 +0100
From: Ulf Hansson <ulf.hansson@...aro.org>
To: Xu Yang <xu.yang_2@....com>
Cc: Frank.Li@....com, s.hauer@...gutronix.de, kernel@...gutronix.de,
festevam@...il.com, peng.fan@....com, jun.li@....com,
rafael.j.wysocki@...el.com, a.fatoum@...gutronix.de, ping.bai@....com,
shawnguo@...nel.org, l.stach@...gutronix.de, linux-pm@...r.kernel.org,
imx@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] pmdomain: imx8mp-blk-ctrl: set awake path for
power_dev if attached device needs wakeup
On Mon, 2 Feb 2026 at 08:46, Xu Yang <xu.yang_2@....com> wrote:
>
> 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@...nel.org
> Signed-off-by: Xu Yang <xu.yang_2@....com>
> ---
> drivers/pmdomain/imx/imx8mp-blk-ctrl.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/pmdomain/imx/imx8mp-blk-ctrl.c b/drivers/pmdomain/imx/imx8mp-blk-ctrl.c
> index 34576be606e3..f3bfd6d22722 100644
> --- a/drivers/pmdomain/imx/imx8mp-blk-ctrl.c
> +++ b/drivers/pmdomain/imx/imx8mp-blk-ctrl.c
> @@ -804,12 +804,20 @@ static int imx8mp_blk_ctrl_suspend(struct device *dev)
>
> for (i = 0; i < bc->onecell_data.num_domains; i++) {
> struct imx8mp_blk_ctrl_domain *domain = &bc->domains[i];
> + struct pm_domain_data *pdd;
>
> ret = pm_runtime_get_sync(domain->power_dev);
> if (ret < 0) {
> pm_runtime_put_noidle(domain->power_dev);
> goto out_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
Powered by blists - more mailing lists