diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2009-08-25 10:28:22 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-18 23:18:27 -0400 |
commit | 40e2e0927003424c25807b575dd40da2b8685857 (patch) | |
tree | 917ca8fd5f7598194d264ec92a08b312d4932b90 /drivers/media/video/pxa_camera.c | |
parent | bc1937b41d8253e2b554da385023a92189d38917 (diff) |
V4L/DVB (12506): soc-camera: convert to platform device
Convert soc-camera core and all drivers to platform device API. We already
converted platforms to register a platform device for each soc-camera client,
now we remove the compatibility code and switch completely to the new scheme.
This is a preparatory step for the v4l2-subdev conversion.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/pxa_camera.c')
-rw-r--r-- | drivers/media/video/pxa_camera.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index 016bb45ba0c3..8b9b44d86837 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c | |||
@@ -830,7 +830,8 @@ static void pxa_camera_init_videobuf(struct videobuf_queue *q, | |||
830 | sizeof(struct pxa_buffer), icd); | 830 | sizeof(struct pxa_buffer), icd); |
831 | } | 831 | } |
832 | 832 | ||
833 | static u32 mclk_get_divisor(struct pxa_camera_dev *pcdev) | 833 | static u32 mclk_get_divisor(struct platform_device *pdev, |
834 | struct pxa_camera_dev *pcdev) | ||
834 | { | 835 | { |
835 | unsigned long mclk = pcdev->mclk; | 836 | unsigned long mclk = pcdev->mclk; |
836 | u32 div; | 837 | u32 div; |
@@ -842,7 +843,7 @@ static u32 mclk_get_divisor(struct pxa_camera_dev *pcdev) | |||
842 | /* mclk <= ciclk / 4 (27.4.2) */ | 843 | /* mclk <= ciclk / 4 (27.4.2) */ |
843 | if (mclk > lcdclk / 4) { | 844 | if (mclk > lcdclk / 4) { |
844 | mclk = lcdclk / 4; | 845 | mclk = lcdclk / 4; |
845 | dev_warn(pcdev->soc_host.dev, "Limiting master clock to %lu\n", mclk); | 846 | dev_warn(&pdev->dev, "Limiting master clock to %lu\n", mclk); |
846 | } | 847 | } |
847 | 848 | ||
848 | /* We verify mclk != 0, so if anyone breaks it, here comes their Oops */ | 849 | /* We verify mclk != 0, so if anyone breaks it, here comes their Oops */ |
@@ -852,8 +853,8 @@ static u32 mclk_get_divisor(struct pxa_camera_dev *pcdev) | |||
852 | if (pcdev->platform_flags & PXA_CAMERA_MCLK_EN) | 853 | if (pcdev->platform_flags & PXA_CAMERA_MCLK_EN) |
853 | pcdev->mclk = lcdclk / (2 * (div + 1)); | 854 | pcdev->mclk = lcdclk / (2 * (div + 1)); |
854 | 855 | ||
855 | dev_dbg(pcdev->soc_host.dev, "LCD clock %luHz, target freq %luHz, " | 856 | dev_dbg(&pdev->dev, "LCD clock %luHz, target freq %luHz, divisor %u\n", |
856 | "divisor %u\n", lcdclk, mclk, div); | 857 | lcdclk, mclk, div); |
857 | 858 | ||
858 | return div; | 859 | return div; |
859 | } | 860 | } |
@@ -958,15 +959,20 @@ static int pxa_camera_add_device(struct soc_camera_device *icd) | |||
958 | goto ebusy; | 959 | goto ebusy; |
959 | } | 960 | } |
960 | 961 | ||
961 | dev_info(&icd->dev, "PXA Camera driver attached to camera %d\n", | ||
962 | icd->devnum); | ||
963 | |||
964 | pxa_camera_activate(pcdev); | 962 | pxa_camera_activate(pcdev); |
965 | ret = icd->ops->init(icd); | 963 | ret = icd->ops->init(icd); |
964 | if (ret < 0) | ||
965 | goto einit; | ||
966 | |||
967 | pcdev->icd = icd; | ||
966 | 968 | ||
967 | if (!ret) | 969 | dev_info(&icd->dev, "PXA Camera driver attached to camera %d\n", |
968 | pcdev->icd = icd; | 970 | icd->devnum); |
969 | 971 | ||
972 | return 0; | ||
973 | |||
974 | einit: | ||
975 | pxa_camera_deactivate(pcdev); | ||
970 | ebusy: | 976 | ebusy: |
971 | return ret; | 977 | return ret; |
972 | } | 978 | } |
@@ -1575,8 +1581,7 @@ static int __devinit pxa_camera_probe(struct platform_device *pdev) | |||
1575 | pcdev->mclk = 20000000; | 1581 | pcdev->mclk = 20000000; |
1576 | } | 1582 | } |
1577 | 1583 | ||
1578 | pcdev->soc_host.dev = &pdev->dev; | 1584 | pcdev->mclk_divisor = mclk_get_divisor(pdev, pcdev); |
1579 | pcdev->mclk_divisor = mclk_get_divisor(pcdev); | ||
1580 | 1585 | ||
1581 | INIT_LIST_HEAD(&pcdev->capture); | 1586 | INIT_LIST_HEAD(&pcdev->capture); |
1582 | spin_lock_init(&pcdev->lock); | 1587 | spin_lock_init(&pcdev->lock); |
@@ -1641,6 +1646,7 @@ static int __devinit pxa_camera_probe(struct platform_device *pdev) | |||
1641 | pcdev->soc_host.drv_name = PXA_CAM_DRV_NAME; | 1646 | pcdev->soc_host.drv_name = PXA_CAM_DRV_NAME; |
1642 | pcdev->soc_host.ops = &pxa_soc_camera_host_ops; | 1647 | pcdev->soc_host.ops = &pxa_soc_camera_host_ops; |
1643 | pcdev->soc_host.priv = pcdev; | 1648 | pcdev->soc_host.priv = pcdev; |
1649 | pcdev->soc_host.dev = &pdev->dev; | ||
1644 | pcdev->soc_host.nr = pdev->id; | 1650 | pcdev->soc_host.nr = pdev->id; |
1645 | 1651 | ||
1646 | err = soc_camera_host_register(&pcdev->soc_host); | 1652 | err = soc_camera_host_register(&pcdev->soc_host); |
@@ -1722,3 +1728,4 @@ module_exit(pxa_camera_exit); | |||
1722 | MODULE_DESCRIPTION("PXA27x SoC Camera Host driver"); | 1728 | MODULE_DESCRIPTION("PXA27x SoC Camera Host driver"); |
1723 | MODULE_AUTHOR("Guennadi Liakhovetski <kernel@pengutronix.de>"); | 1729 | MODULE_AUTHOR("Guennadi Liakhovetski <kernel@pengutronix.de>"); |
1724 | MODULE_LICENSE("GPL"); | 1730 | MODULE_LICENSE("GPL"); |
1731 | MODULE_ALIAS("platform:" PXA_CAM_DRV_NAME); | ||