Re: [PATCH v2 2/2] media: imagination: Add E5010 JPEG Encoder driver

From: Laurent Pinchart
Date: Thu Jul 27 2023 - 17:04:27 EST


On Thu, Jul 27, 2023 at 10:10:41AM -0400, Nicolas Dufresne wrote:
> Le jeudi 27 juillet 2023 à 16:55 +0530, Devarsh Thakkar a écrit :
> > This adds support for stateful V4L2 M2M based driver
> > for Imagination E5010 JPEG Encoder [1] which supports baseline
> > encoding with two different quantization tables and compression
> > ratio as demanded.
> >
> > Support for both contigous and non-contigous YUV420 and YUV422
> contiguous contiguous
>
> > semiplanar formats is added along with alignment restrictions
> > as required by the hardware.
> >
> > System and runtime PM hooks are added in the driver along with v4l2
> > crop and selection API support.
> >
> > Minimum resolution supported is 64x64 and
> > Maximum resolution supported is 8192x8192.
> >
> > All v4l2-compliance tests are passing [2] :
> > v4l2-compliance -s -f -a -d /dev/video0 -e /dev/video1
> >
> > Total for e5010 device /dev/video0: 78, Succeeded: 78, Failed: 0,
> > Warnings: 0
> >
> > NOTE: video1 here is VIVID test pattern generator
> >
> > Also tests [3] were run manually to verify below driver features:
> > - Runtime Power Management
> > - Multi-instance JPEG Encoding
> > - DMABUF import, export support
> > - NV12, NV21, NV16, NV61 video format support
> > - Compression quality S_CTRL
> >
> > Existing V4L2 M2M based JPEG drivers namely s5p-jpeg,
> > imx-jpeg and rcar_jpu were referred while making this.
> >
> > [1]: AM62A TRM (Section 7.6 is for JPEG Encoder)
> > Link: https://www.ti.com/lit/pdf/spruj16
> >
> > [2]: v4l2-compliance test :
> > Link: https://gist.github.com/devarsht/867b1d646bca3f3877edb1f3638aae31
> >
> > [3]: E5010 JPEG Encoder Manual tests :
> > Link: https://gist.github.com/devarsht/ea31179199393c2026ae457219bb6321
> >
> > Co-developed-by: David Huang <d-huang@xxxxxx>
> > Signed-off-by: David Huang <d-huang@xxxxxx>
> > Signed-off-by: Devarsh Thakkar <devarsht@xxxxxx>
> > ---
> > V2: No change
> >
> > MAINTAINERS | 2 +
> > drivers/media/platform/Kconfig | 1 +
> > drivers/media/platform/Makefile | 1 +
> > drivers/media/platform/imagination/Kconfig | 13 +
> > drivers/media/platform/imagination/Makefile | 3 +
> > .../platform/imagination/e5010-core-regs.h | 584 ++++++
> > .../platform/imagination/e5010-jpeg-enc-hw.c | 319 +++
> > .../platform/imagination/e5010-jpeg-enc-hw.h | 41 +
> > .../platform/imagination/e5010-jpeg-enc.c | 1762 +++++++++++++++++
> > .../platform/imagination/e5010-jpeg-enc.h | 165 ++
> > .../platform/imagination/e5010-mmu-regs.h | 303 +++
> > 11 files changed, 3194 insertions(+)
> > create mode 100644 drivers/media/platform/imagination/Kconfig
> > create mode 100644 drivers/media/platform/imagination/Makefile
> > create mode 100644 drivers/media/platform/imagination/e5010-core-regs.h
> > create mode 100644 drivers/media/platform/imagination/e5010-jpeg-enc-hw.c
> > create mode 100644 drivers/media/platform/imagination/e5010-jpeg-enc-hw.h
> > create mode 100644 drivers/media/platform/imagination/e5010-jpeg-enc.c
> > create mode 100644 drivers/media/platform/imagination/e5010-jpeg-enc.h
> > create mode 100644 drivers/media/platform/imagination/e5010-mmu-regs.h

[snip]

> > diff --git a/drivers/media/platform/imagination/e5010-core-regs.h b/drivers/media/platform/imagination/e5010-core-regs.h
> > new file mode 100644
> > index 000000000000..aa2d57146c3d
> > --- /dev/null
> > +++ b/drivers/media/platform/imagination/e5010-core-regs.h
> > @@ -0,0 +1,584 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +/*
> > + * TI E5010 JPEG Encoder driver.
> > + *
> > + * Copyright (c) 2023 Texas Instruments Inc.
> > + * Author: David Huang <d-huang@xxxxxx>
> > + * Author: Devarsh Thakkar <devarsht@xxxxxx>
> > + */
> > +
> > +#ifndef _E5010_CORE_REGS_H
> > +#define _E5010_CORE_REGS_H
>
> nit: Could be modernized to "#pragma once" (though only used in selftest so far)

I don't know if there's a kernel-wide policy regarding its use, but
Linus has not too long ago expressed a dislike for "#pragma once", see
https://lore.kernel.org/lkml/CAHk-=wi13+FLcRo4zmnRUmmY=AAns-Yd5NR_mVdcAd6ZrPq2fA@xxxxxxxxxxxxxx/.

[snip]

--
Regards,

Laurent Pinchart