Add V4L2 driver for i.MX8 JPEG Encoder/Decoder
v3 cover Add V4L2 driver for i.MX8 JPEG Encoder/Decoder
Changes in v3:
Add a 6th patch to update the MAINTAINERS file with an entry for this driver.
This patch set adds the V4L2 driver for i.MX8QXP/QM JPEG encoder/decoder and it's dependencies.
The driver was tested on i.MX8QXP, using a unit test application and the v4l2-compliance tool, including the streaming tests for encoder.
Mirela Rabulea (6):
media: v4l: Add packed YUV444 24bpp pixel format
firmware: imx: scu-pd: Add power domains for imx-jpeg
media: dt-bindings: Add bindings for i.MX8QXP/QM JPEG driver
media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder
arm64: dts: imx8qxp: Add jpeg encoder/decoder nodes Add maintainer for IMX jpeg v4l2 driver
.../devicetree/bindings/media/imx8-jpeg.yaml | 83 + Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst | 37 +- MAINTAINERS | 8 + arch/arm64/boot/dts/freescale/imx8qxp-mek.dts | 8 + arch/arm64/boot/dts/freescale/imx8qxp.dtsi | 37 + drivers/firmware/imx/scu-pd.c | 6 + drivers/media/platform/Kconfig | 2 + drivers/media/platform/Makefile | 1 + drivers/media/platform/imx-jpeg/Kconfig | 10 + drivers/media/platform/imx-jpeg/Makefile | 3 + drivers/media/platform/imx-jpeg/mxc-jpeg-hw.c | 168 ++ drivers/media/platform/imx-jpeg/mxc-jpeg-hw.h | 140 ++ drivers/media/platform/imx-jpeg/mxc-jpeg.c | 2293 ++++++++++++++++++++ drivers/media/platform/imx-jpeg/mxc-jpeg.h | 188 ++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 16 files changed, 2985 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/media/imx8-jpeg.yaml create mode 100644 drivers/media/platform/imx-jpeg/Kconfig create mode 100644 drivers/media/platform/imx-jpeg/Makefile create mode 100644 drivers/media/platform/imx-jpeg/mxc-jpeg-hw.c create mode 100644 drivers/media/platform/imx-jpeg/mxc-jpeg-hw.h create mode 100644 drivers/media/platform/imx-jpeg/mxc-jpeg.c create mode 100644 drivers/media/platform/imx-jpeg/mxc-jpeg.h
Signature · 1 line
2.7.4
PATCH v3 1/6 media: v4l: Add packed YUV444 24bpp pixel format
The added format is V4L2_PIX_FMT_YUV24, this is a packed YUV 4:4:4 format, with 8 bits for each component, 24 bits per sample.
This format is used by the i.MX 8QuadMax and i.MX 8DualXPlus/8QuadXPlus JPEG encoder/decoder.
--- Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst | 37 +++++++++++++++++++++- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 38 insertions(+), 1 deletion(-)
Documentation/media/uapi/v4l/pixfmt-packed-yuv.rst +36 -1
@@ -17,7 +17,8 @@ Description =========== Similar to the packed RGB formats these formats store the Y, Cb and Cr -component of each pixel in one 16 or 32 bit word. +component of each pixel next to each other in memory. They occupy 16, 24 or 32 +bits per pixel. .. raw:: latex
@@ -157,6 +158,40 @@ component of each pixel in one 16 or 32 bit word. - :cspan:`15` + * .. _V4L2-PIX-FMT-YUV24: + + - ``V4L2_PIX_FMT_YUV24`` + - 'YUV3' + + - Y'\ :sub:`7` + - Y'\ :sub:`6` + - Y'\ :sub:`5` + - Y'\ :sub:`4` + - Y'\ :sub:`3` + - Y'\ :sub:`2` + - Y'\ :sub:`1` + - Y'\ :sub:`0` + + - Cb\ :sub:`7` + - Cb\ :sub:`6` + - Cb\ :sub:`5` + - Cb\ :sub:`4` + - Cb\ :sub:`3` + - Cb\ :sub:`2` + - Cb\ :sub:`1` + - Cb\ :sub:`0` + + - Cr\ :sub:`7` + - Cr\ :sub:`6` + - Cr\ :sub:`5` + - Cr\ :sub:`4` + - Cr\ :sub:`3` + - Cr\ :sub:`2` + - Cr\ :sub:`1` + - Cr\ :sub:`0` + + - :cspan:`7` + * .. _V4L2-PIX-FMT-YUV32: - ``V4L2_PIX_FMT_YUV32``
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1246,6 +1246,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_YUV444 : descr ="16-bit A/XYUV 4-4-4-4" ;break ;case V4L2_PIX_FMT_YUV555 : descr ="16-bit A/XYUV 1-5-5-5" ;break ;case V4L2_PIX_FMT_YUV565 : descr ="16-bit YUV 5-6-5" ;break ; +case V4L2_PIX_FMT_YUV24 : descr ="24-bit YUV 4:4:4 8-8-8" ;break ;case V4L2_PIX_FMT_YUV32 : descr ="32-bit A/XYUV 8-8-8-8" ;break ;case V4L2_PIX_FMT_AYUV32 : descr ="32-bit AYUV 8-8-8-8" ;break ;case V4L2_PIX_FMT_XYUV32 : descr ="32-bit XYUV 8-8-8-8" ;break ;
include/uapi/linux/videodev2.h +1 -0
@@ -588,6 +588,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4')/* 16 xxxxyyyy uuuuvvvv */ #define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O')/* 16 YUV-5-5-5 */ #define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P')/* 16 YUV-5-6-5 */ +#define V4L2_PIX_FMT_YUV24 v4l2_fourcc('Y', 'U', 'V', '3')/* 24 YUV-8-8-8 */ #define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4')/* 32 YUV-8-8-8-8 */ #define V4L2_PIX_FMT_AYUV32 v4l2_fourcc('A', 'Y', 'U', 'V')/* 32 AYUV-8-8-8-8 */ #define V4L2_PIX_FMT_XYUV32 v4l2_fourcc('X', 'Y', 'U', 'V')/* 32 XYUV-8-8-8-8 */
Signature · 1 line
2.7.4
PATCH v3 2/6 firmware: imx: scu-pd: Add power domains for imx-jpeg
In reply to Mirela RabuleaThe power domains are for imx8qxp/imx8qm JPEG encoder & decoder. Each has 4 slots and a wrapper.
--- drivers/firmware/imx/scu-pd.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/firmware/imx/scu-pd.c +6 -0
@@ -158,6 +158,12 @@ static const struct imx_sc_pd_range imx8qxp_scu_pd_ranges[] = {/* DC SS */ { "dc0", IMX_SC_R_DC_0, 1, false, 0 }, { "dc0-pll", IMX_SC_R_DC_0_PLL_0, 2, true, 0 }, + +/* IMAGE SS */ + { "img-jpegdec-mp", IMX_SC_R_MJPEG_DEC_MP, 1, false, 0 }, + { "img-jpegdec-s0", IMX_SC_R_MJPEG_DEC_S0, 4, true, 0 }, + { "img-jpegenc-mp", IMX_SC_R_MJPEG_ENC_MP, 1, false, 0 }, + { "img-jpegenc-s0", IMX_SC_R_MJPEG_ENC_S0, 4, true, 0 }, }; static const struct imx_sc_pd_soc imx8qxp_scu_pd = {
Signature · 1 line
2.7.4
PATCH v3 3/6 media: dt-bindings: Add bindings for i.MX8QXP/QM JPEG driver
In reply to Mirela RabuleaAdd bindings documentation for i.MX8QXP/QM JPEG decoder & encoder driver.
--- .../devicetree/bindings/media/imx8-jpeg.yaml | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/imx8-jpeg.yaml
Documentation/devicetree/bindings/media/imx8-jpeg.yaml new file +83 -0
@@ -0,0 +1,83 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/imx8-jpeg.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: i.MX8QXP/QM JPEG decoder/encoder Device Tree Bindings + +maintainers: + - Mirela Rabulea <[email protected]> + +description: |- + The JPEG decoder/encoder present in.MXQXP/QM SoC is an + ISO/IEC 10918-1 JPEG standard compliant decoder/encoder, for Baseline + and Extended Sequential DCT modes. + +properties: + compatible: + items: + - enum: + # JPEG decoder + - fsl,imx8-jpgdec + # JPEG encoder + - fsl,imx8-jpgenc + + reg: + maxItems: 1 + + interrupts: + description: | + There are 4 slots available in the IP + If a certain slot is used, it should have an associated interrupt + minItems: 1 # At least one slot should be available + maxItems: 4 # The IP has 4 slots available for use + + power-domains: + description: + List of phandle and PM domain specifier as documented in + Documentation/devicetree/bindings/power/power_domain.txt + minItems: 2 # Wrapper and 1 slot + maxItems: 5 # Wrapper and 4 slots + +required: + - compatible + - reg + - interrupts + - power-domains + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/firmware/imx/rsrc.h> + + jpegdec: jpegdec@58400000 { + compatible = "fsl,imx8-jpgdec"; + reg = <0x58400000 0x00050000 >; + interrupts = <GIC_SPI 309 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 310 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 311 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 312 IRQ_TYPE_LEVEL_HIGH>; + power-domains = <&pd IMX_SC_R_MJPEG_DEC_MP>, + <&pd IMX_SC_R_MJPEG_DEC_S0>, + <&pd IMX_SC_R_MJPEG_DEC_S1>, + <&pd IMX_SC_R_MJPEG_DEC_S2>, + <&pd IMX_SC_R_MJPEG_DEC_S3>; + }; + + jpegenc: jpegenc@58450000 { + compatible = "fsl,imx8-jpgenc"; + reg = <0x58450000 0x00050000 >; + interrupts = <GIC_SPI 305 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 306 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 307 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 308 IRQ_TYPE_LEVEL_HIGH>; + power-domains = <&pd IMX_SC_R_MJPEG_ENC_MP>, + <&pd IMX_SC_R_MJPEG_ENC_S0>, + <&pd IMX_SC_R_MJPEG_ENC_S1>, + <&pd IMX_SC_R_MJPEG_ENC_S2>, + <&pd IMX_SC_R_MJPEG_ENC_S3>; + }; +...
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [PATCH v3 3/6] media: dt-bindings: Add bindings for i.MX8QXP/QM JPEG driver
Quoted 8 lines · Mirela Rabulea
Add bindings documentation for i.MX8QXP/QM JPEG decoder & encoder driver.
Signed-off-by Mirela Rabulea <[email protected]>--- .../devicetree/bindings/media/imx8-jpeg.yaml | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/imx8-jpeg.yaml
Please add Acked-by/Reviewed-by tags when posting new versions. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for acks received on the version they apply.
If a tag was not added on purpose, please state why and what changed.
Re: [EXT] Re: [PATCH v3 3/6] media: dt-bindings: Add bindings for i.MX8QXP/QM JPEG driver
Quoted 6 lines · Rob Herring
Please add Acked-by/Reviewed-by tags when posting new versions. However,
there's no need to repost patches *only* to add the tags. The upstream
maintainer will do that for acks received on the version they apply.
Ok, sorry about that, I'll keep it in mind for next time.
Quoted 1 line
If a tag was not added on purpose, please state why and what changed.
The sole purpose for this _v3 was to add a new patch to the patchset, and I missed the opportunity to add the tags.
Regards,
Mirela
PATCH v3 4/6 media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder
In reply to Mirela RabuleaV4L2 driver for the JPEG encoder/decoder from i.MX8QXP/i.MX8QM application processors.
The multi-planar buffers API is used.
Baseline and extended sequential jpeg decoding is supported. Progressive jpeg decoding is not supported by the IP. Supports encode and decode of various formats:
YUV444, YUV422, YUV420, RGB, ARGB, Gray
YUV420 is the only multi-planar format supported. Minimum resolution is 64 x 64, maximum 8192 x 8192.
The alignment requirements for the resolution depend on the format, multiple of 16 resolutions should work for all formats.
v4l2-compliance tests are passing, including the
streaming tests, "v4l2-compliance -s"
--- drivers/media/platform/Kconfig | 2 + drivers/media/platform/Makefile | 1 + drivers/media/platform/imx-jpeg/Kconfig | 10 + drivers/media/platform/imx-jpeg/Makefile | 3 + drivers/media/platform/imx-jpeg/mxc-jpeg-hw.c | 168 ++ drivers/media/platform/imx-jpeg/mxc-jpeg-hw.h | 140 ++ drivers/media/platform/imx-jpeg/mxc-jpeg.c | 2293 +++++++++++++++++++++++++ drivers/media/platform/imx-jpeg/mxc-jpeg.h | 188 ++ 8 files changed, 2805 insertions(+) create mode 100644 drivers/media/platform/imx-jpeg/Kconfig create mode 100644 drivers/media/platform/imx-jpeg/Makefile create mode 100644 drivers/media/platform/imx-jpeg/mxc-jpeg-hw.c create mode 100644 drivers/media/platform/imx-jpeg/mxc-jpeg-hw.h create mode 100644 drivers/media/platform/imx-jpeg/mxc-jpeg.c create mode 100644 drivers/media/platform/imx-jpeg/mxc-jpeg.h
drivers/media/platform/Kconfig +2 -0
@@ -198,6 +198,8 @@ config VIDEO_IMX_PXP The i.MX Pixel Pipeline is a memory-to-memory engine for scaling, color space conversion, and rotation. +source "drivers/media/platform/imx-jpeg/Kconfig" + config VIDEO_MEDIATEK_JPEG tristate "Mediatek JPEG Codec driver" depends on MTK_IOMMU_V1 || COMPILE_TEST
drivers/media/platform/Makefile +1 -0
@@ -25,6 +25,7 @@ obj-$(CONFIG_VIDEO_MX2_EMMAPRP) += mx2_emmaprp.o obj-$(CONFIG_VIDEO_CODA) += coda/ obj-$(CONFIG_VIDEO_IMX_PXP) += imx-pxp.o +obj-$(CONFIG_VIDEO_IMX8_JPEG) += imx-jpeg/ obj-$(CONFIG_VIDEO_SH_VEU) += sh_veu.o
drivers/media/platform/imx-jpeg/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0 +config VIDEO_IMX8_JPEG + tristate "IMX8 JPEG Encoder/Decoder" + depends on VIDEO_DEV && VIDEO_V4L2 + select VIDEOBUF2_DMA_CONTIG + select V4L2_MEM2MEM_DEV + default m + help + This is a video4linux2 driver for the i.MX8 QXP/QM integrated + JPEG encoder/decoder.
drivers/media/platform/imx-jpeg/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 +mxc-jpeg-encdec-objs := mxc-jpeg-hw.o mxc-jpeg.o +obj-$(CONFIG_VIDEO_IMX8_JPEG) += mxc-jpeg-encdec.o
drivers/media/platform/imx-jpeg/mxc-jpeg-hw.c new file +168 -0
168 lines not on this page · raw message
drivers/media/platform/imx-jpeg/mxc-jpeg-hw.h new file +140 -0
140 lines not on this page · raw message
drivers/media/platform/imx-jpeg/mxc-jpeg.c new file +2293 -0
2,293 lines not on this page · raw message
drivers/media/platform/imx-jpeg/mxc-jpeg.h new file +188 -0
188 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v3 5/6 arm64: dts: imx8qxp: Add jpeg encoder/decoder nodes
In reply to Mirela RabuleaAdd jpeg decoder/encoder nodes, for now on imx8qxp only. The same should work on imx8qm, but it was not tested.
--- arch/arm64/boot/dts/freescale/imx8qxp-mek.dts | 8 ++++++ arch/arm64/boot/dts/freescale/imx8qxp.dtsi | 37 +++++++++++++++++++++++++++ 2 files changed, 45 insertions(+)
arch/arm64/boot/dts/freescale/imx8qxp-mek.dts +8 -0
@@ -242,3 +242,11 @@ &scu_key { status = "okay"; }; + +&jpegdec { + status = "okay"; +}; + +&jpegenc { + status = "okay"; +};
arch/arm64/boot/dts/freescale/imx8qxp.dtsi +37 -0
@@ -586,4 +586,41 @@ #clock-cells = <1>; }; }; + + img_subsys: bus@58000000 { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x58000000 0x0 0x58000000 0x1000000>; + + jpegdec: jpegdec@58400000 { + compatible = "fsl,imx8-jpgdec"; + reg = <0x58400000 0x00050000 >; + interrupts = <GIC_SPI 309 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 310 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 311 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 312 IRQ_TYPE_LEVEL_HIGH>; + power-domains = <&pd IMX_SC_R_MJPEG_DEC_MP>, + <&pd IMX_SC_R_MJPEG_DEC_S0>, + <&pd IMX_SC_R_MJPEG_DEC_S1>, + <&pd IMX_SC_R_MJPEG_DEC_S2>, + <&pd IMX_SC_R_MJPEG_DEC_S3>; + status = "disabled"; + }; + + jpegenc: jpegenc@58450000 { + compatible = "fsl,imx8-jpgenc"; + reg = <0x58450000 0x00050000 >; + interrupts = <GIC_SPI 305 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 306 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 307 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 308 IRQ_TYPE_LEVEL_HIGH>; + power-domains = <&pd IMX_SC_R_MJPEG_ENC_MP>, + <&pd IMX_SC_R_MJPEG_ENC_S0>, + <&pd IMX_SC_R_MJPEG_ENC_S1>, + <&pd IMX_SC_R_MJPEG_ENC_S2>, + <&pd IMX_SC_R_MJPEG_ENC_S3>; + status = "disabled"; + }; + }; };
Signature · 1 line
2.7.4
PATCH v3 6/6 Add maintainer for IMX jpeg v4l2 driver
In reply to Mirela RabuleaAdded as:
FREESCALE IMX / MXC JPEG V4L2 DRIVER
--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
@@ -6609,6 +6609,14 @@ S: Maintained F: include/linux/platform_data/video-imxfb.h F: drivers/video/fbdev/imxfb.c +FREESCALE IMX / MXC JPEG V4L2 DRIVER +M: Mirela Rabulea <[email protected]> +R: NXP Linux Team <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/media/imx8-jpeg.yaml +F: drivers/media/platform/imx-jpeg + FREESCALE QORIQ DPAA ETHERNET DRIVER M: Madalin Bucur <[email protected]> L: [email protected]
Signature · 1 line
2.7.4