aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 22:22:22 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 22:22:22 -0500
commitd8c532c40721f7507896d202b8cae3b3642d2b0d (patch)
tree42b1ce76671eb85324281ed93491432f4523f983 /include/media
parente777d192ffb9f2929d547a2f8a5f65b7db7a9552 (diff)
parent77c53d0b56264a8fc5844e087ad15fffe20c299d (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab: - Missing MAINTAINERS entries were added for several drivers - Adds V4L2 support for DMABUF handling, allowing zero-copy buffer sharing between V4L2 devices and GPU - Got rid of all warnings when compiling with W=1 on x86 - Add a new driver for Exynos hardware (s3c-camif) - Several bug fixes, cleanups and driver improvements * 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (243 commits) [media] omap3isp: Replace cpu_is_omap3630() with ISP revision check [media] omap3isp: Prepare/unprepare clocks before/after enable/disable [media] omap3isp: preview: Add support for 8-bit formats at the sink pad [media] omap3isp: Replace printk with dev_* [media] omap3isp: Find source pad from external entity [media] omap3isp: Configure CSI-2 phy based on platform data [media] omap3isp: Add PHY routing configuration [media] omap3isp: Add CSI configuration registers from control block to ISP resources [media] omap3isp: Remove unneeded module memory address definitions [media] omap3isp: Use monotonic timestamps for statistics buffers [media] uvcvideo: Fix control value clamping for unsigned integer controls [media] uvcvideo: Mark first output terminal as default video node [media] uvcvideo: Add VIDIOC_[GS]_PRIORITY support [media] uvcvideo: Return -ENOTTY for unsupported ioctls [media] uvcvideo: Set device_caps in VIDIOC_QUERYCAP [media] uvcvideo: Don't fail when an unsupported format is requested [media] uvcvideo: Return -EACCES when trying to access a read/write-only control [media] uvcvideo: Set error_idx properly for extended controls API failures [media] rtl28xxu: add NOXON DAB/DAB+ USB dongle rev 2 [media] fc2580: write some registers conditionally ...
Diffstat (limited to 'include/media')
-rw-r--r--include/media/adp1653.h4
-rw-r--r--include/media/davinci/vpbe_display.h15
-rw-r--r--include/media/davinci/vpbe_osd.h2
-rw-r--r--include/media/ir-kbd-i2c.h2
-rw-r--r--include/media/mt9v022.h16
-rw-r--r--include/media/rc-core.h4
-rw-r--r--include/media/rc-map.h64
-rw-r--r--include/media/s3c_camif.h45
-rw-r--r--include/media/smiapp.h2
-rw-r--r--include/media/v4l2-event.h2
-rw-r--r--include/media/v4l2-fh.h2
-rw-r--r--include/media/v4l2-ioctl.h2
-rw-r--r--include/media/v4l2-mem2mem.h3
-rw-r--r--include/media/videobuf2-core.h38
-rw-r--r--include/media/videobuf2-memops.h5
15 files changed, 172 insertions, 34 deletions
diff --git a/include/media/adp1653.h b/include/media/adp1653.h
index 50a1af88aed0..1d9b48a3bd80 100644
--- a/include/media/adp1653.h
+++ b/include/media/adp1653.h
@@ -3,10 +3,10 @@
3 * 3 *
4 * Copyright (C) 2008--2011 Nokia Corporation 4 * Copyright (C) 2008--2011 Nokia Corporation
5 * 5 *
6 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> 6 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
7 * 7 *
8 * Contributors: 8 * Contributors:
9 * Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> 9 * Sakari Ailus <sakari.ailus@iki.fi>
10 * Tuukka Toivonen <tuukkat76@gmail.com> 10 * Tuukka Toivonen <tuukkat76@gmail.com>
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
diff --git a/include/media/davinci/vpbe_display.h b/include/media/davinci/vpbe_display.h
index dbf6b37682cd..8dffffedbb59 100644
--- a/include/media/davinci/vpbe_display.h
+++ b/include/media/davinci/vpbe_display.h
@@ -16,7 +16,7 @@
16/* Header files */ 16/* Header files */
17#include <linux/videodev2.h> 17#include <linux/videodev2.h>
18#include <media/v4l2-common.h> 18#include <media/v4l2-common.h>
19#include <media/videobuf-dma-contig.h> 19#include <media/videobuf2-dma-contig.h>
20#include <media/davinci/vpbe_types.h> 20#include <media/davinci/vpbe_types.h>
21#include <media/davinci/vpbe_osd.h> 21#include <media/davinci/vpbe_osd.h>
22#include <media/davinci/vpbe.h> 22#include <media/davinci/vpbe.h>
@@ -62,6 +62,11 @@ struct display_layer_info {
62 enum osd_v_exp_ratio v_exp; 62 enum osd_v_exp_ratio v_exp;
63}; 63};
64 64
65struct vpbe_disp_buffer {
66 struct vb2_buffer vb;
67 struct list_head list;
68};
69
65/* vpbe display object structure */ 70/* vpbe display object structure */
66struct vpbe_layer { 71struct vpbe_layer {
67 /* number of buffers in fbuffers */ 72 /* number of buffers in fbuffers */
@@ -69,13 +74,15 @@ struct vpbe_layer {
69 /* Pointer to the vpbe_display */ 74 /* Pointer to the vpbe_display */
70 struct vpbe_display *disp_dev; 75 struct vpbe_display *disp_dev;
71 /* Pointer pointing to current v4l2_buffer */ 76 /* Pointer pointing to current v4l2_buffer */
72 struct videobuf_buffer *cur_frm; 77 struct vpbe_disp_buffer *cur_frm;
73 /* Pointer pointing to next v4l2_buffer */ 78 /* Pointer pointing to next v4l2_buffer */
74 struct videobuf_buffer *next_frm; 79 struct vpbe_disp_buffer *next_frm;
75 /* videobuf specific parameters 80 /* videobuf specific parameters
76 * Buffer queue used in video-buf 81 * Buffer queue used in video-buf
77 */ 82 */
78 struct videobuf_queue buffer_queue; 83 struct vb2_queue buffer_queue;
84 /* allocator-specific contexts for each plane */
85 struct vb2_alloc_ctx *alloc_ctx;
79 /* Queue of filled frames */ 86 /* Queue of filled frames */
80 struct list_head dma_queue; 87 struct list_head dma_queue;
81 /* Used in video-buf */ 88 /* Used in video-buf */
diff --git a/include/media/davinci/vpbe_osd.h b/include/media/davinci/vpbe_osd.h
index d7e397a444e6..5ab0d8d41f68 100644
--- a/include/media/davinci/vpbe_osd.h
+++ b/include/media/davinci/vpbe_osd.h
@@ -357,7 +357,7 @@ struct osd_state {
357 spinlock_t lock; 357 spinlock_t lock;
358 struct device *dev; 358 struct device *dev;
359 dma_addr_t osd_base_phys; 359 dma_addr_t osd_base_phys;
360 unsigned long osd_base; 360 void __iomem *osd_base;
361 unsigned long osd_size; 361 unsigned long osd_size;
362 /* 1-->the isr will toggle the VID0 ping-pong buffer */ 362 /* 1-->the isr will toggle the VID0 ping-pong buffer */
363 int pingpong; 363 int pingpong;
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 768aa77925cd..e221bc74020b 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -37,7 +37,7 @@ enum ir_kbd_get_key_fn {
37struct IR_i2c_init_data { 37struct IR_i2c_init_data {
38 char *ir_codes; 38 char *ir_codes;
39 const char *name; 39 const char *name;
40 u64 type; /* RC_TYPE_RC5, etc */ 40 u64 type; /* RC_BIT_RC5, etc */
41 u32 polling_interval; /* 0 means DEFAULT_POLLING_INTERVAL */ 41 u32 polling_interval; /* 0 means DEFAULT_POLLING_INTERVAL */
42 42
43 /* 43 /*
diff --git a/include/media/mt9v022.h b/include/media/mt9v022.h
new file mode 100644
index 000000000000..40561801321a
--- /dev/null
+++ b/include/media/mt9v022.h
@@ -0,0 +1,16 @@
1/*
2 * mt9v022 sensor
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __MT9V022_H__
10#define __MT9V022_H__
11
12struct mt9v022_platform_data {
13 unsigned short y_skip_top; /* Lines to skip at the top */
14};
15
16#endif
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index b0c494a69079..f03445f3c767 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -50,7 +50,7 @@ enum rc_driver_type {
50 * @input_dev: the input child device used to communicate events to userspace 50 * @input_dev: the input child device used to communicate events to userspace
51 * @driver_type: specifies if protocol decoding is done in hardware or software 51 * @driver_type: specifies if protocol decoding is done in hardware or software
52 * @idle: used to keep track of RX state 52 * @idle: used to keep track of RX state
53 * @allowed_protos: bitmask with the supported RC_TYPE_* protocols 53 * @allowed_protos: bitmask with the supported RC_BIT_* protocols
54 * @scanmask: some hardware decoders are not capable of providing the full 54 * @scanmask: some hardware decoders are not capable of providing the full
55 * scancode to the application. As this is a hardware limit, we can't do 55 * scancode to the application. As this is a hardware limit, we can't do
56 * anything with it. Yet, as the same keycode table can be used with other 56 * anything with it. Yet, as the same keycode table can be used with other
@@ -113,7 +113,7 @@ struct rc_dev {
113 u32 max_timeout; 113 u32 max_timeout;
114 u32 rx_resolution; 114 u32 rx_resolution;
115 u32 tx_resolution; 115 u32 tx_resolution;
116 int (*change_protocol)(struct rc_dev *dev, u64 rc_type); 116 int (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
117 int (*open)(struct rc_dev *dev); 117 int (*open)(struct rc_dev *dev);
118 void (*close)(struct rc_dev *dev); 118 void (*close)(struct rc_dev *dev);
119 int (*s_tx_mask)(struct rc_dev *dev, u32 mask); 119 int (*s_tx_mask)(struct rc_dev *dev, u32 mask);
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index cfd5163ff7f3..74f55a3f14eb 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -11,22 +11,54 @@
11 11
12#include <linux/input.h> 12#include <linux/input.h>
13 13
14#define RC_TYPE_UNKNOWN 0 14enum rc_type {
15#define RC_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ 15 RC_TYPE_UNKNOWN = 0, /* Protocol not known */
16#define RC_TYPE_NEC (1 << 1) 16 RC_TYPE_OTHER = 1, /* Protocol known but proprietary */
17#define RC_TYPE_RC6 (1 << 2) /* Philips RC6 protocol */ 17 RC_TYPE_LIRC = 2, /* Pass raw IR to lirc userspace */
18#define RC_TYPE_JVC (1 << 3) /* JVC protocol */ 18 RC_TYPE_RC5 = 3, /* Philips RC5 protocol */
19#define RC_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */ 19 RC_TYPE_RC5X = 4, /* Philips RC5x protocol */
20#define RC_TYPE_RC5_SZ (1 << 5) /* RC5 variant used by Streamzap */ 20 RC_TYPE_RC5_SZ = 5, /* StreamZap variant of RC5 */
21#define RC_TYPE_SANYO (1 << 6) /* Sanyo protocol */ 21 RC_TYPE_JVC = 6, /* JVC protocol */
22#define RC_TYPE_MCE_KBD (1 << 29) /* RC6-ish MCE keyboard/mouse */ 22 RC_TYPE_SONY12 = 7, /* Sony 12 bit protocol */
23#define RC_TYPE_LIRC (1 << 30) /* Pass raw IR to lirc userspace */ 23 RC_TYPE_SONY15 = 8, /* Sony 15 bit protocol */
24#define RC_TYPE_OTHER (1u << 31) 24 RC_TYPE_SONY20 = 9, /* Sony 20 bit protocol */
25 RC_TYPE_NEC = 10, /* NEC protocol */
26 RC_TYPE_SANYO = 11, /* Sanyo protocol */
27 RC_TYPE_MCE_KBD = 12, /* RC6-ish MCE keyboard/mouse */
28 RC_TYPE_RC6_0 = 13, /* Philips RC6-0-16 protocol */
29 RC_TYPE_RC6_6A_20 = 14, /* Philips RC6-6A-20 protocol */
30 RC_TYPE_RC6_6A_24 = 15, /* Philips RC6-6A-24 protocol */
31 RC_TYPE_RC6_6A_32 = 16, /* Philips RC6-6A-32 protocol */
32 RC_TYPE_RC6_MCE = 17, /* MCE (Philips RC6-6A-32 subtype) protocol */
33};
34
35#define RC_BIT_NONE 0
36#define RC_BIT_UNKNOWN (1 << RC_TYPE_UNKNOWN)
37#define RC_BIT_OTHER (1 << RC_TYPE_OTHER)
38#define RC_BIT_LIRC (1 << RC_TYPE_LIRC)
39#define RC_BIT_RC5 (1 << RC_TYPE_RC5)
40#define RC_BIT_RC5X (1 << RC_TYPE_RC5X)
41#define RC_BIT_RC5_SZ (1 << RC_TYPE_RC5_SZ)
42#define RC_BIT_JVC (1 << RC_TYPE_JVC)
43#define RC_BIT_SONY12 (1 << RC_TYPE_SONY12)
44#define RC_BIT_SONY15 (1 << RC_TYPE_SONY15)
45#define RC_BIT_SONY20 (1 << RC_TYPE_SONY20)
46#define RC_BIT_NEC (1 << RC_TYPE_NEC)
47#define RC_BIT_SANYO (1 << RC_TYPE_SANYO)
48#define RC_BIT_MCE_KBD (1 << RC_TYPE_MCE_KBD)
49#define RC_BIT_RC6_0 (1 << RC_TYPE_RC6_0)
50#define RC_BIT_RC6_6A_20 (1 << RC_TYPE_RC6_6A_20)
51#define RC_BIT_RC6_6A_24 (1 << RC_TYPE_RC6_6A_24)
52#define RC_BIT_RC6_6A_32 (1 << RC_TYPE_RC6_6A_32)
53#define RC_BIT_RC6_MCE (1 << RC_TYPE_RC6_MCE)
25 54
26#define RC_TYPE_ALL (RC_TYPE_RC5 | RC_TYPE_NEC | RC_TYPE_RC6 | \ 55#define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | RC_BIT_LIRC | \
27 RC_TYPE_JVC | RC_TYPE_SONY | RC_TYPE_LIRC | \ 56 RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \
28 RC_TYPE_RC5_SZ | RC_TYPE_SANYO | RC_TYPE_MCE_KBD | \ 57 RC_BIT_JVC | \
29 RC_TYPE_OTHER) 58 RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \
59 RC_BIT_NEC | RC_BIT_SANYO | RC_BIT_MCE_KBD | \
60 RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \
61 RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE)
30 62
31struct rc_map_table { 63struct rc_map_table {
32 u32 scancode; 64 u32 scancode;
@@ -38,7 +70,7 @@ struct rc_map {
38 unsigned int size; /* Max number of entries */ 70 unsigned int size; /* Max number of entries */
39 unsigned int len; /* Used number of entries */ 71 unsigned int len; /* Used number of entries */
40 unsigned int alloc; /* Size of *scan in bytes */ 72 unsigned int alloc; /* Size of *scan in bytes */
41 u64 rc_type; 73 enum rc_type rc_type;
42 const char *name; 74 const char *name;
43 spinlock_t lock; 75 spinlock_t lock;
44}; 76};
diff --git a/include/media/s3c_camif.h b/include/media/s3c_camif.h
new file mode 100644
index 000000000000..df96c2c789b4
--- /dev/null
+++ b/include/media/s3c_camif.h
@@ -0,0 +1,45 @@
1/*
2 * s3c24xx/s3c64xx SoC series Camera Interface (CAMIF) driver
3 *
4 * Copyright (C) 2012 Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#ifndef MEDIA_S3C_CAMIF_
12#define MEDIA_S3C_CAMIF_
13
14#include <linux/i2c.h>
15#include <media/v4l2-mediabus.h>
16
17/**
18 * struct s3c_camif_sensor_info - an image sensor description
19 * @i2c_board_info: pointer to an I2C sensor subdevice board info
20 * @clock_frequency: frequency of the clock the host provides to a sensor
21 * @mbus_type: media bus type
22 * @i2c_bus_num: i2c control bus id the sensor is attached to
23 * @flags: the parallel bus flags defining signals polarity (V4L2_MBUS_*)
24 * @use_field: 1 if parallel bus FIELD signal is used (only s3c64xx)
25 */
26struct s3c_camif_sensor_info {
27 struct i2c_board_info i2c_board_info;
28 unsigned long clock_frequency;
29 enum v4l2_mbus_type mbus_type;
30 u16 i2c_bus_num;
31 u16 flags;
32 u8 use_field;
33};
34
35struct s3c_camif_plat_data {
36 struct s3c_camif_sensor_info sensor;
37 int (*gpio_get)(void);
38 int (*gpio_put)(void);
39};
40
41/* Platform default helper functions */
42int s3c_camif_gpio_get(void);
43int s3c_camif_gpio_put(void);
44
45#endif /* MEDIA_S3C_CAMIF_ */
diff --git a/include/media/smiapp.h b/include/media/smiapp.h
index 9ab07fd45d5c..07f96a89e189 100644
--- a/include/media/smiapp.h
+++ b/include/media/smiapp.h
@@ -4,7 +4,7 @@
4 * Generic driver for SMIA/SMIA++ compliant camera modules 4 * Generic driver for SMIA/SMIA++ compliant camera modules
5 * 5 *
6 * Copyright (C) 2011--2012 Nokia Corporation 6 * Copyright (C) 2011--2012 Nokia Corporation
7 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> 7 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
8 * 8 *
9 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License 10 * modify it under the terms of the GNU General Public License
diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h
index e7c5d170a9cd..eff85f934b24 100644
--- a/include/media/v4l2-event.h
+++ b/include/media/v4l2-event.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * Copyright (C) 2009--2010 Nokia Corporation. 6 * Copyright (C) 2009--2010 Nokia Corporation.
7 * 7 *
8 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> 8 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
9 * 9 *
10 * This program is free software; you can redistribute it and/or 10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License 11 * modify it under the terms of the GNU General Public License
diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
index 52513c225c18..a62ee18cb7b7 100644
--- a/include/media/v4l2-fh.h
+++ b/include/media/v4l2-fh.h
@@ -6,7 +6,7 @@
6 * 6 *
7 * Copyright (C) 2009--2010 Nokia Corporation. 7 * Copyright (C) 2009--2010 Nokia Corporation.
8 * 8 *
9 * Contact: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com> 9 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
10 * 10 *
11 * This program is free software; you can redistribute it and/or 11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License 12 * modify it under the terms of the GNU General Public License
diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
index e48b571ca37d..4118ad1324c9 100644
--- a/include/media/v4l2-ioctl.h
+++ b/include/media/v4l2-ioctl.h
@@ -111,6 +111,8 @@ struct v4l2_ioctl_ops {
111 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b); 111 int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b);
112 int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b); 112 int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b);
113 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b); 113 int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
114 int (*vidioc_expbuf) (struct file *file, void *fh,
115 struct v4l2_exportbuffer *e);
114 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b); 116 int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b);
115 117
116 int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b); 118 int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b);
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
index 131cc4a53675..7e82d2b193d5 100644
--- a/include/media/v4l2-mem2mem.h
+++ b/include/media/v4l2-mem2mem.h
@@ -111,6 +111,9 @@ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
111int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, 111int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
112 struct v4l2_buffer *buf); 112 struct v4l2_buffer *buf);
113 113
114int v4l2_m2m_expbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
115 struct v4l2_exportbuffer *eb);
116
114int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, 117int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
115 enum v4l2_buf_type type); 118 enum v4l2_buf_type type);
116int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, 119int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
index e04252a9fea6..9cfd4ee9e56f 100644
--- a/include/media/videobuf2-core.h
+++ b/include/media/videobuf2-core.h
@@ -16,6 +16,7 @@
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/poll.h> 17#include <linux/poll.h>
18#include <linux/videodev2.h> 18#include <linux/videodev2.h>
19#include <linux/dma-buf.h>
19 20
20struct vb2_alloc_ctx; 21struct vb2_alloc_ctx;
21struct vb2_fileio_data; 22struct vb2_fileio_data;
@@ -41,6 +42,24 @@ struct vb2_fileio_data;
41 * argument to other ops in this structure 42 * argument to other ops in this structure
42 * @put_userptr: inform the allocator that a USERPTR buffer will no longer 43 * @put_userptr: inform the allocator that a USERPTR buffer will no longer
43 * be used 44 * be used
45 * @attach_dmabuf: attach a shared struct dma_buf for a hardware operation;
46 * used for DMABUF memory types; alloc_ctx is the alloc context
47 * dbuf is the shared dma_buf; returns NULL on failure;
48 * allocator private per-buffer structure on success;
49 * this needs to be used for further accesses to the buffer
50 * @detach_dmabuf: inform the exporter of the buffer that the current DMABUF
51 * buffer is no longer used; the buf_priv argument is the
52 * allocator private per-buffer structure previously returned
53 * from the attach_dmabuf callback
54 * @map_dmabuf: request for access to the dmabuf from allocator; the allocator
55 * of dmabuf is informed that this driver is going to use the
56 * dmabuf
57 * @unmap_dmabuf: releases access control to the dmabuf - allocator is notified
58 * that this driver is done using the dmabuf for now
59 * @prepare: called every time the buffer is passed from userspace to the
60 * driver, useful for cache synchronisation, optional
61 * @finish: called every time the buffer is passed back from the driver
62 * to the userspace, also optional
44 * @vaddr: return a kernel virtual address to a given memory buffer 63 * @vaddr: return a kernel virtual address to a given memory buffer
45 * associated with the passed private structure or NULL if no 64 * associated with the passed private structure or NULL if no
46 * such mapping exists 65 * such mapping exists
@@ -56,15 +75,27 @@ struct vb2_fileio_data;
56 * Required ops for USERPTR types: get_userptr, put_userptr. 75 * Required ops for USERPTR types: get_userptr, put_userptr.
57 * Required ops for MMAP types: alloc, put, num_users, mmap. 76 * Required ops for MMAP types: alloc, put, num_users, mmap.
58 * Required ops for read/write access types: alloc, put, num_users, vaddr 77 * Required ops for read/write access types: alloc, put, num_users, vaddr
78 * Required ops for DMABUF types: attach_dmabuf, detach_dmabuf, map_dmabuf,
79 * unmap_dmabuf.
59 */ 80 */
60struct vb2_mem_ops { 81struct vb2_mem_ops {
61 void *(*alloc)(void *alloc_ctx, unsigned long size); 82 void *(*alloc)(void *alloc_ctx, unsigned long size);
62 void (*put)(void *buf_priv); 83 void (*put)(void *buf_priv);
84 struct dma_buf *(*get_dmabuf)(void *buf_priv);
63 85
64 void *(*get_userptr)(void *alloc_ctx, unsigned long vaddr, 86 void *(*get_userptr)(void *alloc_ctx, unsigned long vaddr,
65 unsigned long size, int write); 87 unsigned long size, int write);
66 void (*put_userptr)(void *buf_priv); 88 void (*put_userptr)(void *buf_priv);
67 89
90 void (*prepare)(void *buf_priv);
91 void (*finish)(void *buf_priv);
92
93 void *(*attach_dmabuf)(void *alloc_ctx, struct dma_buf *dbuf,
94 unsigned long size, int write);
95 void (*detach_dmabuf)(void *buf_priv);
96 int (*map_dmabuf)(void *buf_priv);
97 void (*unmap_dmabuf)(void *buf_priv);
98
68 void *(*vaddr)(void *buf_priv); 99 void *(*vaddr)(void *buf_priv);
69 void *(*cookie)(void *buf_priv); 100 void *(*cookie)(void *buf_priv);
70 101
@@ -75,6 +106,8 @@ struct vb2_mem_ops {
75 106
76struct vb2_plane { 107struct vb2_plane {
77 void *mem_priv; 108 void *mem_priv;
109 struct dma_buf *dbuf;
110 unsigned int dbuf_mapped;
78}; 111};
79 112
80/** 113/**
@@ -83,12 +116,14 @@ struct vb2_plane {
83 * @VB2_USERPTR: driver supports USERPTR with streaming API 116 * @VB2_USERPTR: driver supports USERPTR with streaming API
84 * @VB2_READ: driver supports read() style access 117 * @VB2_READ: driver supports read() style access
85 * @VB2_WRITE: driver supports write() style access 118 * @VB2_WRITE: driver supports write() style access
119 * @VB2_DMABUF: driver supports DMABUF with streaming API
86 */ 120 */
87enum vb2_io_modes { 121enum vb2_io_modes {
88 VB2_MMAP = (1 << 0), 122 VB2_MMAP = (1 << 0),
89 VB2_USERPTR = (1 << 1), 123 VB2_USERPTR = (1 << 1),
90 VB2_READ = (1 << 2), 124 VB2_READ = (1 << 2),
91 VB2_WRITE = (1 << 3), 125 VB2_WRITE = (1 << 3),
126 VB2_DMABUF = (1 << 4),
92}; 127};
93 128
94/** 129/**
@@ -329,6 +364,7 @@ int __must_check vb2_queue_init(struct vb2_queue *q);
329void vb2_queue_release(struct vb2_queue *q); 364void vb2_queue_release(struct vb2_queue *q);
330 365
331int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b); 366int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b);
367int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb);
332int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking); 368int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking);
333 369
334int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type); 370int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type);
@@ -438,6 +474,8 @@ int vb2_ioctl_qbuf(struct file *file, void *priv, struct v4l2_buffer *p);
438int vb2_ioctl_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p); 474int vb2_ioctl_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p);
439int vb2_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type i); 475int vb2_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type i);
440int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i); 476int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i);
477int vb2_ioctl_expbuf(struct file *file, void *priv,
478 struct v4l2_exportbuffer *p);
441 479
442/* struct v4l2_file_operations helpers */ 480/* struct v4l2_file_operations helpers */
443 481
diff --git a/include/media/videobuf2-memops.h b/include/media/videobuf2-memops.h
index 84e1f6c031c5..f05444ca8c0c 100644
--- a/include/media/videobuf2-memops.h
+++ b/include/media/videobuf2-memops.h
@@ -33,11 +33,6 @@ extern const struct vm_operations_struct vb2_common_vm_ops;
33int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size, 33int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size,
34 struct vm_area_struct **res_vma, dma_addr_t *res_pa); 34 struct vm_area_struct **res_vma, dma_addr_t *res_pa);
35 35
36int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr,
37 unsigned long size,
38 const struct vm_operations_struct *vm_ops,
39 void *priv);
40
41struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma); 36struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma);
42void vb2_put_vma(struct vm_area_struct *vma); 37void vb2_put_vma(struct vm_area_struct *vma);
43 38