diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2016-11-18 05:17:46 -0500 |
---|---|---|
committer | Viresh Kumar <viresh.kumar@linaro.org> | 2018-05-09 00:45:20 -0400 |
commit | 3ba98324e81addf5a1089ffc981e3e2b1630b2a7 (patch) | |
tree | d7b9587545bf453c54af71360cb33db37b712794 | |
parent | 6e41766a6a504b605a105cc5ab8d276ea20052ba (diff) |
PM / OPP: Get performance state using genpd helper
The genpd core provides an API now to retrieve the performance state
from DT, use that instead of the ->get_pstate() callback.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/opp/core.c | 3 | ||||
-rw-r--r-- | drivers/opp/of.c | 20 |
2 files changed, 19 insertions, 4 deletions
diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 416f54ba7a26..e4ec30ee1493 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c | |||
@@ -1056,9 +1056,6 @@ int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, | |||
1056 | } | 1056 | } |
1057 | } | 1057 | } |
1058 | 1058 | ||
1059 | if (opp_table->get_pstate) | ||
1060 | new_opp->pstate = opp_table->get_pstate(dev, new_opp->rate); | ||
1061 | |||
1062 | list_add(&new_opp->node, head); | 1059 | list_add(&new_opp->node, head); |
1063 | mutex_unlock(&opp_table->lock); | 1060 | mutex_unlock(&opp_table->lock); |
1064 | 1061 | ||
diff --git a/drivers/opp/of.c b/drivers/opp/of.c index de41e68b780f..7026e9f484ea 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <linux/device.h> | 18 | #include <linux/device.h> |
19 | #include <linux/of_device.h> | 19 | #include <linux/of_device.h> |
20 | #include <linux/pm_domain.h> | ||
20 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
21 | #include <linux/export.h> | 22 | #include <linux/export.h> |
22 | 23 | ||
@@ -329,6 +330,8 @@ static int _opp_add_static_v2(struct opp_table *opp_table, struct device *dev, | |||
329 | if (!of_property_read_u32(np, "clock-latency-ns", &val)) | 330 | if (!of_property_read_u32(np, "clock-latency-ns", &val)) |
330 | new_opp->clock_latency_ns = val; | 331 | new_opp->clock_latency_ns = val; |
331 | 332 | ||
333 | new_opp->pstate = of_genpd_opp_to_performance_state(dev, np); | ||
334 | |||
332 | ret = opp_parse_supplies(new_opp, dev, opp_table); | 335 | ret = opp_parse_supplies(new_opp, dev, opp_table); |
333 | if (ret) | 336 | if (ret) |
334 | goto free_opp; | 337 | goto free_opp; |
@@ -379,7 +382,8 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np) | |||
379 | { | 382 | { |
380 | struct device_node *np; | 383 | struct device_node *np; |
381 | struct opp_table *opp_table; | 384 | struct opp_table *opp_table; |
382 | int ret = 0, count = 0; | 385 | int ret = 0, count = 0, pstate_count = 0; |
386 | struct dev_pm_opp *opp; | ||
383 | 387 | ||
384 | opp_table = _managed_opp(opp_np); | 388 | opp_table = _managed_opp(opp_np); |
385 | if (opp_table) { | 389 | if (opp_table) { |
@@ -413,6 +417,20 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np) | |||
413 | goto put_opp_table; | 417 | goto put_opp_table; |
414 | } | 418 | } |
415 | 419 | ||
420 | list_for_each_entry(opp, &opp_table->opp_list, node) | ||
421 | pstate_count += !!opp->pstate; | ||
422 | |||
423 | /* Either all or none of the nodes shall have performance state set */ | ||
424 | if (pstate_count && pstate_count != count) { | ||
425 | dev_err(dev, "Not all nodes have performance state set (%d: %d)\n", | ||
426 | count, pstate_count); | ||
427 | ret = -ENOENT; | ||
428 | goto put_opp_table; | ||
429 | } | ||
430 | |||
431 | if (pstate_count) | ||
432 | opp_table->genpd_performance_state = true; | ||
433 | |||
416 | opp_table->np = opp_np; | 434 | opp_table->np = opp_np; |
417 | if (of_property_read_bool(opp_np, "opp-shared")) | 435 | if (of_property_read_bool(opp_np, "opp-shared")) |
418 | opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED; | 436 | opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED; |