Skip to contentSkip to conversation

media: jpeg: Fix multi-hw judgement

PATCH Superseded Irui Wang 4 participants 6 messages Dec 16, 2022 – Dec 30, 2022

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Irui Wang

author
#0 lore raw

PATCH v2 1/1 media: jpeg: Fix multi-hw judgement

From: kyrie wu <[email protected]>

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

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

---
 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(-)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +3 -1
index 18e867a79f12..7472c1ee23ab 100644
@@ -1694,7 +1694,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);
 
@@ -1889,6 +1889,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 = {
@@ -1900,6 +1901,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)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h +12 -0
index b9126476be8f..ec04a8ce73cf 100644
@@ -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_SINGLE_CORE:	jpeg hw is single core
+ * @MTK_JPEG_HW_MULTI_CORE:		jpeg hw is mluti-core
+ */
+enum mtk_jpeg_hw_arch {
+	MTK_JPEG_HW_SINGLE_CORE = 0,
+	MTK_JPEG_HW_MULTI_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 {
Signature · 1 line
2.18.0
#1 lore raw

Il 16/12/22 04:52, Irui Wang ha scritto:

Quoted 6 lines

From: kyrie wu <[email protected]>

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

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

Typo. s/Fixs/Fixes/g

Fix that, please.

Regards,
Angelo

#2 lore raw
Quoted 6 lines · AngeloGioacchino Del Regno

Il 16/12/22 04:52, Irui Wang ha scritto:

Quoted 5 lines

From: kyrie wu <[email protected]>

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

Quoted 9 lines
Quoted 1 line

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

Typo. s/Fixs/Fixes/g

Fix that, please.

Regards,
Angelo

Hi Angelo,

I will fix that issue in the next version.

Thanks.

Regards,
Kyrie.

#3 lore raw
In reply to Irui Wang
Quoted 4 lines · Irui Wang

From: kyrie wu <[email protected]>

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

nit: s/judgement/conditional block/ ...

drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c static int mtk_jpeg_probe(struct platform_device *pdev) · line 1697

Quoted 2 lines
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +1 -1
-	if (list_empty(&pdev->dev.devres_head)) {
+	if (!jpeg->variant->hw_arch) {

... like here (if block).

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#4 lore raw
Quoted 6 lines · Bagas Sanjaya
Quoted 4 lines · Irui Wang

From: kyrie wu <[email protected]>

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

Quoted 8 lines

nit: s/judgement/conditional block/ ...

drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c static int mtk_jpeg_probe(struct platform_device *pdev) · line 1697

Quoted 2 lines
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +1 -1
-	if (list_empty(&pdev->dev.devres_head)) {
+	if (!jpeg->variant->hw_arch) {

... like here (if block).

Thanks.

Hi Bagas,

I can't get your suggestion exactly.
Do you mean to change if (...) as follows:
if (jpeg->variant->hw_arch)

Quoted 1 line

Thanks.

Regards,
Kyrie.

#5 lore raw
Quoted 14 lines · Kyrie Wu (吴晗)
Quoted 13 lines · Bagas Sanjaya
Quoted 4 lines · Irui Wang

From: kyrie wu <[email protected]>

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

nit: s/judgement/conditional block/ ...

drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c static int mtk_jpeg_probe(struct platform_device *pdev) · line 1697

Quoted 2 lines
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +1 -1
-if (list_empty(&pdev->dev.devres_head)) {
+if (!jpeg->variant->hw_arch) {

... like here (if block).

Quoted 7 lines
Quoted 1 line

Thanks.

Hi Bagas,

I can't get your suggestion exactly.
Do you mean to change if (...) as follows:
if (jpeg->variant->hw_arch)

No, not what I mean. I pointed you at the correct terminology with your code as example.

Thanks.

Signature · 1 line
An old man doll... just what I always wanted! - Clara