* [PATCH v6 1/6] firmware: meson: sm: Add video firmware loading SMC call
2026-07-24 7:04 [PATCH v6 0/6] Add Amlogic stateless H.264 video decoder for S4 Zhentao Guo via B4 Relay
@ 2026-07-24 7:04 ` Zhentao Guo via B4 Relay
2026-07-25 7:13 ` Piotr Oniszczuk
2026-07-24 7:04 ` [PATCH v6 2/6] firmware: meson: sm: video firmware loading via secure monitor Zhentao Guo via B4 Relay
` (5 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Zhentao Guo via B4 Relay @ 2026-07-24 7:04 UTC (permalink / raw)
To: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-arm-kernel, linux-amlogic, linux-kernel, linux-media,
devicetree, Zhentao Guo
From: Zhentao Guo <zhentao.guo@amlogic.com>
Add SM_LOAD_VIDEO_FW at SMC ID 0xb200000f in the command
table to load video firmware.
Signed-off-by: Zhentao Guo <zhentao.guo@amlogic.com>
---
drivers/firmware/meson/meson_sm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
index ab9751a59b55..887caa5c625d 100644
--- a/drivers/firmware/meson/meson_sm.c
+++ b/drivers/firmware/meson/meson_sm.c
@@ -48,6 +48,7 @@ static const struct meson_sm_chip gxbb_chip = {
CMD(SM_THERMAL_CALIB_READ, 0x82000047),
CMD(SM_A1_PWRC_SET, 0x82000093),
CMD(SM_A1_PWRC_GET, 0x82000095),
+ CMD(SM_LOAD_VIDEO_FW, 0xb200000f),
{ /* sentinel */ },
},
};
--
2.42.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH v6 1/6] firmware: meson: sm: Add video firmware loading SMC call
2026-07-24 7:04 ` [PATCH v6 1/6] firmware: meson: sm: Add video firmware loading SMC call Zhentao Guo via B4 Relay
@ 2026-07-25 7:13 ` Piotr Oniszczuk
2026-07-27 2:57 ` Zhentao Guo
0 siblings, 1 reply; 20+ messages in thread
From: Piotr Oniszczuk @ 2026-07-25 7:13 UTC (permalink / raw)
To: zhentao.guo
Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-media, devicetree
> Wiadomość napisana przez Zhentao Guo via B4 Relay <devnull+zhentao.guo.amlogic.com@kernel.org> w dniu 24 lip 2026, o godz. 09:04:
>
> From: Zhentao Guo <zhentao.guo@amlogic.com>
>
> Add SM_LOAD_VIDEO_FW at SMC ID 0xb200000f in the command
> table to load video firmware.
>
> Signed-off-by: Zhentao Guo <zhentao.guo@amlogic.com>
> ---
> drivers/firmware/meson/meson_sm.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
> index ab9751a59b55..887caa5c625d 100644
> --- a/drivers/firmware/meson/meson_sm.c
> +++ b/drivers/firmware/meson/meson_sm.c
> @@ -48,6 +48,7 @@ static const struct meson_sm_chip gxbb_chip = {
> CMD(SM_THERMAL_CALIB_READ, 0x82000047),
> CMD(SM_A1_PWRC_SET, 0x82000093),
> CMD(SM_A1_PWRC_GET, 0x82000095),
> + CMD(SM_LOAD_VIDEO_FW, 0xb200000f),
> { /* sentinel */ },
> },
> };
>
> --
> 2.42.0
>
Zhentao,
What is req. baseline for this patch?
(or what extra patches are needed to test it on 7.1 mainline)
Asking as applying on mainline 7.1.5 I’m getting:
patching file drivers/firmware/meson/meson_sm.c
Hunk #1 FAILED at 48.
1 out of 1 hunk FAILED -- saving rejects to file drivers/firmware/meson/meson_sm.c.rej
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH v6 1/6] firmware: meson: sm: Add video firmware loading SMC call
2026-07-25 7:13 ` Piotr Oniszczuk
@ 2026-07-27 2:57 ` Zhentao Guo
0 siblings, 0 replies; 20+ messages in thread
From: Zhentao Guo @ 2026-07-27 2:57 UTC (permalink / raw)
To: Piotr Oniszczuk
Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-media, devicetree
Hi Piotr,
> [You don't often get email from piotr.oniszczuk@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
>
>> Wiadomość napisana przez Zhentao Guo via B4 Relay <devnull+zhentao.guo.amlogic.com@kernel.org> w dniu 24 lip 2026, o godz. 09:04:
>>
>> From: Zhentao Guo <zhentao.guo@amlogic.com>
>>
>> Add SM_LOAD_VIDEO_FW at SMC ID 0xb200000f in the command
>> table to load video firmware.
>>
>> Signed-off-by: Zhentao Guo <zhentao.guo@amlogic.com>
>> ---
>> drivers/firmware/meson/meson_sm.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/firmware/meson/meson_sm.c b/drivers/firmware/meson/meson_sm.c
>> index ab9751a59b55..887caa5c625d 100644
>> --- a/drivers/firmware/meson/meson_sm.c
>> +++ b/drivers/firmware/meson/meson_sm.c
>> @@ -48,6 +48,7 @@ static const struct meson_sm_chip gxbb_chip = {
>> CMD(SM_THERMAL_CALIB_READ, 0x82000047),
>> CMD(SM_A1_PWRC_SET, 0x82000093),
>> CMD(SM_A1_PWRC_GET, 0x82000095),
>> + CMD(SM_LOAD_VIDEO_FW, 0xb200000f),
>> { /* sentinel */ },
>> },
>> };
>>
>> --
>> 2.42.0
>>
> Zhentao,
>
> What is req. baseline for this patch?
> (or what extra patches are needed to test it on 7.1 mainline)
>
> Asking as applying on mainline 7.1.5 I’m getting:
>
> patching file drivers/firmware/meson/meson_sm.c
> Hunk #1 FAILED at 48.
> 1 out of 1 hunk FAILED -- saving rejects to file drivers/firmware/meson/meson_sm.c.rej
The baseline for this patch is
https://lore.kernel.org/all/20260424-add-thermal-t7-vim4-v5-3-9040ca36afe2@aliel.fr/.
I submitted my patch based on 7.2.0-rc4.
Best regards,
Zhentao
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v6 2/6] firmware: meson: sm: video firmware loading via secure monitor
2026-07-24 7:04 [PATCH v6 0/6] Add Amlogic stateless H.264 video decoder for S4 Zhentao Guo via B4 Relay
2026-07-24 7:04 ` [PATCH v6 1/6] firmware: meson: sm: Add video firmware loading SMC call Zhentao Guo via B4 Relay
@ 2026-07-24 7:04 ` Zhentao Guo via B4 Relay
2026-07-24 10:22 ` Ferass El Hafidi
2026-07-24 7:04 ` [PATCH v6 3/6] media: dt-bindings: Add Amlogic V4L2 video decoder Zhentao Guo via B4 Relay
` (4 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Zhentao Guo via B4 Relay @ 2026-07-24 7:04 UTC (permalink / raw)
To: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-arm-kernel, linux-amlogic, linux-kernel, linux-media,
devicetree, Zhentao Guo
From: Zhentao Guo <zhentao.guo@amlogic.com>
Add SM_LOAD_VIDEO_FW to the secure monitor command enum
to allow decoder drivers to load firmware through the meson_sm
interface.
Signed-off-by: Zhentao Guo <zhentao.guo@amlogic.com>
---
include/linux/firmware/meson/meson_sm.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/firmware/meson/meson_sm.h b/include/linux/firmware/meson/meson_sm.h
index 3ebc2bd9a976..3b90b49d0552 100644
--- a/include/linux/firmware/meson/meson_sm.h
+++ b/include/linux/firmware/meson/meson_sm.h
@@ -15,6 +15,7 @@ enum {
SM_THERMAL_CALIB_READ,
SM_A1_PWRC_SET,
SM_A1_PWRC_GET,
+ SM_LOAD_VIDEO_FW,
};
struct meson_sm_firmware;
--
2.42.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH v6 2/6] firmware: meson: sm: video firmware loading via secure monitor
2026-07-24 7:04 ` [PATCH v6 2/6] firmware: meson: sm: video firmware loading via secure monitor Zhentao Guo via B4 Relay
@ 2026-07-24 10:22 ` Ferass El Hafidi
0 siblings, 0 replies; 20+ messages in thread
From: Ferass El Hafidi @ 2026-07-24 10:22 UTC (permalink / raw)
To: linux-amlogic, zhentao.guo, Neil Armstrong, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: linux-arm-kernel, linux-amlogic, linux-kernel, linux-media,
devicetree, Zhentao Guo
Hi Zhentao,
On Fri, 24 Jul 2026 07:04, Zhentao Guo via B4 Relay <devnull+zhentao.guo.amlogic.com@kernel.org> wrote:
>From: Zhentao Guo <zhentao.guo@amlogic.com>
>
>Add SM_LOAD_VIDEO_FW to the secure monitor command enum
>to allow decoder drivers to load firmware through the meson_sm
>interface.
>
>Signed-off-by: Zhentao Guo <zhentao.guo@amlogic.com>
>---
> include/linux/firmware/meson/meson_sm.h | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/include/linux/firmware/meson/meson_sm.h b/include/linux/firmware/meson/meson_sm.h
>index 3ebc2bd9a976..3b90b49d0552 100644
>--- a/include/linux/firmware/meson/meson_sm.h
>+++ b/include/linux/firmware/meson/meson_sm.h
>@@ -15,6 +15,7 @@ enum {
> SM_THERMAL_CALIB_READ,
> SM_A1_PWRC_SET,
> SM_A1_PWRC_GET,
>+ SM_LOAD_VIDEO_FW,
> };
>
I would include this in patch 1/6.
> struct meson_sm_firmware;
>
>--
>2.42.0
>
>
>
>_______________________________________________
>linux-amlogic mailing list
>linux-amlogic@lists.infradead.org
>http://lists.infradead.org/mailman/listinfo/linux-amlogic
Best regards,
Ferass
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v6 3/6] media: dt-bindings: Add Amlogic V4L2 video decoder
2026-07-24 7:04 [PATCH v6 0/6] Add Amlogic stateless H.264 video decoder for S4 Zhentao Guo via B4 Relay
2026-07-24 7:04 ` [PATCH v6 1/6] firmware: meson: sm: Add video firmware loading SMC call Zhentao Guo via B4 Relay
2026-07-24 7:04 ` [PATCH v6 2/6] firmware: meson: sm: video firmware loading via secure monitor Zhentao Guo via B4 Relay
@ 2026-07-24 7:04 ` Zhentao Guo via B4 Relay
2026-07-27 6:23 ` Krzysztof Kozlowski
2026-07-24 7:04 ` [PATCH v6 5/6] arm64: dts: amlogic: Add video decoder driver support for S4 SOCs Zhentao Guo via B4 Relay
` (3 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Zhentao Guo via B4 Relay @ 2026-07-24 7:04 UTC (permalink / raw)
To: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-arm-kernel, linux-amlogic, linux-kernel, linux-media,
devicetree, Zhentao Guo
From: Zhentao Guo <zhentao.guo@amlogic.com>
Describe the initial support for the V4L2 stateless video decoder
driver used with the Amlogic S4 (S805X2) platform.
Signed-off-by: Zhentao Guo <zhentao.guo@amlogic.com>
---
.../devicetree/bindings/media/amlogic,s4-vdec.yaml | 103 +++++++++++++++++++++
1 file changed, 103 insertions(+)
diff --git a/Documentation/devicetree/bindings/media/amlogic,s4-vdec.yaml b/Documentation/devicetree/bindings/media/amlogic,s4-vdec.yaml
new file mode 100644
index 000000000000..e3c2ab4000aa
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/amlogic,s4-vdec.yaml
@@ -0,0 +1,103 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2025 Amlogic, Inc. All rights reserved
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/amlogic,s4-vdec.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Amlogic Video Decode Accelerator
+
+maintainers:
+ - Zhentao Guo <zhentao.guo@amlogic.com>
+
+description:
+ The Video Decoder Accelerator present on Amlogic SOCs.
+ It supports stateless h264 decoding.
+
+properties:
+ compatible:
+ const: amlogic,s4-vdec
+
+ reg:
+ maxItems: 2
+
+ reg-names:
+ items:
+ - const: dos
+ - const: dmc
+
+ interrupts:
+ maxItems: 3
+
+ clocks:
+ maxItems: 3
+
+ clock-names:
+ items:
+ - const: dos
+ - const: vdec
+ - const: hevcf
+
+ power-domains:
+ maxItems: 2
+
+ power-domain-names:
+ items:
+ - const: vdec
+ - const: hvdec
+
+ resets:
+ maxItems: 1
+
+ amlogic,canvas:
+ description: should point to a canvas provider node
+ $ref: /schemas/types.yaml#/definitions/phandle
+
+ secure-monitor:
+ description: phandle to the secure-monitor node
+ $ref: /schemas/types.yaml#/definitions/phandle
+
+required:
+ - compatible
+ - reg
+ - reg-names
+ - interrupts
+ - clocks
+ - clock-names
+ - power-domains
+ - power-domain-names
+ - amlogic,canvas
+ - secure-monitor
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/clock/amlogic,s4-pll-clkc.h>
+ #include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h>
+ #include <dt-bindings/power/meson-s4-power.h>
+ #include <dt-bindings/reset/amlogic,meson-s4-reset.h>
+ video-codec@fe320000 {
+ compatible = "amlogic,s4-vdec";
+ reg = <0xfe320000 0x10000>,
+ <0xfe036000 0x20>;
+ amlogic,canvas = <&canvas>;
+ reg-names = "dos",
+ "dmc";
+ interrupts = <GIC_SPI 91 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 92 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 93 IRQ_TYPE_EDGE_RISING>;
+ clocks = <&clkc_periphs CLKID_DOS>,
+ <&clkc_periphs CLKID_VDEC_SEL>,
+ <&clkc_periphs CLKID_HEVCF_SEL>;
+ clock-names = "dos",
+ "vdec",
+ "hevcf";
+ power-domains = <&pwrc PWRC_S4_DOS_VDEC_ID>,
+ <&pwrc PWRC_S4_DOS_HEVC_ID>;
+ power-domain-names = "vdec",
+ "hvdec";
+ resets = <&reset RESET_DOS>;
+ secure-monitor = <&sm>;
+ };
--
2.42.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH v6 3/6] media: dt-bindings: Add Amlogic V4L2 video decoder
2026-07-24 7:04 ` [PATCH v6 3/6] media: dt-bindings: Add Amlogic V4L2 video decoder Zhentao Guo via B4 Relay
@ 2026-07-27 6:23 ` Krzysztof Kozlowski
2026-07-27 6:32 ` Zhentao Guo
0 siblings, 1 reply; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-27 6:23 UTC (permalink / raw)
To: Zhentao Guo
Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-media, devicetree
On Fri, Jul 24, 2026 at 03:04:53PM +0800, Zhentao Guo wrote:
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/arm-gic.h>
> + #include <dt-bindings/clock/amlogic,s4-pll-clkc.h>
> + #include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h>
> + #include <dt-bindings/power/meson-s4-power.h>
> + #include <dt-bindings/reset/amlogic,meson-s4-reset.h>
> + video-codec@fe320000 {
> + compatible = "amlogic,s4-vdec";
> + reg = <0xfe320000 0x10000>,
> + <0xfe036000 0x20>;
> + amlogic,canvas = <&canvas>;
> + reg-names = "dos",
> + "dmc";
Please read carefully DTS coding style.
You also need to address all comments from Sashiko.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH v6 3/6] media: dt-bindings: Add Amlogic V4L2 video decoder
2026-07-27 6:23 ` Krzysztof Kozlowski
@ 2026-07-27 6:32 ` Zhentao Guo
0 siblings, 0 replies; 20+ messages in thread
From: Zhentao Guo @ 2026-07-27 6:32 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-media, devicetree
Hi Krzysztof
> On Fri, Jul 24, 2026 at 03:04:53PM +0800, Zhentao Guo wrote:
>> +additionalProperties: false
>> +
>> +examples:
>> + - |
>> + #include <dt-bindings/interrupt-controller/arm-gic.h>
>> + #include <dt-bindings/clock/amlogic,s4-pll-clkc.h>
>> + #include <dt-bindings/clock/amlogic,s4-peripherals-clkc.h>
>> + #include <dt-bindings/power/meson-s4-power.h>
>> + #include <dt-bindings/reset/amlogic,meson-s4-reset.h>
>> + video-codec@fe320000 {
>> + compatible = "amlogic,s4-vdec";
>> + reg = <0xfe320000 0x10000>,
>> + <0xfe036000 0x20>;
>> + amlogic,canvas = <&canvas>;
>> + reg-names = "dos",
>> + "dmc";
> Please read carefully DTS coding style.
>
> You also need to address all comments from Sashiko.
Thanks for pointing out, I'm checking all the comments from Sashiko and
will give out my improvement.
>
> Best regards,
> Krzysztof
BRs
Zhentao
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v6 5/6] arm64: dts: amlogic: Add video decoder driver support for S4 SOCs
2026-07-24 7:04 [PATCH v6 0/6] Add Amlogic stateless H.264 video decoder for S4 Zhentao Guo via B4 Relay
` (2 preceding siblings ...)
2026-07-24 7:04 ` [PATCH v6 3/6] media: dt-bindings: Add Amlogic V4L2 video decoder Zhentao Guo via B4 Relay
@ 2026-07-24 7:04 ` Zhentao Guo via B4 Relay
2026-07-24 7:04 ` [PATCH v6 6/6] arm64: defconfig: Enable CONFIG_VIDEO_AMLOGIC_VDEC Zhentao Guo via B4 Relay
` (2 subsequent siblings)
6 siblings, 0 replies; 20+ messages in thread
From: Zhentao Guo via B4 Relay @ 2026-07-24 7:04 UTC (permalink / raw)
To: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-arm-kernel, linux-amlogic, linux-kernel, linux-media,
devicetree, Zhentao Guo
From: Zhentao Guo <zhentao.guo@amlogic.com>
Add vdec node to enable Amlogic V4L2 stateless video decoder
support.
Signed-off-by: Zhentao Guo <zhentao.guo@amlogic.com>
---
arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 34 +++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-s4.dtsi b/arch/arm64/boot/dts/amlogic/meson-s4.dtsi
index 2a6fbd530836..04fa52b357a2 100644
--- a/arch/arm64/boot/dts/amlogic/meson-s4.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-s4.dtsi
@@ -96,6 +96,11 @@ saradc: adc@fe026000 {
status = "disabled";
};
+ optee {
+ compatible = "linaro,optee-tz";
+ method = "smc";
+ };
+
soc {
compatible = "simple-bus";
#address-cells = <2>;
@@ -907,5 +912,34 @@ emmc: mmc@fe08c000 {
assigned-clocks = <&clkc_periphs CLKID_SD_EMMC_C>;
assigned-clock-rates = <24000000>;
};
+
+ canvas: video-lut@fe036048 {
+ compatible = "amlogic,canvas";
+ reg = <0x0 0xfe036048 0x0 0x14>;
+ };
+
+ video-codec@fe320000 {
+ compatible = "amlogic,s4-vdec";
+ reg = <0x0 0xfe320000 0x0 0x10000>,
+ <0x0 0xfe036000 0x0 0x20>;
+ amlogic,canvas = <&canvas>;
+ reg-names = "dos",
+ "dmc";
+ interrupts = <GIC_SPI 91 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 92 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 93 IRQ_TYPE_EDGE_RISING>;
+ clocks = <&clkc_periphs CLKID_DOS>,
+ <&clkc_periphs CLKID_VDEC_SEL>,
+ <&clkc_periphs CLKID_HEVCF_SEL>;
+ clock-names = "dos",
+ "vdec",
+ "hevcf";
+ power-domains = <&pwrc PWRC_S4_DOS_VDEC_ID>,
+ <&pwrc PWRC_S4_DOS_HEVC_ID>;
+ power-domain-names = "vdec",
+ "hvdec";
+ resets = <&reset RESET_DOS>;
+ secure-monitor = <&sm>;
+ };
};
};
--
2.42.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH v6 6/6] arm64: defconfig: Enable CONFIG_VIDEO_AMLOGIC_VDEC
2026-07-24 7:04 [PATCH v6 0/6] Add Amlogic stateless H.264 video decoder for S4 Zhentao Guo via B4 Relay
` (3 preceding siblings ...)
2026-07-24 7:04 ` [PATCH v6 5/6] arm64: dts: amlogic: Add video decoder driver support for S4 SOCs Zhentao Guo via B4 Relay
@ 2026-07-24 7:04 ` Zhentao Guo via B4 Relay
2026-07-27 6:24 ` Krzysztof Kozlowski
2026-07-24 10:13 ` [PATCH v6 0/6] Add Amlogic stateless H.264 video decoder for S4 Ferass El Hafidi
[not found] ` <20260724-b4-s4-vdec-upstream-v6-4-6072a7ee7428@amlogic.com>
6 siblings, 1 reply; 20+ messages in thread
From: Zhentao Guo via B4 Relay @ 2026-07-24 7:04 UTC (permalink / raw)
To: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-arm-kernel, linux-amlogic, linux-kernel, linux-media,
devicetree, Zhentao Guo
From: Zhentao Guo <zhentao.guo@amlogic.com>
Enable the Amlogic V4L2 stateless video decoder driver as a module
in the arm64 defconfig. This driver is needed for stateless video
decoding support on Amlogic SoCs.
Signed-off-by: Zhentao Guo <zhentao.guo@amlogic.com>
---
arch/arm64/configs/defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 6ec8d3a69c98..7be4e5a284ba 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -919,6 +919,7 @@ CONFIG_V4L_PLATFORM_DRIVERS=y
CONFIG_SDR_PLATFORM_DRIVERS=y
CONFIG_V4L_MEM2MEM_DRIVERS=y
CONFIG_VIDEO_AMPHION_VPU=m
+CONFIG_VIDEO_AMLOGIC_VDEC=m
CONFIG_VIDEO_CADENCE_CSI2RX=m
CONFIG_VIDEO_WAVE_VPU=m
CONFIG_VIDEO_E5010_JPEG_ENC=m
--
2.42.0
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH v6 6/6] arm64: defconfig: Enable CONFIG_VIDEO_AMLOGIC_VDEC
2026-07-24 7:04 ` [PATCH v6 6/6] arm64: defconfig: Enable CONFIG_VIDEO_AMLOGIC_VDEC Zhentao Guo via B4 Relay
@ 2026-07-27 6:24 ` Krzysztof Kozlowski
2026-07-27 6:26 ` Krzysztof Kozlowski
0 siblings, 1 reply; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-27 6:24 UTC (permalink / raw)
To: Zhentao Guo
Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-media, devicetree
On Fri, Jul 24, 2026 at 03:04:56PM +0800, Zhentao Guo wrote:
> Enable the Amlogic V4L2 stateless video decoder driver as a module
> in the arm64 defconfig. This driver is needed for stateless video
> decoding support on Amlogic SoCs.
Which boards use it? Look at `git log` to learn how this commit should
be written.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v6 6/6] arm64: defconfig: Enable CONFIG_VIDEO_AMLOGIC_VDEC
2026-07-27 6:24 ` Krzysztof Kozlowski
@ 2026-07-27 6:26 ` Krzysztof Kozlowski
2026-07-27 6:36 ` Zhentao Guo
0 siblings, 1 reply; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-27 6:26 UTC (permalink / raw)
To: Zhentao Guo
Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-media, devicetree
On 27/07/2026 08:24, Krzysztof Kozlowski wrote:
> On Fri, Jul 24, 2026 at 03:04:56PM +0800, Zhentao Guo wrote:
>> Enable the Amlogic V4L2 stateless video decoder driver as a module
>> in the arm64 defconfig. This driver is needed for stateless video
>> decoding support on Amlogic SoCs.
>
> Which boards use it? Look at `git log` to learn how this commit should
> be written.
I already ASKED YOU this at v4 and pointing you to git log history. Not
much improved.
Did you even check any commits?
NAK
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v6 6/6] arm64: defconfig: Enable CONFIG_VIDEO_AMLOGIC_VDEC
2026-07-27 6:26 ` Krzysztof Kozlowski
@ 2026-07-27 6:36 ` Zhentao Guo
2026-07-27 7:02 ` Krzysztof Kozlowski
0 siblings, 1 reply; 20+ messages in thread
From: Zhentao Guo @ 2026-07-27 6:36 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-media, devicetree
Hi Krzysztof
> On 27/07/2026 08:24, Krzysztof Kozlowski wrote:
>> On Fri, Jul 24, 2026 at 03:04:56PM +0800, Zhentao Guo wrote:
>>> Enable the Amlogic V4L2 stateless video decoder driver as a module
>>> in the arm64 defconfig. This driver is needed for stateless video
>>> decoding support on Amlogic SoCs.
>> Which boards use it? Look at `git log` to learn how this commit should
>> be written.
> I already ASKED YOU this at v4 and pointing you to git log history. Not
> much improved.
>
> Did you even check any commits?
I did check some of the commits. I'll refer to more git logs of other
commits, and describe this patch as clearly as possible.
>
> NAK
>
> Best regards,
> Krzysztof
BRs
Zhentao
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v6 6/6] arm64: defconfig: Enable CONFIG_VIDEO_AMLOGIC_VDEC
2026-07-27 6:36 ` Zhentao Guo
@ 2026-07-27 7:02 ` Krzysztof Kozlowski
2026-07-27 7:19 ` Zhentao Guo
0 siblings, 1 reply; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-27 7:02 UTC (permalink / raw)
To: Zhentao Guo
Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-media, devicetree
On 27/07/2026 08:36, Zhentao Guo wrote:
> Hi Krzysztof
>
>> On 27/07/2026 08:24, Krzysztof Kozlowski wrote:
>>> On Fri, Jul 24, 2026 at 03:04:56PM +0800, Zhentao Guo wrote:
>>>> Enable the Amlogic V4L2 stateless video decoder driver as a module
>>>> in the arm64 defconfig. This driver is needed for stateless video
>>>> decoding support on Amlogic SoCs.
>>> Which boards use it? Look at `git log` to learn how this commit should
>>> be written.
>> I already ASKED YOU this at v4 and pointing you to git log history. Not
>> much improved.
>>
>> Did you even check any commits?
> I did check some of the commits. I'll refer to more git logs of other
> commits, and describe this patch as clearly as possible.
No, you need to provide reason WHY do we want it in mainline. You do not
need to write more sentences. The reason is some mainline board using it.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v6 6/6] arm64: defconfig: Enable CONFIG_VIDEO_AMLOGIC_VDEC
2026-07-27 7:02 ` Krzysztof Kozlowski
@ 2026-07-27 7:19 ` Zhentao Guo
0 siblings, 0 replies; 20+ messages in thread
From: Zhentao Guo @ 2026-07-27 7:19 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
Mauro Carvalho Chehab, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-arm-kernel, linux-amlogic, linux-kernel,
linux-media, devicetree
> On 27/07/2026 08:36, Zhentao Guo wrote:
>> Hi Krzysztof
>>
>>> On 27/07/2026 08:24, Krzysztof Kozlowski wrote:
>>>> On Fri, Jul 24, 2026 at 03:04:56PM +0800, Zhentao Guo wrote:
>>>>> Enable the Amlogic V4L2 stateless video decoder driver as a module
>>>>> in the arm64 defconfig. This driver is needed for stateless video
>>>>> decoding support on Amlogic SoCs.
>>>> Which boards use it? Look at `git log` to learn how this commit should
>>>> be written.
>>> I already ASKED YOU this at v4 and pointing you to git log history. Not
>>> much improved.
>>>
>>> Did you even check any commits?
>> I did check some of the commits. I'll refer to more git logs of other
>> commits, and describe this patch as clearly as possible.
> No, you need to provide reason WHY do we want it in mainline. You do not
> need to write more sentences. The reason is some mainline board using it.
Yes, I read the other feedback from you and see what you mean. Actually
I missed the point when I was reading other git logs before. Thanks for
the reminder, it's clear to me now.
>
> Best regards,
> Krzysztof
BRs,
Zhentao
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v6 0/6] Add Amlogic stateless H.264 video decoder for S4
2026-07-24 7:04 [PATCH v6 0/6] Add Amlogic stateless H.264 video decoder for S4 Zhentao Guo via B4 Relay
` (4 preceding siblings ...)
2026-07-24 7:04 ` [PATCH v6 6/6] arm64: defconfig: Enable CONFIG_VIDEO_AMLOGIC_VDEC Zhentao Guo via B4 Relay
@ 2026-07-24 10:13 ` Ferass El Hafidi
2026-07-27 2:43 ` Zhentao Guo
[not found] ` <20260724-b4-s4-vdec-upstream-v6-4-6072a7ee7428@amlogic.com>
6 siblings, 1 reply; 20+ messages in thread
From: Ferass El Hafidi @ 2026-07-24 10:13 UTC (permalink / raw)
To: linux-amlogic, zhentao.guo, Neil Armstrong, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: linux-arm-kernel, linux-amlogic, linux-kernel, linux-media,
devicetree, Zhentao Guo
Hi Zhentao,
On Fri, 24 Jul 2026 07:04, Zhentao Guo via B4 Relay <devnull+zhentao.guo.amlogic.com@kernel.org> wrote:
>Introduce initial driver support for Amlogic's new video acceleration
>hardware architecture, designed for video stream decoding.
>
>Compared to the current Amlogic video decoder hardware architecture,
>this new implementation eliminates the Esparser hardware component,
>enabling direct vb2 buffer input. The driver is designed to support
>the V4L2 M2M stateless decoder API. The initial phase includes support
>for H.264 decoding on Amlogic S805X2 platform.
>
>The driver needs to work alongside with a signed firmware. The loading process of
>the signed fw is as follow.
Is the firmware still signed on devices that do not have secure boot
enabled? (which means none of their boot chain is signed)
Do the signing checks take place in BL32 or elsewhere?
>Stage1: Decypt and decompose the full firmware package when the driver is probed.
> +---------------------+ +---------------------+
> | Decoder Driver | | TEE Shared Memory |
> | (Kernel Space) | | |
> | +---------------+ | | +---------------+ |
> | | video_ucode | | | | firmware | |
> | | .bin | | Copy payload to SHM | | payload | |
> | | (from fs) | | ---------------------> | | (Secure RAM) | |
> | +---------------+ | | +---------------+ |
> +---------------------+ +----------+----------+
> |
> | PTA Invocation
> v
> +-------------------------------+
> | BL32 |
> | +-------------------------+ |
> | | Decrypt Firmware | |
> | +-----------+-------------+ |
> | | |
> | v |
> | +-------------------------+ |
> | | Decompose the full | |
> | | firmware pacakge | |
> | +-----------+-------------+ |
> | | |
> | v |
> | +-------------------------+ |
> | | Store decomposed .bin | |
> | | in Secure Memory | |
> | +-------------------------+ |
> +-------------------------------+
>
Is BL32 strictly needed to load that firmware? I know on at least older SoCs
(sm1 and older) BL32 is not required for booting and amlogic-based SBCs are
often used without BL32. So once this gets ported to older SoCs, would
it have a hard-dependency on BL32? And if yes, can upstream Arm Trusted
Firmware-A BL32 be used instead of the Amlogic blob?
Best regards,
Ferass
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH v6 0/6] Add Amlogic stateless H.264 video decoder for S4
2026-07-24 10:13 ` [PATCH v6 0/6] Add Amlogic stateless H.264 video decoder for S4 Ferass El Hafidi
@ 2026-07-27 2:43 ` Zhentao Guo
0 siblings, 0 replies; 20+ messages in thread
From: Zhentao Guo @ 2026-07-27 2:43 UTC (permalink / raw)
To: Ferass El Hafidi, linux-amlogic, Neil Armstrong, Kevin Hilman,
Jerome Brunet, Martin Blumenstingl, Mauro Carvalho Chehab,
Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: linux-arm-kernel, linux-kernel, linux-media, devicetree
Hi Feras,
>
> Hi Zhentao,
>
> On Fri, 24 Jul 2026 07:04, Zhentao Guo via B4 Relay
> <devnull+zhentao.guo.amlogic.com@kernel.org> wrote:
>> Introduce initial driver support for Amlogic's new video acceleration
>> hardware architecture, designed for video stream decoding.
>>
>> Compared to the current Amlogic video decoder hardware architecture,
>> this new implementation eliminates the Esparser hardware component,
>> enabling direct vb2 buffer input. The driver is designed to support
>> the V4L2 M2M stateless decoder API. The initial phase includes support
>> for H.264 decoding on Amlogic S805X2 platform.
>>
>> The driver needs to work alongside with a signed firmware. The
>> loading process of
>> the signed fw is as follow.
>
> Is the firmware still signed on devices that do not have secure boot
> enabled? (which means none of their boot chain is signed)
> Do the signing checks take place in BL32 or elsewhere?
The firmware mentioned is not enabled in the chips without the secure
boot . In other words, this policy is not effective for the legacy
platform like SM1/G12.
Yes, the signing check process happens in BL32.
>
>> Stage1: Decypt and decompose the full firmware package when the
>> driver is probed.
>> +---------------------+ +---------------------+
>> | Decoder Driver | | TEE Shared Memory |
>> | (Kernel Space) | | |
>> | +---------------+ | | +---------------+ |
>> | | video_ucode | | | | firmware | |
>> | | .bin | | Copy payload to SHM | | payload | |
>> | | (from fs) | | ---------------------> | | (Secure RAM) | |
>> | +---------------+ | | +---------------+ |
>> +---------------------+ +----------+----------+
>> |
>> | PTA
>> Invocation
>> v
>> +-------------------------------+
>> | BL32 |
>> | +-------------------------+ |
>> | | Decrypt Firmware | |
>> | +-----------+-------------+ |
>> | | |
>> | v |
>> | +-------------------------+ |
>> | | Decompose the full | |
>> | | firmware pacakge | |
>> | +-----------+-------------+ |
>> | | |
>> | v |
>> | +-------------------------+ |
>> | | Store decomposed .bin | |
>> | | in Secure Memory | |
>> | +-------------------------+ |
>> +-------------------------------+
>>
>
> Is BL32 strictly needed to load that firmware? I know on at least
> older SoCs
> (sm1 and older) BL32 is not required for booting and amlogic-based
> SBCs are
> often used without BL32. So once this gets ported to older SoCs, would
> it have a hard-dependency on BL32? And if yes, can upstream Arm Trusted
> Firmware-A BL32 be used instead of the Amlogic blob?
At least on S4 and newer SoC platforms, loading this firmware strictly
requires the closed-source BL32 provided by Amlogic. If this solution is
ported to older SoCs, it will also have a dependency on BL32.
The upstream Arm Trusted Firmware-A BL32 cannot be used either, as it
lacks the capability to verify firmware signatures.
I understand your concerns, but this is primarily for the security of
encrypted data. Amlogic SoCs do not have a dedicated CPU for processing
encrypted data, both encrypted and clear data eventually converge on the
AMRISC micro-core for processing (the firmware mentioned above is what
drives this core). Therefore, we need to encrypt the firmware to prevent
it from being reverse-engineered, which would otherwise lead to the risk
of encrypted data leakage.
>
> Best regards,
> Ferass
Best regards,
Zhentao
^ permalink raw reply [flat|nested] 20+ messages in thread
[parent not found: <20260724-b4-s4-vdec-upstream-v6-4-6072a7ee7428@amlogic.com>]
* Re: [PATCH v6 4/6] decoder: Add V4L2 stateless H.264 decoder driver
[not found] ` <20260724-b4-s4-vdec-upstream-v6-4-6072a7ee7428@amlogic.com>
@ 2026-07-27 6:31 ` Krzysztof Kozlowski
2026-07-27 7:12 ` Zhentao Guo
0 siblings, 1 reply; 20+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-27 6:31 UTC (permalink / raw)
To: zhentao.guo, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-arm-kernel, linux-amlogic, linux-kernel, linux-media,
devicetree
On 24/07/2026 09:04, Zhentao Guo via B4 Relay wrote:
> From: Zhentao Guo <zhentao.guo@amlogic.com>
>
> Add initial support for V4L2 stateless video decoder
> driver on Amlogic S4(S805X2) platform. In phase 1,
> it supports 8bit H.264 bitstreams decoding. Currently
> only progressive streams are supported.
>
> Signed-off-by: Zhentao Guo <zhentao.guo@amlogic.com>
> ---
> MAINTAINERS | 7 +
> drivers/media/platform/amlogic/Kconfig | 1 +
> drivers/media/platform/amlogic/Makefile | 1 +
> drivers/media/platform/amlogic/vdec/Kconfig | 18 +
> drivers/media/platform/amlogic/vdec/Makefile | 4 +
> drivers/media/platform/amlogic/vdec/TODO | 7 +
> drivers/media/platform/amlogic/vdec/aml_vdec.c | 736 +++++++
> drivers/media/platform/amlogic/vdec/aml_vdec.h | 33 +
> drivers/media/platform/amlogic/vdec/aml_vdec_drv.c | 239 +++
> drivers/media/platform/amlogic/vdec/aml_vdec_drv.h | 172 ++
> drivers/media/platform/amlogic/vdec/aml_vdec_hw.c | 538 +++++
> drivers/media/platform/amlogic/vdec/aml_vdec_hw.h | 157 ++
> .../platform/amlogic/vdec/aml_vdec_platform.c | 81 +
> .../platform/amlogic/vdec/aml_vdec_platform.h | 46 +
> .../media/platform/amlogic/vdec/aml_vdec_tee_fw.c | 240 +++
> .../media/platform/amlogic/vdec/aml_vdec_tee_fw.h | 27 +
> drivers/media/platform/amlogic/vdec/h264.c | 2067 ++++++++++++++++++++
> drivers/media/platform/amlogic/vdec/h264.h | 299 +++
> drivers/media/platform/amlogic/vdec/reg_defines.h | 177 ++
> 19 files changed, 4850 insertions(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a112ce9f0fa0..a27ea19907f9 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1423,6 +1423,13 @@ S: Maintained
> F: Documentation/devicetree/bindings/spi/amlogic,a4-spisg.yaml
> F: drivers/spi/spi-amlogic-spisg.c
>
> +AMLOGIC VDEC DRIVER
> +M: Zhentao Guo <zhentao.guo@amlogic.com>
> +L: linux-media@vger.kernel.org
You can drop the L:. Subsystem defines it.
> +S: Maintained
> +F: Documentation/devicetree/bindings/media/amlogic,s4-vcodec-dec.yaml
> +F: drivers/media/platform/amlogic/vdec/
> +
> AMPHENOL CHIPCAP 2 DRIVER
> M: Javier Carrasco <javier.carrasco.cruz@gmail.com>
> L: linux-hwmon@vger.kernel.org
> diff --git a/drivers/media/platform/amlogic/Kconfig b/drivers/media/platform/amlogic/Kconfig
> index 458acf3d5fa8..7c541ac0d0c3 100644
> --- a/drivers/media/platform/amlogic/Kconfig
> +++ b/drivers/media/platform/amlogic/Kconfig
> @@ -4,3 +4,4 @@ comment "Amlogic media platform drivers"
>
> source "drivers/media/platform/amlogic/c3/Kconfig"
> source "drivers/media/platform/amlogic/meson-ge2d/Kconfig"
> +source "drivers/media/platform/amlogic/vdec/Kconfig"
> diff --git a/drivers/media/platform/amlogic/Makefile b/drivers/media/platform/amlogic/Makefile
> index c744afcd1b9e..7409de674c0b 100644
> --- a/drivers/media/platform/amlogic/Makefile
> +++ b/drivers/media/platform/amlogic/Makefile
> @@ -2,3 +2,4 @@
>
> obj-y += c3/
> obj-y += meson-ge2d/
> +obj-y += vdec/
> diff --git a/drivers/media/platform/amlogic/vdec/Kconfig b/drivers/media/platform/amlogic/vdec/Kconfig
> new file mode 100644
> index 000000000000..d392967c7743
> --- /dev/null
> +++ b/drivers/media/platform/amlogic/vdec/Kconfig
> @@ -0,0 +1,18 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR MIT)
> +
> +config VIDEO_AMLOGIC_VDEC
> + tristate "Amlogic Video Decoder Driver"
> + depends on ARCH_MESON || COMPILE_TEST
> + depends on VIDEO_DEV
> + depends on V4L_MEM2MEM_DRIVERS
> + depends on TEE
> + select VIDEOBUF2_DMA_CONTIG
> + select V4L2_H264
> + select V4L2_MEM2MEM_DEV
> + select MESON_CANVAS
> + select MESON_SM
> + help
> + This is a v4l2 driver for Amlogic video decoder driver.
> + This driver is designed to support V4L2 M2M STATELESS
> + interface.
Somehow messed indentation.
...
> +err_media_dev_register:
> + v4l2_m2m_unregister_media_controller(dev->m2m_dev_dec);
> +error_m2m_mc_register:
> + media_device_cleanup(&dev->mdev);
> +err_vid_dev_register:
> + v4l2_m2m_release(dev->m2m_dev_dec);
> +err_hw_init:
> + dev->dec_hw = NULL;
> +err_dec_mem_init:
> + video_device_release(vfd_dec);
> +err_device_alloc:
> + v4l2_device_unregister(&dev->v4l2_dev);
> + return ret;
> +}
> +
> +static void aml_vdec_drv_remove(struct platform_device *pdev)
> +{
> + struct aml_vdec_dev *dev = platform_get_drvdata(pdev);
> +
> + vdec_disable(dev->dec_hw);
> +
> + if (media_devnode_is_registered(dev->mdev.devnode)) {
> + media_device_unregister(&dev->mdev);
> + media_device_cleanup(&dev->mdev);
> + }
> +
> + if (dev->m2m_dev_dec)
> + v4l2_m2m_release(dev->m2m_dev_dec);
> + if (dev->vfd)
> + video_unregister_device(dev->vfd);
> + if (dev->dec_hw) {
I do not understand why do you release resources conditionally. Where
they allocated conditionally? Why probe is not releasing them the same
way in error paths?
> + dev->pvdec_data->destroy_hw_resource(dev);
> + dev->dec_hw = NULL;
What's the purpose of this? If this is needed, then your driver has
serious concurrency issues which are not solved with it.
> + }
> + v4l2_device_unregister(&dev->v4l2_dev);
> +}
> +
> +static const struct of_device_id aml_vdec_match[] = {
> + {.compatible = "amlogic,s4-vdec", .data = &aml_vdec_s4_pdata},
Fix the style, so you will not re-introduce issue Uwe is fixing.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH v6 4/6] decoder: Add V4L2 stateless H.264 decoder driver
2026-07-27 6:31 ` [PATCH v6 4/6] decoder: Add V4L2 stateless H.264 decoder driver Krzysztof Kozlowski
@ 2026-07-27 7:12 ` Zhentao Guo
0 siblings, 0 replies; 20+ messages in thread
From: Zhentao Guo @ 2026-07-27 7:12 UTC (permalink / raw)
To: Krzysztof Kozlowski, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Mauro Carvalho Chehab, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-arm-kernel, linux-amlogic, linux-kernel, linux-media,
devicetree
Hi Krzysztof,
> On 24/07/2026 09:04, Zhentao Guo via B4 Relay wrote:
>> From: Zhentao Guo <zhentao.guo@amlogic.com>
>>
>> Add initial support for V4L2 stateless video decoder
>> driver on Amlogic S4(S805X2) platform. In phase 1,
>> it supports 8bit H.264 bitstreams decoding. Currently
>> only progressive streams are supported.
>>
>> Signed-off-by: Zhentao Guo <zhentao.guo@amlogic.com>
>> ---
>> MAINTAINERS | 7 +
>> drivers/media/platform/amlogic/Kconfig | 1 +
>> drivers/media/platform/amlogic/Makefile | 1 +
>> drivers/media/platform/amlogic/vdec/Kconfig | 18 +
>> drivers/media/platform/amlogic/vdec/Makefile | 4 +
>> drivers/media/platform/amlogic/vdec/TODO | 7 +
>> drivers/media/platform/amlogic/vdec/aml_vdec.c | 736 +++++++
>> drivers/media/platform/amlogic/vdec/aml_vdec.h | 33 +
>> drivers/media/platform/amlogic/vdec/aml_vdec_drv.c | 239 +++
>> drivers/media/platform/amlogic/vdec/aml_vdec_drv.h | 172 ++
>> drivers/media/platform/amlogic/vdec/aml_vdec_hw.c | 538 +++++
>> drivers/media/platform/amlogic/vdec/aml_vdec_hw.h | 157 ++
>> .../platform/amlogic/vdec/aml_vdec_platform.c | 81 +
>> .../platform/amlogic/vdec/aml_vdec_platform.h | 46 +
>> .../media/platform/amlogic/vdec/aml_vdec_tee_fw.c | 240 +++
>> .../media/platform/amlogic/vdec/aml_vdec_tee_fw.h | 27 +
>> drivers/media/platform/amlogic/vdec/h264.c | 2067 ++++++++++++++++++++
>> drivers/media/platform/amlogic/vdec/h264.h | 299 +++
>> drivers/media/platform/amlogic/vdec/reg_defines.h | 177 ++
>> 19 files changed, 4850 insertions(+)
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index a112ce9f0fa0..a27ea19907f9 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -1423,6 +1423,13 @@ S: Maintained
>> F: Documentation/devicetree/bindings/spi/amlogic,a4-spisg.yaml
>> F: drivers/spi/spi-amlogic-spisg.c
>>
>> +AMLOGIC VDEC DRIVER
>> +M: Zhentao Guo <zhentao.guo@amlogic.com>
>> +L: linux-media@vger.kernel.org
> You can drop the L:. Subsystem defines it.
OK, got it. I'll drop this.
>
>> +S: Maintained
>> +F: Documentation/devicetree/bindings/media/amlogic,s4-vcodec-dec.yaml
>> +F: drivers/media/platform/amlogic/vdec/
>> +
>> AMPHENOL CHIPCAP 2 DRIVER
>> M: Javier Carrasco <javier.carrasco.cruz@gmail.com>
>> L: linux-hwmon@vger.kernel.org
>> diff --git a/drivers/media/platform/amlogic/Kconfig b/drivers/media/platform/amlogic/Kconfig
>> index 458acf3d5fa8..7c541ac0d0c3 100644
>> --- a/drivers/media/platform/amlogic/Kconfig
>> +++ b/drivers/media/platform/amlogic/Kconfig
>> @@ -4,3 +4,4 @@ comment "Amlogic media platform drivers"
>>
>> source "drivers/media/platform/amlogic/c3/Kconfig"
>> source "drivers/media/platform/amlogic/meson-ge2d/Kconfig"
>> +source "drivers/media/platform/amlogic/vdec/Kconfig"
>> diff --git a/drivers/media/platform/amlogic/Makefile b/drivers/media/platform/amlogic/Makefile
>> index c744afcd1b9e..7409de674c0b 100644
>> --- a/drivers/media/platform/amlogic/Makefile
>> +++ b/drivers/media/platform/amlogic/Makefile
>> @@ -2,3 +2,4 @@
>>
>> obj-y += c3/
>> obj-y += meson-ge2d/
>> +obj-y += vdec/
>> diff --git a/drivers/media/platform/amlogic/vdec/Kconfig b/drivers/media/platform/amlogic/vdec/Kconfig
>> new file mode 100644
>> index 000000000000..d392967c7743
>> --- /dev/null
>> +++ b/drivers/media/platform/amlogic/vdec/Kconfig
>> @@ -0,0 +1,18 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR MIT)
>> +
>> +config VIDEO_AMLOGIC_VDEC
>> + tristate "Amlogic Video Decoder Driver"
>> + depends on ARCH_MESON || COMPILE_TEST
>> + depends on VIDEO_DEV
>> + depends on V4L_MEM2MEM_DRIVERS
>> + depends on TEE
>> + select VIDEOBUF2_DMA_CONTIG
>> + select V4L2_H264
>> + select V4L2_MEM2MEM_DEV
>> + select MESON_CANVAS
>> + select MESON_SM
>> + help
>> + This is a v4l2 driver for Amlogic video decoder driver.
>> + This driver is designed to support V4L2 M2M STATELESS
>> + interface.
> Somehow messed indentation.
I'll fix the indentation problem in the next revision.
> ...
>
>> +err_media_dev_register:
>> + v4l2_m2m_unregister_media_controller(dev->m2m_dev_dec);
>> +error_m2m_mc_register:
>> + media_device_cleanup(&dev->mdev);
>> +err_vid_dev_register:
>> + v4l2_m2m_release(dev->m2m_dev_dec);
>> +err_hw_init:
>> + dev->dec_hw = NULL;
>> +err_dec_mem_init:
>> + video_device_release(vfd_dec);
>> +err_device_alloc:
>> + v4l2_device_unregister(&dev->v4l2_dev);
>> + return ret;
>> +}
>> +
>> +static void aml_vdec_drv_remove(struct platform_device *pdev)
>> +{
>> + struct aml_vdec_dev *dev = platform_get_drvdata(pdev);
>> +
>> + vdec_disable(dev->dec_hw);
>> +
>> + if (media_devnode_is_registered(dev->mdev.devnode)) {
>> + media_device_unregister(&dev->mdev);
>> + media_device_cleanup(&dev->mdev);
>> + }
>> +
>> + if (dev->m2m_dev_dec)
>> + v4l2_m2m_release(dev->m2m_dev_dec);
>> + if (dev->vfd)
>> + video_unregister_device(dev->vfd);
>> + if (dev->dec_hw) {
> I do not understand why do you release resources conditionally. Where
> they allocated conditionally? Why probe is not releasing them the same
> way in error paths?
These resources are allocated unconditionally in probe, so they should
be released unconditionally as well.
I was being overly cautious here to avoid potential double-free
scenarios. But in fact these resources are only released in remove(), so
the conditional is redundant. I'll drop it in the next revision.
>
>> + dev->pvdec_data->destroy_hw_resource(dev);
>> + dev->dec_hw = NULL;
> What's the purpose of this? If this is needed, then your driver has
> serious concurrency issues which are not solved with it.
>
Do you mean the statement 'dev->dec_hw = NULL;'? Actuallyin the remove
callback, all resources are at the end of their lifecycle and no other
path will access this pointer. This was just my coding habit, nulling
out pointers after freeing them. I'll drop it if you think this is
unnecessary.
>> + }
>> + v4l2_device_unregister(&dev->v4l2_dev);
>> +}
>> +
>> +static const struct of_device_id aml_vdec_match[] = {
>> + {.compatible = "amlogic,s4-vdec", .data = &aml_vdec_s4_pdata},
> Fix the style, so you will not re-introduce issue Uwe is fixing.
Thanks for the reminder. I will refer to Uwe's patch and improve this.
>
>
> Best regards,
> Krzysztof
BRs
Zhentao
^ permalink raw reply [flat|nested] 20+ messages in thread