Skip to content

Commit 3c5a272

Browse files
digetxrafaeljw
authored andcommitted
PM: domains: Improve runtime PM performance state handling
GENPD core doesn't support handling performance state changes while consumer device is runtime-suspended or when runtime PM is disabled. GENPD core may override performance state that was configured by device driver while RPM of the device was disabled or device was RPM-suspended. Let's close that gap by allowing drivers to control performance state while RPM of a consumer device is disabled and to set up performance state of RPM-suspended device that will be applied by GENPD core on RPM-resume of the device. Fixes: 5937c3c ("PM: domains: Drop/restore performance state votes for devices at runtime PM") Signed-off-by: Dmitry Osipenko <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent e22ce8e commit 3c5a272

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/base/power/domain.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ static void genpd_restore_performance_state(struct device *dev,
435435
int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state)
436436
{
437437
struct generic_pm_domain *genpd;
438-
int ret;
438+
int ret = 0;
439439

440440
genpd = dev_to_genpd_safe(dev);
441441
if (!genpd)
@@ -446,7 +446,13 @@ int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state)
446446
return -EINVAL;
447447

448448
genpd_lock(genpd);
449-
ret = genpd_set_performance_state(dev, state);
449+
if (pm_runtime_suspended(dev)) {
450+
dev_gpd_data(dev)->rpm_pstate = state;
451+
} else {
452+
ret = genpd_set_performance_state(dev, state);
453+
if (!ret)
454+
dev_gpd_data(dev)->rpm_pstate = 0;
455+
}
450456
genpd_unlock(genpd);
451457

452458
return ret;

0 commit comments

Comments
 (0)