OSDN Git Service

media: imx: utils: Handle Bayer format lookup through a selection flag
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 6 Apr 2020 16:38:58 +0000 (18:38 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 21 Apr 2020 11:15:24 +0000 (13:15 +0200)
commit0cd5d896a192887041f4030c1d388099a572322e
treebd98c440901eeb386a4837299198e4d782047341
parentc25ab5caf516f9439a5607162852d398c635d948
media: imx: utils: Handle Bayer format lookup through a selection flag

The format lookup (and enumeration) functions take a boolean flag to
tell if Bayer formats should be considered. This leads to hard to read
lines such as

return enum_format(fourcc, NULL, index, cs_sel, true, false);

where the boolean parameters can easily be mixed. To make the code
clearer, add a CS_SEL_BAYER flag that can be passed through the
codespace_sel parameter of the lookup functions to replace the bool
parameter.

[slongerbeam@gmail.com: Instead of declaring CS_SEL_ANY as a bitfield
 containing only CS_SEL_YUV | CS_SEL_RGB, declare CS_SEL_ANY as all of
 the above (YUV, RGB, BAYER). A new enum is declared for the YUV | RGB
 selection as CS_SEL_YUV_RGB, and that is used by sub-devices that
 don't support BAYER and only allow selecting and enumerating YUV or RGB
 encodings. CS_SEL_ANY is now only used by the CSI sub-devices and the
 attached capture interfaces, since only those devices support BAYER
 formats.]

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/imx/imx-ic-prp.c
drivers/staging/media/imx/imx-ic-prpencvf.c
drivers/staging/media/imx/imx-media-capture.c
drivers/staging/media/imx/imx-media-csc-scaler.c
drivers/staging/media/imx/imx-media-csi.c
drivers/staging/media/imx/imx-media-utils.c
drivers/staging/media/imx/imx-media.h
drivers/staging/media/imx/imx7-media-csi.c