media: qcom: iris: rollback OPP vote on PM resume failure
Subsystems (4)
PATCH 1/1 media: qcom: iris: rollback OPP vote on PM resume failure
Rollback the maximum OPP vote whenpm_runtime_resume_and_get() fails iniris_enable_power_domains().
This ensures the performance state vote is released when power domain enablement does not complete successfully.
--- drivers/media/platform/qcom/iris/iris_resources.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/iris/iris_resources.c +3 -1
@@ -79,8 +79,10 @@ int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev)return ret; ret =pm_runtime_resume_and_get (pd_dev); -if (ret) +if (ret) { +iris_opp_set_rate (core->dev,0 );return ret; + }return 0 ; }
Signature · 1 line
2.34.1
Quoted 18 lines · Hungyu Lin
Rollback the maximum OPP vote when
pm_runtime_resume_and_get()fails iniris_enable_power_domains().This ensures the performance state vote is released when power domain enablement does not complete successfully.
Fixes bb8a95aa038e ("media: iris: implement power management")Signed-off-by Hungyu Lin <[email protected]>--- drivers/media/platform/qcom/iris/iris_resources.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/media/platform/qcom/iris/iris_resources.c +0
-0
drivers/media/platform/qcom/iris/iris_resources.c int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev) · line 85
Quoted 8 lines
drivers/media/platform/qcom/iris/iris_resources.c +3
-1@@ -79,8 +79,10 @@ int iris_enable_power_domains(struct iris_core *core, struct device *pd_dev)return ret; ret =pm_runtime_resume_and_get (pd_dev); -if (ret) +if (ret) { +iris_opp_set_rate (core->dev,0 );return ret; + }
opp_set_rate(0) would only drop the performance vote but keep the clock ticking (without ensuring power). If the device's power state remains disabled, the OPP vote will be kept disabled too. I don't think we need it at all. The clock may possibly need to be disabled instead. Or maybe not, if it's hw-controlled (which I'm not sure if it is)
Konrad
Quoted 6 lines
opp_set_rate(0)would only drop the performance vote but keep the clock ticking (without ensuring power). If the device's power state remains disabled, the OPP vote will be kept disabled too. I don't think we need it at all. The clock may possibly need to be disabled instead. Or maybe not, if it's hw-controlled (which I'm not sure if it is)
Thanks for the review.
After tracing the call flow further, I found that the maximum OPP belongs to the complete VPU power-on transaction:
iris_vpu_power_on()
|-- iris_set_icc_bw()
|-- iris_opp_set_rate(..., ULONG_MAX)
|-- power_on_controller()
| `-- iris_enable_power_domains(...)
`-- power_on_hw()
`-- iris_enable_power_domains(...)The power-domain helper only manages one functional domain, so it should not own the transaction-wide OPP state. I will move the OPP lifetime and error cleanup to iris_vpu_power_on() and send the update as v7 after validation.
Also, sorry for the versioning confusion. The previous unversioned posting was intended to be v6.
Thanks,
Hungyu Lin
Quoted 5 lines
as v7 after validation.
Also, sorry for the versioning confusion. The previous unversioned posting was intended to be v6.
Correction: I got the version number wrong. The unversioned patch was sent before v5, so the next version will be v6, not v7.
Sorry for the confusion.
Thanks,
Hungyu Lin