Message ID | 20220223104034.91550-24-jacopo@jmondi.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | media: ov5640: Rework the clock tree programming for MIPI | expand |
Hi Jacopo, Thank you for the patch. On Wed, Feb 23, 2022 at 11:40:30AM +0100, Jacopo Mondi wrote: > Add support for BGR888 image formats. > > No existing media bus codes describe exactly the way data is transferred > on the CSI-2 bus. This is not a new issue, the CSI-2 YUV422 8-bit format > is described by MEDIA_BUS_FMT_UYVY8_1X16 which is an arbitrary > convention and not an exact match. Use the MEDIA_BUS_FMT_BGR888_1X24 to > follow the same convention, based on the order in which bits are > transmitted over the CSI-2 bus when producing images in RGB24 format. > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > --- > drivers/media/i2c/ov5640.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c > index b9a488f63687..04e8f27df222 100644 > --- a/drivers/media/i2c/ov5640.c > +++ b/drivers/media/i2c/ov5640.c > @@ -225,6 +225,10 @@ static const struct ov5640_pixfmt { > .code = MEDIA_BUS_FMT_RGB565_1X16, > .colorspace = V4L2_COLORSPACE_SRGB, > .bpp = 16, > + }, { /* For CSI-2 only */ Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > + .code = MEDIA_BUS_FMT_BGR888_1X24, > + .colorspace = V4L2_COLORSPACE_SRGB, > + .bpp = 24, > }, { > .code = MEDIA_BUS_FMT_SBGGR8_1X8, > .colorspace = V4L2_COLORSPACE_SRGB, > @@ -2912,6 +2916,11 @@ static int ov5640_set_framefmt(struct ov5640_dev *sensor, > fmt = 0x61; > 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;
On Wed, Feb 23, 2022 at 02:02:49PM +0200, Laurent Pinchart wrote: > Hi Jacopo, > > Thank you for the patch. > > On Wed, Feb 23, 2022 at 11:40:30AM +0100, Jacopo Mondi wrote: > > Add support for BGR888 image formats. > > > > No existing media bus codes describe exactly the way data is transferred > > on the CSI-2 bus. This is not a new issue, the CSI-2 YUV422 8-bit format > > is described by MEDIA_BUS_FMT_UYVY8_1X16 which is an arbitrary > > convention and not an exact match. Use the MEDIA_BUS_FMT_BGR888_1X24 to > > follow the same convention, based on the order in which bits are > > transmitted over the CSI-2 bus when producing images in RGB24 format. > > > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > > --- > > drivers/media/i2c/ov5640.c | 9 +++++++++ > > 1 file changed, 9 insertions(+) > > > > diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c > > index b9a488f63687..04e8f27df222 100644 > > --- a/drivers/media/i2c/ov5640.c > > +++ b/drivers/media/i2c/ov5640.c > > @@ -225,6 +225,10 @@ static const struct ov5640_pixfmt { > > .code = MEDIA_BUS_FMT_RGB565_1X16, > > .colorspace = V4L2_COLORSPACE_SRGB, > > .bpp = 16, > > + }, { > > /* For CSI-2 only */ Please ignore this, and in the previous patch too, I see this is added in the CSI-2 list. > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > > + .code = MEDIA_BUS_FMT_BGR888_1X24, > > + .colorspace = V4L2_COLORSPACE_SRGB, > > + .bpp = 24, > > }, { > > .code = MEDIA_BUS_FMT_SBGGR8_1X8, > > .colorspace = V4L2_COLORSPACE_SRGB, > > @@ -2912,6 +2916,11 @@ static int ov5640_set_framefmt(struct ov5640_dev *sensor, > > fmt = 0x61; > > 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 b9a488f63687..04e8f27df222 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -225,6 +225,10 @@ static const struct ov5640_pixfmt { .code = MEDIA_BUS_FMT_RGB565_1X16, .colorspace = V4L2_COLORSPACE_SRGB, .bpp = 16, + }, { + .code = MEDIA_BUS_FMT_BGR888_1X24, + .colorspace = V4L2_COLORSPACE_SRGB, + .bpp = 24, }, { .code = MEDIA_BUS_FMT_SBGGR8_1X8, .colorspace = V4L2_COLORSPACE_SRGB, @@ -2912,6 +2916,11 @@ static int ov5640_set_framefmt(struct ov5640_dev *sensor, fmt = 0x61; 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 BGR888 image formats. No existing media bus codes describe exactly the way data is transferred on the CSI-2 bus. This is not a new issue, the CSI-2 YUV422 8-bit format is described by MEDIA_BUS_FMT_UYVY8_1X16 which is an arbitrary convention and not an exact match. Use the MEDIA_BUS_FMT_BGR888_1X24 to follow the same convention, based on the order in which bits are transmitted over the CSI-2 bus when producing images in RGB24 format. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- drivers/media/i2c/ov5640.c | 9 +++++++++ 1 file changed, 9 insertions(+)