[media] V4L: soc-camera: start removing struct soc_camera_device from client drivers
[pandora-kernel.git] / drivers / media / video / ov5642.c
index 349a4ad..2a26602 100644 (file)
@@ -855,6 +855,17 @@ static int ov5642_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
        return 0;
 }
 
+static int ov5642_g_mbus_config(struct v4l2_subdev *sd,
+                               struct v4l2_mbus_config *cfg)
+{
+       cfg->type = V4L2_MBUS_CSI2;
+       cfg->flags = V4L2_MBUS_CSI2_2_LANE |
+               V4L2_MBUS_CSI2_CHANNEL_0 |
+               V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
+
+       return 0;
+}
+
 static struct v4l2_subdev_video_ops ov5642_subdev_video_ops = {
        .s_mbus_fmt     = ov5642_s_fmt,
        .g_mbus_fmt     = ov5642_g_fmt,
@@ -862,6 +873,7 @@ static struct v4l2_subdev_video_ops ov5642_subdev_video_ops = {
        .enum_mbus_fmt  = ov5642_enum_fmt,
        .g_crop         = ov5642_g_crop,
        .cropcap        = ov5642_cropcap,
+       .g_mbus_config  = ov5642_g_mbus_config,
 };
 
 static struct v4l2_subdev_core_ops ov5642_subdev_core_ops = {
@@ -877,28 +889,7 @@ static struct v4l2_subdev_ops ov5642_subdev_ops = {
        .video  = &ov5642_subdev_video_ops,
 };
 
-/*
- * We have to provide soc-camera operations, but we don't have anything to say
- * there. The MIPI CSI2 driver will provide .query_bus_param and .set_bus_param
- */
-static unsigned long soc_ov5642_query_bus_param(struct soc_camera_device *icd)
-{
-       return 0;
-}
-
-static int soc_ov5642_set_bus_param(struct soc_camera_device *icd,
-                                unsigned long flags)
-{
-       return -EINVAL;
-}
-
-static struct soc_camera_ops soc_ov5642_ops = {
-       .query_bus_param        = soc_ov5642_query_bus_param,
-       .set_bus_param          = soc_ov5642_set_bus_param,
-};
-
-static int ov5642_video_probe(struct soc_camera_device *icd,
-                             struct i2c_client *client)
+static int ov5642_video_probe(struct i2c_client *client)
 {
        int ret;
        u8 id_high, id_low;
@@ -929,16 +920,9 @@ static int ov5642_probe(struct i2c_client *client,
                        const struct i2c_device_id *did)
 {
        struct ov5642 *priv;
-       struct soc_camera_device *icd = client->dev.platform_data;
-       struct soc_camera_link *icl;
+       struct soc_camera_link *icl = soc_camera_i2c_to_link(client);
        int ret;
 
-       if (!icd) {
-               dev_err(&client->dev, "OV5642: missing soc-camera data!\n");
-               return -EINVAL;
-       }
-
-       icl = to_soc_camera_link(icd);
        if (!icl) {
                dev_err(&client->dev, "OV5642: missing platform data!\n");
                return -EINVAL;
@@ -950,17 +934,15 @@ static int ov5642_probe(struct i2c_client *client,
 
        v4l2_i2c_subdev_init(&priv->subdev, client, &ov5642_subdev_ops);
 
-       icd->ops        = &soc_ov5642_ops;
        priv->fmt       = &ov5642_colour_fmts[0];
 
-       ret = ov5642_video_probe(icd, client);
+       ret = ov5642_video_probe(client);
        if (ret < 0)
                goto error;
 
        return 0;
 
 error:
-       icd->ops = NULL;
        kfree(priv);
        return ret;
 }
@@ -968,10 +950,8 @@ error:
 static int ov5642_remove(struct i2c_client *client)
 {
        struct ov5642 *priv = to_ov5642(client);
-       struct soc_camera_device *icd = client->dev.platform_data;
-       struct soc_camera_link *icl = to_soc_camera_link(icd);
+       struct soc_camera_link *icl = soc_camera_i2c_to_link(client);
 
-       icd->ops = NULL;
        if (icl->free_bus)
                icl->free_bus(icl);
        kfree(priv);