Commit 9823f003 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] ov2640: fix colorspace handling

The colorspace is independent of whether YUV or RGB is sent to the SoC.
Fix this.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent c1d82b89
...@@ -794,10 +794,11 @@ static int ov2640_set_params(struct i2c_client *client, u32 *width, u32 *height, ...@@ -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__); dev_dbg(&client->dev, "%s: Selected cfmt YUYV (YUV422)", __func__);
selected_cfmt_regs = ov2640_yuyv_regs; selected_cfmt_regs = ov2640_yuyv_regs;
break; break;
default:
case MEDIA_BUS_FMT_UYVY8_2X8: case MEDIA_BUS_FMT_UYVY8_2X8:
default:
dev_dbg(&client->dev, "%s: Selected cfmt UYVY", __func__); dev_dbg(&client->dev, "%s: Selected cfmt UYVY", __func__);
selected_cfmt_regs = ov2640_uyvy_regs; selected_cfmt_regs = ov2640_uyvy_regs;
break;
} }
/* reset hardware */ /* reset hardware */
...@@ -865,17 +866,7 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd, ...@@ -865,17 +866,7 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd,
mf->width = priv->win->width; mf->width = priv->win->width;
mf->height = priv->win->height; mf->height = priv->win->height;
mf->code = priv->cfmt_code; 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; 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->field = V4L2_FIELD_NONE; mf->field = V4L2_FIELD_NONE;
return 0; return 0;
...@@ -897,17 +888,17 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd, ...@@ -897,17 +888,17 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd,
ov2640_select_win(&mf->width, &mf->height); ov2640_select_win(&mf->width, &mf->height);
mf->field = V4L2_FIELD_NONE; mf->field = V4L2_FIELD_NONE;
mf->colorspace = V4L2_COLORSPACE_SRGB;
switch (mf->code) { switch (mf->code) {
case MEDIA_BUS_FMT_RGB565_2X8_BE: case MEDIA_BUS_FMT_RGB565_2X8_BE:
case MEDIA_BUS_FMT_RGB565_2X8_LE: 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; break;
default: default:
mf->code = MEDIA_BUS_FMT_UYVY8_2X8; mf->code = MEDIA_BUS_FMT_UYVY8_2X8;
case MEDIA_BUS_FMT_YUYV8_2X8: break;
case MEDIA_BUS_FMT_UYVY8_2X8:
mf->colorspace = V4L2_COLORSPACE_JPEG;
} }
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment