mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bod@kernel.org>
To: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
	Renjiang Han <quic_renjiang@quicinc.com>,
	Stanimir Varbanov <stanimir.k.varbanov@gmail.com>,
	Vikash Garodia <quic_vgarodia@quicinc.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 2/4] media: venus: pm_helpers: use opp-table for the frequency
Date: Mon, 7 Apr 2025 16:39:26 +0100	[thread overview]
Message-ID: <6f11921a-4ee8-4f40-9131-529f548f681a@kernel.org> (raw)
In-Reply-To: <ac145c57-1db3-4747-88e2-02825f958d5a@oss.qualcomm.com>

On 09/01/2025 13:05, Konrad Dybcio wrote:
> On 2.01.2025 6:38 AM, Renjiang Han wrote:
>>
>> On 12/23/2024 10:17 PM, Konrad Dybcio wrote:
>>> On 19.12.2024 6:41 AM, Renjiang Han wrote:
>>>> The frequency value in the opp-table in the device tree and the freq_tbl
>>>> in the driver are the same.
>>>>
>>>> Therefore, update pm_helpers.c to use the opp-table for frequency values
>>>> for the v4 core.
>>>> If getting data from the opp table fails, fall back to using the frequency
>>>> table.
>>>>
>>>> Signed-off-by: Renjiang Han<quic_renjiang@quicinc.com>
>>>> ---
>>>>    drivers/media/platform/qcom/venus/pm_helpers.c | 53 +++++++++++++++++++-------
>>>>    1 file changed, 39 insertions(+), 14 deletions(-)
>>>>
>>>> diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
>>>> index 33a5a659c0ada0ca97eebb5522c5f349f95c49c7..b61c0ad152878870b7223efa274e137d3636433b 100644
>>>> --- a/drivers/media/platform/qcom/venus/pm_helpers.c
>>>> +++ b/drivers/media/platform/qcom/venus/pm_helpers.c
>>>> @@ -43,14 +43,20 @@ static int core_clks_enable(struct venus_core *core)
>>>>        const struct venus_resources *res = core->res;
>>>>        const struct freq_tbl *freq_tbl = core->res->freq_tbl;
>>>>        unsigned int freq_tbl_size = core->res->freq_tbl_size;
>>>> +    struct device *dev = core->dev;
>>>> +    struct dev_pm_opp *opp;
>>>>        unsigned long freq;
>>>>        unsigned int i;
>>>>        int ret;
>>>>    -    if (!freq_tbl)
>>>> -        return -EINVAL;
>>>> -
>>>> -    freq = freq_tbl[freq_tbl_size - 1].freq;
>>>> +    opp = dev_pm_opp_find_freq_ceil(dev, &freq);
>>>> +    if (IS_ERR(opp)) {
>>>> +        if (!freq_tbl)
>>>> +            return -EINVAL;
>>>> +        freq = freq_tbl[freq_tbl_size - 1].freq;
>>>> +    } else {
>>>> +        dev_pm_opp_put(opp);
>>>> +    }
>>> I'm not super convinced how this could have ever worked without
>>> scaling voltage levels, by the way. Perhaps this will squash some
>>> random bugs :|
>>>
>>> Konrad
>>   Thanks for your comment.
>>   The default value of freq is 0, and then dev_pm_opp_find_freq_ceil is
>>   used to match freq to the maximum value in opp-table that is close to
>>   0. The frequency values ​​in opp-table and freq_tbl are the same, and
>>   dev_pm_opp_find_freq_ceil is used to assign the minimum value in
>>   opp-table to freq. So the logic is the same as before. I'm not sure if
>>   I've answered your concern.
> 
> We talked offline, but for the record: my concern here was about
> clk_set_rate() not scaling RPM/h voltage corners, which this patch
> fixes
> 
> Konrad

Konrad is this an RB from you, do you have any other concerns with this 
code ?

Dikshita, Vikash ?

I'll give it a test myself ASAP but any other comments or R/B would be 
helpful.

---
bod

  reply	other threads:[~2025-04-07 15:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-19  5:41 [PATCH v6 0/4] media: venus: enable venus on qcs615 Renjiang Han
2024-12-19  5:41 ` [PATCH v6 1/4] dt-bindings: media: add support for video hardware on QCS615 platform Renjiang Han
2024-12-19  8:19   ` Krzysztof Kozlowski
2024-12-19  8:34     ` Renjiang Han
2024-12-19  5:41 ` [PATCH v6 2/4] media: venus: pm_helpers: use opp-table for the frequency Renjiang Han
2024-12-23 14:17   ` Konrad Dybcio
2025-01-02  5:38     ` Renjiang Han
2025-01-09 13:05       ` Konrad Dybcio
2025-04-07 15:39         ` Bryan O'Donoghue [this message]
2025-04-08  9:13           ` Vikash Garodia
2025-04-09 19:17           ` Konrad Dybcio
2025-04-08  9:14   ` Vikash Garodia
2024-12-19  5:41 ` [PATCH v6 3/4] arm64: dts: qcom: qcs615: add venus node to devicetree Renjiang Han
2024-12-19  5:41 ` [PATCH v6 4/4] arm64: dts: qcom: qcs615-ride: enable venus node to initialize video codec Renjiang Han
2025-05-22 18:53   ` Nicolas Dufresne
2024-12-26 22:19 ` [PATCH v6 0/4] media: venus: enable venus on qcs615 Bjorn Andersson
2024-12-31  2:12   ` Renjiang Han
2025-09-09 16:56 ` (subset) " Bjorn Andersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6f11921a-4ee8-4f40-9131-529f548f681a@kernel.org \
    --to=bod@kernel.org \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konrad.dybcio@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=quic_renjiang@quicinc.com \
    --cc=quic_vgarodia@quicinc.com \
    --cc=robh@kernel.org \
    --cc=stanimir.k.varbanov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®