aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/mt9m111.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/mt9m111.c')
-rw-r--r--drivers/media/video/mt9m111.c40
1 files changed, 8 insertions, 32 deletions
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
index 920dd53c4cfa..186902f9be2e 100644
--- a/drivers/media/video/mt9m111.c
+++ b/drivers/media/video/mt9m111.c
@@ -672,13 +672,9 @@ static const struct v4l2_queryctrl mt9m111_controls[] = {
672}; 672};
673 673
674static int mt9m111_resume(struct soc_camera_device *icd); 674static int mt9m111_resume(struct soc_camera_device *icd);
675static int mt9m111_init(struct soc_camera_device *icd);
676static int mt9m111_release(struct soc_camera_device *icd);
677 675
678static struct soc_camera_ops mt9m111_ops = { 676static struct soc_camera_ops mt9m111_ops = {
679 .init = mt9m111_init,
680 .resume = mt9m111_resume, 677 .resume = mt9m111_resume,
681 .release = mt9m111_release,
682 .query_bus_param = mt9m111_query_bus_param, 678 .query_bus_param = mt9m111_query_bus_param,
683 .set_bus_param = mt9m111_set_bus_param, 679 .set_bus_param = mt9m111_set_bus_param,
684 .controls = mt9m111_controls, 680 .controls = mt9m111_controls,
@@ -880,9 +876,8 @@ static int mt9m111_resume(struct soc_camera_device *icd)
880 return ret; 876 return ret;
881} 877}
882 878
883static int mt9m111_init(struct soc_camera_device *icd) 879static int mt9m111_init(struct i2c_client *client)
884{ 880{
885 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
886 struct mt9m111 *mt9m111 = to_mt9m111(client); 881 struct mt9m111 *mt9m111 = to_mt9m111(client);
887 int ret; 882 int ret;
888 883
@@ -899,22 +894,6 @@ static int mt9m111_init(struct soc_camera_device *icd)
899 return ret; 894 return ret;
900} 895}
901 896
902static int mt9m111_release(struct soc_camera_device *icd)
903{
904 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
905 struct mt9m111 *mt9m111 = to_mt9m111(client);
906 int ret;
907
908 ret = reg_clear(RESET, MT9M111_RESET_CHIP_ENABLE);
909 if (!ret)
910 mt9m111->powered = 0;
911
912 if (ret < 0)
913 dev_err(&client->dev, "mt9m11x release failed: %d\n", ret);
914
915 return ret;
916}
917
918/* 897/*
919 * Interface active, can use i2c. If it fails, it can indeed mean, that 898 * Interface active, can use i2c. If it fails, it can indeed mean, that
920 * this wasn't our capture interface, so, we wait for the right one 899 * this wasn't our capture interface, so, we wait for the right one
@@ -934,10 +913,13 @@ static int mt9m111_video_probe(struct soc_camera_device *icd,
934 to_soc_camera_host(icd->dev.parent)->nr != icd->iface) 913 to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
935 return -ENODEV; 914 return -ENODEV;
936 915
937 ret = mt9m111_enable(client); 916 mt9m111->autoexposure = 1;
938 if (ret) 917 mt9m111->autowhitebalance = 1;
939 goto ei2c; 918
940 ret = mt9m111_reset(client); 919 mt9m111->swap_rgb_even_odd = 1;
920 mt9m111->swap_rgb_red_blue = 1;
921
922 ret = mt9m111_init(client);
941 if (ret) 923 if (ret)
942 goto ei2c; 924 goto ei2c;
943 925
@@ -962,12 +944,6 @@ static int mt9m111_video_probe(struct soc_camera_device *icd,
962 944
963 dev_info(&client->dev, "Detected a MT9M11x chip ID %x\n", data); 945 dev_info(&client->dev, "Detected a MT9M11x chip ID %x\n", data);
964 946
965 mt9m111->autoexposure = 1;
966 mt9m111->autowhitebalance = 1;
967
968 mt9m111->swap_rgb_even_odd = 1;
969 mt9m111->swap_rgb_red_blue = 1;
970
971ei2c: 947ei2c:
972 return ret; 948 return ret;
973} 949}