media: venus: pm_helpers: add fallback for the opp-table
Subsystems (4)
PATCH v3 1/1 media: venus: pm_helpers: add fallback for the opp-table
Since the device trees for both HFI_VERSION_1XX and HFI_VERSION_3XX do not include an opp-table and have not configured opp-pmdomain, they still need to use the frequencies defined in the driver's freq_tbl.
Both core_power_v1 and core_power_v4 functions require core_clks_enable function during POWER_ON. Therefore, in the core_clks_enable function, if calling dev_pm_opp_find_freq_ceil to obtain the frequency fails, it needs to fall back to the freq_tbl to retrieve the frequency.
---
Since device trees for both HFI_VERSION_1XX and HFI_VERSION_3XX do not contain an opp-table and have not configured opp-pmdomain, they still need to use the frequencies defined in the driver's freq_tbl.
Therefore, if calling dev_pm_opp_find_freq_ceil to obtain the frequency fails in the core_clks_enable, it needs to fall back to the freq_tbl to retrieve the frequency.
Validated this series on QCS615 and msm8916.
---
Changes in v3:
- 1. Fix patch conflict issue.
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- 1. Update the returned error value as per the feedback.
- Link to v1: https://lore.kernel.org/r/[email protected]
--- drivers/media/platform/qcom/venus/pm_helpers.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/media/platform/qcom/venus/pm_helpers.c +8 -1
@@ -40,6 +40,8 @@ static int core_clks_get(struct venus_core *core)static int core_clks_enable (struct venus_core *core) { +const struct freq_tbl *freq_tbl = core->res->freq_tbl; +unsigned int freq_tbl_size = core->res->freq_tbl_size;const struct venus_resources *res = core->res;struct device *dev = core->dev;unsigned long freq =0 ;
@@ -48,8 +50,13 @@ static int core_clks_enable(struct venus_core *core)int ret; opp =dev_pm_opp_find_freq_ceil (dev, &freq); -if (!IS_ERR (opp)) +if (IS_ERR (opp)) { +if (!freq_tbl) +return -ENODEV ; + freq = freq_tbl[freq_tbl_size -1 ].freq; + }else {dev_pm_opp_put (opp); + }for (i =0 ; i < res->clks_num; i++) {if (IS_V6 (core) || (IS_V4 (core) &&is_lite (core))) {
---
base-commit: ae2d20002576d2893ecaff25db3d7ef9190ac0b6
change-id: 20250918-fallback_of_opp_table-bfae64cca1a0
Best regards,
Signature · 1 line
Renjiang Han <[email protected]>
Quoted 70 lines · Renjiang Han
Since the device trees for both
HFI_VERSION_1XXandHFI_VERSION_3XXdo not include an opp-table and have not configured opp-pmdomain, they still need to use the frequencies defined in the driver'sfreq_tbl.Both
core_power_v1andcore_power_v4functions requirecore_clks_enablefunction duringPOWER_ON. Therefore, in thecore_clks_enablefunction, if callingdev_pm_opp_find_freq_ceilto obtain the frequency fails, it needs to fall back to thefreq_tblto retrieve the frequency.Fixes b179234b5e59 ("media: venus: pm_helpers: use opp-table for the frequency")Reviewed-by Dmitry Baryshkov <[email protected]>Reviewed-by Bryan O'Donoghue <[email protected]>Reviewed-by Vikash Garodia <[email protected]>Closes https://lore.kernel.org/linux-media/CA+G9fYu5=3n84VY+vTbCAcfFKOq7Us5vgBZgpypY4MveM=eVwg@mail.gmail.com open hereSigned-off-by Renjiang Han <[email protected]>---
Since device trees for bothHFI_VERSION_1XXandHFI_VERSION_3XXdo not contain an opp-table and have not configured opp-pmdomain, they still need to use the frequencies defined in the driver'sfreq_tbl.Therefore, if calling
dev_pm_opp_find_freq_ceilto obtain the frequency fails in thecore_clks_enable, it needs to fall back to thefreq_tblto retrieve the frequency.Validated this series on QCS615 and msm8916.
---
Changes in v3:
- 1. Fix patch conflict issue.
- Link to v2: https://lore.kernel.org/r/[email protected]Changes in v2:
- 1. Update the returned error value as per the feedback.
- Link to v1: https://lore.kernel.org/r/[email protected]--- drivers/media/platform/qcom/venus/pm_helpers.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)drivers/media/platform/qcom/venus/pm_helpers.c +8
-2@@ -40,6 +40,8 @@ static int core_clks_get(struct venus_core *core)static int core_clks_enable (struct venus_core *core) { +const struct freq_tbl *freq_tbl = core->res->freq_tbl; +unsigned int freq_tbl_size = core->res->freq_tbl_size;const struct venus_resources *res = core->res;struct device *dev = core->dev;unsigned long freq =0 ;@@ -48,8 +50,13 @@ static int core_clks_enable(struct venus_core *core)int ret; opp =dev_pm_opp_find_freq_ceil (dev, &freq); -if (!IS_ERR (opp)) +if (IS_ERR (opp)) { +if (!freq_tbl) +return -ENODEV ; + freq = freq_tbl[freq_tbl_size -1 ].freq; + }else {dev_pm_opp_put (opp); + }for (i =0 ; i < res->clks_num; i++) {if (IS_V6 (core) || (IS_V4 (core) &&is_lite (core))) { ---base-commit:
ae2d20002576d2893ecaff25db3d7ef9190ac0b6
change-id: 20250918-fallback_of_opp_table-bfae64cca1a0
Quoted 4 lines
Best regards,
--
Renjiang Han <[email protected]>