Re: [PATCH v4 10/12] OPP: Add support for setting interconnect-tags

2020-05-05 Thread Sibi Sankar

On 2020-05-05 10:26, Viresh Kumar wrote:

On 05-05-20, 01:52, Sibi Sankar wrote:

Add support for setting tags on icc paths associated with
the opp_table.

Signed-off-by: Sibi Sankar 
---
 drivers/opp/of.c | 25 +++--
 1 file changed, 19 insertions(+), 6 deletions(-)


Maybe this should be part of Georgi's series ?


yes, I've requested for the
same in my cover-letter.

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project.


Re: [PATCH v4 10/12] OPP: Add support for setting interconnect-tags

2020-05-04 Thread Viresh Kumar
On 05-05-20, 01:52, Sibi Sankar wrote:
> Add support for setting tags on icc paths associated with
> the opp_table.
> 
> Signed-off-by: Sibi Sankar 
> ---
>  drivers/opp/of.c | 25 +++--
>  1 file changed, 19 insertions(+), 6 deletions(-)

Maybe this should be part of Georgi's series ?

-- 
viresh


[PATCH v4 10/12] OPP: Add support for setting interconnect-tags

2020-05-04 Thread Sibi Sankar
Add support for setting tags on icc paths associated with
the opp_table.

Signed-off-by: Sibi Sankar 
---
 drivers/opp/of.c | 25 +++--
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index 2b590fe2e69ae..5273b46f11025 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -336,6 +336,7 @@ int _of_find_paths(struct opp_table *opp_table, struct 
device *dev)
 {
struct device_node *np;
int ret, i, count, num_paths;
+   u32 tag;
 
np = of_node_get(dev->of_node);
if (!np)
@@ -343,22 +344,26 @@ int _of_find_paths(struct opp_table *opp_table, struct 
device *dev)
 
count = of_count_phandle_with_args(np, "interconnects",
   "#interconnect-cells");
-   of_node_put(np);
-   if (count < 0)
-   return 0;
+   if (count < 0) {
+   ret = 0;
+   goto put_np;
+   }
 
/* two phandles when #interconnect-cells = <1> */
if (count % 2) {
dev_err(dev, "%s: Invalid interconnects values\n",
__func__);
-   return -EINVAL;
+   ret = -EINVAL;
+   goto put_np;
}
 
num_paths = count / 2;
opp_table->paths = kcalloc(num_paths, sizeof(*opp_table->paths),
   GFP_KERNEL);
-   if (!opp_table->paths)
-   return -ENOMEM;
+   if (!opp_table->paths) {
+   ret = -ENOMEM;
+   goto put_np;
+   }
 
for (i = 0; i < num_paths; i++) {
opp_table->paths[i] = of_icc_get_by_index(dev, i);
@@ -370,8 +375,14 @@ int _of_find_paths(struct opp_table *opp_table, struct 
device *dev)
}
goto err;
}
+
+   /* Set tag if present */
+   if (!of_property_read_u32_index(np, "interconnect-tags",
+   i, ))
+   icc_set_tag(opp_table->paths[i], tag);
}
opp_table->path_count = num_paths;
+   of_node_put(np);
 
return 0;
 
@@ -381,6 +392,8 @@ int _of_find_paths(struct opp_table *opp_table, struct 
device *dev)
 
kfree(opp_table->paths);
opp_table->paths = NULL;
+put_np:
+   of_node_put(np);
 
return ret;
 }
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project