[PATCH v2] media: venus: pm_helpers: add fallback for the opp-table

Renjiang Han posted 1 patch 4 months, 4 weeks ago
There is a newer version of this series
drivers/media/platform/qcom/venus/pm_helpers.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
[PATCH v2] media: venus: pm_helpers: add fallback for the opp-table
Posted by Renjiang Han 4 months, 4 weeks ago
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.

Fixes: b179234b5e59 ("media: venus: pm_helpers: use opp-table for the frequency")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
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.
---
Changes in v2:
- 1. Update the returned error value as per the feedback.
- Link to v1: https://lore.kernel.org/r/20250723-fallback_of_opp_table-v1-1-20a6277fdded@quicinc.com
---
 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..77c12273dbb9505244e260fc8fa635e4fe045236 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 -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,
-- 
Renjiang Han <quic_renjiang@quicinc.com>
Re: [PATCH v2] media: venus: pm_helpers: add fallback for the opp-table
Posted by Bryan O'Donoghue 4 months, 3 weeks ago
On 24/07/2025 08:53, 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.
> 
> Fixes: b179234b5e59 ("media: venus: pm_helpers: use opp-table for the frequency")
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> 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.
> ---
> Changes in v2:
> - 1. Update the returned error value as per the feedback.
> - Link to v1: https://lore.kernel.org/r/20250723-fallback_of_opp_table-v1-1-20a6277fdded@quicinc.com
> ---
>   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..77c12273dbb9505244e260fc8fa635e4fe045236 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 -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,

Note to self add a

Closes: CA+G9fYu5=3n84VY+vTbCAcfFKOq7Us5vgBZgpypY4MveM=eVwg@mail.gmail.com

---
bod
Re: [PATCH v2] media: venus: pm_helpers: add fallback for the opp-table
Posted by Renjiang Han 3 months, 2 weeks ago
On 7/28/2025 11:20 PM, Bryan O'Donoghue wrote:
> On 24/07/2025 08:53, 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.
>>
>> Fixes: b179234b5e59 ("media: venus: pm_helpers: use opp-table for the 
>> frequency")
>> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
>> 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.
>> ---
>> Changes in v2:
>> - 1. Update the returned error value as per the feedback.
>> - Link to v1: 
>> https://lore.kernel.org/r/20250723-fallback_of_opp_table-v1-1-20a6277fdded@quicinc.com
>> ---
>>   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..77c12273dbb9505244e260fc8fa635e4fe045236 
>> 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 -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,
>
> Note to self add a
>
> Closes: CA+G9fYu5=3n84VY+vTbCAcfFKOq7Us5vgBZgpypY4MveM=eVwg@mail.gmail.com
Thanks for helping review this patch. But I'm sorry, may I ask how to
understand this comment?

This patch has not been picked yet.Is there anything else I need to do?
>
>
> ---
> bod

-- 
Best Regards,
Renjiang

Re: [PATCH v2] media: venus: pm_helpers: add fallback for the opp-table
Posted by Renjiang Han 3 months ago
On 9/4/2025 11:33 AM, Renjiang Han wrote:
>
> On 7/28/2025 11:20 PM, Bryan O'Donoghue wrote:
>> On 24/07/2025 08:53, 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.
>>>
>>> Fixes: b179234b5e59 ("media: venus: pm_helpers: use opp-table for 
>>> the frequency")
>>> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>>> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
>>> 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.
>>> ---
>>> Changes in v2:
>>> - 1. Update the returned error value as per the feedback.
>>> - Link to v1: 
>>> https://lore.kernel.org/r/20250723-fallback_of_opp_table-v1-1-20a6277fdded@quicinc.com
>>> ---
>>>   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..77c12273dbb9505244e260fc8fa635e4fe045236 
>>> 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 -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,
>>
>> Note to self add a
>>
>> Closes: 
>> CA+G9fYu5=3n84VY+vTbCAcfFKOq7Us5vgBZgpypY4MveM=eVwg@mail.gmail.com
> Thanks for helping review this patch. But I'm sorry, may I ask how to
> understand this comment?
>
> This patch has not been picked yet.Is there anything else I need to do?
I’d appreciate any thoughts you might have on this.
>>
>>
>> ---
>> bod
>
-- 
Best Regards,
Renjiang

Re: [PATCH v2] media: venus: pm_helpers: add fallback for the opp-table
Posted by Bryan O'Donoghue 3 months ago
On 18/09/2025 11:21, Renjiang Han wrote:
> 
> On 9/4/2025 11:33 AM, Renjiang Han wrote:
>>
>> On 7/28/2025 11:20 PM, Bryan O'Donoghue wrote:
>>> On 24/07/2025 08:53, 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.
>>>>
>>>> Fixes: b179234b5e59 ("media: venus: pm_helpers: use opp-table for 
>>>> the frequency")
>>>> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>>>> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
>>>> 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.
>>>> ---
>>>> Changes in v2:
>>>> - 1. Update the returned error value as per the feedback.
>>>> - Link to v1: https://lore.kernel.org/r/20250723- 
>>>> fallback_of_opp_table-v1-1-20a6277fdded@quicinc.com
>>>> ---
>>>>   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..77c12273dbb9505244e260fc8fa635e4fe045236 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 -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,
>>>
>>> Note to self add a
>>>
>>> Closes: 
>>> CA+G9fYu5=3n84VY+vTbCAcfFKOq7Us5vgBZgpypY4MveM=eVwg@mail.gmail.com
>> Thanks for helping review this patch. But I'm sorry, may I ask how to
>> understand this comment?
>>
>> This patch has not been picked yet.Is there anything else I need to do?
> I’d appreciate any thoughts you might have on this.
>>>
>>>
>>> ---
>>> bod
>>

Marked as "Not applicable" on media-ci patchwork - you should have 
received an email about that.

* 7881cd6886a89 - media: venus: Fix OPP table error handling (6 weeks ago)
* b179234b5e590 - media: venus: pm_helpers: use opp-table for the 
frequency (3 months ago)
* 14423fc3a4a21 - media: venus: pm_helpers: add compatibility for 
dev_pm_genpd_set_hwmode on V4 (5 months ago)

git checkout -b linux-next/master-25-09-18 linux-next/master
Updating files: 100% (10211/10211), done.
branch 'linux-next/master-25-09-18' set up to track 'linux-next/master'.

b4 shazam b4e25dd2-caf3-48f0-8e1b-622f3db1b7ca@quicinc.com
Grabbing thread from 
lore.kernel.org/all/b4e25dd2-caf3-48f0-8e1b-622f3db1b7ca@quicinc.com/t.mbox.gz
Checking for newer revisions
Grabbing search results from lore.kernel.org
Analyzing 5 messages in the thread
Looking for additional code-review trailers on lore.kernel.org
Analyzing 0 code-review messages
Checking attestation on all messages, may take a moment...
---
   ✓ [PATCH v2] media: venus: pm_helpers: add fallback for the opp-table
     + Closes: 
CA+G9fYu5=3n84VY+vTbCAcfFKOq7Us5vgBZgpypY4MveM=eVwg@mail.gmail.com (✗ 
DKIM/linaro.org)
     + Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com> (✓ 
DKIM/quicinc.com)
   ---
   ✗ No key: ed25519/quic_renjiang@quicinc.com
   ✓ Signed: DKIM/quicinc.com
---
Total patches: 1
---
  Base: using specified base-commit d086c886ceb9f59dea6c3a9dae7eb89e780a20c9
Applying: media: venus: pm_helpers: add fallback for the opp-table
Patch failed at 0001 media: venus: pm_helpers: add fallback for the 
opp-table
error: patch failed: drivers/media/platform/qcom/venus/pm_helpers.c:48
error: drivers/media/platform/qcom/venus/pm_helpers.c: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am 
--abort".
hint: Disable this message with "git config set advice.mergeConflict false"

---
bod
Re: [PATCH v2] media: venus: pm_helpers: add fallback for the opp-table
Posted by Bryan O'Donoghue 3 months ago
On 18/09/2025 11:33, Bryan O'Donoghue wrote:
> On 18/09/2025 11:21, Renjiang Han wrote:
>>
>> On 9/4/2025 11:33 AM, Renjiang Han wrote:
>>>
>>> On 7/28/2025 11:20 PM, Bryan O'Donoghue wrote:
>>>> On 24/07/2025 08:53, 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.
>>>>>
>>>>> Fixes: b179234b5e59 ("media: venus: pm_helpers: use opp-table for 
>>>>> the frequency")
>>>>> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>>>>> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
>>>>> 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.
>>>>> ---
>>>>> Changes in v2:
>>>>> - 1. Update the returned error value as per the feedback.
>>>>> - Link to v1: https://lore.kernel.org/r/20250723- 
>>>>> fallback_of_opp_table-v1-1-20a6277fdded@quicinc.com
>>>>> ---
>>>>>   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..77c12273dbb9505244e260fc8fa635e4fe045236 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 -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,
>>>>
>>>> Note to self add a
>>>>
>>>> Closes: 
>>>> CA+G9fYu5=3n84VY+vTbCAcfFKOq7Us5vgBZgpypY4MveM=eVwg@mail.gmail.com
>>> Thanks for helping review this patch. But I'm sorry, may I ask how to
>>> understand this comment?
>>>
>>> This patch has not been picked yet.Is there anything else I need to do?
>> I’d appreciate any thoughts you might have on this.
>>>>
>>>>
>>>> ---
>>>> bod
>>>
> 
> Marked as "Not applicable" on media-ci patchwork - you should have 
> received an email about that.
> 
> * 7881cd6886a89 - media: venus: Fix OPP table error handling (6 weeks ago)
> * b179234b5e590 - media: venus: pm_helpers: use opp-table for the 
> frequency (3 months ago)
> * 14423fc3a4a21 - media: venus: pm_helpers: add compatibility for 
> dev_pm_genpd_set_hwmode on V4 (5 months ago)
> 
> git checkout -b linux-next/master-25-09-18 linux-next/master
> Updating files: 100% (10211/10211), done.
> branch 'linux-next/master-25-09-18' set up to track 'linux-next/master'.
> 
> b4 shazam b4e25dd2-caf3-48f0-8e1b-622f3db1b7ca@quicinc.com
> Grabbing thread from lore.kernel.org/all/b4e25dd2- 
> caf3-48f0-8e1b-622f3db1b7ca@quicinc.com/t.mbox.gz
> Checking for newer revisions
> Grabbing search results from lore.kernel.org
> Analyzing 5 messages in the thread
> Looking for additional code-review trailers on lore.kernel.org
> Analyzing 0 code-review messages
> Checking attestation on all messages, may take a moment...
> ---
>    ✓ [PATCH v2] media: venus: pm_helpers: add fallback for the opp-table
>      + Closes: 
> CA+G9fYu5=3n84VY+vTbCAcfFKOq7Us5vgBZgpypY4MveM=eVwg@mail.gmail.com (✗ 
> DKIM/linaro.org)
>      + Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com> (✓ DKIM/ 
> quicinc.com)
>    ---
>    ✗ No key: ed25519/quic_renjiang@quicinc.com
>    ✓ Signed: DKIM/quicinc.com
> ---
> Total patches: 1
> ---
>   Base: using specified base-commit 
> d086c886ceb9f59dea6c3a9dae7eb89e780a20c9
> Applying: media: venus: pm_helpers: add fallback for the opp-table
> Patch failed at 0001 media: venus: pm_helpers: add fallback for the opp- 
> table
> error: patch failed: drivers/media/platform/qcom/venus/pm_helpers.c:48
> error: drivers/media/platform/qcom/venus/pm_helpers.c: patch does not apply
> hint: Use 'git am --show-current-patch=diff' to see the failed patch
> hint: When you have resolved this problem, run "git am --continue".
> hint: If you prefer to skip this patch, run "git am --skip" instead.
> hint: To restore the original branch and stop patching, run "git am -- 
> abort".
> hint: Disable this message with "git config set advice.mergeConflict false"
> 
> ---
> bod

"Not Applicable" -> "Changes Requested"

---
bod
Re: [PATCH v2] media: venus: pm_helpers: add fallback for the opp-table
Posted by Vikash Garodia 4 months, 4 weeks ago
On 7/24/2025 1:23 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.
> 
> Fixes: b179234b5e59 ("media: venus: pm_helpers: use opp-table for the frequency")
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> 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.

Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com>