aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/soc_camera/ov772x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/i2c/soc_camera/ov772x.c')
-rw-r--r--drivers/media/i2c/soc_camera/ov772x.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/drivers/media/i2c/soc_camera/ov772x.c b/drivers/media/i2c/soc_camera/ov772x.c
index e4a10751894d..fbeb5b2f3ae5 100644
--- a/drivers/media/i2c/soc_camera/ov772x.c
+++ b/drivers/media/i2c/soc_camera/ov772x.c
@@ -667,9 +667,9 @@ static int ov772x_s_register(struct v4l2_subdev *sd,
667static int ov772x_s_power(struct v4l2_subdev *sd, int on) 667static int ov772x_s_power(struct v4l2_subdev *sd, int on)
668{ 668{
669 struct i2c_client *client = v4l2_get_subdevdata(sd); 669 struct i2c_client *client = v4l2_get_subdevdata(sd);
670 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 670 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
671 671
672 return soc_camera_set_power(&client->dev, icl, on); 672 return soc_camera_set_power(&client->dev, ssdd, on);
673} 673}
674 674
675static const struct ov772x_win_size *ov772x_select_win(u32 width, u32 height) 675static const struct ov772x_win_size *ov772x_select_win(u32 width, u32 height)
@@ -1019,13 +1019,13 @@ static int ov772x_g_mbus_config(struct v4l2_subdev *sd,
1019 struct v4l2_mbus_config *cfg) 1019 struct v4l2_mbus_config *cfg)
1020{ 1020{
1021 struct i2c_client *client = v4l2_get_subdevdata(sd); 1021 struct i2c_client *client = v4l2_get_subdevdata(sd);
1022 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 1022 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
1023 1023
1024 cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | 1024 cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER |
1025 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | 1025 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH |
1026 V4L2_MBUS_DATA_ACTIVE_HIGH; 1026 V4L2_MBUS_DATA_ACTIVE_HIGH;
1027 cfg->type = V4L2_MBUS_PARALLEL; 1027 cfg->type = V4L2_MBUS_PARALLEL;
1028 cfg->flags = soc_camera_apply_board_flags(icl, cfg); 1028 cfg->flags = soc_camera_apply_board_flags(ssdd, cfg);
1029 1029
1030 return 0; 1030 return 0;
1031} 1031}
@@ -1054,11 +1054,11 @@ static int ov772x_probe(struct i2c_client *client,
1054 const struct i2c_device_id *did) 1054 const struct i2c_device_id *did)
1055{ 1055{
1056 struct ov772x_priv *priv; 1056 struct ov772x_priv *priv;
1057 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 1057 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
1058 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 1058 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
1059 int ret; 1059 int ret;
1060 1060
1061 if (!icl || !icl->priv) { 1061 if (!ssdd || !ssdd->drv_priv) {
1062 dev_err(&client->dev, "OV772X: missing platform data!\n"); 1062 dev_err(&client->dev, "OV772X: missing platform data!\n");
1063 return -EINVAL; 1063 return -EINVAL;
1064 } 1064 }
@@ -1070,11 +1070,11 @@ static int ov772x_probe(struct i2c_client *client,
1070 return -EIO; 1070 return -EIO;
1071 } 1071 }
1072 1072
1073 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 1073 priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
1074 if (!priv) 1074 if (!priv)
1075 return -ENOMEM; 1075 return -ENOMEM;
1076 1076
1077 priv->info = icl->priv; 1077 priv->info = ssdd->drv_priv;
1078 1078
1079 v4l2_i2c_subdev_init(&priv->subdev, client, &ov772x_subdev_ops); 1079 v4l2_i2c_subdev_init(&priv->subdev, client, &ov772x_subdev_ops);
1080 v4l2_ctrl_handler_init(&priv->hdl, 3); 1080 v4l2_ctrl_handler_init(&priv->hdl, 3);
@@ -1085,22 +1085,15 @@ static int ov772x_probe(struct i2c_client *client,
1085 v4l2_ctrl_new_std(&priv->hdl, &ov772x_ctrl_ops, 1085 v4l2_ctrl_new_std(&priv->hdl, &ov772x_ctrl_ops,
1086 V4L2_CID_BAND_STOP_FILTER, 0, 256, 1, 0); 1086 V4L2_CID_BAND_STOP_FILTER, 0, 256, 1, 0);
1087 priv->subdev.ctrl_handler = &priv->hdl; 1087 priv->subdev.ctrl_handler = &priv->hdl;
1088 if (priv->hdl.error) { 1088 if (priv->hdl.error)
1089 ret = priv->hdl.error; 1089 return priv->hdl.error;
1090 goto done;
1091 }
1092 1090
1093 ret = ov772x_video_probe(priv); 1091 ret = ov772x_video_probe(priv);
1094 if (ret < 0) 1092 if (ret < 0) {
1095 goto done;
1096
1097 priv->cfmt = &ov772x_cfmts[0];
1098 priv->win = &ov772x_win_sizes[0];
1099
1100done:
1101 if (ret) {
1102 v4l2_ctrl_handler_free(&priv->hdl); 1093 v4l2_ctrl_handler_free(&priv->hdl);
1103 kfree(priv); 1094 } else {
1095 priv->cfmt = &ov772x_cfmts[0];
1096 priv->win = &ov772x_win_sizes[0];
1104 } 1097 }
1105 return ret; 1098 return ret;
1106} 1099}
@@ -1111,7 +1104,6 @@ static int ov772x_remove(struct i2c_client *client)
1111 1104
1112 v4l2_device_unregister_subdev(&priv->subdev); 1105 v4l2_device_unregister_subdev(&priv->subdev);
1113 v4l2_ctrl_handler_free(&priv->hdl); 1106 v4l2_ctrl_handler_free(&priv->hdl);
1114 kfree(priv);
1115 return 0; 1107 return 0;
1116} 1108}
1117 1109