* [PATCH] pmdomain: core: fix "sd_count" field setting
@ 2024-10-24 9:49 Dario Binacchi
2024-10-28 13:33 ` Ulf Hansson
0 siblings, 1 reply; 4+ messages in thread
From: Dario Binacchi @ 2024-10-24 9:49 UTC (permalink / raw)
To: linux-kernel
Cc: linux-amarula, Dario Binacchi, Michael Trimarchi, Ulf Hansson, linux-pm
The "sd_count" field keeps track of the number of subdomains with power
"on," so if pm_genpd_init() is called with the "is_off" parameter set to
false, it means that the power domain is already on, and therefore its
"sd_count" must be 1.
Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
drivers/pmdomain/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
index 5ede0f7eda09..2df6dda98021 100644
--- a/drivers/pmdomain/core.c
+++ b/drivers/pmdomain/core.c
@@ -2221,7 +2221,7 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
genpd_lock_init(genpd);
genpd->gov = gov;
INIT_WORK(&genpd->power_off_work, genpd_power_off_work_fn);
- atomic_set(&genpd->sd_count, 0);
+ atomic_set(&genpd->sd_count, is_off ? 0 : 1);
genpd->status = is_off ? GENPD_STATE_OFF : GENPD_STATE_ON;
genpd->device_count = 0;
genpd->provider = NULL;
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pmdomain: core: fix "sd_count" field setting
2024-10-24 9:49 [PATCH] pmdomain: core: fix "sd_count" field setting Dario Binacchi
@ 2024-10-28 13:33 ` Ulf Hansson
2024-10-28 15:07 ` Dario Binacchi
0 siblings, 1 reply; 4+ messages in thread
From: Ulf Hansson @ 2024-10-28 13:33 UTC (permalink / raw)
To: Dario Binacchi; +Cc: linux-kernel, linux-amarula, Michael Trimarchi, linux-pm
On Thu, 24 Oct 2024 at 11:49, Dario Binacchi
<dario.binacchi@amarulasolutions.com> wrote:
>
> The "sd_count" field keeps track of the number of subdomains with power
> "on," so if pm_genpd_init() is called with the "is_off" parameter set to
> false, it means that the power domain is already on, and therefore its
> "sd_count" must be 1.
genpd_sd_counter_inc() is being called when adding subdomains. Doesn't
that work correctly for you?
>
> Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com>
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
>
Kind regards
Uffe
> ---
>
> drivers/pmdomain/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
> index 5ede0f7eda09..2df6dda98021 100644
> --- a/drivers/pmdomain/core.c
> +++ b/drivers/pmdomain/core.c
> @@ -2221,7 +2221,7 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
> genpd_lock_init(genpd);
> genpd->gov = gov;
> INIT_WORK(&genpd->power_off_work, genpd_power_off_work_fn);
> - atomic_set(&genpd->sd_count, 0);
> + atomic_set(&genpd->sd_count, is_off ? 0 : 1);
> genpd->status = is_off ? GENPD_STATE_OFF : GENPD_STATE_ON;
> genpd->device_count = 0;
> genpd->provider = NULL;
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pmdomain: core: fix "sd_count" field setting
2024-10-28 13:33 ` Ulf Hansson
@ 2024-10-28 15:07 ` Dario Binacchi
2024-10-28 21:51 ` Ulf Hansson
0 siblings, 1 reply; 4+ messages in thread
From: Dario Binacchi @ 2024-10-28 15:07 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-kernel, linux-amarula, Michael Trimarchi, linux-pm
On Mon, Oct 28, 2024 at 2:34 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Thu, 24 Oct 2024 at 11:49, Dario Binacchi
> <dario.binacchi@amarulasolutions.com> wrote:
> >
> > The "sd_count" field keeps track of the number of subdomains with power
> > "on," so if pm_genpd_init() is called with the "is_off" parameter set to
> > false, it means that the power domain is already on, and therefore its
> > "sd_count" must be 1.
>
> genpd_sd_counter_inc() is being called when adding subdomains. Doesn't
> that work correctly for you?
In my use case the genpd_add_subdomain() is not called.
I am working on :
drivers/pmdomain/imx/gpcv2.c
drivers/pmdomain/imx/imx8m-blk-ctrl.c
Thanks and regards,
Dario
>
> >
> > Co-developed-by: Michael Trimarchi <michael@amarulasolutions.com>
> > Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> >
>
> Kind regards
> Uffe
>
> > ---
> >
> > drivers/pmdomain/core.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c
> > index 5ede0f7eda09..2df6dda98021 100644
> > --- a/drivers/pmdomain/core.c
> > +++ b/drivers/pmdomain/core.c
> > @@ -2221,7 +2221,7 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
> > genpd_lock_init(genpd);
> > genpd->gov = gov;
> > INIT_WORK(&genpd->power_off_work, genpd_power_off_work_fn);
> > - atomic_set(&genpd->sd_count, 0);
> > + atomic_set(&genpd->sd_count, is_off ? 0 : 1);
> > genpd->status = is_off ? GENPD_STATE_OFF : GENPD_STATE_ON;
> > genpd->device_count = 0;
> > genpd->provider = NULL;
> > --
> > 2.43.0
> >
--
Dario Binacchi
Senior Embedded Linux Developer
dario.binacchi@amarulasolutions.com
__________________________________
Amarula Solutions SRL
Via Le Canevare 30, 31100 Treviso, Veneto, IT
T. +39 042 243 5310
info@amarulasolutions.com
www.amarulasolutions.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pmdomain: core: fix "sd_count" field setting
2024-10-28 15:07 ` Dario Binacchi
@ 2024-10-28 21:51 ` Ulf Hansson
0 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2024-10-28 21:51 UTC (permalink / raw)
To: Dario Binacchi; +Cc: linux-kernel, linux-amarula, Michael Trimarchi, linux-pm
On Mon, 28 Oct 2024 at 16:07, Dario Binacchi
<dario.binacchi@amarulasolutions.com> wrote:
>
> On Mon, Oct 28, 2024 at 2:34 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
> >
> > On Thu, 24 Oct 2024 at 11:49, Dario Binacchi
> > <dario.binacchi@amarulasolutions.com> wrote:
> > >
> > > The "sd_count" field keeps track of the number of subdomains with power
> > > "on," so if pm_genpd_init() is called with the "is_off" parameter set to
> > > false, it means that the power domain is already on, and therefore its
> > > "sd_count" must be 1.
> >
> > genpd_sd_counter_inc() is being called when adding subdomains. Doesn't
> > that work correctly for you?
>
> In my use case the genpd_add_subdomain() is not called.
> I am working on :
> drivers/pmdomain/imx/gpcv2.c
> drivers/pmdomain/imx/imx8m-blk-ctrl.c
In that case you don't have a child-domain (subdomain), which means
the sd_count should be 0.
[...]
Kind regards
Uffe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-28 21:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-24 9:49 [PATCH] pmdomain: core: fix "sd_count" field setting Dario Binacchi
2024-10-28 13:33 ` Ulf Hansson
2024-10-28 15:07 ` Dario Binacchi
2024-10-28 21:51 ` Ulf Hansson
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®