diff mbox series

[1/2] media: venus: Add support for MSM8939

Message ID 20200501203505.144362-2-konradybcio@gmail.com (mailing list archive)
State New, archived
Headers show
Series Add support for venus on msm8939 | expand

Commit Message

Konrad Dybcio May 1, 2020, 8:35 p.m. UTC
Signed-off-by: Konrad Dybcio <konradybcio@gmail.com>
---
 drivers/media/platform/qcom/venus/core.c | 33 ++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Comments

Stanimir Varbanov May 5, 2020, 11:43 a.m. UTC | #1
Hi Konrad,

On 5/1/20 11:35 PM, Konrad Dybcio wrote:
> Signed-off-by: Konrad Dybcio <konradybcio@gmail.com>
> ---
>  drivers/media/platform/qcom/venus/core.c | 33 ++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 194b10b987672..f3a15991ac763 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -405,6 +405,38 @@ static const struct venus_resources msm8916_res = {
>  	.fwname = "qcom/venus-1.8/venus.mdt",
>  };
>  
> +static const struct freq_tbl msm8939_freq_table[] = {
> +	{ 489600, 266670000 },	/* 1080p @ 60 */
> +	{ 244800, 200000000 },	/* 1080p @ 30 */
> +	{ 244800, 133330000 },	/* 1080p @ 30 (decode only) */
> +	{ 220800, 133330000 },  /* 720p @ 60 (decode only?) */
> +	{ 108000, 133330000 },  /* 720p @ 30*/
> +	{ 72000, 133330000 },  /* VGA @ 60 */
> +	{ 36000, 133330000 },  /* VGA @ 30 */

133MHz is the minimum clock frequency in the GCC driver? Do you think
that will change?

> +};
> +
> +static const struct reg_val msm8939_reg_preset[] = {
> +	{ 0xe0020, 0x0aaaaaaa },
> +	{ 0xe0024, 0x0aaaaaaa },
> +	{ 0x80124, 0x00000003 },
> +};
> +
> +static const struct venus_resources msm8939_res = {
> +	.freq_tbl = msm8939_freq_table,
> +	.freq_tbl_size = ARRAY_SIZE(msm8939_freq_table),
> +	.reg_tbl = msm8939_reg_preset,
> +	.reg_tbl_size = ARRAY_SIZE(msm8939_reg_preset),
> +	.clks = { "core", "iface", "bus", },
> +	.clks_num = 3,
> +	.max_load = 489600, /* 1080p @ 60 */
> +	.hfi_version = HFI_VERSION_1XX,
> +	.vmem_id = VIDC_RESOURCE_NONE,
> +	.vmem_size = 0,
> +	.vmem_addr = 0,
> +	.dma_mask = 0xddc00000 - 1,
> +	.fwname = "qcom/venus-1.8/venus.mdt",
> +};
> +
>  static const struct freq_tbl msm8996_freq_table[] = {
>  	{ 1944000, 520000000 },	/* 4k UHD @ 60 (decode only) */
>  	{  972000, 520000000 },	/* 4k UHD @ 30 */
> @@ -567,6 +599,7 @@ static const struct venus_resources sc7180_res = {
>  
>  static const struct of_device_id venus_dt_match[] = {
>  	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
> +	{ .compatible = "qcom,msm8939-venus", .data = &msm8939_res, },
>  	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
>  	{ .compatible = "qcom,sdm845-venus", .data = &sdm845_res, },
>  	{ .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
>
Konrad Dybcio May 6, 2020, 9:23 p.m. UTC | #2
Hi Stan,

I have found some issues with the submitted GCC driver, related to
venus, but I have to further look into them locally and work out some
stuff. One of the things is that freq table for venus clock should be
changed to the values found here [1] (currently it has 8916
frequencies). When I find all the causes I'll resubmit this and
include them in the cover letter, as I might've overlooked something
wrt venus driver itself when creating this patch from my WIP branch.
Also it seems like I tested this very patch incorrectly (getting
segfaults in ffmpeg with v4l2m2m now)... Anyways, I'll get back to you
when I make it work for sure. Sorry again for the inconvenience.


[1] https://github.com/konradybcio/android_kernel_asus_msm8916-1/blob/minimal/drivers/clk/qcom/clock-gcc-8936.c#L1613-L1618

Konrad

wt., 5 maj 2020 o 13:43 Stanimir Varbanov
<stanimir.varbanov@linaro.org> napisał(a):
>
> Hi Konrad,
>
> On 5/1/20 11:35 PM, Konrad Dybcio wrote:
> > Signed-off-by: Konrad Dybcio <konradybcio@gmail.com>
> > ---
> >  drivers/media/platform/qcom/venus/core.c | 33 ++++++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> >
> > diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> > index 194b10b987672..f3a15991ac763 100644
> > --- a/drivers/media/platform/qcom/venus/core.c
> > +++ b/drivers/media/platform/qcom/venus/core.c
> > @@ -405,6 +405,38 @@ static const struct venus_resources msm8916_res = {
> >       .fwname = "qcom/venus-1.8/venus.mdt",
> >  };
> >
> > +static const struct freq_tbl msm8939_freq_table[] = {
> > +     { 489600, 266670000 },  /* 1080p @ 60 */
> > +     { 244800, 200000000 },  /* 1080p @ 30 */
> > +     { 244800, 133330000 },  /* 1080p @ 30 (decode only) */
> > +     { 220800, 133330000 },  /* 720p @ 60 (decode only?) */
> > +     { 108000, 133330000 },  /* 720p @ 30*/
> > +     { 72000, 133330000 },  /* VGA @ 60 */
> > +     { 36000, 133330000 },  /* VGA @ 30 */
>
> 133MHz is the minimum clock frequency in the GCC driver? Do you think
> that will change?
>
> > +};
> > +
> > +static const struct reg_val msm8939_reg_preset[] = {
> > +     { 0xe0020, 0x0aaaaaaa },
> > +     { 0xe0024, 0x0aaaaaaa },
> > +     { 0x80124, 0x00000003 },
> > +};
> > +
> > +static const struct venus_resources msm8939_res = {
> > +     .freq_tbl = msm8939_freq_table,
> > +     .freq_tbl_size = ARRAY_SIZE(msm8939_freq_table),
> > +     .reg_tbl = msm8939_reg_preset,
> > +     .reg_tbl_size = ARRAY_SIZE(msm8939_reg_preset),
> > +     .clks = { "core", "iface", "bus", },
> > +     .clks_num = 3,
> > +     .max_load = 489600, /* 1080p @ 60 */
> > +     .hfi_version = HFI_VERSION_1XX,
> > +     .vmem_id = VIDC_RESOURCE_NONE,
> > +     .vmem_size = 0,
> > +     .vmem_addr = 0,
> > +     .dma_mask = 0xddc00000 - 1,
> > +     .fwname = "qcom/venus-1.8/venus.mdt",
> > +};
> > +
> >  static const struct freq_tbl msm8996_freq_table[] = {
> >       { 1944000, 520000000 }, /* 4k UHD @ 60 (decode only) */
> >       {  972000, 520000000 }, /* 4k UHD @ 30 */
> > @@ -567,6 +599,7 @@ static const struct venus_resources sc7180_res = {
> >
> >  static const struct of_device_id venus_dt_match[] = {
> >       { .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
> > +     { .compatible = "qcom,msm8939-venus", .data = &msm8939_res, },
> >       { .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
> >       { .compatible = "qcom,sdm845-venus", .data = &sdm845_res, },
> >       { .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
> >
>
> --
> regards,
> Stan
Stanimir Varbanov May 7, 2020, 8:13 a.m. UTC | #3
Hi Konrad,

On 5/7/20 12:23 AM, Konrad Dybcio wrote:
> Hi Stan,
> 
> I have found some issues with the submitted GCC driver, related to
> venus, but I have to further look into them locally and work out some
> stuff. One of the things is that freq table for venus clock should be
> changed to the values found here [1] (currently it has 8916
> frequencies). When I find all the causes I'll resubmit this and
> include them in the cover letter, as I might've overlooked something
> wrt venus driver itself when creating this patch from my WIP branch.
> Also it seems like I tested this very patch incorrectly (getting
> segfaults in ffmpeg with v4l2m2m now)... Anyways, I'll get back to you
> when I make it work for sure. Sorry again for the inconvenience.

OK. Thanks for the details, I'm waiting for good news :). If you need
some help with Venus bringup ping me on IRC - my nickname is svarbanov
on #v4l channel.

Regarding to venus clocks, these two clocks exist in below gcc driver
but missing in msm8916:

gcc_venus0_core0_vcodec0_clk
gcc_venus0_core1_vcodec0_clk

but the Venus IP block should be the same as in msm8916. Can you point
me to the donwstream gcc driver or check from where they comes.

> 
> 
> [1] https://github.com/konradybcio/android_kernel_asus_msm8916-1/blob/minimal/drivers/clk/qcom/clock-gcc-8936.c#L1613-L1618
> 
> Konrad
> 
> wt., 5 maj 2020 o 13:43 Stanimir Varbanov
> <stanimir.varbanov@linaro.org> napisał(a):
>>
>> Hi Konrad,
>>
>> On 5/1/20 11:35 PM, Konrad Dybcio wrote:
>>> Signed-off-by: Konrad Dybcio <konradybcio@gmail.com>
>>> ---
>>>  drivers/media/platform/qcom/venus/core.c | 33 ++++++++++++++++++++++++
>>>  1 file changed, 33 insertions(+)
>>>
>>> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
>>> index 194b10b987672..f3a15991ac763 100644
>>> --- a/drivers/media/platform/qcom/venus/core.c
>>> +++ b/drivers/media/platform/qcom/venus/core.c
>>> @@ -405,6 +405,38 @@ static const struct venus_resources msm8916_res = {
>>>       .fwname = "qcom/venus-1.8/venus.mdt",
>>>  };
>>>
>>> +static const struct freq_tbl msm8939_freq_table[] = {
>>> +     { 489600, 266670000 },  /* 1080p @ 60 */
>>> +     { 244800, 200000000 },  /* 1080p @ 30 */
>>> +     { 244800, 133330000 },  /* 1080p @ 30 (decode only) */
>>> +     { 220800, 133330000 },  /* 720p @ 60 (decode only?) */
>>> +     { 108000, 133330000 },  /* 720p @ 30*/
>>> +     { 72000, 133330000 },  /* VGA @ 60 */
>>> +     { 36000, 133330000 },  /* VGA @ 30 */
>>
>> 133MHz is the minimum clock frequency in the GCC driver? Do you think
>> that will change?
>>
>>> +};
>>> +
>>> +static const struct reg_val msm8939_reg_preset[] = {
>>> +     { 0xe0020, 0x0aaaaaaa },
>>> +     { 0xe0024, 0x0aaaaaaa },
>>> +     { 0x80124, 0x00000003 },
>>> +};
>>> +
>>> +static const struct venus_resources msm8939_res = {
>>> +     .freq_tbl = msm8939_freq_table,
>>> +     .freq_tbl_size = ARRAY_SIZE(msm8939_freq_table),
>>> +     .reg_tbl = msm8939_reg_preset,
>>> +     .reg_tbl_size = ARRAY_SIZE(msm8939_reg_preset),
>>> +     .clks = { "core", "iface", "bus", },
>>> +     .clks_num = 3,
>>> +     .max_load = 489600, /* 1080p @ 60 */
>>> +     .hfi_version = HFI_VERSION_1XX,
>>> +     .vmem_id = VIDC_RESOURCE_NONE,
>>> +     .vmem_size = 0,
>>> +     .vmem_addr = 0,
>>> +     .dma_mask = 0xddc00000 - 1,
>>> +     .fwname = "qcom/venus-1.8/venus.mdt",
>>> +};
>>> +
>>>  static const struct freq_tbl msm8996_freq_table[] = {
>>>       { 1944000, 520000000 }, /* 4k UHD @ 60 (decode only) */
>>>       {  972000, 520000000 }, /* 4k UHD @ 30 */
>>> @@ -567,6 +599,7 @@ static const struct venus_resources sc7180_res = {
>>>
>>>  static const struct of_device_id venus_dt_match[] = {
>>>       { .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
>>> +     { .compatible = "qcom,msm8939-venus", .data = &msm8939_res, },
>>>       { .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
>>>       { .compatible = "qcom,sdm845-venus", .data = &sdm845_res, },
>>>       { .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },
>>>
>>
>> --
>> regards,
>> Stan
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 194b10b987672..f3a15991ac763 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -405,6 +405,38 @@  static const struct venus_resources msm8916_res = {
 	.fwname = "qcom/venus-1.8/venus.mdt",
 };
 
+static const struct freq_tbl msm8939_freq_table[] = {
+	{ 489600, 266670000 },	/* 1080p @ 60 */
+	{ 244800, 200000000 },	/* 1080p @ 30 */
+	{ 244800, 133330000 },	/* 1080p @ 30 (decode only) */
+	{ 220800, 133330000 },  /* 720p @ 60 (decode only?) */
+	{ 108000, 133330000 },  /* 720p @ 30*/
+	{ 72000, 133330000 },  /* VGA @ 60 */
+	{ 36000, 133330000 },  /* VGA @ 30 */
+};
+
+static const struct reg_val msm8939_reg_preset[] = {
+	{ 0xe0020, 0x0aaaaaaa },
+	{ 0xe0024, 0x0aaaaaaa },
+	{ 0x80124, 0x00000003 },
+};
+
+static const struct venus_resources msm8939_res = {
+	.freq_tbl = msm8939_freq_table,
+	.freq_tbl_size = ARRAY_SIZE(msm8939_freq_table),
+	.reg_tbl = msm8939_reg_preset,
+	.reg_tbl_size = ARRAY_SIZE(msm8939_reg_preset),
+	.clks = { "core", "iface", "bus", },
+	.clks_num = 3,
+	.max_load = 489600, /* 1080p @ 60 */
+	.hfi_version = HFI_VERSION_1XX,
+	.vmem_id = VIDC_RESOURCE_NONE,
+	.vmem_size = 0,
+	.vmem_addr = 0,
+	.dma_mask = 0xddc00000 - 1,
+	.fwname = "qcom/venus-1.8/venus.mdt",
+};
+
 static const struct freq_tbl msm8996_freq_table[] = {
 	{ 1944000, 520000000 },	/* 4k UHD @ 60 (decode only) */
 	{  972000, 520000000 },	/* 4k UHD @ 30 */
@@ -567,6 +599,7 @@  static const struct venus_resources sc7180_res = {
 
 static const struct of_device_id venus_dt_match[] = {
 	{ .compatible = "qcom,msm8916-venus", .data = &msm8916_res, },
+	{ .compatible = "qcom,msm8939-venus", .data = &msm8939_res, },
 	{ .compatible = "qcom,msm8996-venus", .data = &msm8996_res, },
 	{ .compatible = "qcom,sdm845-venus", .data = &sdm845_res, },
 	{ .compatible = "qcom,sdm845-venus-v2", .data = &sdm845_res_v2, },