On 03/30/2015 01:10 PM, Philipp Zabel wrote:
Add support for registering the sensor subdevice using the v4l2-async API.
Signed-off-by: Philipp Zabel<p.zabel@xxxxxxxxxxxxxx>
---
drivers/media/i2c/tc358743.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c
index a86cbe0..dfc10f0 100644
--- a/drivers/media/i2c/tc358743.c
+++ b/drivers/media/i2c/tc358743.c
@@ -1711,6 +1711,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;
sd->dev = &client->dev is already done by v4l2_i2c_subdev_init() ~50
lines above
The rest of the code seems fine to me, but I can not test it since the
kernel we use is too old to support async subdevs.
Regards,
Mats Randgaard
+ err = v4l2_async_register_subdev(sd);
+ if (err < 0)
+ goto err_hdl;
+
INIT_DELAYED_WORK(&state->delayed_work_enable_hotplug,
tc358743_delayed_work_enable_hotplug);
@@ -1731,6 +1741,7 @@ static int tc358743_probe(struct i2c_client *client,
return 0;
err_hdl:
+ media_entity_cleanup(&sd->entity);
v4l2_ctrl_handler_free(&state->hdl);
return err;
}
@@ -1742,6 +1753,7 @@ 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);
v4l2_ctrl_handler_free(&state->hdl);
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html