aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/soc_camera/ov2640.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/i2c/soc_camera/ov2640.c')
-rw-r--r--drivers/media/i2c/soc_camera/ov2640.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c
index 66698a83bda2..0f520f693b6e 100644
--- a/drivers/media/i2c/soc_camera/ov2640.c
+++ b/drivers/media/i2c/soc_camera/ov2640.c
@@ -771,9 +771,9 @@ static int ov2640_s_register(struct v4l2_subdev *sd,
771static int ov2640_s_power(struct v4l2_subdev *sd, int on) 771static int ov2640_s_power(struct v4l2_subdev *sd, int on)
772{ 772{
773 struct i2c_client *client = v4l2_get_subdevdata(sd); 773 struct i2c_client *client = v4l2_get_subdevdata(sd);
774 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 774 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
775 775
776 return soc_camera_set_power(&client->dev, icl, on); 776 return soc_camera_set_power(&client->dev, ssdd, on);
777} 777}
778 778
779/* Select the nearest higher resolution for capture */ 779/* Select the nearest higher resolution for capture */
@@ -1046,13 +1046,13 @@ static int ov2640_g_mbus_config(struct v4l2_subdev *sd,
1046 struct v4l2_mbus_config *cfg) 1046 struct v4l2_mbus_config *cfg)
1047{ 1047{
1048 struct i2c_client *client = v4l2_get_subdevdata(sd); 1048 struct i2c_client *client = v4l2_get_subdevdata(sd);
1049 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 1049 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
1050 1050
1051 cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | 1051 cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER |
1052 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | 1052 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH |
1053 V4L2_MBUS_DATA_ACTIVE_HIGH; 1053 V4L2_MBUS_DATA_ACTIVE_HIGH;
1054 cfg->type = V4L2_MBUS_PARALLEL; 1054 cfg->type = V4L2_MBUS_PARALLEL;
1055 cfg->flags = soc_camera_apply_board_flags(icl, cfg); 1055 cfg->flags = soc_camera_apply_board_flags(ssdd, cfg);
1056 1056
1057 return 0; 1057 return 0;
1058} 1058}
@@ -1080,11 +1080,11 @@ static int ov2640_probe(struct i2c_client *client,
1080 const struct i2c_device_id *did) 1080 const struct i2c_device_id *did)
1081{ 1081{
1082 struct ov2640_priv *priv; 1082 struct ov2640_priv *priv;
1083 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 1083 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
1084 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 1084 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
1085 int ret; 1085 int ret;
1086 1086
1087 if (!icl) { 1087 if (!ssdd) {
1088 dev_err(&adapter->dev, 1088 dev_err(&adapter->dev,
1089 "OV2640: Missing platform_data for driver\n"); 1089 "OV2640: Missing platform_data for driver\n");
1090 return -EINVAL; 1090 return -EINVAL;
@@ -1096,7 +1096,7 @@ static int ov2640_probe(struct i2c_client *client,
1096 return -EIO; 1096 return -EIO;
1097 } 1097 }
1098 1098
1099 priv = kzalloc(sizeof(struct ov2640_priv), GFP_KERNEL); 1099 priv = devm_kzalloc(&client->dev, sizeof(struct ov2640_priv), GFP_KERNEL);
1100 if (!priv) { 1100 if (!priv) {
1101 dev_err(&adapter->dev, 1101 dev_err(&adapter->dev,
1102 "Failed to allocate memory for private data!\n"); 1102 "Failed to allocate memory for private data!\n");
@@ -1110,20 +1110,14 @@ static int ov2640_probe(struct i2c_client *client,
1110 v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops, 1110 v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
1111 V4L2_CID_HFLIP, 0, 1, 1, 0); 1111 V4L2_CID_HFLIP, 0, 1, 1, 0);
1112 priv->subdev.ctrl_handler = &priv->hdl; 1112 priv->subdev.ctrl_handler = &priv->hdl;
1113 if (priv->hdl.error) { 1113 if (priv->hdl.error)
1114 int err = priv->hdl.error; 1114 return priv->hdl.error;
1115
1116 kfree(priv);
1117 return err;
1118 }
1119 1115
1120 ret = ov2640_video_probe(client); 1116 ret = ov2640_video_probe(client);
1121 if (ret) { 1117 if (ret)
1122 v4l2_ctrl_handler_free(&priv->hdl); 1118 v4l2_ctrl_handler_free(&priv->hdl);
1123 kfree(priv); 1119 else
1124 } else {
1125 dev_info(&adapter->dev, "OV2640 Probed\n"); 1120 dev_info(&adapter->dev, "OV2640 Probed\n");
1126 }
1127 1121
1128 return ret; 1122 return ret;
1129} 1123}
@@ -1134,7 +1128,6 @@ static int ov2640_remove(struct i2c_client *client)
1134 1128
1135 v4l2_device_unregister_subdev(&priv->subdev); 1129 v4l2_device_unregister_subdev(&priv->subdev);
1136 v4l2_ctrl_handler_free(&priv->hdl); 1130 v4l2_ctrl_handler_free(&priv->hdl);
1137 kfree(priv);
1138 return 0; 1131 return 0;
1139} 1132}
1140 1133