Add support for older Rockchip SoCs to V4L2 hantro and rkvdec drivers
Subsystems (7)
cover Add support for older Rockchip SoCs to V4L2 hantro and rkvdec drivers
Hi list,
this series adds support for older Rockchip SoCs (RK3036, RK3066, RK3188 and RK322x) to the existing V4L2 video decoder/-encoder drivers - namely hantro and rkvdec.
They can be used as-is or with very little modifications.
In preparation to that patches 1-3 add power-controller support for RK3036 and RK322x, since both drivers rely on pm. The drivers for them exist already in the common Rockchip pm driver, they just haven't be added to the device trees yet.
Thanks for your feedback,
Alex.
Alex Bee (10):
ARM: dts: rockchip: add power controller for RK322x
ARM: dts: rockchip: add power controller for RK3036
dt-bindings: mfd: syscon: add Rockchip RK3036/RK3228 qos compatibles
media: hantro: add support for Rockchip RK3066
media: hantro: add support for Rockchip RK3036
ARM: dts: rockchip: add vpu nodes for RK3066 and RK3188
ARM: dts: rockchip: add vpu node for RK322x
media: dt-bindings: media: rockchip-vpu: add new compatibles
ARM: dts: rockchip: add vdec node for RK322x
media: dt-bindings: media: rockchip-vdec: add RK3228 compatible
.../bindings/media/rockchip,vdec.yaml | 10 +- .../bindings/media/rockchip-vpu.yaml | 33 +++- .../devicetree/bindings/mfd/syscon.yaml | 2 + arch/arm/boot/dts/rk3036.dtsi | 51 ++++++ arch/arm/boot/dts/rk3066a.dtsi | 4 + arch/arm/boot/dts/rk3188.dtsi | 5 + arch/arm/boot/dts/rk322x.dtsi | 139 ++++++++++++++- arch/arm/boot/dts/rk3xxx.dtsi | 12 ++ drivers/staging/media/hantro/hantro_drv.c | 2 + drivers/staging/media/hantro/hantro_hw.h | 2 + drivers/staging/media/hantro/rk3288_vpu_hw.c | 165 ++++++++++++++++++ 11 files changed, 414 insertions(+), 11 deletions(-)
base-commit: 5d765451c2409e63563fa6a3e8005bd03ab9e82f
Signature · 1 line
2.27.0
PATCH 1/10 ARM: dts: rockchip: add power controller for RK322x
Add the power controller node and the correspondending qos nodes for RK322x.
Also add the power-domain property to the nodes that are already present.
--- arch/arm/boot/dts/rk322x.dtsi | 112 ++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+)
arch/arm/boot/dts/rk322x.dtsi +112 -0
@@ -6,6 +6,7 @@ #include <dt-bindings/pinctrl/rockchip.h> #include <dt-bindings/clock/rk3228-cru.h> #include <dt-bindings/thermal/thermal.h> +#include <dt-bindings/power/rk3228-power.h> / { #address-cells = <1>;
@@ -240,6 +241,65 @@ u2phy1_host: host-port { status = "disabled"; }; }; + + power: power-controller { + compatible = "rockchip,rk3228-power-controller"; + #power-domain-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + + power-domain@RK3228_PD_VIO { + reg = <RK3228_PD_VIO>; + clocks = <&cru ACLK_HDCP>, + <&cru SCLK_HDCP>, + <&cru ACLK_IEP>, + <&cru HCLK_IEP>, + <&cru ACLK_RGA>, + <&cru HCLK_RGA>, + <&cru SCLK_RGA>; + pm_qos = <&qos_hdcp>, + <&qos_iep>, + <&qos_rga_r>, + <&qos_rga_w>; + #power-domain-cells = <0>; + }; + + power-domain@RK3228_PD_VOP { + reg = <RK3228_PD_VOP>; + clocks =<&cru ACLK_VOP>, + <&cru DCLK_VOP>, + <&cru HCLK_VOP>; + pm_qos = <&qos_vop>; + #power-domain-cells = <0>; + }; + + power-domain@RK3228_PD_VPU { + reg = <RK3228_PD_VPU>; + clocks = <&cru ACLK_VPU>, + <&cru HCLK_VPU>; + pm_qos = <&qos_vpu>; + #power-domain-cells = <0>; + }; + + power-domain@RK3228_PD_RKVDEC { + reg = <RK3228_PD_RKVDEC>; + clocks = <&cru ACLK_RKVDEC>, + <&cru HCLK_RKVDEC>, + <&cru SCLK_VDEC_CABAC>, + <&cru SCLK_VDEC_CORE>; + pm_qos = <&qos_rkvdec_r>, + <&qos_rkvdec_w>; + #power-domain-cells = <0>; + }; + + power-domain@RK3228_PD_GPU { + reg = <RK3228_PD_GPU>; + clocks = <&cru ACLK_GPU>; + pm_qos = <&qos_gpu>; + }; + + }; + }; uart0: serial@11010000 {
@@ -546,6 +606,7 @@ gpu: gpu@20000000 { "ppmmu1"; clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>; clock-names = "bus", "core"; + power-domains = <&power RK3228_PD_GPU>; resets = <&cru SRST_GPU_A>; status = "disabled"; };
@@ -556,6 +617,7 @@ vpu_mmu: iommu@20020800 { interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>; clock-names = "aclk", "iface"; + power-domains = <&power RK3228_PD_VPU>; #iommu-cells = <0>; status = "disabled"; };
@@ -566,6 +628,7 @@ vdec_mmu: iommu@20030480 { interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_RKVDEC>, <&cru HCLK_RKVDEC>; clock-names = "aclk", "iface"; + power-domains = <&power RK3228_PD_RKVDEC>; #iommu-cells = <0>; status = "disabled"; };
@@ -576,6 +639,7 @@ vop: vop@20050000 { interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_VOP>, <&cru DCLK_VOP>, <&cru HCLK_VOP>; clock-names = "aclk_vop", "dclk_vop", "hclk_vop"; + power-domains = <&power RK3228_PD_VOP>; resets = <&cru SRST_VOP_A>, <&cru SRST_VOP_H>, <&cru SRST_VOP_D>; reset-names = "axi", "ahb", "dclk"; iommus = <&vop_mmu>;
@@ -598,6 +662,7 @@ vop_mmu: iommu@20053f00 { interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_VOP>, <&cru HCLK_VOP>; clock-names = "aclk", "iface"; + power-domains = <&power RK3228_PD_VOP>; #iommu-cells = <0>; status = "disabled"; };
@@ -608,6 +673,7 @@ rga: rga@20060000 { interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA>; clock-names = "aclk", "hclk", "sclk"; + power-domains = <&power RK3228_PD_VIO>; resets = <&cru SRST_RGA>, <&cru SRST_RGA_A>, <&cru SRST_RGA_H>; reset-names = "core", "axi", "ahb"; };
@@ -618,6 +684,7 @@ iep_mmu: iommu@20070800 { interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_IEP>, <&cru HCLK_IEP>; clock-names = "aclk", "iface"; + power-domains = <&power RK3228_PD_VIO>; #iommu-cells = <0>; status = "disabled"; };
@@ -792,6 +859,51 @@ gmac: ethernet@30200000 { status = "disabled"; }; + qos_iep: qos@31030080 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31030080 0x20>; + }; + + qos_rga_w: qos@31030100 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31030100 0x20>; + }; + + qos_hdcp: qos@31030180 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31030180 0x20>; + }; + + qos_rga_r: qos@31030200 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31030200 0x20>; + }; + + qos_vpu: qos@31040000 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31040000 0x20>; + }; + + qos_gpu: qos@31050000 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31050000 0x20>; + }; + + qos_vop: qos@31060000 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31060000 0x20>; + }; + + qos_rkvdec_r: qos@31070000 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31070000 0x20>; + }; + + qos_rkvdec_w: qos@31070080 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31070080 0x20>; + }; + gic: interrupt-controller@32010000 { compatible = "arm,gic-400"; interrupt-controller;
Signature · 1 line
2.27.0
PATCH 2/10 ARM: dts: rockchip: add power controller for RK3036
In reply to Alex BeeAdd the power controller node and the correspondending qos nodes for RK3036.
Also add the power-domain property to the nodes that are already present.
Note: Since the regiser offsets of the axi interconnect QoS are missing in the TRM (RK3036 TRM V1.0), they have been taken from vendor kernel.
--- arch/arm/boot/dts/rk3036.dtsi | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
arch/arm/boot/dts/rk3036.dtsi +51 -0
@@ -6,6 +6,7 @@ #include <dt-bindings/pinctrl/rockchip.h> #include <dt-bindings/clock/rk3036-cru.h> #include <dt-bindings/soc/rockchip,boot-mode.h> +#include <dt-bindings/power/rk3036-power.h> / { #address-cells = <1>;
@@ -111,6 +112,7 @@ gpu: gpu@10090000 { assigned-clock-rates = <100000000>; clocks = <&cru SCLK_GPU>, <&cru SCLK_GPU>; clock-names = "bus", "core"; + power-domains = <&power RK3036_PD_GPU>; resets = <&cru SRST_GPU>; status = "disabled"; };
@@ -121,6 +123,7 @@ vop: vop@10118000 { interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_LCDC>, <&cru SCLK_LCDC>, <&cru HCLK_LCDC>; clock-names = "aclk_vop", "dclk_vop", "hclk_vop"; + power-domains = <&power RK3036_PD_VIO>; resets = <&cru SRST_LCDC1_A>, <&cru SRST_LCDC1_H>, <&cru SRST_LCDC1_D>; reset-names = "axi", "ahb", "dclk"; iommus = <&vop_mmu>;
@@ -142,10 +145,26 @@ vop_mmu: iommu@10118300 { interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_LCDC>, <&cru HCLK_LCDC>; clock-names = "aclk", "iface"; + power-domains = <&power RK3036_PD_VIO>; #iommu-cells = <0>; status = "disabled"; }; + qos_gpu: qos@1012d000 { + compatible = "rockchip,rk3036-qos", "syscon"; + reg = <0x1012d000 0x20>; + }; + + qos_vpu: qos@1012e000 { + compatible = "rockchip,rk3036-qos", "syscon"; + reg = <0x1012e000 0x20>; + }; + + qos_vio: qos@1012f000 { + compatible = "rockchip,rk3036-qos", "syscon"; + reg = <0x1012f000 0x20>; + }; + gic: interrupt-controller@10139000 { compatible = "arm,gic-400"; interrupt-controller;
@@ -301,6 +320,38 @@ grf: syscon@20008000 { compatible = "rockchip,rk3036-grf", "syscon", "simple-mfd"; reg = <0x20008000 0x1000>; + power: power-controller { + compatible = "rockchip,rk3036-power-controller"; + #power-domain-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + + power-domain@RK3036_PD_VIO { + reg = <RK3036_PD_VIO>; + clocks = <&cru ACLK_LCDC>, + <&cru HCLK_LCDC>, + <&cru SCLK_LCDC>; + pm_qos = <&qos_vio>; + #power-domain-cells = <0>; + }; + + power-domain@RK3036_PD_VPU { + reg = <RK3036_PD_VPU>; + clocks = <&cru ACLK_VCODEC>, + <&cru HCLK_VCODEC>; + pm_qos = <&qos_vpu>; + #power-domain-cells = <0>; + }; + + power-domain@RK3036_PD_GPU { + reg = <RK3036_PD_GPU>; + clocks = <&cru SCLK_GPU>; + pm_qos = <&qos_gpu>; + #power-domain-cells = <0>; + }; + + }; + reboot-mode { compatible = "syscon-reboot-mode"; offset = <0x1d8>;
Signature · 1 line
2.27.0
PATCH 3/10 dt-bindings: mfd: syscon: add Rockchip RK3036/RK3228 qos compatibles
In reply to Alex BeeChecked with:
make ARCH=arm dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/mfd/syscon.yaml
--- Documentation/devicetree/bindings/mfd/syscon.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/mfd/syscon.yaml +2 -0
@@ -45,7 +45,9 @@ properties: - microchip,sparx5-cpu-syscon - mstar,msc313-pmsleep - rockchip,px30-qos + - rockchip,rk3036-qos - rockchip,rk3066-qos + - rockchip,rk3228-qos - rockchip,rk3288-qos - rockchip,rk3399-qos - samsung,exynos3-sysreg
Signature · 1 line
2.27.0
Re: [PATCH 03/10] dt-bindings: mfd: syscon: add Rockchip RK3036/RK3228 qos compatibles
Am Dienstag, 25. Mai 2021, 17:22:18 CEST schrieb Alex Bee:
Quoted 5 lines
Checked with:
make ARCH=armdtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/mfd/syscon.yamlSigned-off-by Alex Bee <[email protected]>
Quoted 19 lines
--- Documentation/devicetree/bindings/mfd/syscon.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/mfd/syscon.yaml +2
-0@@ -45,7 +45,9 @@ properties: - microchip,sparx5-cpu-syscon - mstar,msc313-pmsleep - rockchip,px30-qos + - rockchip,rk3036-qos - rockchip,rk3066-qos + - rockchip,rk3228-qos - rockchip,rk3288-qos - rockchip,rk3399-qos - samsung,exynos3-sysreg
PATCH 4/10 media: hantro: add support for Rockchip RK3066
In reply to Alex BeeRK3066's VPU IP block is the predecessor from what RK3288 has. The hardware differences are:
- supports decoding frame sizes up to 1920x1088 only
- doesn't have the 'G1_REG_SOFT_RESET' register (requires another .reset callback for hantro_codec_ops, since writing this register will result in non-working IP block)
- has one ACLK/HCLK per vdpu/vepu
- ACLKs can be clocked up to 300 MHz only
- no MMU
(no changes required: CMA will be transparently used)
Add a new RK3066 variant which reflect this differences. This variant can be used for RK3188 as well.
--- drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 + drivers/staging/media/hantro/rk3288_vpu_hw.c | 116 +++++++++++++++++++ 3 files changed, 118 insertions(+)
drivers/staging/media/hantro/hantro_drv.c +1 -0
@@ -489,6 +489,7 @@ static const struct of_device_id of_hantro_match[] = { { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, }, { .compatible = "rockchip,rk3328-vpu", .data = &rk3328_vpu_variant, }, { .compatible = "rockchip,rk3288-vpu", .data = &rk3288_vpu_variant, }, + { .compatible = "rockchip,rk3066-vpu", .data = &rk3066_vpu_variant, }, #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },
drivers/staging/media/hantro/hantro_hw.h +1 -0
@@ -163,6 +163,7 @@ enum hantro_enc_fmt {extern const struct hantro_variant rk3399_vpu_variant;extern const struct hantro_variant rk3328_vpu_variant;extern const struct hantro_variant rk3288_vpu_variant; +extern const struct hantro_variant rk3066_vpu_variant;extern const struct hantro_variant imx8mq_vpu_variant;extern const struct hantro_variant sama5d4_vdec_variant;
drivers/staging/media/hantro/rk3288_vpu_hw.c +116 -0
158 lines not on this page · raw message
Signature · 1 line
2.27.0
Heiko Stübner
maintainerRe: [PATCH 04/10] media: hantro: add support for Rockchip RK3066
Am Dienstag, 25. Mai 2021, 17:22:19 CEST schrieb Alex Bee:
Quoted 27 lines
RK3066's VPU IP block is the predecessor from what RK3288 has. The hardware differences are:
- supports decoding frame sizes up to 1920x1088 only
- doesn't have the 'G1_REG_SOFT_RESET' register (requires another .reset callback forhantro_codec_ops, since writing this register will result in non-working IP block)
- has one ACLK/HCLK per vdpu/vepu
- ACLKs can be clocked up to 300 MHz only
- no MMU
(no changes required: CMA will be transparently used)Add a new RK3066 variant which reflect this differences. This variant can be used for RK3188 as well.
Signed-off-by Alex Bee <[email protected]>--- drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 + drivers/staging/media/hantro/rk3288_vpu_hw.c | 116 +++++++++++++++++++ 3 files changed, 118 insertions(+)drivers/staging/media/hantro/hantro_drv.c +0
-0
drivers/staging/media/hantro/hantro_drv.c static const struct of_device_id of_hantro_match[] = { · line 492
Quoted 4 lines
drivers/staging/media/hantro/hantro_drv.c +1
-0@@ -489,6 +489,7 @@ static const struct of_device_id of_hantro_match[] = { { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, }, { .compatible = "rockchip,rk3328-vpu", .data = &rk3328_vpu_variant, }, { .compatible = "rockchip,rk3288-vpu", .data = &rk3288_vpu_variant, }, + { .compatible = "rockchip,rk3066-vpu", .data = &rk3066_vpu_variant, },
NIT: "someone" should introduce a separate patch ordering that list ;-)
Quoted 84 lines
drivers/staging/media/hantro/hantro_drv.c +0
-0#endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },drivers/staging/media/hantro/hantro_hw.h +1
-0@@ -163,6 +163,7 @@ enum hantro_enc_fmt {extern const struct hantro_variant rk3399_vpu_variant;extern const struct hantro_variant rk3328_vpu_variant;extern const struct hantro_variant rk3288_vpu_variant; +extern const struct hantro_variant rk3066_vpu_variant;extern const struct hantro_variant imx8mq_vpu_variant;extern const struct hantro_variant sama5d4_vdec_variant;drivers/staging/media/hantro/rk3288_vpu_hw.c +48
-0@@ -10,8 +10,10 @@#include "hantro.h" #include "hantro_jpeg.h" +#include "hantro_g1_regs.h" #include "hantro_h1_regs.h" +#define RK3066_ACLK_MAX_FREQ (300 * 1000 * 1000)#define RK3288_ACLK_MAX_FREQ (400 * 1000 * 1000)/* @@ -62,6 +64,52 @@ static const struct hantro_fmt rk3288_vpu_postproc_fmts[] = { }, }; +static const struct hantro_fmt rk3066_vpu_dec_fmts[] = { + { + .fourcc =V4L2_PIX_FMT_NV12 , + .codec_mode =HANTRO_MODE_NONE , + }, + { + .fourcc =V4L2_PIX_FMT_H264_SLICE , + .codec_mode =HANTRO_MODE_H264_DEC , + .max_depth =2 , + .frmsize = { + .min_width =48 , + .max_width =1920 , + .step_width =MB_DIM , + .min_height =48 , + .max_height =1088 , + .step_height =MB_DIM , + }, + }, + { + .fourcc =V4L2_PIX_FMT_MPEG2_SLICE , + .codec_mode =HANTRO_MODE_MPEG2_DEC , + .max_depth =2 , + .frmsize = { + .min_width =48 , + .max_width =1920 , + .step_width =MB_DIM , + .min_height =48 , + .max_height =1088 , + .step_height =MB_DIM , + }, + }, + { + .fourcc =V4L2_PIX_FMT_VP8_FRAME , + .codec_mode =HANTRO_MODE_VP8_DEC , + .max_depth =2 , + .frmsize = { + .min_width =48 , + .max_width =1920 , + .step_width =MB_DIM , + .min_height =48 , + .max_height =1088 , + .step_height =MB_DIM , + }, + }, +}; +static const struct hantro_fmt rk3288_vpu_dec_fmts[] = { { .fourcc =V4L2_PIX_FMT_NV12 ,
drivers/staging/media/hantro/rk3288_vpu_hw.c static irqreturn_t rk3288_vepu_irq(int irq, void *dev_id) · line 181
Quoted 8 lines
drivers/staging/media/hantro/rk3288_vpu_hw.c +5
-0@@ -126,6 +174,14 @@ static irqreturn_t rk3288_vepu_irq(int irq, void *dev_id)return IRQ_HANDLED ; } +static int rk3066_vpu_hw_init (struct hantro_dev *vpu) +{ +/* Bump ACLKs to max. possible freq. to improve performance. */ +clk_set_rate (vpu->clocks[0 ].clk,RK3066_ACLK_MAX_FREQ ); +clk_set_rate (vpu->clocks[0 ].clk,RK3066_ACLK_MAX_FREQ );
hmm, I don't think that line was supposed to be double?
Heiko
Quoted 92 lines
drivers/staging/media/hantro/rk3288_vpu_hw.c +63
-0+return 0 ; +} +static int rk3288_vpu_hw_init (struct hantro_dev *vpu) {/* Bump ACLK to max. possible freq. to improve performance. */ @@ -133,6 +189,14 @@ static int rk3288_vpu_hw_init(struct hantro_dev *vpu)return 0 ; } +static void rk3066_vpu_dec_reset (struct hantro_ctx *ctx) +{ +struct hantro_dev *vpu = ctx->dev; + +vdpu_write (vpu,G1_REG_INTERRUPT_DEC_IRQ_DIS ,G1_REG_INTERRUPT ); +vdpu_write (vpu,G1_REG_CONFIG_DEC_CLK_GATE_E ,G1_REG_CONFIG ); +} +static void rk3288_vpu_enc_reset (struct hantro_ctx *ctx) {struct hantro_dev *vpu = ctx->dev;@@ -145,6 +209,33 @@ static void rk3288_vpu_enc_reset(struct hantro_ctx *ctx)/* * Supported codec ops. */ +static const struct hantro_codec_ops rk3066_vpu_codec_ops[] = { + [HANTRO_MODE_JPEG_ENC ] = { + .run = hantro_h1_jpeg_enc_run, + .reset = rk3288_vpu_enc_reset, + .init = hantro_jpeg_enc_init, + .done = hantro_jpeg_enc_done, + .exit = hantro_jpeg_enc_exit, + }, + [HANTRO_MODE_H264_DEC ] = { + .run = hantro_g1_h264_dec_run, + .reset = rk3066_vpu_dec_reset, + .init = hantro_h264_dec_init, + .exit = hantro_h264_dec_exit, + }, + [HANTRO_MODE_MPEG2_DEC ] = { + .run = hantro_g1_mpeg2_dec_run, + .reset = rk3066_vpu_dec_reset, + .init = hantro_mpeg2_dec_init, + .exit = hantro_mpeg2_dec_exit, + }, + [HANTRO_MODE_VP8_DEC ] = { + .run = hantro_g1_vp8_dec_run, + .reset = rk3066_vpu_dec_reset, + .init = hantro_vp8_dec_init, + .exit = hantro_vp8_dec_exit, + }, +};static const struct hantro_codec_ops rk3288_vpu_codec_ops[] = { [HANTRO_MODE_JPEG_ENC ] = {@@ -183,10 +274,35 @@ static const struct hantro_irq rk3288_irqs[] = { { "vdpu", hantro_g1_irq }, }; +static const char *const rk3066_clk_names[] = { +"aclk_vdpu" ,"hclk_vdpu" , +"aclk_vepu" ,"hclk_vepu" +}; +static const char *const rk3288_clk_names[] = {"aclk" ,"hclk" }; +const struct hantro_variant rk3066_vpu_variant = { + .enc_offset =0x0 , + .enc_fmts = rk3288_vpu_enc_fmts, + .num_enc_fmts =ARRAY_SIZE (rk3288_vpu_enc_fmts), + .dec_offset =0x400 , + .dec_fmts = rk3066_vpu_dec_fmts, + .num_dec_fmts =ARRAY_SIZE (rk3066_vpu_dec_fmts), + .postproc_fmts = rk3288_vpu_postproc_fmts, + .num_postproc_fmts =ARRAY_SIZE (rk3288_vpu_postproc_fmts), + .postproc_regs = &hantro_g1_postproc_regs, + .codec =HANTRO_JPEG_ENCODER |HANTRO_MPEG2_DECODER | +HANTRO_VP8_DECODER |HANTRO_H264_DECODER , + .codec_ops = rk3066_vpu_codec_ops, + .irqs = rk3288_irqs, + .num_irqs =ARRAY_SIZE (rk3288_irqs), + .init = rk3066_vpu_hw_init, + .clk_names = rk3066_clk_names, + .num_clocks =ARRAY_SIZE (rk3066_clk_names) +}; +const struct hantro_variant rk3288_vpu_variant = { .enc_offset =0x0 , .enc_fmts = rk3288_vpu_enc_fmts,
Re: [PATCH 04/10] media: hantro: add support for Rockchip RK3066
In reply to Alex BeeHi Alex,
Thanks for the patch.
Quoted 188 lines · Alex Bee
RK3066's VPU IP block is the predecessor from what RK3288 has. The hardware differences are:
- supports decoding frame sizes up to 1920x1088 only
- doesn't have the 'G1_REG_SOFT_RESET' register (requires another .reset callback forhantro_codec_ops, since writing this register will result in non-working IP block)
- has one ACLK/HCLK per vdpu/vepu
- ACLKs can be clocked up to 300 MHz only
- no MMU
(no changes required: CMA will be transparently used)Add a new RK3066 variant which reflect this differences. This variant can be used for RK3188 as well.
Signed-off-by Alex Bee <[email protected]>---
drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 +drivers/staging/media/hantro/rk3288_vpu_hw.c| 116 +++++++++++++++++++3 files changed, 118 insertions(+)drivers/staging/media/hantro/hantro_drv.c +1
-0@@ -489,6 +489,7 @@ static const struct of_device_id of_hantro_match[] = { { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, }, { .compatible = "rockchip,rk3328-vpu", .data = &rk3328_vpu_variant, }, { .compatible = "rockchip,rk3288-vpu", .data = &rk3288_vpu_variant, }, + { .compatible = "rockchip,rk3066-vpu", .data = &rk3066_vpu_variant, }, #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },drivers/staging/media/hantro/hantro_hw.h +1
-0@@ -163,6 +163,7 @@ enum hantro_enc_fmt { extern const struct hantro_variant rk3399_vpu_variant; extern const struct hantro_variant rk3328_vpu_variant; extern const struct hantro_variant rk3288_vpu_variant; +extern const struct hantro_variant rk3066_vpu_variant; extern const struct hantro_variant imx8mq_vpu_variant; extern const struct hantro_variant sama5d4_vdec_variant;drivers/staging/media/hantro/rk3288_vpu_hw.c +0
-0@@ -10,8 +10,10 @@
#include "hantro.h"
#include "hantro_jpeg.h"
+#include "hantro_g1_regs.h"
#include "hantro_h1_regs.h"
+#defineRK3066_ACLK_MAX_FREQ(300 * 1000 * 1000)
#defineRK3288_ACLK_MAX_FREQ(400 * 1000 * 1000)
/*drivers/staging/media/hantro/rk3288_vpu_hw.c +0
-0@@ -62,6 +64,52 @@ static const struct hantro_fmt rk3288_vpu_postproc_fmts[] = { }, };drivers/staging/media/hantro/rk3288_vpu_hw.c +46
-0+static const struct hantro_fmt rk3066_vpu_dec_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_NV12, + .codec_mode = HANTRO_MODE_NONE, + }, + { + .fourcc = V4L2_PIX_FMT_H264_SLICE, + .codec_mode = HANTRO_MODE_H264_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 1920, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 1088, + .step_height = MB_DIM, + }, + }, + { + .fourcc = V4L2_PIX_FMT_MPEG2_SLICE, + .codec_mode = HANTRO_MODE_MPEG2_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 1920, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 1088, + .step_height = MB_DIM, + }, + }, + { + .fourcc = V4L2_PIX_FMT_VP8_FRAME, + .codec_mode = HANTRO_MODE_VP8_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 1920, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 1088, + .step_height = MB_DIM, + }, + }, +}; +static const struct
hantro_fmtrk3288_vpu_dec_fmts[] = { {
.fourcc =V4L2_PIX_FMT_NV12,drivers/staging/media/hantro/rk3288_vpu_hw.c +0
-0@@ -126,6 +174,14 @@ static irqreturn_t rk3288_vepu_irq(int irq, void *dev_id) return IRQ_HANDLED; }drivers/staging/media/hantro/rk3288_vpu_hw.c +8
-0+static int rk3066_vpu_hw_init (struct hantro_dev *vpu) +{ + /* Bump ACLKs to max. possible freq. to improve performance. */ + clk_set_rate(vpu->clocks[0].clk, RK3066_ACLK_MAX_FREQ); + clk_set_rate(vpu->clocks[0].clk, RK3066_ACLK_MAX_FREQ); + return 0; +} +static int
rk3288_vpu_hw_init(struct hantro_dev *vpu)
{
/* Bump ACLK to max. possible freq. to improve performance. */drivers/staging/media/hantro/rk3288_vpu_hw.c +0
-0@@ -133,6 +189,14 @@ static int rk3288_vpu_hw_init(struct hantro_dev *vpu) return 0; }drivers/staging/media/hantro/rk3288_vpu_hw.c +8
-0+static void rk3066_vpu_dec_reset (struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + + vdpu_write(vpu, G1_REG_INTERRUPT_DEC_IRQ_DIS, G1_REG_INTERRUPT); + vdpu_write(vpu, G1_REG_CONFIG_DEC_CLK_GATE_E, G1_REG_CONFIG); +} +static void
rk3288_vpu_enc_reset(struct hantro_ctx *ctx){
structhantro_dev*vpu =ctx->dev;drivers/staging/media/hantro/rk3288_vpu_hw.c +27
-0@@ -145,6 +209,33 @@ static void rk3288_vpu_enc_reset(struct hantro_ctx *ctx) /** Supported codec ops. */ +static const struct hantro_codec_ops rk3066_vpu_codec_ops[] = { + [HANTRO_MODE_JPEG_ENC] = { + .run = hantro_h1_jpeg_enc_run, + .reset = rk3288_vpu_enc_reset, + .init = hantro_jpeg_enc_init, + .done = hantro_jpeg_enc_done, + .exit = hantro_jpeg_enc_exit, + }, + [HANTRO_MODE_H264_DEC] = { + .run = hantro_g1_h264_dec_run, + .reset = rk3066_vpu_dec_reset, + .init = hantro_h264_dec_init, + .exit = hantro_h264_dec_exit, + }, + [HANTRO_MODE_MPEG2_DEC] = { + .run = hantro_g1_mpeg2_dec_run, + .reset = rk3066_vpu_dec_reset, + .init = hantro_mpeg2_dec_init, + .exit = hantro_mpeg2_dec_exit, + }, + [HANTRO_MODE_VP8_DEC] = { + .run = hantro_g1_vp8_dec_run, + .reset = rk3066_vpu_dec_reset, + .init = hantro_vp8_dec_init, + .exit = hantro_vp8_dec_exit, + }, +};
static const structhantro_codec_opsrk3288_vpu_codec_ops[] = { [HANTRO_MODE_JPEG_ENC] = {drivers/staging/media/hantro/rk3288_vpu_hw.c +0
-0@@ -183,10 +274,35 @@ static const struct hantro_irq rk3288_irqs[] = { { "vdpu", hantro_g1_irq }, };drivers/staging/media/hantro/rk3288_vpu_hw.c +5
-0+static const char *const rk3066_clk_names[] = { + "aclk_vdpu", "hclk_vdpu", + "aclk_vepu", "hclk_vepu" +}; +static const char * const rk3288_clk_names[] = {
Quoted 8 lines
"aclk", "hclk"
};
+const structhantro_variantrk3066_vpu_variant= { + .enc_offset =0x0,
+ .enc_fmts =rk3288_vpu_enc_fmts,
+ .num_enc_fmts =ARRAY_SIZE(rk3288_vpu_enc_fmts), + .dec_offset =0x400,
Having decoder and encoder supported by a single devicetree node was done for RK3288 to cope with some bug in the hardware that was effectively linking the decoder and the encoder.
AFAIK, Rockchip has fixed this, so unless there's a strong need, I prefer we keep them separated, with one DT node for the g1 decoder and one for the h1 encoder.
Thanks!
Ezequiel
Re: [PATCH 04/10] media: hantro: add support for Rockchip RK3066
Hi Ezequiel,
thanks for your feedback.
Am 26.05.21 um 12:32 schrieb Ezequiel Garcia:
Quoted 205 lines
Hi Alex,
Thanks for the patch.
Quoted 186 lines · Alex Bee
RK3066's VPU IP block is the predecessor from what RK3288 has. The hardware differences are:
- supports decoding frame sizes up to 1920x1088 only
- doesn't have the 'G1_REG_SOFT_RESET' register (requires another .reset callback forhantro_codec_ops, since writing this register will result in non-working IP block)
- has one ACLK/HCLK per vdpu/vepu
- ACLKs can be clocked up to 300 MHz only
- no MMU
(no changes required: CMA will be transparently used)Add a new RK3066 variant which reflect this differences. This variant can be used for RK3188 as well.
Signed-off-by Alex Bee <[email protected]>--- drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 + drivers/staging/media/hantro/rk3288_vpu_hw.c | 116 +++++++++++++++++++ 3 files changed, 118 insertions(+)drivers/staging/media/hantro/hantro_drv.c +1
-0@@ -489,6 +489,7 @@ static const struct of_device_id of_hantro_match[] = { { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, }, { .compatible = "rockchip,rk3328-vpu", .data = &rk3328_vpu_variant, }, { .compatible = "rockchip,rk3288-vpu", .data = &rk3288_vpu_variant, }, + { .compatible = "rockchip,rk3066-vpu", .data = &rk3066_vpu_variant, }, #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },drivers/staging/media/hantro/hantro_hw.h +1
-0@@ -163,6 +163,7 @@ enum hantro_enc_fmt { extern const struct hantro_variant rk3399_vpu_variant; extern const struct hantro_variant rk3328_vpu_variant; extern const struct hantro_variant rk3288_vpu_variant; +extern const struct hantro_variant rk3066_vpu_variant; extern const struct hantro_variant imx8mq_vpu_variant; extern const struct hantro_variant sama5d4_vdec_variant;drivers/staging/media/hantro/rk3288_vpu_hw.c +95
-0@@ -10,8 +10,10 @@ #include "hantro.h" #include "hantro_jpeg.h" +#include "hantro_g1_regs.h" #include "hantro_h1_regs.h" +#define RK3066_ACLK_MAX_FREQ (300 * 1000 * 1000) #define RK3288_ACLK_MAX_FREQ (400 * 1000 * 1000) /*@@ -62,6 +64,52 @@ static const struct hantro_fmt rk3288_vpu_postproc_fmts[] = { }, }; +static const struct hantro_fmt rk3066_vpu_dec_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_NV12, + .codec_mode = HANTRO_MODE_NONE, + }, + { + .fourcc = V4L2_PIX_FMT_H264_SLICE, + .codec_mode = HANTRO_MODE_H264_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 1920, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 1088, + .step_height = MB_DIM, + }, + }, + { + .fourcc = V4L2_PIX_FMT_MPEG2_SLICE, + .codec_mode = HANTRO_MODE_MPEG2_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 1920, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 1088, + .step_height = MB_DIM, + }, + }, + { + .fourcc = V4L2_PIX_FMT_VP8_FRAME, + .codec_mode = HANTRO_MODE_VP8_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 1920, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 1088, + .step_height = MB_DIM, + }, + }, +}; + static const struct hantro_fmt rk3288_vpu_dec_fmts[] = { { .fourcc = V4L2_PIX_FMT_NV12,@@ -126,6 +174,14 @@ static irqreturn_t rk3288_vepu_irq(int irq, void *dev_id) return IRQ_HANDLED; } +static int rk3066_vpu_hw_init (struct hantro_dev *vpu) +{ + /* Bump ACLKs to max. possible freq. to improve performance. */ + clk_set_rate(vpu->clocks[0].clk, RK3066_ACLK_MAX_FREQ); + clk_set_rate(vpu->clocks[0].clk, RK3066_ACLK_MAX_FREQ); + return 0; +} + static int rk3288_vpu_hw_init(struct hantro_dev *vpu) { /* Bump ACLK to max. possible freq. to improve performance. */@@ -133,6 +189,14 @@ static int rk3288_vpu_hw_init(struct hantro_dev *vpu) return 0; } +static void rk3066_vpu_dec_reset (struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + + vdpu_write(vpu, G1_REG_INTERRUPT_DEC_IRQ_DIS, G1_REG_INTERRUPT); + vdpu_write(vpu, G1_REG_CONFIG_DEC_CLK_GATE_E, G1_REG_CONFIG); +} + static void rk3288_vpu_enc_reset(struct hantro_ctx *ctx) { struct hantro_dev *vpu = ctx->dev;@@ -145,6 +209,33 @@ static void rk3288_vpu_enc_reset(struct hantro_ctx *ctx) /** Supported codec ops. */ +static const struct hantro_codec_ops rk3066_vpu_codec_ops[] = { + [HANTRO_MODE_JPEG_ENC] = { + .run = hantro_h1_jpeg_enc_run, + .reset = rk3288_vpu_enc_reset, + .init = hantro_jpeg_enc_init, + .done = hantro_jpeg_enc_done, + .exit = hantro_jpeg_enc_exit, + }, + [HANTRO_MODE_H264_DEC] = { + .run = hantro_g1_h264_dec_run, + .reset = rk3066_vpu_dec_reset, + .init = hantro_h264_dec_init, + .exit = hantro_h264_dec_exit, + }, + [HANTRO_MODE_MPEG2_DEC] = { + .run = hantro_g1_mpeg2_dec_run, + .reset = rk3066_vpu_dec_reset, + .init = hantro_mpeg2_dec_init, + .exit = hantro_mpeg2_dec_exit, + }, + [HANTRO_MODE_VP8_DEC] = { + .run = hantro_g1_vp8_dec_run, + .reset = rk3066_vpu_dec_reset, + .init = hantro_vp8_dec_init, + .exit = hantro_vp8_dec_exit, + }, +}; static const struct hantro_codec_ops rk3288_vpu_codec_ops[] = { [HANTRO_MODE_JPEG_ENC] = {@@ -183,10 +274,35 @@ static const struct hantro_irq rk3288_irqs[] = { { "vdpu", hantro_g1_irq }, }; +static const char *const rk3066_clk_names[] = { + "aclk_vdpu", "hclk_vdpu", + "aclk_vepu", "hclk_vepu" +};drivers/staging/media/hantro/rk3288_vpu_hw.c static const struct hantro_irq rk3288_irqs[] = { · line 290
Quoted 10 lines
drivers/staging/media/hantro/rk3288_vpu_hw.c +6
-0+ static const char * const rk3288_clk_names[] = { "aclk", "hclk" }; +const struct hantro_variant rk3066_vpu_variant = { + .enc_offset = 0x0, + .enc_fmts = rk3288_vpu_enc_fmts, + .num_enc_fmts = ARRAY_SIZE(rk3288_vpu_enc_fmts), + .dec_offset = 0x400,Having decoder and encoder supported by a single devicetree node was done for RK3288 to cope with some bug in the hardware that was effectively linking the decoder and the encoder.
Quoted 7 lines
AFAIK, Rockchip has fixed this, so unless there's a strong need, I prefer we keep them separated, with one DT node for the g1 decoder and one for the h1 encoder.
Thanks!
Ezequiel
I just checked it: despite it looks like we could use the decoder and encoder separately
(separate clocks for decoder / encoder) the VPU block won't work (SoC crashes),
if not all 4 clocks are enabled for neither decoding nor encoding.
I'd prefer the other way also, but it seems not possible.
Alex.
Re: [PATCH 04/10] media: hantro: add support for Rockchip RK3066
Quoted 220 lines · Alex Bee
Hi Ezequiel,
thanks for your feedback.
Am 26.05.21 um 12:32 schrieb Ezequiel Garcia:
Quoted 205 lines
Hi Alex,
Thanks for the patch.
Quoted 188 lines · Alex Bee
RK3066's VPU IP block is the predecessor from what RK3288 has. The hardware differences are:
- supports decoding frame sizes up to 1920x1088 only
- doesn't have the 'G1_REG_SOFT_RESET' register (requires another .reset callback forhantro_codec_ops, since writing this register will result in non-working IP block)
- has one ACLK/HCLK per vdpu/vepu
- ACLKs can be clocked up to 300 MHz only
- no MMU
(no changes required: CMA will be transparently used)Add a new RK3066 variant which reflect this differences. This variant can be used for RK3188 as well.
Signed-off-by Alex Bee <[email protected]>---
drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 +drivers/staging/media/hantro/rk3288_vpu_hw.c| 116 +++++++++++++++++++3 files changed, 118 insertions(+)drivers/staging/media/hantro/hantro_drv.c +1
-0@@ -489,6 +489,7 @@ static const struct of_device_id of_hantro_match[] = { { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, }, { .compatible = "rockchip,rk3328-vpu", .data = &rk3328_vpu_variant, }, { .compatible = "rockchip,rk3288-vpu", .data = &rk3288_vpu_variant, }, + { .compatible = "rockchip,rk3066-vpu", .data = &rk3066_vpu_variant, }, #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },drivers/staging/media/hantro/hantro_hw.h +1
-0@@ -163,6 +163,7 @@ enum hantro_enc_fmt { extern const struct hantro_variant rk3399_vpu_variant; extern const struct hantro_variant rk3328_vpu_variant; extern const struct hantro_variant rk3288_vpu_variant; +extern const struct hantro_variant rk3066_vpu_variant; extern const struct hantro_variant imx8mq_vpu_variant; extern const struct hantro_variant sama5d4_vdec_variant;drivers/staging/media/hantro/rk3288_vpu_hw.c +0
-0@@ -10,8 +10,10 @@
#include "hantro.h"
#include "hantro_jpeg.h"
+#include "hantro_g1_regs.h"
#include "hantro_h1_regs.h"
+#defineRK3066_ACLK_MAX_FREQ(300 * 1000 * 1000) #defineRK3288_ACLK_MAX_FREQ(400 * 1000 * 1000)
/*drivers/staging/media/hantro/rk3288_vpu_hw.c +0
-0@@ -62,6 +64,52 @@ static const struct hantro_fmt rk3288_vpu_postproc_fmts[] = { }, };drivers/staging/media/hantro/rk3288_vpu_hw.c +46
-0+static const struct hantro_fmt rk3066_vpu_dec_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_NV12, + .codec_mode = HANTRO_MODE_NONE, + }, + { + .fourcc = V4L2_PIX_FMT_H264_SLICE, + .codec_mode = HANTRO_MODE_H264_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 1920, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 1088, + .step_height = MB_DIM, + }, + }, + { + .fourcc = V4L2_PIX_FMT_MPEG2_SLICE, + .codec_mode = HANTRO_MODE_MPEG2_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 1920, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 1088, + .step_height = MB_DIM, + }, + }, + { + .fourcc = V4L2_PIX_FMT_VP8_FRAME, + .codec_mode = HANTRO_MODE_VP8_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 1920, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 1088, + .step_height = MB_DIM, + }, + }, +}; +static const struct
hantro_fmtrk3288_vpu_dec_fmts[] = { {
.fourcc =V4L2_PIX_FMT_NV12,drivers/staging/media/hantro/rk3288_vpu_hw.c +0
-0@@ -126,6 +174,14 @@ static irqreturn_t rk3288_vepu_irq(int irq, void *dev_id) return IRQ_HANDLED; }drivers/staging/media/hantro/rk3288_vpu_hw.c +8
-0+static int rk3066_vpu_hw_init (struct hantro_dev *vpu) +{ + /* Bump ACLKs to max. possible freq. to improve performance. */ + clk_set_rate(vpu->clocks[0].clk, RK3066_ACLK_MAX_FREQ); + clk_set_rate(vpu->clocks[0].clk, RK3066_ACLK_MAX_FREQ); + return 0; +} +static int
rk3288_vpu_hw_init(struct hantro_dev *vpu)
{
/* Bump ACLK to max. possible freq. to improve performance. */drivers/staging/media/hantro/rk3288_vpu_hw.c +0
-0@@ -133,6 +189,14 @@ static int rk3288_vpu_hw_init(struct hantro_dev *vpu) return 0; }drivers/staging/media/hantro/rk3288_vpu_hw.c +8
-0+static void rk3066_vpu_dec_reset (struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + + vdpu_write(vpu, G1_REG_INTERRUPT_DEC_IRQ_DIS, G1_REG_INTERRUPT); + vdpu_write(vpu, G1_REG_CONFIG_DEC_CLK_GATE_E, G1_REG_CONFIG); +} +static void
rk3288_vpu_enc_reset(struct hantro_ctx *ctx){
structhantro_dev*vpu =ctx->dev;drivers/staging/media/hantro/rk3288_vpu_hw.c +27
-0@@ -145,6 +209,33 @@ static void rk3288_vpu_enc_reset(struct hantro_ctx *ctx) /** Supported codec ops. */ +static const struct hantro_codec_ops rk3066_vpu_codec_ops[] = { + [HANTRO_MODE_JPEG_ENC] = { + .run = hantro_h1_jpeg_enc_run, + .reset = rk3288_vpu_enc_reset, + .init = hantro_jpeg_enc_init, + .done = hantro_jpeg_enc_done, + .exit = hantro_jpeg_enc_exit, + }, + [HANTRO_MODE_H264_DEC] = { + .run = hantro_g1_h264_dec_run, + .reset = rk3066_vpu_dec_reset, + .init = hantro_h264_dec_init, + .exit = hantro_h264_dec_exit, + }, + [HANTRO_MODE_MPEG2_DEC] = { + .run = hantro_g1_mpeg2_dec_run, + .reset = rk3066_vpu_dec_reset, + .init = hantro_mpeg2_dec_init, + .exit = hantro_mpeg2_dec_exit, + }, + [HANTRO_MODE_VP8_DEC] = { + .run = hantro_g1_vp8_dec_run, + .reset = rk3066_vpu_dec_reset, + .init = hantro_vp8_dec_init, + .exit = hantro_vp8_dec_exit, + }, +};
static const structhantro_codec_opsrk3288_vpu_codec_ops[] = { [HANTRO_MODE_JPEG_ENC] = {drivers/staging/media/hantro/rk3288_vpu_hw.c +0
-0@@ -183,10 +274,35 @@ static const struct hantro_irq rk3288_irqs[] = { { "vdpu", hantro_g1_irq }, };drivers/staging/media/hantro/rk3288_vpu_hw.c +5
-0+static const char *const rk3066_clk_names[] = { + "aclk_vdpu", "hclk_vdpu", + "aclk_vepu", "hclk_vepu" +}; +static const char * const rk3288_clk_names[] = {
Quoted 8 lines
"aclk", "hclk"
};
+const structhantro_variantrk3066_vpu_variant= { + .enc_offset =0x0,
+ .enc_fmts =rk3288_vpu_enc_fmts,
+ .num_enc_fmts =ARRAY_SIZE(rk3288_vpu_enc_fmts), + .dec_offset =0x400,Having decoder and encoder supported by a single devicetree node was done for RK3288 to cope with some bug in the hardware that was effectively linking the decoder and the encoder.
Quoted 7 lines
AFAIK, Rockchip has fixed this, so unless there's a strong need, I prefer we keep them separated, with one DT node for the g1 decoder and one for the h1 encoder.
Thanks!
EzequielI just checked it: despite it looks like we could use the decoder and encoder separately
Quoted 7 lines
(separate clocks for decoder / encoder) the VPU block won't work (SoC crashes),
if not all 4 clocks are enabled for neither decoding nor encoding.
I'd prefer the other way also, but it seems not possible.
That's really useful, so it seems it's safer to represent this in a single node, given there's at least some degree of sharing going on, which the VPU Combo naming suggests anyways :)
Could you add a comment in the code about this clock requirement?
Also, does it make sense to merge rk3288_vpu_hw.c and rk3399_vpu_hw.c as just rockchip_vpu_hw.c?
Thanks!
Ezequiel
PATCH 5/10 media: hantro: add support for Rockchip RK3036
In reply to Alex BeeRK3036's VPU IP block is the same as RK3288 has, except that it doesn't have an encoder, decoding is supported up to 1920x1088 only and the axi clock can be set to 300 MHz max.
Add a new RK3036 variant which reflect this differences.
--- drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 + drivers/staging/media/hantro/rk3288_vpu_hw.c | 49 ++++++++++++++++++++ 3 files changed, 51 insertions(+)
drivers/staging/media/hantro/hantro_drv.c +1 -0
@@ -490,6 +490,7 @@ static const struct of_device_id of_hantro_match[] = { { .compatible = "rockchip,rk3328-vpu", .data = &rk3328_vpu_variant, }, { .compatible = "rockchip,rk3288-vpu", .data = &rk3288_vpu_variant, }, { .compatible = "rockchip,rk3066-vpu", .data = &rk3066_vpu_variant, }, + { .compatible = "rockchip,rk3036-vpu", .data = &rk3036_vpu_variant, }, #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },
drivers/staging/media/hantro/hantro_hw.h +1 -0
@@ -164,6 +164,7 @@ extern const struct hantro_variant rk3399_vpu_variant;extern const struct hantro_variant rk3328_vpu_variant;extern const struct hantro_variant rk3288_vpu_variant;extern const struct hantro_variant rk3066_vpu_variant; +extern const struct hantro_variant rk3036_vpu_variant;extern const struct hantro_variant imx8mq_vpu_variant;extern const struct hantro_variant sama5d4_vdec_variant;
drivers/staging/media/hantro/rk3288_vpu_hw.c +49 -0
73 lines not on this page · raw message
Signature · 1 line
2.27.0
Re: [PATCH 05/10] media: hantro: add support for Rockchip RK3036
Hi Alex,
Thanks a lot for the patch.
Quoted 95 lines · Alex Bee
RK3036's VPU IP block is the same as RK3288 has, except that it doesn't have an encoder, decoding is supported up to 1920x1088 only and the axi clock can be set to 300 MHz max.
Add a new RK3036 variant which reflect this differences.
Signed-off-by Alex Bee <[email protected]>---
drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 +drivers/staging/media/hantro/rk3288_vpu_hw.c| 49 ++++++++++++++++++++3 files changed, 51 insertions(+)drivers/staging/media/hantro/hantro_drv.c +1
-0@@ -490,6 +490,7 @@ static const struct of_device_id of_hantro_match[] = { { .compatible = "rockchip,rk3328-vpu", .data = &rk3328_vpu_variant, }, { .compatible = "rockchip,rk3288-vpu", .data = &rk3288_vpu_variant, }, { .compatible = "rockchip,rk3066-vpu", .data = &rk3066_vpu_variant, }, + { .compatible = "rockchip,rk3036-vpu", .data = &rk3036_vpu_variant, }, #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },drivers/staging/media/hantro/hantro_hw.h +1
-0@@ -164,6 +164,7 @@ extern const struct hantro_variant rk3399_vpu_variant; extern const struct hantro_variant rk3328_vpu_variant; extern const struct hantro_variant rk3288_vpu_variant; extern const struct hantro_variant rk3066_vpu_variant; +extern const struct hantro_variant rk3036_vpu_variant; extern const struct hantro_variant imx8mq_vpu_variant; extern const struct hantro_variant sama5d4_vdec_variant;drivers/staging/media/hantro/rk3288_vpu_hw.c +0
-0@@ -174,6 +174,13 @@ static irqreturn_t rk3288_vepu_irq(int irq, void *dev_id) return IRQ_HANDLED; }drivers/staging/media/hantro/rk3288_vpu_hw.c +7
-0+static int rk3036_vpu_hw_init (struct hantro_dev *vpu) +{ + /* Bump ACLKs to max. possible freq. to improve performance. */ + clk_set_rate(vpu->clocks[0].clk, RK3066_ACLK_MAX_FREQ); + return 0; +} +static int
rk3066_vpu_hw_init(struct hantro_dev *vpu)
{
/* Bump ACLKs to max. possible freq. to improve performance. */drivers/staging/media/hantro/rk3288_vpu_hw.c +21
-0@@ -209,6 +216,27 @@ static void rk3288_vpu_enc_reset(struct hantro_ctx *ctx) /** Supported codec ops. */ +static const struct hantro_codec_ops rk3036_vpu_codec_ops[] = { + [HANTRO_MODE_H264_DEC] = { + .run = hantro_g1_h264_dec_run, + .reset = hantro_g1_reset, + .init = hantro_h264_dec_init, + .exit = hantro_h264_dec_exit, + }, + [HANTRO_MODE_MPEG2_DEC] = { + .run = hantro_g1_mpeg2_dec_run, + .reset = hantro_g1_reset, + .init = hantro_mpeg2_dec_init, + .exit = hantro_mpeg2_dec_exit, + }, + [HANTRO_MODE_VP8_DEC] = { + .run = hantro_g1_vp8_dec_run, + .reset = hantro_g1_reset, + .init = hantro_vp8_dec_init, + .exit = hantro_vp8_dec_exit, + }, +}; + static const struct hantro_codec_ops rk3066_vpu_codec_ops[] = { [HANTRO_MODE_JPEG_ENC] = { .run = hantro_h1_jpeg_enc_run,@@ -269,6 +297,10 @@ static const struct hantro_codec_ops rk3288_vpu_codec_ops[] = {* VPU variant. */ drivers/staging/media/hantro/rk3288_vpu_hw.c +4
-0+static const struct hantro_irq rk3036_irqs[] = { + { "vdpu", hantro_g1_irq }, +}; +static const struct
hantro_irqrk3288_irqs[] = {
{ "vepu",rk3288_vepu_irq},
{ "vdpu",hantro_g1_irq},drivers/staging/media/hantro/rk3288_vpu_hw.c +0
-0@@ -283,6 +315,23 @@ static const char * const rk3288_clk_names[] = {
Quoted 5 lines
"aclk", "hclk"
};
+const structhantro_variantrk3036_vpu_variant= { + .dec_offset =0x400,
If it doesn't have an encoder, then you should just use dec_offset = 0x0.
Thanks,
Ezequiel
Re: [PATCH 05/10] media: hantro: add support for Rockchip RK3036
Hi Ezequiel,
Am 26.05.21 um 12:28 schrieb Ezequiel Garcia:
Quoted 103 lines
Hi Alex,
Thanks a lot for the patch.
Quoted 98 lines · Alex Bee
RK3036's VPU IP block is the same as RK3288 has, except that it doesn't have an encoder, decoding is supported up to 1920x1088 only and the axi clock can be set to 300 MHz max.
Add a new RK3036 variant which reflect this differences.
Signed-off-by Alex Bee <[email protected]>--- drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 + drivers/staging/media/hantro/rk3288_vpu_hw.c | 49 ++++++++++++++++++++ 3 files changed, 51 insertions(+)drivers/staging/media/hantro/hantro_drv.c +1
-0@@ -490,6 +490,7 @@ static const struct of_device_id of_hantro_match[] = { { .compatible = "rockchip,rk3328-vpu", .data = &rk3328_vpu_variant, }, { .compatible = "rockchip,rk3288-vpu", .data = &rk3288_vpu_variant, }, { .compatible = "rockchip,rk3066-vpu", .data = &rk3066_vpu_variant, }, + { .compatible = "rockchip,rk3036-vpu", .data = &rk3036_vpu_variant, }, #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },drivers/staging/media/hantro/hantro_hw.h +1
-0@@ -164,6 +164,7 @@ extern const struct hantro_variant rk3399_vpu_variant; extern const struct hantro_variant rk3328_vpu_variant; extern const struct hantro_variant rk3288_vpu_variant; extern const struct hantro_variant rk3066_vpu_variant; +extern const struct hantro_variant rk3036_vpu_variant; extern const struct hantro_variant imx8mq_vpu_variant; extern const struct hantro_variant sama5d4_vdec_variant;drivers/staging/media/hantro/rk3288_vpu_hw.c +32
-0@@ -174,6 +174,13 @@ static irqreturn_t rk3288_vepu_irq(int irq, void *dev_id) return IRQ_HANDLED; } +static int rk3036_vpu_hw_init (struct hantro_dev *vpu) +{ + /* Bump ACLKs to max. possible freq. to improve performance. */ + clk_set_rate(vpu->clocks[0].clk, RK3066_ACLK_MAX_FREQ); + return 0; +} + static int rk3066_vpu_hw_init(struct hantro_dev *vpu) { /* Bump ACLKs to max. possible freq. to improve performance. */@@ -209,6 +216,27 @@ static void rk3288_vpu_enc_reset(struct hantro_ctx *ctx) /** Supported codec ops. */ +static const struct hantro_codec_ops rk3036_vpu_codec_ops[] = { + [HANTRO_MODE_H264_DEC] = { + .run = hantro_g1_h264_dec_run, + .reset = hantro_g1_reset, + .init = hantro_h264_dec_init, + .exit = hantro_h264_dec_exit, + }, + [HANTRO_MODE_MPEG2_DEC] = { + .run = hantro_g1_mpeg2_dec_run, + .reset = hantro_g1_reset, + .init = hantro_mpeg2_dec_init, + .exit = hantro_mpeg2_dec_exit, + }, + [HANTRO_MODE_VP8_DEC] = { + .run = hantro_g1_vp8_dec_run, + .reset = hantro_g1_reset, + .init = hantro_vp8_dec_init, + .exit = hantro_vp8_dec_exit, + }, +}; + static const struct hantro_codec_ops rk3066_vpu_codec_ops[] = { [HANTRO_MODE_JPEG_ENC] = { .run = hantro_h1_jpeg_enc_run,@@ -269,6 +297,10 @@ static const struct hantro_codec_ops rk3288_vpu_codec_ops[] = {* VPU variant. */ +static const struct hantro_irq rk3036_irqs[] = { + { "vdpu", hantro_g1_irq }, +}; + static const struct hantro_irq rk3288_irqs[] = { { "vepu", rk3288_vepu_irq }, { "vdpu", hantro_g1_irq },@@ -283,6 +315,23 @@ static const char * const rk3288_clk_names[] = { "aclk", "hclk" };
Quoted 8 lines
drivers/staging/media/hantro/rk3288_vpu_hw.c static const char * const rk3288_clk_names[] = { · line 319
Quoted 2 lines
drivers/staging/media/hantro/rk3288_vpu_hw.c +2
-0+const struct hantro_variant rk3036_vpu_variant = { + .dec_offset = 0x400,If it doesn't have an encoder, then you should just use
dec_offset=0x0.Thanks,
Ezequiel
That would mean, I'd have to adapt the register offset in the device tree - I'd prefer to keep it in line with the TRM. Unless you insist, I'd like to keep it this way (It's , btw, the very same for RK3328).
Alex
Heiko Stübner
maintainerRe: [PATCH 05/10] media: hantro: add support for Rockchip RK3036
Am Donnerstag, 27. Mai 2021, 01:27:59 CEST schrieb Alex Bee:
Quoted 111 lines
Hi Ezequiel,
Am 26.05.21 um 12:28 schrieb Ezequiel Garcia:
Quoted 108 lines
Hi Alex,
Thanks a lot for the patch.
Quoted 95 lines · Alex Bee
RK3036's VPU IP block is the same as RK3288 has, except that it doesn't have an encoder, decoding is supported up to 1920x1088 only and the axi clock can be set to 300 MHz max.
Add a new RK3036 variant which reflect this differences.
Signed-off-by Alex Bee <[email protected]>--- drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 + drivers/staging/media/hantro/rk3288_vpu_hw.c | 49 ++++++++++++++++++++ 3 files changed, 51 insertions(+)drivers/staging/media/hantro/hantro_drv.c +1
-0@@ -490,6 +490,7 @@ static const struct of_device_id of_hantro_match[] = { { .compatible = "rockchip,rk3328-vpu", .data = &rk3328_vpu_variant, }, { .compatible = "rockchip,rk3288-vpu", .data = &rk3288_vpu_variant, }, { .compatible = "rockchip,rk3066-vpu", .data = &rk3066_vpu_variant, }, + { .compatible = "rockchip,rk3036-vpu", .data = &rk3036_vpu_variant, }, #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },drivers/staging/media/hantro/hantro_hw.h +1
-0@@ -164,6 +164,7 @@ extern const struct hantro_variant rk3399_vpu_variant;extern const struct hantro_variant rk3328_vpu_variant;extern const struct hantro_variant rk3288_vpu_variant;extern const struct hantro_variant rk3066_vpu_variant; +extern const struct hantro_variant rk3036_vpu_variant;extern const struct hantro_variant imx8mq_vpu_variant;extern const struct hantro_variant sama5d4_vdec_variant;drivers/staging/media/hantro/rk3288_vpu_hw.c +32
-0@@ -174,6 +174,13 @@ static irqreturn_t rk3288_vepu_irq(int irq, void *dev_id)return IRQ_HANDLED ; } +static int rk3036_vpu_hw_init (struct hantro_dev *vpu) +{ +/* Bump ACLKs to max. possible freq. to improve performance. */ +clk_set_rate (vpu->clocks[0 ].clk,RK3066_ACLK_MAX_FREQ ); +return 0 ; +} +static int rk3066_vpu_hw_init (struct hantro_dev *vpu) {/* Bump ACLKs to max. possible freq. to improve performance. */ @@ -209,6 +216,27 @@ static void rk3288_vpu_enc_reset(struct hantro_ctx *ctx)/* * Supported codec ops. */ +static const struct hantro_codec_ops rk3036_vpu_codec_ops[] = { + [HANTRO_MODE_H264_DEC ] = { + .run = hantro_g1_h264_dec_run, + .reset = hantro_g1_reset, + .init = hantro_h264_dec_init, + .exit = hantro_h264_dec_exit, + }, + [HANTRO_MODE_MPEG2_DEC ] = { + .run = hantro_g1_mpeg2_dec_run, + .reset = hantro_g1_reset, + .init = hantro_mpeg2_dec_init, + .exit = hantro_mpeg2_dec_exit, + }, + [HANTRO_MODE_VP8_DEC ] = { + .run = hantro_g1_vp8_dec_run, + .reset = hantro_g1_reset, + .init = hantro_vp8_dec_init, + .exit = hantro_vp8_dec_exit, + }, +}; +static const struct hantro_codec_ops rk3066_vpu_codec_ops[] = { [HANTRO_MODE_JPEG_ENC ] = { .run = hantro_h1_jpeg_enc_run,@@ -269,6 +297,10 @@ static const struct hantro_codec_ops rk3288_vpu_codec_ops[] = {* VPU variant. */ +static const struct hantro_irq rk3036_irqs[] = { + {"vdpu" , hantro_g1_irq }, +}; +static const struct hantro_irq rk3288_irqs[] = { {"vepu" , rk3288_vepu_irq }, {"vdpu" , hantro_g1_irq },drivers/staging/media/hantro/rk3288_vpu_hw.c static const char * const rk3288_clk_names[] = { · line 319
Quoted 5 lines
drivers/staging/media/hantro/rk3288_vpu_hw.c +2
-0@@ -283,6 +315,23 @@ static const char * const rk3288_clk_names[] = {"aclk" ,"hclk" }; +const struct hantro_variant rk3036_vpu_variant = { + .dec_offset = 0x400,If it doesn't have an encoder, then you should just use
dec_offset=0x0.
Quoted 6 lines
Quoted 3 lines
Thanks,
EzequielThat would mean, I'd have to adapt the register offset in the device tree - I'd prefer to keep it in line with the TRM. Unless you insist, I'd like to keep it this way (It's , btw, the very same for RK3328).
I'd agree with Alex ... ideally the devicetree should match the block register area from the TRM not some internal offset.
[DT describes hardware etc etc ;-) ]
Heiko
Re: [PATCH 05/10] media: hantro: add support for Rockchip RK3036
Quoted 115 lines · Heiko Stübner
Am Donnerstag, 27. Mai 2021, 01:27:59 CEST schrieb Alex Bee:
Quoted 114 lines
Hi Ezequiel,
Am 26.05.21 um 12:28 schrieb Ezequiel Garcia:
Quoted 111 lines
Hi Alex,
Thanks a lot for the patch.
Quoted 95 lines · Alex Bee
RK3036's VPU IP block is the same as RK3288 has, except that it doesn't have an encoder, decoding is supported up to 1920x1088 only and the axi clock can be set to 300 MHz max.
Add a new RK3036 variant which reflect this differences.
Signed-off-by Alex Bee <[email protected]>---
drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 +drivers/staging/media/hantro/rk3288_vpu_hw.c| 49 ++++++++++++++++++++3 files changed, 51 insertions(+)drivers/staging/media/hantro/hantro_drv.c +1
-0@@ -490,6 +490,7 @@ static const struct of_device_id of_hantro_match[] = { { .compatible = "rockchip,rk3328-vpu", .data = &rk3328_vpu_variant, }, { .compatible = "rockchip,rk3288-vpu", .data = &rk3288_vpu_variant, }, { .compatible = "rockchip,rk3066-vpu", .data = &rk3066_vpu_variant, }, + { .compatible = "rockchip,rk3036-vpu", .data = &rk3036_vpu_variant, }, #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },drivers/staging/media/hantro/hantro_hw.h +1
-0@@ -164,6 +164,7 @@ extern const struct hantro_variant rk3399_vpu_variant; extern const struct hantro_variant rk3328_vpu_variant; extern const struct hantro_variant rk3288_vpu_variant; extern const struct hantro_variant rk3066_vpu_variant; +extern const struct hantro_variant rk3036_vpu_variant; extern const struct hantro_variant imx8mq_vpu_variant; extern const struct hantro_variant sama5d4_vdec_variant;drivers/staging/media/hantro/rk3288_vpu_hw.c +0
-0@@ -174,6 +174,13 @@ static irqreturn_t rk3288_vepu_irq(int irq, void *dev_id) return IRQ_HANDLED; }drivers/staging/media/hantro/rk3288_vpu_hw.c +7
-0+static int rk3036_vpu_hw_init (struct hantro_dev *vpu) +{ + /* Bump ACLKs to max. possible freq. to improve performance. */ + clk_set_rate(vpu->clocks[0].clk, RK3066_ACLK_MAX_FREQ); + return 0; +} +static int
rk3066_vpu_hw_init(struct hantro_dev *vpu)
{
/* Bump ACLKs to max. possible freq. to improve performance. */drivers/staging/media/hantro/rk3288_vpu_hw.c +21
-0@@ -209,6 +216,27 @@ static void rk3288_vpu_enc_reset(struct hantro_ctx *ctx) /** Supported codec ops. */ +static const struct hantro_codec_ops rk3036_vpu_codec_ops[] = { + [HANTRO_MODE_H264_DEC] = { + .run = hantro_g1_h264_dec_run, + .reset = hantro_g1_reset, + .init = hantro_h264_dec_init, + .exit = hantro_h264_dec_exit, + }, + [HANTRO_MODE_MPEG2_DEC] = { + .run = hantro_g1_mpeg2_dec_run, + .reset = hantro_g1_reset, + .init = hantro_mpeg2_dec_init, + .exit = hantro_mpeg2_dec_exit, + }, + [HANTRO_MODE_VP8_DEC] = { + .run = hantro_g1_vp8_dec_run, + .reset = hantro_g1_reset, + .init = hantro_vp8_dec_init, + .exit = hantro_vp8_dec_exit, + }, +}; + static const struct hantro_codec_ops rk3066_vpu_codec_ops[] = { [HANTRO_MODE_JPEG_ENC] = { .run = hantro_h1_jpeg_enc_run,@@ -269,6 +297,10 @@ static const struct hantro_codec_ops rk3288_vpu_codec_ops[] = {* VPU variant. */ drivers/staging/media/hantro/rk3288_vpu_hw.c +4
-0+static const struct hantro_irq rk3036_irqs[] = { + { "vdpu", hantro_g1_irq }, +}; +static const struct
hantro_irqrk3288_irqs[] = { { "vepu",rk3288_vepu_irq},
{ "vdpu",hantro_g1_irq},drivers/staging/media/hantro/rk3288_vpu_hw.c +0
-0@@ -283,6 +315,23 @@ static const char * const rk3288_clk_names[] = {Quoted 5 lines
"aclk", "hclk"
};
+const structhantro_variantrk3036_vpu_variant= { + .dec_offset =0x400,If it doesn't have an encoder, then you should just use
dec_offset=0x0.Thanks,
Ezequiel
Quoted 8 lines
Quoted 3 lines
That would mean, I'd have to adapt the register offset in the device tree - I'd prefer to keep it in line with the TRM. Unless you insist, I'd like to keep it this way (It's , btw, the very same for RK3328).
I'd agree with Alex ... ideally the devicetree should match the block register area from the TRM not some internal offset.
[DT describes hardware etc etc ;-) ]
Well, I've always considered this internal offset as something unfortunate we didn't do well when we upstreamed RK3288.
The RK3288 TRM documents a so-called "VPU combo", and then documents the encoder and the decoder cores as separate engines, with separate register blocks (called VEPU and VDPU). In fact, for each register block you'll see swreg0 documented at offset 0x0.
(In some integrations they can operate independently, but iirc not in RK3288.)
So to be clear, instead of:
vpu: video-codec@ff9a0000 {
compatible = "rockchip,rk3288-vpu";
reg = <0x0 0xff9a0000 0x0 0x800>;
interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "vepu", "vdpu";
clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>;
clock-names = "aclk", "hclk";
...It could have looked like:
vpu: video-codec@ff9a0000 {
compatible = "rockchip,rk3288-vpu";
reg = <0x0 0xff9a0000 0x0 0x400>
<0x0 0xff9a0400 0x0 0x400>;
...I guess I missed this when RK3328 was pushed, but OTOH I don't see any real impact in doing things this way. So at the end of the day, I'm fine either way.
BTW, the series is not adding the vpu node for arch/arm/boot/dts/rk3036.dtsi right?
Thanks a lot!
Ezequiel
Re: [PATCH 05/10] media: hantro: add support for Rockchip RK3036
Hi Ezequiel,
Am 27.05.21 um 03:27 schrieb Ezequiel Garcia:
Quoted 123 lines · Heiko Stübner
Quoted 115 lines
Am Donnerstag, 27. Mai 2021, 01:27:59 CEST schrieb Alex Bee:
Quoted 114 lines
Hi Ezequiel,
Am 26.05.21 um 12:28 schrieb Ezequiel Garcia:
Quoted 111 lines
Hi Alex,
Thanks a lot for the patch.
Quoted 95 lines · Alex Bee
RK3036's VPU IP block is the same as RK3288 has, except that it doesn't have an encoder, decoding is supported up to 1920x1088 only and the axi clock can be set to 300 MHz max.
Add a new RK3036 variant which reflect this differences.
Signed-off-by Alex Bee <[email protected]>--- drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 + drivers/staging/media/hantro/rk3288_vpu_hw.c | 49 ++++++++++++++++++++ 3 files changed, 51 insertions(+)drivers/staging/media/hantro/hantro_drv.c +1
-0@@ -490,6 +490,7 @@ static const struct of_device_id of_hantro_match[] = { { .compatible = "rockchip,rk3328-vpu", .data = &rk3328_vpu_variant, }, { .compatible = "rockchip,rk3288-vpu", .data = &rk3288_vpu_variant, }, { .compatible = "rockchip,rk3066-vpu", .data = &rk3066_vpu_variant, }, + { .compatible = "rockchip,rk3036-vpu", .data = &rk3036_vpu_variant, }, #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },drivers/staging/media/hantro/hantro_hw.h +1
-0@@ -164,6 +164,7 @@ extern const struct hantro_variant rk3399_vpu_variant; extern const struct hantro_variant rk3328_vpu_variant; extern const struct hantro_variant rk3288_vpu_variant; extern const struct hantro_variant rk3066_vpu_variant; +extern const struct hantro_variant rk3036_vpu_variant; extern const struct hantro_variant imx8mq_vpu_variant; extern const struct hantro_variant sama5d4_vdec_variant;drivers/staging/media/hantro/rk3288_vpu_hw.c +32
-0@@ -174,6 +174,13 @@ static irqreturn_t rk3288_vepu_irq(int irq, void *dev_id) return IRQ_HANDLED; } +static int rk3036_vpu_hw_init (struct hantro_dev *vpu) +{ + /* Bump ACLKs to max. possible freq. to improve performance. */ + clk_set_rate(vpu->clocks[0].clk, RK3066_ACLK_MAX_FREQ); + return 0; +} + static int rk3066_vpu_hw_init(struct hantro_dev *vpu) { /* Bump ACLKs to max. possible freq. to improve performance. */@@ -209,6 +216,27 @@ static void rk3288_vpu_enc_reset(struct hantro_ctx *ctx) /** Supported codec ops. */ +static const struct hantro_codec_ops rk3036_vpu_codec_ops[] = { + [HANTRO_MODE_H264_DEC] = { + .run = hantro_g1_h264_dec_run, + .reset = hantro_g1_reset, + .init = hantro_h264_dec_init, + .exit = hantro_h264_dec_exit, + }, + [HANTRO_MODE_MPEG2_DEC] = { + .run = hantro_g1_mpeg2_dec_run, + .reset = hantro_g1_reset, + .init = hantro_mpeg2_dec_init, + .exit = hantro_mpeg2_dec_exit, + }, + [HANTRO_MODE_VP8_DEC] = { + .run = hantro_g1_vp8_dec_run, + .reset = hantro_g1_reset, + .init = hantro_vp8_dec_init, + .exit = hantro_vp8_dec_exit, + }, +}; + static const struct hantro_codec_ops rk3066_vpu_codec_ops[] = { [HANTRO_MODE_JPEG_ENC] = { .run = hantro_h1_jpeg_enc_run,@@ -269,6 +297,10 @@ static const struct hantro_codec_ops rk3288_vpu_codec_ops[] = {* VPU variant. */ +static const struct hantro_irq rk3036_irqs[] = { + { "vdpu", hantro_g1_irq }, +}; + static const struct hantro_irq rk3288_irqs[] = { { "vepu", rk3288_vepu_irq }, { "vdpu", hantro_g1_irq },drivers/staging/media/hantro/rk3288_vpu_hw.c static const char * const rk3288_clk_names[] = { · line 319
Quoted 5 lines
drivers/staging/media/hantro/rk3288_vpu_hw.c +2
-0@@ -283,6 +315,23 @@ static const char * const rk3288_clk_names[] = { "aclk", "hclk" }; +const struct hantro_variant rk3036_vpu_variant = { + .dec_offset = 0x400,If it doesn't have an encoder, then you should just use
dec_offset=0x0.Thanks,
EzequielQuoted 7 lines
Quoted 3 lines
That would mean, I'd have to adapt the register offset in the device tree - I'd prefer to keep it in line with the TRM. Unless you insist, I'd like to keep it this way (It's , btw, the very same for RK3328).
I'd agree with Alex ... ideally the devicetree should match the block register area from the TRM not some internal offset.
[DT describes hardware etc etc ;-) ]
Quoted 7 lines
Well, I've always considered this internal offset as something unfortunate we didn't do well when we upstreamed RK3288.
The RK3288 TRM documents a so-called "VPU combo", and then documents the encoder and the decoder cores as separate engines, with separate register blocks (called VEPU and VDPU). In fact, for each register block you'll see swreg0 documented at offset
0x0.
I've always looked at the "Address Mapping" section in the TRMs when I checked the register offsets. I can't find a seperation the vpu block there (for any SoC).
I've found it more unfortunate, that they started with register offset 0x0 for vdpu and vepu, since none of the SoCs (so far) can use the blocks separately.
Quoted 22 lines
(In some integrations they can operate independently, but iirc not in RK3288.)
So to be clear, instead of:
vpu: video-codec@ff9a0000 { compatible = "rockchip,rk3288-vpu"; reg = <0x0 0xff9a0000 0x0 0x800>; interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "vepu", "vdpu"; clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>; clock-names = "aclk", "hclk"; ...It could have looked like:
vpu: video-codec@ff9a0000 { compatible = "rockchip,rk3288-vpu"; reg = <0x0 0xff9a0000 0x0 0x400> <0x0 0xff9a0400 0x0 0x400>; ...
Quoted 5 lines
I guess I missed this when RK3328 was pushed, but OTOH I don't see any real impact in doing things this way. So at the end of the day, I'm fine either way.
BTW, the series is not adding the vpu node for
arch/arm/boot/dts/rk3036.dtsiright?
Ups, yes - I missed to submit this patch with v1 - I added it in its original version to v2 (so we know, what we are talking about)-
If you think it should be changed, please reply to v2.
Quoted 3 lines
Thanks a lot!
Ezequiel
Thanks,
Alex
PATCH 6/10 ARM: dts: rockchip: add vpu nodes for RK3066 and RK3188
In reply to Alex BeeAdd the vpu node to the common rk3xxx.dtsi and only the powerdomain property to the SoC specific device trees.
--- arch/arm/boot/dts/rk3066a.dtsi | 4 ++++ arch/arm/boot/dts/rk3188.dtsi | 5 +++++ arch/arm/boot/dts/rk3xxx.dtsi | 12 ++++++++++++ 3 files changed, 21 insertions(+)
arch/arm/boot/dts/rk3066a.dtsi +4 -0
@@ -869,6 +869,10 @@ &uart3 { pinctrl-0 = <&uart3_xfer>; }; +&vpu { + power-domains = <&power RK3066_PD_VIDEO>; +}; + &wdt { compatible = "rockchip,rk3066-wdt", "snps,dw-wdt"; };
arch/arm/boot/dts/rk3188.dtsi +5 -0
@@ -802,6 +802,11 @@ &uart3 { pinctrl-0 = <&uart3_xfer>; }; +&vpu { + compatible = "rockchip,rk3188-vpu", "rockchip,rk3066-vpu"; + power-domains = <&power RK3188_PD_VIDEO>; +}; + &wdt { compatible = "rockchip,rk3188-wdt", "snps,dw-wdt"; };
arch/arm/boot/dts/rk3xxx.dtsi +12 -0
@@ -50,6 +50,18 @@ gpu: gpu@10090000 { status = "disabled"; }; + vpu: video-codec@10104000 { + compatible = "rockchip,rk3066-vpu"; + reg = <0x10104000 0x800>; + interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "vepu", "vdpu"; + clocks = <&cru ACLK_VDPU>, <&cru HCLK_VDPU>, + <&cru ACLK_VEPU>, <&cru HCLK_VEPU>; + clock-names = "aclk_vdpu", "hclk_vdpu", + "aclk_vepu", "hclk_vepu"; + }; + L2: cache-controller@10138000 { compatible = "arm,pl310-cache"; reg = <0x10138000 0x1000>;
Signature · 1 line
2.27.0
PATCH 7/10 ARM: dts: rockchip: add vpu node for RK322x
In reply to Alex BeeThe VPU IP block of RK322x is the same as RK3399 has and the driver can be used as-is.
Add the respective nodes to the device tree.
--- arch/arm/boot/dts/rk322x.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm/boot/dts/rk322x.dtsi +12 -1
@@ -611,6 +611,18 @@ gpu: gpu@20000000 { status = "disabled"; }; + vpu: video-codec@20020000 { + compatible = "rockchip,rk3228-vpu", "rockchip,rk3399-vpu"; + reg = <0x20020000 0x800>; + interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "vepu", "vdpu"; + clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>; + clock-names = "aclk", "hclk"; + power-domains = <&power RK3228_PD_VPU>; + iommus = <&vpu_mmu>; + }; + vpu_mmu: iommu@20020800 { compatible = "rockchip,iommu"; reg = <0x20020800 0x100>;
@@ -619,7 +631,6 @@ vpu_mmu: iommu@20020800 { clock-names = "aclk", "iface"; power-domains = <&power RK3228_PD_VPU>; #iommu-cells = <0>; - status = "disabled"; }; vdec_mmu: iommu@20030480 {
Signature · 1 line
2.27.0
Heiko Stübner
maintainerRe: [PATCH 07/10] ARM: dts: rockchip: add vpu node for RK322x
Am Dienstag, 25. Mai 2021, 17:22:22 CEST schrieb Alex Bee:
Quoted 18 lines
The VPU IP block of RK322x is the same as RK3399 has and the driver can be used as-is.
Add the respective nodes to the device tree.
Signed-off-by Alex Bee <[email protected]>--- arch/arm/boot/dts/rk322x.dtsi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm/boot/dts/rk322x.dtsi +0
-0@@ -611,6 +611,18 @@ gpu: gpu@20000000 { status = "disabled"; };
arch/arm/boot/dts/rk322x.dtsi gpu: gpu@20000000 { · line 623
Quoted 10 lines
arch/arm/boot/dts/rk322x.dtsi +10
-0+ vpu: video-codec@20020000 { + compatible = "rockchip,rk3228-vpu", "rockchip,rk3399-vpu"; + reg = <0x20020000 0x800>; + interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "vepu", "vdpu"; + clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>; + clock-names = "aclk", "hclk"; + power-domains = <&power RK3228_PD_VPU>; + iommus = <&vpu_mmu>;
NIT: [if you need to resend for other reasons] iommus before power-domains please
Quoted 14 lines
arch/arm/boot/dts/rk322x.dtsi +2
-1+ }; + vpu_mmu: iommu@20020800 { compatible = "rockchip,iommu"; reg = <0x20020800 0x100>;@@ -619,7 +631,6 @@ vpu_mmu: iommu@20020800 { clock-names = "aclk", "iface"; power-domains = <&power RK3228_PD_VPU>; #iommu-cells = <0>; - status = "disabled"; }; vdec_mmu: iommu@20030480 {
PATCH 8/10 media: dt-bindings: media: rockchip-vpu: add new compatibles
In reply to Alex BeeAdd compatibles for RK3036, RK3066, RK3188 and RK3228. Also reflect the changes to the additional clocks for RK3066/RK3188.
Checked with:
make ARCH=arm dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-vpu.yaml
--- .../bindings/media/rockchip-vpu.yaml | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/media/rockchip-vpu.yaml +25 -8
@@ -15,10 +15,19 @@ description: properties: compatible: - enum: - - rockchip,rk3288-vpu - - rockchip,rk3328-vpu - - rockchip,rk3399-vpu + oneOf: + - enum: + - rockchip,rk3036-vpu + - rockchip,rk3066-vpu + - rockchip,rk3288-vpu + - rockchip,rk3328-vpu + - rockchip,rk3399-vpu + - items: + - const: rockchip,rk3228-vpu + - const: rockchip,rk3399-vpu + - items: + - const: rockchip,rk3188-vpu + - const: rockchip,rk3066-vpu reg: maxItems: 1
@@ -35,12 +44,20 @@ properties: - const: vdpu clocks: - maxItems: 2 + oneOf: + - maxItems: 2 + - maxItems: 4 clock-names: - items: - - const: aclk - - const: hclk + oneOf: + - items: + - const: aclk + - const: hclk + - items: + - const: aclk_vdpu + - const: hclk_vdpu + - const: aclk_vepu + - const: hclk_vepu power-domains: maxItems: 1
Signature · 1 line
2.27.0
Rob Herring
maintainerRe: [PATCH 08/10] media: dt-bindings: media: rockchip-vpu: add new compatibles
Quoted 12 lines · Alex Bee
Add compatibles for RK3036, RK3066, RK3188 and RK3228. Also reflect the changes to the additional clocks for RK3066/RK3188.
Checked with:
make ARCH=armdtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip-vpu.yamlSigned-off-by Alex Bee <[email protected]>--- .../bindings/media/rockchip-vpu.yaml | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-)
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:./Documentation/devicetree/bindings/media/rockchip-vpu.yaml:20:9: [warning] wrong indentation: expected 10 but found 8 (indentation) ./Documentation/devicetree/bindings/media/rockchip-vpu.yaml:26:9: [warning] wrong indentation: expected 10 but found 8 (indentation) ./Documentation/devicetree/bindings/media/rockchip-vpu.yaml:29:9: [warning] wrong indentation: expected 10 but found 8 (indentation) ./Documentation/devicetree/bindings/media/rockchip-vpu.yaml:54:9: [warning] wrong indentation: expected 10 but found 8 (indentation) ./Documentation/devicetree/bindings/media/rockchip-vpu.yaml:57:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
dtschema/dtc warnings/errors:
See https://patchwork.ozlabs.org/patch/1483524
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
PATCH 9/10 ARM: dts: rockchip: add vdec node for RK322x
In reply to Alex BeeThe vdec IP block of RK322x is the same as RK3399 has and the driver can be used as-is.
Add the respective node to the device tree.
Note: core and cabac clock need to be set to a specific rate which is done by using "assigned-clocks" / "assigned-clock-rates" properties (axi clock rate is currently set in the driver).
--- arch/arm/boot/dts/rk322x.dtsi | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
arch/arm/boot/dts/rk322x.dtsi +13 -1
@@ -633,6 +633,19 @@ vpu_mmu: iommu@20020800 { #iommu-cells = <0>; }; + vdec: video-codec@20030000 { + compatible = "rockchip,rk3228-vdec", "rockchip,rk3399-vdec"; + reg = <0x20030000 0x480>; + interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru ACLK_RKVDEC>, <&cru HCLK_RKVDEC>, + <&cru SCLK_VDEC_CABAC>, <&cru SCLK_VDEC_CORE>; + clock-names = "axi", "ahb", "cabac", "core"; + assigned-clocks = <&cru SCLK_VDEC_CABAC>, <&cru SCLK_VDEC_CORE>; + assigned-clock-rates = <300000000>, <300000000>; + power-domains = <&power RK3228_PD_RKVDEC>; + iommus = <&vdec_mmu>; + }; + vdec_mmu: iommu@20030480 { compatible = "rockchip,iommu"; reg = <0x20030480 0x40>, <0x200304c0 0x40>;
@@ -641,7 +654,6 @@ vdec_mmu: iommu@20030480 { clock-names = "aclk", "iface"; power-domains = <&power RK3228_PD_RKVDEC>; #iommu-cells = <0>; - status = "disabled"; }; vop: vop@20050000 {
Signature · 1 line
2.27.0
PATCH 10/10 media: dt-bindings: media: rockchip-vdec: add RK3228 compatible
In reply to Alex BeeDocument the RK3228 compatible for rockchip-vdec. Also add the optional assigned-clocks and assigned-clock-rates properties.
Checked with:
make ARCH=arm dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip,vdec.yaml
--- .../devicetree/bindings/media/rockchip,vdec.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/rockchip,vdec.yaml +9 -1
@@ -15,7 +15,11 @@ description: |- properties: compatible: - const: rockchip,rk3399-vdec + oneOf: + - const: rockchip,rk3399-vdec + - items: + - const: rockchip,rk3228-vdec + - const: rockchip,rk3399-vdec reg: maxItems: 1
@@ -37,6 +41,10 @@ properties: - const: cabac - const: core + assigned-clocks: true + + assigned-clock-rates: true + power-domains: maxItems: 1
Signature · 1 line
2.27.0
Rob Herring
maintainerRe: [PATCH 10/10] media: dt-bindings: media: rockchip-vdec: add RK3228 compatible
Quoted 4 lines · Alex Bee
Document the RK3228 compatible for rockchip-vdec. Also add the optional assigned-clocks and assigned-clock-rates properties.
Quoted 9 lines
Checked with:
make ARCH=armdtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/media/rockchip,vdec.yamlSigned-off-by Alex Bee <[email protected]>--- .../devicetree/bindings/media/rockchip,vdec.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:./Documentation/devicetree/bindings/media/rockchip,vdec.yaml:21:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
dtschema/dtc warnings/errors:
See https://patchwork.ozlabs.org/patch/1483527
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
Heiko Stübner
maintainerHi Alex,
Am Dienstag, 25. Mai 2021, 17:22:15 CEST schrieb Alex Bee:
Quoted 11 lines
Hi list,
this series adds support for older Rockchip SoCs (RK3036, RK3066, RK3188 and RK322x) to the existing V4L2 video decoder/-encoder drivers - namely hantro and rkvdec.
They can be used as-is or with very little modifications.In preparation to that patches 1-3 add power-controller support for RK3036 and RK322x, since both drivers rely on pm. The drivers for them exist already in the common Rockchip pm driver, they just haven't be added to the device trees yet.
on first glance, looks good. Just a small ordering nit, if you need to resend the series for other reasons:
Please try to order patches like:
(1) dt-binding - compatible addition
(2) driver patches
(3) devicetree node patches
That makes it way easier to keep track of dependencies when glancing at the series. Like for patches 1+2, I need to wait for Lee to apply (or Ack) the binding addition in patch 3.
Same for the hantro devicetree additions, that need to wait for both bindings (and driver) changes to get applied to the media tree.
Thanks
Heiko
Quoted 32 lines
Thanks for your feedback,
Alex.Alex Bee (10):
ARM: dts: rockchip: add power controller for RK322x
ARM: dts: rockchip: add power controller for RK3036
dt-bindings: mfd: syscon: add Rockchip RK3036/RK3228 qos compatibles
media: hantro: add support for Rockchip RK3066
media: hantro: add support for Rockchip RK3036
ARM: dts: rockchip: add vpu nodes for RK3066 and RK3188
ARM: dts: rockchip: add vpu node for RK322x
media: dt-bindings: media: rockchip-vpu: add new compatibles
ARM: dts: rockchip: add vdec node for RK322x
media: dt-bindings: media: rockchip-vdec: add RK3228 compatible.../bindings/media/rockchip,vdec.yaml | 10 +- .../bindings/media/rockchip-vpu.yaml | 33 +++- .../devicetree/bindings/mfd/syscon.yaml | 2 + arch/arm/boot/dts/rk3036.dtsi | 51 ++++++ arch/arm/boot/dts/rk3066a.dtsi | 4 + arch/arm/boot/dts/rk3188.dtsi | 5 + arch/arm/boot/dts/rk322x.dtsi | 139 ++++++++++++++- arch/arm/boot/dts/rk3xxx.dtsi | 12 ++ drivers/staging/media/hantro/hantro_drv.c | 2 + drivers/staging/media/hantro/hantro_hw.h | 2 + drivers/staging/media/hantro/rk3288_vpu_hw.c | 165 ++++++++++++++++++ 11 files changed, 414 insertions(+), 11 deletions(-)base-commit:
5d765451c2409e63563fa6a3e8005bd03ab9e82f
Hi Heiko, Ezequiel, Rob and List,
thanks for your feedback.
Am 26.05.21 um 01:01 schrieb Heiko Stübner:
Quoted 26 lines
Hi Alex,
Am Dienstag, 25. Mai 2021, 17:22:15 CEST schrieb Alex Bee:
Quoted 11 lines
Hi list,
this series adds support for older Rockchip SoCs (RK3036, RK3066, RK3188 and RK322x) to the existing V4L2 video decoder/-encoder drivers - namely hantro and rkvdec.
They can be used as-is or with very little modifications.In preparation to that patches 1-3 add power-controller support for RK3036 and RK322x, since both drivers rely on pm. The drivers for them exist already in the common Rockchip pm driver, they just haven't be added to the device trees yet.
on first glance, looks good. Just a small ordering nit, if you need to resend the series for other reasons:
Please try to order patches like:
(1) dt-binding - compatible addition
(2) driver patches
(3) devicetree node patchesThat makes it way easier to keep track of dependencies when glancing at the series. Like for patches 1+2, I need to wait for Lee to apply (or Ack) the binding addition in patch 3.
Quoted 41 lines
Same for the hantro devicetree additions, that need to wait for both bindings (and driver) changes to get applied to the media tree.
Thanks
HeikoQuoted 31 lines
Thanks for your feedback,
Alex.Alex Bee (10):
ARM: dts: rockchip: add power controller for RK322x
ARM: dts: rockchip: add power controller for RK3036
dt-bindings: mfd: syscon: add Rockchip RK3036/RK3228 qos compatibles
media: hantro: add support for Rockchip RK3066
media: hantro: add support for Rockchip RK3036
ARM: dts: rockchip: add vpu nodes for RK3066 and RK3188
ARM: dts: rockchip: add vpu node for RK322x
media: dt-bindings: media: rockchip-vpu: add new compatibles
ARM: dts: rockchip: add vdec node for RK322x
media: dt-bindings: media: rockchip-vdec: add RK3228 compatible.../bindings/media/rockchip,vdec.yaml | 10 +- .../bindings/media/rockchip-vpu.yaml | 33 +++- .../devicetree/bindings/mfd/syscon.yaml | 2 + arch/arm/boot/dts/rk3036.dtsi | 51 ++++++ arch/arm/boot/dts/rk3066a.dtsi | 4 + arch/arm/boot/dts/rk3188.dtsi | 5 + arch/arm/boot/dts/rk322x.dtsi | 139 ++++++++++++++- arch/arm/boot/dts/rk3xxx.dtsi | 12 ++ drivers/staging/media/hantro/hantro_drv.c | 2 + drivers/staging/media/hantro/hantro_hw.h | 2 + drivers/staging/media/hantro/rk3288_vpu_hw.c | 165 ++++++++++++++++++ 11 files changed, 414 insertions(+), 11 deletions(-)base-commit:
5d765451c2409e63563fa6a3e8005bd03ab9e82f
I'll address your comments in v2 - see individual patches for specific replies (if any).
Thanks,
Alex
v2 cover Add support for older Rockchip SoCs to V4L2 hantro and rkvdec drivers
In reply to Alex BeeHi list,
this series adds support for older Rockchip SoCs (RK3036, RK3066, RK3188 and RK322x) to the existing V4L2 video decoder/-encoder drivers - namely hantro and rkvdec.
They can be used as-is or with very little modifications.
In preparation to that patches 1,8 and 9 add power-controller support for RK3036 and RK322x, since both drivers rely on pm. The drivers for them exist already in the common Rockchip pm driver, they just haven't be added to the device trees yet.
Changes in v2:
- reordered patches as suggested by Heiko
- fixed indentation and order issues in dt-bindings / DT patches
- added patch to reorder variants in hantro alphanumeric
- added patch that merges hantro platform drivers for Rockchip in one
- added missing DT patch for RK3036 (missed to submit with v1) See individual patches for details about changes.
Thanks for your feedback,
Alex.
Alex Bee (12):
dt-bindings: mfd: syscon: add Rockchip RK3036/RK3228 qos compatibles
dt-bindings: media: rockchip-vpu: add new compatibles
dt-bindings: media: rockchip-vdec: add RK3228 compatible
media: hantro: reorder variants
media: hantro: merge Rockchip platform drivers
media: hantro: add support for Rockchip RK3066
media: hantro: add support for Rockchip RK3036
ARM: dts: rockchip: add power controller for RK3036
ARM: dts: rockchip: add power controller for RK322x
ARM: dts: rockchip: add vpu node for RK3036
ARM: dts: rockchip: add vpu nodes for RK3066 and RK3188
ARM: dts: rockchip: add vpu and vdec node for RK322x
.../bindings/media/rockchip,vdec.yaml | 10 +-
.../bindings/media/rockchip-vpu.yaml | 33 +-
.../devicetree/bindings/mfd/syscon.yaml | 2 +
arch/arm/boot/dts/rk3036.dtsi | 72 +++
arch/arm/boot/dts/rk3066a.dtsi | 4 +
arch/arm/boot/dts/rk3188.dtsi | 5 +
arch/arm/boot/dts/rk322x.dtsi | 140 ++++-
arch/arm/boot/dts/rk3xxx.dtsi | 12 +
drivers/staging/media/hantro/Makefile | 9 +-
drivers/staging/media/hantro/hantro_drv.c | 6 +-
drivers/staging/media/hantro/hantro_hw.h | 30 +-
drivers/staging/media/hantro/rk3288_vpu_hw.c | 208 -------
drivers/staging/media/hantro/rk3399_vpu_hw.c | 222 --------
...jpeg_enc.c => rockchip_vpu2_hw_jpeg_enc.c} | 30 +-
...eg2_dec.c => rockchip_vpu2_hw_mpeg2_dec.c} | 25 +-
...w_vp8_dec.c => rockchip_vpu2_hw_vp8_dec.c} | 2 +-
...rk3399_vpu_regs.h => rockchip_vpu2_regs.h} | 6 +-
.../staging/media/hantro/rockchip_vpu_hw.c | 526 ++++++++++++++++++
18 files changed, 848 insertions(+), 494 deletions(-)
delete mode 100644 drivers/staging/media/hantro/rk3288_vpu_hw.c
delete mode 100644 drivers/staging/media/hantro/rk3399_vpu_hw.c
rename drivers/staging/media/hantro/{rk3399_vpu_hw_jpeg_enc.c => rockchip_vpu2_hw_jpeg_enc.c} (87%)
rename drivers/staging/media/hantro/{rk3399_vpu_hw_mpeg2_dec.c => rockchip_vpu2_hw_mpeg2_dec.c} (93%)
rename drivers/staging/media/hantro/{rk3399_vpu_hw_vp8_dec.c => rockchip_vpu2_hw_vp8_dec.c} (99%)
rename drivers/staging/media/hantro/{rk3399_vpu_regs.h => rockchip_vpu2_regs.h} (99%)
create mode 100644 drivers/staging/media/hantro/rockchip_vpu_hw.cbase-commit: 5d765451c2409e63563fa6a3e8005bd03ab9e82f
Signature · 1 line
2.27.0
PATCH v2 1/12 dt-bindings: mfd: syscon: add Rockchip RK3036/RK3228 qos compatibles
Document Rockchip RK3036/RK3228 qos compatibles
---
Changes in v2:
- collect Reviewed tag
Documentation/devicetree/bindings/mfd/syscon.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/mfd/syscon.yaml +2 -0
@@ -45,7 +45,9 @@ properties: - microchip,sparx5-cpu-syscon - mstar,msc313-pmsleep - rockchip,px30-qos + - rockchip,rk3036-qos - rockchip,rk3066-qos + - rockchip,rk3228-qos - rockchip,rk3288-qos - rockchip,rk3399-qos - samsung,exynos3-sysreg
Signature · 1 line
2.27.0
Lee Jones
AppliedRe: [PATCH v2 01/12] dt-bindings: mfd: syscon: add Rockchip RK3036/RK3228 qos compatibles
Quoted 11 lines · Alex Bee
Document Rockchip RK3036/RK3228 qos compatibles
Signed-off-by Alex Bee <[email protected]>Reviewed-by Heiko Stuebner <[email protected]>---
Changes in v2:
- collect Reviewed tagDocumentation/devicetree/bindings/mfd/syscon.yaml | 2 ++ 1 file changed, 2 insertions(+)
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Heiko Stübner
maintainerRe: [PATCH v2 01/12] dt-bindings: mfd: syscon: add Rockchip RK3036/RK3228 qos compatibles
Hi Lee,
Am Dienstag, 1. Juni 2021, 17:46:51 CEST schrieb Lee Jones:
Quoted 8 lines · Alex Bee
Quoted 7 lines
Document Rockchip RK3036/RK3228 qos compatibles
Signed-off-by Alex Bee <[email protected]>Reviewed-by Heiko Stuebner <[email protected]>---
Quoted 7 lines
Quoted 5 lines
Changes in v2:
- collect Reviewed tagDocumentation/devicetree/bindings/mfd/syscon.yaml | 2 ++ 1 file changed, 2 insertions(+)Applied, thanks.
not sure if I'm missing something, but this patch wasn't part of your 5.14? And I also don't see it in your for-mfd-next branch. Did it get lost somewhere?
Thanks
Heiko
Re: [PATCH v2 01/12] dt-bindings: mfd: syscon: add Rockchip RK3036/RK3228 qos compatibles
Hi Lee, Heiko,
Am 11.07.21 um 13:55 schrieb Heiko Stübner:
Quoted 11 lines
Hi Lee,
Am Dienstag, 1. Juni 2021, 17:46:51 CEST schrieb Lee Jones:
Quoted 8 lines · Alex Bee
Quoted 7 lines
Document Rockchip RK3036/RK3228 qos compatibles
Signed-off-by Alex Bee <[email protected]>Reviewed-by Heiko Stuebner <[email protected]>---
Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
Changes in v2:
- collect Reviewed tagDocumentation/devicetree/bindings/mfd/syscon.yaml | 2 ++ 1 file changed, 2 insertions(+)Applied, thanks.
not sure if I'm missing something, but this patch wasn't part of your 5.14? And I also don't see it in your for-mfd-next branch. Did it get lost somewhere?
I can't find this patch in neihter the mentioned trees nor in 5.14-rc1.
Lee, could you queue it for rc2, please?
Thanks,
Alex
Quoted 4 lines
Thanks
Heiko
Re: [PATCH v2 01/12] dt-bindings: mfd: syscon: add Rockchip RK3036/RK3228 qos compatibles
Quoted 22 lines · Alex Bee
Hi Lee, Heiko,
Am 11.07.21 um 13:55 schrieb Heiko Stübner:
Quoted 19 lines
Hi Lee,
Am Dienstag, 1. Juni 2021, 17:46:51 CEST schrieb Lee Jones:
Quoted 8 lines · Alex Bee
Quoted 7 lines
Document Rockchip RK3036/RK3228 qos compatibles
Signed-off-by Alex Bee <[email protected]>Reviewed-by Heiko Stuebner <[email protected]>---
Quoted 6 lines
Quoted 5 lines
Changes in v2:
- collect Reviewed tagDocumentation/devicetree/bindings/mfd/syscon.yaml | 2 ++ 1 file changed, 2 insertions(+)Applied, thanks.
not sure if I'm missing something, but this patch wasn't part of your 5.14? And I also don't see it in your for-mfd-next branch. Did it get lost somewhere?
Hmm... looks like it was dropped some how. Apologies for that.
Quoted 3 lines
I can't find this patch in neihter the mentioned trees nor in 5.14-rc1.
Lee, could you queue it for rc2, please?
Unfortunately, that's not how it works.
Only bug fixes are allowed for inclusion into the rcs.
I'll re-queue for v5.15 though.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH v2 01/12] dt-bindings: mfd: syscon: add Rockchip RK3036/RK3228 qos compatibles
In reply to Alex BeeQuoted 4 lines · Alex Bee
Document Rockchip RK3036/RK3228 qos compatibles
Signed-off-by Alex Bee <[email protected]>Reviewed-by Heiko Stuebner <[email protected]>
Quoted 8 lines
---
Changes in v2:
- collect Reviewed tagDocumentation/devicetree/bindings/mfd/syscon.yaml | 2 ++ 1 file changed, 2 insertions(+)
PATCH v2 2/12 dt-bindings: media: rockchip-vpu: add new compatibles
In reply to Alex BeeAdd compatibles for RK3036, RK3066, RK3188 and RK3228. Also reflect the changes to the additional clocks for RK3066/RK3188.
---
Changes in v2:
- fix order
- fix indentation
.../bindings/media/rockchip-vpu.yaml | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/media/rockchip-vpu.yaml +25 -8
@@ -15,10 +15,19 @@ description: properties: compatible: - enum: - - rockchip,rk3288-vpu - - rockchip,rk3328-vpu - - rockchip,rk3399-vpu + oneOf: + - enum: + - rockchip,rk3036-vpu + - rockchip,rk3066-vpu + - rockchip,rk3288-vpu + - rockchip,rk3328-vpu + - rockchip,rk3399-vpu + - items: + - const: rockchip,rk3188-vpu + - const: rockchip,rk3066-vpu + - items: + - const: rockchip,rk3228-vpu + - const: rockchip,rk3399-vpu reg: maxItems: 1
@@ -35,12 +44,20 @@ properties: - const: vdpu clocks: - maxItems: 2 + oneOf: + - maxItems: 2 + - maxItems: 4 clock-names: - items: - - const: aclk - - const: hclk + oneOf: + - items: + - const: aclk + - const: hclk + - items: + - const: aclk_vdpu + - const: hclk_vdpu + - const: aclk_vepu + - const: hclk_vepu power-domains: maxItems: 1
Signature · 1 line
2.27.0
Re: [PATCH v2 02/12] dt-bindings: media: rockchip-vpu: add new compatibles
Quoted 4 lines · Alex Bee
Add compatibles for RK3036, RK3066, RK3188 and RK3228. Also reflect the changes to the additional clocks for RK3066/RK3188.
Signed-off-by Alex Bee <[email protected]>
Quoted 9 lines
---
Changes in v2:
- fix order
- fix indentation.../bindings/media/rockchip-vpu.yaml | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-)
PATCH v2 3/12 dt-bindings: media: rockchip-vdec: add RK3228 compatible
In reply to Alex BeeDocument the RK3228 compatible for rockchip-vdec. Also add the optional assigned-clocks and assigned-clock-rates properties.
---
Changes in v2:
- fix indentation
.../devicetree/bindings/media/rockchip,vdec.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/rockchip,vdec.yaml +9 -1
@@ -15,7 +15,11 @@ description: |- properties: compatible: - const: rockchip,rk3399-vdec + oneOf: + - const: rockchip,rk3399-vdec + - items: + - const: rockchip,rk3228-vdec + - const: rockchip,rk3399-vdec reg: maxItems: 1
@@ -37,6 +41,10 @@ properties: - const: cabac - const: core + assigned-clocks: true + + assigned-clock-rates: true + power-domains: maxItems: 1
Signature · 1 line
2.27.0
Re: [PATCH v2 03/12] dt-bindings: media: rockchip-vdec: add RK3228 compatible
Quoted 4 lines · Alex Bee
Document the RK3228 compatible for rockchip-vdec. Also add the optional assigned-clocks and assigned-clock-rates properties.
Quoted 9 lines
Signed-off-by Alex Bee <[email protected]>---
Changes in v2:
- fix indentation.../devicetree/bindings/media/rockchip,vdec.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v2 4/12 media: hantro: reorder variants
In reply to Alex BeeReorder variants in hantro driver alphanumeric.
---
Changes in v2:
- added patch
drivers/staging/media/hantro/hantro_drv.c | 4 ++-- drivers/staging/media/hantro/hantro_hw.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/media/hantro/hantro_drv.c +2 -2
@@ -486,9 +486,9 @@ static const struct v4l2_file_operations hantro_fops = {static const struct of_device_id of_hantro_match[] = { #ifdef CONFIG_VIDEO_HANTRO_ROCKCHIP - { .compatible ="rockchip,rk3399-vpu" , .data = &rk3399_vpu_variant, }, - { .compatible ="rockchip,rk3328-vpu" , .data = &rk3328_vpu_variant, }, { .compatible ="rockchip,rk3288-vpu" , .data = &rk3288_vpu_variant, }, + { .compatible ="rockchip,rk3328-vpu" , .data = &rk3328_vpu_variant, }, + { .compatible ="rockchip,rk3399-vpu" , .data = &rk3399_vpu_variant, }, #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },
drivers/staging/media/hantro/hantro_hw.h +3 -3
@@ -160,10 +160,10 @@ enum hantro_enc_fmt { RK3288_VPU_ENC_FMT_UYVY422 = 3, }; -extern const struct hantro_variant rk3399_vpu_variant; -extern const struct hantro_variant rk3328_vpu_variant; -extern const struct hantro_variant rk3288_vpu_variant;extern const struct hantro_variant imx8mq_vpu_variant; +extern const struct hantro_variant rk3288_vpu_variant; +extern const struct hantro_variant rk3328_vpu_variant; +extern const struct hantro_variant rk3399_vpu_variant;extern const struct hantro_variant sama5d4_vdec_variant;extern const struct hantro_postproc_regs hantro_g1_postproc_regs;
Signature · 1 line
2.27.0
Re: [PATCH v2 04/12] media: hantro: reorder variants
Quoted 3 lines · Alex Bee
Reorder variants in hantro driver alphanumeric.
Signed-off-by Alex Bee <[email protected]>
Thanks,
Ezequiel
PATCH v2 5/12 media: hantro: merge Rockchip platform drivers
In reply to Alex BeeMerge the two Rockchip platform drivers into one as it was suggested at
[1] and [2].
This will hopefully make it easier to add new variants (which are surely to come for Rockchip).
Also rename from "rk3288" to "v(d/e)pu1" and "rk3399" to "v(d/e)pu2" where applicable, as this is the dicition the vendor uses and will also refelect the variants that get added later in this series. Rename from "rk3288" to "rockchip" if applicable to both hardware versions.
[1] https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/
[2] https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/
---
Changes in v2:
- added patch
drivers/staging/media/hantro/Makefile | 9 +-
drivers/staging/media/hantro/hantro_hw.h | 22 +-
drivers/staging/media/hantro/rk3288_vpu_hw.c | 208 ----------
drivers/staging/media/hantro/rk3399_vpu_hw.c | 222 -----------
...jpeg_enc.c => rockchip_vpu2_hw_jpeg_enc.c} | 30 +-
...eg2_dec.c => rockchip_vpu2_hw_mpeg2_dec.c} | 25 +-
...w_vp8_dec.c => rockchip_vpu2_hw_vp8_dec.c} | 2 +-
...rk3399_vpu_regs.h => rockchip_vpu2_regs.h} | 6 +-
.../staging/media/hantro/rockchip_vpu_hw.c | 356 ++++++++++++++++++
9 files changed, 402 insertions(+), 478 deletions(-)
delete mode 100644 drivers/staging/media/hantro/rk3288_vpu_hw.c
delete mode 100644 drivers/staging/media/hantro/rk3399_vpu_hw.c
rename drivers/staging/media/hantro/{rk3399_vpu_hw_jpeg_enc.c => rockchip_vpu2_hw_jpeg_enc.c} (87%)
rename drivers/staging/media/hantro/{rk3399_vpu_hw_mpeg2_dec.c => rockchip_vpu2_hw_mpeg2_dec.c} (93%)
rename drivers/staging/media/hantro/{rk3399_vpu_hw_vp8_dec.c => rockchip_vpu2_hw_vp8_dec.c} (99%)
rename drivers/staging/media/hantro/{rk3399_vpu_regs.h => rockchip_vpu2_regs.h} (99%)
create mode 100644 drivers/staging/media/hantro/rockchip_vpu_hw.cdrivers/staging/media/hantro/Makefile +4 -5
@@ -11,9 +11,9 @@ hantro-vpu-y += \ hantro_g1_h264_dec.o \ hantro_g1_mpeg2_dec.o \ hantro_g1_vp8_dec.o \ - rk3399_vpu_hw_jpeg_enc.o \ - rk3399_vpu_hw_mpeg2_dec.o \ - rk3399_vpu_hw_vp8_dec.o \ + rockchip_vpu2_hw_jpeg_enc.o \ + rockchip_vpu2_hw_mpeg2_dec.o \ + rockchip_vpu2_hw_vp8_dec.o \ hantro_jpeg.o \ hantro_h264.o \ hantro_mpeg2.o \
@@ -26,5 +26,4 @@ hantro-vpu-$(CONFIG_VIDEO_HANTRO_SAMA5D4) += \ sama5d4_vdec_hw.o hantro-vpu-$(CONFIG_VIDEO_HANTRO_ROCKCHIP) += \ - rk3288_vpu_hw.o \ - rk3399_vpu_hw.o + rockchip_vpu_hw.o
drivers/staging/media/hantro/hantro_hw.h +11 -11
@@ -148,16 +148,16 @@ struct hantro_codec_ops {/** * enum hantro_enc_fmt - source format ID for hardware registers. * -* @RK3288_VPU_ENC_FMT_YUV420P: Y/CbCr 4:2:0 planar format -* @RK3288_VPU_ENC_FMT_YUV420SP: Y/CbCr 4:2:0 semi-planar format -* @RK3288_VPU_ENC_FMT_YUYV422: YUV 4:2:2 packed format (YUYV) -* @RK3288_VPU_ENC_FMT_UYVY422: YUV 4:2:2 packed format (UYVY) +* @ROCKCHIP_VPU_ENC_FMT_YUV420P: Y/CbCr 4:2:0 planar format +* @ROCKCHIP_VPU_ENC_FMT_YUV420SP: Y/CbCr 4:2:0 semi-planar format +* @ROCKCHIP_VPU_ENC_FMT_YUYV422: YUV 4:2:2 packed format (YUYV) +* @ROCKCHIP_VPU_ENC_FMT_UYVY422: YUV 4:2:2 packed format (UYVY) */ enum hantro_enc_fmt { -RK3288_VPU_ENC_FMT_YUV420P =0 , -RK3288_VPU_ENC_FMT_YUV420SP =1 , -RK3288_VPU_ENC_FMT_YUYV422 =2 , -RK3288_VPU_ENC_FMT_UYVY422 =3 , +ROCKCHIP_VPU_ENC_FMT_YUV420P =0 , +ROCKCHIP_VPU_ENC_FMT_YUV420SP =1 , +ROCKCHIP_VPU_ENC_FMT_YUYV422 =2 , +ROCKCHIP_VPU_ENC_FMT_UYVY422 =3 , };extern const struct hantro_variant imx8mq_vpu_variant;
@@ -181,7 +181,7 @@ irqreturn_t hantro_g1_irq(int irq, void *dev_id);void hantro_g1_reset (struct hantro_ctx *ctx);void hantro_h1_jpeg_enc_run (struct hantro_ctx *ctx); -void rk3399_vpu_jpeg_enc_run (struct hantro_ctx *ctx); +void rockchip_vpu2_jpeg_enc_run (struct hantro_ctx *ctx);int hantro_jpeg_enc_init (struct hantro_ctx *ctx);void hantro_jpeg_enc_exit (struct hantro_ctx *ctx);void hantro_jpeg_enc_done (struct hantro_ctx *ctx);
@@ -221,14 +221,14 @@ hantro_h264_mv_size(unsigned int width, unsigned int height) }void hantro_g1_mpeg2_dec_run (struct hantro_ctx *ctx); -void rk3399_vpu_mpeg2_dec_run (struct hantro_ctx *ctx); +void rockchip_vpu2_mpeg2_dec_run (struct hantro_ctx *ctx);void hantro_mpeg2_dec_copy_qtable (u8 *qtable,const struct v4l2_ctrl_mpeg2_quantisation *ctrl);int hantro_mpeg2_dec_init (struct hantro_ctx *ctx);void hantro_mpeg2_dec_exit (struct hantro_ctx *ctx);void hantro_g1_vp8_dec_run (struct hantro_ctx *ctx); -void rk3399_vpu_vp8_dec_run (struct hantro_ctx *ctx); +void rockchip_vpu2_vp8_dec_run (struct hantro_ctx *ctx);int hantro_vp8_dec_init (struct hantro_ctx *ctx);void hantro_vp8_dec_exit (struct hantro_ctx *ctx); void hantro_vp8_prob_update(struct hantro_ctx *ctx,
drivers/staging/media/hantro/rk3288_vpu_hw.c deleted +0 -208
208 lines not on this page · raw message
drivers/staging/media/hantro/rk3399_vpu_hw.c deleted +0 -222
222 lines not on this page · raw message
drivers/staging/media/hantro/rockchip_vpu2_hw_jpeg_enc.c renamed from drivers/staging/media/hantro/rk3399_vpu_hw_jpeg_enc.c +15 -15
@@ -28,12 +28,12 @@#include "hantro.h" #include "hantro_v4l2.h" #include "hantro_hw.h" -#include "rk3399_vpu_regs.h" +#include "rockchip_vpu2_regs.h" #define VEPU_JPEG_QUANT_TABLE_COUNT 16 -static void rk3399_vpu_set_src_img_ctrl (struct hantro_dev *vpu, -struct hantro_ctx *ctx) +static void rockchip_vpu2_set_src_img_ctrl (struct hantro_dev *vpu, +struct hantro_ctx *ctx) {struct v4l2_pix_format_mplane *pix_fmt = &ctx->src_fmt;u32 reg;
@@ -59,9 +59,9 @@ static void rk3399_vpu_set_src_img_ctrl(struct hantro_dev *vpu,vepu_write_relaxed (vpu, reg,VEPU_REG_ENC_CTRL1 ); } -static void rk3399_vpu_jpeg_enc_set_buffers (struct hantro_dev *vpu, -struct hantro_ctx *ctx, -struct vb2_buffer *src_buf) +static void rockchip_vpu2_jpeg_enc_set_buffers (struct hantro_dev *vpu, +struct hantro_ctx *ctx, +struct vb2_buffer *src_buf) {struct v4l2_pix_format_mplane *pix_fmt = &ctx->src_fmt;dma_addr_t src[3 ];
@@ -92,9 +92,9 @@ static void rk3399_vpu_jpeg_enc_set_buffers(struct hantro_dev *vpu, }static void -rk3399_vpu_jpeg_enc_set_qtable (struct hantro_dev *vpu, -unsigned char *luma_qtable, -unsigned char *chroma_qtable) +rockchip_vpu2_jpeg_enc_set_qtable (struct hantro_dev *vpu, +unsigned char *luma_qtable, +unsigned char *chroma_qtable) {u32 reg, i;__be32 *luma_qtable_p;
@@ -118,7 +118,7 @@ rk3399_vpu_jpeg_enc_set_qtable(struct hantro_dev *vpu, } } -void rk3399_vpu_jpeg_enc_run (struct hantro_ctx *ctx) +void rockchip_vpu2_jpeg_enc_run (struct hantro_ctx *ctx) {struct hantro_dev *vpu = ctx->dev;struct vb2_v4l2_buffer *src_buf, *dst_buf;
@@ -141,11 +141,11 @@ void rk3399_vpu_jpeg_enc_run(struct hantro_ctx *ctx)vepu_write_relaxed (vpu,VEPU_REG_ENCODE_FORMAT_JPEG ,VEPU_REG_ENCODE_START ); -rk3399_vpu_set_src_img_ctrl (vpu, ctx); -rk3399_vpu_jpeg_enc_set_buffers (vpu, ctx, &src_buf->vb2_buf); -rk3399_vpu_jpeg_enc_set_qtable (vpu, -hantro_jpeg_get_qtable (0 ), -hantro_jpeg_get_qtable (1 )); +rockchip_vpu2_set_src_img_ctrl (vpu, ctx); +rockchip_vpu2_jpeg_enc_set_buffers (vpu, ctx, &src_buf->vb2_buf); +rockchip_vpu2_jpeg_enc_set_qtable (vpu, +hantro_jpeg_get_qtable (0 ), +hantro_jpeg_get_qtable (1 )); reg =VEPU_REG_OUTPUT_SWAP32 |VEPU_REG_OUTPUT_SWAP16
drivers/staging/media/hantro/rockchip_vpu2_hw_mpeg2_dec.c renamed from drivers/staging/media/hantro/rk3399_vpu_hw_mpeg2_dec.c +12 -13
@@ -80,8 +80,8 @@#define VDPU_REG_MV_ACCURACY_BWD (v) ((v) ? BIT(1) : 0)static void -rk3399_vpu_mpeg2_dec_set_quantisation (struct hantro_dev *vpu, -struct hantro_ctx *ctx) +rockchip_vpu2_mpeg2_dec_set_quantisation (struct hantro_dev *vpu, +struct hantro_ctx *ctx) {struct v4l2_ctrl_mpeg2_quantisation *q;
@@ -91,12 +91,12 @@ rk3399_vpu_mpeg2_dec_set_quantisation(struct hantro_dev *vpu, }static void -rk3399_vpu_mpeg2_dec_set_buffers (struct hantro_dev *vpu, -struct hantro_ctx *ctx, -struct vb2_buffer *src_buf, -struct vb2_buffer *dst_buf, -const struct v4l2_ctrl_mpeg2_sequence *seq, -const struct v4l2_ctrl_mpeg2_picture *pic) +rockchip_vpu2_mpeg2_dec_set_buffers (struct hantro_dev *vpu, +struct hantro_ctx *ctx, +struct vb2_buffer *src_buf, +struct vb2_buffer *dst_buf, +const struct v4l2_ctrl_mpeg2_sequence *seq, +const struct v4l2_ctrl_mpeg2_picture *pic) {dma_addr_t forward_addr =0 , backward_addr =0 ;dma_addr_t current_addr, addr;
@@ -148,7 +148,7 @@ rk3399_vpu_mpeg2_dec_set_buffers(struct hantro_dev *vpu,vdpu_write_relaxed (vpu, backward_addr,VDPU_REG_REFER3_BASE ); } -void rk3399_vpu_mpeg2_dec_run (struct hantro_ctx *ctx) +void rockchip_vpu2_mpeg2_dec_run (struct hantro_ctx *ctx) {struct hantro_dev *vpu = ctx->dev;struct vb2_v4l2_buffer *src_buf, *dst_buf;
@@ -233,11 +233,10 @@ void rk3399_vpu_mpeg2_dec_run(struct hantro_ctx *ctx)VDPU_REG_MV_ACCURACY_BWD (1 );vdpu_write_relaxed (vpu, reg,VDPU_SWREG (136 )); -rk3399_vpu_mpeg2_dec_set_quantisation (vpu, ctx); +rockchip_vpu2_mpeg2_dec_set_quantisation (vpu, ctx); -rk3399_vpu_mpeg2_dec_set_buffers (vpu, ctx, &src_buf->vb2_buf, - &dst_buf->vb2_buf, - seq, pic); +rockchip_vpu2_mpeg2_dec_set_buffers (vpu, ctx, &src_buf->vb2_buf, + &dst_buf->vb2_buf, seq, pic);/* Kick the watchdog and start decoding */ hantro_end_prepare_run (ctx);
drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c renamed from drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c +1 -1
@@ -503,7 +503,7 @@ static void cfg_buffers(struct hantro_ctx *ctx,vdpu_write_relaxed (vpu, dst_dma,VDPU_REG_ADDR_DST ); } -void rk3399_vpu_vp8_dec_run (struct hantro_ctx *ctx) +void rockchip_vpu2_vp8_dec_run (struct hantro_ctx *ctx) {const struct v4l2_ctrl_vp8_frame *hdr;struct hantro_dev *vpu = ctx->dev;
drivers/staging/media/hantro/rockchip_vpu2_regs.h renamed from drivers/staging/media/hantro/rk3399_vpu_regs.h +3 -3
@@ -6,8 +6,8 @@* Alpha Lin <[email protected]> */ -#ifndef RK3399_VPU_REGS_H_ -#define RK3399_VPU_REGS_H_ +#ifndef ROCKCHIP_VPU2_REGS_H_ +#define ROCKCHIP_VPU2_REGS_H_ /* Encoder registers. */ #define VEPU_REG_VP8_QUT_1ST (i) (0x000 + ((i) * 0x24))
@@ -597,4 +597,4 @@#define VDPU_REG_PRED_FLT_PRED_BC_TAP_4_3 (x) (((x) & 0x3ff) << 12)#define VDPU_REG_PRED_FLT_PRED_BC_TAP_5_0 (x) (((x) & 0x3ff) << 2) -#endif /* RK3399_VPU_REGS_H_ */ +#endif /* ROCKCHIP_VPU2_REGS_H_ */
drivers/staging/media/hantro/rockchip_vpu_hw.c new file +356 -0
356 lines not on this page · raw message
Signature · 1 line
2.27.0
Re: [PATCH v2 05/12] media: hantro: merge Rockchip platform drivers
Hi Alex,
This cleanup looks nice, thanks!
Just a comment about the clock rate and a minor typo.
Quoted 36 lines · Alex Bee
Merge the two Rockchip platform drivers into one as it was suggested at
[1] and [2].
This will hopefully make it easier to add new variants (which are surely to come for Rockchip).
Also rename from "rk3288" to "v(d/e)pu1" and "rk3399" to "v(d/e)pu2" where applicable, as this is the dicition the vendor uses and will also refelect the variants that get added later in this series. Rename from "rk3288" to "rockchip" if applicable to both hardware versions.[1] https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/
[2] https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/Signed-off-by Alex Bee <[email protected]>---
Changes in v2:
- added patchdrivers/staging/media/hantro/Makefile | 9 +- drivers/staging/media/hantro/hantro_hw.h | 22 +- drivers/staging/media/hantro/rk3288_vpu_hw.c | 208 ---------- drivers/staging/media/hantro/rk3399_vpu_hw.c | 222 -----------
...jpeg_enc.c => rockchip_vpu2_hw_jpeg_enc.c} | 30 +- ...eg2_dec.c => rockchip_vpu2_hw_mpeg2_dec.c} | 25 +- ...w_vp8_dec.c => rockchip_vpu2_hw_vp8_dec.c} | 2 +- ...rk3399_vpu_regs.h => rockchip_vpu2_regs.h} | 6 +- .../staging/media/hantro/rockchip_vpu_hw.c | 356 ++++++++++++++++++ 9 files changed, 402 insertions(+), 478 deletions(-)delete mode 100644
drivers/staging/media/hantro/rk3288_vpu_hw.c
delete mode 100644drivers/staging/media/hantro/rk3399_vpu_hw.c
renamedrivers/staging/media/hantro/{rk3399_vpu_hw_jpeg_enc.c=>rockchip_vpu2_hw_jpeg_enc.c} (87%) renamedrivers/staging/media/hantro/{rk3399_vpu_hw_mpeg2_dec.c=>rockchip_vpu2_hw_mpeg2_dec.c} (93%) renamedrivers/staging/media/hantro/{rk3399_vpu_hw_vp8_dec.c=>rockchip_vpu2_hw_vp8_dec.c} (99%) renamedrivers/staging/media/hantro/{rk3399_vpu_regs.h=>rockchip_vpu2_regs.h} (99%) create mode 100644drivers/staging/media/hantro/rockchip_vpu_hw.c
[..]
Quoted 13 lines
drivers/staging/media/hantro/rockchip_vpu_hw.c new file +7
-0@@ -0,0 +1,356 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Hantro VPU codec driver +* +* Copyright (C) 2018 Rockchip Electronics Co., Ltd. +* Jeffy Chen <[email protected]> +*/
drivers/staging/media/hantro/rockchip_vpu_hw.c line 17
Quoted 10 lines
drivers/staging/media/hantro/rockchip_vpu_hw.c new file +10
-0+ +#include <linux/clk.h> + +#include "hantro.h" +#include "hantro_jpeg.h" +#include "hantro_h1_regs.h" +#include "rockchip_vpu2_regs.h" + +#define RK3288_ACLK_MAX_FREQ (400 * 1000 * 1000) +
Something for later, could we bump this clock?
Rockchip uses 300MHz and 600MHz even for RK3288,
see arch/arm/boot/dts/rk3288.dtsi:
vdpu: vdpu@ff9a0400 {
compatible = "rockchip,vpu-decoder-rk3288", "rockchip,vpu-decoder-v1";
reg = <0x0 0xff9a0400 0x0 0x400>;
interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "irq_dec";
clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>;
clock-names = "aclk_vcodec", "hclk_vcodec";
rockchip,normal-rates = <300000000>, <0>;
rockchip,advanced-rates = <600000000>, <0>;On vdpu1 for instance, it switches to the "advanced-rate" when width > 2560, which I think it's too naive for us.
At least on RK3566 I tested bumping this rate, while still passing conformance tests.
Quoted 268 lines
drivers/staging/media/hantro/rockchip_vpu_hw.c new file +268
-0+/* +* Supported formats. +*/ + +static const struct hantro_fmt rockchip_vpu_enc_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_YUV420M, + .codec_mode = HANTRO_MODE_NONE, + .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUV420P, + }, + { + .fourcc = V4L2_PIX_FMT_NV12M, + .codec_mode = HANTRO_MODE_NONE, + .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUV420SP, + }, + { + .fourcc = V4L2_PIX_FMT_YUYV, + .codec_mode = HANTRO_MODE_NONE, + .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUYV422, + }, + { + .fourcc = V4L2_PIX_FMT_UYVY, + .codec_mode = HANTRO_MODE_NONE, + .enc_fmt = ROCKCHIP_VPU_ENC_FMT_UYVY422, + }, + { + .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 = 8192, + .step_width = MB_DIM, + .min_height = 32, + .max_height = 8192, + .step_height = MB_DIM, + }, + }, +}; + +static const struct hantro_fmt rockchip_vpu1_postproc_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_YUYV, + .codec_mode = HANTRO_MODE_NONE, + }, +}; + +static const struct hantro_fmt rk3288_vpu_dec_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_NV12, + .codec_mode = HANTRO_MODE_NONE, + }, + { + .fourcc = V4L2_PIX_FMT_H264_SLICE, + .codec_mode = HANTRO_MODE_H264_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 4096, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 2304, + .step_height = MB_DIM, + }, + }, + { + .fourcc = V4L2_PIX_FMT_MPEG2_SLICE, + .codec_mode = HANTRO_MODE_MPEG2_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 1920, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 1088, + .step_height = MB_DIM, + }, + }, + { + .fourcc = V4L2_PIX_FMT_VP8_FRAME, + .codec_mode = HANTRO_MODE_VP8_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 3840, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 2160, + .step_height = MB_DIM, + }, + }, +}; + +static const struct hantro_fmt rk3399_vpu_dec_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_NV12, + .codec_mode = HANTRO_MODE_NONE, + }, + { + .fourcc = V4L2_PIX_FMT_MPEG2_SLICE, + .codec_mode = HANTRO_MODE_MPEG2_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 1920, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 1088, + .step_height = MB_DIM, + }, + }, + { + .fourcc = V4L2_PIX_FMT_VP8_FRAME, + .codec_mode = HANTRO_MODE_VP8_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 3840, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 2160, + .step_height = MB_DIM, + }, + }, +}; + +static irqreturn_t rockchip_vpu1_vepu_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, 0, H1_REG_INTERRUPT); + vepu_write(vpu, 0, H1_REG_AXI_CTRL); + + hantro_irq_done(vpu, state); + + return IRQ_HANDLED; +} + +static irqreturn_t rockchip_vpu2_vdpu_irq (int irq,void *dev_id) +{ + struct hantro_dev *vpu = dev_id; + enum vb2_buffer_state state; + u32 status; + + status = vdpu_read(vpu, VDPU_REG_INTERRUPT); + state = (status & VDPU_REG_INTERRUPT_DEC_IRQ) ? + VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; + + vdpu_write(vpu, 0, VDPU_REG_INTERRUPT); + vdpu_write(vpu, 0, VDPU_REG_AXI_CTRL); + + hantro_irq_done(vpu, state); + + return IRQ_HANDLED; +} + +static irqreturn_t rockchip_vpu2_vepu_irq (int irq,void *dev_id) +{ + struct hantro_dev *vpu = dev_id; + enum vb2_buffer_state state; + u32 status; + + status = vepu_read(vpu, VEPU_REG_INTERRUPT); + state = (status & VEPU_REG_INTERRUPT_FRAME_READY) ? + VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; + + vepu_write(vpu, 0, VEPU_REG_INTERRUPT); + vepu_write(vpu, 0, VEPU_REG_AXI_CTRL); + + hantro_irq_done(vpu, state); + + return IRQ_HANDLED; +} + +static int rockchip_vpu_hw_init (struct hantro_dev *vpu) +{ + /* Bump ACLK to max. possible freq. to improve performance. */ + clk_set_rate(vpu->clocks[0].clk, RK3288_ACLK_MAX_FREQ); + return 0; +} + +static void rockchip_vpu1_enc_reset (struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + + vepu_write(vpu, H1_REG_INTERRUPT_DIS_BIT, H1_REG_INTERRUPT); + vepu_write(vpu, 0, H1_REG_ENC_CTRL); + vepu_write(vpu, 0, H1_REG_AXI_CTRL); +} + +static void rockchip_vpu2_dec_reset (struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + + vdpu_write(vpu, VDPU_REG_INTERRUPT_DEC_IRQ_DIS, VDPU_REG_INTERRUPT); + vdpu_write(vpu, 0, VDPU_REG_EN_FLAGS); + vdpu_write(vpu, 1, VDPU_REG_SOFT_RESET); +} + +static void rockchip_vpu2_enc_reset (struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + + vepu_write(vpu, VEPU_REG_INTERRUPT_DIS_BIT, VEPU_REG_INTERRUPT); + vepu_write(vpu, 0, VEPU_REG_ENCODE_START); + vepu_write(vpu, 0, VEPU_REG_AXI_CTRL); +} + +/* +* Supported codec ops. +*/ + +static const struct hantro_codec_ops rk3288_vpu_codec_ops[] = { + [HANTRO_MODE_JPEG_ENC] = { + .run = hantro_h1_jpeg_enc_run, + .reset = rockchip_vpu1_enc_reset, + .init = hantro_jpeg_enc_init, + .done = hantro_jpeg_enc_done, + .exit = hantro_jpeg_enc_exit, + }, + [HANTRO_MODE_H264_DEC] = { + .run = hantro_g1_h264_dec_run, + .reset = hantro_g1_reset, + .init = hantro_h264_dec_init, + .exit = hantro_h264_dec_exit, + }, + [HANTRO_MODE_MPEG2_DEC] = { + .run = hantro_g1_mpeg2_dec_run, + .reset = hantro_g1_reset, + .init = hantro_mpeg2_dec_init, + .exit = hantro_mpeg2_dec_exit, + }, + [HANTRO_MODE_VP8_DEC] = { + .run = hantro_g1_vp8_dec_run, + .reset = hantro_g1_reset, + .init = hantro_vp8_dec_init, + .exit = hantro_vp8_dec_exit, + }, +}; + +static const struct hantro_codec_ops rk3399_vpu_codec_ops[] = { + [HANTRO_MODE_JPEG_ENC] = { + .run = rockchip_vpu2_jpeg_enc_run, + .reset = rockchip_vpu2_enc_reset, + .init = hantro_jpeg_enc_init, + .exit = hantro_jpeg_enc_exit, + }, + [HANTRO_MODE_MPEG2_DEC] = { + .run = rockchip_vpu2_mpeg2_dec_run, + .reset = rockchip_vpu2_dec_reset, + .init = hantro_mpeg2_dec_init, + .exit = hantro_mpeg2_dec_exit, + }, + [HANTRO_MODE_VP8_DEC] = { + .run = rockchip_vpu2_vp8_dec_run, + .reset = rockchip_vpu2_dec_reset, + .init = hantro_vp8_dec_init, + .exit = hantro_vp8_dec_exit, + }, +}; +
drivers/staging/media/hantro/rockchip_vpu_hw.c line 295
Quoted 10 lines
drivers/staging/media/hantro/rockchip_vpu_hw.c new file +10
-0+/* +* VPU variant. +*/ + +static const struct hantro_irq rockchip_vpu1_irqs[] = { + { "vepu", rockchip_vpu1_vepu_irq }, + { "vdpu", hantro_g1_irq }, +}; + +static const struct hantro_irq rockchip_vpdu2_irqs[] = {
Typo: vpdu -> vdpu?
drivers/staging/media/hantro/rockchip_vpu_hw.c line 298
Quoted 3 lines
drivers/staging/media/hantro/rockchip_vpu_hw.c new file +3
-0+ { "vdpu", rockchip_vpu2_vdpu_irq }, +}; +
Thanks,
Ezequiel
Re: [PATCH v2 05/12] media: hantro: merge Rockchip platform drivers
Hi Ezequiel,
Am 11.06.21 um 17:36 schrieb Ezequiel Garcia:
Quoted 82 lines
Hi Alex,
This cleanup looks nice, thanks!
Just a comment about the clock rate and a minor typo.
Quoted 36 lines · Alex Bee
Merge the two Rockchip platform drivers into one as it was suggested at
[1] and [2].
This will hopefully make it easier to add new variants (which are surely to come for Rockchip).
Also rename from "rk3288" to "v(d/e)pu1" and "rk3399" to "v(d/e)pu2" where applicable, as this is the dicition the vendor uses and will also refelect the variants that get added later in this series. Rename from "rk3288" to "rockchip" if applicable to both hardware versions.[1] https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/
[2] https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/Signed-off-by Alex Bee <[email protected]>---
Changes in v2:
- added patchdrivers/staging/media/hantro/Makefile | 9 +- drivers/staging/media/hantro/hantro_hw.h | 22 +- drivers/staging/media/hantro/rk3288_vpu_hw.c | 208 ---------- drivers/staging/media/hantro/rk3399_vpu_hw.c | 222 ----------- ...jpeg_enc.c => rockchip_vpu2_hw_jpeg_enc.c} | 30 +- ...eg2_dec.c => rockchip_vpu2_hw_mpeg2_dec.c} | 25 +- ...w_vp8_dec.c => rockchip_vpu2_hw_vp8_dec.c} | 2 +- ...rk3399_vpu_regs.h => rockchip_vpu2_regs.h} | 6 +- .../staging/media/hantro/rockchip_vpu_hw.c | 356 ++++++++++++++++++ 9 files changed, 402 insertions(+), 478 deletions(-)delete mode 100644
drivers/staging/media/hantro/rk3288_vpu_hw.c
delete mode 100644drivers/staging/media/hantro/rk3399_vpu_hw.c
renamedrivers/staging/media/hantro/{rk3399_vpu_hw_jpeg_enc.c=>rockchip_vpu2_hw_jpeg_enc.c} (87%) renamedrivers/staging/media/hantro/{rk3399_vpu_hw_mpeg2_dec.c=>rockchip_vpu2_hw_mpeg2_dec.c} (93%) renamedrivers/staging/media/hantro/{rk3399_vpu_hw_vp8_dec.c=>rockchip_vpu2_hw_vp8_dec.c} (99%) renamedrivers/staging/media/hantro/{rk3399_vpu_regs.h=>rockchip_vpu2_regs.h} (99%) create mode 100644drivers/staging/media/hantro/rockchip_vpu_hw.c[..]
Quoted 13 lines
drivers/staging/media/hantro/rockchip_vpu_hw.c new file +7
-0@@ -0,0 +1,356 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Hantro VPU codec driver +* +* Copyright (C) 2018 Rockchip Electronics Co., Ltd. +* Jeffy Chen <[email protected]> +*/ drivers/staging/media/hantro/rockchip_vpu_hw.c line 17
Quoted 10 lines
drivers/staging/media/hantro/rockchip_vpu_hw.c new file +10
-0+ +#include <linux/clk.h> + +#include "hantro.h" +#include "hantro_jpeg.h" +#include "hantro_h1_regs.h" +#include "rockchip_vpu2_regs.h" + +#define RK3288_ACLK_MAX_FREQ (400 * 1000 * 1000) +Something for later, could we bump this clock?
Rockchip uses 300MHz and 600MHz even for RK3288,
seearch/arm/boot/dts/rk3288.dtsi:vdpu: vdpu@ff9a0400 { compatible = "rockchip,vpu-decoder-rk3288", "rockchip,vpu-decoder-v1"; reg = <0x0 0xff9a0400 0x0 0x400>; interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "irq_dec"; clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>; clock-names = "aclk_vcodec", "hclk_vcodec"; rockchip,normal-rates = <300000000>, <0>; rockchip,advanced-rates = <600000000>, <0>;
Quoted 5 lines
On vdpu1 for instance, it switches to the "advanced-rate" when width > 2560, which I think it's too naive for us.
At least on RK3566 I tested bumping this rate, while still passing conformance tests.
Yes, RK3288's can (and maybe also should) run at 600 MHz (since we are sugesting to "Bump ACLK to max. possible freq. to improve performance." currently) - but I never ran conformance tests after setting this rate, tbh.
I'm also not sure, VDPU2 (RK3399) variant supports VP8 up to 3840x2160p. It would be the only codec supported up that frame size (we already know, that H.264 is supported up to 1920x1088, even if it is not supported currently by upstream hantro driver) and TRM says the hantro IP block is a "1080P encoder/decoder Processing Core", without saying anything specific per codec.
Both should be checked and addressed in a upcoming series.
Quoted 271 lines
Quoted 271 lines
drivers/staging/media/hantro/rockchip_vpu_hw.c new file +271
-0+/* +* Supported formats. +*/ + +static const struct hantro_fmt rockchip_vpu_enc_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_YUV420M, + .codec_mode = HANTRO_MODE_NONE, + .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUV420P, + }, + { + .fourcc = V4L2_PIX_FMT_NV12M, + .codec_mode = HANTRO_MODE_NONE, + .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUV420SP, + }, + { + .fourcc = V4L2_PIX_FMT_YUYV, + .codec_mode = HANTRO_MODE_NONE, + .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUYV422, + }, + { + .fourcc = V4L2_PIX_FMT_UYVY, + .codec_mode = HANTRO_MODE_NONE, + .enc_fmt = ROCKCHIP_VPU_ENC_FMT_UYVY422, + }, + { + .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 = 8192, + .step_width = MB_DIM, + .min_height = 32, + .max_height = 8192, + .step_height = MB_DIM, + }, + }, +}; + +static const struct hantro_fmt rockchip_vpu1_postproc_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_YUYV, + .codec_mode = HANTRO_MODE_NONE, + }, +}; + +static const struct hantro_fmt rk3288_vpu_dec_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_NV12, + .codec_mode = HANTRO_MODE_NONE, + }, + { + .fourcc = V4L2_PIX_FMT_H264_SLICE, + .codec_mode = HANTRO_MODE_H264_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 4096, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 2304, + .step_height = MB_DIM, + }, + }, + { + .fourcc = V4L2_PIX_FMT_MPEG2_SLICE, + .codec_mode = HANTRO_MODE_MPEG2_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 1920, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 1088, + .step_height = MB_DIM, + }, + }, + { + .fourcc = V4L2_PIX_FMT_VP8_FRAME, + .codec_mode = HANTRO_MODE_VP8_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 3840, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 2160, + .step_height = MB_DIM, + }, + }, +}; + +static const struct hantro_fmt rk3399_vpu_dec_fmts[] = { + { + .fourcc = V4L2_PIX_FMT_NV12, + .codec_mode = HANTRO_MODE_NONE, + }, + { + .fourcc = V4L2_PIX_FMT_MPEG2_SLICE, + .codec_mode = HANTRO_MODE_MPEG2_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 1920, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 1088, + .step_height = MB_DIM, + }, + }, + { + .fourcc = V4L2_PIX_FMT_VP8_FRAME, + .codec_mode = HANTRO_MODE_VP8_DEC, + .max_depth = 2, + .frmsize = { + .min_width = 48, + .max_width = 3840, + .step_width = MB_DIM, + .min_height = 48, + .max_height = 2160, + .step_height = MB_DIM, + }, + }, +}; + +static irqreturn_t rockchip_vpu1_vepu_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, 0, H1_REG_INTERRUPT); + vepu_write(vpu, 0, H1_REG_AXI_CTRL); + + hantro_irq_done(vpu, state); + + return IRQ_HANDLED; +} + +static irqreturn_t rockchip_vpu2_vdpu_irq (int irq,void *dev_id) +{ + struct hantro_dev *vpu = dev_id; + enum vb2_buffer_state state; + u32 status; + + status = vdpu_read(vpu, VDPU_REG_INTERRUPT); + state = (status & VDPU_REG_INTERRUPT_DEC_IRQ) ? + VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; + + vdpu_write(vpu, 0, VDPU_REG_INTERRUPT); + vdpu_write(vpu, 0, VDPU_REG_AXI_CTRL); + + hantro_irq_done(vpu, state); + + return IRQ_HANDLED; +} + +static irqreturn_t rockchip_vpu2_vepu_irq (int irq,void *dev_id) +{ + struct hantro_dev *vpu = dev_id; + enum vb2_buffer_state state; + u32 status; + + status = vepu_read(vpu, VEPU_REG_INTERRUPT); + state = (status & VEPU_REG_INTERRUPT_FRAME_READY) ? + VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR; + + vepu_write(vpu, 0, VEPU_REG_INTERRUPT); + vepu_write(vpu, 0, VEPU_REG_AXI_CTRL); + + hantro_irq_done(vpu, state); + + return IRQ_HANDLED; +} + +static int rockchip_vpu_hw_init (struct hantro_dev *vpu) +{ + /* Bump ACLK to max. possible freq. to improve performance. */ + clk_set_rate(vpu->clocks[0].clk, RK3288_ACLK_MAX_FREQ); + return 0; +} + +static void rockchip_vpu1_enc_reset (struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + + vepu_write(vpu, H1_REG_INTERRUPT_DIS_BIT, H1_REG_INTERRUPT); + vepu_write(vpu, 0, H1_REG_ENC_CTRL); + vepu_write(vpu, 0, H1_REG_AXI_CTRL); +} + +static void rockchip_vpu2_dec_reset (struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + + vdpu_write(vpu, VDPU_REG_INTERRUPT_DEC_IRQ_DIS, VDPU_REG_INTERRUPT); + vdpu_write(vpu, 0, VDPU_REG_EN_FLAGS); + vdpu_write(vpu, 1, VDPU_REG_SOFT_RESET); +} + +static void rockchip_vpu2_enc_reset (struct hantro_ctx *ctx) +{ + struct hantro_dev *vpu = ctx->dev; + + vepu_write(vpu, VEPU_REG_INTERRUPT_DIS_BIT, VEPU_REG_INTERRUPT); + vepu_write(vpu, 0, VEPU_REG_ENCODE_START); + vepu_write(vpu, 0, VEPU_REG_AXI_CTRL); +} + +/* +* Supported codec ops. +*/ + +static const struct hantro_codec_ops rk3288_vpu_codec_ops[] = { + [HANTRO_MODE_JPEG_ENC] = { + .run = hantro_h1_jpeg_enc_run, + .reset = rockchip_vpu1_enc_reset, + .init = hantro_jpeg_enc_init, + .done = hantro_jpeg_enc_done, + .exit = hantro_jpeg_enc_exit, + }, + [HANTRO_MODE_H264_DEC] = { + .run = hantro_g1_h264_dec_run, + .reset = hantro_g1_reset, + .init = hantro_h264_dec_init, + .exit = hantro_h264_dec_exit, + }, + [HANTRO_MODE_MPEG2_DEC] = { + .run = hantro_g1_mpeg2_dec_run, + .reset = hantro_g1_reset, + .init = hantro_mpeg2_dec_init, + .exit = hantro_mpeg2_dec_exit, + }, + [HANTRO_MODE_VP8_DEC] = { + .run = hantro_g1_vp8_dec_run, + .reset = hantro_g1_reset, + .init = hantro_vp8_dec_init, + .exit = hantro_vp8_dec_exit, + }, +}; + +static const struct hantro_codec_ops rk3399_vpu_codec_ops[] = { + [HANTRO_MODE_JPEG_ENC] = { + .run = rockchip_vpu2_jpeg_enc_run, + .reset = rockchip_vpu2_enc_reset, + .init = hantro_jpeg_enc_init, + .exit = hantro_jpeg_enc_exit, + }, + [HANTRO_MODE_MPEG2_DEC] = { + .run = rockchip_vpu2_mpeg2_dec_run, + .reset = rockchip_vpu2_dec_reset, + .init = hantro_mpeg2_dec_init, + .exit = hantro_mpeg2_dec_exit, + }, + [HANTRO_MODE_VP8_DEC] = { + .run = rockchip_vpu2_vp8_dec_run, + .reset = rockchip_vpu2_dec_reset, + .init = hantro_vp8_dec_init, + .exit = hantro_vp8_dec_exit, + }, +}; + +/* +* VPU variant. +*/
Quoted 8 lines
drivers/staging/media/hantro/rockchip_vpu_hw.c line 295
Quoted 7 lines
drivers/staging/media/hantro/rockchip_vpu_hw.c new file +7
-0+ +static const struct hantro_irq rockchip_vpu1_irqs[] = { + { "vepu", rockchip_vpu1_vepu_irq }, + { "vdpu", hantro_g1_irq }, +}; + +static const struct hantro_irq rockchip_vpdu2_irqs[] = {Typo: vpdu -> vdpu?
Will fix it in v3.
Quoted 9 lines
drivers/staging/media/hantro/rockchip_vpu_hw.c line 298
Quoted 4 lines
drivers/staging/media/hantro/rockchip_vpu_hw.c new file +3
-0+ { "vdpu", rockchip_vpu2_vdpu_irq }, +}; +Reviewed-by Ezequiel Garcia <[email protected]>Thanks,
Ezequiel
Alex
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v2 6/12 media: hantro: add support for Rockchip RK3066
In reply to Alex BeeRK3066's VPU IP block is the predecessor from what RK3288 has. The hardware differences are:
- supports decoding frame sizes up to 1920x1088 only
- doesn't have the 'G1_REG_SOFT_RESET' register (requires another .reset callback for hantro_codec_ops, since writing this register will result in non-working IP block)
- has one ACLK/HCLK per vdpu/vepu
- ACLKs can be clocked up to 300 MHz only
- no MMU
(no changes required: CMA will be transparently used)
Add a new RK3066 variant which reflect this differences. This variant can be used for RK3188 as well.
---
Changes in v2:
- fixed wrong index in clk array for vepu clock in rk3066_vpu_hw_init
- added comment, why this variant can't be splitted in g1/h1 variants
drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 + .../staging/media/hantro/rockchip_vpu_hw.c | 121 ++++++++++++++++++ 3 files changed, 123 insertions(+)
drivers/staging/media/hantro/hantro_drv.c +1 -0
@@ -486,6 +486,7 @@ static const struct v4l2_file_operations hantro_fops = {static const struct of_device_id of_hantro_match[] = { #ifdef CONFIG_VIDEO_HANTRO_ROCKCHIP + { .compatible ="rockchip,rk3066-vpu" , .data = &rk3066_vpu_variant, }, { .compatible ="rockchip,rk3288-vpu" , .data = &rk3288_vpu_variant, }, { .compatible ="rockchip,rk3328-vpu" , .data = &rk3328_vpu_variant, }, { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, },
drivers/staging/media/hantro/hantro_hw.h +1 -0
@@ -161,6 +161,7 @@ enum hantro_enc_fmt { };extern const struct hantro_variant imx8mq_vpu_variant; +extern const struct hantro_variant rk3066_vpu_variant;extern const struct hantro_variant rk3288_vpu_variant;extern const struct hantro_variant rk3328_vpu_variant;extern const struct hantro_variant rk3399_vpu_variant;
drivers/staging/media/hantro/rockchip_vpu_hw.c +121 -0
164 lines not on this page · raw message
Signature · 1 line
2.27.0
Re: [PATCH v2 06/12] media: hantro: add support for Rockchip RK3066
Hi Alex,
Quoted 9 lines · Alex Bee
RK3066's VPU IP block is the predecessor from what RK3288 has. The hardware differences are:
- supports decoding frame sizes up to 1920x1088 only
- doesn't have the 'G1_REG_SOFT_RESET' register (requires another .reset callback forhantro_codec_ops, since writing this register will result in non-working IP block)
- has one ACLK/HCLK per vdpu/vepu
- ACLKs can be clocked up to 300 MHz only
Have you tested trying 400 MHz (or more) ?
Quoted 6 lines
- no MMU
(no changes required: CMA will be transparently used)Add a new RK3066 variant which reflect this differences. This variant can be used for RK3188 as well.
Thanks!
Ezequiel
Re: [PATCH v2 06/12] media: hantro: add support for Rockchip RK3066
Hi Ezequiel,
Am 11.06.21 um 17:50 schrieb Ezequiel Garcia:
Quoted 12 lines
Hi Alex,
Quoted 9 lines · Alex Bee
RK3066's VPU IP block is the predecessor from what RK3288 has. The hardware differences are:
- supports decoding frame sizes up to 1920x1088 only
- doesn't have the 'G1_REG_SOFT_RESET' register (requires another .reset callback forhantro_codec_ops, since writing this register will result in non-working IP block)
- has one ACLK/HCLK per vdpu/vepu
- ACLKs can be clocked up to 300 MHz only
Quoted 1 line
Have you tested trying 400 MHz (or more) ?
Yes, I've tried this on both RK3066 and RK3036 variants - everything above 300 MHz results in non-functioning IP block.
See comment in RK3036 devicetree in vendor kernel at [1].
[1] https://github.com/rockchip-linux/kernel/blob/develop-4.4/arch/arm/boot/dts/rk3036.dtsi#L246-L248
Quoted 12 lines
Quoted 7 lines
- no MMU
(no changes required: CMA will be transparently used)Add a new RK3066 variant which reflect this differences. This variant can be used for RK3188 as well.
Reviewed-by Ezequiel Garcia <[email protected]>Thanks!
Ezequiel
PATCH v2 7/12 media: hantro: add support for Rockchip RK3036
In reply to Alex BeeRK3036's VPU IP block is the same as RK3288 has, except that it doesn't have an encoder, decoding is supported up to 1920x1088 only and the axi clock can be set to 300 MHz max.
Add a new RK3036 variant which reflect this differences.
---
Changes in v2:
- rename rk3036_irqs -> rockchip_vdpu1_irqs
- fix spelling error
drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 + .../staging/media/hantro/rockchip_vpu_hw.c | 49 +++++++++++++++++++ 3 files changed, 51 insertions(+)
drivers/staging/media/hantro/hantro_drv.c +1 -0
@@ -486,6 +486,7 @@ static const struct v4l2_file_operations hantro_fops = {static const struct of_device_id of_hantro_match[] = { #ifdef CONFIG_VIDEO_HANTRO_ROCKCHIP + { .compatible ="rockchip,rk3036-vpu" , .data = &rk3036_vpu_variant, }, { .compatible ="rockchip,rk3066-vpu" , .data = &rk3066_vpu_variant, }, { .compatible ="rockchip,rk3288-vpu" , .data = &rk3288_vpu_variant, }, { .compatible = "rockchip,rk3328-vpu", .data = &rk3328_vpu_variant, },
drivers/staging/media/hantro/hantro_hw.h +1 -0
@@ -161,6 +161,7 @@ enum hantro_enc_fmt { };extern const struct hantro_variant imx8mq_vpu_variant; +extern const struct hantro_variant rk3036_vpu_variant;extern const struct hantro_variant rk3066_vpu_variant;extern const struct hantro_variant rk3288_vpu_variant;extern const struct hantro_variant rk3328_vpu_variant;
drivers/staging/media/hantro/rockchip_vpu_hw.c +49 -0
73 lines not on this page · raw message
Signature · 1 line
2.27.0
Re: [PATCH v2 07/12] media: hantro: add support for Rockchip RK3036
Quoted 6 lines · Alex Bee
RK3036's VPU IP block is the same as RK3288 has, except that it doesn't have an encoder, decoding is supported up to 1920x1088 only and the axi clock can be set to 300 MHz max.
Add a new RK3036 variant which reflect this differences.
Same question here, about testing higher rate than 300 MHz, but I suspect you did that already :)
Thanks,
Ezequiel
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v2 8/12 ARM: dts: rockchip: add power controller for RK3036
In reply to Alex BeeAdd the power controller node and the correspondending qos nodes for RK3036.
Also add the power-domain property to the nodes that are already present.
Note: Since the regiser offsets of the axi interconnect QoS are missing in the TRM (RK3036 TRM V1.0), they have been taken from vendor kernel.
---
Changes in v2:
- moved power-domains property after iommus-property
arch/arm/boot/dts/rk3036.dtsi | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
arch/arm/boot/dts/rk3036.dtsi +51 -0
@@ -6,6 +6,7 @@ #include <dt-bindings/pinctrl/rockchip.h> #include <dt-bindings/clock/rk3036-cru.h> #include <dt-bindings/soc/rockchip,boot-mode.h> +#include <dt-bindings/power/rk3036-power.h> / { #address-cells = <1>;
@@ -111,6 +112,7 @@ gpu: gpu@10090000 { assigned-clock-rates = <100000000>; clocks = <&cru SCLK_GPU>, <&cru SCLK_GPU>; clock-names = "bus", "core"; + power-domains = <&power RK3036_PD_GPU>; resets = <&cru SRST_GPU>; status = "disabled"; };
@@ -124,6 +126,7 @@ vop: vop@10118000 { resets = <&cru SRST_LCDC1_A>, <&cru SRST_LCDC1_H>, <&cru SRST_LCDC1_D>; reset-names = "axi", "ahb", "dclk"; iommus = <&vop_mmu>; + power-domains = <&power RK3036_PD_VIO>; status = "disabled"; vop_out: port {
@@ -142,10 +145,26 @@ vop_mmu: iommu@10118300 { interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_LCDC>, <&cru HCLK_LCDC>; clock-names = "aclk", "iface"; + power-domains = <&power RK3036_PD_VIO>; #iommu-cells = <0>; status = "disabled"; }; + qos_gpu: qos@1012d000 { + compatible = "rockchip,rk3036-qos", "syscon"; + reg = <0x1012d000 0x20>; + }; + + qos_vpu: qos@1012e000 { + compatible = "rockchip,rk3036-qos", "syscon"; + reg = <0x1012e000 0x20>; + }; + + qos_vio: qos@1012f000 { + compatible = "rockchip,rk3036-qos", "syscon"; + reg = <0x1012f000 0x20>; + }; + gic: interrupt-controller@10139000 { compatible = "arm,gic-400"; interrupt-controller;
@@ -301,6 +320,38 @@ grf: syscon@20008000 { compatible = "rockchip,rk3036-grf", "syscon", "simple-mfd"; reg = <0x20008000 0x1000>; + power: power-controller { + compatible = "rockchip,rk3036-power-controller"; + #power-domain-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + + power-domain@RK3036_PD_VIO { + reg = <RK3036_PD_VIO>; + clocks = <&cru ACLK_LCDC>, + <&cru HCLK_LCDC>, + <&cru SCLK_LCDC>; + pm_qos = <&qos_vio>; + #power-domain-cells = <0>; + }; + + power-domain@RK3036_PD_VPU { + reg = <RK3036_PD_VPU>; + clocks = <&cru ACLK_VCODEC>, + <&cru HCLK_VCODEC>; + pm_qos = <&qos_vpu>; + #power-domain-cells = <0>; + }; + + power-domain@RK3036_PD_GPU { + reg = <RK3036_PD_GPU>; + clocks = <&cru SCLK_GPU>; + pm_qos = <&qos_gpu>; + #power-domain-cells = <0>; + }; + + }; + reboot-mode { compatible = "syscon-reboot-mode"; offset = <0x1d8>;
Signature · 1 line
2.27.0
Re: [PATCH v2 08/12] ARM: dts: rockchip: add power controller for RK3036
Hi Heiko,
Quoted 7 lines · Alex Bee
Add the power controller node and the correspondending qos nodes for RK3036.
Also add the power-domain property to the nodes that are already present.
Note: Since the regiser offsets of the axi interconnect QoS are missing in the TRM (RK3036 TRM V1.0), they have been taken from vendor kernel.
Can you take care of the device tree changes (patches 8 to 12)?
Thanks!
Ezequiel
Heiko Stuebner
maintainerRe: [PATCH v2 08/12] ARM: dts: rockchip: add power controller for RK3036
Am Freitag, 11. Juni 2021, 17:58:58 CEST schrieb Ezequiel Garcia:
Quoted 11 lines
Hi Heiko,
Quoted 7 lines · Alex Bee
Add the power controller node and the correspondending qos nodes for RK3036.
Also add the power-domain property to the nodes that are already present.
Note: Since the regiser offsets of the axi interconnect QoS are missing in the TRM (RK3036 TRM V1.0), they have been taken from vendor kernel.
Quoted 1 line
Can you take care of the device tree changes (patches 8 to 12)?
sure, I'll pick the power-domains now but need to wait for the vpu nodes for the driver parts to land in the media tree.
Heiko
Re: [PATCH v2 08/12] ARM: dts: rockchip: add power controller for RK3036
Hi Heiko,
Am 13.06.21 um 18:22 schrieb Heiko Stuebner:
Quoted 11 lines
Am Freitag, 11. Juni 2021, 17:58:58 CEST schrieb Ezequiel Garcia:
Quoted 10 lines
Hi Heiko,
Quoted 7 lines · Alex Bee
Add the power controller node and the correspondending qos nodes for RK3036.
Also add the power-domain property to the nodes that are already present.
Note: Since the regiser offsets of the axi interconnect QoS are missing in the TRM (RK3036 TRM V1.0), they have been taken from vendor kernel.
Quoted 3 lines
Quoted 1 line
Can you take care of the device tree changes (patches 8 to 12)?
sure, I'll pick the power-domains now but need to wait for the vpu nodes for the driver parts to land in the media tree.
Looks like I'm too late for 5.14 - just in case you didn't follow or didn't receive a notification:
hantro patches of this series have been merged in media_tree and vpu node patches (please pick from v2) could get reviewed/applied now.
Thanks,
Alex
Quoted 4 lines
Heiko
PATCH v2 9/12 ARM: dts: rockchip: add power controller for RK322x
In reply to Alex BeeAdd the power controller node and the correspondending qos nodes for RK322x.
Also add the power-domain property to the nodes that are already present.
---
Changes in v2:
- moved power node to appropriate position
- added #power-domain-cells for RK3228_PD_GPU
- moved power-domains property after iommous property
arch/arm/boot/dts/rk322x.dtsi | 113 ++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+)
arch/arm/boot/dts/rk322x.dtsi +113 -0
@@ -6,6 +6,7 @@ #include <dt-bindings/pinctrl/rockchip.h> #include <dt-bindings/clock/rk3228-cru.h> #include <dt-bindings/thermal/thermal.h> +#include <dt-bindings/power/rk3228-power.h> / { #address-cells = <1>;
@@ -190,6 +191,65 @@ io_domains: io-domains { status = "disabled"; }; + power: power-controller { + compatible = "rockchip,rk3228-power-controller"; + #power-domain-cells = <1>; + #address-cells = <1>; + #size-cells = <0>; + + power-domain@RK3228_PD_VIO { + reg = <RK3228_PD_VIO>; + clocks = <&cru ACLK_HDCP>, + <&cru SCLK_HDCP>, + <&cru ACLK_IEP>, + <&cru HCLK_IEP>, + <&cru ACLK_RGA>, + <&cru HCLK_RGA>, + <&cru SCLK_RGA>; + pm_qos = <&qos_hdcp>, + <&qos_iep>, + <&qos_rga_r>, + <&qos_rga_w>; + #power-domain-cells = <0>; + }; + + power-domain@RK3228_PD_VOP { + reg = <RK3228_PD_VOP>; + clocks =<&cru ACLK_VOP>, + <&cru DCLK_VOP>, + <&cru HCLK_VOP>; + pm_qos = <&qos_vop>; + #power-domain-cells = <0>; + }; + + power-domain@RK3228_PD_VPU { + reg = <RK3228_PD_VPU>; + clocks = <&cru ACLK_VPU>, + <&cru HCLK_VPU>; + pm_qos = <&qos_vpu>; + #power-domain-cells = <0>; + }; + + power-domain@RK3228_PD_RKVDEC { + reg = <RK3228_PD_RKVDEC>; + clocks = <&cru ACLK_RKVDEC>, + <&cru HCLK_RKVDEC>, + <&cru SCLK_VDEC_CABAC>, + <&cru SCLK_VDEC_CORE>; + pm_qos = <&qos_rkvdec_r>, + <&qos_rkvdec_w>; + #power-domain-cells = <0>; + }; + + power-domain@RK3228_PD_GPU { + reg = <RK3228_PD_GPU>; + clocks = <&cru ACLK_GPU>; + pm_qos = <&qos_gpu>; + #power-domain-cells = <0>; + }; + + }; + u2phy0: usb2-phy@760 { compatible = "rockchip,rk3228-usb2phy"; reg = <0x0760 0x0c>;
@@ -240,6 +300,7 @@ u2phy1_host: host-port { status = "disabled"; }; }; + }; uart0: serial@11010000 {
@@ -546,6 +607,7 @@ gpu: gpu@20000000 { "ppmmu1"; clocks = <&cru ACLK_GPU>, <&cru ACLK_GPU>; clock-names = "bus", "core"; + power-domains = <&power RK3228_PD_GPU>; resets = <&cru SRST_GPU_A>; status = "disabled"; };
@@ -556,6 +618,7 @@ vpu_mmu: iommu@20020800 { interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>; clock-names = "aclk", "iface"; + power-domains = <&power RK3228_PD_VPU>; #iommu-cells = <0>; status = "disabled"; };
@@ -566,6 +629,7 @@ vdec_mmu: iommu@20030480 { interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_RKVDEC>, <&cru HCLK_RKVDEC>; clock-names = "aclk", "iface"; + power-domains = <&power RK3228_PD_RKVDEC>; #iommu-cells = <0>; status = "disabled"; };
@@ -579,6 +643,7 @@ vop: vop@20050000 { resets = <&cru SRST_VOP_A>, <&cru SRST_VOP_H>, <&cru SRST_VOP_D>; reset-names = "axi", "ahb", "dclk"; iommus = <&vop_mmu>; + power-domains = <&power RK3228_PD_VOP>; status = "disabled"; vop_out: port {
@@ -598,6 +663,7 @@ vop_mmu: iommu@20053f00 { interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_VOP>, <&cru HCLK_VOP>; clock-names = "aclk", "iface"; + power-domains = <&power RK3228_PD_VOP>; #iommu-cells = <0>; status = "disabled"; };
@@ -608,6 +674,7 @@ rga: rga@20060000 { interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA>; clock-names = "aclk", "hclk", "sclk"; + power-domains = <&power RK3228_PD_VIO>; resets = <&cru SRST_RGA>, <&cru SRST_RGA_A>, <&cru SRST_RGA_H>; reset-names = "core", "axi", "ahb"; };
@@ -618,6 +685,7 @@ iep_mmu: iommu@20070800 { interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru ACLK_IEP>, <&cru HCLK_IEP>; clock-names = "aclk", "iface"; + power-domains = <&power RK3228_PD_VIO>; #iommu-cells = <0>; status = "disabled"; };
@@ -792,6 +860,51 @@ gmac: ethernet@30200000 { status = "disabled"; }; + qos_iep: qos@31030080 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31030080 0x20>; + }; + + qos_rga_w: qos@31030100 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31030100 0x20>; + }; + + qos_hdcp: qos@31030180 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31030180 0x20>; + }; + + qos_rga_r: qos@31030200 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31030200 0x20>; + }; + + qos_vpu: qos@31040000 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31040000 0x20>; + }; + + qos_gpu: qos@31050000 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31050000 0x20>; + }; + + qos_vop: qos@31060000 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31060000 0x20>; + }; + + qos_rkvdec_r: qos@31070000 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31070000 0x20>; + }; + + qos_rkvdec_w: qos@31070080 { + compatible = "rockchip,rk3228-qos", "syscon"; + reg = <0x31070080 0x20>; + }; + gic: interrupt-controller@32010000 { compatible = "arm,gic-400"; interrupt-controller;
Signature · 1 line
2.27.0
PATCH v2 10/12 ARM: dts: rockchip: add vpu node for RK3036
In reply to Alex BeeAdd the vpu node and the node for the attached iommu for RK3036.
---
Changes in v2:
- added missing patch
arch/arm/boot/dts/rk3036.dtsi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
arch/arm/boot/dts/rk3036.dtsi +21 -0
@@ -117,6 +117,27 @@ gpu: gpu@10090000 { status = "disabled"; }; + vpu: video-codec@10108000 { + compatible = "rockchip,rk3036-vpu"; + reg = <0x10108000 0x800>; + interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "vdpu"; + clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>; + clock-names = "aclk", "hclk"; + iommus = <&vpu_mmu>; + power-domains = <&power RK3036_PD_VPU>; + }; + + vpu_mmu: iommu@10108800 { + compatible = "rockchip,iommu"; + reg = <0x10108800 0x100>; + interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru ACLK_VCODEC>, <&cru HCLK_VCODEC>; + clock-names = "aclk", "iface"; + power-domains = <&power RK3036_PD_VPU>; + #iommu-cells = <0>; + }; + vop: vop@10118000 { compatible = "rockchip,rk3036-vop"; reg = <0x10118000 0x19c>;
Signature · 1 line
2.27.0
PATCH v2 11/12 ARM: dts: rockchip: add vpu nodes for RK3066 and RK3188
In reply to Alex BeeAdd the vpu node to the common rk3xxx.dtsi and only the powerdomain property to the SoC specific device trees.
---
(no changes since v1)
arch/arm/boot/dts/rk3066a.dtsi | 4 ++++ arch/arm/boot/dts/rk3188.dtsi | 5 +++++ arch/arm/boot/dts/rk3xxx.dtsi | 12 ++++++++++++ 3 files changed, 21 insertions(+)
arch/arm/boot/dts/rk3066a.dtsi +4 -0
@@ -869,6 +869,10 @@ &uart3 { pinctrl-0 = <&uart3_xfer>; }; +&vpu { + power-domains = <&power RK3066_PD_VIDEO>; +}; + &wdt { compatible = "rockchip,rk3066-wdt", "snps,dw-wdt"; };
arch/arm/boot/dts/rk3188.dtsi +5 -0
@@ -802,6 +802,11 @@ &uart3 { pinctrl-0 = <&uart3_xfer>; }; +&vpu { + compatible = "rockchip,rk3188-vpu", "rockchip,rk3066-vpu"; + power-domains = <&power RK3188_PD_VIDEO>; +}; + &wdt { compatible = "rockchip,rk3188-wdt", "snps,dw-wdt"; };
arch/arm/boot/dts/rk3xxx.dtsi +12 -0
@@ -50,6 +50,18 @@ gpu: gpu@10090000 { status = "disabled"; }; + vpu: video-codec@10104000 { + compatible = "rockchip,rk3066-vpu"; + reg = <0x10104000 0x800>; + interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "vepu", "vdpu"; + clocks = <&cru ACLK_VDPU>, <&cru HCLK_VDPU>, + <&cru ACLK_VEPU>, <&cru HCLK_VEPU>; + clock-names = "aclk_vdpu", "hclk_vdpu", + "aclk_vepu", "hclk_vepu"; + }; + L2: cache-controller@10138000 { compatible = "arm,pl310-cache"; reg = <0x10138000 0x1000>;
Signature · 1 line
2.27.0
PATCH v2 12/12 ARM: dts: rockchip: add vpu and vdec node for RK322x
In reply to Alex BeeThe VPU and the VDEC IP block of RK322x are the same as RK3399 has and the drivers can be used as-is.
Add the respective nodes to the device tree.
---
Changes in v2:
- squashed previously 2 commits for vdec/vpu
- moved power-domains property after iommu property
arch/arm/boot/dts/rk322x.dtsi | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
arch/arm/boot/dts/rk322x.dtsi +25 -2
@@ -612,6 +612,18 @@ gpu: gpu@20000000 { status = "disabled"; }; + vpu: video-codec@20020000 { + compatible = "rockchip,rk3228-vpu", "rockchip,rk3399-vpu"; + reg = <0x20020000 0x800>; + interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "vepu", "vdpu"; + clocks = <&cru ACLK_VPU>, <&cru HCLK_VPU>; + clock-names = "aclk", "hclk"; + iommus = <&vpu_mmu>; + power-domains = <&power RK3228_PD_VPU>; + }; + vpu_mmu: iommu@20020800 { compatible = "rockchip,iommu"; reg = <0x20020800 0x100>;
@@ -620,7 +632,19 @@ vpu_mmu: iommu@20020800 { clock-names = "aclk", "iface"; power-domains = <&power RK3228_PD_VPU>; #iommu-cells = <0>; - status = "disabled"; + }; + + vdec: video-codec@20030000 { + compatible = "rockchip,rk3228-vdec", "rockchip,rk3399-vdec"; + reg = <0x20030000 0x480>; + interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru ACLK_RKVDEC>, <&cru HCLK_RKVDEC>, + <&cru SCLK_VDEC_CABAC>, <&cru SCLK_VDEC_CORE>; + clock-names = "axi", "ahb", "cabac", "core"; + assigned-clocks = <&cru SCLK_VDEC_CABAC>, <&cru SCLK_VDEC_CORE>; + assigned-clock-rates = <300000000>, <300000000>; + iommus = <&vdec_mmu>; + power-domains = <&power RK3228_PD_RKVDEC>; }; vdec_mmu: iommu@20030480 {
@@ -631,7 +655,6 @@ vdec_mmu: iommu@20030480 { clock-names = "aclk", "iface"; power-domains = <&power RK3228_PD_RKVDEC>; #iommu-cells = <0>; - status = "disabled"; }; vop: vop@20050000 {
Signature · 1 line
2.27.0
Re: (subset) [PATCH v2 00/12] Add support for older Rockchip SoCs to V4L2 hantro and rkvdec drivers
In reply to Alex BeeQuoted 11 lines · Alex Bee
this series adds support for older Rockchip SoCs (RK3036, RK3066, RK3188 and RK322x) to the existing V4L2 video decoder/-encoder drivers - namely hantro and rkvdec.
They can be used as-is or with very little modifications.In preparation to that patches 1,8 and 9 add power-controller support for RK3036 and RK322x, since both drivers rely on pm. The drivers for them exist already in the common Rockchip pm driver, they just haven't be added to the device trees yet.
[...]
Removed some unnecessary added empty lines and
Applied, thanks!
[08/12] ARM: dts: rockchip: add power controller for RK3036
commit: 1a4eb37f3174d3a54e40392abcfbb9b3949948bb
[09/12] ARM: dts: rockchip: add power controller for RK322x
commit: 623ba75a5d6b8e196a21f3ed36d26a5f6db459ceBest regards,
Signature · 1 line
Heiko Stuebner <[email protected]>
Hi Alex,
Quoted 23 lines · Alex Bee
Hi list,
this series adds support for older Rockchip SoCs (RK3036, RK3066, RK3188 and RK322x) to the existing V4L2 video decoder/-encoder drivers - namely hantro and rkvdec.
They can be used as-is or with very little modifications.In preparation to that patches 1,8 and 9 add power-controller support for RK3036 and RK322x, since both drivers rely on pm. The drivers for them exist already in the common Rockchip pm driver, they just haven't be added to the device trees yet.
Changes in v2:
- reordered patches as suggested by Heiko
- fixed indentation and order issues in dt-bindings / DT patches
- added patch to reorder variants in hantro alphanumeric
- added patch that merges hantro platform drivers for Rockchip in one
- added missing DT patch for RK3036 (missed to submit with v1) See individual patches for details about changes.Thanks for your feedback,
Alex.
Quoted 13 lines
Alex Bee (12):
dt-bindings: mfd: syscon: add Rockchip RK3036/RK3228 qos compatibles
dt-bindings: media: rockchip-vpu: add new compatibles
dt-bindings: media: rockchip-vdec: add RK3228 compatible
media: hantro: reorder variants
media: hantro: merge Rockchip platform drivers
media: hantro: add support for Rockchip RK3066
media: hantro: add support for Rockchip RK3036
ARM: dts: rockchip: add power controller for RK3036
ARM: dts: rockchip: add power controller for RK322x
ARM: dts: rockchip: add vpu node for RK3036
ARM: dts: rockchip: add vpu nodes for RK3066 and RK3188
ARM: dts: rockchip: add vpu and vdec node for RK322x
Unfortunately this series no longer applies. Support for the G2/HEVC decoder was merged, and that conflicts with this series.
It is best to rebase you series to the master branch of the media_stage tree (https://git.linuxtv.org/media_stage.git/log/), which contains that series. I expect/hope that this will be merged later this week to the regular media_tree master branch, so you can wait for that as well.
Regards,
Hans
Quoted 29 lines
.../bindings/media/rockchip,vdec.yaml | 10 +-
.../bindings/media/rockchip-vpu.yaml | 33 +-
.../devicetree/bindings/mfd/syscon.yaml | 2 +
arch/arm/boot/dts/rk3036.dtsi | 72 +++
arch/arm/boot/dts/rk3066a.dtsi | 4 +
arch/arm/boot/dts/rk3188.dtsi | 5 +
arch/arm/boot/dts/rk322x.dtsi | 140 ++++-
arch/arm/boot/dts/rk3xxx.dtsi | 12 +
drivers/staging/media/hantro/Makefile | 9 +-
drivers/staging/media/hantro/hantro_drv.c | 6 +-
drivers/staging/media/hantro/hantro_hw.h | 30 +-
drivers/staging/media/hantro/rk3288_vpu_hw.c | 208 -------
drivers/staging/media/hantro/rk3399_vpu_hw.c | 222 --------
...jpeg_enc.c => rockchip_vpu2_hw_jpeg_enc.c} | 30 +-
...eg2_dec.c => rockchip_vpu2_hw_mpeg2_dec.c} | 25 +-
...w_vp8_dec.c => rockchip_vpu2_hw_vp8_dec.c} | 2 +-
...rk3399_vpu_regs.h => rockchip_vpu2_regs.h} | 6 +-
.../staging/media/hantro/rockchip_vpu_hw.c | 526 ++++++++++++++++++
18 files changed, 848 insertions(+), 494 deletions(-)
delete mode 100644 drivers/staging/media/hantro/rk3288_vpu_hw.c
delete mode 100644 drivers/staging/media/hantro/rk3399_vpu_hw.c
rename drivers/staging/media/hantro/{rk3399_vpu_hw_jpeg_enc.c => rockchip_vpu2_hw_jpeg_enc.c} (87%)
rename drivers/staging/media/hantro/{rk3399_vpu_hw_mpeg2_dec.c => rockchip_vpu2_hw_mpeg2_dec.c} (93%)
rename drivers/staging/media/hantro/{rk3399_vpu_hw_vp8_dec.c => rockchip_vpu2_hw_vp8_dec.c} (99%)
rename drivers/staging/media/hantro/{rk3399_vpu_regs.h => rockchip_vpu2_regs.h} (99%)
create mode 100644 drivers/staging/media/hantro/rockchip_vpu_hw.cQuoted 2 lines
base-commit:
5d765451c2409e63563fa6a3e8005bd03ab9e82f
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Quoted 40 lines · Hans Verkuil
Hi Alex,
Quoted 23 lines · Alex Bee
Hi list,
this series adds support for older Rockchip SoCs (RK3036, RK3066, RK3188 and RK322x) to the existing V4L2 video decoder/-encoder drivers - namely hantro and rkvdec.
They can be used as-is or with very little modifications.In preparation to that patches 1,8 and 9 add power-controller support for RK3036 and RK322x, since both drivers rely on pm. The drivers for them exist already in the common Rockchip pm driver, they just haven't be added to the device trees yet.
Changes in v2:
- reordered patches as suggested by Heiko
- fixed indentation and order issues in dt-bindings / DT patches
- added patch to reorder variants in hantro alphanumeric
- added patch that merges hantro platform drivers for Rockchip in one
- added missing DT patch for RK3036 (missed to submit with v1) See individual patches for details about changes.Thanks for your feedback,
Alex.Quoted 13 lines
Alex Bee (12):
dt-bindings: mfd: syscon: add Rockchip RK3036/RK3228 qos compatibles
dt-bindings: media: rockchip-vpu: add new compatibles
dt-bindings: media: rockchip-vdec: add RK3228 compatible
media: hantro: reorder variants
media: hantro: merge Rockchip platform drivers
media: hantro: add support for Rockchip RK3066
media: hantro: add support for Rockchip RK3036
ARM: dts: rockchip: add power controller for RK3036
ARM: dts: rockchip: add power controller for RK322x
ARM: dts: rockchip: add vpu node for RK3036
ARM: dts: rockchip: add vpu nodes for RK3066 and RK3188
ARM: dts: rockchip: add vpu and vdec node for RK322x
Quoted 7 lines
Unfortunately this series no longer applies. Support for the G2/HEVC decoder was merged, and that conflicts with this series.
It is best to rebase you series to the master branch of the
media_stagetree (https://git.linuxtv.org/media_stage.git/log/), which contains that series. I expect/hope that this will be merged later this week to the regularmedia_treemaster branch, so you can wait for that as well.
Ah, it just got merged to media_tree master. So just base your series on that branch.
Regards,
Hans
Quoted 37 lines
Regards,
Hans
Quoted 31 lines
.../bindings/media/rockchip,vdec.yaml | 10 +- .../bindings/media/rockchip-vpu.yaml | 33 +- .../devicetree/bindings/mfd/syscon.yaml | 2 + arch/arm/boot/dts/rk3036.dtsi | 72 +++ arch/arm/boot/dts/rk3066a.dtsi | 4 + arch/arm/boot/dts/rk3188.dtsi | 5 + arch/arm/boot/dts/rk322x.dtsi | 140 ++++- arch/arm/boot/dts/rk3xxx.dtsi | 12 + drivers/staging/media/hantro/Makefile | 9 +- drivers/staging/media/hantro/hantro_drv.c | 6 +- drivers/staging/media/hantro/hantro_hw.h | 30 +- drivers/staging/media/hantro/rk3288_vpu_hw.c | 208 ------- drivers/staging/media/hantro/rk3399_vpu_hw.c | 222 -------- ...jpeg_enc.c => rockchip_vpu2_hw_jpeg_enc.c} | 30 +- ...eg2_dec.c => rockchip_vpu2_hw_mpeg2_dec.c} | 25 +- ...w_vp8_dec.c => rockchip_vpu2_hw_vp8_dec.c} | 2 +- ...rk3399_vpu_regs.h => rockchip_vpu2_regs.h} | 6 +- .../staging/media/hantro/rockchip_vpu_hw.c | 526 ++++++++++++++++++ 18 files changed, 848 insertions(+), 494 deletions(-) delete mode 100644 drivers/staging/media/hantro/rk3288_vpu_hw.c delete mode 100644 drivers/staging/media/hantro/rk3399_vpu_hw.c rename drivers/staging/media/hantro/{rk3399_vpu_hw_jpeg_enc.c => rockchip_vpu2_hw_jpeg_enc.c} (87%) rename drivers/staging/media/hantro/{rk3399_vpu_hw_mpeg2_dec.c => rockchip_vpu2_hw_mpeg2_dec.c} (93%) rename drivers/staging/media/hantro/{rk3399_vpu_hw_vp8_dec.c => rockchip_vpu2_hw_vp8_dec.c} (99%) rename drivers/staging/media/hantro/{rk3399_vpu_regs.h => rockchip_vpu2_regs.h} (99%) create mode 100644 drivers/staging/media/hantro/rockchip_vpu_hw.cbase-commit:
5d765451c2409e63563fa6a3e8005bd03ab9e82f
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Re: (subset) [PATCH v2 00/12] Add support for older Rockchip SoCs to V4L2 hantro and rkvdec drivers
In reply to Alex BeeQuoted 11 lines · Alex Bee
this series adds support for older Rockchip SoCs (RK3036, RK3066, RK3188 and RK322x) to the existing V4L2 video decoder/-encoder drivers - namely hantro and rkvdec.
They can be used as-is or with very little modifications.In preparation to that patches 1,8 and 9 add power-controller support for RK3036 and RK322x, since both drivers rely on pm. The drivers for them exist already in the common Rockchip pm driver, they just haven't be added to the device trees yet.
[...]
Applied, thanks!
[10/12] ARM: dts: rockchip: add vpu node for RK3036
commit: 9d34d4aa896d00d398d799caa839a1494ba7c018
[11/12] ARM: dts: rockchip: add vpu nodes for RK3066 and RK3188
commit: db3fc8fa0fcfa481cd8087c2ee068d1d1988c3a2
[12/12] ARM: dts: rockchip: add vpu and vdec node for RK322x
commit: 36e9534dfcb5b09b919d2831d6a19aa3856b95a1Best regards,
Signature · 1 line
Heiko Stuebner <[email protected]>
v3 cover Add support for older Rockchip SoCs to V4L2 hantro and rkvdec drivers
In reply to Alex BeeHi list,
this is v3 of series, that adds support for older Rockchip SoCs (RK3036, RK3066, RK3188 and RK322x) to the existing V4L2 video decoder/-encoder drivers - namely hantro and rkvdec.
They can be used as-is or with very little modifications.
In preparation to that previous versions added power-controller support for RK3036 and RK322x, since both drivers rely on pm. The drivers for them exist already in the common Rockchip pm driver, they just haven't been added to the device trees yet.
Those patches have been applied already.
This is a basically a rebase of the patches that should get merged in media_tree.
Please pick the DT patches, which are not applied yet from v2.
Changes in v3:
- rebased on current media_tree
- collected Reviewd-tags from v2
Changes in v2:
- reordered patches as suggested by Heiko
- fixed indentation and order issues in dt-bindings / DT patches
- added patch to reorder variants in hantro alphanumeric
- added patch that merges hantro platform drivers for Rockchip in one
- added missing DT patch for RK3036 (missed to submit with v1)
See individual patches for details about changes.
Thanks for your feedback,
Alex.
Alex Bee (6):
dt-bindings: media: rockchip-vpu: add new compatibles
dt-bindings: media: rockchip-vdec: add RK3228 compatible
media: hantro: reorder variants
media: hantro: merge Rockchip platform drivers
media: hantro: add support for Rockchip RK3066
media: hantro: add support for Rockchip RK3036
.../bindings/media/rockchip,vdec.yaml | 10 +-
.../bindings/media/rockchip-vpu.yaml | 33 +-
drivers/staging/media/hantro/Makefile | 9 +-
drivers/staging/media/hantro/hantro_drv.c | 6 +-
drivers/staging/media/hantro/hantro_hw.h | 32 +-
drivers/staging/media/hantro/rk3288_vpu_hw.c | 208 -------
drivers/staging/media/hantro/rk3399_vpu_hw.c | 222 --------
...jpeg_enc.c => rockchip_vpu2_hw_jpeg_enc.c} | 30 +-
...eg2_dec.c => rockchip_vpu2_hw_mpeg2_dec.c} | 25 +-
...w_vp8_dec.c => rockchip_vpu2_hw_vp8_dec.c} | 2 +-
...rk3399_vpu_regs.h => rockchip_vpu2_regs.h} | 6 +-
.../staging/media/hantro/rockchip_vpu_hw.c | 526 ++++++++++++++++++
12 files changed, 616 insertions(+), 493 deletions(-)
delete mode 100644 drivers/staging/media/hantro/rk3288_vpu_hw.c
delete mode 100644 drivers/staging/media/hantro/rk3399_vpu_hw.c
rename drivers/staging/media/hantro/{rk3399_vpu_hw_jpeg_enc.c => rockchip_vpu2_hw_jpeg_enc.c} (87%)
rename drivers/staging/media/hantro/{rk3399_vpu_hw_mpeg2_dec.c => rockchip_vpu2_hw_mpeg2_dec.c} (94%)
rename drivers/staging/media/hantro/{rk3399_vpu_hw_vp8_dec.c => rockchip_vpu2_hw_vp8_dec.c} (99%)
rename drivers/staging/media/hantro/{rk3399_vpu_regs.h => rockchip_vpu2_regs.h} (99%)
create mode 100644 drivers/staging/media/hantro/rockchip_vpu_hw.cbase-commit: 45040f675041956ad763f9ef139ecee3647aa8bb
Signature · 1 line
2.27.0
PATCH v3 1/6 dt-bindings: media: rockchip-vpu: add new compatibles
Add compatibles for RK3036, RK3066, RK3188 and RK3228. Also reflect the changes to the additional clocks for RK3066/RK3188.
---
Changes in v3:
- collect Reviewed-Tag
Changes in v2:
- fix order
- fix indentation
.../bindings/media/rockchip-vpu.yaml | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/media/rockchip-vpu.yaml +25 -8
@@ -15,10 +15,19 @@ description: properties: compatible: - enum: - - rockchip,rk3288-vpu - - rockchip,rk3328-vpu - - rockchip,rk3399-vpu + oneOf: + - enum: + - rockchip,rk3036-vpu + - rockchip,rk3066-vpu + - rockchip,rk3288-vpu + - rockchip,rk3328-vpu + - rockchip,rk3399-vpu + - items: + - const: rockchip,rk3188-vpu + - const: rockchip,rk3066-vpu + - items: + - const: rockchip,rk3228-vpu + - const: rockchip,rk3399-vpu reg: maxItems: 1
@@ -35,12 +44,20 @@ properties: - const: vdpu clocks: - maxItems: 2 + oneOf: + - maxItems: 2 + - maxItems: 4 clock-names: - items: - - const: aclk - - const: hclk + oneOf: + - items: + - const: aclk + - const: hclk + - items: + - const: aclk_vdpu + - const: hclk_vdpu + - const: aclk_vepu + - const: hclk_vepu power-domains: maxItems: 1
Signature · 7 lines
2.27.0 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v3 2/6 dt-bindings: media: rockchip-vdec: add RK3228 compatible
In reply to Alex BeeDocument the RK3228 compatible for rockchip-vdec. Also add the optional assigned-clocks and assigned-clock-rates properties.
---
Changes in v3:
- collect Reviewed-tag
Changes in v2:
- fix indentation
.../devicetree/bindings/media/rockchip,vdec.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/media/rockchip,vdec.yaml +9 -1
@@ -15,7 +15,11 @@ description: |- properties: compatible: - const: rockchip,rk3399-vdec + oneOf: + - const: rockchip,rk3399-vdec + - items: + - const: rockchip,rk3228-vdec + - const: rockchip,rk3399-vdec reg: maxItems: 1
@@ -37,6 +41,10 @@ properties: - const: cabac - const: core + assigned-clocks: true + + assigned-clock-rates: true + power-domains: maxItems: 1
Signature · 7 lines
2.27.0 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v3 3/6 media: hantro: reorder variants
In reply to Alex BeeReorder variants in hantro driver alphanumeric.
---
Changes in v3:
- collect Reviewed-Tag
Changes in v2:
- added patch
drivers/staging/media/hantro/hantro_drv.c | 4 ++-- drivers/staging/media/hantro/hantro_hw.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/media/hantro/hantro_drv.c +2 -2
@@ -582,9 +582,9 @@ static const struct v4l2_file_operations hantro_fops = {static const struct of_device_id of_hantro_match[] = { #ifdef CONFIG_VIDEO_HANTRO_ROCKCHIP - { .compatible ="rockchip,rk3399-vpu" , .data = &rk3399_vpu_variant, }, - { .compatible ="rockchip,rk3328-vpu" , .data = &rk3328_vpu_variant, }, { .compatible ="rockchip,rk3288-vpu" , .data = &rk3288_vpu_variant, }, + { .compatible ="rockchip,rk3328-vpu" , .data = &rk3328_vpu_variant, }, + { .compatible ="rockchip,rk3399-vpu" , .data = &rk3399_vpu_variant, }, #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mq-vpu", .data = &imx8mq_vpu_variant, },
drivers/staging/media/hantro/hantro_hw.h +4 -4
@@ -203,12 +203,12 @@ enum hantro_enc_fmt { RK3288_VPU_ENC_FMT_UYVY422 = 3, }; -extern const struct hantro_variant rk3399_vpu_variant; -extern const struct hantro_variant rk3328_vpu_variant; -extern const struct hantro_variant rk3288_vpu_variant; +extern const struct hantro_variant imx8mq_vpu_g2_variant;extern const struct hantro_variant imx8mq_vpu_variant; +extern const struct hantro_variant rk3288_vpu_variant; +extern const struct hantro_variant rk3328_vpu_variant; +extern const struct hantro_variant rk3399_vpu_variant;extern const struct hantro_variant sama5d4_vdec_variant; -extern const struct hantro_variant imx8mq_vpu_g2_variant;extern const struct hantro_postproc_regs hantro_g1_postproc_regs;
Signature · 7 lines
2.27.0 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH v3 4/6 media: hantro: merge Rockchip platform drivers
In reply to Alex BeeMerge the two Rockchip platform drivers into one as it was suggested at
[1] and [2].
This will hopefully make it easier to add new variants (which are surely to come for Rockchip).
Also rename from "rk3288" to "v(d/e)pu1" and "rk3399" to "v(d/e)pu2" where applicable, as this is the dicition the vendor uses and will also refelect the variants that get added later in this series. Rename from "rk3288" to "rockchip" if applicable to both hardware versions.
[1] https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/
[2] https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/
---
Changes in v3:
- fix typo: rockchip_vpdu2_irqs -> rockchip_vdpu2_irqs
- collect Reviewed-Tag
Changes in v2:
- added patch
drivers/staging/media/hantro/Makefile | 9 +-
drivers/staging/media/hantro/hantro_hw.h | 22 +-
drivers/staging/media/hantro/rk3288_vpu_hw.c | 208 ----------
drivers/staging/media/hantro/rk3399_vpu_hw.c | 222 -----------
...jpeg_enc.c => rockchip_vpu2_hw_jpeg_enc.c} | 30 +-
...eg2_dec.c => rockchip_vpu2_hw_mpeg2_dec.c} | 25 +-
...w_vp8_dec.c => rockchip_vpu2_hw_vp8_dec.c} | 2 +-
...rk3399_vpu_regs.h => rockchip_vpu2_regs.h} | 6 +-
.../staging/media/hantro/rockchip_vpu_hw.c | 356 ++++++++++++++++++
9 files changed, 402 insertions(+), 478 deletions(-)
delete mode 100644 drivers/staging/media/hantro/rk3288_vpu_hw.c
delete mode 100644 drivers/staging/media/hantro/rk3399_vpu_hw.c
rename drivers/staging/media/hantro/{rk3399_vpu_hw_jpeg_enc.c => rockchip_vpu2_hw_jpeg_enc.c} (87%)
rename drivers/staging/media/hantro/{rk3399_vpu_hw_mpeg2_dec.c => rockchip_vpu2_hw_mpeg2_dec.c} (94%)
rename drivers/staging/media/hantro/{rk3399_vpu_hw_vp8_dec.c => rockchip_vpu2_hw_vp8_dec.c} (99%)
rename drivers/staging/media/hantro/{rk3399_vpu_regs.h => rockchip_vpu2_regs.h} (99%)
create mode 100644 drivers/staging/media/hantro/rockchip_vpu_hw.cdrivers/staging/media/hantro/Makefile +4 -5
@@ -12,9 +12,9 @@ hantro-vpu-y += \ hantro_g1_mpeg2_dec.o \ hantro_g2_hevc_dec.o \ hantro_g1_vp8_dec.o \ - rk3399_vpu_hw_jpeg_enc.o \ - rk3399_vpu_hw_mpeg2_dec.o \ - rk3399_vpu_hw_vp8_dec.o \ + rockchip_vpu2_hw_jpeg_enc.o \ + rockchip_vpu2_hw_mpeg2_dec.o \ + rockchip_vpu2_hw_vp8_dec.o \ hantro_jpeg.o \ hantro_h264.o \ hantro_hevc.o \
@@ -28,5 +28,4 @@ hantro-vpu-$(CONFIG_VIDEO_HANTRO_SAMA5D4) += \ sama5d4_vdec_hw.o hantro-vpu-$(CONFIG_VIDEO_HANTRO_ROCKCHIP) += \ - rk3288_vpu_hw.o \ - rk3399_vpu_hw.o + rockchip_vpu_hw.o
drivers/staging/media/hantro/hantro_hw.h +11 -11
@@ -191,16 +191,16 @@ struct hantro_codec_ops {/** * enum hantro_enc_fmt - source format ID for hardware registers. * -* @RK3288_VPU_ENC_FMT_YUV420P: Y/CbCr 4:2:0 planar format -* @RK3288_VPU_ENC_FMT_YUV420SP: Y/CbCr 4:2:0 semi-planar format -* @RK3288_VPU_ENC_FMT_YUYV422: YUV 4:2:2 packed format (YUYV) -* @RK3288_VPU_ENC_FMT_UYVY422: YUV 4:2:2 packed format (UYVY) +* @ROCKCHIP_VPU_ENC_FMT_YUV420P: Y/CbCr 4:2:0 planar format +* @ROCKCHIP_VPU_ENC_FMT_YUV420SP: Y/CbCr 4:2:0 semi-planar format +* @ROCKCHIP_VPU_ENC_FMT_YUYV422: YUV 4:2:2 packed format (YUYV) +* @ROCKCHIP_VPU_ENC_FMT_UYVY422: YUV 4:2:2 packed format (UYVY) */ enum hantro_enc_fmt { -RK3288_VPU_ENC_FMT_YUV420P =0 , -RK3288_VPU_ENC_FMT_YUV420SP =1 , -RK3288_VPU_ENC_FMT_YUYV422 =2 , -RK3288_VPU_ENC_FMT_UYVY422 =3 , +ROCKCHIP_VPU_ENC_FMT_YUV420P =0 , +ROCKCHIP_VPU_ENC_FMT_YUV420SP =1 , +ROCKCHIP_VPU_ENC_FMT_YUYV422 =2 , +ROCKCHIP_VPU_ENC_FMT_UYVY422 =3 , };extern const struct hantro_variant imx8mq_vpu_g2_variant;
@@ -225,7 +225,7 @@ irqreturn_t hantro_g1_irq(int irq, void *dev_id);void hantro_g1_reset (struct hantro_ctx *ctx);int hantro_h1_jpeg_enc_run (struct hantro_ctx *ctx); -int rk3399_vpu_jpeg_enc_run (struct hantro_ctx *ctx); +int rockchip_vpu2_jpeg_enc_run (struct hantro_ctx *ctx);int hantro_jpeg_enc_init (struct hantro_ctx *ctx);void hantro_jpeg_enc_exit (struct hantro_ctx *ctx);void hantro_jpeg_enc_done (struct hantro_ctx *ctx);
@@ -274,14 +274,14 @@ hantro_h264_mv_size(unsigned int width, unsigned int height) }int hantro_g1_mpeg2_dec_run (struct hantro_ctx *ctx); -int rk3399_vpu_mpeg2_dec_run (struct hantro_ctx *ctx); +int rockchip_vpu2_mpeg2_dec_run (struct hantro_ctx *ctx);void hantro_mpeg2_dec_copy_qtable (u8 *qtable,const struct v4l2_ctrl_mpeg2_quantisation *ctrl);int hantro_mpeg2_dec_init (struct hantro_ctx *ctx);void hantro_mpeg2_dec_exit (struct hantro_ctx *ctx);int hantro_g1_vp8_dec_run (struct hantro_ctx *ctx); -int rk3399_vpu_vp8_dec_run (struct hantro_ctx *ctx); +int rockchip_vpu2_vp8_dec_run (struct hantro_ctx *ctx);int hantro_vp8_dec_init (struct hantro_ctx *ctx);void hantro_vp8_dec_exit (struct hantro_ctx *ctx); void hantro_vp8_prob_update(struct hantro_ctx *ctx,
drivers/staging/media/hantro/rk3288_vpu_hw.c deleted +0 -208
208 lines not on this page · raw message
drivers/staging/media/hantro/rk3399_vpu_hw.c deleted +0 -222
222 lines not on this page · raw message
drivers/staging/media/hantro/rockchip_vpu2_hw_jpeg_enc.c renamed from drivers/staging/media/hantro/rk3399_vpu_hw_jpeg_enc.c +15 -15
@@ -28,12 +28,12 @@#include "hantro.h" #include "hantro_v4l2.h" #include "hantro_hw.h" -#include "rk3399_vpu_regs.h" +#include "rockchip_vpu2_regs.h" #define VEPU_JPEG_QUANT_TABLE_COUNT 16 -static void rk3399_vpu_set_src_img_ctrl (struct hantro_dev *vpu, -struct hantro_ctx *ctx) +static void rockchip_vpu2_set_src_img_ctrl (struct hantro_dev *vpu, +struct hantro_ctx *ctx) {struct v4l2_pix_format_mplane *pix_fmt = &ctx->src_fmt;u32 reg;
@@ -59,9 +59,9 @@ static void rk3399_vpu_set_src_img_ctrl(struct hantro_dev *vpu,vepu_write_relaxed (vpu, reg,VEPU_REG_ENC_CTRL1 ); } -static void rk3399_vpu_jpeg_enc_set_buffers (struct hantro_dev *vpu, -struct hantro_ctx *ctx, -struct vb2_buffer *src_buf) +static void rockchip_vpu2_jpeg_enc_set_buffers (struct hantro_dev *vpu, +struct hantro_ctx *ctx, +struct vb2_buffer *src_buf) {struct v4l2_pix_format_mplane *pix_fmt = &ctx->src_fmt;dma_addr_t src[3 ];
@@ -92,9 +92,9 @@ static void rk3399_vpu_jpeg_enc_set_buffers(struct hantro_dev *vpu, }static void -rk3399_vpu_jpeg_enc_set_qtable (struct hantro_dev *vpu, -unsigned char *luma_qtable, -unsigned char *chroma_qtable) +rockchip_vpu2_jpeg_enc_set_qtable (struct hantro_dev *vpu, +unsigned char *luma_qtable, +unsigned char *chroma_qtable) {u32 reg, i;__be32 *luma_qtable_p;
@@ -118,7 +118,7 @@ rk3399_vpu_jpeg_enc_set_qtable(struct hantro_dev *vpu, } } -int rk3399_vpu_jpeg_enc_run (struct hantro_ctx *ctx) +int rockchip_vpu2_jpeg_enc_run (struct hantro_ctx *ctx) {struct hantro_dev *vpu = ctx->dev;struct vb2_v4l2_buffer *src_buf, *dst_buf;
@@ -141,11 +141,11 @@ int rk3399_vpu_jpeg_enc_run(struct hantro_ctx *ctx)vepu_write_relaxed (vpu,VEPU_REG_ENCODE_FORMAT_JPEG ,VEPU_REG_ENCODE_START ); -rk3399_vpu_set_src_img_ctrl (vpu, ctx); -rk3399_vpu_jpeg_enc_set_buffers (vpu, ctx, &src_buf->vb2_buf); -rk3399_vpu_jpeg_enc_set_qtable (vpu, -hantro_jpeg_get_qtable (0 ), -hantro_jpeg_get_qtable (1 )); +rockchip_vpu2_set_src_img_ctrl (vpu, ctx); +rockchip_vpu2_jpeg_enc_set_buffers (vpu, ctx, &src_buf->vb2_buf); +rockchip_vpu2_jpeg_enc_set_qtable (vpu, +hantro_jpeg_get_qtable (0 ), +hantro_jpeg_get_qtable (1 )); reg =VEPU_REG_OUTPUT_SWAP32 |VEPU_REG_OUTPUT_SWAP16
drivers/staging/media/hantro/rockchip_vpu2_hw_mpeg2_dec.c renamed from drivers/staging/media/hantro/rk3399_vpu_hw_mpeg2_dec.c +12 -13
@@ -80,8 +80,8 @@#define VDPU_REG_MV_ACCURACY_BWD (v) ((v) ? BIT(1) : 0)static void -rk3399_vpu_mpeg2_dec_set_quantisation (struct hantro_dev *vpu, -struct hantro_ctx *ctx) +rockchip_vpu2_mpeg2_dec_set_quantisation (struct hantro_dev *vpu, +struct hantro_ctx *ctx) {struct v4l2_ctrl_mpeg2_quantisation *q;
@@ -91,12 +91,12 @@ rk3399_vpu_mpeg2_dec_set_quantisation(struct hantro_dev *vpu, }static void -rk3399_vpu_mpeg2_dec_set_buffers (struct hantro_dev *vpu, -struct hantro_ctx *ctx, -struct vb2_buffer *src_buf, -struct vb2_buffer *dst_buf, -const struct v4l2_ctrl_mpeg2_sequence *seq, -const struct v4l2_ctrl_mpeg2_picture *pic) +rockchip_vpu2_mpeg2_dec_set_buffers (struct hantro_dev *vpu, +struct hantro_ctx *ctx, +struct vb2_buffer *src_buf, +struct vb2_buffer *dst_buf, +const struct v4l2_ctrl_mpeg2_sequence *seq, +const struct v4l2_ctrl_mpeg2_picture *pic) {dma_addr_t forward_addr =0 , backward_addr =0 ;dma_addr_t current_addr, addr;
@@ -148,7 +148,7 @@ rk3399_vpu_mpeg2_dec_set_buffers(struct hantro_dev *vpu,vdpu_write_relaxed (vpu, backward_addr,VDPU_REG_REFER3_BASE ); } -int rk3399_vpu_mpeg2_dec_run (struct hantro_ctx *ctx) +int rockchip_vpu2_mpeg2_dec_run (struct hantro_ctx *ctx) {struct hantro_dev *vpu = ctx->dev;struct vb2_v4l2_buffer *src_buf, *dst_buf;
@@ -233,11 +233,10 @@ int rk3399_vpu_mpeg2_dec_run(struct hantro_ctx *ctx)VDPU_REG_MV_ACCURACY_BWD (1 );vdpu_write_relaxed (vpu, reg,VDPU_SWREG (136 )); -rk3399_vpu_mpeg2_dec_set_quantisation (vpu, ctx); +rockchip_vpu2_mpeg2_dec_set_quantisation (vpu, ctx); -rk3399_vpu_mpeg2_dec_set_buffers (vpu, ctx, &src_buf->vb2_buf, - &dst_buf->vb2_buf, - seq, pic); +rockchip_vpu2_mpeg2_dec_set_buffers (vpu, ctx, &src_buf->vb2_buf, + &dst_buf->vb2_buf, seq, pic);/* Kick the watchdog and start decoding */ hantro_end_prepare_run (ctx);
drivers/staging/media/hantro/rockchip_vpu2_hw_vp8_dec.c renamed from drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c +1 -1
@@ -503,7 +503,7 @@ static void cfg_buffers(struct hantro_ctx *ctx,vdpu_write_relaxed (vpu, dst_dma,VDPU_REG_ADDR_DST ); } -int rk3399_vpu_vp8_dec_run (struct hantro_ctx *ctx) +int rockchip_vpu2_vp8_dec_run (struct hantro_ctx *ctx) {const struct v4l2_ctrl_vp8_frame *hdr;struct hantro_dev *vpu = ctx->dev;
drivers/staging/media/hantro/rockchip_vpu2_regs.h renamed from drivers/staging/media/hantro/rk3399_vpu_regs.h +3 -3
@@ -6,8 +6,8 @@* Alpha Lin <[email protected]> */ -#ifndef RK3399_VPU_REGS_H_ -#define RK3399_VPU_REGS_H_ +#ifndef ROCKCHIP_VPU2_REGS_H_ +#define ROCKCHIP_VPU2_REGS_H_ /* Encoder registers. */ #define VEPU_REG_VP8_QUT_1ST (i) (0x000 + ((i) * 0x24))
@@ -597,4 +597,4 @@#define VDPU_REG_PRED_FLT_PRED_BC_TAP_4_3 (x) (((x) & 0x3ff) << 12)#define VDPU_REG_PRED_FLT_PRED_BC_TAP_5_0 (x) (((x) & 0x3ff) << 2) -#endif /* RK3399_VPU_REGS_H_ */ +#endif /* ROCKCHIP_VPU2_REGS_H_ */
drivers/staging/media/hantro/rockchip_vpu_hw.c new file +356 -0
356 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v3 5/6 media: hantro: add support for Rockchip RK3066
In reply to Alex BeeRK3066's VPU IP block is the predecessor from what RK3288 has. The hardware differences are:
- supports decoding frame sizes up to 1920x1088 only
- doesn't have the 'G1_REG_SOFT_RESET' register (requires another .reset callback for hantro_codec_ops, since writing this register will result in non-working IP block)
- has one ACLK/HCLK per vdpu/vepu
- ACLKs can be clocked up to 300 MHz only
- no MMU
(no changes required: CMA will be transparently used)
Add a new RK3066 variant which reflect this differences. This variant can be used for RK3188 as well.
---
Changes in v3:
- rename rk3066_clk_names -> rk3066_vpu_clk_names
- collect Reviewed-tag
Changes in v2:
- fixed wrong index in clk array for vepu clock in rk3066_vpu_hw_init
- added comment, why this variant can't be splitted in g1/h1 variants
drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 + .../staging/media/hantro/rockchip_vpu_hw.c | 121 ++++++++++++++++++ 3 files changed, 123 insertions(+)
drivers/staging/media/hantro/hantro_drv.c +1 -0
@@ -582,6 +582,7 @@ static const struct v4l2_file_operations hantro_fops = {static const struct of_device_id of_hantro_match[] = { #ifdef CONFIG_VIDEO_HANTRO_ROCKCHIP + { .compatible ="rockchip,rk3066-vpu" , .data = &rk3066_vpu_variant, }, { .compatible ="rockchip,rk3288-vpu" , .data = &rk3288_vpu_variant, }, { .compatible ="rockchip,rk3328-vpu" , .data = &rk3328_vpu_variant, }, { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, },
drivers/staging/media/hantro/hantro_hw.h +1 -0
@@ -205,6 +205,7 @@ enum hantro_enc_fmt {extern const struct hantro_variant imx8mq_vpu_g2_variant;extern const struct hantro_variant imx8mq_vpu_variant; +extern const struct hantro_variant rk3066_vpu_variant;extern const struct hantro_variant rk3288_vpu_variant;extern const struct hantro_variant rk3328_vpu_variant;extern const struct hantro_variant rk3399_vpu_variant;
drivers/staging/media/hantro/rockchip_vpu_hw.c +121 -0
164 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v3 6/6 media: hantro: add support for Rockchip RK3036
In reply to Alex BeeRK3036's VPU IP block is the same as RK3288 has, except that it doesn't have an encoder, decoding is supported up to 1920x1088 only and the axi clock can be set to 300 MHz max.
Add a new RK3036 variant which reflects these differences.
---
Changes in v3:
- collect Reviewed-tag
Changes in v2:
- rename rk3036_irqs -> rockchip_vdpu1_irqs
- fix spelling error
drivers/staging/media/hantro/hantro_drv.c | 1 + drivers/staging/media/hantro/hantro_hw.h | 1 + .../staging/media/hantro/rockchip_vpu_hw.c | 49 +++++++++++++++++++ 3 files changed, 51 insertions(+)
drivers/staging/media/hantro/hantro_drv.c +1 -0
@@ -582,6 +582,7 @@ static const struct v4l2_file_operations hantro_fops = {static const struct of_device_id of_hantro_match[] = { #ifdef CONFIG_VIDEO_HANTRO_ROCKCHIP + { .compatible ="rockchip,rk3036-vpu" , .data = &rk3036_vpu_variant, }, { .compatible ="rockchip,rk3066-vpu" , .data = &rk3066_vpu_variant, }, { .compatible ="rockchip,rk3288-vpu" , .data = &rk3288_vpu_variant, }, { .compatible = "rockchip,rk3328-vpu", .data = &rk3328_vpu_variant, },
drivers/staging/media/hantro/hantro_hw.h +1 -0
@@ -205,6 +205,7 @@ enum hantro_enc_fmt {extern const struct hantro_variant imx8mq_vpu_g2_variant;extern const struct hantro_variant imx8mq_vpu_variant; +extern const struct hantro_variant rk3036_vpu_variant;extern const struct hantro_variant rk3066_vpu_variant;extern const struct hantro_variant rk3288_vpu_variant;extern const struct hantro_variant rk3328_vpu_variant;
drivers/staging/media/hantro/rockchip_vpu_hw.c +49 -0
73 lines not on this page · raw message
Signature · 1 line
2.27.0