Skip to content

Commit

Permalink
[media] tc358743: register v4l2 asynchronous subdevice
Browse files Browse the repository at this point in the history
Add support for registering the sensor subdevice using the v4l2-async API.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
  • Loading branch information
Philipp Zabel authored and Mauro Carvalho Chehab committed Jul 22, 2015
1 parent 55b858b commit 4c5211a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/media/i2c/tc358743.c
Original file line number Diff line number Diff line change
Expand Up @@ -1710,6 +1710,16 @@ static int tc358743_probe(struct i2c_client *client,
goto err_hdl;
}

state->pad.flags = MEDIA_PAD_FL_SOURCE;
err = media_entity_init(&sd->entity, 1, &state->pad, 0);
if (err < 0)
goto err_hdl;

sd->dev = &client->dev;
err = v4l2_async_register_subdev(sd);
if (err < 0)
goto err_hdl;

mutex_init(&state->confctl_mutex);

INIT_DELAYED_WORK(&state->delayed_work_enable_hotplug,
Expand Down Expand Up @@ -1740,6 +1750,7 @@ static int tc358743_probe(struct i2c_client *client,
destroy_workqueue(state->work_queues);
mutex_destroy(&state->confctl_mutex);
err_hdl:
media_entity_cleanup(&sd->entity);
v4l2_ctrl_handler_free(&state->hdl);
return err;
}
Expand All @@ -1751,8 +1762,10 @@ static int tc358743_remove(struct i2c_client *client)

cancel_delayed_work(&state->delayed_work_enable_hotplug);
destroy_workqueue(state->work_queues);
v4l2_async_unregister_subdev(sd);
v4l2_device_unregister_subdev(sd);
mutex_destroy(&state->confctl_mutex);
media_entity_cleanup(&sd->entity);
v4l2_ctrl_handler_free(&state->hdl);

return 0;
Expand Down

0 comments on commit 4c5211a

Please sign in to comment.