public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/4] [media] tc358743: register v4l2 asynchronous subdevice
@ 2015-07-17 10:58 Philipp Zabel
  2015-07-17 10:58 ` [PATCH v2 2/4] [media] tc358743: enable v4l2 subdevice devnode Philipp Zabel
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Philipp Zabel @ 2015-07-17 10:58 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Mats Randgaard, linux-media, kernel, Philipp Zabel

Add support for registering the sensor subdevice using the v4l2-async API.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
Changes since v1:
 - Added missing media_entity_cleanup
---
 drivers/media/i2c/tc358743.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index 34d4f32..8d9906b 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -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,
@@ -1740,6 +1750,7 @@ err_work_queues:
 	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;
 }
@@ -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;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-17 14:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-17 10:58 [PATCH v2 1/4] [media] tc358743: register v4l2 asynchronous subdevice Philipp Zabel
2015-07-17 10:58 ` [PATCH v2 2/4] [media] tc358743: enable v4l2 subdevice devnode Philipp Zabel
2015-07-17 10:58 ` [PATCH v2 3/4] [media] tc358743: support probe from device tree Philipp Zabel
2015-07-17 12:23   ` Hans Verkuil
2015-07-17 14:06     ` Philipp Zabel
2015-07-17 10:58 ` [PATCH v2 4/4] [media] tc358743: add direct interrupt handling Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox