[0/6] SM8350 and SC8280XP venus support

Message ID 20230731-topic-8280_venus-v1-0-8c8bbe1983a5@linaro.org
Headers
Series SM8350 and SC8280XP venus support |

Message

Konrad Dybcio Aug. 4, 2023, 8:09 p.m. UTC
  SM8350 and SC8280XP both implement IRIS2, with the bigger SoC having
a bit of a beefier unit, capable of reaching a higher core clock.

Rebased atop Stan's venus-for-6.6.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
Konrad Dybcio (6):
      media: dt-bindings: Document SC8280XP/SM8350 Venus
      media: venus: core: Remove trailing commas from of match entries
      media: venus: hfi_venus: Support only updating certain bits with presets
      media: platform: venus: Add optional LLCC path
      media: venus: core: Add SM8350 resource struct
      media: venus: core: Add SC8280XP resource struct

 .../bindings/media/qcom,sm8350-venus.yaml          | 149 +++++++++++++++++++++
 drivers/media/platform/qcom/venus/core.c           | 119 ++++++++++++++--
 drivers/media/platform/qcom/venus/core.h           |   4 +
 drivers/media/platform/qcom/venus/hfi_venus.c      |  15 ++-
 drivers/media/platform/qcom/venus/pm_helpers.c     |   3 +
 5 files changed, 279 insertions(+), 11 deletions(-)
---
base-commit: 210fefeb11b4bf5d4c5597f126425c2d3fea1aa9
change-id: 20230731-topic-8280_venus-8f506ae723a6

Best regards,
  

Comments

Bryan O'Donoghue Aug. 4, 2023, 8:50 p.m. UTC | #1
On 04/08/2023 21:09, Konrad Dybcio wrote:
> On some platforms (like SM8350) we're expected to only touch certain bits
> (such as 0 and 4 corresponding to mask 0x11). Add support for doing so.
> 
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> ---
>   drivers/media/platform/qcom/venus/core.h      |  1 +
>   drivers/media/platform/qcom/venus/hfi_venus.c | 15 ++++++++++++---
>   2 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h
> index d996abd339e1..2999c24392f5 100644
> --- a/drivers/media/platform/qcom/venus/core.h
> +++ b/drivers/media/platform/qcom/venus/core.h
> @@ -38,6 +38,7 @@ struct freq_tbl {
>   struct reg_val {
>   	u32 reg;
>   	u32 value;
> +	u32 mask;
>   };
>   
>   struct bw_tbl {
> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
> index 19fc6575a489..d4bad66f7293 100644
> --- a/drivers/media/platform/qcom/venus/hfi_venus.c
> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c
> @@ -349,10 +349,19 @@ static void venus_set_registers(struct venus_hfi_device *hdev)
>   	const struct venus_resources *res = hdev->core->res;
>   	const struct reg_val *tbl = res->reg_tbl;
>   	unsigned int count = res->reg_tbl_size;
> -	unsigned int i;
> +	unsigned int i, val;

u32 val;

> +
> +	for (i = 0; i < count; i++) {
> +		val = tbl[i].value;

struct reg_val looks like this

struct reg_val {
         u32 reg;
         u32 value;
};

val should be declared a u32

> -	for (i = 0; i < count; i++)
> -		writel(tbl[i].value, hdev->core->base + tbl[i].reg);
> +		/* In some cases, we only want to update certain bits */

I'll trust this is a legitimate and true statement.

> +		if (tbl[i].mask) {
> +			val = readl(hdev->core->base + tbl[i].reg);
> +			val = (val & ~tbl[i].mask) | (tbl[i].value & tbl[i].mask);

feels like something regmap_update_bits() already does though, I prefer 
this because there's less code in it.

> +		}
> +
> +		writel(val, hdev->core->base + tbl[i].reg);
> +	}

With the val declaration fix

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
  
Bryan O'Donoghue Aug. 4, 2023, 8:51 p.m. UTC | #2
On 04/08/2023 21:50, Bryan O'Donoghue wrote:
> On 04/08/2023 21:09, Konrad Dybcio wrote:
>> On some platforms (like SM8350) we're expected to only touch certain bits
>> (such as 0 and 4 corresponding to mask 0x11). Add support for doing so.
>>
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
>> ---
>>   drivers/media/platform/qcom/venus/core.h      |  1 +
>>   drivers/media/platform/qcom/venus/hfi_venus.c | 15 ++++++++++++---
>>   2 files changed, 13 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/media/platform/qcom/venus/core.h 
>> b/drivers/media/platform/qcom/venus/core.h
>> index d996abd339e1..2999c24392f5 100644
>> --- a/drivers/media/platform/qcom/venus/core.h
>> +++ b/drivers/media/platform/qcom/venus/core.h
>> @@ -38,6 +38,7 @@ struct freq_tbl {
>>   struct reg_val {
>>       u32 reg;
>>       u32 value;
>> +    u32 mask;
>>   };
>>   struct bw_tbl {
>> diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c 
>> b/drivers/media/platform/qcom/venus/hfi_venus.c
>> index 19fc6575a489..d4bad66f7293 100644
>> --- a/drivers/media/platform/qcom/venus/hfi_venus.c
>> +++ b/drivers/media/platform/qcom/venus/hfi_venus.c
>> @@ -349,10 +349,19 @@ static void venus_set_registers(struct 
>> venus_hfi_device *hdev)
>>       const struct venus_resources *res = hdev->core->res;
>>       const struct reg_val *tbl = res->reg_tbl;
>>       unsigned int count = res->reg_tbl_size;
>> -    unsigned int i;
>> +    unsigned int i, val;
> 
> u32 val;
> 
>> +
>> +    for (i = 0; i < count; i++) {
>> +        val = tbl[i].value;
> 
> struct reg_val looks like this
> 
> struct reg_val {
>          u32 reg;
>          u32 value;
> };
> 
> val should be declared a u32
> 
>> -    for (i = 0; i < count; i++)
>> -        writel(tbl[i].value, hdev->core->base + tbl[i].reg);
>> +        /* In some cases, we only want to update certain bits */
> 
> I'll trust this is a legitimate and true statement.
> 
>> +        if (tbl[i].mask) {
>> +            val = readl(hdev->core->base + tbl[i].reg);
>> +            val = (val & ~tbl[i].mask) | (tbl[i].value & tbl[i].mask);
> 
> feels like something regmap_update_bits() already does though, I prefer 
> this because there's less code in it.
> 
>> +        }
>> +
>> +        writel(val, hdev->core->base + tbl[i].reg);
>> +    }
> 
> With the val declaration fix
> 
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
  
Bryan O'Donoghue Aug. 4, 2023, 9:05 p.m. UTC | #3
On 04/08/2023 21:09, Konrad Dybcio wrote:
> Even though it has zero effect on functionality, remove them for coherency
> with other drivers.
> 
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> ---
>   drivers/media/platform/qcom/venus/core.c | 16 ++++++++--------
>   1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 3cc38881d4f6..0af45faec247 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -884,14 +884,14 @@ static const struct venus_resources sc7280_res = {
>   };
>   
>   static const struct of_device_id venus_dt_match[] = {
> -	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
> -	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
> -	{ .compatible = "qcom,sdm660-venus", .data = &sdm660_res, },
> -	{ .compatible = "qcom,sdm845-venus", .data = &sdm845_res, },
> -	{ .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
> -	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res, },
> -	{ .compatible = "qcom,sc7280-venus", .data = &sc7280_res, },
> -	{ .compatible = "qcom,sm8250-venus", .data = &sm8250_res, },
> +	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res },
> +	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res },
> +	{ .compatible = "qcom,sdm660-venus", .data = &sdm660_res },
> +	{ .compatible = "qcom,sdm845-venus", .data = &sdm845_res },
> +	{ .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2 },
> +	{ .compatible = "qcom,sc7180-venus", .data = &sc7180_res },
> +	{ .compatible = "qcom,sc7280-venus", .data = &sc7280_res },
> +	{ .compatible = "qcom,sm8250-venus", .data = &sm8250_res },
>   	{ }
>   };
>   MODULE_DEVICE_TABLE(of, venus_dt_match);


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