Skip to content

Commit

Permalink
media: ov6650: Register with asynchronous subdevice framework
Browse files Browse the repository at this point in the history
Register V4L2 subdevice implemented by the driver to the V4L2
asynchronous subdevice framework.

[Sakari Ailus: Remove extra call to v4l2_i2c_subdev_set_name]

Signed-off-by: Janusz Krzysztofik <[email protected]>
Signed-off-by: Sakari Ailus <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
jkrzyszt authored and mchehab committed Apr 22, 2019
1 parent ccdd85d commit c62b960
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions drivers/media/i2c/ov6650.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,9 @@ static int ov6650_prog_dflt(struct i2c_client *client)
return ret;
}

static int ov6650_video_probe(struct i2c_client *client)
static int ov6650_video_probe(struct v4l2_subdev *sd)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct ov6650 *priv = to_ov6650(client);
u8 pidh, pidl, midh, midl;
int ret;
Expand All @@ -817,7 +818,7 @@ static int ov6650_video_probe(struct i2c_client *client)
return ret;
}

ret = ov6650_s_power(&priv->subdev, 1);
ret = ov6650_s_power(sd, 1);
if (ret < 0)
goto eclkput;

Expand Down Expand Up @@ -855,7 +856,7 @@ static int ov6650_video_probe(struct i2c_client *client)
ret = v4l2_ctrl_handler_setup(&priv->hdl);

done:
ov6650_s_power(&priv->subdev, 0);
ov6650_s_power(sd, 0);
if (!ret)
return 0;
eclkput:
Expand Down Expand Up @@ -943,6 +944,10 @@ static const struct v4l2_subdev_ops ov6650_subdev_ops = {
.pad = &ov6650_pad_ops,
};

static const struct v4l2_subdev_internal_ops ov6650_internal_ops = {
.registered = ov6650_video_probe,
};

/*
* i2c_driver function
*/
Expand Down Expand Up @@ -1003,7 +1008,10 @@ static int ov6650_probe(struct i2c_client *client,
priv->code = MEDIA_BUS_FMT_YUYV8_2X8;
priv->colorspace = V4L2_COLORSPACE_JPEG;

ret = ov6650_video_probe(client);
priv->subdev.internal_ops = &ov6650_internal_ops;
priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;

ret = v4l2_async_register_subdev(&priv->subdev);
if (ret)
v4l2_ctrl_handler_free(&priv->hdl);

Expand All @@ -1015,7 +1023,7 @@ static int ov6650_remove(struct i2c_client *client)
struct ov6650 *priv = to_ov6650(client);

v4l2_clk_put(priv->clk);
v4l2_device_unregister_subdev(&priv->subdev);
v4l2_async_unregister_subdev(&priv->subdev);
v4l2_ctrl_handler_free(&priv->hdl);
return 0;
}
Expand Down

0 comments on commit c62b960

Please sign in to comment.