Skip to contentSkip to conversation

PATCH Superseded Jianhua Lin 1 participant 4 messages Mar 24

Subsystems (4)

v3 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

From: Jianhua Lin <[email protected]>
Date: Mon, 23 Mar 2026 16:12:30 +0800
Subject: [PATCH v3 0/3] Mediatek MT8189 JPEG support

This series is based on tag: next-20260320, linux-next/master

Changes compared with v2:
- Dropped the dts patch (arm64: dts: mt8188: update JPEG encoder/decoder compatible) as it belongs to a different tree/series.
- Patches 1/3 (dt-bindings: decoder):
- Changed the MT8189 compatible to be a standalone const instead of

    an `enum`.

- Added an allOf block with conditional checks to enforce the single clock ("jpgdec") requirement for MT8189, while preserving the two-clock requirement for older SoCs.
- Updated commit message to reflect the schema structure changes and hardware differences.
- Patches 2/3 (dt-bindings: encoder):
- Changed the MT8189 compatible to be a standalone const instead of an enum inside the items list, as it does not fallback to "mediatek,mtk-jpgenc" due to 34-bit IOVA requirements.
- Updated commit message to explain the standalone compatible design.
- Patches 3/3 (media: mediatek: jpeg):
- Refined commit message for better clarity regarding 34-bit IOVA and single clock configuration.

Changes compared with v1:
- Patches 1/4:
- Updating commit message
- Patches 2/4, 3/4:
- Updating commit message
- Adjusted property descriptions acorrding to hardware requirements
- Improved formatting for better readability and consistency
- Patches 4/4:
- Updating commit message

Jianhua Lin (3):
dt-bindings: media: mediatek-jpeg-decoder: add MT8189 compatible
string
dt-bindings: media: mediatek-jpeg-encoder: add MT8189 compatible
string
media: mediatek: jpeg: add compatible for MT8189 SoC

 .../bindings/media/mediatek-jpeg-decoder.yaml | 39 +++++++++++++---
 .../bindings/media/mediatek-jpeg-encoder.yaml | 20 ++++++---
 .../platform/mediatek/jpeg/mtk_jpeg_core.c    | 44 +++++++++++++++++++
 3 files changed, 91 insertions(+), 12 deletions(-)
Signature · 1 line
2.45.2
#1 lore raw

PATCH v3 1/3 dt-bindings: media: mediatek-jpeg-decoder: add MT8189 compatible string

Add the compatible string for the JPEG decoder block found in the MediaTek MT8189 SoC.

Compared to previous generation ICs, the MT8189 JPEG decoder requires 34-bit IOVA address space support and only needs a single clock ("jpgdec") instead of two. Therefore, it is added as a standalone compatible string without falling back to older SoCs.

Update the binding schema to include the new compatible string and add an allOf block with conditional checks. This enforces the single clock requirement for MT8189 while preserving the two-clock requirement ("jpgdec-smi", "jpgdec") for older SoCs.

---
 .../bindings/media/mediatek-jpeg-decoder.yaml | 39 ++++++++++++++++---
 1 file changed, 34 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/media/mediatek-jpeg-decoder.yaml +34 -5
index a4aacd3eb189..91c9b2a4687b 100644
@@ -17,13 +17,14 @@ properties:
     oneOf:
       - items:
           - enum:
-              - mediatek,mt8173-jpgdec
               - mediatek,mt2701-jpgdec
+              - mediatek,mt8173-jpgdec
       - items:
           - enum:
               - mediatek,mt7623-jpgdec
               - mediatek,mt8188-jpgdec
           - const: mediatek,mt2701-jpgdec
+      - const: mediatek,mt8189-jpgdec
 
   reg:
     maxItems: 1
@@ -32,13 +33,22 @@ properties:
     maxItems: 1
 
   clocks:
+    minItems: 1
     maxItems: 2
-    minItems: 2
 
   clock-names:
-    items:
-      - const: jpgdec-smi
-      - const: jpgdec
+    minItems: 1
+    maxItems: 2
+    oneOf:
+      - items:
+          - const: jpgdec
+      - items:
+          - const: jpgdec-smi
+          - const: jpgdec
+
+  mediatek,larb:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: a phandle to the smi_larb node.
 
   power-domains:
     maxItems: 1
@@ -60,6 +70,25 @@ required:
   - power-domains
   - iommus
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: mediatek,mt8189-jpgdec
+    then:
+      properties:
+        clocks:
+          maxItems: 1
+        clock-names:
+          maxItems: 1
+    else:
+      properties:
+        clocks:
+          minItems: 2
+        clock-names:
+          minItems: 2
+
 additionalProperties: false
 
 examples:
Signature · 1 line
2.45.2
#2 lore raw

PATCH v3 2/3 dt-bindings: media: mediatek-jpeg-encoder: add MT8189 compatible string

In reply to Jianhua Lin

Add the compatible string for the JPEG encoder block found in the MediaTek MT8189 SoC.

Unlike some previous SoCs, the MT8189 JPEG encoder requires 34-bit IOVA address space support. Therefore, it is added as a standalone compatible string without falling back to the generic "mediatek,mtk-jpgenc" to ensure the driver applies the correct hardware-specific configurations.

---
 .../bindings/media/mediatek-jpeg-encoder.yaml | 20 ++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/media/mediatek-jpeg-encoder.yaml +13 -7
index 5b15f8977f67..476b7122d3fc 100644
@@ -14,13 +14,15 @@ description: |-
 
 properties:
   compatible:
-    items:
-      - enum:
-          - mediatek,mt2701-jpgenc
-          - mediatek,mt8183-jpgenc
-          - mediatek,mt8186-jpgenc
-          - mediatek,mt8188-jpgenc
-      - const: mediatek,mtk-jpgenc
+    oneOf:
+      - items:
+          - enum:
+              - mediatek,mt2701-jpgenc
+              - mediatek,mt8183-jpgenc
+              - mediatek,mt8186-jpgenc
+              - mediatek,mt8188-jpgenc
+          - const: mediatek,mtk-jpgenc
+      - const: mediatek,mt8189-jpgenc
   reg:
     maxItems: 1
 
@@ -34,6 +36,10 @@ properties:
     items:
       - const: jpgenc
 
+  mediatek,larb:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description: a phandle to the smi_larb node.
+
   power-domains:
     maxItems: 1
 
Signature · 1 line
2.45.2
#3 lore raw

PATCH v3 3/3 media: mediatek: jpeg: add compatible for MT8189 SoC

In reply to Jianhua Lin

Compared to the previous generation ICs, the MT8189 uses a 34-bit IOVA address space (16GB) and requires a single clock configuration.

Therefore, add new compatible strings ("mediatek,mt8189-jpgenc" and "mediatek,mt8189-jpgdec") along with their specific driver data to support the JPEG encoder and decoder of the MT8189 SoC.

---
 .../platform/mediatek/jpeg/mtk_jpeg_core.c    | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +44 -0
index c01124a349f6..c6fc5d228e20 100644
@@ -1866,6 +1866,10 @@ static struct clk_bulk_data mt8173_jpeg_dec_clocks[] = {
 	{ .id = "jpgdec" },
 };
 
+static struct clk_bulk_data mtk_jpeg_dec_clocks[] = {
+	{ .id = "jpgdec" },
+};
+
 static const struct mtk_jpeg_variant mt8173_jpeg_drvdata = {
 	.clks = mt8173_jpeg_dec_clocks,
 	.num_clks = ARRAY_SIZE(mt8173_jpeg_dec_clocks),
@@ -1897,6 +1901,38 @@ static const struct mtk_jpeg_variant mtk_jpeg_drvdata = {
 	.multi_core = false,
 };
 
+static const struct mtk_jpeg_variant mtk8189_jpegenc_drvdata = {
+	.clks = mtk_jpeg_clocks,
+	.num_clks = ARRAY_SIZE(mtk_jpeg_clocks),
+	.formats = mtk_jpeg_enc_formats,
+	.num_formats = MTK_JPEG_ENC_NUM_FORMATS,
+	.qops = &mtk_jpeg_enc_qops,
+	.irq_handler = mtk_jpeg_enc_irq,
+	.hw_reset = mtk_jpeg_enc_reset,
+	.m2m_ops = &mtk_jpeg_enc_m2m_ops,
+	.dev_name = "mtk-jpeg-enc",
+	.ioctl_ops = &mtk_jpeg_enc_ioctl_ops,
+	.out_q_default_fourcc = V4L2_PIX_FMT_YUYV,
+	.cap_q_default_fourcc = V4L2_PIX_FMT_JPEG,
+	.support_34bit = true,
+};
+
+static const struct mtk_jpeg_variant mtk8189_jpegdec_drvdata = {
+	.clks = mtk_jpeg_dec_clocks,
+	.num_clks = ARRAY_SIZE(mtk_jpeg_dec_clocks),
+	.formats = mtk_jpeg_dec_formats,
+	.num_formats = MTK_JPEG_DEC_NUM_FORMATS,
+	.qops = &mtk_jpeg_dec_qops,
+	.irq_handler = mtk_jpeg_dec_irq,
+	.hw_reset = mtk_jpeg_dec_reset,
+	.m2m_ops = &mtk_jpeg_dec_m2m_ops,
+	.dev_name = "mtk-jpeg-dec",
+	.ioctl_ops = &mtk_jpeg_dec_ioctl_ops,
+	.out_q_default_fourcc = V4L2_PIX_FMT_JPEG,
+	.cap_q_default_fourcc = V4L2_PIX_FMT_YUV420M,
+	.support_34bit = true,
+};
+
 static struct mtk_jpeg_variant mtk8195_jpegenc_drvdata = {
 	.formats = mtk_jpeg_enc_formats,
 	.num_formats = MTK_JPEG_ENC_NUM_FORMATS,
@@ -1936,6 +1972,14 @@ static const struct of_device_id mtk_jpeg_match[] = {
 		.compatible = "mediatek,mtk-jpgenc",
 		.data = &mtk_jpeg_drvdata,
 	},
+	{
+		.compatible = "mediatek,mt8189-jpgenc",
+		.data = &mtk8189_jpegenc_drvdata,
+	},
+	{
+		.compatible = "mediatek,mt8189-jpgdec",
+		.data = &mtk8189_jpegdec_drvdata,
+	},
 	{
 		.compatible = "mediatek,mt8195-jpgenc",
 		.data = &mtk8195_jpegenc_drvdata,
Signature · 1 line
2.45.2