Re: [PATCH v3 10/13] media: stm32: dcmipp: pixelproc: addition of dcmipp-pixelproc subdev
Alain Volmat <[email protected]>
| Newsgroups | org.kernel.vger.linux-media,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Hi Hans, thanks for the review, On Mon, Jul 27, 2026 at 03:49:38PM +0200, Hans Verkuil wrote: > Hi Alain, > > Some control-related comments: > > On 24/07/2026 18:13, Alain Volmat wrote: > > Addition of the driver for dcmipp-pixelproc subdev. This subdev is the > > last one before the capture device at the tail of both main and > > aux pipelines. > > > > It is in charge of: > > - framerate adjustment > > - downscale > > - gamma correction > > - color conversion > > - pixel packing > > > > Signed-off-by: Alain Volmat <[email protected]> > > --- > > .../media/platform/st/stm32/stm32-dcmipp/Makefile | 2 +- > > .../platform/st/stm32/stm32-dcmipp/dcmipp-common.h | 4 + > > .../st/stm32/stm32-dcmipp/dcmipp-pixelproc.c | 941 +++++++++++++++++++++ > > 3 files changed, 946 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/Makefile b/drivers/media/platform/st/stm32/stm32-dcmipp/Makefile > > index a708534a51af4..7178934bb116b 100644 > > --- a/drivers/media/platform/st/stm32/stm32-dcmipp/Makefile > > +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/Makefile > > @@ -1,5 +1,5 @@ > > # SPDX-License-Identifier: GPL-2.0 > > stm32-dcmipp-y := dcmipp-core.o dcmipp-common.o dcmipp-input.o dcmipp-byteproc.o dcmipp-bytecap.o > > -stm32-dcmipp-y += dcmipp-pixelcommon.o dcmipp-isp.o > > +stm32-dcmipp-y += dcmipp-pixelcommon.o dcmipp-isp.o dcmipp-pixelproc.o > > > > obj-$(CONFIG_VIDEO_STM32_DCMIPP) += stm32-dcmipp.o > > diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h > > index e04fde86550a5..8f41473605aae 100644 > > --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h > > +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.h > > @@ -285,5 +285,9 @@ void dcmipp_bytecap_ent_release(struct dcmipp_ent_device *ved); > > struct dcmipp_ent_device *dcmipp_isp_ent_init(const char *entity_name, > > struct dcmipp_device *dcmipp); > > void dcmipp_isp_ent_release(struct dcmipp_ent_device *ved); > > +struct dcmipp_ent_device * > > +dcmipp_pixelproc_ent_init(const char *entity_name, > > + struct dcmipp_device *dcmipp); > > +void dcmipp_pixelproc_ent_release(struct dcmipp_ent_device *ved); > > > > #endif > > diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c > > new file mode 100644 > > index 0000000000000..4372c75508725 > > --- /dev/null > > +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-pixelproc.c > > <snip> > > > +/* > > + * Functions handling controls > > + */ > > +#define V4L2_CID_PIXELPROC_GAMMA_CORRECTION (V4L2_CID_USER_BASE | 0x1001) > > You need to reserve a range in include/uapi/linux/v4l2-controls.h for this > driver (search for V4L2_CID_USER_MALI_C55_BASE). Done in v4. > > And the define should include the driver name. 'PIXELPROC' is much too generic. > It probably should be called DCMIPP_PIXELPROC. Done in v4. > Please document what this control does. Typically a new header is added to > include/linux/uapi for this driver containing the CID and the documentation. > See: include/uapi/linux/dw100.h Looking at other drivers such as raspberry etc, they seems to have their header in include/uapi/linux/media/xx so I added a new header include/uapi/linux/media/st/dcmipp_config.h > > > + > > +static int dcmipp_pixelproc_s_ctrl(struct v4l2_ctrl *ctrl) > > +{ > > + struct dcmipp_pixelproc_device *pixelproc = > > + container_of(ctrl->handler, > > + struct dcmipp_pixelproc_device, ctrls); > > + > > + if (!pm_runtime_get_if_in_use(pixelproc->dev)) > > + return 0; > > + > > + switch (ctrl->id) { > > + case V4L2_CID_PIXELPROC_GAMMA_CORRECTION: > > + reg_write(pixelproc, DCMIPP_PxGMCR(pixelproc->pipe_id), > > + (ctrl->val ? DCMIPP_PxGMCR_ENABLE : 0)); > > + break; > > + } > > + > > + pm_runtime_put(pixelproc->dev); > > + > > + return 0; > > +}; > > + > > +static const struct v4l2_ctrl_ops dcmipp_pixelproc_ctrl_ops = { > > + .s_ctrl = dcmipp_pixelproc_s_ctrl, > > +}; > > + > > +static const struct v4l2_ctrl_config dcmipp_pixelproc_ctrls[] = { > > + { > > + .ops = &dcmipp_pixelproc_ctrl_ops, > > + .id = V4L2_CID_PIXELPROC_GAMMA_CORRECTION, > > + .type = V4L2_CTRL_TYPE_BOOLEAN, > > + .name = "Gamma correction", > > "Gamma Correction". More likely, "Gamma Correction Enable" (and ENABLE should probably > be in the CID define as well). Done in v4. Regards, Alain