diff mbox series

[3/5] media: mediatek: vcodec: Add mt8188 encoder driver

Message ID 20220716093808.29894-4-irui.wang@mediatek.com (mailing list archive)
State New, archived
Headers show
Series support mt8188 h264 encoder | expand

Commit Message

Irui Wang July 16, 2022, 9:38 a.m. UTC
Add mt8188's compatible "mediatek,mt8188-vcodec-enc".
Add mt8188's device private data "mt8188_pdata".
Remove platform_get_resource API to get IRQ resoure.

Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
 .../mediatek/vcodec/mtk_vcodec_enc_drv.c      | 21 ++++++++++++-------
 1 file changed, 13 insertions(+), 8 deletions(-)

Comments

AngeloGioacchino Del Regno July 18, 2022, 9:53 a.m. UTC | #1
Il 16/07/22 11:38, Irui Wang ha scritto:
> Add mt8188's compatible "mediatek,mt8188-vcodec-enc".
> Add mt8188's device private data "mt8188_pdata".
> Remove platform_get_resource API to get IRQ resoure.
> 
> Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> ---
>   .../mediatek/vcodec/mtk_vcodec_enc_drv.c      | 21 ++++++++++++-------
>   1 file changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
> index 95e8c29ccc65..6b0688b4872d 100644
> --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
> +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
> @@ -228,7 +228,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
>   {
>   	struct mtk_vcodec_dev *dev;
>   	struct video_device *vfd_enc;
> -	struct resource *res;
>   	phandle rproc_phandle;
>   	enum mtk_vcodec_fw_type fw_type;
>   	int ret;
> @@ -272,13 +271,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev)
>   		goto err_res;
>   	}
>   
> -	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);

This needs to be a separated commit with a Fixes tag!

> -	if (res == NULL) {
> -		dev_err(&pdev->dev, "failed to get irq resource");
> -		ret = -ENOENT;
> -		goto err_res;
> -	}
> -
>   	dev->enc_irq = platform_get_irq(pdev, 0);
>   	irq_set_status_flags(dev->enc_irq, IRQ_NOAUTOEN);
>   	ret = devm_request_irq(&pdev->dev, dev->enc_irq,
> @@ -428,6 +420,18 @@ static const struct mtk_vcodec_enc_pdata mt8195_pdata = {
>   	.core_id = VENC_SYS,
>   };
>   
> +static const struct mtk_vcodec_enc_pdata mt8188_pdata = {
> +	.uses_ext = true,
> +	.capture_formats = mtk_video_formats_capture_h264,
> +	.num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_h264),
> +	.output_formats = mtk_video_formats_output,
> +	.num_output_formats = ARRAY_SIZE(mtk_video_formats_output),
> +	.min_bitrate = 64,
> +	.max_bitrate = 50000000,
> +	.core_id = VENC_SYS,
> +	.is_34bit = true,
> +};
> +
>   static const struct of_device_id mtk_vcodec_enc_match[] = {
>   	{.compatible = "mediatek,mt8173-vcodec-enc",
>   			.data = &mt8173_avc_pdata},
> @@ -436,6 +440,7 @@ static const struct of_device_id mtk_vcodec_enc_match[] = {
>   	{.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata},
>   	{.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata},
>   	{.compatible = "mediatek,mt8195-vcodec-enc", .data = &mt8195_pdata},
> +	{.compatible = "mediatek,mt8188-vcodec-enc", .data = &mt8188_pdata},

Please keep this list alphabetically sorted.

>   	{},
>   };
>   MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);
Irui Wang July 18, 2022, 11:34 a.m. UTC | #2
Dear Angelo,
On Mon, 2022-07-18 at 11:53 +0200, AngeloGioacchino Del Regno wrote:
> Il 16/07/22 11:38, Irui Wang ha scritto:
> > Add mt8188's compatible "mediatek,mt8188-vcodec-enc".
> > Add mt8188's device private data "mt8188_pdata".
> > Remove platform_get_resource API to get IRQ resoure.
> > 
> > Signed-off-by: Irui Wang <irui.wang@mediatek.com>
> > ---
> >   .../mediatek/vcodec/mtk_vcodec_enc_drv.c      | 21 ++++++++++++
> > -------
> >   1 file changed, 13 insertions(+), 8 deletions(-)
> > 
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
> > b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
> > index 95e8c29ccc65..6b0688b4872d 100644
> > --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
> > +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
> > @@ -228,7 +228,6 @@ static int mtk_vcodec_probe(struct
> > platform_device *pdev)
> >   {
> >   	struct mtk_vcodec_dev *dev;
> >   	struct video_device *vfd_enc;
> > -	struct resource *res;
> >   	phandle rproc_phandle;
> >   	enum mtk_vcodec_fw_type fw_type;
> >   	int ret;
> > @@ -272,13 +271,6 @@ static int mtk_vcodec_probe(struct
> > platform_device *pdev)
> >   		goto err_res;
> >   	}
> >   
> > -	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> 
> This needs to be a separated commit with a Fixes tag!
Separate to another patch, thanks.
> 
> > -	if (res == NULL) {
> > -		dev_err(&pdev->dev, "failed to get irq resource");
> > -		ret = -ENOENT;
> > -		goto err_res;
> > -	}
> > -
> >   	dev->enc_irq = platform_get_irq(pdev, 0);
> >   	irq_set_status_flags(dev->enc_irq, IRQ_NOAUTOEN);
> >   	ret = devm_request_irq(&pdev->dev, dev->enc_irq,
> > @@ -428,6 +420,18 @@ static const struct mtk_vcodec_enc_pdata
> > mt8195_pdata = {
> >   	.core_id = VENC_SYS,
> >   };
> >   
> > +static const struct mtk_vcodec_enc_pdata mt8188_pdata = {
> > +	.uses_ext = true,
> > +	.capture_formats = mtk_video_formats_capture_h264,
> > +	.num_capture_formats =
> > ARRAY_SIZE(mtk_video_formats_capture_h264),
> > +	.output_formats = mtk_video_formats_output,
> > +	.num_output_formats = ARRAY_SIZE(mtk_video_formats_output),
> > +	.min_bitrate = 64,
> > +	.max_bitrate = 50000000,
> > +	.core_id = VENC_SYS,
> > +	.is_34bit = true,
> > +};
> > +
> >   static const struct of_device_id mtk_vcodec_enc_match[] = {
> >   	{.compatible = "mediatek,mt8173-vcodec-enc",
> >   			.data = &mt8173_avc_pdata},
> > @@ -436,6 +440,7 @@ static const struct of_device_id
> > mtk_vcodec_enc_match[] = {
> >   	{.compatible = "mediatek,mt8183-vcodec-enc", .data =
> > &mt8183_pdata},
> >   	{.compatible = "mediatek,mt8192-vcodec-enc", .data =
> > &mt8192_pdata},
> >   	{.compatible = "mediatek,mt8195-vcodec-enc", .data =
> > &mt8195_pdata},
> > +	{.compatible = "mediatek,mt8188-vcodec-enc", .data =
> > &mt8188_pdata},
> 
> Please keep this list alphabetically sorted.
Fix in next version.

Thanks
Best Regards.
> 
> >   	{},
> >   };
> >   MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);
> 
>
diff mbox series

Patch

diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
index 95e8c29ccc65..6b0688b4872d 100644
--- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
+++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c
@@ -228,7 +228,6 @@  static int mtk_vcodec_probe(struct platform_device *pdev)
 {
 	struct mtk_vcodec_dev *dev;
 	struct video_device *vfd_enc;
-	struct resource *res;
 	phandle rproc_phandle;
 	enum mtk_vcodec_fw_type fw_type;
 	int ret;
@@ -272,13 +271,6 @@  static int mtk_vcodec_probe(struct platform_device *pdev)
 		goto err_res;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (res == NULL) {
-		dev_err(&pdev->dev, "failed to get irq resource");
-		ret = -ENOENT;
-		goto err_res;
-	}
-
 	dev->enc_irq = platform_get_irq(pdev, 0);
 	irq_set_status_flags(dev->enc_irq, IRQ_NOAUTOEN);
 	ret = devm_request_irq(&pdev->dev, dev->enc_irq,
@@ -428,6 +420,18 @@  static const struct mtk_vcodec_enc_pdata mt8195_pdata = {
 	.core_id = VENC_SYS,
 };
 
+static const struct mtk_vcodec_enc_pdata mt8188_pdata = {
+	.uses_ext = true,
+	.capture_formats = mtk_video_formats_capture_h264,
+	.num_capture_formats = ARRAY_SIZE(mtk_video_formats_capture_h264),
+	.output_formats = mtk_video_formats_output,
+	.num_output_formats = ARRAY_SIZE(mtk_video_formats_output),
+	.min_bitrate = 64,
+	.max_bitrate = 50000000,
+	.core_id = VENC_SYS,
+	.is_34bit = true,
+};
+
 static const struct of_device_id mtk_vcodec_enc_match[] = {
 	{.compatible = "mediatek,mt8173-vcodec-enc",
 			.data = &mt8173_avc_pdata},
@@ -436,6 +440,7 @@  static const struct of_device_id mtk_vcodec_enc_match[] = {
 	{.compatible = "mediatek,mt8183-vcodec-enc", .data = &mt8183_pdata},
 	{.compatible = "mediatek,mt8192-vcodec-enc", .data = &mt8192_pdata},
 	{.compatible = "mediatek,mt8195-vcodec-enc", .data = &mt8195_pdata},
+	{.compatible = "mediatek,mt8188-vcodec-enc", .data = &mt8188_pdata},
 	{},
 };
 MODULE_DEVICE_TABLE(of, mtk_vcodec_enc_match);