aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/soc_camera/ov6650.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/i2c/soc_camera/ov6650.c')
-rw-r--r--drivers/media/i2c/soc_camera/ov6650.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/drivers/media/i2c/soc_camera/ov6650.c b/drivers/media/i2c/soc_camera/ov6650.c
index e87feb0881e3..dbe4f564e6b2 100644
--- a/drivers/media/i2c/soc_camera/ov6650.c
+++ b/drivers/media/i2c/soc_camera/ov6650.c
@@ -435,9 +435,9 @@ static int ov6650_set_register(struct v4l2_subdev *sd,
435static int ov6650_s_power(struct v4l2_subdev *sd, int on) 435static int ov6650_s_power(struct v4l2_subdev *sd, int on)
436{ 436{
437 struct i2c_client *client = v4l2_get_subdevdata(sd); 437 struct i2c_client *client = v4l2_get_subdevdata(sd);
438 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 438 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
439 439
440 return soc_camera_set_power(&client->dev, icl, on); 440 return soc_camera_set_power(&client->dev, ssdd, on);
441} 441}
442 442
443static int ov6650_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) 443static int ov6650_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
@@ -892,7 +892,7 @@ static int ov6650_g_mbus_config(struct v4l2_subdev *sd,
892 struct v4l2_mbus_config *cfg) 892 struct v4l2_mbus_config *cfg)
893{ 893{
894 struct i2c_client *client = v4l2_get_subdevdata(sd); 894 struct i2c_client *client = v4l2_get_subdevdata(sd);
895 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 895 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
896 896
897 cfg->flags = V4L2_MBUS_MASTER | 897 cfg->flags = V4L2_MBUS_MASTER |
898 V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | 898 V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING |
@@ -900,7 +900,7 @@ static int ov6650_g_mbus_config(struct v4l2_subdev *sd,
900 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW | 900 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW |
901 V4L2_MBUS_DATA_ACTIVE_HIGH; 901 V4L2_MBUS_DATA_ACTIVE_HIGH;
902 cfg->type = V4L2_MBUS_PARALLEL; 902 cfg->type = V4L2_MBUS_PARALLEL;
903 cfg->flags = soc_camera_apply_board_flags(icl, cfg); 903 cfg->flags = soc_camera_apply_board_flags(ssdd, cfg);
904 904
905 return 0; 905 return 0;
906} 906}
@@ -910,8 +910,8 @@ static int ov6650_s_mbus_config(struct v4l2_subdev *sd,
910 const struct v4l2_mbus_config *cfg) 910 const struct v4l2_mbus_config *cfg)
911{ 911{
912 struct i2c_client *client = v4l2_get_subdevdata(sd); 912 struct i2c_client *client = v4l2_get_subdevdata(sd);
913 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 913 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
914 unsigned long flags = soc_camera_apply_board_flags(icl, cfg); 914 unsigned long flags = soc_camera_apply_board_flags(ssdd, cfg);
915 int ret; 915 int ret;
916 916
917 if (flags & V4L2_MBUS_PCLK_SAMPLE_RISING) 917 if (flags & V4L2_MBUS_PCLK_SAMPLE_RISING)
@@ -963,15 +963,15 @@ static int ov6650_probe(struct i2c_client *client,
963 const struct i2c_device_id *did) 963 const struct i2c_device_id *did)
964{ 964{
965 struct ov6650 *priv; 965 struct ov6650 *priv;
966 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 966 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
967 int ret; 967 int ret;
968 968
969 if (!icl) { 969 if (!ssdd) {
970 dev_err(&client->dev, "Missing platform_data for driver\n"); 970 dev_err(&client->dev, "Missing platform_data for driver\n");
971 return -EINVAL; 971 return -EINVAL;
972 } 972 }
973 973
974 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 974 priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
975 if (!priv) { 975 if (!priv) {
976 dev_err(&client->dev, 976 dev_err(&client->dev,
977 "Failed to allocate memory for private data!\n"); 977 "Failed to allocate memory for private data!\n");
@@ -1009,12 +1009,9 @@ static int ov6650_probe(struct i2c_client *client,
1009 V4L2_CID_GAMMA, 0, 0xff, 1, 0x12); 1009 V4L2_CID_GAMMA, 0, 0xff, 1, 0x12);
1010 1010
1011 priv->subdev.ctrl_handler = &priv->hdl; 1011 priv->subdev.ctrl_handler = &priv->hdl;
1012 if (priv->hdl.error) { 1012 if (priv->hdl.error)
1013 int err = priv->hdl.error; 1013 return priv->hdl.error;
1014 1014
1015 kfree(priv);
1016 return err;
1017 }
1018 v4l2_ctrl_auto_cluster(2, &priv->autogain, 0, true); 1015 v4l2_ctrl_auto_cluster(2, &priv->autogain, 0, true);
1019 v4l2_ctrl_auto_cluster(3, &priv->autowb, 0, true); 1016 v4l2_ctrl_auto_cluster(3, &priv->autowb, 0, true);
1020 v4l2_ctrl_auto_cluster(2, &priv->autoexposure, 1017 v4l2_ctrl_auto_cluster(2, &priv->autoexposure,
@@ -1029,10 +1026,8 @@ static int ov6650_probe(struct i2c_client *client,
1029 priv->colorspace = V4L2_COLORSPACE_JPEG; 1026 priv->colorspace = V4L2_COLORSPACE_JPEG;
1030 1027
1031 ret = ov6650_video_probe(client); 1028 ret = ov6650_video_probe(client);
1032 if (ret) { 1029 if (ret)
1033 v4l2_ctrl_handler_free(&priv->hdl); 1030 v4l2_ctrl_handler_free(&priv->hdl);
1034 kfree(priv);
1035 }
1036 1031
1037 return ret; 1032 return ret;
1038} 1033}
@@ -1043,7 +1038,6 @@ static int ov6650_remove(struct i2c_client *client)
1043 1038
1044 v4l2_device_unregister_subdev(&priv->subdev); 1039 v4l2_device_unregister_subdev(&priv->subdev);
1045 v4l2_ctrl_handler_free(&priv->hdl); 1040 v4l2_ctrl_handler_free(&priv->hdl);
1046 kfree(priv);
1047 return 0; 1041 return 0;
1048} 1042}
1049 1043