Commit 7553a72b authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'pm-core' and 'pm-opp'

These are a PM core fix and an OPP framework fix for 4.18-rc2,
both "stable" material.

* pm-core:
  PM / core: Fix supplier device runtime PM usage counter imbalance

* pm-opp:
  PM / OPP: Update voltage in case freq == old_freq
...@@ -236,6 +236,13 @@ struct device_link *device_link_add(struct device *consumer, ...@@ -236,6 +236,13 @@ struct device_link *device_link_add(struct device *consumer,
link->rpm_active = true; link->rpm_active = true;
} }
pm_runtime_new_link(consumer); pm_runtime_new_link(consumer);
/*
* If the link is being added by the consumer driver at probe
* time, balance the decrementation of the supplier's runtime PM
* usage counter after consumer probe in driver_probe_device().
*/
if (consumer->links.status == DL_DEV_PROBING)
pm_runtime_get_noresume(supplier);
} }
get_device(supplier); get_device(supplier);
link->supplier = supplier; link->supplier = supplier;
...@@ -255,12 +262,12 @@ struct device_link *device_link_add(struct device *consumer, ...@@ -255,12 +262,12 @@ struct device_link *device_link_add(struct device *consumer,
switch (consumer->links.status) { switch (consumer->links.status) {
case DL_DEV_PROBING: case DL_DEV_PROBING:
/* /*
* Balance the decrementation of the supplier's * Some callers expect the link creation during
* runtime PM usage counter after consumer probe * consumer driver probe to resume the supplier
* in driver_probe_device(). * even without DL_FLAG_RPM_ACTIVE.
*/ */
if (flags & DL_FLAG_PM_RUNTIME) if (flags & DL_FLAG_PM_RUNTIME)
pm_runtime_get_sync(supplier); pm_runtime_resume(supplier);
link->status = DL_STATE_CONSUMER_PROBE; link->status = DL_STATE_CONSUMER_PROBE;
break; break;
......
...@@ -598,7 +598,7 @@ static int _generic_set_opp_regulator(const struct opp_table *opp_table, ...@@ -598,7 +598,7 @@ static int _generic_set_opp_regulator(const struct opp_table *opp_table,
} }
/* Scaling up? Scale voltage before frequency */ /* Scaling up? Scale voltage before frequency */
if (freq > old_freq) { if (freq >= old_freq) {
ret = _set_opp_voltage(dev, reg, new_supply); ret = _set_opp_voltage(dev, reg, new_supply);
if (ret) if (ret)
goto restore_voltage; goto restore_voltage;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment