diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2018-10-03 10:38:15 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-10-18 06:25:09 -0400 |
commit | 2c9b7f8772033cc8bafbd4eefe2ca605bf3eb094 (patch) | |
tree | 6cabeb3f4c2461443e0f0ba00aa5f1006a8bbe3b /drivers/base | |
parent | 2c361684803e0129007806b1ce42cbf9c52f8cd0 (diff) |
PM / Domains: Deal with multiple states but no governor in genpd
A caller of pm_genpd_init() that provides some states for the genpd via the
->states pointer in the struct generic_pm_domain, should also provide a
governor. This because it's the job of the governor to pick a state that
satisfies the constraints.
Therefore, let's print a warning to inform the user about such bogus
configuration and avoid to bail out, by instead picking the shallowest
state before genpd invokes the ->power_off() callback.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Lina Iyer <ilina@codeaurora.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/power/domain.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index e1bbddb02871..7f38a92b444a 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
@@ -467,6 +467,10 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, | |||
467 | return -EAGAIN; | 467 | return -EAGAIN; |
468 | } | 468 | } |
469 | 469 | ||
470 | /* Default to shallowest state. */ | ||
471 | if (!genpd->gov) | ||
472 | genpd->state_idx = 0; | ||
473 | |||
470 | if (genpd->power_off) { | 474 | if (genpd->power_off) { |
471 | int ret; | 475 | int ret; |
472 | 476 | ||
@@ -1687,6 +1691,8 @@ int pm_genpd_init(struct generic_pm_domain *genpd, | |||
1687 | ret = genpd_set_default_power_state(genpd); | 1691 | ret = genpd_set_default_power_state(genpd); |
1688 | if (ret) | 1692 | if (ret) |
1689 | return ret; | 1693 | return ret; |
1694 | } else if (!gov) { | ||
1695 | pr_warn("%s : no governor for states\n", genpd->name); | ||
1690 | } | 1696 | } |
1691 | 1697 | ||
1692 | device_initialize(&genpd->dev); | 1698 | device_initialize(&genpd->dev); |