aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-08-25 10:53:23 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:19:18 -0400
commita4c56fd8892e51d675f7665ddee4fd9d7e5c2cc3 (patch)
treebf19f94a6bf467e2a366a9de9a229ff1149baf76
parent6a6c8786725c0b3d143674effa8b772f47b1c189 (diff)
V4L/DVB (12535): soc-camera: remove .init() and .release() methods from struct soc_camera_ops
Remove unneeded soc-camera operations, this also makes the soc-camera API to v4l2 subdevices thinner. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/mt9m001.c22
-rw-r--r--drivers/media/video/mt9m111.c40
-rw-r--r--drivers/media/video/mt9t031.c23
-rw-r--r--drivers/media/video/mt9v022.c8
-rw-r--r--drivers/media/video/soc_camera.c11
-rw-r--r--include/media/soc_camera.h4
6 files changed, 26 insertions, 82 deletions
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c
index e8cf56189ef1..4b394798a293 100644
--- a/drivers/media/video/mt9m001.c
+++ b/drivers/media/video/mt9m001.c
@@ -122,9 +122,8 @@ static int reg_clear(struct i2c_client *client, const u8 reg,
122 return reg_write(client, reg, ret & ~data); 122 return reg_write(client, reg, ret & ~data);
123} 123}
124 124
125static int mt9m001_init(struct soc_camera_device *icd) 125static int mt9m001_init(struct i2c_client *client)
126{ 126{
127 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
128 int ret; 127 int ret;
129 128
130 dev_dbg(&client->dev, "%s\n", __func__); 129 dev_dbg(&client->dev, "%s\n", __func__);
@@ -144,16 +143,6 @@ static int mt9m001_init(struct soc_camera_device *icd)
144 return ret; 143 return ret;
145} 144}
146 145
147static int mt9m001_release(struct soc_camera_device *icd)
148{
149 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
150
151 /* Disable the chip */
152 reg_write(client, MT9M001_OUTPUT_CONTROL, 0);
153
154 return 0;
155}
156
157static int mt9m001_s_stream(struct v4l2_subdev *sd, int enable) 146static int mt9m001_s_stream(struct v4l2_subdev *sd, int enable)
158{ 147{
159 struct i2c_client *client = sd->priv; 148 struct i2c_client *client = sd->priv;
@@ -446,8 +435,6 @@ static const struct v4l2_queryctrl mt9m001_controls[] = {
446}; 435};
447 436
448static struct soc_camera_ops mt9m001_ops = { 437static struct soc_camera_ops mt9m001_ops = {
449 .init = mt9m001_init,
450 .release = mt9m001_release,
451 .set_bus_param = mt9m001_set_bus_param, 438 .set_bus_param = mt9m001_set_bus_param,
452 .query_bus_param = mt9m001_query_bus_param, 439 .query_bus_param = mt9m001_query_bus_param,
453 .controls = mt9m001_controls, 440 .controls = mt9m001_controls,
@@ -581,6 +568,7 @@ static int mt9m001_video_probe(struct soc_camera_device *icd,
581 struct soc_camera_link *icl = to_soc_camera_link(icd); 568 struct soc_camera_link *icl = to_soc_camera_link(icd);
582 s32 data; 569 s32 data;
583 unsigned long flags; 570 unsigned long flags;
571 int ret;
584 572
585 /* We must have a parent by now. And it cannot be a wrong one. 573 /* We must have a parent by now. And it cannot be a wrong one.
586 * So this entire test is completely redundant. */ 574 * So this entire test is completely redundant. */
@@ -637,7 +625,11 @@ static int mt9m001_video_probe(struct soc_camera_device *icd,
637 dev_info(&client->dev, "Detected a MT9M001 chip ID %x (%s)\n", data, 625 dev_info(&client->dev, "Detected a MT9M001 chip ID %x (%s)\n", data,
638 data == 0x8431 ? "C12STM" : "C12ST"); 626 data == 0x8431 ? "C12STM" : "C12ST");
639 627
640 return 0; 628 ret = mt9m001_init(client);
629 if (ret < 0)
630 dev_err(&client->dev, "Failed to initialise the camera\n");
631
632 return ret;
641} 633}
642 634
643static void mt9m001_video_remove(struct soc_camera_device *icd) 635static void mt9m001_video_remove(struct soc_camera_device *icd)
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}
diff --git a/drivers/media/video/mt9t031.c b/drivers/media/video/mt9t031.c
index f234ba602049..9a6489689382 100644
--- a/drivers/media/video/mt9t031.c
+++ b/drivers/media/video/mt9t031.c
@@ -163,20 +163,6 @@ static int mt9t031_disable(struct i2c_client *client)
163 return 0; 163 return 0;
164} 164}
165 165
166static int mt9t031_init(struct soc_camera_device *icd)
167{
168 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
169
170 return mt9t031_idle(client);
171}
172
173static int mt9t031_release(struct soc_camera_device *icd)
174{
175 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
176
177 return mt9t031_disable(client);
178}
179
180static int mt9t031_s_stream(struct v4l2_subdev *sd, int enable) 166static int mt9t031_s_stream(struct v4l2_subdev *sd, int enable)
181{ 167{
182 struct i2c_client *client = sd->priv; 168 struct i2c_client *client = sd->priv;
@@ -539,8 +525,6 @@ static const struct v4l2_queryctrl mt9t031_controls[] = {
539}; 525};
540 526
541static struct soc_camera_ops mt9t031_ops = { 527static struct soc_camera_ops mt9t031_ops = {
542 .init = mt9t031_init,
543 .release = mt9t031_release,
544 .set_bus_param = mt9t031_set_bus_param, 528 .set_bus_param = mt9t031_set_bus_param,
545 .query_bus_param = mt9t031_query_bus_param, 529 .query_bus_param = mt9t031_query_bus_param,
546 .controls = mt9t031_controls, 530 .controls = mt9t031_controls,
@@ -689,6 +673,7 @@ static int mt9t031_video_probe(struct i2c_client *client)
689 struct soc_camera_device *icd = client->dev.platform_data; 673 struct soc_camera_device *icd = client->dev.platform_data;
690 struct mt9t031 *mt9t031 = to_mt9t031(client); 674 struct mt9t031 *mt9t031 = to_mt9t031(client);
691 s32 data; 675 s32 data;
676 int ret;
692 677
693 /* Enable the chip */ 678 /* Enable the chip */
694 data = reg_write(client, MT9T031_CHIP_ENABLE, 1); 679 data = reg_write(client, MT9T031_CHIP_ENABLE, 1);
@@ -711,7 +696,11 @@ static int mt9t031_video_probe(struct i2c_client *client)
711 696
712 dev_info(&client->dev, "Detected a MT9T031 chip ID %x\n", data); 697 dev_info(&client->dev, "Detected a MT9T031 chip ID %x\n", data);
713 698
714 return 0; 699 ret = mt9t031_idle(client);
700 if (ret < 0)
701 dev_err(&client->dev, "Failed to initialise the camera\n");
702
703 return ret;
715} 704}
716 705
717static struct v4l2_subdev_core_ops mt9t031_subdev_core_ops = { 706static struct v4l2_subdev_core_ops mt9t031_subdev_core_ops = {
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c
index 35ea0ddd0715..5c47b55823c8 100644
--- a/drivers/media/video/mt9v022.c
+++ b/drivers/media/video/mt9v022.c
@@ -138,9 +138,8 @@ static int reg_clear(struct i2c_client *client, const u8 reg,
138 return reg_write(client, reg, ret & ~data); 138 return reg_write(client, reg, ret & ~data);
139} 139}
140 140
141static int mt9v022_init(struct soc_camera_device *icd) 141static int mt9v022_init(struct i2c_client *client)
142{ 142{
143 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
144 struct mt9v022 *mt9v022 = to_mt9v022(client); 143 struct mt9v022 *mt9v022 = to_mt9v022(client);
145 int ret; 144 int ret;
146 145
@@ -532,7 +531,6 @@ static const struct v4l2_queryctrl mt9v022_controls[] = {
532}; 531};
533 532
534static struct soc_camera_ops mt9v022_ops = { 533static struct soc_camera_ops mt9v022_ops = {
535 .init = mt9v022_init,
536 .set_bus_param = mt9v022_set_bus_param, 534 .set_bus_param = mt9v022_set_bus_param,
537 .query_bus_param = mt9v022_query_bus_param, 535 .query_bus_param = mt9v022_query_bus_param,
538 .controls = mt9v022_controls, 536 .controls = mt9v022_controls,
@@ -751,6 +749,10 @@ static int mt9v022_video_probe(struct soc_camera_device *icd,
751 data, mt9v022->model == V4L2_IDENT_MT9V022IX7ATM ? 749 data, mt9v022->model == V4L2_IDENT_MT9V022IX7ATM ?
752 "monochrome" : "colour"); 750 "monochrome" : "colour");
753 751
752 ret = mt9v022_init(client);
753 if (ret < 0)
754 dev_err(&client->dev, "Failed to initialise the camera\n");
755
754ei2c: 756ei2c:
755 return ret; 757 return ret;
756} 758}
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
index 86e0648f65a0..27921162514c 100644
--- a/drivers/media/video/soc_camera.c
+++ b/drivers/media/video/soc_camera.c
@@ -385,12 +385,6 @@ static int soc_camera_open(struct file *file)
385 goto eiciadd; 385 goto eiciadd;
386 } 386 }
387 387
388 if (icd->ops->init) {
389 ret = icd->ops->init(icd);
390 if (ret < 0)
391 goto einit;
392 }
393
394 /* Try to configure with default parameters */ 388 /* Try to configure with default parameters */
395 ret = soc_camera_set_fmt(icf, &f); 389 ret = soc_camera_set_fmt(icf, &f);
396 if (ret < 0) 390 if (ret < 0)
@@ -411,9 +405,6 @@ static int soc_camera_open(struct file *file)
411 * and use_count == 1 405 * and use_count == 1
412 */ 406 */
413esfmt: 407esfmt:
414 if (icd->ops->release)
415 icd->ops->release(icd);
416einit:
417 ici->ops->remove(icd); 408 ici->ops->remove(icd);
418eiciadd: 409eiciadd:
419 if (icl->power) 410 if (icl->power)
@@ -438,8 +429,6 @@ static int soc_camera_close(struct file *file)
438 if (!icd->use_count) { 429 if (!icd->use_count) {
439 struct soc_camera_link *icl = to_soc_camera_link(icd); 430 struct soc_camera_link *icl = to_soc_camera_link(icd);
440 431
441 if (icd->ops->release)
442 icd->ops->release(icd);
443 ici->ops->remove(icd); 432 ici->ops->remove(icd);
444 if (icl->power) 433 if (icl->power)
445 icl->power(icd->pdev, 0); 434 icl->power(icd->pdev, 0);
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 3185e8daaa0a..f95cc4a2d9af 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -191,12 +191,8 @@ struct soc_camera_format_xlate {
191struct soc_camera_ops { 191struct soc_camera_ops {
192 int (*suspend)(struct soc_camera_device *, pm_message_t state); 192 int (*suspend)(struct soc_camera_device *, pm_message_t state);
193 int (*resume)(struct soc_camera_device *); 193 int (*resume)(struct soc_camera_device *);
194 int (*init)(struct soc_camera_device *);
195 int (*release)(struct soc_camera_device *);
196 unsigned long (*query_bus_param)(struct soc_camera_device *); 194 unsigned long (*query_bus_param)(struct soc_camera_device *);
197 int (*set_bus_param)(struct soc_camera_device *, unsigned long); 195 int (*set_bus_param)(struct soc_camera_device *, unsigned long);
198 int (*get_chip_id)(struct soc_camera_device *,
199 struct v4l2_dbg_chip_ident *);
200 int (*enum_input)(struct soc_camera_device *, struct v4l2_input *); 196 int (*enum_input)(struct soc_camera_device *, struct v4l2_input *);
201 const struct v4l2_queryctrl *controls; 197 const struct v4l2_queryctrl *controls;
202 int num_controls; 198 int num_controls;