2023-10-04 09:16:45

by Hugues Fruchet

[permalink] [raw]
Subject: [PATCH 0/7] Add support for video hardware codec of STMicroelectronics STM32 SoC series

This patchset introduces support for VDEC video hardware decoder
and VENC video hardware encoder of STMicroelectronics STM32MP25
SoC series.

This initial support implements H264 decoding, VP8 decoding and
JPEG encoding.

This has been tested on STM32MP257F-EV1 evaluation board.

Hugues Fruchet (7):
dt-bindings: media: Document STM32MP25 VDEC video decoder
media: hantro: add support for STM32MP25 VDEC
dt-bindings: media: Document STM32MP25 VENC video encoder
media: hantro: add support for STM32MP25 VENC
arm64: dts: st: add soc & rifsc structure to stm32mp255
arm64: dts: st: add video decoder support to stm32mp255
arm64: dts: st: add video encoder support to stm32mp255

.../bindings/media/st,stm32mp25-vdec.yaml | 56 +++++++
.../bindings/media/st,stm32mp25-venc.yaml | 56 +++++++
arch/arm64/boot/dts/st/stm32mp251.dtsi | 12 ++
arch/arm64/boot/dts/st/stm32mp255.dtsi | 21 +++
drivers/media/platform/verisilicon/Kconfig | 14 +-
drivers/media/platform/verisilicon/Makefile | 4 +
.../media/platform/verisilicon/hantro_drv.c | 4 +
.../media/platform/verisilicon/hantro_hw.h | 2 +
.../platform/verisilicon/stm32mp25_vdec_hw.c | 92 +++++++++++
.../platform/verisilicon/stm32mp25_venc_hw.c | 147 ++++++++++++++++++
10 files changed, 405 insertions(+), 3 deletions(-)
create mode 100644 Documentation/devicetree/bindings/media/st,stm32mp25-vdec.yaml
create mode 100644 Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
create mode 100644 drivers/media/platform/verisilicon/stm32mp25_vdec_hw.c
create mode 100644 drivers/media/platform/verisilicon/stm32mp25_venc_hw.c

--
2.25.1


2023-10-04 09:16:49

by Hugues Fruchet

[permalink] [raw]
Subject: [PATCH 4/7] media: hantro: add support for STM32MP25 VENC

Add support for STM32MP25 VENC video hardware encoder.
JPEG encoding up to 8176x8176.
VENC has its own reset/clock/irq.

Signed-off-by: Hugues Fruchet <[email protected]>
---
drivers/media/platform/verisilicon/Makefile | 3 +-
.../media/platform/verisilicon/hantro_drv.c | 1 +
.../media/platform/verisilicon/hantro_hw.h | 1 +
.../platform/verisilicon/stm32mp25_venc_hw.c | 147 ++++++++++++++++++
4 files changed, 151 insertions(+), 1 deletion(-)
create mode 100644 drivers/media/platform/verisilicon/stm32mp25_venc_hw.c

diff --git a/drivers/media/platform/verisilicon/Makefile b/drivers/media/platform/verisilicon/Makefile
index 5854e0f0dd32..3bf43fdbedc1 100644
--- a/drivers/media/platform/verisilicon/Makefile
+++ b/drivers/media/platform/verisilicon/Makefile
@@ -41,4 +41,5 @@ hantro-vpu-$(CONFIG_VIDEO_HANTRO_SUNXI) += \
sunxi_vpu_hw.o

hantro-vpu-$(CONFIG_VIDEO_HANTRO_STM32MP25) += \
- stm32mp25_vdec_hw.o
+ stm32mp25_vdec_hw.o \
+ stm32mp25_venc_hw.o
diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c
index 8c6e0c66f0cd..3156aff50eb5 100644
--- a/drivers/media/platform/verisilicon/hantro_drv.c
+++ b/drivers/media/platform/verisilicon/hantro_drv.c
@@ -735,6 +735,7 @@ static const struct of_device_id of_hantro_match[] = {
#endif
#ifdef CONFIG_VIDEO_HANTRO_STM32MP25
{ .compatible = "st,stm32mp25-vdec", .data = &stm32mp25_vdec_variant, },
+ { .compatible = "st,stm32mp25-venc", .data = &stm32mp25_venc_variant, },
#endif
{ /* sentinel */ }
};
diff --git a/drivers/media/platform/verisilicon/hantro_hw.h b/drivers/media/platform/verisilicon/hantro_hw.h
index b7eccc1a96fc..70c72e9d11d5 100644
--- a/drivers/media/platform/verisilicon/hantro_hw.h
+++ b/drivers/media/platform/verisilicon/hantro_hw.h
@@ -407,6 +407,7 @@ extern const struct hantro_variant rk3588_vpu981_variant;
extern const struct hantro_variant sama5d4_vdec_variant;
extern const struct hantro_variant sunxi_vpu_variant;
extern const struct hantro_variant stm32mp25_vdec_variant;
+extern const struct hantro_variant stm32mp25_venc_variant;

extern const struct hantro_postproc_ops hantro_g1_postproc_ops;
extern const struct hantro_postproc_ops hantro_g2_postproc_ops;
diff --git a/drivers/media/platform/verisilicon/stm32mp25_venc_hw.c b/drivers/media/platform/verisilicon/stm32mp25_venc_hw.c
new file mode 100644
index 000000000000..0aac33afcadc
--- /dev/null
+++ b/drivers/media/platform/verisilicon/stm32mp25_venc_hw.c
@@ -0,0 +1,147 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * STM32MP25 VENC video encoder driver
+ *
+ * Copyright (C) STMicroelectronics SA 2022
+ * Authors: Hugues Fruchet <[email protected]>
+ * for STMicroelectronics.
+ *
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/reset.h>
+
+#include "hantro.h"
+#include "hantro_jpeg.h"
+#include "hantro_h1_regs.h"
+
+/*
+ * Supported formats.
+ */
+
+static const struct hantro_fmt stm32mp25_venc_fmts[] = {
+ {
+ .fourcc = V4L2_PIX_FMT_YUV420M,
+ .codec_mode = HANTRO_MODE_NONE,
+ .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUV420P,
+ .frmsize = {
+ .min_width = 96,
+ .max_width = 8176,
+ .step_width = MB_DIM,
+ .min_height = 32,
+ .max_height = 8176,
+ .step_height = MB_DIM,
+ },
+ },
+ {
+ .fourcc = V4L2_PIX_FMT_NV12M,
+ .codec_mode = HANTRO_MODE_NONE,
+ .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUV420SP,
+ .frmsize = {
+ .min_width = 96,
+ .max_width = 8176,
+ .step_width = MB_DIM,
+ .min_height = 32,
+ .max_height = 8176,
+ .step_height = MB_DIM,
+ },
+ },
+ {
+ .fourcc = V4L2_PIX_FMT_YUYV,
+ .codec_mode = HANTRO_MODE_NONE,
+ .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUYV422,
+ .frmsize = {
+ .min_width = 96,
+ .max_width = 8176,
+ .step_width = MB_DIM,
+ .min_height = 32,
+ .max_height = 8176,
+ .step_height = MB_DIM,
+ },
+ },
+ {
+ .fourcc = V4L2_PIX_FMT_UYVY,
+ .codec_mode = HANTRO_MODE_NONE,
+ .enc_fmt = ROCKCHIP_VPU_ENC_FMT_UYVY422,
+ .frmsize = {
+ .min_width = 96,
+ .max_width = 8176,
+ .step_width = MB_DIM,
+ .min_height = 32,
+ .max_height = 8176,
+ .step_height = MB_DIM,
+ },
+ },
+ {
+ .fourcc = V4L2_PIX_FMT_JPEG,
+ .codec_mode = HANTRO_MODE_JPEG_ENC,
+ .max_depth = 2,
+ .header_size = JPEG_HEADER_SIZE,
+ .frmsize = {
+ .min_width = 96,
+ .max_width = 8176,
+ .step_width = MB_DIM,
+ .min_height = 32,
+ .max_height = 8176,
+ .step_height = MB_DIM,
+ },
+ },
+};
+
+static irqreturn_t stm32mp25_venc_irq(int irq, void *dev_id)
+{
+ struct hantro_dev *vpu = dev_id;
+ enum vb2_buffer_state state;
+ u32 status;
+
+ status = vepu_read(vpu, H1_REG_INTERRUPT);
+ state = (status & H1_REG_INTERRUPT_FRAME_RDY) ?
+ VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR;
+
+ vepu_write(vpu, H1_REG_INTERRUPT_BIT, H1_REG_INTERRUPT);
+
+ hantro_irq_done(vpu, state);
+
+ return IRQ_HANDLED;
+}
+
+static void stm32mp25_venc_reset(struct hantro_ctx *ctx)
+{
+}
+
+/*
+ * Supported codec ops.
+ */
+
+static const struct hantro_codec_ops stm32mp25_venc_codec_ops[] = {
+ [HANTRO_MODE_JPEG_ENC] = {
+ .run = hantro_h1_jpeg_enc_run,
+ .reset = stm32mp25_venc_reset,
+ .done = hantro_h1_jpeg_enc_done,
+ },
+};
+
+/*
+ * Variants.
+ */
+
+static const struct hantro_irq stm32mp25_venc_irqs[] = {
+ { "venc", stm32mp25_venc_irq },
+};
+
+static const char * const stm32mp25_venc_clk_names[] = {
+ "venc-clk"
+};
+
+const struct hantro_variant stm32mp25_venc_variant = {
+ .enc_fmts = stm32mp25_venc_fmts,
+ .num_enc_fmts = ARRAY_SIZE(stm32mp25_venc_fmts),
+ .codec = HANTRO_JPEG_ENCODER,
+ .codec_ops = stm32mp25_venc_codec_ops,
+ .irqs = stm32mp25_venc_irqs,
+ .num_irqs = ARRAY_SIZE(stm32mp25_venc_irqs),
+ .clk_names = stm32mp25_venc_clk_names,
+ .num_clocks = ARRAY_SIZE(stm32mp25_venc_clk_names)
+};
+
--
2.25.1

2023-10-04 09:16:52

by Hugues Fruchet

[permalink] [raw]
Subject: [PATCH 1/7] dt-bindings: media: Document STM32MP25 VDEC video decoder

Add STM32MP25 VDEC video decoder bindings.

Signed-off-by: Hugues Fruchet <[email protected]>
---
.../bindings/media/st,stm32mp25-vdec.yaml | 56 +++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/st,stm32mp25-vdec.yaml

diff --git a/Documentation/devicetree/bindings/media/st,stm32mp25-vdec.yaml b/Documentation/devicetree/bindings/media/st,stm32mp25-vdec.yaml
new file mode 100644
index 000000000000..cf41f704113f
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/st,stm32mp25-vdec.yaml
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/st,stm32mp25-vdec.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STMicroelectronics STM32MP25 VDEC video decoder
+
+maintainers:
+ - Hugues Fruchet <[email protected]>
+
+description:
+ The STMicroelectronics STM32MP25 SOCs embeds a VDEC video hardware decoder
+ peripheral based on Verisilicon VC8000NanoD IP (former Hantro G1).
+
+properties:
+ compatible:
+ const: st,stm32mp25-vdec
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ interrupt-names:
+ maxItems: 1
+
+ clocks:
+ maxItems: 1
+
+ clock-names:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - interrupt-names
+ - clocks
+ - clock-names
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ vdec: vdec@580d0000 {
+ compatible = "st,stm32mp25-vdec";
+ reg = <0x580d0000 0x3c8>;
+ interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "vdec";
+ clocks = <&ck_icn_p_vdec>;
+ clock-names = "vdec-clk";
+ };
--
2.25.1

2023-10-04 09:17:15

by Hugues Fruchet

[permalink] [raw]
Subject: [PATCH 3/7] dt-bindings: media: Document STM32MP25 VENC video encoder

Add STM32MP25 VENC video encoder bindings.

Signed-off-by: Hugues Fruchet <[email protected]>
---
.../bindings/media/st,stm32mp25-venc.yaml | 56 +++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml

diff --git a/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml b/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
new file mode 100644
index 000000000000..c69e0a34f675
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/st,stm32mp25-venc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: STMicroelectronics STM32MP25 VENC video encoder
+
+maintainers:
+ - Hugues Fruchet <[email protected]>
+
+description:
+ The STMicroelectronics STM32MP25 SOCs embeds a VENC video hardware encoder
+ peripheral based on Verisilicon VC8000NanoE IP (former Hantro H1).
+
+properties:
+ compatible:
+ const: st,stm32mp25-venc
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ interrupt-names:
+ maxItems: 1
+
+ clocks:
+ maxItems: 1
+
+ clock-names:
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - interrupt-names
+ - clocks
+ - clock-names
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ venc: venc@580e0000 {
+ compatible = "st,stm32mp25-venc";
+ reg = <0x580e0000 0x800>;
+ interrupts = <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "venc";
+ clocks = <&ck_icn_p_venc>;
+ clock-names = "venc-clk";
+ };
--
2.25.1

2023-10-04 09:17:33

by Hugues Fruchet

[permalink] [raw]
Subject: [PATCH 5/7] arm64: dts: st: add soc & rifsc structure to stm32mp255

Add soc & rifsc structure to stm32mp255.

Signed-off-by: Hugues Fruchet <[email protected]>
---
arch/arm64/boot/dts/st/stm32mp255.dtsi | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/arm64/boot/dts/st/stm32mp255.dtsi b/arch/arm64/boot/dts/st/stm32mp255.dtsi
index e6fa596211f5..4f2b224fe077 100644
--- a/arch/arm64/boot/dts/st/stm32mp255.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp255.dtsi
@@ -6,4 +6,8 @@
#include "stm32mp253.dtsi"

/ {
+ soc@0 {
+ rifsc: rifsc-bus@42080000 {
+ };
+ };
};
--
2.25.1

2023-10-04 09:17:54

by Hugues Fruchet

[permalink] [raw]
Subject: [PATCH 6/7] arm64: dts: st: add video decoder support to stm32mp255

Add VDEC hardware video decoder support to STM32MP255.

Signed-off-by: Hugues Fruchet <[email protected]>
---
arch/arm64/boot/dts/st/stm32mp251.dtsi | 6 ++++++
arch/arm64/boot/dts/st/stm32mp255.dtsi | 8 ++++++++
2 files changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/st/stm32mp251.dtsi
index 5268a4321841..0ca421ede0ae 100644
--- a/arch/arm64/boot/dts/st/stm32mp251.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi
@@ -46,6 +46,12 @@ ck_icn_ls_mcu: ck-icn-ls-mcu {
compatible = "fixed-clock";
clock-frequency = <200000000>;
};
+
+ ck_icn_p_vdec: ck-icn-p-vdec {
+ #clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <200000000>;
+ };
};

firmware {
diff --git a/arch/arm64/boot/dts/st/stm32mp255.dtsi b/arch/arm64/boot/dts/st/stm32mp255.dtsi
index 4f2b224fe077..105ef2d71c77 100644
--- a/arch/arm64/boot/dts/st/stm32mp255.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp255.dtsi
@@ -8,6 +8,14 @@
/ {
soc@0 {
rifsc: rifsc-bus@42080000 {
+ vdec: vdec@480d0000 {
+ compatible = "st,stm32mp25-vdec";
+ reg = <0x480d0000 0x3c8>;
+ interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-names = "vdec";
+ clocks = <&ck_icn_p_vdec>;
+ clock-names = "vdec-clk";
+ };
};
};
};
--
2.25.1

2023-10-04 09:18:06

by Hugues Fruchet

[permalink] [raw]
Subject: [PATCH 7/7] arm64: dts: st: add video encoder support to stm32mp255

Add VENC hardware video encoder support to STM32MP255.

Signed-off-by: Hugues Fruchet <[email protected]>
---
arch/arm64/boot/dts/st/stm32mp251.dtsi | 6 ++++++
arch/arm64/boot/dts/st/stm32mp255.dtsi | 9 +++++++++
2 files changed, 15 insertions(+)

diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/st/stm32mp251.dtsi
index 0ca421ede0ae..2aff746968f5 100644
--- a/arch/arm64/boot/dts/st/stm32mp251.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi
@@ -52,6 +52,12 @@ ck_icn_p_vdec: ck-icn-p-vdec {
compatible = "fixed-clock";
clock-frequency = <200000000>;
};
+
+ ck_icn_p_venc: ck-icn-p-venc {
+ #clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <200000000>;
+ };
};

firmware {
diff --git a/arch/arm64/boot/dts/st/stm32mp255.dtsi b/arch/arm64/boot/dts/st/stm32mp255.dtsi
index 105ef2d71c77..0035fbf5e17d 100644
--- a/arch/arm64/boot/dts/st/stm32mp255.dtsi
+++ b/arch/arm64/boot/dts/st/stm32mp255.dtsi
@@ -16,6 +16,15 @@ vdec: vdec@480d0000 {
clocks = <&ck_icn_p_vdec>;
clock-names = "vdec-clk";
};
+
+ venc: venc@480e0000 {
+ compatible = "st,stm32mp25-venc";
+ reg = <0x480e0000 0x800>;
+ interrupt-names = "venc";
+ interrupts = <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>;
+ clock-names = "venc-clk";
+ clocks = <&ck_icn_ls_mcu>;
+ };
};
};
};
--
2.25.1

2023-10-04 23:41:44

by Adam Ford

[permalink] [raw]
Subject: Re: [PATCH 3/7] dt-bindings: media: Document STM32MP25 VENC video encoder

On Wed, Oct 4, 2023 at 4:16 AM Hugues Fruchet
<[email protected]> wrote:
>
> Add STM32MP25 VENC video encoder bindings.
>
> Signed-off-by: Hugues Fruchet <[email protected]>
> ---
> .../bindings/media/st,stm32mp25-venc.yaml | 56 +++++++++++++++++++
> 1 file changed, 56 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
>
> diff --git a/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml b/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
> new file mode 100644
> index 000000000000..c69e0a34f675
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
> @@ -0,0 +1,56 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/media/st,stm32mp25-venc.yaml#

Can this dt-binding be made more generic, like something like
hantro-h1 or VC8000NanoE?

I think there will be more boards that may incorporate the Hantro-H1
or a VC8000 in the future, because I don't think this IP is unique to
the STM32MP25.

adam

> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: STMicroelectronics STM32MP25 VENC video encoder
> +
> +maintainers:
> + - Hugues Fruchet <[email protected]>
> +
> +description:
> + The STMicroelectronics STM32MP25 SOCs embeds a VENC video hardware encoder
> + peripheral based on Verisilicon VC8000NanoE IP (former Hantro H1).
> +
> +properties:
> + compatible:
> + const: st,stm32mp25-venc
> +
> + reg:
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 1
> +
> + interrupt-names:
> + maxItems: 1
> +
> + clocks:
> + maxItems: 1
> +
> + clock-names:
> + maxItems: 1
> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> + - interrupt-names
> + - clocks
> + - clock-names
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/arm-gic.h>
> + venc: venc@580e0000 {
> + compatible = "st,stm32mp25-venc";
> + reg = <0x580e0000 0x800>;
> + interrupts = <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>;
> + interrupt-names = "venc";


Is the interrupt-names needed if there is only one?

> + clocks = <&ck_icn_p_venc>;
> + clock-names = "venc-clk";

Same thing for the clock. if there is only one clock, doe they need names?

adam
> + };
> --
> 2.25.1
>

2023-10-05 14:49:14

by Hugues Fruchet

[permalink] [raw]
Subject: Re: [PATCH 3/7] dt-bindings: media: Document STM32MP25 VENC video encoder

Hi Adam,

Thanks for review,

On 10/5/23 01:41, Adam Ford wrote:
> On Wed, Oct 4, 2023 at 4:16 AM Hugues Fruchet
> <[email protected]> wrote:
>>
>> Add STM32MP25 VENC video encoder bindings.
>>
>> Signed-off-by: Hugues Fruchet <[email protected]>
>> ---
>> .../bindings/media/st,stm32mp25-venc.yaml | 56 +++++++++++++++++++
>> 1 file changed, 56 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml b/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
>> new file mode 100644
>> index 000000000000..c69e0a34f675
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
>> @@ -0,0 +1,56 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/media/st,stm32mp25-venc.yaml#
>
> Can this dt-binding be made more generic, like something like
> hantro-h1 or VC8000NanoE?
>
> I think there will be more boards that may incorporate the Hantro-H1
> or a VC8000 in the future, because I don't think this IP is unique to
> the STM32MP25.

This is already the case, check variants in hantro_drv.c.
Several SoCs are sharing this IP but each IP slightly differs because of
supported resolution, codec, preprocessing features, ...
There are also some differences on how clock, interrupt, reset are
hardware mapped: shared or not by decoder and encoder for ex.

>
> adam
>
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: STMicroelectronics STM32MP25 VENC video encoder
>> +
>> +maintainers:
>> + - Hugues Fruchet <[email protected]>
>> +
>> +description:
>> + The STMicroelectronics STM32MP25 SOCs embeds a VENC video hardware encoder
>> + peripheral based on Verisilicon VC8000NanoE IP (former Hantro H1).
>> +
>> +properties:
>> + compatible:
>> + const: st,stm32mp25-venc
>> +
>> + reg:
>> + maxItems: 1
>> +
>> + interrupts:
>> + maxItems: 1
>> +
>> + interrupt-names:
>> + maxItems: 1
>> +
>> + clocks:
>> + maxItems: 1
>> +
>> + clock-names:
>> + maxItems: 1
>> +
>> +required:
>> + - compatible
>> + - reg
>> + - interrupts
>> + - interrupt-names
>> + - clocks
>> + - clock-names
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> + - |
>> + #include <dt-bindings/interrupt-controller/arm-gic.h>
>> + venc: venc@580e0000 {
>> + compatible = "st,stm32mp25-venc";
>> + reg = <0x580e0000 0x800>;
>> + interrupts = <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>;
>> + interrupt-names = "venc";
>
>
> Is the interrupt-names needed if there is only one?
>

Not really, could be dropped.

>> + clocks = <&ck_icn_p_venc>;
>> + clock-names = "venc-clk";
>
> Same thing for the clock. if there is only one clock, doe they need names?
>
Not really, could be dropped.

> adam
>> + };
>> --
>> 2.25.1
>>

BR,
Hugues.

2023-10-05 19:46:22

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 3/7] dt-bindings: media: Document STM32MP25 VENC video encoder

On 04/10/2023 11:15, Hugues Fruchet wrote:
> Add STM32MP25 VENC video encoder bindings.
>

I don't understand why this binding is separate from video decoder.
Merge them.

Best regards,
Krzysztof

2023-10-05 19:47:06

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 1/7] dt-bindings: media: Document STM32MP25 VDEC video decoder

On 04/10/2023 11:15, Hugues Fruchet wrote:
> Add STM32MP25 VDEC video decoder bindings.
>
> Signed-off-by: Hugues Fruchet <[email protected]>
> ---
> .../bindings/media/st,stm32mp25-vdec.yaml | 56 +++++++++++++++++++
> 1 file changed, 56 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/media/st,stm32mp25-vdec.yaml
>
> diff --git a/Documentation/devicetree/bindings/media/st,stm32mp25-vdec.yaml b/Documentation/devicetree/bindings/media/st,stm32mp25-vdec.yaml
> new file mode 100644
> index 000000000000..cf41f704113f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/st,stm32mp25-vdec.yaml
> @@ -0,0 +1,56 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/media/st,stm32mp25-vdec.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: STMicroelectronics STM32MP25 VDEC video decoder
> +
> +maintainers:
> + - Hugues Fruchet <[email protected]>
> +
> +description:
> + The STMicroelectronics STM32MP25 SOCs embeds a VDEC video hardware decoder
> + peripheral based on Verisilicon VC8000NanoD IP (former Hantro G1).
> +
> +properties:
> + compatible:
> + const: st,stm32mp25-vdec
> +
> + reg:
> + maxItems: 1
> +
> + interrupts:
> + maxItems: 1
> +
> + interrupt-names:
> + maxItems: 1

This must be specific or just drop (little use of names for one entry)

> +
> + clocks:
> + maxItems: 1
> +
> + clock-names:
> + maxItems: 1

Same problem.

> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> + - interrupt-names
> + - clocks
> + - clock-names
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/arm-gic.h>
> + vdec: vdec@580d0000 {

Drop label. Node name: video-codec
(assuming this is video coder/decoder)

Node names should be generic. See also an explanation and list of
examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation


Best regards,
Krzysztof

2023-10-05 19:47:18

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 5/7] arm64: dts: st: add soc & rifsc structure to stm32mp255

On 04/10/2023 11:15, Hugues Fruchet wrote:
> Add soc & rifsc structure to stm32mp255.
>
> Signed-off-by: Hugues Fruchet <[email protected]>
> ---
> arch/arm64/boot/dts/st/stm32mp255.dtsi | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/st/stm32mp255.dtsi b/arch/arm64/boot/dts/st/stm32mp255.dtsi
> index e6fa596211f5..4f2b224fe077 100644
> --- a/arch/arm64/boot/dts/st/stm32mp255.dtsi
> +++ b/arch/arm64/boot/dts/st/stm32mp255.dtsi
> @@ -6,4 +6,8 @@
> #include "stm32mp253.dtsi"
>
> / {
> + soc@0 {
> + rifsc: rifsc-bus@42080000 {


This change on its own makes little sense. We do not add empty
placeholders...


Best regards,
Krzysztof

2023-10-06 16:27:27

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH 3/7] dt-bindings: media: Document STM32MP25 VENC video encoder

On Wed, Oct 04, 2023 at 06:41:09PM -0500, Adam Ford wrote:
> On Wed, Oct 4, 2023 at 4:16 AM Hugues Fruchet
> <[email protected]> wrote:
> >
> > Add STM32MP25 VENC video encoder bindings.
> >
> > Signed-off-by: Hugues Fruchet <[email protected]>
> > ---
> > .../bindings/media/st,stm32mp25-venc.yaml | 56 +++++++++++++++++++
> > 1 file changed, 56 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml b/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
> > new file mode 100644
> > index 000000000000..c69e0a34f675
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
> > @@ -0,0 +1,56 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/media/st,stm32mp25-venc.yaml#
>
> Can this dt-binding be made more generic, like something like
> hantro-h1 or VC8000NanoE?
>
> I think there will be more boards that may incorporate the Hantro-H1
> or a VC8000 in the future, because I don't think this IP is unique to
> the STM32MP25.

Unless the underlying IP is well documented (i.e. public), then it's
kind of pointless. Everyone will just invent their own numbers and names
of clocks, resets, etc. unless someone can enforce not doing that.

Rob

2023-10-09 13:07:18

by Hugues Fruchet

[permalink] [raw]
Subject: Re: [PATCH 3/7] dt-bindings: media: Document STM32MP25 VENC video encoder

Hi Rob,

On 10/6/23 18:27, Rob Herring wrote:
> On Wed, Oct 04, 2023 at 06:41:09PM -0500, Adam Ford wrote:
>> On Wed, Oct 4, 2023 at 4:16 AM Hugues Fruchet
>> <[email protected]> wrote:
>>>
>>> Add STM32MP25 VENC video encoder bindings.
>>>
>>> Signed-off-by: Hugues Fruchet <[email protected]>
>>> ---
>>> .../bindings/media/st,stm32mp25-venc.yaml | 56 +++++++++++++++++++
>>> 1 file changed, 56 insertions(+)
>>> create mode 100644 Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
>>>
>>> diff --git a/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml b/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
>>> new file mode 100644
>>> index 000000000000..c69e0a34f675
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/media/st,stm32mp25-venc.yaml
>>> @@ -0,0 +1,56 @@
>>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>>> +
>>> +%YAML 1.2
>>> +---
>>> +$id: http://devicetree.org/schemas/media/st,stm32mp25-venc.yaml#
>>
>> Can this dt-binding be made more generic, like something like
>> hantro-h1 or VC8000NanoE?
>>
>> I think there will be more boards that may incorporate the Hantro-H1
>> or a VC8000 in the future, because I don't think this IP is unique to
>> the STM32MP25.
>
> Unless the underlying IP is well documented (i.e. public), then it's
> kind of pointless. Everyone will just invent their own numbers and names
> of clocks, resets, etc. unless someone can enforce not doing that.

Unfortunately the IP documentation is not public, there are no documents
provided publicly by Verisilicon for the time being.

>
> Rob

BR,
Hugues

2023-10-09 13:12:13

by Hugues Fruchet

[permalink] [raw]
Subject: Re: [PATCH 1/7] dt-bindings: media: Document STM32MP25 VDEC video decoder

Hi Krzysztof,

On 10/5/23 21:45, Krzysztof Kozlowski wrote:
> On 04/10/2023 11:15, Hugues Fruchet wrote:
>> Add STM32MP25 VDEC video decoder bindings.
>>
>> Signed-off-by: Hugues Fruchet <[email protected]>
>> ---
>> .../bindings/media/st,stm32mp25-vdec.yaml | 56 +++++++++++++++++++
>> 1 file changed, 56 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/media/st,stm32mp25-vdec.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/media/st,stm32mp25-vdec.yaml b/Documentation/devicetree/bindings/media/st,stm32mp25-vdec.yaml
>> new file mode 100644
>> index 000000000000..cf41f704113f
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/media/st,stm32mp25-vdec.yaml
>> @@ -0,0 +1,56 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/media/st,stm32mp25-vdec.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: STMicroelectronics STM32MP25 VDEC video decoder
>> +
>> +maintainers:
>> + - Hugues Fruchet <[email protected]>
>> +
>> +description:
>> + The STMicroelectronics STM32MP25 SOCs embeds a VDEC video hardware decoder
>> + peripheral based on Verisilicon VC8000NanoD IP (former Hantro G1).
>> +
>> +properties:
>> + compatible:
>> + const: st,stm32mp25-vdec
>> +
>> + reg:
>> + maxItems: 1
>> +
>> + interrupts:
>> + maxItems: 1
>> +
>> + interrupt-names:
>> + maxItems: 1
>
> This must be specific or just drop (little use of names for one entry)
I'll drop in v2.

>
>> +
>> + clocks:
>> + maxItems: 1
>> +
>> + clock-names:
>> + maxItems: 1
>
> Same problem.
I'll drop in v2.

>
>> +
>> +required:
>> + - compatible
>> + - reg
>> + - interrupts
>> + - interrupt-names
>> + - clocks
>> + - clock-names
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> + - |
>> + #include <dt-bindings/interrupt-controller/arm-gic.h>
>> + vdec: vdec@580d0000 {
>
> Drop label. Node name: video-codec
> (assuming this is video coder/decoder)
>
> Node names should be generic. See also an explanation and list of
> examples (not exhaustive) in DT specification:
> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
I'll do in v2, thanks for pointing-out the "video-codec" generic name.

>
>
> Best regards,
> Krzysztof
>

BR,
Hugues.

2023-10-09 13:50:37

by Hugues Fruchet

[permalink] [raw]
Subject: Re: [PATCH 3/7] dt-bindings: media: Document STM32MP25 VENC video encoder

Hi Krzysztof,

On 10/5/23 21:45, Krzysztof Kozlowski wrote:
> On 04/10/2023 11:15, Hugues Fruchet wrote:
>> Add STM32MP25 VENC video encoder bindings.
>>
>
> I don't understand why this binding is separate from video decoder.
> Merge them.
VDEC and VENC are two independent IPs with their own clock, reset,
interrupt & register set, they have their own access to APB/AXI bus.
Moreover future chipsets may embed only VENC or VDEC.

Hoping that this clarifies the reason of two different bindings.

>
> Best regards,
> Krzysztof
>


Br,
Hugues.

2023-10-09 13:54:43

by Hugues Fruchet

[permalink] [raw]
Subject: Re: [PATCH 5/7] arm64: dts: st: add soc & rifsc structure to stm32mp255

Hi Krzysztof,

On 10/5/23 21:46, Krzysztof Kozlowski wrote:
> On 04/10/2023 11:15, Hugues Fruchet wrote:
>> Add soc & rifsc structure to stm32mp255.
>>
>> Signed-off-by: Hugues Fruchet <[email protected]>
>> ---
>> arch/arm64/boot/dts/st/stm32mp255.dtsi | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/st/stm32mp255.dtsi b/arch/arm64/boot/dts/st/stm32mp255.dtsi
>> index e6fa596211f5..4f2b224fe077 100644
>> --- a/arch/arm64/boot/dts/st/stm32mp255.dtsi
>> +++ b/arch/arm64/boot/dts/st/stm32mp255.dtsi
>> @@ -6,4 +6,8 @@
>> #include "stm32mp253.dtsi"
>>
>> / {
>> + soc@0 {
>> + rifsc: rifsc-bus@42080000 {
>
>
> This change on its own makes little sense. We do not add empty
> placeholders...

So I will add it with introduction of vdec node... will do in v2.

>
>
> Best regards,
> Krzysztof
>

BR,
Hugues.

2023-10-09 13:56:36

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 3/7] dt-bindings: media: Document STM32MP25 VENC video encoder

On 09/10/2023 15:49, Hugues FRUCHET wrote:
> Hi Krzysztof,
>
> On 10/5/23 21:45, Krzysztof Kozlowski wrote:
>> On 04/10/2023 11:15, Hugues Fruchet wrote:
>>> Add STM32MP25 VENC video encoder bindings.
>>>
>>
>> I don't understand why this binding is separate from video decoder.
>> Merge them.
> VDEC and VENC are two independent IPs with their own clock, reset,
> interrupt & register set, they have their own access to APB/AXI bus.
> Moreover future chipsets may embed only VENC or VDEC.
>
> Hoping that this clarifies the reason of two different bindings.

No, it does not. These are no reasons to have independent bindings,
except when having actual impact on the bindings. The bindings look
identical. What are the differences?

Best regards,
Krzysztof

2023-10-09 14:25:53

by Hugues Fruchet

[permalink] [raw]
Subject: Re: [PATCH 3/7] dt-bindings: media: Document STM32MP25 VENC video encoder

Hi Krzysztof,

On 10/9/23 15:56, Krzysztof Kozlowski wrote:
> On 09/10/2023 15:49, Hugues FRUCHET wrote:
>> Hi Krzysztof,
>>
>> On 10/5/23 21:45, Krzysztof Kozlowski wrote:
>>> On 04/10/2023 11:15, Hugues Fruchet wrote:
>>>> Add STM32MP25 VENC video encoder bindings.
>>>>
>>>
>>> I don't understand why this binding is separate from video decoder.
>>> Merge them.
>> VDEC and VENC are two independent IPs with their own clock, reset,
>> interrupt & register set, they have their own access to APB/AXI bus.
>> Moreover future chipsets may embed only VENC or VDEC.
>>
>> Hoping that this clarifies the reason of two different bindings.
>
> No, it does not. These are no reasons to have independent bindings,
> except when having actual impact on the bindings. The bindings look
> identical. What are the differences?
I'm sorry but I really don't understand your point, these are two
different IPs with very different registers in it, so why should
I share that in a single binding ?

>
> Best regards,
> Krzysztof
>

BR,
Hugues.

2023-10-09 14:29:17

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 3/7] dt-bindings: media: Document STM32MP25 VENC video encoder

On 09/10/2023 16:24, Hugues FRUCHET wrote:
> Hi Krzysztof,
>
> On 10/9/23 15:56, Krzysztof Kozlowski wrote:
>> On 09/10/2023 15:49, Hugues FRUCHET wrote:
>>> Hi Krzysztof,
>>>
>>> On 10/5/23 21:45, Krzysztof Kozlowski wrote:
>>>> On 04/10/2023 11:15, Hugues Fruchet wrote:
>>>>> Add STM32MP25 VENC video encoder bindings.
>>>>>
>>>>
>>>> I don't understand why this binding is separate from video decoder.
>>>> Merge them.
>>> VDEC and VENC are two independent IPs with their own clock, reset,
>>> interrupt & register set, they have their own access to APB/AXI bus.
>>> Moreover future chipsets may embed only VENC or VDEC.
>>>
>>> Hoping that this clarifies the reason of two different bindings.
>>
>> No, it does not. These are no reasons to have independent bindings,
>> except when having actual impact on the bindings. The bindings look
>> identical. What are the differences?
> I'm sorry but I really don't understand your point, these are two
> different IPs with very different registers in it, so why should
> I share that in a single binding ?

Because the binding is identical. If not, maybe I missed something, so
please point me to differences in the binding.

Best regards,
Krzysztof

2023-10-09 15:56:39

by Hugues Fruchet

[permalink] [raw]
Subject: Re: [PATCH 3/7] dt-bindings: media: Document STM32MP25 VENC video encoder

Hi Krzysztof,

On 10/9/23 16:28, Krzysztof Kozlowski wrote:
> On 09/10/2023 16:24, Hugues FRUCHET wrote:
>> Hi Krzysztof,
>>
>> On 10/9/23 15:56, Krzysztof Kozlowski wrote:
>>> On 09/10/2023 15:49, Hugues FRUCHET wrote:
>>>> Hi Krzysztof,
>>>>
>>>> On 10/5/23 21:45, Krzysztof Kozlowski wrote:
>>>>> On 04/10/2023 11:15, Hugues Fruchet wrote:
>>>>>> Add STM32MP25 VENC video encoder bindings.
>>>>>>
>>>>>
>>>>> I don't understand why this binding is separate from video decoder.
>>>>> Merge them.
>>>> VDEC and VENC are two independent IPs with their own clock, reset,
>>>> interrupt & register set, they have their own access to APB/AXI bus.
>>>> Moreover future chipsets may embed only VENC or VDEC.
>>>>
>>>> Hoping that this clarifies the reason of two different bindings.
>>>
>>> No, it does not. These are no reasons to have independent bindings,
>>> except when having actual impact on the bindings. The bindings look
>>> identical. What are the differences?
>> I'm sorry but I really don't understand your point, these are two
>> different IPs with very different registers in it, so why should
>> I share that in a single binding ?
>
> Because the binding is identical. If not, maybe I missed something, so
> please point me to differences in the binding.

OK, currently they are identical so I will merge into a single one
even if I disagree on that.
I hope that in future this will not change otherwise I'll need to
revisit that and make separate bindings as initially proposed...
I'll so push a v2 with merged version proposal.

>
> Best regards,
> Krzysztof
>

BR,
Hugues.