mirror of https://gitee.com/openkylin/linux.git
media: ov6650: Fix incorrect use of JPEG colorspace
Since its initial submission, the driver selects V4L2_COLORSPACE_JPEG
for supported formats other than V4L2_MBUS_FMT_SBGGR8_1X8. According
to v4l2-compliance test program, V4L2_COLORSPACE_JPEG applies
exclusively to V4L2_PIX_FMT_JPEG. Since the sensor does not support
JPEG format, fix it to always select V4L2_COLORSPACE_SRGB.
Fixes: 2f6e240479
("[media] SoC Camera: add driver for OV6650 sensor")
Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
7b188d6ba2
commit
1250073189
|
@ -200,7 +200,6 @@ struct ov6650 {
|
||||||
unsigned long pclk_max; /* from resolution and format */
|
unsigned long pclk_max; /* from resolution and format */
|
||||||
struct v4l2_fract tpf; /* as requested with s_frame_interval */
|
struct v4l2_fract tpf; /* as requested with s_frame_interval */
|
||||||
u32 code;
|
u32 code;
|
||||||
enum v4l2_colorspace colorspace;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -514,7 +513,7 @@ static int ov6650_get_fmt(struct v4l2_subdev *sd,
|
||||||
mf->width = priv->rect.width >> priv->half_scale;
|
mf->width = priv->rect.width >> priv->half_scale;
|
||||||
mf->height = priv->rect.height >> priv->half_scale;
|
mf->height = priv->rect.height >> priv->half_scale;
|
||||||
mf->code = priv->code;
|
mf->code = priv->code;
|
||||||
mf->colorspace = priv->colorspace;
|
mf->colorspace = V4L2_COLORSPACE_SRGB;
|
||||||
mf->field = V4L2_FIELD_NONE;
|
mf->field = V4L2_FIELD_NONE;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -622,11 +621,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||||
priv->pclk_max = 8000000;
|
priv->pclk_max = 8000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code == MEDIA_BUS_FMT_SBGGR8_1X8)
|
|
||||||
priv->colorspace = V4L2_COLORSPACE_SRGB;
|
|
||||||
else if (code != 0)
|
|
||||||
priv->colorspace = V4L2_COLORSPACE_JPEG;
|
|
||||||
|
|
||||||
if (half_scale) {
|
if (half_scale) {
|
||||||
dev_dbg(&client->dev, "max resolution: QCIF\n");
|
dev_dbg(&client->dev, "max resolution: QCIF\n");
|
||||||
coma_set |= COMA_QCIF;
|
coma_set |= COMA_QCIF;
|
||||||
|
@ -657,7 +651,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||||
ret = ov6650_reg_rmw(client, REG_COML, coml_set, coml_mask);
|
ret = ov6650_reg_rmw(client, REG_COML, coml_set, coml_mask);
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
mf->colorspace = priv->colorspace;
|
|
||||||
mf->width = priv->rect.width >> half_scale;
|
mf->width = priv->rect.width >> half_scale;
|
||||||
mf->height = priv->rect.height >> half_scale;
|
mf->height = priv->rect.height >> half_scale;
|
||||||
}
|
}
|
||||||
|
@ -680,6 +673,7 @@ static int ov6650_set_fmt(struct v4l2_subdev *sd,
|
||||||
&mf->height, 2, H_CIF, 1, 0);
|
&mf->height, 2, H_CIF, 1, 0);
|
||||||
|
|
||||||
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_Y10_1X10:
|
case MEDIA_BUS_FMT_Y10_1X10:
|
||||||
|
@ -690,13 +684,11 @@ static int ov6650_set_fmt(struct v4l2_subdev *sd,
|
||||||
case MEDIA_BUS_FMT_YUYV8_2X8:
|
case MEDIA_BUS_FMT_YUYV8_2X8:
|
||||||
case MEDIA_BUS_FMT_VYUY8_2X8:
|
case MEDIA_BUS_FMT_VYUY8_2X8:
|
||||||
case MEDIA_BUS_FMT_UYVY8_2X8:
|
case MEDIA_BUS_FMT_UYVY8_2X8:
|
||||||
mf->colorspace = V4L2_COLORSPACE_JPEG;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mf->code = MEDIA_BUS_FMT_SBGGR8_1X8;
|
mf->code = MEDIA_BUS_FMT_SBGGR8_1X8;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case MEDIA_BUS_FMT_SBGGR8_1X8:
|
case MEDIA_BUS_FMT_SBGGR8_1X8:
|
||||||
mf->colorspace = V4L2_COLORSPACE_SRGB;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1004,7 +996,6 @@ static int ov6650_probe(struct i2c_client *client,
|
||||||
priv->rect.height = H_CIF;
|
priv->rect.height = H_CIF;
|
||||||
priv->half_scale = false;
|
priv->half_scale = false;
|
||||||
priv->code = MEDIA_BUS_FMT_YUYV8_2X8;
|
priv->code = MEDIA_BUS_FMT_YUYV8_2X8;
|
||||||
priv->colorspace = V4L2_COLORSPACE_JPEG;
|
|
||||||
|
|
||||||
priv->subdev.internal_ops = &ov6650_internal_ops;
|
priv->subdev.internal_ops = &ov6650_internal_ops;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue