diff options
author | Paulius Zaleckas <paulius.zaleckas@teltonika.lt> | 2008-07-11 19:50:31 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:25:17 -0400 |
commit | 092d3921195c4553a1818e698cee7a281ab361f4 (patch) | |
tree | dc888fdf713a8b4736b622be9e5b94ec23c76872 /drivers | |
parent | 439d0e4250b6fc9df3fc9183db38cf8a23d4ad93 (diff) |
V4L/DVB (8337): soc_camera: make videobuf independent
Makes SoC camera videobuf independent. Includes all necessary changes for
PXA camera driver (currently the only driver using soc_camera in the mainline).
These changes are important for the future soc_camera based drivers.
Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/Kconfig | 3 | ||||
-rw-r--r-- | drivers/media/video/pxa_camera.c | 14 | ||||
-rw-r--r-- | drivers/media/video/soc_camera.c | 9 |
3 files changed, 17 insertions, 9 deletions
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index a6fbee4d41b7..2103f7bfd48c 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -921,7 +921,7 @@ endif # V4L_USB_DRIVERS | |||
921 | config SOC_CAMERA | 921 | config SOC_CAMERA |
922 | tristate "SoC camera support" | 922 | tristate "SoC camera support" |
923 | depends on VIDEO_V4L2 && HAS_DMA | 923 | depends on VIDEO_V4L2 && HAS_DMA |
924 | select VIDEOBUF_DMA_SG | 924 | select VIDEOBUF_GEN |
925 | help | 925 | help |
926 | SoC Camera is a common API to several cameras, not connecting | 926 | SoC Camera is a common API to several cameras, not connecting |
927 | over a bus like PCI or USB. For example some i2c camera connected | 927 | over a bus like PCI or USB. For example some i2c camera connected |
@@ -960,6 +960,7 @@ config VIDEO_PXA27x | |||
960 | tristate "PXA27x Quick Capture Interface driver" | 960 | tristate "PXA27x Quick Capture Interface driver" |
961 | depends on VIDEO_DEV && PXA27x | 961 | depends on VIDEO_DEV && PXA27x |
962 | select SOC_CAMERA | 962 | select SOC_CAMERA |
963 | select VIDEOBUF_DMA_SG | ||
963 | ---help--- | 964 | ---help--- |
964 | This is a v4l2 driver for the PXA27x Quick Capture Interface | 965 | This is a v4l2 driver for the PXA27x Quick Capture Interface |
965 | 966 | ||
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c index 5ec5bb9a94d2..c3a7d476dc4b 100644 --- a/drivers/media/video/pxa_camera.c +++ b/drivers/media/video/pxa_camera.c | |||
@@ -30,6 +30,7 @@ | |||
30 | 30 | ||
31 | #include <media/v4l2-common.h> | 31 | #include <media/v4l2-common.h> |
32 | #include <media/v4l2-dev.h> | 32 | #include <media/v4l2-dev.h> |
33 | #include <media/videobuf-dma-sg.h> | ||
33 | #include <media/soc_camera.h> | 34 | #include <media/soc_camera.h> |
34 | 35 | ||
35 | #include <linux/videodev2.h> | 36 | #include <linux/videodev2.h> |
@@ -582,6 +583,16 @@ static struct videobuf_queue_ops pxa_videobuf_ops = { | |||
582 | .buf_release = pxa_videobuf_release, | 583 | .buf_release = pxa_videobuf_release, |
583 | }; | 584 | }; |
584 | 585 | ||
586 | static void pxa_camera_init_videobuf(struct videobuf_queue *q, spinlock_t *lock, | ||
587 | struct soc_camera_device *icd) | ||
588 | { | ||
589 | /* We must pass NULL as dev pointer, then all pci_* dma operations | ||
590 | * transform to normal dma_* ones. */ | ||
591 | videobuf_queue_sg_init(q, &pxa_videobuf_ops, NULL, lock, | ||
592 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, | ||
593 | sizeof(struct pxa_buffer), icd); | ||
594 | } | ||
595 | |||
585 | static int mclk_get_divisor(struct pxa_camera_dev *pcdev) | 596 | static int mclk_get_divisor(struct pxa_camera_dev *pcdev) |
586 | { | 597 | { |
587 | unsigned int mclk_10khz = pcdev->platform_mclk_10khz; | 598 | unsigned int mclk_10khz = pcdev->platform_mclk_10khz; |
@@ -998,6 +1009,7 @@ static struct soc_camera_host_ops pxa_soc_camera_host_ops = { | |||
998 | .remove = pxa_camera_remove_device, | 1009 | .remove = pxa_camera_remove_device, |
999 | .set_fmt_cap = pxa_camera_set_fmt_cap, | 1010 | .set_fmt_cap = pxa_camera_set_fmt_cap, |
1000 | .try_fmt_cap = pxa_camera_try_fmt_cap, | 1011 | .try_fmt_cap = pxa_camera_try_fmt_cap, |
1012 | .init_videobuf = pxa_camera_init_videobuf, | ||
1001 | .reqbufs = pxa_camera_reqbufs, | 1013 | .reqbufs = pxa_camera_reqbufs, |
1002 | .poll = pxa_camera_poll, | 1014 | .poll = pxa_camera_poll, |
1003 | .querycap = pxa_camera_querycap, | 1015 | .querycap = pxa_camera_querycap, |
@@ -1009,8 +1021,6 @@ static struct soc_camera_host_ops pxa_soc_camera_host_ops = { | |||
1009 | /* Should be allocated dynamically too, but we have only one. */ | 1021 | /* Should be allocated dynamically too, but we have only one. */ |
1010 | static struct soc_camera_host pxa_soc_camera_host = { | 1022 | static struct soc_camera_host pxa_soc_camera_host = { |
1011 | .drv_name = PXA_CAM_DRV_NAME, | 1023 | .drv_name = PXA_CAM_DRV_NAME, |
1012 | .vbq_ops = &pxa_videobuf_ops, | ||
1013 | .msize = sizeof(struct pxa_buffer), | ||
1014 | .ops = &pxa_soc_camera_host_ops, | 1024 | .ops = &pxa_soc_camera_host_ops, |
1015 | }; | 1025 | }; |
1016 | 1026 | ||
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 8ae2d9916d9f..38a89f133164 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include <media/v4l2-common.h> | 27 | #include <media/v4l2-common.h> |
28 | #include <media/v4l2-dev.h> | 28 | #include <media/v4l2-dev.h> |
29 | #include <media/videobuf-core.h> | ||
29 | #include <media/soc_camera.h> | 30 | #include <media/soc_camera.h> |
30 | 31 | ||
31 | static LIST_HEAD(hosts); | 32 | static LIST_HEAD(hosts); |
@@ -233,11 +234,7 @@ static int soc_camera_open(struct inode *inode, struct file *file) | |||
233 | file->private_data = icf; | 234 | file->private_data = icf; |
234 | dev_dbg(&icd->dev, "camera device open\n"); | 235 | dev_dbg(&icd->dev, "camera device open\n"); |
235 | 236 | ||
236 | /* We must pass NULL as dev pointer, then all pci_* dma operations | 237 | ici->ops->init_videobuf(&icf->vb_vidq, icf->lock, icd); |
237 | * transform to normal dma_* ones. */ | ||
238 | videobuf_queue_sg_init(&icf->vb_vidq, ici->vbq_ops, NULL, icf->lock, | ||
239 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, | ||
240 | ici->msize, icd); | ||
241 | 238 | ||
242 | return 0; | 239 | return 0; |
243 | 240 | ||
@@ -787,7 +784,7 @@ int soc_camera_host_register(struct soc_camera_host *ici) | |||
787 | int ret; | 784 | int ret; |
788 | struct soc_camera_host *ix; | 785 | struct soc_camera_host *ix; |
789 | 786 | ||
790 | if (!ici->vbq_ops || !ici->ops->add || !ici->ops->remove) | 787 | if (!ici->ops->init_videobuf || !ici->ops->add || !ici->ops->remove) |
791 | return -EINVAL; | 788 | return -EINVAL; |
792 | 789 | ||
793 | /* Number might be equal to the platform device ID */ | 790 | /* Number might be equal to the platform device ID */ |