linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [V4] media: mtk-jpeg: Fixes jpeghw multi-core judgement
@ 2023-01-03  3:42 Irui Wang
  2023-01-27 10:06 ` Hans Verkuil
  0 siblings, 1 reply; 3+ messages in thread
From: Irui Wang @ 2023-01-03  3:42 UTC (permalink / raw)
  To: Hans Verkuil, Mauro Carvalho Chehab, Matthias Brugger,
	angelogioacchino.delregno, nicolas.dufresne, kyrie wu
  Cc: Project_Global_Chrome_Upstream_Group, linux-media, linux-kernel,
	linux-arm-kernel, linux-mediatek, Tomasz Figa, xia.jiang,
	maoguang.meng, Irui Wang

From: kyrie wu <kyrie.wu@mediatek.com>

some chips have multi-hw, but others have only one,
modify the condition of multi-hw judgement

Fixes: 934e8bccac95 ("mtk-jpegenc: support jpegenc multi-hardware")

Signed-off-by: kyrie wu <kyrie.wu@mediatek.com>
Signed-off-by: irui wang <irui.wang@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c |  4 +++-
 drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h | 12 ++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
index 969516a940ba..56b27ecd61ec 100644
--- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
@@ -1692,7 +1692,7 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	if (list_empty(&pdev->dev.devres_head)) {
+	if (jpeg->variant->hw_arch) {
 		INIT_DELAYED_WORK(&jpeg->job_timeout_work,
 				  mtk_jpeg_job_timeout_work);
 
@@ -1885,6 +1885,7 @@ static struct mtk_jpeg_variant mtk8195_jpegenc_drvdata = {
 	.ioctl_ops = &mtk_jpeg_enc_ioctl_ops,
 	.out_q_default_fourcc = V4L2_PIX_FMT_YUYV,
 	.cap_q_default_fourcc = V4L2_PIX_FMT_JPEG,
+	.hw_arch = MTK_JPEG_HW_MULTI_CORE,
 };
 
 static const struct mtk_jpeg_variant mtk8195_jpegdec_drvdata = {
@@ -1896,6 +1897,7 @@ static const struct mtk_jpeg_variant mtk8195_jpegdec_drvdata = {
 	.ioctl_ops = &mtk_jpeg_dec_ioctl_ops,
 	.out_q_default_fourcc = V4L2_PIX_FMT_JPEG,
 	.cap_q_default_fourcc = V4L2_PIX_FMT_YUV420M,
+	.hw_arch = MTK_JPEG_HW_MULTI_CORE,
 };
 
 #if defined(CONFIG_OF)
diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h
index b9126476be8f..ead47e11dd48 100644
--- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h
+++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h
@@ -46,6 +46,16 @@ enum mtk_jpeg_ctx_state {
 	MTK_JPEG_SOURCE_CHANGE,
 };
 
+/**
+ * enum mtk_jpeg_hw_arch - arch of the jpeg hw
+ * @MTK_JPEG_HW_MULTI_CORE:	jpeg hw is mluti-core
+ * @MTK_JPEG_HW_SINGLE_CORE:	jpeg hw is single core
+ */
+enum mtk_jpeg_hw_arch {
+	MTK_JPEG_HW_MULTI_CORE = 0,
+	MTK_JPEG_HW_SINGLE_CORE = 1,
+};
+
 /**
  * struct mtk_jpeg_variant - mtk jpeg driver variant
  * @clks:			clock names
@@ -60,6 +70,7 @@ enum mtk_jpeg_ctx_state {
  * @ioctl_ops:			the callback of jpeg v4l2_ioctl_ops
  * @out_q_default_fourcc:	output queue default fourcc
  * @cap_q_default_fourcc:	capture queue default fourcc
+ * @hw_arch:            mark jpeg hw arch
  */
 struct mtk_jpeg_variant {
 	struct clk_bulk_data *clks;
@@ -74,6 +85,7 @@ struct mtk_jpeg_variant {
 	const struct v4l2_ioctl_ops *ioctl_ops;
 	u32 out_q_default_fourcc;
 	u32 cap_q_default_fourcc;
+	enum mtk_jpeg_hw_arch hw_arch;
 };
 
 struct mtk_jpeg_src_buf {
-- 
2.18.0


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

* Re: [V4] media: mtk-jpeg: Fixes jpeghw multi-core judgement
  2023-01-03  3:42 [V4] media: mtk-jpeg: Fixes jpeghw multi-core judgement Irui Wang
@ 2023-01-27 10:06 ` Hans Verkuil
  2023-01-29  1:11   ` Kyrie Wu (吴晗)
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Verkuil @ 2023-01-27 10:06 UTC (permalink / raw)
  To: Irui Wang, Mauro Carvalho Chehab, Matthias Brugger,
	angelogioacchino.delregno, nicolas.dufresne, kyrie wu
  Cc: Project_Global_Chrome_Upstream_Group, linux-media, linux-kernel,
	linux-arm-kernel, linux-mediatek, Tomasz Figa, xia.jiang,
	maoguang.meng

Hi Irui, Kyrie,

On 03/01/2023 04:42, Irui Wang wrote:
> From: kyrie wu <kyrie.wu@mediatek.com>
> 
> some chips have multi-hw, but others have only one,
> modify the condition of multi-hw judgement
> 
> Fixes: 934e8bccac95 ("mtk-jpegenc: support jpegenc multi-hardware")
> 
> Signed-off-by: kyrie wu <kyrie.wu@mediatek.com>
> Signed-off-by: irui wang <irui.wang@mediatek.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
>  drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c |  4 +++-
>  drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h | 12 ++++++++++++
>  2 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> index 969516a940ba..56b27ecd61ec 100644
> --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> @@ -1692,7 +1692,7 @@ static int mtk_jpeg_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  
> -	if (list_empty(&pdev->dev.devres_head)) {
> +	if (jpeg->variant->hw_arch) {
>  		INIT_DELAYED_WORK(&jpeg->job_timeout_work,
>  				  mtk_jpeg_job_timeout_work);
>  
> @@ -1885,6 +1885,7 @@ static struct mtk_jpeg_variant mtk8195_jpegenc_drvdata = {
>  	.ioctl_ops = &mtk_jpeg_enc_ioctl_ops,
>  	.out_q_default_fourcc = V4L2_PIX_FMT_YUYV,
>  	.cap_q_default_fourcc = V4L2_PIX_FMT_JPEG,
> +	.hw_arch = MTK_JPEG_HW_MULTI_CORE,
>  };
>  
>  static const struct mtk_jpeg_variant mtk8195_jpegdec_drvdata = {
> @@ -1896,6 +1897,7 @@ static const struct mtk_jpeg_variant mtk8195_jpegdec_drvdata = {
>  	.ioctl_ops = &mtk_jpeg_dec_ioctl_ops,
>  	.out_q_default_fourcc = V4L2_PIX_FMT_JPEG,
>  	.cap_q_default_fourcc = V4L2_PIX_FMT_YUV420M,
> +	.hw_arch = MTK_JPEG_HW_MULTI_CORE,
>  };

So presumably the mtk8195 is multi core and the other variants are single core, but...

>  
>  #if defined(CONFIG_OF)
> diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h
> index b9126476be8f..ead47e11dd48 100644
> --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h
> +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h
> @@ -46,6 +46,16 @@ enum mtk_jpeg_ctx_state {
>  	MTK_JPEG_SOURCE_CHANGE,
>  };
>  
> +/**
> + * enum mtk_jpeg_hw_arch - arch of the jpeg hw
> + * @MTK_JPEG_HW_MULTI_CORE:	jpeg hw is mluti-core

mluti -> multi

> + * @MTK_JPEG_HW_SINGLE_CORE:	jpeg hw is single core
> + */
> +enum mtk_jpeg_hw_arch {
> +	MTK_JPEG_HW_MULTI_CORE = 0,

...this has value 0, so multi core is the default. This means that all variants are
seen as multi core.

> +	MTK_JPEG_HW_SINGLE_CORE = 1,
> +};
> +
>  /**
>   * struct mtk_jpeg_variant - mtk jpeg driver variant
>   * @clks:			clock names
> @@ -60,6 +70,7 @@ enum mtk_jpeg_ctx_state {
>   * @ioctl_ops:			the callback of jpeg v4l2_ioctl_ops
>   * @out_q_default_fourcc:	output queue default fourcc
>   * @cap_q_default_fourcc:	capture queue default fourcc
> + * @hw_arch:            mark jpeg hw arch

I think this is a poorly chosen name: wouldn't it be better
to just make this a 'bool multi_core;'?

>   */
>  struct mtk_jpeg_variant {
>  	struct clk_bulk_data *clks;
> @@ -74,6 +85,7 @@ struct mtk_jpeg_variant {
>  	const struct v4l2_ioctl_ops *ioctl_ops;
>  	u32 out_q_default_fourcc;
>  	u32 cap_q_default_fourcc;
> +	enum mtk_jpeg_hw_arch hw_arch;
>  };
>  
>  struct mtk_jpeg_src_buf {

In any case, this patch doesn't look right.

Regards,

	Hans

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

* Re: [V4] media: mtk-jpeg: Fixes jpeghw multi-core judgement
  2023-01-27 10:06 ` Hans Verkuil
@ 2023-01-29  1:11   ` Kyrie Wu (吴晗)
  0 siblings, 0 replies; 3+ messages in thread
From: Kyrie Wu (吴晗) @ 2023-01-29  1:11 UTC (permalink / raw)
  To: nicolas.dufresne, matthias.bgg, mchehab,
	Kyrie Wu (吴晗),
	angelogioacchino.delregno, Irui Wang (王瑞),
	hverkuil-cisco
  Cc: linux-kernel, linux-mediatek, tfiga, linux-media,
	Maoguang Meng (孟毛广),
	Project_Global_Chrome_Upstream_Group, linux-arm-kernel,
	Xia Jiang (江霞)

On Fri, 2023-01-27 at 11:06 +0100, Hans Verkuil wrote:
> Hi Irui, Kyrie,
> 
> On 03/01/2023 04:42, Irui Wang wrote:
> > From: kyrie wu <kyrie.wu@mediatek.com>
> > 
> > some chips have multi-hw, but others have only one,
> > modify the condition of multi-hw judgement
> > 
> > Fixes: 934e8bccac95 ("mtk-jpegenc: support jpegenc multi-hardware")
> > 
> > Signed-off-by: kyrie wu <kyrie.wu@mediatek.com>
> > Signed-off-by: irui wang <irui.wang@mediatek.com>
> > Reviewed-by: AngeloGioacchino Del Regno <
> > angelogioacchino.delregno@collabora.com>
> > ---
> >  drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c |  4 +++-
> >  drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h | 12
> > ++++++++++++
> >  2 files changed, 15 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> > b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> > index 969516a940ba..56b27ecd61ec 100644
> > --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> > +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
> > @@ -1692,7 +1692,7 @@ static int mtk_jpeg_probe(struct
> > platform_device *pdev)
> >  		return -EINVAL;
> >  	}
> >  
> > -	if (list_empty(&pdev->dev.devres_head)) {
> > +	if (jpeg->variant->hw_arch) {
> >  		INIT_DELAYED_WORK(&jpeg->job_timeout_work,
> >  				  mtk_jpeg_job_timeout_work);
> >  
> > @@ -1885,6 +1885,7 @@ static struct mtk_jpeg_variant
> > mtk8195_jpegenc_drvdata = {
> >  	.ioctl_ops = &mtk_jpeg_enc_ioctl_ops,
> >  	.out_q_default_fourcc = V4L2_PIX_FMT_YUYV,
> >  	.cap_q_default_fourcc = V4L2_PIX_FMT_JPEG,
> > +	.hw_arch = MTK_JPEG_HW_MULTI_CORE,
> >  };
> >  
> >  static const struct mtk_jpeg_variant mtk8195_jpegdec_drvdata = {
> > @@ -1896,6 +1897,7 @@ static const struct mtk_jpeg_variant
> > mtk8195_jpegdec_drvdata = {
> >  	.ioctl_ops = &mtk_jpeg_dec_ioctl_ops,
> >  	.out_q_default_fourcc = V4L2_PIX_FMT_JPEG,
> >  	.cap_q_default_fourcc = V4L2_PIX_FMT_YUV420M,
> > +	.hw_arch = MTK_JPEG_HW_MULTI_CORE,
> >  };
> 
> So presumably the mtk8195 is multi core and the other variants are
> single core, but...
> 
> >  
> >  #if defined(CONFIG_OF)
> > diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h
> > b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h
> > index b9126476be8f..ead47e11dd48 100644
> > --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h
> > +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h
> > @@ -46,6 +46,16 @@ enum mtk_jpeg_ctx_state {
> >  	MTK_JPEG_SOURCE_CHANGE,
> >  };
> >  
> > +/**
> > + * enum mtk_jpeg_hw_arch - arch of the jpeg hw
> > + * @MTK_JPEG_HW_MULTI_CORE:	jpeg hw is mluti-core
> 
> mluti -> multi
> 
> > + * @MTK_JPEG_HW_SINGLE_CORE:	jpeg hw is single core
> > + */
> > +enum mtk_jpeg_hw_arch {
> > +	MTK_JPEG_HW_MULTI_CORE = 0,
> 
> ...this has value 0, so multi core is the default. This means that
> all variants are
> seen as multi core.
Dear Hans,

Thanks for your reminding, I will fix this problem.

> 
> > +	MTK_JPEG_HW_SINGLE_CORE = 1,
> > +};
> > +
> >  /**
> >   * struct mtk_jpeg_variant - mtk jpeg driver variant
> >   * @clks:			clock names
> > @@ -60,6 +70,7 @@ enum mtk_jpeg_ctx_state {
> >   * @ioctl_ops:			the callback of jpeg
> > v4l2_ioctl_ops
> >   * @out_q_default_fourcc:	output queue default fourcc
> >   * @cap_q_default_fourcc:	capture queue default fourcc
> > + * @hw_arch:            mark jpeg hw arch
> 
> I think this is a poorly chosen name: wouldn't it be better
> to just make this a 'bool multi_core;'?
Thanks, I would change the choosing.

Regards,
Kyrie.
> 
> >   */
> >  struct mtk_jpeg_variant {
> >  	struct clk_bulk_data *clks;
> > @@ -74,6 +85,7 @@ struct mtk_jpeg_variant {
> >  	const struct v4l2_ioctl_ops *ioctl_ops;
> >  	u32 out_q_default_fourcc;
> >  	u32 cap_q_default_fourcc;
> > +	enum mtk_jpeg_hw_arch hw_arch;
> >  };
> >  
> >  struct mtk_jpeg_src_buf {
> 
> In any case, this patch doesn't look right.
> 
> Regards,
> 
> 	Hans

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

end of thread, other threads:[~2023-01-29  1:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-03  3:42 [V4] media: mtk-jpeg: Fixes jpeghw multi-core judgement Irui Wang
2023-01-27 10:06 ` Hans Verkuil
2023-01-29  1:11   ` Kyrie Wu (吴晗)

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).