diff options
| -rw-r--r-- | drivers/media/video/imx074.c | 17 | ||||
| -rw-r--r-- | drivers/media/video/mt9m001.c | 39 | ||||
| -rw-r--r-- | drivers/media/video/mt9m111.c | 24 | ||||
| -rw-r--r-- | drivers/media/video/mt9t031.c | 22 | ||||
| -rw-r--r-- | drivers/media/video/mt9t112.c | 45 | ||||
| -rw-r--r-- | drivers/media/video/mt9v022.c | 44 | ||||
| -rw-r--r-- | drivers/media/video/ov2640.c | 27 | ||||
| -rw-r--r-- | drivers/media/video/ov5642.c | 17 | ||||
| -rw-r--r-- | drivers/media/video/ov6650.c | 20 | ||||
| -rw-r--r-- | drivers/media/video/ov772x.c | 31 | ||||
| -rw-r--r-- | drivers/media/video/ov9640.c | 21 | ||||
| -rw-r--r-- | drivers/media/video/ov9740.c | 21 | ||||
| -rw-r--r-- | drivers/media/video/rj54n1cb0c.c | 27 | ||||
| -rw-r--r-- | drivers/media/video/tw9910.c | 32 | ||||
| -rw-r--r-- | include/media/soc_camera.h | 25 |
15 files changed, 126 insertions, 286 deletions
diff --git a/drivers/media/video/imx074.c b/drivers/media/video/imx074.c index 3f5d4de8b91b..4f3ce7fa87df 100644 --- a/drivers/media/video/imx074.c +++ b/drivers/media/video/imx074.c | |||
| @@ -298,8 +298,7 @@ static struct v4l2_subdev_ops imx074_subdev_ops = { | |||
| 298 | .video = &imx074_subdev_video_ops, | 298 | .video = &imx074_subdev_video_ops, |
| 299 | }; | 299 | }; |
| 300 | 300 | ||
| 301 | static int imx074_video_probe(struct soc_camera_device *icd, | 301 | static int imx074_video_probe(struct i2c_client *client) |
| 302 | struct i2c_client *client) | ||
| 303 | { | 302 | { |
| 304 | int ret; | 303 | int ret; |
| 305 | u16 id; | 304 | u16 id; |
| @@ -409,17 +408,10 @@ static int imx074_probe(struct i2c_client *client, | |||
| 409 | const struct i2c_device_id *did) | 408 | const struct i2c_device_id *did) |
| 410 | { | 409 | { |
| 411 | struct imx074 *priv; | 410 | struct imx074 *priv; |
| 412 | struct soc_camera_device *icd = client->dev.platform_data; | ||
| 413 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | 411 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
| 414 | struct soc_camera_link *icl; | 412 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 415 | int ret; | 413 | int ret; |
| 416 | 414 | ||
| 417 | if (!icd) { | ||
| 418 | dev_err(&client->dev, "IMX074: missing soc-camera data!\n"); | ||
| 419 | return -EINVAL; | ||
| 420 | } | ||
| 421 | |||
| 422 | icl = to_soc_camera_link(icd); | ||
| 423 | if (!icl) { | 415 | if (!icl) { |
| 424 | dev_err(&client->dev, "IMX074: missing platform data!\n"); | 416 | dev_err(&client->dev, "IMX074: missing platform data!\n"); |
| 425 | return -EINVAL; | 417 | return -EINVAL; |
| @@ -439,7 +431,7 @@ static int imx074_probe(struct i2c_client *client, | |||
| 439 | 431 | ||
| 440 | priv->fmt = &imx074_colour_fmts[0]; | 432 | priv->fmt = &imx074_colour_fmts[0]; |
| 441 | 433 | ||
| 442 | ret = imx074_video_probe(icd, client); | 434 | ret = imx074_video_probe(client); |
| 443 | if (ret < 0) { | 435 | if (ret < 0) { |
| 444 | kfree(priv); | 436 | kfree(priv); |
| 445 | return ret; | 437 | return ret; |
| @@ -451,8 +443,7 @@ static int imx074_probe(struct i2c_client *client, | |||
| 451 | static int imx074_remove(struct i2c_client *client) | 443 | static int imx074_remove(struct i2c_client *client) |
| 452 | { | 444 | { |
| 453 | struct imx074 *priv = to_imx074(client); | 445 | struct imx074 *priv = to_imx074(client); |
| 454 | struct soc_camera_device *icd = client->dev.platform_data; | 446 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 455 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 456 | 447 | ||
| 457 | if (icl->free_bus) | 448 | if (icl->free_bus) |
| 458 | icl->free_bus(icl); | 449 | icl->free_bus(icl); |
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c index 42bb3c89cfe6..58cdcedf53de 100644 --- a/drivers/media/video/mt9m001.c +++ b/drivers/media/video/mt9m001.c | |||
| @@ -205,7 +205,7 @@ static int mt9m001_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) | |||
| 205 | 205 | ||
| 206 | /* | 206 | /* |
| 207 | * The caller provides a supported format, as verified per | 207 | * The caller provides a supported format, as verified per |
| 208 | * call to icd->try_fmt() | 208 | * call to .try_mbus_fmt() |
| 209 | */ | 209 | */ |
| 210 | if (!ret) | 210 | if (!ret) |
| 211 | ret = reg_write(client, MT9M001_COLUMN_START, rect.left); | 211 | ret = reg_write(client, MT9M001_COLUMN_START, rect.left); |
| @@ -474,19 +474,14 @@ static int mt9m001_s_ctrl(struct v4l2_ctrl *ctrl) | |||
| 474 | * Interface active, can use i2c. If it fails, it can indeed mean, that | 474 | * Interface active, can use i2c. If it fails, it can indeed mean, that |
| 475 | * this wasn't our capture interface, so, we wait for the right one | 475 | * this wasn't our capture interface, so, we wait for the right one |
| 476 | */ | 476 | */ |
| 477 | static int mt9m001_video_probe(struct soc_camera_device *icd, | 477 | static int mt9m001_video_probe(struct soc_camera_link *icl, |
| 478 | struct i2c_client *client) | 478 | struct i2c_client *client) |
| 479 | { | 479 | { |
| 480 | struct mt9m001 *mt9m001 = to_mt9m001(client); | 480 | struct mt9m001 *mt9m001 = to_mt9m001(client); |
| 481 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 482 | s32 data; | 481 | s32 data; |
| 483 | unsigned long flags; | 482 | unsigned long flags; |
| 484 | int ret; | 483 | int ret; |
| 485 | 484 | ||
| 486 | /* We must have a parent by now. And it cannot be a wrong one. */ | ||
| 487 | BUG_ON(!icd->parent || | ||
| 488 | to_soc_camera_host(icd->parent)->nr != icd->iface); | ||
| 489 | |||
| 490 | /* Enable the chip */ | 485 | /* Enable the chip */ |
| 491 | data = reg_write(client, MT9M001_CHIP_ENABLE, 1); | 486 | data = reg_write(client, MT9M001_CHIP_ENABLE, 1); |
| 492 | dev_dbg(&client->dev, "write: %d\n", data); | 487 | dev_dbg(&client->dev, "write: %d\n", data); |
| @@ -544,12 +539,8 @@ static int mt9m001_video_probe(struct soc_camera_device *icd, | |||
| 544 | return v4l2_ctrl_handler_setup(&mt9m001->hdl); | 539 | return v4l2_ctrl_handler_setup(&mt9m001->hdl); |
| 545 | } | 540 | } |
| 546 | 541 | ||
| 547 | static void mt9m001_video_remove(struct soc_camera_device *icd) | 542 | static void mt9m001_video_remove(struct soc_camera_link *icl) |
| 548 | { | 543 | { |
| 549 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 550 | |||
| 551 | dev_dbg(icd->pdev, "Video removed: %p, %p\n", | ||
| 552 | icd->parent, icd->vdev); | ||
| 553 | if (icl->free_bus) | 544 | if (icl->free_bus) |
| 554 | icl->free_bus(icl); | 545 | icl->free_bus(icl); |
| 555 | } | 546 | } |
| @@ -594,8 +585,7 @@ static int mt9m001_g_mbus_config(struct v4l2_subdev *sd, | |||
| 594 | struct v4l2_mbus_config *cfg) | 585 | struct v4l2_mbus_config *cfg) |
| 595 | { | 586 | { |
| 596 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 587 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 597 | struct soc_camera_device *icd = client->dev.platform_data; | 588 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 598 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 599 | 589 | ||
| 600 | /* MT9M001 has all capture_format parameters fixed */ | 590 | /* MT9M001 has all capture_format parameters fixed */ |
| 601 | cfg->flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | | 591 | cfg->flags = V4L2_MBUS_PCLK_SAMPLE_FALLING | |
| @@ -610,9 +600,9 @@ static int mt9m001_g_mbus_config(struct v4l2_subdev *sd, | |||
| 610 | static int mt9m001_s_mbus_config(struct v4l2_subdev *sd, | 600 | static int mt9m001_s_mbus_config(struct v4l2_subdev *sd, |
| 611 | const struct v4l2_mbus_config *cfg) | 601 | const struct v4l2_mbus_config *cfg) |
| 612 | { | 602 | { |
| 613 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 603 | const struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 614 | struct soc_camera_device *icd = client->dev.platform_data; | 604 | struct soc_camera_device *icd = soc_camera_from_i2c(client); |
| 615 | struct soc_camera_link *icl = to_soc_camera_link(icd); | 605 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 616 | /* | 606 | /* |
| 617 | * Cannot use icd->current_fmt->host_fmt->bits_per_sample, because that | 607 | * Cannot use icd->current_fmt->host_fmt->bits_per_sample, because that |
| 618 | * is the number of bits, that the host has to sample, not the number of | 608 | * is the number of bits, that the host has to sample, not the number of |
| @@ -658,17 +648,10 @@ static int mt9m001_probe(struct i2c_client *client, | |||
| 658 | const struct i2c_device_id *did) | 648 | const struct i2c_device_id *did) |
| 659 | { | 649 | { |
| 660 | struct mt9m001 *mt9m001; | 650 | struct mt9m001 *mt9m001; |
| 661 | struct soc_camera_device *icd = client->dev.platform_data; | ||
| 662 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | 651 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
| 663 | struct soc_camera_link *icl; | 652 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 664 | int ret; | 653 | int ret; |
| 665 | 654 | ||
| 666 | if (!icd) { | ||
| 667 | dev_err(&client->dev, "MT9M001: missing soc-camera data!\n"); | ||
| 668 | return -EINVAL; | ||
| 669 | } | ||
| 670 | |||
| 671 | icl = to_soc_camera_link(icd); | ||
| 672 | if (!icl) { | 655 | if (!icl) { |
| 673 | dev_err(&client->dev, "MT9M001 driver needs platform data\n"); | 656 | dev_err(&client->dev, "MT9M001 driver needs platform data\n"); |
| 674 | return -EINVAL; | 657 | return -EINVAL; |
| @@ -716,7 +699,7 @@ static int mt9m001_probe(struct i2c_client *client, | |||
| 716 | mt9m001->rect.width = MT9M001_MAX_WIDTH; | 699 | mt9m001->rect.width = MT9M001_MAX_WIDTH; |
| 717 | mt9m001->rect.height = MT9M001_MAX_HEIGHT; | 700 | mt9m001->rect.height = MT9M001_MAX_HEIGHT; |
| 718 | 701 | ||
| 719 | ret = mt9m001_video_probe(icd, client); | 702 | ret = mt9m001_video_probe(icl, client); |
| 720 | if (ret) { | 703 | if (ret) { |
| 721 | v4l2_ctrl_handler_free(&mt9m001->hdl); | 704 | v4l2_ctrl_handler_free(&mt9m001->hdl); |
| 722 | kfree(mt9m001); | 705 | kfree(mt9m001); |
| @@ -728,11 +711,11 @@ static int mt9m001_probe(struct i2c_client *client, | |||
| 728 | static int mt9m001_remove(struct i2c_client *client) | 711 | static int mt9m001_remove(struct i2c_client *client) |
| 729 | { | 712 | { |
| 730 | struct mt9m001 *mt9m001 = to_mt9m001(client); | 713 | struct mt9m001 *mt9m001 = to_mt9m001(client); |
| 731 | struct soc_camera_device *icd = client->dev.platform_data; | 714 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 732 | 715 | ||
| 733 | v4l2_device_unregister_subdev(&mt9m001->subdev); | 716 | v4l2_device_unregister_subdev(&mt9m001->subdev); |
| 734 | v4l2_ctrl_handler_free(&mt9m001->hdl); | 717 | v4l2_ctrl_handler_free(&mt9m001->hdl); |
| 735 | mt9m001_video_remove(icd); | 718 | mt9m001_video_remove(icl); |
| 736 | kfree(mt9m001); | 719 | kfree(mt9m001); |
| 737 | 720 | ||
| 738 | return 0; | 721 | return 0; |
diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c index 8cacbf016848..9feeb0cb6722 100644 --- a/drivers/media/video/mt9m111.c +++ b/drivers/media/video/mt9m111.c | |||
| @@ -784,19 +784,12 @@ static int mt9m111_init(struct mt9m111 *mt9m111) | |||
| 784 | * Interface active, can use i2c. If it fails, it can indeed mean, that | 784 | * Interface active, can use i2c. If it fails, it can indeed mean, that |
| 785 | * this wasn't our capture interface, so, we wait for the right one | 785 | * this wasn't our capture interface, so, we wait for the right one |
| 786 | */ | 786 | */ |
| 787 | static int mt9m111_video_probe(struct soc_camera_device *icd, | 787 | static int mt9m111_video_probe(struct i2c_client *client) |
| 788 | struct i2c_client *client) | ||
| 789 | { | 788 | { |
| 790 | struct mt9m111 *mt9m111 = to_mt9m111(client); | 789 | struct mt9m111 *mt9m111 = to_mt9m111(client); |
| 791 | s32 data; | 790 | s32 data; |
| 792 | int ret; | 791 | int ret; |
| 793 | 792 | ||
| 794 | /* We must have a parent by now. And it cannot be a wrong one. */ | ||
| 795 | BUG_ON(!icd->parent || | ||
| 796 | to_soc_camera_host(icd->parent)->nr != icd->iface); | ||
| 797 | |||
| 798 | mt9m111->lastpage = -1; | ||
| 799 | |||
| 800 | data = reg_read(CHIP_VERSION); | 793 | data = reg_read(CHIP_VERSION); |
| 801 | 794 | ||
| 802 | switch (data) { | 795 | switch (data) { |
| @@ -883,8 +876,7 @@ static int mt9m111_g_mbus_config(struct v4l2_subdev *sd, | |||
| 883 | struct v4l2_mbus_config *cfg) | 876 | struct v4l2_mbus_config *cfg) |
| 884 | { | 877 | { |
| 885 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 878 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 886 | struct soc_camera_device *icd = client->dev.platform_data; | 879 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 887 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 888 | 880 | ||
| 889 | cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING | | 881 | cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING | |
| 890 | V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_HIGH | | 882 | V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_HIGH | |
| @@ -915,17 +907,10 @@ static int mt9m111_probe(struct i2c_client *client, | |||
| 915 | const struct i2c_device_id *did) | 907 | const struct i2c_device_id *did) |
| 916 | { | 908 | { |
| 917 | struct mt9m111 *mt9m111; | 909 | struct mt9m111 *mt9m111; |
| 918 | struct soc_camera_device *icd = client->dev.platform_data; | ||
| 919 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | 910 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
| 920 | struct soc_camera_link *icl; | 911 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 921 | int ret; | 912 | int ret; |
| 922 | 913 | ||
| 923 | if (!icd) { | ||
| 924 | dev_err(&client->dev, "mt9m111: soc-camera data missing!\n"); | ||
| 925 | return -EINVAL; | ||
| 926 | } | ||
| 927 | |||
| 928 | icl = to_soc_camera_link(icd); | ||
| 929 | if (!icl) { | 914 | if (!icl) { |
| 930 | dev_err(&client->dev, "mt9m111: driver needs platform data\n"); | 915 | dev_err(&client->dev, "mt9m111: driver needs platform data\n"); |
| 931 | return -EINVAL; | 916 | return -EINVAL; |
| @@ -968,8 +953,9 @@ static int mt9m111_probe(struct i2c_client *client, | |||
| 968 | mt9m111->rect.width = MT9M111_MAX_WIDTH; | 953 | mt9m111->rect.width = MT9M111_MAX_WIDTH; |
| 969 | mt9m111->rect.height = MT9M111_MAX_HEIGHT; | 954 | mt9m111->rect.height = MT9M111_MAX_HEIGHT; |
| 970 | mt9m111->fmt = &mt9m111_colour_fmts[0]; | 955 | mt9m111->fmt = &mt9m111_colour_fmts[0]; |
| 956 | mt9m111->lastpage = -1; | ||
| 971 | 957 | ||
| 972 | ret = mt9m111_video_probe(icd, client); | 958 | ret = mt9m111_video_probe(client); |
| 973 | if (ret) { | 959 | if (ret) { |
| 974 | v4l2_ctrl_handler_free(&mt9m111->hdl); | 960 | v4l2_ctrl_handler_free(&mt9m111->hdl); |
| 975 | kfree(mt9m111); | 961 | kfree(mt9m111); |
diff --git a/drivers/media/video/mt9t031.c b/drivers/media/video/mt9t031.c index 7ce37990a446..95cd602ae4ec 100644 --- a/drivers/media/video/mt9t031.c +++ b/drivers/media/video/mt9t031.c | |||
| @@ -265,7 +265,7 @@ static int mt9t031_set_params(struct i2c_client *client, | |||
| 265 | 265 | ||
| 266 | /* | 266 | /* |
| 267 | * The caller provides a supported format, as guaranteed by | 267 | * The caller provides a supported format, as guaranteed by |
| 268 | * icd->try_fmt_cap(), soc_camera_s_crop() and soc_camera_cropcap() | 268 | * .try_mbus_fmt(), soc_camera_s_crop() and soc_camera_cropcap() |
| 269 | */ | 269 | */ |
| 270 | if (ret >= 0) | 270 | if (ret >= 0) |
| 271 | ret = reg_write(client, MT9T031_COLUMN_START, rect->left); | 271 | ret = reg_write(client, MT9T031_COLUMN_START, rect->left); |
| @@ -573,8 +573,7 @@ static int mt9t031_runtime_suspend(struct device *dev) | |||
| 573 | static int mt9t031_runtime_resume(struct device *dev) | 573 | static int mt9t031_runtime_resume(struct device *dev) |
| 574 | { | 574 | { |
| 575 | struct video_device *vdev = to_video_device(dev); | 575 | struct video_device *vdev = to_video_device(dev); |
| 576 | struct soc_camera_device *icd = dev_get_drvdata(vdev->parent); | 576 | struct v4l2_subdev *sd = soc_camera_vdev_to_subdev(vdev); |
| 577 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | ||
| 578 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 577 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 579 | struct mt9t031 *mt9t031 = to_mt9t031(client); | 578 | struct mt9t031 *mt9t031 = to_mt9t031(client); |
| 580 | 579 | ||
| @@ -684,8 +683,7 @@ static int mt9t031_g_mbus_config(struct v4l2_subdev *sd, | |||
| 684 | struct v4l2_mbus_config *cfg) | 683 | struct v4l2_mbus_config *cfg) |
| 685 | { | 684 | { |
| 686 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 685 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 687 | struct soc_camera_device *icd = client->dev.platform_data; | 686 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 688 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 689 | 687 | ||
| 690 | cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING | | 688 | cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING | |
| 691 | V4L2_MBUS_PCLK_SAMPLE_FALLING | V4L2_MBUS_HSYNC_ACTIVE_HIGH | | 689 | V4L2_MBUS_PCLK_SAMPLE_FALLING | V4L2_MBUS_HSYNC_ACTIVE_HIGH | |
| @@ -700,8 +698,7 @@ static int mt9t031_s_mbus_config(struct v4l2_subdev *sd, | |||
| 700 | const struct v4l2_mbus_config *cfg) | 698 | const struct v4l2_mbus_config *cfg) |
| 701 | { | 699 | { |
| 702 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 700 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 703 | struct soc_camera_device *icd = client->dev.platform_data; | 701 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 704 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 705 | 702 | ||
| 706 | if (soc_camera_apply_board_flags(icl, cfg) & | 703 | if (soc_camera_apply_board_flags(icl, cfg) & |
| 707 | V4L2_MBUS_PCLK_SAMPLE_FALLING) | 704 | V4L2_MBUS_PCLK_SAMPLE_FALLING) |
| @@ -737,16 +734,13 @@ static int mt9t031_probe(struct i2c_client *client, | |||
| 737 | const struct i2c_device_id *did) | 734 | const struct i2c_device_id *did) |
| 738 | { | 735 | { |
| 739 | struct mt9t031 *mt9t031; | 736 | struct mt9t031 *mt9t031; |
| 740 | struct soc_camera_device *icd = client->dev.platform_data; | 737 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 741 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | 738 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
| 742 | int ret; | 739 | int ret; |
| 743 | 740 | ||
| 744 | if (icd) { | 741 | if (!icl) { |
| 745 | struct soc_camera_link *icl = to_soc_camera_link(icd); | 742 | dev_err(&client->dev, "MT9T031 driver needs platform data\n"); |
| 746 | if (!icl) { | 743 | return -EINVAL; |
| 747 | dev_err(&client->dev, "MT9T031 driver needs platform data\n"); | ||
| 748 | return -EINVAL; | ||
| 749 | } | ||
| 750 | } | 744 | } |
| 751 | 745 | ||
| 752 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) { | 746 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) { |
diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c index b8da7fe9a6bd..5b045a1097c6 100644 --- a/drivers/media/video/mt9t112.c +++ b/drivers/media/video/mt9t112.c | |||
| @@ -89,7 +89,6 @@ struct mt9t112_priv { | |||
| 89 | struct v4l2_subdev subdev; | 89 | struct v4l2_subdev subdev; |
| 90 | struct mt9t112_camera_info *info; | 90 | struct mt9t112_camera_info *info; |
| 91 | struct i2c_client *client; | 91 | struct i2c_client *client; |
| 92 | struct soc_camera_device icd; | ||
| 93 | struct v4l2_rect frame; | 92 | struct v4l2_rect frame; |
| 94 | const struct mt9t112_format *format; | 93 | const struct mt9t112_format *format; |
| 95 | int model; | 94 | int model; |
| @@ -306,38 +305,38 @@ static int mt9t112_clock_info(const struct i2c_client *client, u32 ext) | |||
| 306 | n = (n >> 8) & 0x003f; | 305 | n = (n >> 8) & 0x003f; |
| 307 | 306 | ||
| 308 | enable = ((6000 > ext) || (54000 < ext)) ? "X" : ""; | 307 | enable = ((6000 > ext) || (54000 < ext)) ? "X" : ""; |
| 309 | dev_info(&client->dev, "EXTCLK : %10u K %s\n", ext, enable); | 308 | dev_dbg(&client->dev, "EXTCLK : %10u K %s\n", ext, enable); |
| 310 | 309 | ||
| 311 | vco = 2 * m * ext / (n+1); | 310 | vco = 2 * m * ext / (n+1); |
| 312 | enable = ((384000 > vco) || (768000 < vco)) ? "X" : ""; | 311 | enable = ((384000 > vco) || (768000 < vco)) ? "X" : ""; |
| 313 | dev_info(&client->dev, "VCO : %10u K %s\n", vco, enable); | 312 | dev_dbg(&client->dev, "VCO : %10u K %s\n", vco, enable); |
| 314 | 313 | ||
| 315 | clk = vco / (p1+1) / (p2+1); | 314 | clk = vco / (p1+1) / (p2+1); |
| 316 | enable = (96000 < clk) ? "X" : ""; | 315 | enable = (96000 < clk) ? "X" : ""; |
| 317 | dev_info(&client->dev, "PIXCLK : %10u K %s\n", clk, enable); | 316 | dev_dbg(&client->dev, "PIXCLK : %10u K %s\n", clk, enable); |
| 318 | 317 | ||
| 319 | clk = vco / (p3+1); | 318 | clk = vco / (p3+1); |
| 320 | enable = (768000 < clk) ? "X" : ""; | 319 | enable = (768000 < clk) ? "X" : ""; |
| 321 | dev_info(&client->dev, "MIPICLK : %10u K %s\n", clk, enable); | 320 | dev_dbg(&client->dev, "MIPICLK : %10u K %s\n", clk, enable); |
| 322 | 321 | ||
| 323 | clk = vco / (p6+1); | 322 | clk = vco / (p6+1); |
| 324 | enable = (96000 < clk) ? "X" : ""; | 323 | enable = (96000 < clk) ? "X" : ""; |
| 325 | dev_info(&client->dev, "MCU CLK : %10u K %s\n", clk, enable); | 324 | dev_dbg(&client->dev, "MCU CLK : %10u K %s\n", clk, enable); |
| 326 | 325 | ||
| 327 | clk = vco / (p5+1); | 326 | clk = vco / (p5+1); |
| 328 | enable = (54000 < clk) ? "X" : ""; | 327 | enable = (54000 < clk) ? "X" : ""; |
| 329 | dev_info(&client->dev, "SOC CLK : %10u K %s\n", clk, enable); | 328 | dev_dbg(&client->dev, "SOC CLK : %10u K %s\n", clk, enable); |
| 330 | 329 | ||
| 331 | clk = vco / (p4+1); | 330 | clk = vco / (p4+1); |
| 332 | enable = (70000 < clk) ? "X" : ""; | 331 | enable = (70000 < clk) ? "X" : ""; |
| 333 | dev_info(&client->dev, "Sensor CLK : %10u K %s\n", clk, enable); | 332 | dev_dbg(&client->dev, "Sensor CLK : %10u K %s\n", clk, enable); |
| 334 | 333 | ||
| 335 | clk = vco / (p7+1); | 334 | clk = vco / (p7+1); |
| 336 | dev_info(&client->dev, "External sensor : %10u K\n", clk); | 335 | dev_dbg(&client->dev, "External sensor : %10u K\n", clk); |
| 337 | 336 | ||
| 338 | clk = ext / (n+1); | 337 | clk = ext / (n+1); |
| 339 | enable = ((2000 > clk) || (24000 < clk)) ? "X" : ""; | 338 | enable = ((2000 > clk) || (24000 < clk)) ? "X" : ""; |
| 340 | dev_info(&client->dev, "PFD : %10u K %s\n", clk, enable); | 339 | dev_dbg(&client->dev, "PFD : %10u K %s\n", clk, enable); |
| 341 | 340 | ||
| 342 | return 0; | 341 | return 0; |
| 343 | } | 342 | } |
| @@ -982,8 +981,7 @@ static int mt9t112_g_mbus_config(struct v4l2_subdev *sd, | |||
| 982 | struct v4l2_mbus_config *cfg) | 981 | struct v4l2_mbus_config *cfg) |
| 983 | { | 982 | { |
| 984 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 983 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 985 | struct soc_camera_device *icd = client->dev.platform_data; | 984 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 986 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 987 | 985 | ||
| 988 | cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_VSYNC_ACTIVE_HIGH | | 986 | cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_VSYNC_ACTIVE_HIGH | |
| 989 | V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_DATA_ACTIVE_HIGH | | 987 | V4L2_MBUS_HSYNC_ACTIVE_HIGH | V4L2_MBUS_DATA_ACTIVE_HIGH | |
| @@ -998,8 +996,7 @@ static int mt9t112_s_mbus_config(struct v4l2_subdev *sd, | |||
| 998 | const struct v4l2_mbus_config *cfg) | 996 | const struct v4l2_mbus_config *cfg) |
| 999 | { | 997 | { |
| 1000 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 998 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 1001 | struct soc_camera_device *icd = client->dev.platform_data; | 999 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 1002 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 1003 | struct mt9t112_priv *priv = to_mt9t112(client); | 1000 | struct mt9t112_priv *priv = to_mt9t112(client); |
| 1004 | 1001 | ||
| 1005 | if (soc_camera_apply_board_flags(icl, cfg) & V4L2_MBUS_PCLK_SAMPLE_RISING) | 1002 | if (soc_camera_apply_board_flags(icl, cfg) & V4L2_MBUS_PCLK_SAMPLE_RISING) |
| @@ -1029,17 +1026,12 @@ static struct v4l2_subdev_ops mt9t112_subdev_ops = { | |||
| 1029 | .video = &mt9t112_subdev_video_ops, | 1026 | .video = &mt9t112_subdev_video_ops, |
| 1030 | }; | 1027 | }; |
| 1031 | 1028 | ||
| 1032 | static int mt9t112_camera_probe(struct soc_camera_device *icd, | 1029 | static int mt9t112_camera_probe(struct i2c_client *client) |
| 1033 | struct i2c_client *client) | ||
| 1034 | { | 1030 | { |
| 1035 | struct mt9t112_priv *priv = to_mt9t112(client); | 1031 | struct mt9t112_priv *priv = to_mt9t112(client); |
| 1036 | const char *devname; | 1032 | const char *devname; |
| 1037 | int chipid; | 1033 | int chipid; |
| 1038 | 1034 | ||
| 1039 | /* We must have a parent by now. And it cannot be a wrong one. */ | ||
| 1040 | BUG_ON(!icd->parent || | ||
| 1041 | to_soc_camera_host(icd->parent)->nr != icd->iface); | ||
| 1042 | |||
| 1043 | /* | 1035 | /* |
| 1044 | * check and show chip ID | 1036 | * check and show chip ID |
| 1045 | */ | 1037 | */ |
| @@ -1068,8 +1060,7 @@ static int mt9t112_probe(struct i2c_client *client, | |||
| 1068 | const struct i2c_device_id *did) | 1060 | const struct i2c_device_id *did) |
| 1069 | { | 1061 | { |
| 1070 | struct mt9t112_priv *priv; | 1062 | struct mt9t112_priv *priv; |
| 1071 | struct soc_camera_device *icd = client->dev.platform_data; | 1063 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 1072 | struct soc_camera_link *icl; | ||
| 1073 | struct v4l2_rect rect = { | 1064 | struct v4l2_rect rect = { |
| 1074 | .width = VGA_WIDTH, | 1065 | .width = VGA_WIDTH, |
| 1075 | .height = VGA_HEIGHT, | 1066 | .height = VGA_HEIGHT, |
| @@ -1078,15 +1069,11 @@ static int mt9t112_probe(struct i2c_client *client, | |||
| 1078 | }; | 1069 | }; |
| 1079 | int ret; | 1070 | int ret; |
| 1080 | 1071 | ||
| 1081 | if (!icd) { | 1072 | if (!icl || !icl->priv) { |
| 1082 | dev_err(&client->dev, "mt9t112: missing soc-camera data!\n"); | 1073 | dev_err(&client->dev, "mt9t112: missing platform data!\n"); |
| 1083 | return -EINVAL; | 1074 | return -EINVAL; |
| 1084 | } | 1075 | } |
| 1085 | 1076 | ||
| 1086 | icl = to_soc_camera_link(icd); | ||
| 1087 | if (!icl || !icl->priv) | ||
| 1088 | return -EINVAL; | ||
| 1089 | |||
| 1090 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 1077 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
| 1091 | if (!priv) | 1078 | if (!priv) |
| 1092 | return -ENOMEM; | 1079 | return -ENOMEM; |
| @@ -1095,7 +1082,7 @@ static int mt9t112_probe(struct i2c_client *client, | |||
| 1095 | 1082 | ||
| 1096 | v4l2_i2c_subdev_init(&priv->subdev, client, &mt9t112_subdev_ops); | 1083 | v4l2_i2c_subdev_init(&priv->subdev, client, &mt9t112_subdev_ops); |
| 1097 | 1084 | ||
| 1098 | ret = mt9t112_camera_probe(icd, client); | 1085 | ret = mt9t112_camera_probe(client); |
| 1099 | if (ret) | 1086 | if (ret) |
| 1100 | kfree(priv); | 1087 | kfree(priv); |
| 1101 | 1088 | ||
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c index 7e2aeda21752..72b179b2ad6c 100644 --- a/drivers/media/video/mt9v022.c +++ b/drivers/media/video/mt9v022.c | |||
| @@ -332,7 +332,7 @@ static int mt9v022_s_fmt(struct v4l2_subdev *sd, | |||
| 332 | 332 | ||
| 333 | /* | 333 | /* |
| 334 | * The caller provides a supported format, as verified per call to | 334 | * The caller provides a supported format, as verified per call to |
| 335 | * icd->try_fmt(), datawidth is from our supported format list | 335 | * .try_mbus_fmt(), datawidth is from our supported format list |
| 336 | */ | 336 | */ |
| 337 | switch (mf->code) { | 337 | switch (mf->code) { |
| 338 | case V4L2_MBUS_FMT_Y8_1X8: | 338 | case V4L2_MBUS_FMT_Y8_1X8: |
| @@ -562,19 +562,14 @@ static int mt9v022_s_ctrl(struct v4l2_ctrl *ctrl) | |||
| 562 | * Interface active, can use i2c. If it fails, it can indeed mean, that | 562 | * Interface active, can use i2c. If it fails, it can indeed mean, that |
| 563 | * this wasn't our capture interface, so, we wait for the right one | 563 | * this wasn't our capture interface, so, we wait for the right one |
| 564 | */ | 564 | */ |
| 565 | static int mt9v022_video_probe(struct soc_camera_device *icd, | 565 | static int mt9v022_video_probe(struct i2c_client *client) |
| 566 | struct i2c_client *client) | ||
| 567 | { | 566 | { |
| 568 | struct mt9v022 *mt9v022 = to_mt9v022(client); | 567 | struct mt9v022 *mt9v022 = to_mt9v022(client); |
| 569 | struct soc_camera_link *icl = to_soc_camera_link(icd); | 568 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 570 | s32 data; | 569 | s32 data; |
| 571 | int ret; | 570 | int ret; |
| 572 | unsigned long flags; | 571 | unsigned long flags; |
| 573 | 572 | ||
| 574 | /* We must have a parent by now. And it cannot be a wrong one. */ | ||
| 575 | BUG_ON(!icd->parent || | ||
| 576 | to_soc_camera_host(icd->parent)->nr != icd->iface); | ||
| 577 | |||
| 578 | /* Read out the chip version register */ | 573 | /* Read out the chip version register */ |
| 579 | data = reg_read(client, MT9V022_CHIP_VERSION); | 574 | data = reg_read(client, MT9V022_CHIP_VERSION); |
| 580 | 575 | ||
| @@ -648,16 +643,6 @@ ei2c: | |||
| 648 | return ret; | 643 | return ret; |
| 649 | } | 644 | } |
| 650 | 645 | ||
| 651 | static void mt9v022_video_remove(struct soc_camera_device *icd) | ||
| 652 | { | ||
| 653 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 654 | |||
| 655 | dev_dbg(icd->pdev, "Video removed: %p, %p\n", | ||
| 656 | icd->parent, icd->vdev); | ||
| 657 | if (icl->free_bus) | ||
| 658 | icl->free_bus(icl); | ||
| 659 | } | ||
| 660 | |||
| 661 | static int mt9v022_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines) | 646 | static int mt9v022_g_skip_top_lines(struct v4l2_subdev *sd, u32 *lines) |
| 662 | { | 647 | { |
| 663 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 648 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| @@ -698,8 +683,7 @@ static int mt9v022_g_mbus_config(struct v4l2_subdev *sd, | |||
| 698 | struct v4l2_mbus_config *cfg) | 683 | struct v4l2_mbus_config *cfg) |
| 699 | { | 684 | { |
| 700 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 685 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 701 | struct soc_camera_device *icd = client->dev.platform_data; | 686 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 702 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 703 | 687 | ||
| 704 | cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_SLAVE | | 688 | cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_SLAVE | |
| 705 | V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | | 689 | V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | |
| @@ -730,8 +714,8 @@ static int mt9v022_s_mbus_config(struct v4l2_subdev *sd, | |||
| 730 | int ret; | 714 | int ret; |
| 731 | u16 pixclk = 0; | 715 | u16 pixclk = 0; |
| 732 | 716 | ||
| 733 | dev_info(icd->pdev, "set %d: %s, %dbps\n", icd->current_fmt->code, | 717 | dev_dbg(icd->pdev, "set %d: %s, %dbps\n", icd->current_fmt->code, |
| 734 | icd->current_fmt->host_fmt->name, bps); | 718 | icd->current_fmt->host_fmt->name, bps); |
| 735 | 719 | ||
| 736 | if (icl->set_bus_param) { | 720 | if (icl->set_bus_param) { |
| 737 | ret = icl->set_bus_param(icl, 1 << (bps - 1)); | 721 | ret = icl->set_bus_param(icl, 1 << (bps - 1)); |
| @@ -798,17 +782,10 @@ static int mt9v022_probe(struct i2c_client *client, | |||
| 798 | const struct i2c_device_id *did) | 782 | const struct i2c_device_id *did) |
| 799 | { | 783 | { |
| 800 | struct mt9v022 *mt9v022; | 784 | struct mt9v022 *mt9v022; |
| 801 | struct soc_camera_device *icd = client->dev.platform_data; | 785 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 802 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | 786 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
| 803 | struct soc_camera_link *icl; | ||
| 804 | int ret; | 787 | int ret; |
| 805 | 788 | ||
| 806 | if (!icd) { | ||
| 807 | dev_err(&client->dev, "MT9V022: missing soc-camera data!\n"); | ||
| 808 | return -EINVAL; | ||
| 809 | } | ||
| 810 | |||
| 811 | icl = to_soc_camera_link(icd); | ||
| 812 | if (!icl) { | 789 | if (!icl) { |
| 813 | dev_err(&client->dev, "MT9V022 driver needs platform data\n"); | 790 | dev_err(&client->dev, "MT9V022 driver needs platform data\n"); |
| 814 | return -EINVAL; | 791 | return -EINVAL; |
| @@ -868,7 +845,7 @@ static int mt9v022_probe(struct i2c_client *client, | |||
| 868 | mt9v022->rect.width = MT9V022_MAX_WIDTH; | 845 | mt9v022->rect.width = MT9V022_MAX_WIDTH; |
| 869 | mt9v022->rect.height = MT9V022_MAX_HEIGHT; | 846 | mt9v022->rect.height = MT9V022_MAX_HEIGHT; |
| 870 | 847 | ||
| 871 | ret = mt9v022_video_probe(icd, client); | 848 | ret = mt9v022_video_probe(client); |
| 872 | if (ret) { | 849 | if (ret) { |
| 873 | v4l2_ctrl_handler_free(&mt9v022->hdl); | 850 | v4l2_ctrl_handler_free(&mt9v022->hdl); |
| 874 | kfree(mt9v022); | 851 | kfree(mt9v022); |
| @@ -880,10 +857,11 @@ static int mt9v022_probe(struct i2c_client *client, | |||
| 880 | static int mt9v022_remove(struct i2c_client *client) | 857 | static int mt9v022_remove(struct i2c_client *client) |
| 881 | { | 858 | { |
| 882 | struct mt9v022 *mt9v022 = to_mt9v022(client); | 859 | struct mt9v022 *mt9v022 = to_mt9v022(client); |
| 883 | struct soc_camera_device *icd = client->dev.platform_data; | 860 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 884 | 861 | ||
| 885 | v4l2_device_unregister_subdev(&mt9v022->subdev); | 862 | v4l2_device_unregister_subdev(&mt9v022->subdev); |
| 886 | mt9v022_video_remove(icd); | 863 | if (icl->free_bus) |
| 864 | icl->free_bus(icl); | ||
| 887 | v4l2_ctrl_handler_free(&mt9v022->hdl); | 865 | v4l2_ctrl_handler_free(&mt9v022->hdl); |
| 888 | kfree(mt9v022); | 866 | kfree(mt9v022); |
| 889 | 867 | ||
diff --git a/drivers/media/video/ov2640.c b/drivers/media/video/ov2640.c index 981767f2d8ea..d37a5cceebb6 100644 --- a/drivers/media/video/ov2640.c +++ b/drivers/media/video/ov2640.c | |||
| @@ -942,18 +942,13 @@ static int ov2640_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) | |||
| 942 | return 0; | 942 | return 0; |
| 943 | } | 943 | } |
| 944 | 944 | ||
| 945 | static int ov2640_video_probe(struct soc_camera_device *icd, | 945 | static int ov2640_video_probe(struct i2c_client *client) |
| 946 | struct i2c_client *client) | ||
| 947 | { | 946 | { |
| 948 | struct ov2640_priv *priv = to_ov2640(client); | 947 | struct ov2640_priv *priv = to_ov2640(client); |
| 949 | u8 pid, ver, midh, midl; | 948 | u8 pid, ver, midh, midl; |
| 950 | const char *devname; | 949 | const char *devname; |
| 951 | int ret; | 950 | int ret; |
| 952 | 951 | ||
| 953 | /* We must have a parent by now. And it cannot be a wrong one. */ | ||
| 954 | BUG_ON(!icd->parent || | ||
| 955 | to_soc_camera_host(icd->parent)->nr != icd->iface); | ||
| 956 | |||
| 957 | /* | 952 | /* |
| 958 | * check and show product ID and manufacturer ID | 953 | * check and show product ID and manufacturer ID |
| 959 | */ | 954 | */ |
| @@ -1001,8 +996,7 @@ static int ov2640_g_mbus_config(struct v4l2_subdev *sd, | |||
| 1001 | struct v4l2_mbus_config *cfg) | 996 | struct v4l2_mbus_config *cfg) |
| 1002 | { | 997 | { |
| 1003 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 998 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 1004 | struct soc_camera_device *icd = client->dev.platform_data; | 999 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 1005 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 1006 | 1000 | ||
| 1007 | cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | | 1001 | cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | |
| 1008 | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | | 1002 | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | |
| @@ -1035,18 +1029,11 @@ static struct v4l2_subdev_ops ov2640_subdev_ops = { | |||
| 1035 | static int ov2640_probe(struct i2c_client *client, | 1029 | static int ov2640_probe(struct i2c_client *client, |
| 1036 | const struct i2c_device_id *did) | 1030 | const struct i2c_device_id *did) |
| 1037 | { | 1031 | { |
| 1038 | struct ov2640_priv *priv; | 1032 | struct ov2640_priv *priv; |
| 1039 | struct soc_camera_device *icd = client->dev.platform_data; | 1033 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 1040 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | 1034 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
| 1041 | struct soc_camera_link *icl; | 1035 | int ret; |
| 1042 | int ret; | ||
| 1043 | |||
| 1044 | if (!icd) { | ||
| 1045 | dev_err(&adapter->dev, "OV2640: missing soc-camera data!\n"); | ||
| 1046 | return -EINVAL; | ||
| 1047 | } | ||
| 1048 | 1036 | ||
| 1049 | icl = to_soc_camera_link(icd); | ||
| 1050 | if (!icl) { | 1037 | if (!icl) { |
| 1051 | dev_err(&adapter->dev, | 1038 | dev_err(&adapter->dev, |
| 1052 | "OV2640: Missing platform_data for driver\n"); | 1039 | "OV2640: Missing platform_data for driver\n"); |
| @@ -1080,7 +1067,7 @@ static int ov2640_probe(struct i2c_client *client, | |||
| 1080 | return err; | 1067 | return err; |
| 1081 | } | 1068 | } |
| 1082 | 1069 | ||
| 1083 | ret = ov2640_video_probe(icd, client); | 1070 | ret = ov2640_video_probe(client); |
| 1084 | if (ret) { | 1071 | if (ret) { |
| 1085 | v4l2_ctrl_handler_free(&priv->hdl); | 1072 | v4l2_ctrl_handler_free(&priv->hdl); |
| 1086 | kfree(priv); | 1073 | kfree(priv); |
diff --git a/drivers/media/video/ov5642.c b/drivers/media/video/ov5642.c index 163a6f7ff8ef..2a26602fc86d 100644 --- a/drivers/media/video/ov5642.c +++ b/drivers/media/video/ov5642.c | |||
| @@ -889,8 +889,7 @@ static struct v4l2_subdev_ops ov5642_subdev_ops = { | |||
| 889 | .video = &ov5642_subdev_video_ops, | 889 | .video = &ov5642_subdev_video_ops, |
| 890 | }; | 890 | }; |
| 891 | 891 | ||
| 892 | static int ov5642_video_probe(struct soc_camera_device *icd, | 892 | static int ov5642_video_probe(struct i2c_client *client) |
| 893 | struct i2c_client *client) | ||
| 894 | { | 893 | { |
| 895 | int ret; | 894 | int ret; |
| 896 | u8 id_high, id_low; | 895 | u8 id_high, id_low; |
| @@ -921,16 +920,9 @@ static int ov5642_probe(struct i2c_client *client, | |||
| 921 | const struct i2c_device_id *did) | 920 | const struct i2c_device_id *did) |
| 922 | { | 921 | { |
| 923 | struct ov5642 *priv; | 922 | struct ov5642 *priv; |
| 924 | struct soc_camera_device *icd = client->dev.platform_data; | 923 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 925 | struct soc_camera_link *icl; | ||
| 926 | int ret; | 924 | int ret; |
| 927 | 925 | ||
| 928 | if (!icd) { | ||
| 929 | dev_err(&client->dev, "OV5642: missing soc-camera data!\n"); | ||
| 930 | return -EINVAL; | ||
| 931 | } | ||
| 932 | |||
| 933 | icl = to_soc_camera_link(icd); | ||
| 934 | if (!icl) { | 926 | if (!icl) { |
| 935 | dev_err(&client->dev, "OV5642: missing platform data!\n"); | 927 | dev_err(&client->dev, "OV5642: missing platform data!\n"); |
| 936 | return -EINVAL; | 928 | return -EINVAL; |
| @@ -944,7 +936,7 @@ static int ov5642_probe(struct i2c_client *client, | |||
| 944 | 936 | ||
| 945 | priv->fmt = &ov5642_colour_fmts[0]; | 937 | priv->fmt = &ov5642_colour_fmts[0]; |
| 946 | 938 | ||
| 947 | ret = ov5642_video_probe(icd, client); | 939 | ret = ov5642_video_probe(client); |
| 948 | if (ret < 0) | 940 | if (ret < 0) |
| 949 | goto error; | 941 | goto error; |
| 950 | 942 | ||
| @@ -958,8 +950,7 @@ error: | |||
| 958 | static int ov5642_remove(struct i2c_client *client) | 950 | static int ov5642_remove(struct i2c_client *client) |
| 959 | { | 951 | { |
| 960 | struct ov5642 *priv = to_ov5642(client); | 952 | struct ov5642 *priv = to_ov5642(client); |
| 961 | struct soc_camera_device *icd = client->dev.platform_data; | 953 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 962 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 963 | 954 | ||
| 964 | if (icl->free_bus) | 955 | if (icl->free_bus) |
| 965 | icl->free_bus(icl); | 956 | icl->free_bus(icl); |
diff --git a/drivers/media/video/ov6650.c b/drivers/media/video/ov6650.c index efa45132c992..f060eaaf916f 100644 --- a/drivers/media/video/ov6650.c +++ b/drivers/media/video/ov6650.c | |||
| @@ -820,8 +820,7 @@ static int ov6650_prog_dflt(struct i2c_client *client) | |||
| 820 | return ret; | 820 | return ret; |
| 821 | } | 821 | } |
| 822 | 822 | ||
| 823 | static int ov6650_video_probe(struct soc_camera_device *icd, | 823 | static int ov6650_video_probe(struct i2c_client *client) |
| 824 | struct i2c_client *client) | ||
| 825 | { | 824 | { |
| 826 | u8 pidh, pidl, midh, midl; | 825 | u8 pidh, pidl, midh, midl; |
| 827 | int ret = 0; | 826 | int ret = 0; |
| @@ -875,8 +874,7 @@ static int ov6650_g_mbus_config(struct v4l2_subdev *sd, | |||
| 875 | struct v4l2_mbus_config *cfg) | 874 | struct v4l2_mbus_config *cfg) |
| 876 | { | 875 | { |
| 877 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 876 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 878 | struct soc_camera_device *icd = client->dev.platform_data; | 877 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 879 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 880 | 878 | ||
| 881 | cfg->flags = V4L2_MBUS_MASTER | | 879 | cfg->flags = V4L2_MBUS_MASTER | |
| 882 | V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | | 880 | V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | |
| @@ -894,8 +892,7 @@ static int ov6650_s_mbus_config(struct v4l2_subdev *sd, | |||
| 894 | const struct v4l2_mbus_config *cfg) | 892 | const struct v4l2_mbus_config *cfg) |
| 895 | { | 893 | { |
| 896 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 894 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 897 | struct soc_camera_device *icd = client->dev.platform_data; | 895 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 898 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 899 | unsigned long flags = soc_camera_apply_board_flags(icl, cfg); | 896 | unsigned long flags = soc_camera_apply_board_flags(icl, cfg); |
| 900 | int ret; | 897 | int ret; |
| 901 | 898 | ||
| @@ -948,16 +945,9 @@ static int ov6650_probe(struct i2c_client *client, | |||
| 948 | const struct i2c_device_id *did) | 945 | const struct i2c_device_id *did) |
| 949 | { | 946 | { |
| 950 | struct ov6650 *priv; | 947 | struct ov6650 *priv; |
| 951 | struct soc_camera_device *icd = client->dev.platform_data; | 948 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 952 | struct soc_camera_link *icl; | ||
| 953 | int ret; | 949 | int ret; |
| 954 | 950 | ||
| 955 | if (!icd) { | ||
| 956 | dev_err(&client->dev, "Missing soc-camera data!\n"); | ||
| 957 | return -EINVAL; | ||
| 958 | } | ||
| 959 | |||
| 960 | icl = to_soc_camera_link(icd); | ||
| 961 | if (!icl) { | 951 | if (!icl) { |
| 962 | dev_err(&client->dev, "Missing platform_data for driver\n"); | 952 | dev_err(&client->dev, "Missing platform_data for driver\n"); |
| 963 | return -EINVAL; | 953 | return -EINVAL; |
| @@ -1020,7 +1010,7 @@ static int ov6650_probe(struct i2c_client *client, | |||
| 1020 | priv->code = V4L2_MBUS_FMT_YUYV8_2X8; | 1010 | priv->code = V4L2_MBUS_FMT_YUYV8_2X8; |
| 1021 | priv->colorspace = V4L2_COLORSPACE_JPEG; | 1011 | priv->colorspace = V4L2_COLORSPACE_JPEG; |
| 1022 | 1012 | ||
| 1023 | ret = ov6650_video_probe(icd, client); | 1013 | ret = ov6650_video_probe(client); |
| 1024 | if (!ret) | 1014 | if (!ret) |
| 1025 | ret = v4l2_ctrl_handler_setup(&priv->hdl); | 1015 | ret = v4l2_ctrl_handler_setup(&priv->hdl); |
| 1026 | 1016 | ||
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c index 9b540421e2cb..a2146c30771e 100644 --- a/drivers/media/video/ov772x.c +++ b/drivers/media/video/ov772x.c | |||
| @@ -953,17 +953,12 @@ static int ov772x_try_fmt(struct v4l2_subdev *sd, | |||
| 953 | return 0; | 953 | return 0; |
| 954 | } | 954 | } |
| 955 | 955 | ||
| 956 | static int ov772x_video_probe(struct soc_camera_device *icd, | 956 | static int ov772x_video_probe(struct i2c_client *client) |
| 957 | struct i2c_client *client) | ||
| 958 | { | 957 | { |
| 959 | struct ov772x_priv *priv = to_ov772x(client); | 958 | struct ov772x_priv *priv = to_ov772x(client); |
| 960 | u8 pid, ver; | 959 | u8 pid, ver; |
| 961 | const char *devname; | 960 | const char *devname; |
| 962 | 961 | ||
| 963 | /* We must have a parent by now. And it cannot be a wrong one. */ | ||
| 964 | BUG_ON(!icd->parent || | ||
| 965 | to_soc_camera_host(icd->parent)->nr != icd->iface); | ||
| 966 | |||
| 967 | /* | 962 | /* |
| 968 | * check and show product ID and manufacturer ID | 963 | * check and show product ID and manufacturer ID |
| 969 | */ | 964 | */ |
| @@ -1021,8 +1016,7 @@ static int ov772x_g_mbus_config(struct v4l2_subdev *sd, | |||
| 1021 | struct v4l2_mbus_config *cfg) | 1016 | struct v4l2_mbus_config *cfg) |
| 1022 | { | 1017 | { |
| 1023 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1018 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 1024 | struct soc_camera_device *icd = client->dev.platform_data; | 1019 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 1025 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 1026 | 1020 | ||
| 1027 | cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | | 1021 | cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | |
| 1028 | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | | 1022 | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | |
| @@ -1056,20 +1050,15 @@ static struct v4l2_subdev_ops ov772x_subdev_ops = { | |||
| 1056 | static int ov772x_probe(struct i2c_client *client, | 1050 | static int ov772x_probe(struct i2c_client *client, |
| 1057 | const struct i2c_device_id *did) | 1051 | const struct i2c_device_id *did) |
| 1058 | { | 1052 | { |
| 1059 | struct ov772x_priv *priv; | 1053 | struct ov772x_priv *priv; |
| 1060 | struct soc_camera_device *icd = client->dev.platform_data; | 1054 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 1061 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | 1055 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
| 1062 | struct soc_camera_link *icl; | 1056 | int ret; |
| 1063 | int ret; | ||
| 1064 | |||
| 1065 | if (!icd) { | ||
| 1066 | dev_err(&client->dev, "OV772X: missing soc-camera data!\n"); | ||
| 1067 | return -EINVAL; | ||
| 1068 | } | ||
| 1069 | 1057 | ||
| 1070 | icl = to_soc_camera_link(icd); | 1058 | if (!icl || !icl->priv) { |
| 1071 | if (!icl || !icl->priv) | 1059 | dev_err(&client->dev, "OV772X: missing platform data!\n"); |
| 1072 | return -EINVAL; | 1060 | return -EINVAL; |
| 1061 | } | ||
| 1073 | 1062 | ||
| 1074 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { | 1063 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { |
| 1075 | dev_err(&adapter->dev, | 1064 | dev_err(&adapter->dev, |
| @@ -1100,7 +1089,7 @@ static int ov772x_probe(struct i2c_client *client, | |||
| 1100 | return err; | 1089 | return err; |
| 1101 | } | 1090 | } |
| 1102 | 1091 | ||
| 1103 | ret = ov772x_video_probe(icd, client); | 1092 | ret = ov772x_video_probe(client); |
| 1104 | if (ret) { | 1093 | if (ret) { |
| 1105 | v4l2_ctrl_handler_free(&priv->hdl); | 1094 | v4l2_ctrl_handler_free(&priv->hdl); |
| 1106 | kfree(priv); | 1095 | kfree(priv); |
diff --git a/drivers/media/video/ov9640.c b/drivers/media/video/ov9640.c index 12d33a9c07b0..f9babf39d802 100644 --- a/drivers/media/video/ov9640.c +++ b/drivers/media/video/ov9640.c | |||
| @@ -578,8 +578,7 @@ static int ov9640_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) | |||
| 578 | return 0; | 578 | return 0; |
| 579 | } | 579 | } |
| 580 | 580 | ||
| 581 | static int ov9640_video_probe(struct soc_camera_device *icd, | 581 | static int ov9640_video_probe(struct i2c_client *client) |
| 582 | struct i2c_client *client) | ||
| 583 | { | 582 | { |
| 584 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | 583 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
| 585 | struct ov9640_priv *priv = to_ov9640_sensor(sd); | 584 | struct ov9640_priv *priv = to_ov9640_sensor(sd); |
| @@ -587,10 +586,6 @@ static int ov9640_video_probe(struct soc_camera_device *icd, | |||
| 587 | const char *devname; | 586 | const char *devname; |
| 588 | int ret = 0; | 587 | int ret = 0; |
| 589 | 588 | ||
| 590 | /* We must have a parent by now. And it cannot be a wrong one. */ | ||
| 591 | BUG_ON(!icd->parent || | ||
| 592 | to_soc_camera_host(icd->parent)->nr != icd->iface); | ||
| 593 | |||
| 594 | /* | 589 | /* |
| 595 | * check and show product ID and manufacturer ID | 590 | * check and show product ID and manufacturer ID |
| 596 | */ | 591 | */ |
| @@ -644,8 +639,7 @@ static int ov9640_g_mbus_config(struct v4l2_subdev *sd, | |||
| 644 | struct v4l2_mbus_config *cfg) | 639 | struct v4l2_mbus_config *cfg) |
| 645 | { | 640 | { |
| 646 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 641 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 647 | struct soc_camera_device *icd = client->dev.platform_data; | 642 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 648 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 649 | 643 | ||
| 650 | cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | | 644 | cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | |
| 651 | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | | 645 | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | |
| @@ -678,16 +672,9 @@ static int ov9640_probe(struct i2c_client *client, | |||
| 678 | const struct i2c_device_id *did) | 672 | const struct i2c_device_id *did) |
| 679 | { | 673 | { |
| 680 | struct ov9640_priv *priv; | 674 | struct ov9640_priv *priv; |
| 681 | struct soc_camera_device *icd = client->dev.platform_data; | 675 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 682 | struct soc_camera_link *icl; | ||
| 683 | int ret; | 676 | int ret; |
| 684 | 677 | ||
| 685 | if (!icd) { | ||
| 686 | dev_err(&client->dev, "Missing soc-camera data!\n"); | ||
| 687 | return -EINVAL; | ||
| 688 | } | ||
| 689 | |||
| 690 | icl = to_soc_camera_link(icd); | ||
| 691 | if (!icl) { | 678 | if (!icl) { |
| 692 | dev_err(&client->dev, "Missing platform_data for driver\n"); | 679 | dev_err(&client->dev, "Missing platform_data for driver\n"); |
| 693 | return -EINVAL; | 680 | return -EINVAL; |
| @@ -715,7 +702,7 @@ static int ov9640_probe(struct i2c_client *client, | |||
| 715 | return err; | 702 | return err; |
| 716 | } | 703 | } |
| 717 | 704 | ||
| 718 | ret = ov9640_video_probe(icd, client); | 705 | ret = ov9640_video_probe(client); |
| 719 | 706 | ||
| 720 | if (ret) { | 707 | if (ret) { |
| 721 | v4l2_ctrl_handler_free(&priv->hdl); | 708 | v4l2_ctrl_handler_free(&priv->hdl); |
diff --git a/drivers/media/video/ov9740.c b/drivers/media/video/ov9740.c index 3dd910dcc5b8..9558aca86818 100644 --- a/drivers/media/video/ov9740.c +++ b/drivers/media/video/ov9740.c | |||
| @@ -836,18 +836,13 @@ static int ov9740_set_register(struct v4l2_subdev *sd, | |||
| 836 | } | 836 | } |
| 837 | #endif | 837 | #endif |
| 838 | 838 | ||
| 839 | static int ov9740_video_probe(struct soc_camera_device *icd, | 839 | static int ov9740_video_probe(struct i2c_client *client) |
| 840 | struct i2c_client *client) | ||
| 841 | { | 840 | { |
| 842 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | 841 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
| 843 | struct ov9740_priv *priv = to_ov9740(sd); | 842 | struct ov9740_priv *priv = to_ov9740(sd); |
| 844 | u8 modelhi, modello; | 843 | u8 modelhi, modello; |
| 845 | int ret; | 844 | int ret; |
| 846 | 845 | ||
| 847 | /* We must have a parent by now. And it cannot be a wrong one. */ | ||
| 848 | BUG_ON(!icd->parent || | ||
| 849 | to_soc_camera_host(icd->parent)->nr != icd->iface); | ||
| 850 | |||
| 851 | /* | 846 | /* |
| 852 | * check and show product ID and manufacturer ID | 847 | * check and show product ID and manufacturer ID |
| 853 | */ | 848 | */ |
| @@ -893,8 +888,7 @@ static int ov9740_g_mbus_config(struct v4l2_subdev *sd, | |||
| 893 | struct v4l2_mbus_config *cfg) | 888 | struct v4l2_mbus_config *cfg) |
| 894 | { | 889 | { |
| 895 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 890 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 896 | struct soc_camera_device *icd = client->dev.platform_data; | 891 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 897 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 898 | 892 | ||
| 899 | cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | | 893 | cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | |
| 900 | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | | 894 | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | |
| @@ -940,16 +934,9 @@ static int ov9740_probe(struct i2c_client *client, | |||
| 940 | const struct i2c_device_id *did) | 934 | const struct i2c_device_id *did) |
| 941 | { | 935 | { |
| 942 | struct ov9740_priv *priv; | 936 | struct ov9740_priv *priv; |
| 943 | struct soc_camera_device *icd = client->dev.platform_data; | 937 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 944 | struct soc_camera_link *icl; | ||
| 945 | int ret; | 938 | int ret; |
| 946 | 939 | ||
| 947 | if (!icd) { | ||
| 948 | dev_err(&client->dev, "Missing soc-camera data!\n"); | ||
| 949 | return -EINVAL; | ||
| 950 | } | ||
| 951 | |||
| 952 | icl = to_soc_camera_link(icd); | ||
| 953 | if (!icl) { | 940 | if (!icl) { |
| 954 | dev_err(&client->dev, "Missing platform_data for driver\n"); | 941 | dev_err(&client->dev, "Missing platform_data for driver\n"); |
| 955 | return -EINVAL; | 942 | return -EINVAL; |
| @@ -975,7 +962,7 @@ static int ov9740_probe(struct i2c_client *client, | |||
| 975 | return err; | 962 | return err; |
| 976 | } | 963 | } |
| 977 | 964 | ||
| 978 | ret = ov9740_video_probe(icd, client); | 965 | ret = ov9740_video_probe(client); |
| 979 | if (!ret) | 966 | if (!ret) |
| 980 | ret = v4l2_ctrl_handler_setup(&priv->hdl); | 967 | ret = v4l2_ctrl_handler_setup(&priv->hdl); |
| 981 | if (ret < 0) { | 968 | if (ret < 0) { |
diff --git a/drivers/media/video/rj54n1cb0c.c b/drivers/media/video/rj54n1cb0c.c index 9a871537d233..fcb14d93a24c 100644 --- a/drivers/media/video/rj54n1cb0c.c +++ b/drivers/media/video/rj54n1cb0c.c | |||
| @@ -1235,8 +1235,7 @@ static int rj54n1_g_mbus_config(struct v4l2_subdev *sd, | |||
| 1235 | struct v4l2_mbus_config *cfg) | 1235 | struct v4l2_mbus_config *cfg) |
| 1236 | { | 1236 | { |
| 1237 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1237 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 1238 | struct soc_camera_device *icd = client->dev.platform_data; | 1238 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 1239 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 1240 | 1239 | ||
| 1241 | cfg->flags = | 1240 | cfg->flags = |
| 1242 | V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | | 1241 | V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | |
| @@ -1252,8 +1251,7 @@ static int rj54n1_s_mbus_config(struct v4l2_subdev *sd, | |||
| 1252 | const struct v4l2_mbus_config *cfg) | 1251 | const struct v4l2_mbus_config *cfg) |
| 1253 | { | 1252 | { |
| 1254 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1253 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 1255 | struct soc_camera_device *icd = client->dev.platform_data; | 1254 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 1256 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 1257 | 1255 | ||
| 1258 | /* Figures 2.5-1 to 2.5-3 - default falling pixclk edge */ | 1256 | /* Figures 2.5-1 to 2.5-3 - default falling pixclk edge */ |
| 1259 | if (soc_camera_apply_board_flags(icl, cfg) & | 1257 | if (soc_camera_apply_board_flags(icl, cfg) & |
| @@ -1285,17 +1283,12 @@ static struct v4l2_subdev_ops rj54n1_subdev_ops = { | |||
| 1285 | * Interface active, can use i2c. If it fails, it can indeed mean, that | 1283 | * Interface active, can use i2c. If it fails, it can indeed mean, that |
| 1286 | * this wasn't our capture interface, so, we wait for the right one | 1284 | * this wasn't our capture interface, so, we wait for the right one |
| 1287 | */ | 1285 | */ |
| 1288 | static int rj54n1_video_probe(struct soc_camera_device *icd, | 1286 | static int rj54n1_video_probe(struct i2c_client *client, |
| 1289 | struct i2c_client *client, | ||
| 1290 | struct rj54n1_pdata *priv) | 1287 | struct rj54n1_pdata *priv) |
| 1291 | { | 1288 | { |
| 1292 | int data1, data2; | 1289 | int data1, data2; |
| 1293 | int ret; | 1290 | int ret; |
| 1294 | 1291 | ||
| 1295 | /* We must have a parent by now. And it cannot be a wrong one. */ | ||
| 1296 | BUG_ON(!icd->parent || | ||
| 1297 | to_soc_camera_host(icd->parent)->nr != icd->iface); | ||
| 1298 | |||
| 1299 | /* Read out the chip version register */ | 1292 | /* Read out the chip version register */ |
| 1300 | data1 = reg_read(client, RJ54N1_DEV_CODE); | 1293 | data1 = reg_read(client, RJ54N1_DEV_CODE); |
| 1301 | data2 = reg_read(client, RJ54N1_DEV_CODE2); | 1294 | data2 = reg_read(client, RJ54N1_DEV_CODE2); |
| @@ -1323,18 +1316,11 @@ static int rj54n1_probe(struct i2c_client *client, | |||
| 1323 | const struct i2c_device_id *did) | 1316 | const struct i2c_device_id *did) |
| 1324 | { | 1317 | { |
| 1325 | struct rj54n1 *rj54n1; | 1318 | struct rj54n1 *rj54n1; |
| 1326 | struct soc_camera_device *icd = client->dev.platform_data; | 1319 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 1327 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | 1320 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
| 1328 | struct soc_camera_link *icl; | ||
| 1329 | struct rj54n1_pdata *rj54n1_priv; | 1321 | struct rj54n1_pdata *rj54n1_priv; |
| 1330 | int ret; | 1322 | int ret; |
| 1331 | 1323 | ||
| 1332 | if (!icd) { | ||
| 1333 | dev_err(&client->dev, "RJ54N1CB0C: missing soc-camera data!\n"); | ||
| 1334 | return -EINVAL; | ||
| 1335 | } | ||
| 1336 | |||
| 1337 | icl = to_soc_camera_link(icd); | ||
| 1338 | if (!icl || !icl->priv) { | 1324 | if (!icl || !icl->priv) { |
| 1339 | dev_err(&client->dev, "RJ54N1CB0C: missing platform data!\n"); | 1325 | dev_err(&client->dev, "RJ54N1CB0C: missing platform data!\n"); |
| 1340 | return -EINVAL; | 1326 | return -EINVAL; |
| @@ -1382,7 +1368,7 @@ static int rj54n1_probe(struct i2c_client *client, | |||
| 1382 | rj54n1->tgclk_mhz = (rj54n1_priv->mclk_freq / PLL_L * PLL_N) / | 1368 | rj54n1->tgclk_mhz = (rj54n1_priv->mclk_freq / PLL_L * PLL_N) / |
| 1383 | (clk_div.ratio_tg + 1) / (clk_div.ratio_t + 1); | 1369 | (clk_div.ratio_tg + 1) / (clk_div.ratio_t + 1); |
| 1384 | 1370 | ||
| 1385 | ret = rj54n1_video_probe(icd, client, rj54n1_priv); | 1371 | ret = rj54n1_video_probe(client, rj54n1_priv); |
| 1386 | if (ret < 0) { | 1372 | if (ret < 0) { |
| 1387 | v4l2_ctrl_handler_free(&rj54n1->hdl); | 1373 | v4l2_ctrl_handler_free(&rj54n1->hdl); |
| 1388 | kfree(rj54n1); | 1374 | kfree(rj54n1); |
| @@ -1394,8 +1380,7 @@ static int rj54n1_probe(struct i2c_client *client, | |||
| 1394 | static int rj54n1_remove(struct i2c_client *client) | 1380 | static int rj54n1_remove(struct i2c_client *client) |
| 1395 | { | 1381 | { |
| 1396 | struct rj54n1 *rj54n1 = to_rj54n1(client); | 1382 | struct rj54n1 *rj54n1 = to_rj54n1(client); |
| 1397 | struct soc_camera_device *icd = client->dev.platform_data; | 1383 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 1398 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 1399 | 1384 | ||
| 1400 | v4l2_device_unregister_subdev(&rj54n1->subdev); | 1385 | v4l2_device_unregister_subdev(&rj54n1->subdev); |
| 1401 | if (icl->free_bus) | 1386 | if (icl->free_bus) |
diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c index 2fddd1fbe529..5a3722b756c7 100644 --- a/drivers/media/video/tw9910.c +++ b/drivers/media/video/tw9910.c | |||
| @@ -764,10 +764,6 @@ static int tw9910_video_probe(struct soc_camera_device *icd, | |||
| 764 | struct tw9910_priv *priv = to_tw9910(client); | 764 | struct tw9910_priv *priv = to_tw9910(client); |
| 765 | s32 id; | 765 | s32 id; |
| 766 | 766 | ||
| 767 | /* We must have a parent by now. And it cannot be a wrong one. */ | ||
| 768 | BUG_ON(!icd->parent || | ||
| 769 | to_soc_camera_host(icd->parent)->nr != icd->iface); | ||
| 770 | |||
| 771 | /* | 767 | /* |
| 772 | * tw9910 only use 8 or 16 bit bus width | 768 | * tw9910 only use 8 or 16 bit bus width |
| 773 | */ | 769 | */ |
| @@ -825,8 +821,7 @@ static int tw9910_g_mbus_config(struct v4l2_subdev *sd, | |||
| 825 | struct v4l2_mbus_config *cfg) | 821 | struct v4l2_mbus_config *cfg) |
| 826 | { | 822 | { |
| 827 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 823 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 828 | struct soc_camera_device *icd = client->dev.platform_data; | 824 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 829 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 830 | 825 | ||
| 831 | cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | | 826 | cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | |
| 832 | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW | | 827 | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_VSYNC_ACTIVE_LOW | |
| @@ -842,8 +837,7 @@ static int tw9910_s_mbus_config(struct v4l2_subdev *sd, | |||
| 842 | const struct v4l2_mbus_config *cfg) | 837 | const struct v4l2_mbus_config *cfg) |
| 843 | { | 838 | { |
| 844 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 839 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 845 | struct soc_camera_device *icd = client->dev.platform_data; | 840 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 846 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
| 847 | u8 val = VSSL_VVALID | HSSL_DVALID; | 841 | u8 val = VSSL_VVALID | HSSL_DVALID; |
| 848 | unsigned long flags = soc_camera_apply_board_flags(icl, cfg); | 842 | unsigned long flags = soc_camera_apply_board_flags(icl, cfg); |
| 849 | 843 | ||
| @@ -887,23 +881,19 @@ static int tw9910_probe(struct i2c_client *client, | |||
| 887 | const struct i2c_device_id *did) | 881 | const struct i2c_device_id *did) |
| 888 | 882 | ||
| 889 | { | 883 | { |
| 890 | struct tw9910_priv *priv; | 884 | struct tw9910_priv *priv; |
| 891 | struct tw9910_video_info *info; | 885 | struct tw9910_video_info *info; |
| 892 | struct soc_camera_device *icd = client->dev.platform_data; | 886 | struct soc_camera_device *icd = client->dev.platform_data; |
| 893 | struct i2c_adapter *adapter = | 887 | struct i2c_adapter *adapter = |
| 894 | to_i2c_adapter(client->dev.parent); | 888 | to_i2c_adapter(client->dev.parent); |
| 895 | struct soc_camera_link *icl; | 889 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
| 896 | int ret; | 890 | int ret; |
| 897 | 891 | ||
| 898 | if (!icd) { | 892 | if (!icl || !icl->priv) { |
| 899 | dev_err(&client->dev, "TW9910: missing soc-camera data!\n"); | 893 | dev_err(&client->dev, "TW9910: missing platform data!\n"); |
| 900 | return -EINVAL; | 894 | return -EINVAL; |
| 901 | } | 895 | } |
| 902 | 896 | ||
| 903 | icl = to_soc_camera_link(icd); | ||
| 904 | if (!icl || !icl->priv) | ||
| 905 | return -EINVAL; | ||
| 906 | |||
| 907 | info = icl->priv; | 897 | info = icl->priv; |
| 908 | 898 | ||
| 909 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { | 899 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { |
| @@ -921,8 +911,6 @@ static int tw9910_probe(struct i2c_client *client, | |||
| 921 | 911 | ||
| 922 | v4l2_i2c_subdev_init(&priv->subdev, client, &tw9910_subdev_ops); | 912 | v4l2_i2c_subdev_init(&priv->subdev, client, &tw9910_subdev_ops); |
| 923 | 913 | ||
| 924 | icd->iface = icl->bus_id; | ||
| 925 | |||
| 926 | ret = tw9910_video_probe(icd, client); | 914 | ret = tw9910_video_probe(icd, client); |
| 927 | if (ret) | 915 | if (ret) |
| 928 | kfree(priv); | 916 | kfree(priv); |
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 6398ff0f08ab..67a52c729eff 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
| @@ -251,18 +251,35 @@ unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl, | |||
| 251 | 251 | ||
| 252 | /* This is only temporary here - until v4l2-subdev begins to link to video_device */ | 252 | /* This is only temporary here - until v4l2-subdev begins to link to video_device */ |
| 253 | #include <linux/i2c.h> | 253 | #include <linux/i2c.h> |
| 254 | static inline struct video_device *soc_camera_i2c_to_vdev(struct i2c_client *client) | 254 | static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client) |
| 255 | { | 255 | { |
| 256 | struct soc_camera_device *icd = client->dev.platform_data; | 256 | struct soc_camera_device *icd = client->dev.platform_data; |
| 257 | return icd->vdev; | 257 | return icd ? icd->vdev : NULL; |
| 258 | } | 258 | } |
| 259 | 259 | ||
| 260 | static inline struct soc_camera_device *soc_camera_from_vb2q(struct vb2_queue *vq) | 260 | static inline struct soc_camera_link *soc_camera_i2c_to_link(const struct i2c_client *client) |
| 261 | { | ||
| 262 | struct soc_camera_device *icd = client->dev.platform_data; | ||
| 263 | return icd ? to_soc_camera_link(icd) : NULL; | ||
| 264 | } | ||
| 265 | |||
| 266 | static inline struct v4l2_subdev *soc_camera_vdev_to_subdev(const struct video_device *vdev) | ||
| 267 | { | ||
| 268 | struct soc_camera_device *icd = dev_get_drvdata(vdev->parent); | ||
| 269 | return soc_camera_to_subdev(icd); | ||
| 270 | } | ||
| 271 | |||
| 272 | static inline struct soc_camera_device *soc_camera_from_i2c(const struct i2c_client *client) | ||
| 273 | { | ||
| 274 | return client->dev.platform_data; | ||
| 275 | } | ||
| 276 | |||
| 277 | static inline struct soc_camera_device *soc_camera_from_vb2q(const struct vb2_queue *vq) | ||
| 261 | { | 278 | { |
| 262 | return container_of(vq, struct soc_camera_device, vb2_vidq); | 279 | return container_of(vq, struct soc_camera_device, vb2_vidq); |
| 263 | } | 280 | } |
| 264 | 281 | ||
| 265 | static inline struct soc_camera_device *soc_camera_from_vbq(struct videobuf_queue *vq) | 282 | static inline struct soc_camera_device *soc_camera_from_vbq(const struct videobuf_queue *vq) |
| 266 | { | 283 | { |
| 267 | return container_of(vq, struct soc_camera_device, vb_vidq); | 284 | return container_of(vq, struct soc_camera_device, vb_vidq); |
| 268 | } | 285 | } |
