linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: venus: pm_helpers: Unify v3 and v4 venc/vdec_get
@ 2023-08-11 11:12 Konrad Dybcio
  2023-08-11 11:52 ` Bryan O'Donoghue
  0 siblings, 1 reply; 3+ messages in thread
From: Konrad Dybcio @ 2023-08-11 11:12 UTC (permalink / raw)
  To: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
	Andy Gross, Bjorn Andersson, Mauro Carvalho Chehab
  Cc: Marijn Suijten, linux-media, linux-arm-msm, linux-kernel,
	Konrad Dybcio

They do the same thing, except v3 and earlier are expected to have the
old style of bindings (i.e. core clock per core under video-enc/decoder
subnode).

Unify them to stop duplicating needlessly.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
 drivers/media/platform/qcom/venus/pm_helpers.c | 34 ++++++++------------------
 1 file changed, 10 insertions(+), 24 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
index 48c9084bb4db..83d1e68bb9ca 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -295,6 +295,8 @@ static int core_get_v1(struct venus_core *core)
 {
 	int ret;
 
+	legacy_binding = true;
+
 	ret = core_clks_get(core);
 	if (ret)
 		return ret;
@@ -349,6 +351,9 @@ static int vdec_get_v3(struct device *dev)
 {
 	struct venus_core *core = dev_get_drvdata(dev);
 
+	if (!legacy_binding)
+		return 0;
+
 	return vcodec_clks_get(core, dev, core->vcodec0_clks,
 			       core->res->vcodec0_clks);
 }
@@ -374,6 +379,9 @@ static int venc_get_v3(struct device *dev)
 {
 	struct venus_core *core = dev_get_drvdata(dev);
 
+	if (!legacy_binding)
+		return 0;
+
 	return vcodec_clks_get(core, dev, core->vcodec1_clks,
 			       core->res->vcodec1_clks);
 }
@@ -764,17 +772,6 @@ static int coreid_power_v4(struct venus_inst *inst, int on)
 	return ret;
 }
 
-static int vdec_get_v4(struct device *dev)
-{
-	struct venus_core *core = dev_get_drvdata(dev);
-
-	if (!legacy_binding)
-		return 0;
-
-	return vcodec_clks_get(core, dev, core->vcodec0_clks,
-			       core->res->vcodec0_clks);
-}
-
 static void vdec_put_v4(struct device *dev)
 {
 	struct venus_core *core = dev_get_drvdata(dev);
@@ -809,17 +806,6 @@ static int vdec_power_v4(struct device *dev, int on)
 	return ret;
 }
 
-static int venc_get_v4(struct device *dev)
-{
-	struct venus_core *core = dev_get_drvdata(dev);
-
-	if (!legacy_binding)
-		return 0;
-
-	return vcodec_clks_get(core, dev, core->vcodec1_clks,
-			       core->res->vcodec1_clks);
-}
-
 static void venc_put_v4(struct device *dev)
 {
 	struct venus_core *core = dev_get_drvdata(dev);
@@ -1180,10 +1166,10 @@ static const struct venus_pm_ops pm_ops_v4 = {
 	.core_get = core_get_v4,
 	.core_put = core_put_v4,
 	.core_power = core_power_v4,
-	.vdec_get = vdec_get_v4,
+	.vdec_get = vdec_get_v3,
 	.vdec_put = vdec_put_v4,
 	.vdec_power = vdec_power_v4,
-	.venc_get = venc_get_v4,
+	.venc_get = venc_get_v3,
 	.venc_put = venc_put_v4,
 	.venc_power = venc_power_v4,
 	.coreid_power = coreid_power_v4,

---
base-commit: 21ef7b1e17d039053edaeaf41142423810572741
change-id: 20230811-topic-venus_dedup-08f183d3a611

Best regards,
-- 
Konrad Dybcio <konrad.dybcio@linaro.org>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: venus: pm_helpers: Unify v3 and v4 venc/vdec_get
  2023-08-11 11:12 [PATCH] media: venus: pm_helpers: Unify v3 and v4 venc/vdec_get Konrad Dybcio
@ 2023-08-11 11:52 ` Bryan O'Donoghue
  2023-08-11 11:56   ` Konrad Dybcio
  0 siblings, 1 reply; 3+ messages in thread
From: Bryan O'Donoghue @ 2023-08-11 11:52 UTC (permalink / raw)
  To: Konrad Dybcio, Stanimir Varbanov, Vikash Garodia, Andy Gross,
	Bjorn Andersson, Mauro Carvalho Chehab
  Cc: Marijn Suijten, linux-media, linux-arm-msm, linux-kernel

On 11/08/2023 12:12, Konrad Dybcio wrote:
> They do the same thing, except v3 and earlier are expected to have the
> old style of bindings (i.e. core clock per core under video-enc/decoder
> subnode).
> 
> Unify them to stop duplicating needlessly.
> 
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> ---
>   drivers/media/platform/qcom/venus/pm_helpers.c | 34 ++++++++------------------
>   1 file changed, 10 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
> index 48c9084bb4db..83d1e68bb9ca 100644
> --- a/drivers/media/platform/qcom/venus/pm_helpers.c
> +++ b/drivers/media/platform/qcom/venus/pm_helpers.c
> @@ -295,6 +295,8 @@ static int core_get_v1(struct venus_core *core)
>   {
>   	int ret;
>   
> +	legacy_binding = true;
> +
>   	ret = core_clks_get(core);
>   	if (ret)
>   		return ret;
> @@ -349,6 +351,9 @@ static int vdec_get_v3(struct device *dev)
>   {
>   	struct venus_core *core = dev_get_drvdata(dev);
>   
> +	if (!legacy_binding)
> +		return 0;
> +
>   	return vcodec_clks_get(core, dev, core->vcodec0_clks,
>   			       core->res->vcodec0_clks);
>   }
> @@ -374,6 +379,9 @@ static int venc_get_v3(struct device *dev)
>   {
>   	struct venus_core *core = dev_get_drvdata(dev);
>   
> +	if (!legacy_binding)
> +		return 0;
> +
>   	return vcodec_clks_get(core, dev, core->vcodec1_clks,
>   			       core->res->vcodec1_clks);
>   }
> @@ -764,17 +772,6 @@ static int coreid_power_v4(struct venus_inst *inst, int on)
>   	return ret;
>   }
>   
> -static int vdec_get_v4(struct device *dev)
> -{
> -	struct venus_core *core = dev_get_drvdata(dev);
> -
> -	if (!legacy_binding)
> -		return 0;
> -
> -	return vcodec_clks_get(core, dev, core->vcodec0_clks,
> -			       core->res->vcodec0_clks);
> -}
> -
>   static void vdec_put_v4(struct device *dev)
>   {
>   	struct venus_core *core = dev_get_drvdata(dev);
> @@ -809,17 +806,6 @@ static int vdec_power_v4(struct device *dev, int on)
>   	return ret;
>   }
>   
> -static int venc_get_v4(struct device *dev)
> -{
> -	struct venus_core *core = dev_get_drvdata(dev);
> -
> -	if (!legacy_binding)
> -		return 0;
> -
> -	return vcodec_clks_get(core, dev, core->vcodec1_clks,
> -			       core->res->vcodec1_clks);
> -}
> -
>   static void venc_put_v4(struct device *dev)
>   {
>   	struct venus_core *core = dev_get_drvdata(dev);
> @@ -1180,10 +1166,10 @@ static const struct venus_pm_ops pm_ops_v4 = {
>   	.core_get = core_get_v4,
>   	.core_put = core_put_v4,
>   	.core_power = core_power_v4,
> -	.vdec_get = vdec_get_v4,
> +	.vdec_get = vdec_get_v3,
>   	.vdec_put = vdec_put_v4,
>   	.vdec_power = vdec_power_v4,
> -	.venc_get = venc_get_v4,
> +	.venc_get = venc_get_v3,
>   	.venc_put = venc_put_v4,
>   	.venc_power = venc_power_v4,
>   	.coreid_power = coreid_power_v4,
> 
> ---
> base-commit: 21ef7b1e17d039053edaeaf41142423810572741
> change-id: 20230811-topic-venus_dedup-08f183d3a611
> 
> Best regards,

This makes sense.

It'd be nice to get rid of the top-level static bool and bury it in the 
core venus structure but, that's not a problem with your patch.

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] media: venus: pm_helpers: Unify v3 and v4 venc/vdec_get
  2023-08-11 11:52 ` Bryan O'Donoghue
@ 2023-08-11 11:56   ` Konrad Dybcio
  0 siblings, 0 replies; 3+ messages in thread
From: Konrad Dybcio @ 2023-08-11 11:56 UTC (permalink / raw)
  To: Bryan O'Donoghue, Stanimir Varbanov, Vikash Garodia,
	Andy Gross, Bjorn Andersson, Mauro Carvalho Chehab
  Cc: Marijn Suijten, linux-media, linux-arm-msm, linux-kernel

On 11.08.2023 13:52, Bryan O'Donoghue wrote:
> On 11/08/2023 12:12, Konrad Dybcio wrote:
>> They do the same thing, except v3 and earlier are expected to have the
>> old style of bindings (i.e. core clock per core under video-enc/decoder
>> subnode).
>>
>> Unify them to stop duplicating needlessly.
>>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
>> ---
>>   drivers/media/platform/qcom/venus/pm_helpers.c | 34 ++++++++------------------
>>   1 file changed, 10 insertions(+), 24 deletions(-)
>>
>> diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
>> index 48c9084bb4db..83d1e68bb9ca 100644
>> --- a/drivers/media/platform/qcom/venus/pm_helpers.c
>> +++ b/drivers/media/platform/qcom/venus/pm_helpers.c
>> @@ -295,6 +295,8 @@ static int core_get_v1(struct venus_core *core)
>>   {
>>       int ret;
>>   +    legacy_binding = true;
>> +
>>       ret = core_clks_get(core);
>>       if (ret)
>>           return ret;
>> @@ -349,6 +351,9 @@ static int vdec_get_v3(struct device *dev)
>>   {
>>       struct venus_core *core = dev_get_drvdata(dev);
>>   +    if (!legacy_binding)
>> +        return 0;
>> +
>>       return vcodec_clks_get(core, dev, core->vcodec0_clks,
>>                      core->res->vcodec0_clks);
>>   }
>> @@ -374,6 +379,9 @@ static int venc_get_v3(struct device *dev)
>>   {
>>       struct venus_core *core = dev_get_drvdata(dev);
>>   +    if (!legacy_binding)
>> +        return 0;
>> +
>>       return vcodec_clks_get(core, dev, core->vcodec1_clks,
>>                      core->res->vcodec1_clks);
>>   }
>> @@ -764,17 +772,6 @@ static int coreid_power_v4(struct venus_inst *inst, int on)
>>       return ret;
>>   }
>>   -static int vdec_get_v4(struct device *dev)
>> -{
>> -    struct venus_core *core = dev_get_drvdata(dev);
>> -
>> -    if (!legacy_binding)
>> -        return 0;
>> -
>> -    return vcodec_clks_get(core, dev, core->vcodec0_clks,
>> -                   core->res->vcodec0_clks);
>> -}
>> -
>>   static void vdec_put_v4(struct device *dev)
>>   {
>>       struct venus_core *core = dev_get_drvdata(dev);
>> @@ -809,17 +806,6 @@ static int vdec_power_v4(struct device *dev, int on)
>>       return ret;
>>   }
>>   -static int venc_get_v4(struct device *dev)
>> -{
>> -    struct venus_core *core = dev_get_drvdata(dev);
>> -
>> -    if (!legacy_binding)
>> -        return 0;
>> -
>> -    return vcodec_clks_get(core, dev, core->vcodec1_clks,
>> -                   core->res->vcodec1_clks);
>> -}
>> -
>>   static void venc_put_v4(struct device *dev)
>>   {
>>       struct venus_core *core = dev_get_drvdata(dev);
>> @@ -1180,10 +1166,10 @@ static const struct venus_pm_ops pm_ops_v4 = {
>>       .core_get = core_get_v4,
>>       .core_put = core_put_v4,
>>       .core_power = core_power_v4,
>> -    .vdec_get = vdec_get_v4,
>> +    .vdec_get = vdec_get_v3,
>>       .vdec_put = vdec_put_v4,
>>       .vdec_power = vdec_power_v4,
>> -    .venc_get = venc_get_v4,
>> +    .venc_get = venc_get_v3,
>>       .venc_put = venc_put_v4,
>>       .venc_power = venc_power_v4,
>>       .coreid_power = coreid_power_v4,
>>
>> ---
>> base-commit: 21ef7b1e17d039053edaeaf41142423810572741
>> change-id: 20230811-topic-venus_dedup-08f183d3a611
>>
>> Best regards,
> 
> This makes sense.
> 
> It'd be nice to get rid of the top-level static bool and bury it in the core venus structure but, that's not a problem with your patch.
That's the plan, just that untangling this mess will take some time

Konrad

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-11 11:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-11 11:12 [PATCH] media: venus: pm_helpers: Unify v3 and v4 venc/vdec_get Konrad Dybcio
2023-08-11 11:52 ` Bryan O'Donoghue
2023-08-11 11:56   ` Konrad Dybcio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).