mbox series

[0/8] media: sunxi: Add DE2 rotate driver

Message ID 20200124232014.574989-1-jernej.skrabec@siol.net (mailing list archive)
Headers show
Series media: sunxi: Add DE2 rotate driver | expand

Message

Jernej Škrabec Jan. 24, 2020, 11:20 p.m. UTC
Some of Allwinner SoCs like A83T and A64 SoCs contain DE2 rotate core
which can flip image horizontal and vertical and rotate it in 90 deg.
steps. It support a lot of output formats, but a bit less capture
formats. All YUV input formats get converted to yuv420p, while RGB
formats are preserved.

Patches 1-2 fix few issues with DE2 clocks.

Patches 3-4 fix register range of DE2 clocks (it would overlap with
rotate driver)

Patches 5-8 provide binding, implement driver and add nodes.

v4l2-compliance SHA: ec55a961487b449bedbe07650674b4965814cf07, 32 bits, 32-bit time_t

Compliance test for sun8i-rotate device /dev/video0:

Driver Info:
        Driver name      : sun8i-rotate
        Card type        : sun8i-rotate
        Bus info         : platform:sun8i-rotate
        Driver version   : 5.5.0
        Capabilities     : 0x84208000
                Video Memory-to-Memory
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04208000
                Video Memory-to-Memory
                Streaming
                Extended Pix Format

Required ioctls:
        test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
        test second /dev/video0 open: OK
        test VIDIOC_QUERYCAP: OK
        test VIDIOC_G/S_PRIORITY: OK
        test for unlimited opens: OK

        test invalid ioctls: OK
Debug ioctls:
        test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
        test VIDIOC_LOG_STATUS: OK

Input ioctls:
        test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
        test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
        test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
        test VIDIOC_ENUMAUDIO: OK (Not Supported)
        test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
        test VIDIOC_G/S_AUDIO: OK (Not Supported)
        Inputs: 0 Audio Inputs: 0 Tuners: 0

Output ioctls:
        test VIDIOC_G/S_MODULATOR: OK (Not Supported)
        test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
        test VIDIOC_ENUMAUDOUT: OK (Not Supported)
        test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
        test VIDIOC_G/S_AUDOUT: OK (Not Supported)
        Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
        test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
        test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
        test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
        test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls:
        test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
        test VIDIOC_QUERYCTRL: OK
        test VIDIOC_G/S_CTRL: OK
        test VIDIOC_G/S/TRY_EXT_CTRLS: OK
        test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
        test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
        Standard Controls: 4 Private Controls: 0

Format ioctls:
        test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
        test VIDIOC_G/S_PARM: OK (Not Supported)
        test VIDIOC_G_FBUF: OK (Not Supported)
        test VIDIOC_G_FMT: OK
        test VIDIOC_TRY_FMT: OK
        test VIDIOC_S_FMT: OK
        test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
        test Cropping: OK (Not Supported)
        test Composing: OK (Not Supported)
        test Scaling: OK (Not Supported)

Codec ioctls:
        test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
        test VIDIOC_G_ENC_INDEX: OK (Not Supported)
        test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
        test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
        test VIDIOC_EXPBUF: OK
        test Requests: OK (Not Supported)

Total for sun8i-rotate device /dev/video0: 45, Succeeded: 45, Failed: 0, Warnings: 0

Best regards,
Jernej

Jernej Skrabec (8):
  clk: sunxi-ng: sun8i-de2: Swap A64 and H6 definitions
  clk: sunxi-ng: sun8i-de2: Fix A83T clocks and reset
  ARM: dts: sunxi: Fix DE2 clocks register range
  arm64: dts: allwinner: a64: Fix display clock register range
  media: dt-bindings: media: Add Allwinner A83T Rotate driver
  media: sun8i: Add Allwinner A83T Rotate driver
  ARM: dts: sun8i: a83t: Add device node for rotation core
  arm64: dts: allwinner: a64: add node for rotation core

 .../allwinner,sun8i-a83t-de2-rotate.yaml      |  70 ++
 MAINTAINERS                                   |   8 +
 arch/arm/boot/dts/sun8i-a83t.dtsi             |  13 +-
 arch/arm/boot/dts/sun8i-r40.dtsi              |   2 +-
 arch/arm/boot/dts/sun8i-v3s.dtsi              |   2 +-
 arch/arm/boot/dts/sunxi-h3-h5.dtsi            |   2 +-
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |  14 +-
 drivers/clk/sunxi-ng/ccu-sun8i-de2.c          |  49 +-
 drivers/media/platform/Kconfig                |  12 +
 drivers/media/platform/sunxi/Makefile         |   1 +
 .../platform/sunxi/sun8i-rotate/Makefile      |   2 +
 .../sunxi/sun8i-rotate/sun8i-formats.c        | 273 ++++++
 .../sunxi/sun8i-rotate/sun8i-formats.h        |  25 +
 .../sunxi/sun8i-rotate/sun8i-rotate.c         | 924 ++++++++++++++++++
 .../sunxi/sun8i-rotate/sun8i-rotate.h         | 135 +++
 15 files changed, 1512 insertions(+), 20 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/allwinner,sun8i-a83t-de2-rotate.yaml
 create mode 100644 drivers/media/platform/sunxi/sun8i-rotate/Makefile
 create mode 100644 drivers/media/platform/sunxi/sun8i-rotate/sun8i-formats.c
 create mode 100644 drivers/media/platform/sunxi/sun8i-rotate/sun8i-formats.h
 create mode 100644 drivers/media/platform/sunxi/sun8i-rotate/sun8i-rotate.c
 create mode 100644 drivers/media/platform/sunxi/sun8i-rotate/sun8i-rotate.h

Comments

Jernej Škrabec Feb. 11, 2020, 7:12 p.m. UTC | #1
Dne sobota, 25. januar 2020 ob 00:20:06 CET je Jernej Skrabec napisal(a):
> Some of Allwinner SoCs like A83T and A64 SoCs contain DE2 rotate core
> which can flip image horizontal and vertical and rotate it in 90 deg.
> steps. It support a lot of output formats, but a bit less capture
> formats. All YUV input formats get converted to yuv420p, while RGB
> formats are preserved.
> 
> Patches 1-2 fix few issues with DE2 clocks.
> 
> Patches 3-4 fix register range of DE2 clocks (it would overlap with
> rotate driver)
> 
> Patches 5-8 provide binding, implement driver and add nodes.
> 
> v4l2-compliance SHA: ec55a961487b449bedbe07650674b4965814cf07, 32 bits,
> 32-bit time_t
> 
> Compliance test for sun8i-rotate device /dev/video0:
> 
> Driver Info:
>         Driver name      : sun8i-rotate
>         Card type        : sun8i-rotate
>         Bus info         : platform:sun8i-rotate
>         Driver version   : 5.5.0
>         Capabilities     : 0x84208000
>                 Video Memory-to-Memory
>                 Streaming
>                 Extended Pix Format
>                 Device Capabilities
>         Device Caps      : 0x04208000
>                 Video Memory-to-Memory
>                 Streaming
>                 Extended Pix Format
> 
> Required ioctls:
>         test VIDIOC_QUERYCAP: OK
> 
> Allow for multiple opens:
>         test second /dev/video0 open: OK
>         test VIDIOC_QUERYCAP: OK
>         test VIDIOC_G/S_PRIORITY: OK
>         test for unlimited opens: OK
> 
>         test invalid ioctls: OK
> Debug ioctls:
>         test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
>         test VIDIOC_LOG_STATUS: OK
> 
> Input ioctls:
>         test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
>         test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
>         test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
>         test VIDIOC_ENUMAUDIO: OK (Not Supported)
>         test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
>         test VIDIOC_G/S_AUDIO: OK (Not Supported)
>         Inputs: 0 Audio Inputs: 0 Tuners: 0
> 
> Output ioctls:
>         test VIDIOC_G/S_MODULATOR: OK (Not Supported)
>         test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
>         test VIDIOC_ENUMAUDOUT: OK (Not Supported)
>         test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
>         test VIDIOC_G/S_AUDOUT: OK (Not Supported)
>         Outputs: 0 Audio Outputs: 0 Modulators: 0
> 
> Input/Output configuration ioctls:
>         test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
>         test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
>         test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
>         test VIDIOC_G/S_EDID: OK (Not Supported)
> 
> Control ioctls:
>         test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
>         test VIDIOC_QUERYCTRL: OK
>         test VIDIOC_G/S_CTRL: OK
>         test VIDIOC_G/S/TRY_EXT_CTRLS: OK
>         test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
>         test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
>         Standard Controls: 4 Private Controls: 0
> 
> Format ioctls:
>         test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
>         test VIDIOC_G/S_PARM: OK (Not Supported)
>         test VIDIOC_G_FBUF: OK (Not Supported)
>         test VIDIOC_G_FMT: OK
>         test VIDIOC_TRY_FMT: OK
>         test VIDIOC_S_FMT: OK
>         test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
>         test Cropping: OK (Not Supported)
>         test Composing: OK (Not Supported)
>         test Scaling: OK (Not Supported)
> 
> Codec ioctls:
>         test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
>         test VIDIOC_G_ENC_INDEX: OK (Not Supported)
>         test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
> 
> Buffer ioctls:
>         test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
>         test VIDIOC_EXPBUF: OK
>         test Requests: OK (Not Supported)
> 
> Total for sun8i-rotate device /dev/video0: 45, Succeeded: 45, Failed: 0,
> Warnings: 0
> 
> Best regards,
> Jernej
> 
> Jernej Skrabec (8):
>   clk: sunxi-ng: sun8i-de2: Swap A64 and H6 definitions
>   clk: sunxi-ng: sun8i-de2: Fix A83T clocks and reset

Please disregard above two patches. It turns out that many more changes are 
required to fix mess with rotation clocks and reset. I sent separate patch 
series: http://lists.infradead.org/pipermail/linux-arm-kernel/2020-February/
710242.html

Comments on the rest of the series are welcome, though.

Best regards,
Jernej

>   ARM: dts: sunxi: Fix DE2 clocks register range
>   arm64: dts: allwinner: a64: Fix display clock register range
>   media: dt-bindings: media: Add Allwinner A83T Rotate driver
>   media: sun8i: Add Allwinner A83T Rotate driver
>   ARM: dts: sun8i: a83t: Add device node for rotation core
>   arm64: dts: allwinner: a64: add node for rotation core
> 
>  .../allwinner,sun8i-a83t-de2-rotate.yaml      |  70 ++
>  MAINTAINERS                                   |   8 +
>  arch/arm/boot/dts/sun8i-a83t.dtsi             |  13 +-
>  arch/arm/boot/dts/sun8i-r40.dtsi              |   2 +-
>  arch/arm/boot/dts/sun8i-v3s.dtsi              |   2 +-
>  arch/arm/boot/dts/sunxi-h3-h5.dtsi            |   2 +-
>  arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |  14 +-
>  drivers/clk/sunxi-ng/ccu-sun8i-de2.c          |  49 +-
>  drivers/media/platform/Kconfig                |  12 +
>  drivers/media/platform/sunxi/Makefile         |   1 +
>  .../platform/sunxi/sun8i-rotate/Makefile      |   2 +
>  .../sunxi/sun8i-rotate/sun8i-formats.c        | 273 ++++++
>  .../sunxi/sun8i-rotate/sun8i-formats.h        |  25 +
>  .../sunxi/sun8i-rotate/sun8i-rotate.c         | 924 ++++++++++++++++++
>  .../sunxi/sun8i-rotate/sun8i-rotate.h         | 135 +++
>  15 files changed, 1512 insertions(+), 20 deletions(-)
>  create mode 100644
> Documentation/devicetree/bindings/media/allwinner,sun8i-a83t-de2-rotate.yam
> l create mode 100644 drivers/media/platform/sunxi/sun8i-rotate/Makefile
> create mode 100644
> drivers/media/platform/sunxi/sun8i-rotate/sun8i-formats.c create mode
> 100644 drivers/media/platform/sunxi/sun8i-rotate/sun8i-formats.h create
> mode 100644 drivers/media/platform/sunxi/sun8i-rotate/sun8i-rotate.c create
> mode 100644 drivers/media/platform/sunxi/sun8i-rotate/sun8i-rotate.h
Chen-Yu Tsai March 12, 2020, 5:31 a.m. UTC | #2
On Wed, Feb 12, 2020 at 3:13 AM Jernej Škrabec <jernej.skrabec@gmail.com> wrote:
>
> Dne sobota, 25. januar 2020 ob 00:20:06 CET je Jernej Skrabec napisal(a):
> > Some of Allwinner SoCs like A83T and A64 SoCs contain DE2 rotate core
> > which can flip image horizontal and vertical and rotate it in 90 deg.
> > steps. It support a lot of output formats, but a bit less capture
> > formats. All YUV input formats get converted to yuv420p, while RGB
> > formats are preserved.
> >
> > Patches 1-2 fix few issues with DE2 clocks.
> >
> > Patches 3-4 fix register range of DE2 clocks (it would overlap with
> > rotate driver)
> >
> > Patches 5-8 provide binding, implement driver and add nodes.
> >
> > v4l2-compliance SHA: ec55a961487b449bedbe07650674b4965814cf07, 32 bits,
> > 32-bit time_t
> >
> > Compliance test for sun8i-rotate device /dev/video0:
> >
> > Driver Info:
> >         Driver name      : sun8i-rotate
> >         Card type        : sun8i-rotate
> >         Bus info         : platform:sun8i-rotate
> >         Driver version   : 5.5.0
> >         Capabilities     : 0x84208000
> >                 Video Memory-to-Memory
> >                 Streaming
> >                 Extended Pix Format
> >                 Device Capabilities
> >         Device Caps      : 0x04208000
> >                 Video Memory-to-Memory
> >                 Streaming
> >                 Extended Pix Format
> >
> > Required ioctls:
> >         test VIDIOC_QUERYCAP: OK
> >
> > Allow for multiple opens:
> >         test second /dev/video0 open: OK
> >         test VIDIOC_QUERYCAP: OK
> >         test VIDIOC_G/S_PRIORITY: OK
> >         test for unlimited opens: OK
> >
> >         test invalid ioctls: OK
> > Debug ioctls:
> >         test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
> >         test VIDIOC_LOG_STATUS: OK
> >
> > Input ioctls:
> >         test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
> >         test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
> >         test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
> >         test VIDIOC_ENUMAUDIO: OK (Not Supported)
> >         test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
> >         test VIDIOC_G/S_AUDIO: OK (Not Supported)
> >         Inputs: 0 Audio Inputs: 0 Tuners: 0
> >
> > Output ioctls:
> >         test VIDIOC_G/S_MODULATOR: OK (Not Supported)
> >         test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
> >         test VIDIOC_ENUMAUDOUT: OK (Not Supported)
> >         test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
> >         test VIDIOC_G/S_AUDOUT: OK (Not Supported)
> >         Outputs: 0 Audio Outputs: 0 Modulators: 0
> >
> > Input/Output configuration ioctls:
> >         test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
> >         test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
> >         test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
> >         test VIDIOC_G/S_EDID: OK (Not Supported)
> >
> > Control ioctls:
> >         test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK
> >         test VIDIOC_QUERYCTRL: OK
> >         test VIDIOC_G/S_CTRL: OK
> >         test VIDIOC_G/S/TRY_EXT_CTRLS: OK
> >         test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
> >         test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
> >         Standard Controls: 4 Private Controls: 0
> >
> > Format ioctls:
> >         test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
> >         test VIDIOC_G/S_PARM: OK (Not Supported)
> >         test VIDIOC_G_FBUF: OK (Not Supported)
> >         test VIDIOC_G_FMT: OK
> >         test VIDIOC_TRY_FMT: OK
> >         test VIDIOC_S_FMT: OK
> >         test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
> >         test Cropping: OK (Not Supported)
> >         test Composing: OK (Not Supported)
> >         test Scaling: OK (Not Supported)
> >
> > Codec ioctls:
> >         test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
> >         test VIDIOC_G_ENC_INDEX: OK (Not Supported)
> >         test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
> >
> > Buffer ioctls:
> >         test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
> >         test VIDIOC_EXPBUF: OK
> >         test Requests: OK (Not Supported)
> >
> > Total for sun8i-rotate device /dev/video0: 45, Succeeded: 45, Failed: 0,
> > Warnings: 0
> >
> > Best regards,
> > Jernej
> >
> > Jernej Skrabec (8):
> >   clk: sunxi-ng: sun8i-de2: Swap A64 and H6 definitions
> >   clk: sunxi-ng: sun8i-de2: Fix A83T clocks and reset
>
> Please disregard above two patches. It turns out that many more changes are
> required to fix mess with rotation clocks and reset. I sent separate patch
> series: http://lists.infradead.org/pipermail/linux-arm-kernel/2020-February/
> 710242.html
>
> Comments on the rest of the series are welcome, though.
>
> Best regards,
> Jernej
>
> >   ARM: dts: sunxi: Fix DE2 clocks register range
> >   arm64: dts: allwinner: a64: Fix display clock register range
> >   media: dt-bindings: media: Add Allwinner A83T Rotate driver
> >   media: sun8i: Add Allwinner A83T Rotate driver
> >   ARM: dts: sun8i: a83t: Add device node for rotation core
> >   arm64: dts: allwinner: a64: add node for rotation core

Merged the DTS patches for 5.7.

ChenYu

> >  .../allwinner,sun8i-a83t-de2-rotate.yaml      |  70 ++
> >  MAINTAINERS                                   |   8 +
> >  arch/arm/boot/dts/sun8i-a83t.dtsi             |  13 +-
> >  arch/arm/boot/dts/sun8i-r40.dtsi              |   2 +-
> >  arch/arm/boot/dts/sun8i-v3s.dtsi              |   2 +-
> >  arch/arm/boot/dts/sunxi-h3-h5.dtsi            |   2 +-
> >  arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |  14 +-
> >  drivers/clk/sunxi-ng/ccu-sun8i-de2.c          |  49 +-
> >  drivers/media/platform/Kconfig                |  12 +
> >  drivers/media/platform/sunxi/Makefile         |   1 +
> >  .../platform/sunxi/sun8i-rotate/Makefile      |   2 +
> >  .../sunxi/sun8i-rotate/sun8i-formats.c        | 273 ++++++
> >  .../sunxi/sun8i-rotate/sun8i-formats.h        |  25 +
> >  .../sunxi/sun8i-rotate/sun8i-rotate.c         | 924 ++++++++++++++++++
> >  .../sunxi/sun8i-rotate/sun8i-rotate.h         | 135 +++
> >  15 files changed, 1512 insertions(+), 20 deletions(-)
> >  create mode 100644
> > Documentation/devicetree/bindings/media/allwinner,sun8i-a83t-de2-rotate.yam
> > l create mode 100644 drivers/media/platform/sunxi/sun8i-rotate/Makefile
> > create mode 100644
> > drivers/media/platform/sunxi/sun8i-rotate/sun8i-formats.c create mode
> > 100644 drivers/media/platform/sunxi/sun8i-rotate/sun8i-formats.h create
> > mode 100644 drivers/media/platform/sunxi/sun8i-rotate/sun8i-rotate.c create
> > mode 100644 drivers/media/platform/sunxi/sun8i-rotate/sun8i-rotate.h
>
>
>
>