* [PATCH] media: venus: pm_helpers: add fallback for the opp-table
@ 2025-07-23 12:56 Renjiang Han
2025-07-23 12:59 ` Bryan O'Donoghue
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Renjiang Han @ 2025-07-23 12:56 UTC (permalink / raw)
To: quic_qiweil, quic_wangaow, Vikash Garodia, Dikshita Agarwal,
Bryan O'Donoghue, Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel, Renjiang Han
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.
Signed-off-by: Renjiang Han <quic_renjiang@quicinc.com>
---
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.
---
drivers/media/platform/qcom/venus/pm_helpers.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
index 8dd5a9b0d060cddfeafd4da477ade0c7aeb6c390..27b033a3a26e0474c37353a0fe7627586e6416e2 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -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,7 +50,14 @@ static int core_clks_enable(struct venus_core *core)
int ret;
opp = dev_pm_opp_find_freq_ceil(dev, &freq);
- dev_pm_opp_put(opp);
+ if (IS_ERR(opp)) {
+ if (!freq_tbl)
+ return -EINVAL;
+ 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)) {
---
base-commit: d086c886ceb9f59dea6c3a9dae7eb89e780a20c9
change-id: 20250721-fallback_of_opp_table-4ea39376f617
Best regards,
--
Renjiang Han <quic_renjiang@quicinc.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: venus: pm_helpers: add fallback for the opp-table
2025-07-23 12:56 [PATCH] media: venus: pm_helpers: add fallback for the opp-table Renjiang Han
@ 2025-07-23 12:59 ` Bryan O'Donoghue
2025-07-23 13:01 ` Dmitry Baryshkov
2025-07-23 13:30 ` Konrad Dybcio
2 siblings, 0 replies; 5+ messages in thread
From: Bryan O'Donoghue @ 2025-07-23 12:59 UTC (permalink / raw)
To: Renjiang Han, quic_qiweil, quic_wangaow, Vikash Garodia,
Dikshita Agarwal, Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel
On 23/07/2025 13:56, Renjiang Han wrote:
> 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.
>
> Signed-off-by: Renjiang Han <quic_renjiang@quicinc.com>
> ---
> 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.
> ---
> drivers/media/platform/qcom/venus/pm_helpers.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
> index 8dd5a9b0d060cddfeafd4da477ade0c7aeb6c390..27b033a3a26e0474c37353a0fe7627586e6416e2 100644
> --- a/drivers/media/platform/qcom/venus/pm_helpers.c
> +++ b/drivers/media/platform/qcom/venus/pm_helpers.c
> @@ -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,7 +50,14 @@ static int core_clks_enable(struct venus_core *core)
> int ret;
>
> opp = dev_pm_opp_find_freq_ceil(dev, &freq);
> - dev_pm_opp_put(opp);
> + if (IS_ERR(opp)) {
> + if (!freq_tbl)
> + return -EINVAL;
-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)) {
>
> ---
> base-commit: d086c886ceb9f59dea6c3a9dae7eb89e780a20c9
> change-id: 20250721-fallback_of_opp_table-4ea39376f617
>
> Best regards,
With that changed.
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: venus: pm_helpers: add fallback for the opp-table
2025-07-23 12:56 [PATCH] media: venus: pm_helpers: add fallback for the opp-table Renjiang Han
2025-07-23 12:59 ` Bryan O'Donoghue
@ 2025-07-23 13:01 ` Dmitry Baryshkov
2025-07-23 13:30 ` Konrad Dybcio
2 siblings, 0 replies; 5+ messages in thread
From: Dmitry Baryshkov @ 2025-07-23 13:01 UTC (permalink / raw)
To: Renjiang Han
Cc: quic_qiweil, quic_wangaow, Vikash Garodia, Dikshita Agarwal,
Bryan O'Donoghue, Mauro Carvalho Chehab, linux-media,
linux-arm-msm, linux-kernel
On Wed, Jul 23, 2025 at 06:26:02PM +0530, Renjiang Han wrote:
> 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.
>
> Signed-off-by: Renjiang Han <quic_renjiang@quicinc.com>
> ---
> 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.
> ---
> drivers/media/platform/qcom/venus/pm_helpers.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
Fixes: b179234b5e59 ("media: venus: pm_helpers: use opp-table for the frequency")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: venus: pm_helpers: add fallback for the opp-table
2025-07-23 12:56 [PATCH] media: venus: pm_helpers: add fallback for the opp-table Renjiang Han
2025-07-23 12:59 ` Bryan O'Donoghue
2025-07-23 13:01 ` Dmitry Baryshkov
@ 2025-07-23 13:30 ` Konrad Dybcio
2025-07-23 13:32 ` Konrad Dybcio
2 siblings, 1 reply; 5+ messages in thread
From: Konrad Dybcio @ 2025-07-23 13:30 UTC (permalink / raw)
To: Renjiang Han, quic_qiweil, quic_wangaow, Vikash Garodia,
Dikshita Agarwal, Bryan O'Donoghue, Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel
On 7/23/25 2:56 PM, Renjiang Han wrote:
> 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.
>
> Signed-off-by: Renjiang Han <quic_renjiang@quicinc.com>
> ---
> 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.
> ---
This is not a proper fix, the logic you added in core_get_v4() should
be moved to a common handler
Konrad
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] media: venus: pm_helpers: add fallback for the opp-table
2025-07-23 13:30 ` Konrad Dybcio
@ 2025-07-23 13:32 ` Konrad Dybcio
0 siblings, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2025-07-23 13:32 UTC (permalink / raw)
To: Renjiang Han, quic_qiweil, quic_wangaow, Vikash Garodia,
Dikshita Agarwal, Bryan O'Donoghue, Mauro Carvalho Chehab
Cc: linux-media, linux-arm-msm, linux-kernel
On 7/23/25 3:30 PM, Konrad Dybcio wrote:
> On 7/23/25 2:56 PM, Renjiang Han wrote:
>> 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.
>>
>> Signed-off-by: Renjiang Han <quic_renjiang@quicinc.com>
>> ---
>> 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.
>> ---
>
> This is not a proper fix, the logic you added in core_get_v4() should
> be moved to a common handler
Well, it is a proper fix in the sense that it makes things work, but
you're expanding the delta between the power handling across generations,
even though it's almost the same.. I submitted a series to clean it up
once, but it didn't go anywhere
https://lore.kernel.org/linux-arm-msm/20230911-topic-mars-v3-0-79f23b81c261@linaro.org/
Konrad
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-07-23 13:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-23 12:56 [PATCH] media: venus: pm_helpers: add fallback for the opp-table Renjiang Han
2025-07-23 12:59 ` Bryan O'Donoghue
2025-07-23 13:01 ` Dmitry Baryshkov
2025-07-23 13:30 ` Konrad Dybcio
2025-07-23 13:32 ` Konrad Dybcio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®