Message ID | 20220508202544.501981-1-frattaroli.nicolas@gmail.com |
---|---|
State | New |
Headers | show |
On Montag, 9. Mai 2022 09:25:23 CEST Krzysztof Kozlowski wrote: > On 08/05/2022 22:25, Nicolas Frattaroli wrote: > > The RK3568 and RK3566 have a Hantro VPU node solely dedicated to > > encoding. This patch adds a compatible for it, and also allows > > the bindings to only come with a vepu interrupt. > > > > Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com> > > --- > > Documentation/devicetree/bindings/media/rockchip-vpu.yaml | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml > > index bacb60a34989..4045f107ca4e 100644 > > --- a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml > > +++ b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml > > @@ -22,6 +22,7 @@ properties: > > - rockchip,rk3288-vpu > > - rockchip,rk3328-vpu > > - rockchip,rk3399-vpu > > + - rockchip,rk3568-vepu > > - rockchip,px30-vpu > > - items: > > - const: rockchip,rk3188-vpu > > @@ -40,6 +41,7 @@ properties: > > interrupt-names: > > oneOf: > > - const: vdpu > > + - const: vepu > > This should be enum (for both lines above) and you should add > allOf:if:then with a constraints which variant can have which interrupts. > > > Best regards, > Krzysztof > So something like this? interrupt-names: oneOf: - enum: - vdpu - vepu - items: - const: vepu - const: vdpu What's the difference between a list of consts and an enum here? I'm not very familiar with dt-schema, my apologies. Also, since I don't know which of the other variants can have the encoding interrupt and this wasn't brought up until now, I think my solution will be to have a check for -vepu in the compatible and in that case require that only the vepu interrupt is present, if that's alright with you. Regards, Nicolas Frattaroli
On 09/05/2022 11:24, Nicolas Frattaroli wrote: > On Montag, 9. Mai 2022 09:25:23 CEST Krzysztof Kozlowski wrote: >> On 08/05/2022 22:25, Nicolas Frattaroli wrote: >>> The RK3568 and RK3566 have a Hantro VPU node solely dedicated to >>> encoding. This patch adds a compatible for it, and also allows >>> the bindings to only come with a vepu interrupt. >>> >>> Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com> >>> --- >>> Documentation/devicetree/bindings/media/rockchip-vpu.yaml | 2 ++ >>> 1 file changed, 2 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml >>> index bacb60a34989..4045f107ca4e 100644 >>> --- a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml >>> +++ b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml >>> @@ -22,6 +22,7 @@ properties: >>> - rockchip,rk3288-vpu >>> - rockchip,rk3328-vpu >>> - rockchip,rk3399-vpu >>> + - rockchip,rk3568-vepu >>> - rockchip,px30-vpu >>> - items: >>> - const: rockchip,rk3188-vpu >>> @@ -40,6 +41,7 @@ properties: >>> interrupt-names: >>> oneOf: >>> - const: vdpu >>> + - const: vepu >> >> This should be enum (for both lines above) and you should add >> allOf:if:then with a constraints which variant can have which interrupts. >> >> >> Best regards, >> Krzysztof >> > > So something like this? > > interrupt-names: > oneOf: > - enum: > - vdpu > - vepu > - items: > - const: vepu > - const: vdpu Yes > > What's the difference between a list of consts and an enum here? > I'm not very familiar with dt-schema, my apologies. The effect is the same, just oneOf is a bit more complicated way to describe it. > > Also, since I don't know which of the other variants can have > the encoding interrupt and this wasn't brought up until now, I think > my solution will be to have a check for -vepu in the compatible and in > that case require that only the vepu interrupt is present, if that's > alright with you. If you meant by adding a "if" case for only rockchip,rk3568-vepu, it's ok. Best regards, Krzysztof
diff --git a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml index cd62b44c34c3..4045f107ca4e 100644 --- a/Documentation/devicetree/bindings/media/rockchip-vpu.yaml +++ b/Documentation/devicetree/bindings/media/rockchip-vpu.yaml @@ -22,7 +22,7 @@ properties: - rockchip,rk3288-vpu - rockchip,rk3328-vpu - rockchip,rk3399-vpu - - rockchip,rk3568-jpeg-vepu + - rockchip,rk3568-vepu - rockchip,px30-vpu - items: - const: rockchip,rk3188-vpu diff --git a/arch/arm64/boot/dts/rockchip/rk356x.dtsi b/arch/arm64/boot/dts/rockchip/rk356x.dtsi index 276b76d5f3fb..2e3c9e1887e3 100644 --- a/arch/arm64/boot/dts/rockchip/rk356x.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk356x.dtsi @@ -508,18 +508,18 @@ gpu: gpu@fde60000 { status = "disabled"; }; - vepu_jpeg: video-codec@fdee0000 { - compatible = "rockchip,rk3568-jpeg-vepu"; + vepu: video-codec@fdee0000 { + compatible = "rockchip,rk3568-vepu"; reg = <0x0 0xfdee0000 0x0 0x800>; interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "vepu"; clocks = <&cru ACLK_JENC>, <&cru HCLK_JENC>; clock-names = "aclk", "hclk"; - iommus = <&vepu_jpeg_mmu>; + iommus = <&vepu_mmu>; power-domains = <&power RK3568_PD_RGA>; }; - vepu_jpeg_mmu: iommu@fdee0800 { + vepu_mmu: iommu@fdee0800 { compatible = "rockchip,rk3568-iommu"; reg = <0x0 0xfdee0800 0x0 0x40>; interrupts = <GIC_SPI 63 IRQ_TYPE_LEVEL_HIGH>; diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index 3add9babd7bb..0b38b41136e2 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -628,7 +628,7 @@ static const struct of_device_id of_hantro_match[] = { { .compatible = "rockchip,rk3288-vpu", .data = &rk3288_vpu_variant, }, { .compatible = "rockchip,rk3328-vpu", .data = &rk3328_vpu_variant, }, { .compatible = "rockchip,rk3399-vpu", .data = &rk3399_vpu_variant, }, - { .compatible = "rockchip,rk3568-jpeg-vepu", .data = &rk3568_jpeg_vepu_variant, }, + { .compatible = "rockchip,rk3568-vepu", .data = &rk3568_vepu_variant, }, #endif #ifdef CONFIG_VIDEO_HANTRO_IMX8M { .compatible = "nxp,imx8mm-vpu-g1", .data = &imx8mm_vpu_g1_variant, }, diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h index dd7f1edfacf2..b312da654d38 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -300,7 +300,7 @@ 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; -extern const struct hantro_variant rk3568_jpeg_vepu_variant; +extern const struct hantro_variant rk3568_vepu_variant; extern const struct hantro_variant sama5d4_vdec_variant; extern const struct hantro_variant sunxi_vpu_variant; diff --git a/drivers/staging/media/hantro/rockchip_vpu_hw.c b/drivers/staging/media/hantro/rockchip_vpu_hw.c index 10d3ea92a954..a97a4ea8ede4 100644 --- a/drivers/staging/media/hantro/rockchip_vpu_hw.c +++ b/drivers/staging/media/hantro/rockchip_vpu_hw.c @@ -204,43 +204,6 @@ static const struct hantro_fmt rk3399_vpu_dec_fmts[] = { }, }; -static const struct hantro_fmt rk3568_jpeg_vepu_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 irqreturn_t rockchip_vpu1_vepu_irq(int irq, void *dev_id) { struct hantro_dev *vpu = dev_id; @@ -484,7 +447,7 @@ static const struct hantro_irq rockchip_vpu2_irqs[] = { { "vdpu", rockchip_vpu2_vdpu_irq }, }; -static const struct hantro_irq rk3568_jpeg_vepu_irqs[] = { +static const struct hantro_irq rk3568_vepu_irqs[] = { { "vepu", rockchip_vpu2_vepu_irq }, }; @@ -594,14 +557,14 @@ const struct hantro_variant rk3399_vpu_variant = { .num_clocks = ARRAY_SIZE(rockchip_vpu_clk_names) }; -const struct hantro_variant rk3568_jpeg_vepu_variant = { +const struct hantro_variant rk3568_vepu_variant = { .enc_offset = 0x0, - .enc_fmts = rk3568_jpeg_vepu_enc_fmts, - .num_enc_fmts = ARRAY_SIZE(rk3568_jpeg_vepu_enc_fmts), + .enc_fmts = rockchip_vpu_enc_fmts, + .num_enc_fmts = ARRAY_SIZE(rockchip_vpu_enc_fmts), .codec = HANTRO_JPEG_ENCODER, .codec_ops = rk3568_jpeg_enc_codec_ops, - .irqs = rk3568_jpeg_vepu_irqs, - .num_irqs = ARRAY_SIZE(rk3568_jpeg_vepu_irqs), + .irqs = rk3568_vepu_irqs, + .num_irqs = ARRAY_SIZE(rk3568_vepu_irqs), .init = rockchip_vpu_hw_init, .clk_names = rockchip_vpu_clk_names, .num_clocks = ARRAY_SIZE(rockchip_vpu_clk_names)