2022-12-07 06:11:55

by Allen-KH Cheng

[permalink] [raw]
Subject: [PATCH v6 0/3] Add vcodec lat and core nodes for mt8192

This series is based on linux-next.

Change from v5:
- Add required interrupts for mediatek,mtk-vcodec-core
- Rewrite commit message for 'Remove "dma-ranges" property for decoder' PATCH

Change from v4:
- Add patch for removing dma-ranges
- Update child names to video-codec
- Update patch title and message

Change from v3:
- Drop `vcodec_lat:` and `vcodec_core:`

Change from v2:
- Add a dt-bindings patch for changing "vcodec" to "video-codec"
- Rename child names for vcodec lat and core nodes

Change from v1:
- Replace node names with video-codec
[Allen-KH Cheng <[email protected]>]

Allen-KH Cheng (3):
media: dt-bindings: media: mediatek: Rename child node names for
decoder
media: dt-bindings: media: mediatek: Remove "dma-ranges" property for
decoder
arm64: dts: mt8192: Add video-codec nodes

.../media/mediatek,vcodec-subdev-decoder.yaml | 68 ++-----------------
arch/arm64/boot/dts/mediatek/mt8192.dtsi | 59 ++++++++++++++++
2 files changed, 64 insertions(+), 63 deletions(-)

--
2.18.0


2022-12-07 06:31:25

by Allen-KH Cheng

[permalink] [raw]
Subject: [PATCH v6 3/3] arm64: dts: mt8192: Add video-codec nodes

Add video-codec lat and core nodes for mt8192 SoC.

Signed-off-by: Allen-KH Cheng <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
Reviewed-by: Nícolas F. R. A. Prado <[email protected]>
Tested-by: Nícolas F. R. A. Prado <[email protected]>
---
arch/arm64/boot/dts/mediatek/mt8192.dtsi | 59 ++++++++++++++++++++++++
1 file changed, 59 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8192.dtsi b/arch/arm64/boot/dts/mediatek/mt8192.dtsi
index 6b20376191a7..fffddef5c92f 100644
--- a/arch/arm64/boot/dts/mediatek/mt8192.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8192.dtsi
@@ -1449,6 +1449,65 @@
power-domains = <&spm MT8192_POWER_DOMAIN_ISP2>;
};

+ vcodec_dec: video-codec@16000000 {
+ compatible = "mediatek,mt8192-vcodec-dec";
+ reg = <0 0x16000000 0 0x1000>;
+ mediatek,scp = <&scp>;
+ iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>;
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges = <0 0 0 0x16000000 0 0x26000>;
+
+ video-codec@10000 {
+ compatible = "mediatek,mtk-vcodec-lat";
+ reg = <0x0 0x10000 0 0x800>;
+ interrupts = <GIC_SPI 426 IRQ_TYPE_LEVEL_HIGH 0>;
+ iommus = <&iommu0 M4U_PORT_L5_VDEC_LAT0_VLD_EXT>,
+ <&iommu0 M4U_PORT_L5_VDEC_LAT0_VLD2_EXT>,
+ <&iommu0 M4U_PORT_L5_VDEC_LAT0_AVC_MV_EXT>,
+ <&iommu0 M4U_PORT_L5_VDEC_LAT0_PRED_RD_EXT>,
+ <&iommu0 M4U_PORT_L5_VDEC_LAT0_TILE_EXT>,
+ <&iommu0 M4U_PORT_L5_VDEC_LAT0_WDMA_EXT>,
+ <&iommu0 M4U_PORT_L5_VDEC_LAT0_RG_CTRL_DMA_EXT>,
+ <&iommu0 M4U_PORT_L5_VDEC_UFO_ENC_EXT>;
+ clocks = <&topckgen CLK_TOP_VDEC_SEL>,
+ <&vdecsys_soc CLK_VDEC_SOC_VDEC>,
+ <&vdecsys_soc CLK_VDEC_SOC_LAT>,
+ <&vdecsys_soc CLK_VDEC_SOC_LARB1>,
+ <&topckgen CLK_TOP_MAINPLL_D4>;
+ clock-names = "sel", "soc-vdec", "soc-lat", "vdec", "top";
+ assigned-clocks = <&topckgen CLK_TOP_VDEC_SEL>;
+ assigned-clock-parents = <&topckgen CLK_TOP_MAINPLL_D4>;
+ power-domains = <&spm MT8192_POWER_DOMAIN_VDEC>;
+ };
+
+ video-codec@25000 {
+ compatible = "mediatek,mtk-vcodec-core";
+ reg = <0 0x25000 0 0x1000>;
+ interrupts = <GIC_SPI 425 IRQ_TYPE_LEVEL_HIGH 0>;
+ iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>,
+ <&iommu0 M4U_PORT_L4_VDEC_UFO_EXT>,
+ <&iommu0 M4U_PORT_L4_VDEC_PP_EXT>,
+ <&iommu0 M4U_PORT_L4_VDEC_PRED_RD_EXT>,
+ <&iommu0 M4U_PORT_L4_VDEC_PRED_WR_EXT>,
+ <&iommu0 M4U_PORT_L4_VDEC_PPWRAP_EXT>,
+ <&iommu0 M4U_PORT_L4_VDEC_TILE_EXT>,
+ <&iommu0 M4U_PORT_L4_VDEC_VLD_EXT>,
+ <&iommu0 M4U_PORT_L4_VDEC_VLD2_EXT>,
+ <&iommu0 M4U_PORT_L4_VDEC_AVC_MV_EXT>,
+ <&iommu0 M4U_PORT_L4_VDEC_RG_CTRL_DMA_EXT>;
+ clocks = <&topckgen CLK_TOP_VDEC_SEL>,
+ <&vdecsys CLK_VDEC_VDEC>,
+ <&vdecsys CLK_VDEC_LAT>,
+ <&vdecsys CLK_VDEC_LARB1>,
+ <&topckgen CLK_TOP_MAINPLL_D4>;
+ clock-names = "sel", "soc-vdec", "soc-lat", "vdec", "top";
+ assigned-clocks = <&topckgen CLK_TOP_VDEC_SEL>;
+ assigned-clock-parents = <&topckgen CLK_TOP_MAINPLL_D4>;
+ power-domains = <&spm MT8192_POWER_DOMAIN_VDEC2>;
+ };
+ };
+
larb5: larb@1600d000 {
compatible = "mediatek,mt8192-smi-larb";
reg = <0 0x1600d000 0 0x1000>;
--
2.18.0

2022-12-07 06:35:28

by Allen-KH Cheng

[permalink] [raw]
Subject: [PATCH v6 2/3] media: dt-bindings: media: mediatek: Remove "dma-ranges" property for decoder

Because the decoder nodes already make use of the iommus property to
configure the IOMMU for address translations, having a dma-ranges
property makes no sense.

In fact, after commit f1ad5338a4d5 ("of: Fix "dma-ranges" handling for
bus controllers"), having a dma-ranges property causes IOMMU faults.

Remove the dma-ranges property and update the example.

Signed-off-by: Allen-KH Cheng <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
Acked-by: Rob Herring <[email protected]>
Reviewed-by: Nícolas F. R. A. Prado <[email protected]>
---
.../bindings/media/mediatek,vcodec-subdev-decoder.yaml | 7 -------
1 file changed, 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
index 46308cdaacc0..7efc70ae4406 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
@@ -76,11 +76,6 @@ properties:
The node of system control processor (SCP), using
the remoteproc & rpmsg framework.

- dma-ranges:
- maxItems: 1
- description: |
- Describes the physical address space of IOMMU maps to memory.
-
"#address-cells":
const: 2

@@ -151,7 +146,6 @@ required:
- reg
- iommus
- mediatek,scp
- - dma-ranges
- ranges

if:
@@ -185,7 +179,6 @@ examples:
compatible = "mediatek,mt8192-vcodec-dec";
mediatek,scp = <&scp>;
iommus = <&iommu0 M4U_PORT_L4_VDEC_MC_EXT>;
- dma-ranges = <0x1 0x0 0x0 0x40000000 0x0 0xfff00000>;
#address-cells = <2>;
#size-cells = <2>;
ranges = <0 0 0 0x16000000 0 0x40000>;
--
2.18.0

2022-12-07 06:52:37

by Allen-KH Cheng

[permalink] [raw]
Subject: [PATCH v6 1/3] media: dt-bindings: media: mediatek: Rename child node names for decoder

In order to make the names of the child nodes more generic, we rename
"vcodec-lat" and "vcodec-core" to "video-codec" for decoder in
patternProperties and example.

Signed-off-by: Allen-KH Cheng <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
---
.../media/mediatek,vcodec-subdev-decoder.yaml | 61 ++-----------------
1 file changed, 5 insertions(+), 56 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
index c4f20acdc1f8..46308cdaacc0 100644
--- a/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
+++ b/Documentation/devicetree/bindings/media/mediatek,vcodec-subdev-decoder.yaml
@@ -91,12 +91,13 @@ properties:

# Required child node:
patternProperties:
- '^vcodec-lat@[0-9a-f]+$':
+ '^video-codec@[0-9a-f]+$':
type: object

properties:
compatible:
enum:
+ - mediatek,mtk-vcodec-core
- mediatek,mtk-vcodec-lat
- mediatek,mtk-vcodec-lat-soc

@@ -145,59 +146,6 @@ patternProperties:

additionalProperties: false

- '^vcodec-core@[0-9a-f]+$':
- type: object
-
- properties:
- compatible:
- const: mediatek,mtk-vcodec-core
-
- reg:
- maxItems: 1
-
- interrupts:
- maxItems: 1
-
- iommus:
- minItems: 1
- maxItems: 32
- description: |
- List of the hardware port in respective IOMMU block for current Socs.
- Refer to bindings/iommu/mediatek,iommu.yaml.
-
- clocks:
- maxItems: 5
-
- clock-names:
- items:
- - const: sel
- - const: soc-vdec
- - const: soc-lat
- - const: vdec
- - const: top
-
- assigned-clocks:
- maxItems: 1
-
- assigned-clock-parents:
- maxItems: 1
-
- power-domains:
- maxItems: 1
-
- required:
- - compatible
- - reg
- - interrupts
- - iommus
- - clocks
- - clock-names
- - assigned-clocks
- - assigned-clock-parents
- - power-domains
-
- additionalProperties: false
-
required:
- compatible
- reg
@@ -211,6 +159,7 @@ if:
compatible:
contains:
enum:
+ - mediatek,mtk-vcodec-core
- mediatek,mtk-vcodec-lat

then:
@@ -241,7 +190,7 @@ examples:
#size-cells = <2>;
ranges = <0 0 0 0x16000000 0 0x40000>;
reg = <0 0x16000000 0 0x1000>; /* VDEC_SYS */
- vcodec-lat@10000 {
+ video-codec@10000 {
compatible = "mediatek,mtk-vcodec-lat";
reg = <0 0x10000 0 0x800>;
interrupts = <GIC_SPI 426 IRQ_TYPE_LEVEL_HIGH 0>;
@@ -264,7 +213,7 @@ examples:
power-domains = <&spm MT8192_POWER_DOMAIN_VDEC>;
};

- vcodec-core@25000 {
+ video-codec@25000 {
compatible = "mediatek,mtk-vcodec-core";
reg = <0 0x25000 0 0x1000>;
interrupts = <GIC_SPI 425 IRQ_TYPE_LEVEL_HIGH 0>;
--
2.18.0

Subject: Re: [PATCH v6 1/3] media: dt-bindings: media: mediatek: Rename child node names for decoder

Il 07/12/22 06:51, Allen-KH Cheng ha scritto:
> In order to make the names of the child nodes more generic, we rename
> "vcodec-lat" and "vcodec-core" to "video-codec" for decoder in
> patternProperties and example.
>
> Signed-off-by: Allen-KH Cheng <[email protected]>
> Reviewed-by: Krzysztof Kozlowski <[email protected]>

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>


Subject: Re: [PATCH v6 0/3] Add vcodec lat and core nodes for mt8192

Il 07/12/22 06:51, Allen-KH Cheng ha scritto:
> This series is based on linux-next.
>
> Change from v5:
> - Add required interrupts for mediatek,mtk-vcodec-core
> - Rewrite commit message for 'Remove "dma-ranges" property for decoder' PATCH
>
> Change from v4:
> - Add patch for removing dma-ranges
> - Update child names to video-codec
> - Update patch title and message
>
> Change from v3:
> - Drop `vcodec_lat:` and `vcodec_core:`
>
> Change from v2:
> - Add a dt-bindings patch for changing "vcodec" to "video-codec"
> - Rename child names for vcodec lat and core nodes
>
> Change from v1:
> - Replace node names with video-codec
> [Allen-KH Cheng <[email protected]>]
>
> Allen-KH Cheng (3):
> media: dt-bindings: media: mediatek: Rename child node names for
> decoder
> media: dt-bindings: media: mediatek: Remove "dma-ranges" property for
> decoder
> arm64: dts: mt8192: Add video-codec nodes
>
> .../media/mediatek,vcodec-subdev-decoder.yaml | 68 ++-----------------
> arch/arm64/boot/dts/mediatek/mt8192.dtsi | 59 ++++++++++++++++
> 2 files changed, 64 insertions(+), 63 deletions(-)
>

Matthias, can you please pick this one? It's all good and tested.

Thanks,
Angelo