Message ID | 20220210111044.152904-2-jacopo@jmondi.org |
---|---|
State | New |
Headers | show |
Series | media: ov5640: Rework the clock tree programming for MIPI | expand |
Hi Jacopo, Thank you for the patch. On Thu, Feb 10, 2022 at 12:10:42PM +0100, Jacopo Mondi wrote: > Add support for RGB888/BGR888 image formats. > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > --- > drivers/media/i2c/ov5640.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c > index 3a21f4648acf..f894570ac53c 100644 > --- a/drivers/media/i2c/ov5640.c > +++ b/drivers/media/i2c/ov5640.c > @@ -224,6 +224,14 @@ static const struct ov5640_pixfmt { > .code = MEDIA_BUS_FMT_RGB565_1X16, > .colorspace = V4L2_COLORSPACE_SRGB, > .bpp = 16, > + }, { > + .code = MEDIA_BUS_FMT_RGB888_1X24, > + .colorspace = V4L2_COLORSPACE_SRGB, > + .bpp = 24, > + }, { > + .code = MEDIA_BUS_FMT_BGR888_1X24, > + .colorspace = V4L2_COLORSPACE_SRGB, > + .bpp = 16, bpp = 24 If we can limit MEDIA_BUS_FMT_RGB565_1X16 to CSI-2 mode in the previous patch, then this should be limited too. > }, { > .code = MEDIA_BUS_FMT_SBGGR8_1X8, > .colorspace = V4L2_COLORSPACE_SRGB, > @@ -2777,6 +2785,16 @@ static int ov5640_set_framefmt(struct ov5640_dev *sensor, > fmt = 0x61; > mux = OV5640_FMT_MUX_RGB; > break; > + case MEDIA_BUS_FMT_RGB888_1X24: > + /* RGB888: BGR */ The datasheet documents formats 0x22 and 0x23 as BGRBGR... and RGBRGB... but doesn't tell how that's mapped to the MIPI CSI-2 RGB888 formats (which is transmitted with the blue bits first). I thus can't tell which order is correct here. We can fix it later if it turns out not to be correct. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > + fmt = 0x22; > + mux = OV5640_FMT_MUX_RGB; > + break; > + case MEDIA_BUS_FMT_BGR888_1X24: > + /* BGR888: RGB */ > + fmt = 0x23; > + mux = OV5640_FMT_MUX_RGB; > + break; > case MEDIA_BUS_FMT_JPEG_1X8: > /* YUV422, YUYV */ > fmt = 0x30;
diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 3a21f4648acf..f894570ac53c 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -224,6 +224,14 @@ static const struct ov5640_pixfmt { .code = MEDIA_BUS_FMT_RGB565_1X16, .colorspace = V4L2_COLORSPACE_SRGB, .bpp = 16, + }, { + .code = MEDIA_BUS_FMT_RGB888_1X24, + .colorspace = V4L2_COLORSPACE_SRGB, + .bpp = 24, + }, { + .code = MEDIA_BUS_FMT_BGR888_1X24, + .colorspace = V4L2_COLORSPACE_SRGB, + .bpp = 16, }, { .code = MEDIA_BUS_FMT_SBGGR8_1X8, .colorspace = V4L2_COLORSPACE_SRGB, @@ -2777,6 +2785,16 @@ static int ov5640_set_framefmt(struct ov5640_dev *sensor, fmt = 0x61; mux = OV5640_FMT_MUX_RGB; break; + case MEDIA_BUS_FMT_RGB888_1X24: + /* RGB888: BGR */ + fmt = 0x22; + mux = OV5640_FMT_MUX_RGB; + break; + case MEDIA_BUS_FMT_BGR888_1X24: + /* BGR888: RGB */ + fmt = 0x23; + mux = OV5640_FMT_MUX_RGB; + break; case MEDIA_BUS_FMT_JPEG_1X8: /* YUV422, YUYV */ fmt = 0x30;
Add support for RGB888/BGR888 image formats. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- drivers/media/i2c/ov5640.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)