aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/Kconfig3
-rw-r--r--drivers/media/video/pxa_camera.c14
-rw-r--r--drivers/media/video/soc_camera.c9
-rw-r--r--include/media/soc_camera.h6
4 files changed, 20 insertions, 12 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
921config SOC_CAMERA 921config 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
586static 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
585static int mclk_get_divisor(struct pxa_camera_dev *pcdev) 596static 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. */
1010static struct soc_camera_host pxa_soc_camera_host = { 1022static 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
31static LIST_HEAD(hosts); 32static 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 */
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h
index 6a8c8be7a1ae..b204c0dee956 100644
--- a/include/media/soc_camera.h
+++ b/include/media/soc_camera.h
@@ -13,7 +13,7 @@
13#define SOC_CAMERA_H 13#define SOC_CAMERA_H
14 14
15#include <linux/videodev2.h> 15#include <linux/videodev2.h>
16#include <media/videobuf-dma-sg.h> 16#include <media/videobuf-core.h>
17 17
18struct soc_camera_device { 18struct soc_camera_device {
19 struct list_head list; 19 struct list_head list;
@@ -55,8 +55,6 @@ struct soc_camera_host {
55 struct list_head list; 55 struct list_head list;
56 struct device dev; 56 struct device dev;
57 unsigned char nr; /* Host number */ 57 unsigned char nr; /* Host number */
58 size_t msize;
59 struct videobuf_queue_ops *vbq_ops;
60 void *priv; 58 void *priv;
61 char *drv_name; 59 char *drv_name;
62 struct soc_camera_host_ops *ops; 60 struct soc_camera_host_ops *ops;
@@ -69,6 +67,8 @@ struct soc_camera_host_ops {
69 int (*set_fmt_cap)(struct soc_camera_device *, __u32, 67 int (*set_fmt_cap)(struct soc_camera_device *, __u32,
70 struct v4l2_rect *); 68 struct v4l2_rect *);
71 int (*try_fmt_cap)(struct soc_camera_device *, struct v4l2_format *); 69 int (*try_fmt_cap)(struct soc_camera_device *, struct v4l2_format *);
70 void (*init_videobuf)(struct videobuf_queue*, spinlock_t *,
71 struct soc_camera_device *);
72 int (*reqbufs)(struct soc_camera_file *, struct v4l2_requestbuffers *); 72 int (*reqbufs)(struct soc_camera_file *, struct v4l2_requestbuffers *);
73 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *); 73 int (*querycap)(struct soc_camera_host *, struct v4l2_capability *);
74 int (*try_bus_param)(struct soc_camera_device *, __u32); 74 int (*try_bus_param)(struct soc_camera_device *, __u32);