Re: [PATCH v4 11/27] venus: core,helpers: add two more clocks found in Venus 4xx

From: Stanimir Varbanov
Date: Mon Jul 02 2018 - 10:01:25 EST


Hi Alex,

Thanks for the review!

On 07/02/2018 11:45 AM, Alexandre Courbot wrote:
> On Thu, Jun 28, 2018 at 12:34 AM Stanimir Varbanov
> <stanimir.varbanov@xxxxxxxxxx> wrote:
>>
>> Add two more clocks for Venus 4xx in core structure and create
>> a new power enable function to handle it for 3xx/4xx versions.
>>
>> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@xxxxxxxxxx>
>> ---
>> drivers/media/platform/qcom/venus/core.h | 4 +++
>> drivers/media/platform/qcom/venus/helpers.c | 51 +++++++++++++++++++++++++++++
>> drivers/media/platform/qcom/venus/helpers.h | 2 ++
>> drivers/media/platform/qcom/venus/vdec.c | 44 ++++++++++++++++++++-----
>> drivers/media/platform/qcom/venus/venc.c | 44 ++++++++++++++++++++-----
>> 5 files changed, 129 insertions(+), 16 deletions(-)
>>

<snip>

>> @@ -1131,15 +1137,21 @@ static int vdec_remove(struct platform_device *pdev)
>> static __maybe_unused int vdec_runtime_suspend(struct device *dev)
>> {
>> struct venus_core *core = dev_get_drvdata(dev);
>> + int ret;
>>
>> - if (core->res->hfi_version == HFI_VERSION_1XX)
>> + if (IS_V1(core))
>> return 0;
>>
>> - writel(0, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL);
>> + ret = venus_helper_power_enable(core, VIDC_SESSION_TYPE_DEC, true);
>> +
>> + if (IS_V4(core))
>> + clk_disable_unprepare(core->core0_bus_clk);
>> +
>> clk_disable_unprepare(core->core0_clk);
>> - writel(1, core->base + WRAPPER_VDEC_VCODEC_POWER_CONTROL);
>>
>> - return 0;
>> + ret |= venus_helper_power_enable(core, VIDC_SESSION_TYPE_DEC, false);
>
> Is it safe to OR two potentially different error messages, at the risk
> of getting a third one that is different?

venus_helper_power_enable can return zero or ETIMEDOUT, but ...

>
> If venus_helper_power_enable() fails, shouldn't we just exit early and
> signify that the suspend operation failed?
>

I had the same comment from Tomasz, hence maybe I'm wrong :) so I will
re-work that and will exit early if error.

--
regards,
Stan