pmdomain: core: fix "sd_count" field setting
PATCH 1/1 pmdomain: core: fix "sd_count" field setting
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.
---
drivers/pmdomain/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pmdomain/core.c +1 -1
@@ -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 ;
Signature · 1 line
2.43.0
Quoted 5 lines · Dario Binacchi
The "
sd_count" field keeps track of the number of subdomains with power "on," so ifpm_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?
Quoted 5 lines
Co-developed-by Michael Trimarchi <[email protected]>Signed-off-by Michael Trimarchi <[email protected]>Signed-off-by Dario Binacchi <[email protected]>
Kind regards
Uffe
Quoted 21 lines
---
drivers/pmdomain/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pmdomain/core.c +1
-2@@ -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
Quoted 11 lines · Ulf Hansson
Quoted 5 lines · Dario Binacchi
The "
sd_count" field keeps track of the number of subdomains with power "on," so ifpm_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
Quoted 31 lines
Quoted 6 lines
Co-developed-by Michael Trimarchi <[email protected]>Signed-off-by Michael Trimarchi <[email protected]>Signed-off-by Dario Binacchi <[email protected]>Kind regards
UffeQuoted 21 lines
---
drivers/pmdomain/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pmdomain/core.c +1
-2@@ -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
Signature · 17 lines
Dario Binacchi Senior Embedded Linux Developer [email protected] __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 [email protected] www.amarulasolutions.com
Quoted 11 lines · Dario Binacchi
Quoted 9 lines · Ulf Hansson
Quoted 5 lines · Dario Binacchi
The "
sd_count" field keeps track of the number of subdomains with power "on," so ifpm_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.
Quoted 7 lines
Quoted 2 lines
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.cdrivers/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