Skip to contentSkip to conversation

venus: core: change clk enable and disable order in resume and suspend

PATCH Superseded Mansur Alisha Shaik 2 participants 4 messages Sep 8, 2020 – Sep 17, 2020

Subsystems (4)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 venus: core: change clk enable and disable order in resume and suspend

Currently video driver is voting after clk enable and un voting before clk disable. Basically we should vote before clk enable and un vote after clk disable.

Corrected this by changing the order of clk enable and clk disable.

---
 drivers/media/platform/qcom/venus/core.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/media/platform/qcom/venus/core.c +10 -7
index c5af428..4857bbd 100644
@@ -363,13 +363,16 @@ static __maybe_unused int venus_runtime_suspend(struct device *dev)
 	if (ret)
 		return ret;
 
+	if (pm_ops->core_power) {
+		ret = pm_ops->core_power(dev, POWER_OFF);
+		if (ret)
+			return ret;
+	}
+
 	ret = icc_set_bw(core->cpucfg_path, 0, 0);
 	if (ret)
 		return ret;
 
-	if (pm_ops->core_power)
-		ret = pm_ops->core_power(dev, POWER_OFF);
-
 	return ret;
 }
 
@@ -379,16 +382,16 @@ static __maybe_unused int venus_runtime_resume(struct device *dev)
 	const struct venus_pm_ops *pm_ops = core->pm_ops;
 	int ret;
 
+	ret = icc_set_bw(core->cpucfg_path, 0, kbps_to_icc(1000));
+	if (ret)
+		return ret;
+
 	if (pm_ops->core_power) {
 		ret = pm_ops->core_power(dev, POWER_ON);
 		if (ret)
 			return ret;
 	}
 
-	ret = icc_set_bw(core->cpucfg_path, 0, kbps_to_icc(1000));
-	if (ret)
-		return ret;
-
 	return hfi_core_resume(core, false);
 }
 
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation
#1 lore raw

Quoting Mansur Alisha Shaik (2020-09-07 20:44:05)

Quoted 8 lines

Currently video driver is voting after clk enable and un voting before clk disable. Basically we should vote before clk enable and un vote after clk disable.

Corrected this by changing the order of clk enable and clk disable.

---

Any Fixes: tag?

Quoted 10 lines
 drivers/media/platform/qcom/venus/core.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/media/platform/qcom/venus/core.c +0 -0
index c5af428..4857bbd 100644
@@ -363,13 +363,16 @@ static __maybe_unused int venus_runtime_suspend(struct device *dev)
        if (ret)
                return ret;

drivers/media/platform/qcom/venus/core.c static __maybe_unused int venus_runtime_suspend(struct device *dev) · line 374

Quoted 10 lines
drivers/media/platform/qcom/venus/core.c +6 -0
 
+       if (pm_ops->core_power) {
+               ret = pm_ops->core_power(dev, POWER_OFF);
+               if (ret)
+                       return ret;
+       }
+
        ret = icc_set_bw(core->cpucfg_path, 0, 0);
        if (ret)
                return ret;

Shouldn't we power it back up if this fails during suspend?

Quoted 7 lines
drivers/media/platform/qcom/venus/core.c +0 -3
-       if (pm_ops->core_power)
-               ret = pm_ops->core_power(dev, POWER_OFF);
-
        return ret;
 }
 
#2 lore raw
Quoted 6 lines · Stephen Boyd
Quoted 5 lines

Quoting Mansur Alisha Shaik (2020-09-07 20:44:05)

Quoted 4 lines

Currently video driver is voting after clk enable and un voting before clk disable. Basically we should vote before clk enable and un vote after clk disable.

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

Corrected this by changing the order of clk enable and clk disable.

---

Any Fixes: tag?

Added Fixes tag

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
 drivers/media/platform/qcom/venus/core.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/media/platform/qcom/venus/core.c +0 -0
index c5af428..4857bbd 100644
@@ -363,13 +363,16 @@ static __maybe_unused int 
 venus_runtime_suspend(struct device *dev)
        if (ret)
                return ret;
 
Quoted 11 lines
Quoted 11 lines

drivers/media/platform/qcom/venus/core.c static __maybe_unused int venus_runtime_suspend(struct device *dev) · line 374

Quoted 9 lines
drivers/media/platform/qcom/venus/core.c +6 -0
+       if (pm_ops->core_power) {
+               ret = pm_ops->core_power(dev, POWER_OFF);
+               if (ret)
+                       return ret;
+       }
+
        ret = icc_set_bw(core->cpucfg_path, 0, 0);
        if (ret)
                return ret;

Shouldn't we power it back up if this fails during suspend?

On icc_set_bw() failure, we are just power it and return. Addressed these comments and posted new version
https://lore.kernel.org/patchwork/project/lkml/list/?series=463224

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/media/platform/qcom/venus/core.c +0 -3
-       if (pm_ops->core_power)
-               ret = pm_ops->core_power(dev, POWER_OFF);
-
        return ret;
 }
 
#3 lore raw

Quoting [email protected] (2020-09-16 18:07:44)

Quoted 38 lines
Quoted 6 lines · Stephen Boyd
Quoted 5 lines

Quoting Mansur Alisha Shaik (2020-09-07 20:44:05)

Quoted 4 lines

Currently video driver is voting after clk enable and un voting before clk disable. Basically we should vote before clk enable and un vote after clk disable.

Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

Corrected this by changing the order of clk enable and clk disable.

---

Any Fixes: tag?

Added Fixes tag

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
 drivers/media/platform/qcom/venus/core.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/media/platform/qcom/venus/core.c +0 -0
index c5af428..4857bbd 100644
@@ -363,13 +363,16 @@ static __maybe_unused int 
 venus_runtime_suspend(struct device *dev)
        if (ret)
                return ret;
 
Quoted 11 lines
Quoted 11 lines

drivers/media/platform/qcom/venus/core.c static __maybe_unused int venus_runtime_suspend(struct device *dev) · line 374

Quoted 9 lines
drivers/media/platform/qcom/venus/core.c +6 -0
+       if (pm_ops->core_power) {
+               ret = pm_ops->core_power(dev, POWER_OFF);
+               if (ret)
+                       return ret;
+       }
+
        ret = icc_set_bw(core->cpucfg_path, 0, 0);
        if (ret)
                return ret;

Shouldn't we power it back up if this fails during suspend?

Quoted 3 lines

On icc_set_bw() failure, we are just power it and return. Addressed these comments and posted new version
https://lore.kernel.org/patchwork/project/lkml/list/?series=463224

Thanks. It's customary to Cc reviewers on patches, so please add me on the next round of patches.