Commit b0a7d0e1 authored by Akinobu Mita's avatar Akinobu Mita Committed by Mauro Carvalho Chehab

media: ov2640: set default window and format code at probe time

Set default window and format code at probe time instead of always checking
if they have not been set yet when VIDIOC_SUBDEV_G_FMT ioctl is called.

This change simplifies the next patch (make VIDIOC_SUBDEV_G_FMT ioctl work
with V4L2_SUBDEV_FORMAT_TRY).
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 47ee7bde
...@@ -842,9 +842,6 @@ static int ov2640_set_params(struct i2c_client *client, ...@@ -842,9 +842,6 @@ static int ov2640_set_params(struct i2c_client *client,
u8 val; u8 val;
int ret; int ret;
if (!win)
return -EINVAL;
switch (code) { switch (code) {
case MEDIA_BUS_FMT_RGB565_2X8_BE: case MEDIA_BUS_FMT_RGB565_2X8_BE:
dev_dbg(&client->dev, "%s: Selected cfmt RGB565 BE", __func__); dev_dbg(&client->dev, "%s: Selected cfmt RGB565 BE", __func__);
...@@ -929,10 +926,6 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd, ...@@ -929,10 +926,6 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd,
if (format->pad) if (format->pad)
return -EINVAL; return -EINVAL;
if (!priv->win) {
priv->win = ov2640_select_win(SVGA_WIDTH, SVGA_HEIGHT);
priv->cfmt_code = MEDIA_BUS_FMT_UYVY8_2X8;
}
mf->width = priv->win->width; mf->width = priv->win->width;
mf->height = priv->win->height; mf->height = priv->win->height;
...@@ -1193,6 +1186,9 @@ static int ov2640_probe(struct i2c_client *client, ...@@ -1193,6 +1186,9 @@ static int ov2640_probe(struct i2c_client *client,
if (ret) if (ret)
goto err_clk; goto err_clk;
priv->win = ov2640_select_win(SVGA_WIDTH, SVGA_HEIGHT);
priv->cfmt_code = MEDIA_BUS_FMT_UYVY8_2X8;
v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops); v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops);
priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
V4L2_SUBDEV_FL_HAS_EVENTS; V4L2_SUBDEV_FL_HAS_EVENTS;
......
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