aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/i2c/soc_camera/imx074.c14
-rw-r--r--drivers/media/i2c/soc_camera/mt9m001.c38
-rw-r--r--drivers/media/i2c/soc_camera/mt9m111.c21
-rw-r--r--drivers/media/i2c/soc_camera/mt9t031.c22
-rw-r--r--drivers/media/i2c/soc_camera/mt9t112.c18
-rw-r--r--drivers/media/i2c/soc_camera/mt9v022.c36
-rw-r--r--drivers/media/i2c/soc_camera/ov2640.c12
-rw-r--r--drivers/media/i2c/soc_camera/ov5642.c16
-rw-r--r--drivers/media/i2c/soc_camera/ov6650.c16
-rw-r--r--drivers/media/i2c/soc_camera/ov772x.c14
-rw-r--r--drivers/media/i2c/soc_camera/ov9640.c12
-rw-r--r--drivers/media/i2c/soc_camera/ov9740.c14
-rw-r--r--drivers/media/i2c/soc_camera/rj54n1cb0c.c24
-rw-r--r--drivers/media/i2c/soc_camera/tw9910.c18
-rw-r--r--drivers/media/platform/soc_camera/soc_camera.c98
-rw-r--r--drivers/media/platform/soc_camera/soc_camera_platform.c2
-rw-r--r--include/media/soc_camera.h102
-rw-r--r--include/media/soc_camera_platform.h10
18 files changed, 279 insertions, 208 deletions
diff --git a/drivers/media/i2c/soc_camera/imx074.c b/drivers/media/i2c/soc_camera/imx074.c
index f8534eec9de9..1c065717cdd1 100644
--- a/drivers/media/i2c/soc_camera/imx074.c
+++ b/drivers/media/i2c/soc_camera/imx074.c
@@ -271,9 +271,9 @@ static int imx074_g_chip_ident(struct v4l2_subdev *sd,
271static int imx074_s_power(struct v4l2_subdev *sd, int on) 271static int imx074_s_power(struct v4l2_subdev *sd, int on)
272{ 272{
273 struct i2c_client *client = v4l2_get_subdevdata(sd); 273 struct i2c_client *client = v4l2_get_subdevdata(sd);
274 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 274 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
275 275
276 return soc_camera_set_power(&client->dev, icl, on); 276 return soc_camera_set_power(&client->dev, ssdd, on);
277} 277}
278 278
279static int imx074_g_mbus_config(struct v4l2_subdev *sd, 279static int imx074_g_mbus_config(struct v4l2_subdev *sd,
@@ -430,10 +430,10 @@ static int imx074_probe(struct i2c_client *client,
430{ 430{
431 struct imx074 *priv; 431 struct imx074 *priv;
432 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 432 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
433 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 433 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
434 int ret; 434 int ret;
435 435
436 if (!icl) { 436 if (!ssdd) {
437 dev_err(&client->dev, "IMX074: missing platform data!\n"); 437 dev_err(&client->dev, "IMX074: missing platform data!\n");
438 return -EINVAL; 438 return -EINVAL;
439 } 439 }
@@ -464,10 +464,10 @@ static int imx074_probe(struct i2c_client *client,
464static int imx074_remove(struct i2c_client *client) 464static int imx074_remove(struct i2c_client *client)
465{ 465{
466 struct imx074 *priv = to_imx074(client); 466 struct imx074 *priv = to_imx074(client);
467 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 467 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
468 468
469 if (icl->free_bus) 469 if (ssdd->free_bus)
470 icl->free_bus(icl); 470 ssdd->free_bus(ssdd);
471 kfree(priv); 471 kfree(priv);
472 472
473 return 0; 473 return 0;
diff --git a/drivers/media/i2c/soc_camera/mt9m001.c b/drivers/media/i2c/soc_camera/mt9m001.c
index 19f8a07764f9..9ae7066798eb 100644
--- a/drivers/media/i2c/soc_camera/mt9m001.c
+++ b/drivers/media/i2c/soc_camera/mt9m001.c
@@ -23,7 +23,7 @@
23/* 23/*
24 * mt9m001 i2c address 0x5d 24 * mt9m001 i2c address 0x5d
25 * The platform has to define struct i2c_board_info objects and link to them 25 * The platform has to define struct i2c_board_info objects and link to them
26 * from struct soc_camera_link 26 * from struct soc_camera_host_desc
27 */ 27 */
28 28
29/* mt9m001 selected register addresses */ 29/* mt9m001 selected register addresses */
@@ -380,9 +380,9 @@ static int mt9m001_s_register(struct v4l2_subdev *sd,
380static int mt9m001_s_power(struct v4l2_subdev *sd, int on) 380static int mt9m001_s_power(struct v4l2_subdev *sd, int on)
381{ 381{
382 struct i2c_client *client = v4l2_get_subdevdata(sd); 382 struct i2c_client *client = v4l2_get_subdevdata(sd);
383 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 383 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
384 384
385 return soc_camera_set_power(&client->dev, icl, on); 385 return soc_camera_set_power(&client->dev, ssdd, on);
386} 386}
387 387
388static int mt9m001_g_volatile_ctrl(struct v4l2_ctrl *ctrl) 388static int mt9m001_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
@@ -482,7 +482,7 @@ static int mt9m001_s_ctrl(struct v4l2_ctrl *ctrl)
482 * Interface active, can use i2c. If it fails, it can indeed mean, that 482 * Interface active, can use i2c. If it fails, it can indeed mean, that
483 * this wasn't our capture interface, so, we wait for the right one 483 * this wasn't our capture interface, so, we wait for the right one
484 */ 484 */
485static int mt9m001_video_probe(struct soc_camera_link *icl, 485static int mt9m001_video_probe(struct soc_camera_subdev_desc *ssdd,
486 struct i2c_client *client) 486 struct i2c_client *client)
487{ 487{
488 struct mt9m001 *mt9m001 = to_mt9m001(client); 488 struct mt9m001 *mt9m001 = to_mt9m001(client);
@@ -526,8 +526,8 @@ static int mt9m001_video_probe(struct soc_camera_link *icl,
526 * The platform may support different bus widths due to 526 * The platform may support different bus widths due to
527 * different routing of the data lines. 527 * different routing of the data lines.
528 */ 528 */
529 if (icl->query_bus_param) 529 if (ssdd->query_bus_param)
530 flags = icl->query_bus_param(icl); 530 flags = ssdd->query_bus_param(ssdd);
531 else 531 else
532 flags = SOCAM_DATAWIDTH_10; 532 flags = SOCAM_DATAWIDTH_10;
533 533
@@ -558,10 +558,10 @@ done:
558 return ret; 558 return ret;
559} 559}
560 560
561static void mt9m001_video_remove(struct soc_camera_link *icl) 561static void mt9m001_video_remove(struct soc_camera_subdev_desc *ssdd)
562{ 562{
563 if (icl->free_bus) 563 if (ssdd->free_bus)
564 icl->free_bus(icl); 564 ssdd->free_bus(ssdd);
565} 565}
566 566
567static int mt9m001_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines) 567static int mt9m001_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines)
@@ -605,14 +605,14 @@ static int mt9m001_g_mbus_config(struct v4l2_subdev *sd,
605 struct v4l2_mbus_config *cfg) 605 struct v4l2_mbus_config *cfg)
606{ 606{
607 struct i2c_client *client = v4l2_get_subdevdata(sd); 607 struct i2c_client *client = v4l2_get_subdevdata(sd);
608 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 608 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
609 609
610 /* MT9M001 has all capture_format parameters fixed */ 610 /* MT9M001 has all capture_format parameters fixed */
611 cfg->flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | 611 cfg->flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
612 V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_HIGH | 612 V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_HIGH |
613 V4L2_MBUS_DATA_ACTIVE_HIGH | V4L2_MBUS_MASTER; 613 V4L2_MBUS_DATA_ACTIVE_HIGH | V4L2_MBUS_MASTER;
614 cfg->type = V4L2_MBUS_PARALLEL; 614 cfg->type = V4L2_MBUS_PARALLEL;
615 cfg->flags = soc_camera_apply_board_flags(icl, cfg); 615 cfg->flags = soc_camera_apply_board_flags(ssdd, cfg);
616 616
617 return 0; 617 return 0;
618} 618}
@@ -621,12 +621,12 @@ static int mt9m001_s_mbus_config(struct v4l2_subdev *sd,
621 const struct v4l2_mbus_config *cfg) 621 const struct v4l2_mbus_config *cfg)
622{ 622{
623 const struct i2c_client *client = v4l2_get_subdevdata(sd); 623 const struct i2c_client *client = v4l2_get_subdevdata(sd);
624 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 624 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
625 struct mt9m001 *mt9m001 = to_mt9m001(client); 625 struct mt9m001 *mt9m001 = to_mt9m001(client);
626 unsigned int bps = soc_mbus_get_fmtdesc(mt9m001->fmt->code)->bits_per_sample; 626 unsigned int bps = soc_mbus_get_fmtdesc(mt9m001->fmt->code)->bits_per_sample;
627 627
628 if (icl->set_bus_param) 628 if (ssdd->set_bus_param)
629 return icl->set_bus_param(icl, 1 << (bps - 1)); 629 return ssdd->set_bus_param(ssdd, 1 << (bps - 1));
630 630
631 /* 631 /*
632 * Without board specific bus width settings we only support the 632 * Without board specific bus width settings we only support the
@@ -663,10 +663,10 @@ static int mt9m001_probe(struct i2c_client *client,
663{ 663{
664 struct mt9m001 *mt9m001; 664 struct mt9m001 *mt9m001;
665 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 665 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
666 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 666 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
667 int ret; 667 int ret;
668 668
669 if (!icl) { 669 if (!ssdd) {
670 dev_err(&client->dev, "MT9M001 driver needs platform data\n"); 670 dev_err(&client->dev, "MT9M001 driver needs platform data\n");
671 return -EINVAL; 671 return -EINVAL;
672 } 672 }
@@ -713,7 +713,7 @@ static int mt9m001_probe(struct i2c_client *client,
713 mt9m001->rect.width = MT9M001_MAX_WIDTH; 713 mt9m001->rect.width = MT9M001_MAX_WIDTH;
714 mt9m001->rect.height = MT9M001_MAX_HEIGHT; 714 mt9m001->rect.height = MT9M001_MAX_HEIGHT;
715 715
716 ret = mt9m001_video_probe(icl, client); 716 ret = mt9m001_video_probe(ssdd, client);
717 if (ret) { 717 if (ret) {
718 v4l2_ctrl_handler_free(&mt9m001->hdl); 718 v4l2_ctrl_handler_free(&mt9m001->hdl);
719 kfree(mt9m001); 719 kfree(mt9m001);
@@ -725,11 +725,11 @@ static int mt9m001_probe(struct i2c_client *client,
725static int mt9m001_remove(struct i2c_client *client) 725static int mt9m001_remove(struct i2c_client *client)
726{ 726{
727 struct mt9m001 *mt9m001 = to_mt9m001(client); 727 struct mt9m001 *mt9m001 = to_mt9m001(client);
728 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 728 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
729 729
730 v4l2_device_unregister_subdev(&mt9m001->subdev); 730 v4l2_device_unregister_subdev(&mt9m001->subdev);
731 v4l2_ctrl_handler_free(&mt9m001->hdl); 731 v4l2_ctrl_handler_free(&mt9m001->hdl);
732 mt9m001_video_remove(icl); 732 mt9m001_video_remove(ssdd);
733 kfree(mt9m001); 733 kfree(mt9m001);
734 734
735 return 0; 735 return 0;
diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/soc_camera/mt9m111.c
index 62fd94af599b..78511669bab0 100644
--- a/drivers/media/i2c/soc_camera/mt9m111.c
+++ b/drivers/media/i2c/soc_camera/mt9m111.c
@@ -24,7 +24,8 @@
24/* 24/*
25 * MT9M111, MT9M112 and MT9M131: 25 * MT9M111, MT9M112 and MT9M131:
26 * i2c address is 0x48 or 0x5d (depending on SADDR pin) 26 * i2c address is 0x48 or 0x5d (depending on SADDR pin)
27 * The platform has to define i2c_board_info and call i2c_register_board_info() 27 * The platform has to define struct i2c_board_info objects and link to them
28 * from struct soc_camera_host_desc
28 */ 29 */
29 30
30/* 31/*
@@ -799,17 +800,17 @@ static int mt9m111_init(struct mt9m111 *mt9m111)
799static int mt9m111_power_on(struct mt9m111 *mt9m111) 800static int mt9m111_power_on(struct mt9m111 *mt9m111)
800{ 801{
801 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); 802 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev);
802 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 803 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
803 int ret; 804 int ret;
804 805
805 ret = soc_camera_power_on(&client->dev, icl); 806 ret = soc_camera_power_on(&client->dev, ssdd);
806 if (ret < 0) 807 if (ret < 0)
807 return ret; 808 return ret;
808 809
809 ret = mt9m111_resume(mt9m111); 810 ret = mt9m111_resume(mt9m111);
810 if (ret < 0) { 811 if (ret < 0) {
811 dev_err(&client->dev, "Failed to resume the sensor: %d\n", ret); 812 dev_err(&client->dev, "Failed to resume the sensor: %d\n", ret);
812 soc_camera_power_off(&client->dev, icl); 813 soc_camera_power_off(&client->dev, ssdd);
813 } 814 }
814 815
815 return ret; 816 return ret;
@@ -818,10 +819,10 @@ static int mt9m111_power_on(struct mt9m111 *mt9m111)
818static void mt9m111_power_off(struct mt9m111 *mt9m111) 819static void mt9m111_power_off(struct mt9m111 *mt9m111)
819{ 820{
820 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); 821 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev);
821 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 822 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
822 823
823 mt9m111_suspend(mt9m111); 824 mt9m111_suspend(mt9m111);
824 soc_camera_power_off(&client->dev, icl); 825 soc_camera_power_off(&client->dev, ssdd);
825} 826}
826 827
827static int mt9m111_s_power(struct v4l2_subdev *sd, int on) 828static int mt9m111_s_power(struct v4l2_subdev *sd, int on)
@@ -879,13 +880,13 @@ static int mt9m111_g_mbus_config(struct v4l2_subdev *sd,
879 struct v4l2_mbus_config *cfg) 880 struct v4l2_mbus_config *cfg)
880{ 881{
881 struct i2c_client *client = v4l2_get_subdevdata(sd); 882 struct i2c_client *client = v4l2_get_subdevdata(sd);
882 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 883 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
883 884
884 cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING | 885 cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING |
885 V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_HIGH | 886 V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_HIGH |
886 V4L2_MBUS_DATA_ACTIVE_HIGH; 887 V4L2_MBUS_DATA_ACTIVE_HIGH;
887 cfg->type = V4L2_MBUS_PARALLEL; 888 cfg->type = V4L2_MBUS_PARALLEL;
888 cfg->flags = soc_camera_apply_board_flags(icl, cfg); 889 cfg->flags = soc_camera_apply_board_flags(ssdd, cfg);
889 890
890 return 0; 891 return 0;
891} 892}
@@ -956,10 +957,10 @@ static int mt9m111_probe(struct i2c_client *client,
956{ 957{
957 struct mt9m111 *mt9m111; 958 struct mt9m111 *mt9m111;
958 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 959 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
959 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 960 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
960 int ret; 961 int ret;
961 962
962 if (!icl) { 963 if (!ssdd) {
963 dev_err(&client->dev, "mt9m111: driver needs platform data\n"); 964 dev_err(&client->dev, "mt9m111: driver needs platform data\n");
964 return -EINVAL; 965 return -EINVAL;
965 } 966 }
diff --git a/drivers/media/i2c/soc_camera/mt9t031.c b/drivers/media/i2c/soc_camera/mt9t031.c
index 40800b10a080..9ca6d65cefaf 100644
--- a/drivers/media/i2c/soc_camera/mt9t031.c
+++ b/drivers/media/i2c/soc_camera/mt9t031.c
@@ -31,8 +31,8 @@
31 31
32/* 32/*
33 * mt9t031 i2c address 0x5d 33 * mt9t031 i2c address 0x5d
34 * The platform has to define i2c_board_info and link to it from 34 * The platform has to define struct i2c_board_info objects and link to them
35 * struct soc_camera_link 35 * from struct soc_camera_host_desc
36 */ 36 */
37 37
38/* mt9t031 selected register addresses */ 38/* mt9t031 selected register addresses */
@@ -608,18 +608,18 @@ static struct device_type mt9t031_dev_type = {
608static int mt9t031_s_power(struct v4l2_subdev *sd, int on) 608static int mt9t031_s_power(struct v4l2_subdev *sd, int on)
609{ 609{
610 struct i2c_client *client = v4l2_get_subdevdata(sd); 610 struct i2c_client *client = v4l2_get_subdevdata(sd);
611 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 611 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
612 struct video_device *vdev = soc_camera_i2c_to_vdev(client); 612 struct video_device *vdev = soc_camera_i2c_to_vdev(client);
613 int ret; 613 int ret;
614 614
615 if (on) { 615 if (on) {
616 ret = soc_camera_power_on(&client->dev, icl); 616 ret = soc_camera_power_on(&client->dev, ssdd);
617 if (ret < 0) 617 if (ret < 0)
618 return ret; 618 return ret;
619 vdev->dev.type = &mt9t031_dev_type; 619 vdev->dev.type = &mt9t031_dev_type;
620 } else { 620 } else {
621 vdev->dev.type = NULL; 621 vdev->dev.type = NULL;
622 soc_camera_power_off(&client->dev, icl); 622 soc_camera_power_off(&client->dev, ssdd);
623 } 623 }
624 624
625 return 0; 625 return 0;
@@ -707,13 +707,13 @@ static int mt9t031_g_mbus_config(struct v4l2_subdev *sd,
707 struct v4l2_mbus_config *cfg) 707 struct v4l2_mbus_config *cfg)
708{ 708{
709 struct i2c_client *client = v4l2_get_subdevdata(sd); 709 struct i2c_client *client = v4l2_get_subdevdata(sd);
710 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 710 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
711 711
712 cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING | 712 cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING |
713 V4L2_MBUS_PCLK_SAMPLE_FALLING | V4L2_MBUS_HSYNC_ACTIVE_HIGH | 713 V4L2_MBUS_PCLK_SAMPLE_FALLING | V4L2_MBUS_HSYNC_ACTIVE_HIGH |
714 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_DATA_ACTIVE_HIGH; 714 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_DATA_ACTIVE_HIGH;
715 cfg->type = V4L2_MBUS_PARALLEL; 715 cfg->type = V4L2_MBUS_PARALLEL;
716 cfg->flags = soc_camera_apply_board_flags(icl, cfg); 716 cfg->flags = soc_camera_apply_board_flags(ssdd, cfg);
717 717
718 return 0; 718 return 0;
719} 719}
@@ -722,9 +722,9 @@ static int mt9t031_s_mbus_config(struct v4l2_subdev *sd,
722 const struct v4l2_mbus_config *cfg) 722 const struct v4l2_mbus_config *cfg)
723{ 723{
724 struct i2c_client *client = v4l2_get_subdevdata(sd); 724 struct i2c_client *client = v4l2_get_subdevdata(sd);
725 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 725 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
726 726
727 if (soc_camera_apply_board_flags(icl, cfg) & 727 if (soc_camera_apply_board_flags(ssdd, cfg) &
728 V4L2_MBUS_PCLK_SAMPLE_FALLING) 728 V4L2_MBUS_PCLK_SAMPLE_FALLING)
729 return reg_clear(client, MT9T031_PIXEL_CLOCK_CONTROL, 0x8000); 729 return reg_clear(client, MT9T031_PIXEL_CLOCK_CONTROL, 0x8000);
730 else 730 else
@@ -758,11 +758,11 @@ static int mt9t031_probe(struct i2c_client *client,
758 const struct i2c_device_id *did) 758 const struct i2c_device_id *did)
759{ 759{
760 struct mt9t031 *mt9t031; 760 struct mt9t031 *mt9t031;
761 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 761 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
762 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 762 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
763 int ret; 763 int ret;
764 764
765 if (!icl) { 765 if (!ssdd) {
766 dev_err(&client->dev, "MT9T031 driver needs platform data\n"); 766 dev_err(&client->dev, "MT9T031 driver needs platform data\n");
767 return -EINVAL; 767 return -EINVAL;
768 } 768 }
diff --git a/drivers/media/i2c/soc_camera/mt9t112.c b/drivers/media/i2c/soc_camera/mt9t112.c
index de7cd836b0a2..92bb65de6cd9 100644
--- a/drivers/media/i2c/soc_camera/mt9t112.c
+++ b/drivers/media/i2c/soc_camera/mt9t112.c
@@ -779,9 +779,9 @@ static int mt9t112_s_register(struct v4l2_subdev *sd,
779static int mt9t112_s_power(struct v4l2_subdev *sd, int on) 779static int mt9t112_s_power(struct v4l2_subdev *sd, int on)
780{ 780{
781 struct i2c_client *client = v4l2_get_subdevdata(sd); 781 struct i2c_client *client = v4l2_get_subdevdata(sd);
782 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 782 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
783 783
784 return soc_camera_set_power(&client->dev, icl, on); 784 return soc_camera_set_power(&client->dev, ssdd, on);
785} 785}
786 786
787static struct v4l2_subdev_core_ops mt9t112_subdev_core_ops = { 787static struct v4l2_subdev_core_ops mt9t112_subdev_core_ops = {
@@ -991,13 +991,13 @@ static int mt9t112_g_mbus_config(struct v4l2_subdev *sd,
991 struct v4l2_mbus_config *cfg) 991 struct v4l2_mbus_config *cfg)
992{ 992{
993 struct i2c_client *client = v4l2_get_subdevdata(sd); 993 struct i2c_client *client = v4l2_get_subdevdata(sd);
994 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 994 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
995 995
996 cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_VSYNC_ACTIVE_HIGH | 996 cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_VSYNC_ACTIVE_HIGH |
997 V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_DATA_ACTIVE_HIGH | 997 V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_DATA_ACTIVE_HIGH |
998 V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING; 998 V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING;
999 cfg->type = V4L2_MBUS_PARALLEL; 999 cfg->type = V4L2_MBUS_PARALLEL;
1000 cfg->flags = soc_camera_apply_board_flags(icl, cfg); 1000 cfg->flags = soc_camera_apply_board_flags(ssdd, cfg);
1001 1001
1002 return 0; 1002 return 0;
1003} 1003}
@@ -1006,10 +1006,10 @@ static int mt9t112_s_mbus_config(struct v4l2_subdev *sd,
1006 const struct v4l2_mbus_config *cfg) 1006 const struct v4l2_mbus_config *cfg)
1007{ 1007{
1008 struct i2c_client *client = v4l2_get_subdevdata(sd); 1008 struct i2c_client *client = v4l2_get_subdevdata(sd);
1009 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 1009 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
1010 struct mt9t112_priv *priv = to_mt9t112(client); 1010 struct mt9t112_priv *priv = to_mt9t112(client);
1011 1011
1012 if (soc_camera_apply_board_flags(icl, cfg) & V4L2_MBUS_PCLK_SAMPLE_RISING) 1012 if (soc_camera_apply_board_flags(ssdd, cfg) & V4L2_MBUS_PCLK_SAMPLE_RISING)
1013 priv->flags |= PCLK_RISING; 1013 priv->flags |= PCLK_RISING;
1014 1014
1015 return 0; 1015 return 0;
@@ -1078,7 +1078,7 @@ static int mt9t112_probe(struct i2c_client *client,
1078 const struct i2c_device_id *did) 1078 const struct i2c_device_id *did)
1079{ 1079{
1080 struct mt9t112_priv *priv; 1080 struct mt9t112_priv *priv;
1081 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 1081 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
1082 struct v4l2_rect rect = { 1082 struct v4l2_rect rect = {
1083 .width = VGA_WIDTH, 1083 .width = VGA_WIDTH,
1084 .height = VGA_HEIGHT, 1084 .height = VGA_HEIGHT,
@@ -1087,7 +1087,7 @@ static int mt9t112_probe(struct i2c_client *client,
1087 }; 1087 };
1088 int ret; 1088 int ret;
1089 1089
1090 if (!icl || !icl->priv) { 1090 if (!ssdd || !ssdd->drv_priv) {
1091 dev_err(&client->dev, "mt9t112: missing platform data!\n"); 1091 dev_err(&client->dev, "mt9t112: missing platform data!\n");
1092 return -EINVAL; 1092 return -EINVAL;
1093 } 1093 }
@@ -1096,7 +1096,7 @@ static int mt9t112_probe(struct i2c_client *client,
1096 if (!priv) 1096 if (!priv)
1097 return -ENOMEM; 1097 return -ENOMEM;
1098 1098
1099 priv->info = icl->priv; 1099 priv->info = ssdd->drv_priv;
1100 1100
1101 v4l2_i2c_subdev_init(&priv->subdev, client, &mt9t112_subdev_ops); 1101 v4l2_i2c_subdev_init(&priv->subdev, client, &mt9t112_subdev_ops);
1102 1102
diff --git a/drivers/media/i2c/soc_camera/mt9v022.c b/drivers/media/i2c/soc_camera/mt9v022.c
index 75098024d477..33fb5c3b52b4 100644
--- a/drivers/media/i2c/soc_camera/mt9v022.c
+++ b/drivers/media/i2c/soc_camera/mt9v022.c
@@ -25,7 +25,7 @@
25/* 25/*
26 * mt9v022 i2c address 0x48, 0x4c, 0x58, 0x5c 26 * mt9v022 i2c address 0x48, 0x4c, 0x58, 0x5c
27 * The platform has to define struct i2c_board_info objects and link to them 27 * The platform has to define struct i2c_board_info objects and link to them
28 * from struct soc_camera_link 28 * from struct soc_camera_host_desc
29 */ 29 */
30 30
31static char *sensor_type; 31static char *sensor_type;
@@ -508,9 +508,9 @@ static int mt9v022_s_register(struct v4l2_subdev *sd,
508static int mt9v022_s_power(struct v4l2_subdev *sd, int on) 508static int mt9v022_s_power(struct v4l2_subdev *sd, int on)
509{ 509{
510 struct i2c_client *client = v4l2_get_subdevdata(sd); 510 struct i2c_client *client = v4l2_get_subdevdata(sd);
511 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 511 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
512 512
513 return soc_camera_set_power(&client->dev, icl, on); 513 return soc_camera_set_power(&client->dev, ssdd, on);
514} 514}
515 515
516static int mt9v022_g_volatile_ctrl(struct v4l2_ctrl *ctrl) 516static int mt9v022_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
@@ -655,7 +655,7 @@ static int mt9v022_s_ctrl(struct v4l2_ctrl *ctrl)
655static int mt9v022_video_probe(struct i2c_client *client) 655static int mt9v022_video_probe(struct i2c_client *client)
656{ 656{
657 struct mt9v022 *mt9v022 = to_mt9v022(client); 657 struct mt9v022 *mt9v022 = to_mt9v022(client);
658 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 658 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
659 s32 data; 659 s32 data;
660 int ret; 660 int ret;
661 unsigned long flags; 661 unsigned long flags;
@@ -715,8 +715,8 @@ static int mt9v022_video_probe(struct i2c_client *client)
715 * The platform may support different bus widths due to 715 * The platform may support different bus widths due to
716 * different routing of the data lines. 716 * different routing of the data lines.
717 */ 717 */
718 if (icl->query_bus_param) 718 if (ssdd->query_bus_param)
719 flags = icl->query_bus_param(icl); 719 flags = ssdd->query_bus_param(ssdd);
720 else 720 else
721 flags = SOCAM_DATAWIDTH_10; 721 flags = SOCAM_DATAWIDTH_10;
722 722
@@ -784,7 +784,7 @@ static int mt9v022_g_mbus_config(struct v4l2_subdev *sd,
784 struct v4l2_mbus_config *cfg) 784 struct v4l2_mbus_config *cfg)
785{ 785{
786 struct i2c_client *client = v4l2_get_subdevdata(sd); 786 struct i2c_client *client = v4l2_get_subdevdata(sd);
787 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 787 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
788 788
789 cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_SLAVE | 789 cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_SLAVE |
790 V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | 790 V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING |
@@ -792,7 +792,7 @@ static int mt9v022_g_mbus_config(struct v4l2_subdev *sd,
792 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW | 792 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW |
793 V4L2_MBUS_DATA_ACTIVE_HIGH; 793 V4L2_MBUS_DATA_ACTIVE_HIGH;
794 cfg->type = V4L2_MBUS_PARALLEL; 794 cfg->type = V4L2_MBUS_PARALLEL;
795 cfg->flags = soc_camera_apply_board_flags(icl, cfg); 795 cfg->flags = soc_camera_apply_board_flags(ssdd, cfg);
796 796
797 return 0; 797 return 0;
798} 798}
@@ -801,15 +801,15 @@ static int mt9v022_s_mbus_config(struct v4l2_subdev *sd,
801 const struct v4l2_mbus_config *cfg) 801 const struct v4l2_mbus_config *cfg)
802{ 802{
803 struct i2c_client *client = v4l2_get_subdevdata(sd); 803 struct i2c_client *client = v4l2_get_subdevdata(sd);
804 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 804 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
805 struct mt9v022 *mt9v022 = to_mt9v022(client); 805 struct mt9v022 *mt9v022 = to_mt9v022(client);
806 unsigned long flags = soc_camera_apply_board_flags(icl, cfg); 806 unsigned long flags = soc_camera_apply_board_flags(ssdd, cfg);
807 unsigned int bps = soc_mbus_get_fmtdesc(mt9v022->fmt->code)->bits_per_sample; 807 unsigned int bps = soc_mbus_get_fmtdesc(mt9v022->fmt->code)->bits_per_sample;
808 int ret; 808 int ret;
809 u16 pixclk = 0; 809 u16 pixclk = 0;
810 810
811 if (icl->set_bus_param) { 811 if (ssdd->set_bus_param) {
812 ret = icl->set_bus_param(icl, 1 << (bps - 1)); 812 ret = ssdd->set_bus_param(ssdd, 1 << (bps - 1));
813 if (ret) 813 if (ret)
814 return ret; 814 return ret;
815 } else if (bps != 10) { 815 } else if (bps != 10) {
@@ -873,12 +873,12 @@ static int mt9v022_probe(struct i2c_client *client,
873 const struct i2c_device_id *did) 873 const struct i2c_device_id *did)
874{ 874{
875 struct mt9v022 *mt9v022; 875 struct mt9v022 *mt9v022;
876 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 876 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
877 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 877 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
878 struct mt9v022_platform_data *pdata; 878 struct mt9v022_platform_data *pdata;
879 int ret; 879 int ret;
880 880
881 if (!icl) { 881 if (!ssdd) {
882 dev_err(&client->dev, "MT9V022 driver needs platform data\n"); 882 dev_err(&client->dev, "MT9V022 driver needs platform data\n");
883 return -EINVAL; 883 return -EINVAL;
884 } 884 }
@@ -893,7 +893,7 @@ static int mt9v022_probe(struct i2c_client *client,
893 if (!mt9v022) 893 if (!mt9v022)
894 return -ENOMEM; 894 return -ENOMEM;
895 895
896 pdata = icl->priv; 896 pdata = ssdd->drv_priv;
897 v4l2_i2c_subdev_init(&mt9v022->subdev, client, &mt9v022_subdev_ops); 897 v4l2_i2c_subdev_init(&mt9v022->subdev, client, &mt9v022_subdev_ops);
898 v4l2_ctrl_handler_init(&mt9v022->hdl, 6); 898 v4l2_ctrl_handler_init(&mt9v022->hdl, 6);
899 v4l2_ctrl_new_std(&mt9v022->hdl, &mt9v022_ctrl_ops, 899 v4l2_ctrl_new_std(&mt9v022->hdl, &mt9v022_ctrl_ops,
@@ -961,11 +961,11 @@ static int mt9v022_probe(struct i2c_client *client,
961static int mt9v022_remove(struct i2c_client *client) 961static int mt9v022_remove(struct i2c_client *client)
962{ 962{
963 struct mt9v022 *mt9v022 = to_mt9v022(client); 963 struct mt9v022 *mt9v022 = to_mt9v022(client);
964 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 964 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
965 965
966 v4l2_device_unregister_subdev(&mt9v022->subdev); 966 v4l2_device_unregister_subdev(&mt9v022->subdev);
967 if (icl->free_bus) 967 if (ssdd->free_bus)
968 icl->free_bus(icl); 968 ssdd->free_bus(ssdd);
969 v4l2_ctrl_handler_free(&mt9v022->hdl); 969 v4l2_ctrl_handler_free(&mt9v022->hdl);
970 kfree(mt9v022); 970 kfree(mt9v022);
971 971
diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c
index 66698a83bda2..c57a5095edef 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;
diff --git a/drivers/media/i2c/soc_camera/ov5642.c b/drivers/media/i2c/soc_camera/ov5642.c
index 8577e0cfb7fe..b892d01e57ae 100644
--- a/drivers/media/i2c/soc_camera/ov5642.c
+++ b/drivers/media/i2c/soc_camera/ov5642.c
@@ -934,13 +934,13 @@ static int ov5642_g_mbus_config(struct v4l2_subdev *sd,
934static int ov5642_s_power(struct v4l2_subdev *sd, int on) 934static int ov5642_s_power(struct v4l2_subdev *sd, int on)
935{ 935{
936 struct i2c_client *client = v4l2_get_subdevdata(sd); 936 struct i2c_client *client = v4l2_get_subdevdata(sd);
937 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 937 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
938 int ret; 938 int ret;
939 939
940 if (!on) 940 if (!on)
941 return soc_camera_power_off(&client->dev, icl); 941 return soc_camera_power_off(&client->dev, ssdd);
942 942
943 ret = soc_camera_power_on(&client->dev, icl); 943 ret = soc_camera_power_on(&client->dev, ssdd);
944 if (ret < 0) 944 if (ret < 0)
945 return ret; 945 return ret;
946 946
@@ -1020,10 +1020,10 @@ static int ov5642_probe(struct i2c_client *client,
1020 const struct i2c_device_id *did) 1020 const struct i2c_device_id *did)
1021{ 1021{
1022 struct ov5642 *priv; 1022 struct ov5642 *priv;
1023 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 1023 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
1024 int ret; 1024 int ret;
1025 1025
1026 if (!icl) { 1026 if (!ssdd) {
1027 dev_err(&client->dev, "OV5642: missing platform data!\n"); 1027 dev_err(&client->dev, "OV5642: missing platform data!\n");
1028 return -EINVAL; 1028 return -EINVAL;
1029 } 1029 }
@@ -1057,10 +1057,10 @@ error:
1057static int ov5642_remove(struct i2c_client *client) 1057static int ov5642_remove(struct i2c_client *client)
1058{ 1058{
1059 struct ov5642 *priv = to_ov5642(client); 1059 struct ov5642 *priv = to_ov5642(client);
1060 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 1060 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
1061 1061
1062 if (icl->free_bus) 1062 if (ssdd->free_bus)
1063 icl->free_bus(icl); 1063 ssdd->free_bus(ssdd);
1064 kfree(priv); 1064 kfree(priv);
1065 1065
1066 return 0; 1066 return 0;
diff --git a/drivers/media/i2c/soc_camera/ov6650.c b/drivers/media/i2c/soc_camera/ov6650.c
index e87feb0881e3..1ae8b8dd268b 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,10 +963,10 @@ 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 }
diff --git a/drivers/media/i2c/soc_camera/ov772x.c b/drivers/media/i2c/soc_camera/ov772x.c
index e4a10751894d..5172ce9d8de1 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 }
@@ -1074,7 +1074,7 @@ static int ov772x_probe(struct i2c_client *client,
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);
diff --git a/drivers/media/i2c/soc_camera/ov9640.c b/drivers/media/i2c/soc_camera/ov9640.c
index b323684eaf77..0ce212437bc1 100644
--- a/drivers/media/i2c/soc_camera/ov9640.c
+++ b/drivers/media/i2c/soc_camera/ov9640.c
@@ -336,9 +336,9 @@ static int ov9640_set_register(struct v4l2_subdev *sd,
336static int ov9640_s_power(struct v4l2_subdev *sd, int on) 336static int ov9640_s_power(struct v4l2_subdev *sd, int on)
337{ 337{
338 struct i2c_client *client = v4l2_get_subdevdata(sd); 338 struct i2c_client *client = v4l2_get_subdevdata(sd);
339 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 339 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
340 340
341 return soc_camera_set_power(&client->dev, icl, on); 341 return soc_camera_set_power(&client->dev, ssdd, on);
342} 342}
343 343
344/* select nearest higher resolution for capture */ 344/* select nearest higher resolution for capture */
@@ -657,13 +657,13 @@ static int ov9640_g_mbus_config(struct v4l2_subdev *sd,
657 struct v4l2_mbus_config *cfg) 657 struct v4l2_mbus_config *cfg)
658{ 658{
659 struct i2c_client *client = v4l2_get_subdevdata(sd); 659 struct i2c_client *client = v4l2_get_subdevdata(sd);
660 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 660 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
661 661
662 cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | 662 cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER |
663 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | 663 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH |
664 V4L2_MBUS_DATA_ACTIVE_HIGH; 664 V4L2_MBUS_DATA_ACTIVE_HIGH;
665 cfg->type = V4L2_MBUS_PARALLEL; 665 cfg->type = V4L2_MBUS_PARALLEL;
666 cfg->flags = soc_camera_apply_board_flags(icl, cfg); 666 cfg->flags = soc_camera_apply_board_flags(ssdd, cfg);
667 667
668 return 0; 668 return 0;
669} 669}
@@ -690,10 +690,10 @@ static int ov9640_probe(struct i2c_client *client,
690 const struct i2c_device_id *did) 690 const struct i2c_device_id *did)
691{ 691{
692 struct ov9640_priv *priv; 692 struct ov9640_priv *priv;
693 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 693 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
694 int ret; 694 int ret;
695 695
696 if (!icl) { 696 if (!ssdd) {
697 dev_err(&client->dev, "Missing platform_data for driver\n"); 697 dev_err(&client->dev, "Missing platform_data for driver\n");
698 return -EINVAL; 698 return -EINVAL;
699 } 699 }
diff --git a/drivers/media/i2c/soc_camera/ov9740.c b/drivers/media/i2c/soc_camera/ov9740.c
index 7a55889e397b..cdaaf5e140f8 100644
--- a/drivers/media/i2c/soc_camera/ov9740.c
+++ b/drivers/media/i2c/soc_camera/ov9740.c
@@ -787,12 +787,12 @@ static int ov9740_g_chip_ident(struct v4l2_subdev *sd,
787static int ov9740_s_power(struct v4l2_subdev *sd, int on) 787static int ov9740_s_power(struct v4l2_subdev *sd, int on)
788{ 788{
789 struct i2c_client *client = v4l2_get_subdevdata(sd); 789 struct i2c_client *client = v4l2_get_subdevdata(sd);
790 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 790 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
791 struct ov9740_priv *priv = to_ov9740(sd); 791 struct ov9740_priv *priv = to_ov9740(sd);
792 int ret; 792 int ret;
793 793
794 if (on) { 794 if (on) {
795 ret = soc_camera_power_on(&client->dev, icl); 795 ret = soc_camera_power_on(&client->dev, ssdd);
796 if (ret < 0) 796 if (ret < 0)
797 return ret; 797 return ret;
798 798
@@ -806,7 +806,7 @@ static int ov9740_s_power(struct v4l2_subdev *sd, int on)
806 priv->current_enable = true; 806 priv->current_enable = true;
807 } 807 }
808 808
809 soc_camera_power_off(&client->dev, icl); 809 soc_camera_power_off(&client->dev, ssdd);
810 } 810 }
811 811
812 return 0; 812 return 0;
@@ -905,13 +905,13 @@ static int ov9740_g_mbus_config(struct v4l2_subdev *sd,
905 struct v4l2_mbus_config *cfg) 905 struct v4l2_mbus_config *cfg)
906{ 906{
907 struct i2c_client *client = v4l2_get_subdevdata(sd); 907 struct i2c_client *client = v4l2_get_subdevdata(sd);
908 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 908 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
909 909
910 cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | 910 cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER |
911 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | 911 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH |
912 V4L2_MBUS_DATA_ACTIVE_HIGH; 912 V4L2_MBUS_DATA_ACTIVE_HIGH;
913 cfg->type = V4L2_MBUS_PARALLEL; 913 cfg->type = V4L2_MBUS_PARALLEL;
914 cfg->flags = soc_camera_apply_board_flags(icl, cfg); 914 cfg->flags = soc_camera_apply_board_flags(ssdd, cfg);
915 915
916 return 0; 916 return 0;
917} 917}
@@ -951,10 +951,10 @@ static int ov9740_probe(struct i2c_client *client,
951 const struct i2c_device_id *did) 951 const struct i2c_device_id *did)
952{ 952{
953 struct ov9740_priv *priv; 953 struct ov9740_priv *priv;
954 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 954 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
955 int ret; 955 int ret;
956 956
957 if (!icl) { 957 if (!ssdd) {
958 dev_err(&client->dev, "Missing platform_data for driver\n"); 958 dev_err(&client->dev, "Missing platform_data for driver\n");
959 return -EINVAL; 959 return -EINVAL;
960 } 960 }
diff --git a/drivers/media/i2c/soc_camera/rj54n1cb0c.c b/drivers/media/i2c/soc_camera/rj54n1cb0c.c
index 02f0400051d9..297e28817e45 100644
--- a/drivers/media/i2c/soc_camera/rj54n1cb0c.c
+++ b/drivers/media/i2c/soc_camera/rj54n1cb0c.c
@@ -1183,9 +1183,9 @@ static int rj54n1_s_register(struct v4l2_subdev *sd,
1183static int rj54n1_s_power(struct v4l2_subdev *sd, int on) 1183static int rj54n1_s_power(struct v4l2_subdev *sd, int on)
1184{ 1184{
1185 struct i2c_client *client = v4l2_get_subdevdata(sd); 1185 struct i2c_client *client = v4l2_get_subdevdata(sd);
1186 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 1186 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
1187 1187
1188 return soc_camera_set_power(&client->dev, icl, on); 1188 return soc_camera_set_power(&client->dev, ssdd, on);
1189} 1189}
1190 1190
1191static int rj54n1_s_ctrl(struct v4l2_ctrl *ctrl) 1191static int rj54n1_s_ctrl(struct v4l2_ctrl *ctrl)
@@ -1245,14 +1245,14 @@ static int rj54n1_g_mbus_config(struct v4l2_subdev *sd,
1245 struct v4l2_mbus_config *cfg) 1245 struct v4l2_mbus_config *cfg)
1246{ 1246{
1247 struct i2c_client *client = v4l2_get_subdevdata(sd); 1247 struct i2c_client *client = v4l2_get_subdevdata(sd);
1248 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 1248 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
1249 1249
1250 cfg->flags = 1250 cfg->flags =
1251 V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | 1251 V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING |
1252 V4L2_MBUS_MASTER | V4L2_MBUS_DATA_ACTIVE_HIGH | 1252 V4L2_MBUS_MASTER | V4L2_MBUS_DATA_ACTIVE_HIGH |
1253 V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_HIGH; 1253 V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_HIGH;
1254 cfg->type = V4L2_MBUS_PARALLEL; 1254 cfg->type = V4L2_MBUS_PARALLEL;
1255 cfg->flags = soc_camera_apply_board_flags(icl, cfg); 1255 cfg->flags = soc_camera_apply_board_flags(ssdd, cfg);
1256 1256
1257 return 0; 1257 return 0;
1258} 1258}
@@ -1261,10 +1261,10 @@ static int rj54n1_s_mbus_config(struct v4l2_subdev *sd,
1261 const struct v4l2_mbus_config *cfg) 1261 const struct v4l2_mbus_config *cfg)
1262{ 1262{
1263 struct i2c_client *client = v4l2_get_subdevdata(sd); 1263 struct i2c_client *client = v4l2_get_subdevdata(sd);
1264 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 1264 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
1265 1265
1266 /* Figures 2.5-1 to 2.5-3 - default falling pixclk edge */ 1266 /* Figures 2.5-1 to 2.5-3 - default falling pixclk edge */
1267 if (soc_camera_apply_board_flags(icl, cfg) & 1267 if (soc_camera_apply_board_flags(ssdd, cfg) &
1268 V4L2_MBUS_PCLK_SAMPLE_RISING) 1268 V4L2_MBUS_PCLK_SAMPLE_RISING)
1269 return reg_write(client, RJ54N1_OUT_SIGPO, 1 << 4); 1269 return reg_write(client, RJ54N1_OUT_SIGPO, 1 << 4);
1270 else 1270 else
@@ -1334,17 +1334,17 @@ static int rj54n1_probe(struct i2c_client *client,
1334 const struct i2c_device_id *did) 1334 const struct i2c_device_id *did)
1335{ 1335{
1336 struct rj54n1 *rj54n1; 1336 struct rj54n1 *rj54n1;
1337 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 1337 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
1338 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 1338 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
1339 struct rj54n1_pdata *rj54n1_priv; 1339 struct rj54n1_pdata *rj54n1_priv;
1340 int ret; 1340 int ret;
1341 1341
1342 if (!icl || !icl->priv) { 1342 if (!ssdd || !ssdd->drv_priv) {
1343 dev_err(&client->dev, "RJ54N1CB0C: missing platform data!\n"); 1343 dev_err(&client->dev, "RJ54N1CB0C: missing platform data!\n");
1344 return -EINVAL; 1344 return -EINVAL;
1345 } 1345 }
1346 1346
1347 rj54n1_priv = icl->priv; 1347 rj54n1_priv = ssdd->drv_priv;
1348 1348
1349 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { 1349 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
1350 dev_warn(&adapter->dev, 1350 dev_warn(&adapter->dev,
@@ -1398,11 +1398,11 @@ static int rj54n1_probe(struct i2c_client *client,
1398static int rj54n1_remove(struct i2c_client *client) 1398static int rj54n1_remove(struct i2c_client *client)
1399{ 1399{
1400 struct rj54n1 *rj54n1 = to_rj54n1(client); 1400 struct rj54n1 *rj54n1 = to_rj54n1(client);
1401 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 1401 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
1402 1402
1403 v4l2_device_unregister_subdev(&rj54n1->subdev); 1403 v4l2_device_unregister_subdev(&rj54n1->subdev);
1404 if (icl->free_bus) 1404 if (ssdd->free_bus)
1405 icl->free_bus(icl); 1405 ssdd->free_bus(ssdd);
1406 v4l2_ctrl_handler_free(&rj54n1->hdl); 1406 v4l2_ctrl_handler_free(&rj54n1->hdl);
1407 kfree(rj54n1); 1407 kfree(rj54n1);
1408 1408
diff --git a/drivers/media/i2c/soc_camera/tw9910.c b/drivers/media/i2c/soc_camera/tw9910.c
index 140716e71a15..cc34c5956419 100644
--- a/drivers/media/i2c/soc_camera/tw9910.c
+++ b/drivers/media/i2c/soc_camera/tw9910.c
@@ -569,9 +569,9 @@ static int tw9910_s_register(struct v4l2_subdev *sd,
569static int tw9910_s_power(struct v4l2_subdev *sd, int on) 569static int tw9910_s_power(struct v4l2_subdev *sd, int on)
570{ 570{
571 struct i2c_client *client = v4l2_get_subdevdata(sd); 571 struct i2c_client *client = v4l2_get_subdevdata(sd);
572 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 572 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
573 573
574 return soc_camera_set_power(&client->dev, icl, on); 574 return soc_camera_set_power(&client->dev, ssdd, on);
575} 575}
576 576
577static int tw9910_set_frame(struct v4l2_subdev *sd, u32 *width, u32 *height) 577static int tw9910_set_frame(struct v4l2_subdev *sd, u32 *width, u32 *height)
@@ -847,14 +847,14 @@ static int tw9910_g_mbus_config(struct v4l2_subdev *sd,
847 struct v4l2_mbus_config *cfg) 847 struct v4l2_mbus_config *cfg)
848{ 848{
849 struct i2c_client *client = v4l2_get_subdevdata(sd); 849 struct i2c_client *client = v4l2_get_subdevdata(sd);
850 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 850 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
851 851
852 cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | 852 cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER |
853 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW | 853 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW |
854 V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_LOW | 854 V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_LOW |
855 V4L2_MBUS_DATA_ACTIVE_HIGH; 855 V4L2_MBUS_DATA_ACTIVE_HIGH;
856 cfg->type = V4L2_MBUS_PARALLEL; 856 cfg->type = V4L2_MBUS_PARALLEL;
857 cfg->flags = soc_camera_apply_board_flags(icl, cfg); 857 cfg->flags = soc_camera_apply_board_flags(ssdd, cfg);
858 858
859 return 0; 859 return 0;
860} 860}
@@ -863,9 +863,9 @@ static int tw9910_s_mbus_config(struct v4l2_subdev *sd,
863 const struct v4l2_mbus_config *cfg) 863 const struct v4l2_mbus_config *cfg)
864{ 864{
865 struct i2c_client *client = v4l2_get_subdevdata(sd); 865 struct i2c_client *client = v4l2_get_subdevdata(sd);
866 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 866 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
867 u8 val = VSSL_VVALID | HSSL_DVALID; 867 u8 val = VSSL_VVALID | HSSL_DVALID;
868 unsigned long flags = soc_camera_apply_board_flags(icl, cfg); 868 unsigned long flags = soc_camera_apply_board_flags(ssdd, cfg);
869 869
870 /* 870 /*
871 * set OUTCTR1 871 * set OUTCTR1
@@ -911,15 +911,15 @@ static int tw9910_probe(struct i2c_client *client,
911 struct tw9910_video_info *info; 911 struct tw9910_video_info *info;
912 struct i2c_adapter *adapter = 912 struct i2c_adapter *adapter =
913 to_i2c_adapter(client->dev.parent); 913 to_i2c_adapter(client->dev.parent);
914 struct soc_camera_link *icl = soc_camera_i2c_to_link(client); 914 struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client);
915 int ret; 915 int ret;
916 916
917 if (!icl || !icl->priv) { 917 if (!ssdd || !ssdd->drv_priv) {
918 dev_err(&client->dev, "TW9910: missing platform data!\n"); 918 dev_err(&client->dev, "TW9910: missing platform data!\n");
919 return -EINVAL; 919 return -EINVAL;
920 } 920 }
921 921
922 info = icl->priv; 922 info = ssdd->drv_priv;
923 923
924 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { 924 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
925 dev_err(&client->dev, 925 dev_err(&client->dev,
diff --git a/drivers/media/platform/soc_camera/soc_camera.c b/drivers/media/platform/soc_camera/soc_camera.c
index ae89f980e82b..dd057f19dbc3 100644
--- a/drivers/media/platform/soc_camera/soc_camera.c
+++ b/drivers/media/platform/soc_camera/soc_camera.c
@@ -50,22 +50,22 @@ static LIST_HEAD(hosts);
50static LIST_HEAD(devices); 50static LIST_HEAD(devices);
51static DEFINE_MUTEX(list_lock); /* Protects the list of hosts */ 51static DEFINE_MUTEX(list_lock); /* Protects the list of hosts */
52 52
53int soc_camera_power_on(struct device *dev, struct soc_camera_link *icl) 53int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd)
54{ 54{
55 int ret = regulator_bulk_enable(icl->num_regulators, 55 int ret = regulator_bulk_enable(ssdd->num_regulators,
56 icl->regulators); 56 ssdd->regulators);
57 if (ret < 0) { 57 if (ret < 0) {
58 dev_err(dev, "Cannot enable regulators\n"); 58 dev_err(dev, "Cannot enable regulators\n");
59 return ret; 59 return ret;
60 } 60 }
61 61
62 if (icl->power) { 62 if (ssdd->power) {
63 ret = icl->power(dev, 1); 63 ret = ssdd->power(dev, 1);
64 if (ret < 0) { 64 if (ret < 0) {
65 dev_err(dev, 65 dev_err(dev,
66 "Platform failed to power-on the camera.\n"); 66 "Platform failed to power-on the camera.\n");
67 regulator_bulk_disable(icl->num_regulators, 67 regulator_bulk_disable(ssdd->num_regulators,
68 icl->regulators); 68 ssdd->regulators);
69 } 69 }
70 } 70 }
71 71
@@ -73,13 +73,13 @@ int soc_camera_power_on(struct device *dev, struct soc_camera_link *icl)
73} 73}
74EXPORT_SYMBOL(soc_camera_power_on); 74EXPORT_SYMBOL(soc_camera_power_on);
75 75
76int soc_camera_power_off(struct device *dev, struct soc_camera_link *icl) 76int soc_camera_power_off(struct device *dev, struct soc_camera_subdev_desc *ssdd)
77{ 77{
78 int ret = 0; 78 int ret = 0;
79 int err; 79 int err;
80 80
81 if (icl->power) { 81 if (ssdd->power) {
82 err = icl->power(dev, 0); 82 err = ssdd->power(dev, 0);
83 if (err < 0) { 83 if (err < 0) {
84 dev_err(dev, 84 dev_err(dev,
85 "Platform failed to power-off the camera.\n"); 85 "Platform failed to power-off the camera.\n");
@@ -87,8 +87,8 @@ int soc_camera_power_off(struct device *dev, struct soc_camera_link *icl)
87 } 87 }
88 } 88 }
89 89
90 err = regulator_bulk_disable(icl->num_regulators, 90 err = regulator_bulk_disable(ssdd->num_regulators,
91 icl->regulators); 91 ssdd->regulators);
92 if (err < 0) { 92 if (err < 0) {
93 dev_err(dev, "Cannot disable regulators\n"); 93 dev_err(dev, "Cannot disable regulators\n");
94 ret = ret ? : err; 94 ret = ret ? : err;
@@ -136,29 +136,29 @@ EXPORT_SYMBOL(soc_camera_xlate_by_fourcc);
136 136
137/** 137/**
138 * soc_camera_apply_board_flags() - apply platform SOCAM_SENSOR_INVERT_* flags 138 * soc_camera_apply_board_flags() - apply platform SOCAM_SENSOR_INVERT_* flags
139 * @icl: camera platform parameters 139 * @ssdd: camera platform parameters
140 * @cfg: media bus configuration 140 * @cfg: media bus configuration
141 * @return: resulting flags 141 * @return: resulting flags
142 */ 142 */
143unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl, 143unsigned long soc_camera_apply_board_flags(struct soc_camera_subdev_desc *ssdd,
144 const struct v4l2_mbus_config *cfg) 144 const struct v4l2_mbus_config *cfg)
145{ 145{
146 unsigned long f, flags = cfg->flags; 146 unsigned long f, flags = cfg->flags;
147 147
148 /* If only one of the two polarities is supported, switch to the opposite */ 148 /* If only one of the two polarities is supported, switch to the opposite */
149 if (icl->flags & SOCAM_SENSOR_INVERT_HSYNC) { 149 if (ssdd->flags & SOCAM_SENSOR_INVERT_HSYNC) {
150 f = flags & (V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_LOW); 150 f = flags & (V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_LOW);
151 if (f == V4L2_MBUS_HSYNC_ACTIVE_HIGH || f == V4L2_MBUS_HSYNC_ACTIVE_LOW) 151 if (f == V4L2_MBUS_HSYNC_ACTIVE_HIGH || f == V4L2_MBUS_HSYNC_ACTIVE_LOW)
152 flags ^= V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_LOW; 152 flags ^= V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_LOW;
153 } 153 }
154 154
155 if (icl->flags & SOCAM_SENSOR_INVERT_VSYNC) { 155 if (ssdd->flags & SOCAM_SENSOR_INVERT_VSYNC) {
156 f = flags & (V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW); 156 f = flags & (V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW);
157 if (f == V4L2_MBUS_VSYNC_ACTIVE_HIGH || f == V4L2_MBUS_VSYNC_ACTIVE_LOW) 157 if (f == V4L2_MBUS_VSYNC_ACTIVE_HIGH || f == V4L2_MBUS_VSYNC_ACTIVE_LOW)
158 flags ^= V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW; 158 flags ^= V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW;
159 } 159 }
160 160
161 if (icl->flags & SOCAM_SENSOR_INVERT_PCLK) { 161 if (ssdd->flags & SOCAM_SENSOR_INVERT_PCLK) {
162 f = flags & (V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING); 162 f = flags & (V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING);
163 if (f == V4L2_MBUS_PCLK_SAMPLE_RISING || f == V4L2_MBUS_PCLK_SAMPLE_FALLING) 163 if (f == V4L2_MBUS_PCLK_SAMPLE_RISING || f == V4L2_MBUS_PCLK_SAMPLE_FALLING)
164 flags ^= V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING; 164 flags ^= V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING;
@@ -509,7 +509,7 @@ static int soc_camera_open(struct file *file)
509{ 509{
510 struct video_device *vdev = video_devdata(file); 510 struct video_device *vdev = video_devdata(file);
511 struct soc_camera_device *icd = dev_get_drvdata(vdev->parent); 511 struct soc_camera_device *icd = dev_get_drvdata(vdev->parent);
512 struct soc_camera_link *icl = to_soc_camera_link(icd); 512 struct soc_camera_desc *sdesc = to_soc_camera_desc(icd);
513 struct soc_camera_host *ici; 513 struct soc_camera_host *ici;
514 int ret; 514 int ret;
515 515
@@ -552,8 +552,8 @@ static int soc_camera_open(struct file *file)
552 }; 552 };
553 553
554 /* The camera could have been already on, try to reset */ 554 /* The camera could have been already on, try to reset */
555 if (icl->reset) 555 if (sdesc->subdev_desc.reset)
556 icl->reset(icd->pdev); 556 sdesc->subdev_desc.reset(icd->pdev);
557 557
558 ret = ici->ops->add(icd); 558 ret = ici->ops->add(icd);
559 if (ret < 0) { 559 if (ret < 0) {
@@ -1072,23 +1072,24 @@ static void scan_add_host(struct soc_camera_host *ici)
1072 1072
1073#ifdef CONFIG_I2C_BOARDINFO 1073#ifdef CONFIG_I2C_BOARDINFO
1074static int soc_camera_init_i2c(struct soc_camera_device *icd, 1074static int soc_camera_init_i2c(struct soc_camera_device *icd,
1075 struct soc_camera_link *icl) 1075 struct soc_camera_desc *sdesc)
1076{ 1076{
1077 struct i2c_client *client; 1077 struct i2c_client *client;
1078 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); 1078 struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
1079 struct i2c_adapter *adap = i2c_get_adapter(icl->i2c_adapter_id); 1079 struct soc_camera_host_desc *shd = &sdesc->host_desc;
1080 struct i2c_adapter *adap = i2c_get_adapter(shd->i2c_adapter_id);
1080 struct v4l2_subdev *subdev; 1081 struct v4l2_subdev *subdev;
1081 1082
1082 if (!adap) { 1083 if (!adap) {
1083 dev_err(icd->pdev, "Cannot get I2C adapter #%d. No driver?\n", 1084 dev_err(icd->pdev, "Cannot get I2C adapter #%d. No driver?\n",
1084 icl->i2c_adapter_id); 1085 shd->i2c_adapter_id);
1085 goto ei2cga; 1086 goto ei2cga;
1086 } 1087 }
1087 1088
1088 icl->board_info->platform_data = icl; 1089 shd->board_info->platform_data = &sdesc->subdev_desc;
1089 1090
1090 subdev = v4l2_i2c_new_subdev_board(&ici->v4l2_dev, adap, 1091 subdev = v4l2_i2c_new_subdev_board(&ici->v4l2_dev, adap,
1091 icl->board_info, NULL); 1092 shd->board_info, NULL);
1092 if (!subdev) 1093 if (!subdev)
1093 goto ei2cnd; 1094 goto ei2cnd;
1094 1095
@@ -1116,7 +1117,7 @@ static void soc_camera_free_i2c(struct soc_camera_device *icd)
1116 i2c_put_adapter(adap); 1117 i2c_put_adapter(adap);
1117} 1118}
1118#else 1119#else
1119#define soc_camera_init_i2c(icd, icl) (-ENODEV) 1120#define soc_camera_init_i2c(icd, sdesc) (-ENODEV)
1120#define soc_camera_free_i2c(icd) do {} while (0) 1121#define soc_camera_free_i2c(icd) do {} while (0)
1121#endif 1122#endif
1122 1123
@@ -1126,7 +1127,9 @@ static int video_dev_create(struct soc_camera_device *icd);
1126static int soc_camera_probe(struct soc_camera_device *icd) 1127static int soc_camera_probe(struct soc_camera_device *icd)
1127{ 1128{
1128 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); 1129 struct soc_camera_host *ici = to_soc_camera_host(icd->parent);
1129 struct soc_camera_link *icl = to_soc_camera_link(icd); 1130 struct soc_camera_desc *sdesc = to_soc_camera_desc(icd);
1131 struct soc_camera_host_desc *shd = &sdesc->host_desc;
1132 struct soc_camera_subdev_desc *ssdd = &sdesc->subdev_desc;
1130 struct device *control = NULL; 1133 struct device *control = NULL;
1131 struct v4l2_subdev *sd; 1134 struct v4l2_subdev *sd;
1132 struct v4l2_mbus_framefmt mf; 1135 struct v4l2_mbus_framefmt mf;
@@ -1146,8 +1149,8 @@ static int soc_camera_probe(struct soc_camera_device *icd)
1146 return ret; 1149 return ret;
1147 1150
1148 /* The camera could have been already on, try to reset */ 1151 /* The camera could have been already on, try to reset */
1149 if (icl->reset) 1152 if (ssdd->reset)
1150 icl->reset(icd->pdev); 1153 ssdd->reset(icd->pdev);
1151 1154
1152 mutex_lock(&ici->host_lock); 1155 mutex_lock(&ici->host_lock);
1153 ret = ici->ops->add(icd); 1156 ret = ici->ops->add(icd);
@@ -1161,18 +1164,18 @@ static int soc_camera_probe(struct soc_camera_device *icd)
1161 goto evdc; 1164 goto evdc;
1162 1165
1163 /* Non-i2c cameras, e.g., soc_camera_platform, have no board_info */ 1166 /* Non-i2c cameras, e.g., soc_camera_platform, have no board_info */
1164 if (icl->board_info) { 1167 if (shd->board_info) {
1165 ret = soc_camera_init_i2c(icd, icl); 1168 ret = soc_camera_init_i2c(icd, sdesc);
1166 if (ret < 0) 1169 if (ret < 0)
1167 goto eadddev; 1170 goto eadddev;
1168 } else if (!icl->add_device || !icl->del_device) { 1171 } else if (!shd->add_device || !shd->del_device) {
1169 ret = -EINVAL; 1172 ret = -EINVAL;
1170 goto eadddev; 1173 goto eadddev;
1171 } else { 1174 } else {
1172 if (icl->module_name) 1175 if (shd->module_name)
1173 ret = request_module(icl->module_name); 1176 ret = request_module(shd->module_name);
1174 1177
1175 ret = icl->add_device(icd); 1178 ret = shd->add_device(icd);
1176 if (ret < 0) 1179 if (ret < 0)
1177 goto eadddev; 1180 goto eadddev;
1178 1181
@@ -1183,7 +1186,7 @@ static int soc_camera_probe(struct soc_camera_device *icd)
1183 control = to_soc_camera_control(icd); 1186 control = to_soc_camera_control(icd);
1184 if (!control || !control->driver || !dev_get_drvdata(control) || 1187 if (!control || !control->driver || !dev_get_drvdata(control) ||
1185 !try_module_get(control->driver->owner)) { 1188 !try_module_get(control->driver->owner)) {
1186 icl->del_device(icd); 1189 shd->del_device(icd);
1187 ret = -ENODEV; 1190 ret = -ENODEV;
1188 goto enodrv; 1191 goto enodrv;
1189 } 1192 }
@@ -1234,10 +1237,10 @@ evidstart:
1234 soc_camera_free_user_formats(icd); 1237 soc_camera_free_user_formats(icd);
1235eiufmt: 1238eiufmt:
1236ectrl: 1239ectrl:
1237 if (icl->board_info) { 1240 if (shd->board_info) {
1238 soc_camera_free_i2c(icd); 1241 soc_camera_free_i2c(icd);
1239 } else { 1242 } else {
1240 icl->del_device(icd); 1243 shd->del_device(icd);
1241 module_put(control->driver->owner); 1244 module_put(control->driver->owner);
1242 } 1245 }
1243enodrv: 1246enodrv:
@@ -1259,7 +1262,7 @@ eadd:
1259 */ 1262 */
1260static int soc_camera_remove(struct soc_camera_device *icd) 1263static int soc_camera_remove(struct soc_camera_device *icd)
1261{ 1264{
1262 struct soc_camera_link *icl = to_soc_camera_link(icd); 1265 struct soc_camera_desc *sdesc = to_soc_camera_desc(icd);
1263 struct video_device *vdev = icd->vdev; 1266 struct video_device *vdev = icd->vdev;
1264 1267
1265 BUG_ON(!icd->parent); 1268 BUG_ON(!icd->parent);
@@ -1270,12 +1273,12 @@ static int soc_camera_remove(struct soc_camera_device *icd)
1270 icd->vdev = NULL; 1273 icd->vdev = NULL;
1271 } 1274 }
1272 1275
1273 if (icl->board_info) { 1276 if (sdesc->host_desc.board_info) {
1274 soc_camera_free_i2c(icd); 1277 soc_camera_free_i2c(icd);
1275 } else { 1278 } else {
1276 struct device_driver *drv = to_soc_camera_control(icd)->driver; 1279 struct device_driver *drv = to_soc_camera_control(icd)->driver;
1277 if (drv) { 1280 if (drv) {
1278 icl->del_device(icd); 1281 sdesc->host_desc.del_device(icd);
1279 module_put(drv->owner); 1282 module_put(drv->owner);
1280 } 1283 }
1281 } 1284 }
@@ -1534,24 +1537,25 @@ static int soc_camera_video_start(struct soc_camera_device *icd)
1534 1537
1535static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev) 1538static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev)
1536{ 1539{
1537 struct soc_camera_link *icl = pdev->dev.platform_data; 1540 struct soc_camera_desc *sdesc = pdev->dev.platform_data;
1541 struct soc_camera_subdev_desc *ssdd = &sdesc->subdev_desc;
1538 struct soc_camera_device *icd; 1542 struct soc_camera_device *icd;
1539 int ret; 1543 int ret;
1540 1544
1541 if (!icl) 1545 if (!sdesc)
1542 return -EINVAL; 1546 return -EINVAL;
1543 1547
1544 icd = devm_kzalloc(&pdev->dev, sizeof(*icd), GFP_KERNEL); 1548 icd = devm_kzalloc(&pdev->dev, sizeof(*icd), GFP_KERNEL);
1545 if (!icd) 1549 if (!icd)
1546 return -ENOMEM; 1550 return -ENOMEM;
1547 1551
1548 ret = devm_regulator_bulk_get(&pdev->dev, icl->num_regulators, 1552 ret = devm_regulator_bulk_get(&pdev->dev, ssdd->num_regulators,
1549 icl->regulators); 1553 ssdd->regulators);
1550 if (ret < 0) 1554 if (ret < 0)
1551 return ret; 1555 return ret;
1552 1556
1553 icd->iface = icl->bus_id; 1557 icd->iface = sdesc->host_desc.bus_id;
1554 icd->link = icl; 1558 icd->sdesc = sdesc;
1555 icd->pdev = &pdev->dev; 1559 icd->pdev = &pdev->dev;
1556 platform_set_drvdata(pdev, icd); 1560 platform_set_drvdata(pdev, icd);
1557 1561
diff --git a/drivers/media/platform/soc_camera/soc_camera_platform.c b/drivers/media/platform/soc_camera/soc_camera_platform.c
index 7cf7fd16481f..51e29d19b1b4 100644
--- a/drivers/media/platform/soc_camera/soc_camera_platform.c
+++ b/drivers/media/platform/soc_camera/soc_camera_platform.c
@@ -54,7 +54,7 @@ static int soc_camera_platform_s_power(struct v4l2_subdev *sd, int on)
54{ 54{
55 struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd); 55 struct soc_camera_platform_info *p = v4l2_get_subdevdata(sd);
56 56
57 return soc_camera_set_power(p->icd->control, p->icd->link, on); 57 return soc_camera_set_power(p->icd->control, &p->icd->sdesc->subdev_desc, on);
58} 58}
59 59
60static struct v4l2_subdev_core_ops platform_subdev_core_ops = { 60static struct v4l2_subdev_core_ops platform_subdev_core_ops = {
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 5a662c981484..2cc70cf318bf 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -23,11 +23,11 @@
23#include <media/v4l2-device.h> 23#include <media/v4l2-device.h>
24 24
25struct file; 25struct file;
26struct soc_camera_link; 26struct soc_camera_desc;
27 27
28struct soc_camera_device { 28struct soc_camera_device {
29 struct list_head list; /* list of all registered devices */ 29 struct list_head list; /* list of all registered devices */
30 struct soc_camera_link *link; 30 struct soc_camera_desc *sdesc;
31 struct device *pdev; /* Platform device */ 31 struct device *pdev; /* Platform device */
32 struct device *parent; /* Camera host device */ 32 struct device *parent; /* Camera host device */
33 struct device *control; /* E.g., the i2c client */ 33 struct device *control; /* E.g., the i2c client */
@@ -116,26 +116,72 @@ struct soc_camera_host_ops {
116struct i2c_board_info; 116struct i2c_board_info;
117struct regulator_bulk_data; 117struct regulator_bulk_data;
118 118
119struct soc_camera_link { 119struct soc_camera_subdev_desc {
120 /* Camera bus id, used to match a camera and a bus */
121 int bus_id;
122 /* Per camera SOCAM_SENSOR_* bus flags */ 120 /* Per camera SOCAM_SENSOR_* bus flags */
123 unsigned long flags; 121 unsigned long flags;
124 int i2c_adapter_id; 122
125 struct i2c_board_info *board_info; 123 /* sensor driver private platform data */
126 const char *module_name; 124 void *drv_priv;
127 void *priv;
128 125
129 /* Optional regulators that have to be managed on power on/off events */ 126 /* Optional regulators that have to be managed on power on/off events */
130 struct regulator_bulk_data *regulators; 127 struct regulator_bulk_data *regulators;
131 int num_regulators; 128 int num_regulators;
132 129
130 /* Optional callbacks to power on or off and reset the sensor */
131 int (*power)(struct device *, int);
132 int (*reset)(struct device *);
133
134 /*
135 * some platforms may support different data widths than the sensors
136 * native ones due to different data line routing. Let the board code
137 * overwrite the width flags.
138 */
139 int (*set_bus_param)(struct soc_camera_subdev_desc *, unsigned long flags);
140 unsigned long (*query_bus_param)(struct soc_camera_subdev_desc *);
141 void (*free_bus)(struct soc_camera_subdev_desc *);
142};
143
144struct soc_camera_host_desc {
145 /* Camera bus id, used to match a camera and a bus */
146 int bus_id;
147 int i2c_adapter_id;
148 struct i2c_board_info *board_info;
149 const char *module_name;
150
133 /* 151 /*
134 * For non-I2C devices platform has to provide methods to add a device 152 * For non-I2C devices platform has to provide methods to add a device
135 * to the system and to remove it 153 * to the system and to remove it
136 */ 154 */
137 int (*add_device)(struct soc_camera_device *); 155 int (*add_device)(struct soc_camera_device *);
138 void (*del_device)(struct soc_camera_device *); 156 void (*del_device)(struct soc_camera_device *);
157};
158
159/*
160 * This MUST be kept binary-identical to struct soc_camera_link below, until
161 * it is completely replaced by this one, after which we can split it into its
162 * two components.
163 */
164struct soc_camera_desc {
165 struct soc_camera_subdev_desc subdev_desc;
166 struct soc_camera_host_desc host_desc;
167};
168
169/* Prepare to replace this struct: don't change its layout any more! */
170struct soc_camera_link {
171 /*
172 * Subdevice part - keep at top and compatible to
173 * struct soc_camera_subdev_desc
174 */
175
176 /* Per camera SOCAM_SENSOR_* bus flags */
177 unsigned long flags;
178
179 void *priv;
180
181 /* Optional regulators that have to be managed on power on/off events */
182 struct regulator_bulk_data *regulators;
183 int num_regulators;
184
139 /* Optional callbacks to power on or off and reset the sensor */ 185 /* Optional callbacks to power on or off and reset the sensor */
140 int (*power)(struct device *, int); 186 int (*power)(struct device *, int);
141 int (*reset)(struct device *); 187 int (*reset)(struct device *);
@@ -147,6 +193,24 @@ struct soc_camera_link {
147 int (*set_bus_param)(struct soc_camera_link *, unsigned long flags); 193 int (*set_bus_param)(struct soc_camera_link *, unsigned long flags);
148 unsigned long (*query_bus_param)(struct soc_camera_link *); 194 unsigned long (*query_bus_param)(struct soc_camera_link *);
149 void (*free_bus)(struct soc_camera_link *); 195 void (*free_bus)(struct soc_camera_link *);
196
197 /*
198 * Host part - keep at bottom and compatible to
199 * struct soc_camera_host_desc
200 */
201
202 /* Camera bus id, used to match a camera and a bus */
203 int bus_id;
204 int i2c_adapter_id;
205 struct i2c_board_info *board_info;
206 const char *module_name;
207
208 /*
209 * For non-I2C devices platform has to provide methods to add a device
210 * to the system and to remove it
211 */
212 int (*add_device)(struct soc_camera_device *);
213 void (*del_device)(struct soc_camera_device *);
150}; 214};
151 215
152static inline struct soc_camera_host *to_soc_camera_host( 216static inline struct soc_camera_host *to_soc_camera_host(
@@ -157,10 +221,10 @@ static inline struct soc_camera_host *to_soc_camera_host(
157 return container_of(v4l2_dev, struct soc_camera_host, v4l2_dev); 221 return container_of(v4l2_dev, struct soc_camera_host, v4l2_dev);
158} 222}
159 223
160static inline struct soc_camera_link *to_soc_camera_link( 224static inline struct soc_camera_desc *to_soc_camera_desc(
161 const struct soc_camera_device *icd) 225 const struct soc_camera_device *icd)
162{ 226{
163 return icd->link; 227 return icd->sdesc;
164} 228}
165 229
166static inline struct device *to_soc_camera_control( 230static inline struct device *to_soc_camera_control(
@@ -250,19 +314,17 @@ static inline void soc_camera_limit_side(int *start, int *length,
250 *start = start_min + length_max - *length; 314 *start = start_min + length_max - *length;
251} 315}
252 316
253unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, 317unsigned long soc_camera_apply_board_flags(struct soc_camera_subdev_desc *ssdd,
254 unsigned long flags);
255unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl,
256 const struct v4l2_mbus_config *cfg); 318 const struct v4l2_mbus_config *cfg);
257 319
258int soc_camera_power_on(struct device *dev, struct soc_camera_link *icl); 320int soc_camera_power_on(struct device *dev, struct soc_camera_subdev_desc *ssdd);
259int soc_camera_power_off(struct device *dev, struct soc_camera_link *icl); 321int soc_camera_power_off(struct device *dev, struct soc_camera_subdev_desc *ssdd);
260 322
261static inline int soc_camera_set_power(struct device *dev, 323static inline int soc_camera_set_power(struct device *dev,
262 struct soc_camera_link *icl, bool on) 324 struct soc_camera_subdev_desc *ssdd, bool on)
263{ 325{
264 return on ? soc_camera_power_on(dev, icl) 326 return on ? soc_camera_power_on(dev, ssdd)
265 : soc_camera_power_off(dev, icl); 327 : soc_camera_power_off(dev, ssdd);
266} 328}
267 329
268/* This is only temporary here - until v4l2-subdev begins to link to video_device */ 330/* This is only temporary here - until v4l2-subdev begins to link to video_device */
@@ -274,7 +336,7 @@ static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_clien
274 return icd ? icd->vdev : NULL; 336 return icd ? icd->vdev : NULL;
275} 337}
276 338
277static inline struct soc_camera_link *soc_camera_i2c_to_link(const struct i2c_client *client) 339static inline struct soc_camera_subdev_desc *soc_camera_i2c_to_desc(const struct i2c_client *client)
278{ 340{
279 return client->dev.platform_data; 341 return client->dev.platform_data;
280} 342}
diff --git a/include/media/soc_camera_platform.h b/include/media/soc_camera_platform.h
index 8aa4200a0b1d..1e5065dab430 100644
--- a/include/media/soc_camera_platform.h
+++ b/include/media/soc_camera_platform.h
@@ -38,10 +38,12 @@ static inline int soc_camera_platform_add(struct soc_camera_device *icd,
38 void (*release)(struct device *dev), 38 void (*release)(struct device *dev),
39 int id) 39 int id)
40{ 40{
41 struct soc_camera_platform_info *info = plink->priv; 41 struct soc_camera_subdev_desc *ssdd =
42 (struct soc_camera_subdev_desc *)plink;
43 struct soc_camera_platform_info *info = ssdd->drv_priv;
42 int ret; 44 int ret;
43 45
44 if (icd->link != plink) 46 if (&icd->sdesc->subdev_desc != ssdd)
45 return -ENODEV; 47 return -ENODEV;
46 48
47 if (*pdev) 49 if (*pdev)
@@ -70,7 +72,9 @@ static inline void soc_camera_platform_del(const struct soc_camera_device *icd,
70 struct platform_device *pdev, 72 struct platform_device *pdev,
71 const struct soc_camera_link *plink) 73 const struct soc_camera_link *plink)
72{ 74{
73 if (icd->link != plink || !pdev) 75 const struct soc_camera_subdev_desc *ssdd =
76 (const struct soc_camera_subdev_desc *)plink;
77 if (&icd->sdesc->subdev_desc != ssdd || !pdev)
74 return; 78 return;
75 79
76 platform_device_unregister(pdev); 80 platform_device_unregister(pdev);