[PATCH v2 07/11] PM / devfreq: exynos-bus: Replace the deprecated 'devfreq' and 'devfreq-events' property
From: Chanwoo Choi
Date: Thu Dec 19 2019 - 19:18:44 EST
Replace the deprecated 'devfreq' and 'devfreq-events' property
with new following properties.
- 'devfreq' is changed to 'exynos,parent-bus' property
- 'devfreq-events' is changed to 'exynos,ppmu-device' property
But, to guarantee the backward-compatibility, keep the support
both 'devfreq' and 'devfreq-events' property.
Signed-off-by: Chanwoo Choi <cw00.choi@xxxxxxxxxxx>
---
drivers/devfreq/exynos-bus.c | 52 +++++++++++++++++++++++++-----------
1 file changed, 37 insertions(+), 15 deletions(-)
diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
index c4931ef53f15..9fdb188915e8 100644
--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -88,22 +88,35 @@ static int exynos_bus_get_event(struct exynos_bus *bus,
static struct devfreq *exynos_bus_get_parent_devfreq(struct device_node *np)
{
- struct device_node *node = of_parse_phandle(np, "devfreq", 0);
-
- if (!node)
- return ERR_PTR(-ENODEV);
-
+ struct device_node *node = of_parse_phandle(np, "exynos,parent-bus", 0);
+
+ if (!node) {
+ /*
+ * Check the deprecated 'devfreq' property
+ * to support backward-compatibility.
+ */
+ node = of_parse_phandle(np, "devfreq", 0);
+ if (!node)
+ return ERR_PTR(-ENODEV);
+ }
return devfreq_get_devfreq_by_node(node);
}
static struct devfreq_event_dev *exynos_bus_get_edev(struct device_node *np,
int index)
{
- struct device_node *node = of_parse_phandle(np, "devfreq-events",
- index);
-
- if (!node)
- return ERR_PTR(-ENODEV);
+ struct device_node *node = of_parse_phandle(np,
+ "exynos,ppmu-device", index);
+
+ if (!node) {
+ /*
+ * Check the deprecated 'devfreq-events' property
+ * to support backward-compatibility.
+ */
+ node = of_parse_phandle(np, "devfreq-events", index);
+ if (!node)
+ return ERR_PTR(-ENODEV);
+ }
return devfreq_event_get_edev_by_node(node);
}
@@ -214,11 +227,20 @@ static int exynos_bus_parent_parse_of(struct device_node *np,
* buses. This raw data will be used in devfreq ondemand governor.
*/
count = of_property_count_elems_of_size(dev->of_node,
- "devfreq-events", sizeof(u32));
+ "exynos,ppmu-device", sizeof(u32));
if (count < 0) {
- dev_err(dev, "failed to get the count of devfreq-event dev\n");
- ret = count;
- goto err_regulator;
+ /*
+ * Check the deprecated 'devfreq-events' property
+ * to support backward-compatibility.
+ */
+ count = of_property_count_elems_of_size(dev->of_node,
+ "devfreq-events", sizeof(u32));
+ if (count < 0) {
+ dev_err(dev,
+ "failed to get the count of devfreq-event dev\n");
+ ret = count;
+ goto err_regulator;
+ }
}
bus->edev_count = count;
@@ -423,7 +445,7 @@ static int exynos_bus_probe(struct platform_device *pdev)
if (!profile)
return -ENOMEM;
- node = of_parse_phandle(dev->of_node, "devfreq", 0);
+ node = of_parse_phandle(dev->of_node, "exynos,parent-bus", 0);
if (node) {
of_node_put(node);
passive = true;
--
2.17.1