diff options
Diffstat (limited to 'drivers/media/video/mt9v022.c')
-rw-r--r-- | drivers/media/video/mt9v022.c | 44 |
1 files changed, 11 insertions, 33 deletions
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 | ||