diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2016-08-16 22:56:43 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-04-10 14:00:34 +0300 |
commit | 9823f003b96c2995d91fdca2456cd2b2b3c4246e (patch) | |
tree | 4fe37539870f594fdee1bec03b3c4e859cb778e2 /drivers/media/i2c | |
parent | c1d82b89538032718cba30b5b1fe192dfb343212 (diff) | |
download | linux-9823f003b96c2995d91fdca2456cd2b2b3c4246e.tar.xz |
[media] ov2640: fix colorspace handling
The colorspace is independent of whether YUV or RGB is sent to the SoC.
Fix this.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r-- | drivers/media/i2c/soc_camera/ov2640.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c index e0c08c007bb3..2a0620086aa5 100644 --- a/drivers/media/i2c/soc_camera/ov2640.c +++ b/drivers/media/i2c/soc_camera/ov2640.c @@ -794,10 +794,11 @@ static int ov2640_set_params(struct i2c_client *client, u32 *width, u32 *height, dev_dbg(&client->dev, "%s: Selected cfmt YUYV (YUV422)", __func__); selected_cfmt_regs = ov2640_yuyv_regs; break; - default: case MEDIA_BUS_FMT_UYVY8_2X8: + default: dev_dbg(&client->dev, "%s: Selected cfmt UYVY", __func__); selected_cfmt_regs = ov2640_uyvy_regs; + break; } /* reset hardware */ @@ -865,17 +866,7 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd, mf->width = priv->win->width; mf->height = priv->win->height; mf->code = priv->cfmt_code; - - switch (mf->code) { - case MEDIA_BUS_FMT_RGB565_2X8_BE: - case MEDIA_BUS_FMT_RGB565_2X8_LE: - mf->colorspace = V4L2_COLORSPACE_SRGB; - break; - default: - case MEDIA_BUS_FMT_YUYV8_2X8: - case MEDIA_BUS_FMT_UYVY8_2X8: - mf->colorspace = V4L2_COLORSPACE_JPEG; - } + mf->colorspace = V4L2_COLORSPACE_SRGB; mf->field = V4L2_FIELD_NONE; return 0; @@ -897,17 +888,17 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd, ov2640_select_win(&mf->width, &mf->height); mf->field = V4L2_FIELD_NONE; + mf->colorspace = V4L2_COLORSPACE_SRGB; switch (mf->code) { case MEDIA_BUS_FMT_RGB565_2X8_BE: case MEDIA_BUS_FMT_RGB565_2X8_LE: - mf->colorspace = V4L2_COLORSPACE_SRGB; + case MEDIA_BUS_FMT_YUYV8_2X8: + case MEDIA_BUS_FMT_UYVY8_2X8: break; default: mf->code = MEDIA_BUS_FMT_UYVY8_2X8; - case MEDIA_BUS_FMT_YUYV8_2X8: - case MEDIA_BUS_FMT_UYVY8_2X8: - mf->colorspace = V4L2_COLORSPACE_JPEG; + break; } if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) |