Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: neil.armstrong@linaro.org
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Vikash Garodia <quic_vgarodia@quicinc.com>,
	Dikshita Agarwal <quic_dikshita@quicinc.com>,
	Abhinav Kumar <quic_abhinavk@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>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] media: platform: qcom/iris: add reset_controller & power_off_controller to vpu_ops
Date: Tue, 25 Feb 2025 19:10:00 +0100	[thread overview]
Message-ID: <9cf6e092-db2d-4d49-90c3-d8a62658b2f8@linaro.org> (raw)
In-Reply-To: <5mnho424mrrj2fwrtbdzjtkgvhlmoxcy5ba2rjjn4hvrgbmco7@7q6ezfbgi6m4>

On 25/02/2025 19:06, Dmitry Baryshkov wrote:
> On Tue, Feb 25, 2025 at 06:55:58PM +0100, neil.armstrong@linaro.org wrote:
>> On 25/02/2025 11:41, Dmitry Baryshkov wrote:
>>> On Tue, 25 Feb 2025 at 12:04, Neil Armstrong <neil.armstrong@linaro.org> wrote:
>>>>
>>>> On 25/02/2025 11:02, Dmitry Baryshkov wrote:
>>>>> On Tue, Feb 25, 2025 at 10:05:10AM +0100, Neil Armstrong wrote:
>>>>>> In order to support the SM8650 iris33 hardware, we need to provide specific
>>>>>> reset and constoller power off sequences via the vpu_ops callbacks.
>>>>>>
>>>>>> Add those callbacks, and use the current helpers for currently supported
>>>>>> platforms.
>>>>>>
>>>>>> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
>>>>>> ---
>>>>>>     drivers/media/platform/qcom/iris/iris_vpu2.c       |  2 ++
>>>>>>     drivers/media/platform/qcom/iris/iris_vpu3.c       |  2 ++
>>>>>>     drivers/media/platform/qcom/iris/iris_vpu_common.c | 14 ++++++++++----
>>>>>>     drivers/media/platform/qcom/iris/iris_vpu_common.h |  4 ++++
>>>>>>     4 files changed, 18 insertions(+), 4 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/media/platform/qcom/iris/iris_vpu2.c b/drivers/media/platform/qcom/iris/iris_vpu2.c
>>>>>> index 8f502aed43ce2fa6a272a2ce14ff1ca54d3e63a2..093e2068ec35e902f6c7bb3a487a679f9eada39a 100644
>>>>>> --- a/drivers/media/platform/qcom/iris/iris_vpu2.c
>>>>>> +++ b/drivers/media/platform/qcom/iris/iris_vpu2.c
>>>>>> @@ -33,6 +33,8 @@ static u64 iris_vpu2_calc_freq(struct iris_inst *inst, size_t data_size)
>>>>>>     }
>>>>>>
>>>>>>     const struct vpu_ops iris_vpu2_ops = {
>>>>>> +    .reset_controller = iris_vpu_reset_controller,
>>>>>>        .power_off_hw = iris_vpu_power_off_hw,
>>>>>> +    .power_off_controller = iris_vpu_power_off_controller,
>>>>>>        .calc_freq = iris_vpu2_calc_freq,
>>>>>>     };
>>>>>> diff --git a/drivers/media/platform/qcom/iris/iris_vpu3.c b/drivers/media/platform/qcom/iris/iris_vpu3.c
>>>>>> index b484638e6105a69319232f667ee7ae95e3853698..95f362633c95b101ecfda6480c4c0b73416bd00c 100644
>>>>>> --- a/drivers/media/platform/qcom/iris/iris_vpu3.c
>>>>>> +++ b/drivers/media/platform/qcom/iris/iris_vpu3.c
>>>>>> @@ -117,6 +117,8 @@ static u64 iris_vpu3_calculate_frequency(struct iris_inst *inst, size_t data_siz
>>>>>>     }
>>>>>>
>>>>>>     const struct vpu_ops iris_vpu3_ops = {
>>>>>> +    .reset_controller = iris_vpu_reset_controller,
>>>>>>        .power_off_hw = iris_vpu3_power_off_hardware,
>>>>>> +    .power_off_controller = iris_vpu_power_off_controller,
>>>>>>        .calc_freq = iris_vpu3_calculate_frequency,
>>>>>>     };
>>>>>> diff --git a/drivers/media/platform/qcom/iris/iris_vpu_common.c b/drivers/media/platform/qcom/iris/iris_vpu_common.c
>>>>>> index fe9896d66848cdcd8c67bd45bbf3b6ce4a01ab10..ec8b10d836d0993bcd722a2bafbb577b85f41fc9 100644
>>>>>> --- a/drivers/media/platform/qcom/iris/iris_vpu_common.c
>>>>>> +++ b/drivers/media/platform/qcom/iris/iris_vpu_common.c
>>>>>> @@ -211,7 +211,7 @@ int iris_vpu_prepare_pc(struct iris_core *core)
>>>>>>        return -EAGAIN;
>>>>>>     }
>>>>>>
>>>>>> -static int iris_vpu_power_off_controller(struct iris_core *core)
>>>>>> +int iris_vpu_power_off_controller(struct iris_core *core)
>>>>>>     {
>>>>>>        u32 val = 0;
>>>>>>        int ret;
>>>>>> @@ -264,23 +264,29 @@ void iris_vpu_power_off(struct iris_core *core)
>>>>>>     {
>>>>>>        dev_pm_opp_set_rate(core->dev, 0);
>>>>>>        core->iris_platform_data->vpu_ops->power_off_hw(core);
>>>>>> -    iris_vpu_power_off_controller(core);
>>>>>> +    core->iris_platform_data->vpu_ops->power_off_controller(core);
>>>>>>        iris_unset_icc_bw(core);
>>>>>>
>>>>>>        if (!iris_vpu_watchdog(core, core->intr_status))
>>>>>>                disable_irq_nosync(core->irq);
>>>>>>     }
>>>>>>
>>>>>> -static int iris_vpu_power_on_controller(struct iris_core *core)
>>>>>> +int iris_vpu_reset_controller(struct iris_core *core)
>>>>>
>>>>> If these functions are platform-specific, please rename them
>>>>> accordingly, like iris_vpu2_3_foo() or just iris_vpu2_foo().
>>>>
>>>> They are not, this is the whole point.
>>>
>>> I think they are, you are adding them to the platform-specific ops. In
>>> the end, they are not applicable to 3.3.
>>
>> Vpu 3.3 is added on the next patch, with specific callbacks
>> for 3.3, this very patch has no functional change, it still uses
>> the same "common" reset and controller power off for vpu2 and vpu3.
>>
>> This very patch is a preparation for vpu33, using common helpers
>> in vpu_ops is already done in the vpu2 support, I simply extend
>> the same logic here.
> 
> I'd really expect that iris_vpu_foo() functions apply to every platform.
> These functions are now being used for VPU2 and VPU3 only. Thus I assume
> that they are platform specific and should have platform-specific
> prefix.

Thanks for your advice, but I followed the code and naming style of
the current merged driver, perhaps Dikshita will give some suggestions
on how the naming should be done in this case.

Neil

> 
>>
>> Neil
>>
>>>
>>>>
>>>> Neil
>>>>
>>>>>
>>>>>>     {
>>>>>>        u32 rst_tbl_size = core->iris_platform_data->clk_rst_tbl_size;
>>>>>> +
>>>>>> +    return reset_control_bulk_reset(rst_tbl_size, core->resets);
>>>>>> +}
>>>>>> +
>>>>>> +static int iris_vpu_power_on_controller(struct iris_core *core)
>>>>>> +{
>>>>>>        int ret;
>>>>>>
>>>>>>        ret = iris_enable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_POWER_DOMAIN]);
>>>>>>        if (ret)
>>>>>>                return ret;
>>>>>>
>>>>>> -    ret = reset_control_bulk_reset(rst_tbl_size, core->resets);
>>>>>> +    ret = core->iris_platform_data->vpu_ops->reset_controller(core);
>>>>>>        if (ret)
>>>>>>                goto err_disable_power;
>>>>>>
>>>>>> diff --git a/drivers/media/platform/qcom/iris/iris_vpu_common.h b/drivers/media/platform/qcom/iris/iris_vpu_common.h
>>>>>> index 63fa1fa5a4989e48aebdb6c7619c140000c0b44c..c948d8b5aee87ccf1fd53c5518a27294232d8fb8 100644
>>>>>> --- a/drivers/media/platform/qcom/iris/iris_vpu_common.h
>>>>>> +++ b/drivers/media/platform/qcom/iris/iris_vpu_common.h
>>>>>> @@ -12,7 +12,9 @@ extern const struct vpu_ops iris_vpu2_ops;
>>>>>>     extern const struct vpu_ops iris_vpu3_ops;
>>>>>>
>>>>>>     struct vpu_ops {
>>>>>> +    int (*reset_controller)(struct iris_core *core);
>>>>>>        void (*power_off_hw)(struct iris_core *core);
>>>>>> +    int (*power_off_controller)(struct iris_core *core);
>>>>>>        u64 (*calc_freq)(struct iris_inst *inst, size_t data_size);
>>>>>>     };
>>>>>>
>>>>>> @@ -21,7 +23,9 @@ void iris_vpu_raise_interrupt(struct iris_core *core);
>>>>>>     void iris_vpu_clear_interrupt(struct iris_core *core);
>>>>>>     int iris_vpu_watchdog(struct iris_core *core, u32 intr_status);
>>>>>>     int iris_vpu_prepare_pc(struct iris_core *core);
>>>>>> +int iris_vpu_reset_controller(struct iris_core *core);
>>>>>>     int iris_vpu_power_on(struct iris_core *core);
>>>>>> +int iris_vpu_power_off_controller(struct iris_core *core);
>>>>>>     void iris_vpu_power_off_hw(struct iris_core *core);
>>>>>>     void iris_vpu_power_off(struct iris_core *core);
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 2.34.1
>>>>>>
>>>>>
>>>>
>>>
>>>
>>
> 


  reply	other threads:[~2025-02-25 18:10 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-25  9:05 [PATCH 0/4] media: qcom: iris: add support for SM8650 Neil Armstrong
2025-02-25  9:05 ` [PATCH 1/4] dt-bindings: media: qcom,sm8550-iris: document SM8650 IRIS accelerator Neil Armstrong
2025-02-25 17:15   ` Rob Herring (Arm)
2025-02-28 12:21   ` Dikshita Agarwal
2025-03-03 16:54     ` Neil Armstrong
2025-03-03 17:16     ` Krzysztof Kozlowski
2025-02-25  9:05 ` [PATCH 2/4] media: platform: qcom/iris: add reset_controller & power_off_controller to vpu_ops Neil Armstrong
2025-02-25 10:02   ` Dmitry Baryshkov
2025-02-25 10:03     ` Neil Armstrong
2025-02-25 10:41       ` Dmitry Baryshkov
2025-02-25 17:55         ` neil.armstrong
2025-02-25 18:06           ` Dmitry Baryshkov
2025-02-25 18:10             ` neil.armstrong [this message]
2025-02-25 21:04               ` Dmitry Baryshkov
2025-02-25  9:05 ` [PATCH 3/4] media: platform: qcom/iris: add support for vpu33 Neil Armstrong
2025-02-28 11:39   ` Dikshita Agarwal
2025-02-28 12:33     ` Neil Armstrong
2025-03-03 17:03     ` Neil Armstrong
2025-03-04  8:38       ` Dikshita Agarwal
2025-03-04  9:38         ` neil.armstrong
2025-02-28 12:09   ` Vikash Garodia
2025-02-28 12:36     ` Neil Armstrong
2025-02-28 16:38   ` Philipp Zabel
2025-03-03 16:59     ` Neil Armstrong
2025-02-25  9:05 ` [PATCH 4/4] media: platform: qcom/iris: add sm8650 support Neil Armstrong
2025-02-28 12:15   ` Dikshita Agarwal
2025-02-28 12:35     ` Neil Armstrong
2025-02-28 13:35       ` Vikash Garodia
2025-02-28 13:40         ` neil.armstrong
2025-02-28 13:52           ` Vikash Garodia

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=9cf6e092-db2d-4d49-90c3-d8a62658b2f8@linaro.org \
    --to=neil.armstrong@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.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=p.zabel@pengutronix.de \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_dikshita@quicinc.com \
    --cc=quic_vgarodia@quicinc.com \
    --cc=robh@kernel.org \
    /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