summaryrefslogtreecommitdiff
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2017-01-30 11:50:45 -0200
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-04-10 14:26:50 -0300
commitff0e9c1d6de4728d2a7cbc98fe188094599b5c8b (patch)
tree1eb116e186d7f502c11733f281aa3e028bbfe8ce /drivers/media/i2c
parent46796cfcd346a70af679d1e7126db6774d440c6f (diff)
[media] ov2640: add MC support
The MC support is needed by the em28xx driver. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/ov2640.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
index dcc1c68e8bb3..b67e44c6f48c 100644
--- a/drivers/media/i2c/ov2640.c
+++ b/drivers/media/i2c/ov2640.c
@@ -282,6 +282,9 @@ struct ov2640_win_size {
struct ov2640_priv {
struct v4l2_subdev subdev;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ struct media_pad pad;
+#endif
struct v4l2_ctrl_handler hdl;
u32 cfmt_code;
struct clk *clk;
@@ -1063,6 +1066,7 @@ static int ov2640_probe(struct i2c_client *client,
goto err_clk;
v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops);
+ priv->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
v4l2_ctrl_handler_init(&priv->hdl, 2);
v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
V4L2_CID_VFLIP, 0, 1, 1, 0);
@@ -1073,19 +1077,30 @@ static int ov2640_probe(struct i2c_client *client,
ret = priv->hdl.error;
goto err_hdl;
}
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ priv->pad.flags = MEDIA_PAD_FL_SOURCE;
+ priv->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR;
+ ret = media_entity_pads_init(&priv->subdev.entity, 1, &priv->pad);
+ if (ret < 0)
+ goto err_hdl;
+#endif
ret = ov2640_video_probe(client);
if (ret < 0)
- goto err_hdl;
+ goto err_videoprobe;
ret = v4l2_async_register_subdev(&priv->subdev);
if (ret < 0)
- goto err_hdl;
+ goto err_videoprobe;
dev_info(&adapter->dev, "OV2640 Probed\n");
return 0;
+err_videoprobe:
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ media_entity_cleanup(&priv->subdev.entity);
+#endif
err_hdl:
v4l2_ctrl_handler_free(&priv->hdl);
err_clk:
@@ -1099,6 +1114,9 @@ static int ov2640_remove(struct i2c_client *client)
v4l2_async_unregister_subdev(&priv->subdev);
v4l2_ctrl_handler_free(&priv->hdl);
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ media_entity_cleanup(&priv->subdev.entity);
+#endif
v4l2_device_unregister_subdev(&priv->subdev);
clk_disable_unprepare(priv->clk);
return 0;