From b2409b65d9401f7e3c572fc59db6a920fc7a163e Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Oct 2012 07:29:17 -0300 Subject: [media] remove include/linux/dvb/dmx.h The only reason for this header is to make sure that include linux/time.h were added before uapi/*/dmx.h. Just push down the time.h header on the few places where this is used, and drop this new header. Signed-off-by: Mauro Carvalho Chehab --- include/linux/dvb/dmx.h | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 include/linux/dvb/dmx.h (limited to 'include') diff --git a/include/linux/dvb/dmx.h b/include/linux/dvb/dmx.h deleted file mode 100644 index 0be6d8f2b52b..000000000000 --- a/include/linux/dvb/dmx.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * dmx.h - * - * Copyright (C) 2000 Marcus Metzler - * & Ralph Metzler - * for convergence integrated media GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - */ -#ifndef _DVBDMX_H_ -#define _DVBDMX_H_ - -#include -#include - -#endif /*_DVBDMX_H_*/ -- cgit v1.2.3 From 74df06daf632ce2d321d01cb046004768352efc4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 19 Oct 2012 07:41:50 -0300 Subject: [media] Remove include/linux/dvb/ stuff The only file left there is include/linux/dvb/video.h. The only function for it is to include linux/compiler.h, but this is already indirectly included. So, get rid of it. Signed-off-by: Mauro Carvalho Chehab --- include/linux/dvb/Kbuild | 0 include/linux/dvb/video.h | 29 ----------------------------- 2 files changed, 29 deletions(-) delete mode 100644 include/linux/dvb/Kbuild delete mode 100644 include/linux/dvb/video.h (limited to 'include') diff --git a/include/linux/dvb/Kbuild b/include/linux/dvb/Kbuild deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h deleted file mode 100644 index 85c20d925696..000000000000 --- a/include/linux/dvb/video.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * video.h - * - * Copyright (C) 2000 Marcus Metzler - * & Ralph Metzler - * for convergence integrated media GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - */ -#ifndef _DVBVIDEO_H_ -#define _DVBVIDEO_H_ - -#include -#include - -#endif /*_DVBVIDEO_H_*/ -- cgit v1.2.3 From c003ab1bedf028db15b0185b683d5c387204e8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20H=C3=A4rdeman?= Date: Thu, 11 Oct 2012 19:11:54 -0300 Subject: [media] rc-core: add separate defines for protocol bitmaps and numbers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The RC_TYPE_* defines are currently used both where a single protocol is expected and where a bitmap of protocols is expected. Functions like rc_keydown() and functions which add/remove entries to the keytable want a single protocol. Future userspace APIs would also benefit from numeric protocols (rather than bitmap ones). Keytables are smaller if they can use a small(ish) integer rather than a bitmap. Other functions or struct members (e.g. allowed_protos, enabled_protocols, etc) accept multiple protocols and need a bitmap. Using different types reduces the risk of programmer error. Using a protocol enum whereever possible also makes for a more future-proof user-space API as we don't need to worry about a sufficient number of bits being available (e.g. in structs used for ioctl() calls). The use of both a number and a corresponding bit is dalso one in e.g. the input subsystem as well (see all the references to set/clear bit when changing keytables for example). This patch separate the different usages in preparation for upcoming patches. Where a single protocol is expected, enum rc_type is used; where one or more protocol(s) are expected, something like u64 is used. The patch has been rewritten so that the format of the sysfs "protocols" file is no longer altered (at the loss of some detail). The file itself should probably be deprecated in the future though. Signed-off-by: David Härdeman Cc: Andy Walls Cc: Maxim Levitsky Cc: Antti Palosaari Cc: Mike Isely Signed-off-by: Mauro Carvalho Chehab --- include/media/ir-kbd-i2c.h | 2 +- include/media/rc-core.h | 4 +-- include/media/rc-map.h | 64 ++++++++++++++++++++++++++++++++++------------ 3 files changed, 51 insertions(+), 19 deletions(-) (limited to 'include') 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 { struct IR_i2c_init_data { char *ir_codes; const char *name; - u64 type; /* RC_TYPE_RC5, etc */ + u64 type; /* RC_BIT_RC5, etc */ u32 polling_interval; /* 0 means DEFAULT_POLLING_INTERVAL */ /* 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 { * @input_dev: the input child device used to communicate events to userspace * @driver_type: specifies if protocol decoding is done in hardware or software * @idle: used to keep track of RX state - * @allowed_protos: bitmask with the supported RC_TYPE_* protocols + * @allowed_protos: bitmask with the supported RC_BIT_* protocols * @scanmask: some hardware decoders are not capable of providing the full * scancode to the application. As this is a hardware limit, we can't do * anything with it. Yet, as the same keycode table can be used with other @@ -113,7 +113,7 @@ struct rc_dev { u32 max_timeout; u32 rx_resolution; u32 tx_resolution; - int (*change_protocol)(struct rc_dev *dev, u64 rc_type); + int (*change_protocol)(struct rc_dev *dev, u64 *rc_type); int (*open)(struct rc_dev *dev); void (*close)(struct rc_dev *dev); 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 @@ #include -#define RC_TYPE_UNKNOWN 0 -#define RC_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ -#define RC_TYPE_NEC (1 << 1) -#define RC_TYPE_RC6 (1 << 2) /* Philips RC6 protocol */ -#define RC_TYPE_JVC (1 << 3) /* JVC protocol */ -#define RC_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */ -#define RC_TYPE_RC5_SZ (1 << 5) /* RC5 variant used by Streamzap */ -#define RC_TYPE_SANYO (1 << 6) /* Sanyo protocol */ -#define RC_TYPE_MCE_KBD (1 << 29) /* RC6-ish MCE keyboard/mouse */ -#define RC_TYPE_LIRC (1 << 30) /* Pass raw IR to lirc userspace */ -#define RC_TYPE_OTHER (1u << 31) +enum rc_type { + RC_TYPE_UNKNOWN = 0, /* Protocol not known */ + RC_TYPE_OTHER = 1, /* Protocol known but proprietary */ + RC_TYPE_LIRC = 2, /* Pass raw IR to lirc userspace */ + RC_TYPE_RC5 = 3, /* Philips RC5 protocol */ + RC_TYPE_RC5X = 4, /* Philips RC5x protocol */ + RC_TYPE_RC5_SZ = 5, /* StreamZap variant of RC5 */ + RC_TYPE_JVC = 6, /* JVC protocol */ + RC_TYPE_SONY12 = 7, /* Sony 12 bit protocol */ + RC_TYPE_SONY15 = 8, /* Sony 15 bit protocol */ + RC_TYPE_SONY20 = 9, /* Sony 20 bit protocol */ + RC_TYPE_NEC = 10, /* NEC protocol */ + RC_TYPE_SANYO = 11, /* Sanyo protocol */ + RC_TYPE_MCE_KBD = 12, /* RC6-ish MCE keyboard/mouse */ + RC_TYPE_RC6_0 = 13, /* Philips RC6-0-16 protocol */ + RC_TYPE_RC6_6A_20 = 14, /* Philips RC6-6A-20 protocol */ + RC_TYPE_RC6_6A_24 = 15, /* Philips RC6-6A-24 protocol */ + RC_TYPE_RC6_6A_32 = 16, /* Philips RC6-6A-32 protocol */ + RC_TYPE_RC6_MCE = 17, /* MCE (Philips RC6-6A-32 subtype) protocol */ +}; + +#define RC_BIT_NONE 0 +#define RC_BIT_UNKNOWN (1 << RC_TYPE_UNKNOWN) +#define RC_BIT_OTHER (1 << RC_TYPE_OTHER) +#define RC_BIT_LIRC (1 << RC_TYPE_LIRC) +#define RC_BIT_RC5 (1 << RC_TYPE_RC5) +#define RC_BIT_RC5X (1 << RC_TYPE_RC5X) +#define RC_BIT_RC5_SZ (1 << RC_TYPE_RC5_SZ) +#define RC_BIT_JVC (1 << RC_TYPE_JVC) +#define RC_BIT_SONY12 (1 << RC_TYPE_SONY12) +#define RC_BIT_SONY15 (1 << RC_TYPE_SONY15) +#define RC_BIT_SONY20 (1 << RC_TYPE_SONY20) +#define RC_BIT_NEC (1 << RC_TYPE_NEC) +#define RC_BIT_SANYO (1 << RC_TYPE_SANYO) +#define RC_BIT_MCE_KBD (1 << RC_TYPE_MCE_KBD) +#define RC_BIT_RC6_0 (1 << RC_TYPE_RC6_0) +#define RC_BIT_RC6_6A_20 (1 << RC_TYPE_RC6_6A_20) +#define RC_BIT_RC6_6A_24 (1 << RC_TYPE_RC6_6A_24) +#define RC_BIT_RC6_6A_32 (1 << RC_TYPE_RC6_6A_32) +#define RC_BIT_RC6_MCE (1 << RC_TYPE_RC6_MCE) -#define RC_TYPE_ALL (RC_TYPE_RC5 | RC_TYPE_NEC | RC_TYPE_RC6 | \ - RC_TYPE_JVC | RC_TYPE_SONY | RC_TYPE_LIRC | \ - RC_TYPE_RC5_SZ | RC_TYPE_SANYO | RC_TYPE_MCE_KBD | \ - RC_TYPE_OTHER) +#define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | RC_BIT_LIRC | \ + RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \ + RC_BIT_JVC | \ + RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \ + RC_BIT_NEC | RC_BIT_SANYO | RC_BIT_MCE_KBD | \ + RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \ + RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE) struct rc_map_table { u32 scancode; @@ -38,7 +70,7 @@ struct rc_map { unsigned int size; /* Max number of entries */ unsigned int len; /* Used number of entries */ unsigned int alloc; /* Size of *scan in bytes */ - u64 rc_type; + enum rc_type rc_type; const char *name; spinlock_t lock; }; -- cgit v1.2.3 From 2e74598d7f4c6d1b34da84037d9a7f8b1c8e04ae Mon Sep 17 00:00:00 2001 From: Kirill Smelkov Date: Mon, 22 Oct 2012 14:14:01 -0300 Subject: [media] v4l2: Fix typo in struct v4l2_captureparm description Judging from what drivers do and from my experience temeperframe fraction is set in seconds - look e.g. here static int bttv_g_parm(struct file *file, void *f, struct v4l2_streamparm *parm) { struct bttv_fh *fh = f; struct bttv *btv = fh->btv; v4l2_video_std_frame_period(bttv_tvnorms[btv->tvnorm].v4l2_id, &parm->parm.capture.timeperframe); ... void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod) { if (id & V4L2_STD_525_60) { frameperiod->numerator = 1001; frameperiod->denominator = 30000; } else { frameperiod->numerator = 1; frameperiod->denominator = 25; } and also v4l2-ctl in userspace decodes this as seconds: if (doioctl(fd, VIDIOC_G_PARM, &parm, "VIDIOC_G_PARM") == 0) { const struct v4l2_fract &tf = parm.parm.capture.timeperframe; ... printf("\tFrames per second: %.3f (%d/%d)\n", (1.0 * tf.denominator) / tf.numerator, tf.denominator, tf.numerator); The typo was there from day 1 - added in 2002 in e028b61b ([PATCH] add v4l2 api)(*) (*) found in history tree git://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git Signed-off-by: Kirill Smelkov Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/uapi/linux/videodev2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 57bfa59cda74..2fff7ff3e05b 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -737,7 +737,7 @@ struct v4l2_window { struct v4l2_captureparm { __u32 capability; /* Supported modes */ __u32 capturemode; /* Current mode */ - struct v4l2_fract timeperframe; /* Time per frame in .1us units */ + struct v4l2_fract timeperframe; /* Time per frame in seconds */ __u32 extendedmode; /* Driver-specific extensions */ __u32 readbuffers; /* # of buffers for read */ __u32 reserved[4]; -- cgit v1.2.3 From 8c5dff905714446f8836b40a93bfeabd0aea8c82 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Sun, 28 Oct 2012 06:44:17 -0300 Subject: [media] v4l, smiapp, smiapp-pll, adp1653: Update contact information Update contact information to correspond my e-mail address changes. Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- include/media/adp1653.h | 4 ++-- include/media/smiapp.h | 2 +- include/media/v4l2-event.h | 2 +- include/media/v4l2-fh.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'include') 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 @@ * * Copyright (C) 2008--2011 Nokia Corporation * - * Contact: Sakari Ailus + * Contact: Sakari Ailus * * Contributors: - * Sakari Ailus + * Sakari Ailus * Tuukka Toivonen * * This program is free software; you can redistribute it and/or 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 @@ * Generic driver for SMIA/SMIA++ compliant camera modules * * Copyright (C) 2011--2012 Nokia Corporation - * Contact: Sakari Ailus + * Contact: Sakari Ailus * * This program is free software; you can redistribute it and/or * 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 @@ * * Copyright (C) 2009--2010 Nokia Corporation. * - * Contact: Sakari Ailus + * Contact: Sakari Ailus * * This program is free software; you can redistribute it and/or * 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 @@ * * Copyright (C) 2009--2010 Nokia Corporation. * - * Contact: Sakari Ailus + * Contact: Sakari Ailus * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License -- cgit v1.2.3 From baa29837a76d5738837602ff249a0c371591d7c7 Mon Sep 17 00:00:00 2001 From: "Lad, Prabhakar" Date: Fri, 9 Nov 2012 05:59:32 -0300 Subject: [media] media: davinci: vpbe: fix build warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Warnings were generated because of the following commit changed data type for address pointer 195bbca ARM: 7500/1: io: avoid writeback addressing modes for __raw_ accessors add __iomem annotation to fix following warnings drivers/media/platform/davinci/vpbe_osd.c: In function ‘osd_read’: drivers/media/platform/davinci/vpbe_osd.c:49:2: warning: passing argument 1 of ‘__raw_readl’ makes pointer from integer without a cast [enabled by default] arch/arm/include/asm/io.h:104:19: note: expected ‘const volatile void *’ but argument is of type ‘long unsigned int’ This patch stores the ioremap_nocache() returned address in a void __iomem * instead of a unsigned long and passes the same to readl/writel functions which fixes the above warnings. Signed-off-by: Lad, Prabhakar Signed-off-by: Manjunath Hadli Acked-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- include/media/davinci/vpbe_osd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') 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 { spinlock_t lock; struct device *dev; dma_addr_t osd_base_phys; - unsigned long osd_base; + void __iomem *osd_base; unsigned long osd_size; /* 1-->the isr will toggle the VID0 ping-pong buffer */ int pingpong; -- cgit v1.2.3 From 13fc23d3067e996c03d8b602266f47d27d205d36 Mon Sep 17 00:00:00 2001 From: "Lad, Prabhakar" Date: Mon, 22 Oct 2012 09:27:13 -0300 Subject: [media] media: davinci: vpbe: migrate driver to videobuf2 This patch migrates VPBE display driver to videobuf2 framework. Signed-off-by: Lad, Prabhakar Signed-off-by: Manjunath Hadli Signed-off-by: Mauro Carvalho Chehab --- include/media/davinci/vpbe_display.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'include') 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 @@ /* Header files */ #include #include -#include +#include #include #include #include @@ -62,6 +62,11 @@ struct display_layer_info { enum osd_v_exp_ratio v_exp; }; +struct vpbe_disp_buffer { + struct vb2_buffer vb; + struct list_head list; +}; + /* vpbe display object structure */ struct vpbe_layer { /* number of buffers in fbuffers */ @@ -69,13 +74,15 @@ struct vpbe_layer { /* Pointer to the vpbe_display */ struct vpbe_display *disp_dev; /* Pointer pointing to current v4l2_buffer */ - struct videobuf_buffer *cur_frm; + struct vpbe_disp_buffer *cur_frm; /* Pointer pointing to next v4l2_buffer */ - struct videobuf_buffer *next_frm; + struct vpbe_disp_buffer *next_frm; /* videobuf specific parameters * Buffer queue used in video-buf */ - struct videobuf_queue buffer_queue; + struct vb2_queue buffer_queue; + /* allocator-specific contexts for each plane */ + struct vb2_alloc_ctx *alloc_ctx; /* Queue of filled frames */ struct list_head dma_queue; /* Used in video-buf */ -- cgit v1.2.3 From b6f50b49b9712f49c377e9e3587906e27bea39d0 Mon Sep 17 00:00:00 2001 From: Anatolij Gustschin Date: Thu, 27 Sep 2012 19:05:27 -0300 Subject: [media] mt9v022: set y_skip_top field to zero as default Set "y_skip_top" to zero and revise comment as I do not see this line corruption on two different mt9v022 setups. The first read-out line is perfectly fine. Add mt9v022 platform data configuring y_skip_top for platforms that have issues with the first read-out line. Set y_skip_top to 1 for pcm990 board. Signed-off-by: Anatolij Gustschin Acked-by: Eric Miao Signed-off-by: Guennadi Liakhovetski Signed-off-by: Mauro Carvalho Chehab --- include/media/mt9v022.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 include/media/mt9v022.h (limited to 'include') 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 @@ +/* + * mt9v022 sensor + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __MT9V022_H__ +#define __MT9V022_H__ + +struct mt9v022_platform_data { + unsigned short y_skip_top; /* Lines to skip at the top */ +}; + +#endif -- cgit v1.2.3 From 051c7788bcb92f2e98ef86e86651e0420765b121 Mon Sep 17 00:00:00 2001 From: Sumit Semwal Date: Thu, 14 Jun 2012 10:37:35 -0300 Subject: [media] v4l: Add DMABUF as a memory type Adds DMABUF memory type to v4l framework. Also adds the related file descriptor in v4l2_plane and v4l2_buffer. [original work in the PoC for buffer sharing] Signed-off-by: Tomasz Stanislawski Signed-off-by: Sumit Semwal Signed-off-by: Sumit Semwal Acked-by: Laurent Pinchart Acked-by: Hans Verkuil Tested-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- include/uapi/linux/videodev2.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 2fff7ff3e05b..91ac83b21c20 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -186,6 +186,7 @@ enum v4l2_memory { V4L2_MEMORY_MMAP = 1, V4L2_MEMORY_USERPTR = 2, V4L2_MEMORY_OVERLAY = 3, + V4L2_MEMORY_DMABUF = 4, }; /* see also http://vektor.theorem.ca/graphics/ycbcr/ */ @@ -602,6 +603,8 @@ struct v4l2_requestbuffers { * should be passed to mmap() called on the video node) * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer * pointing to this plane + * @fd: when memory is V4L2_MEMORY_DMABUF, a userspace file + * descriptor associated with this plane * @data_offset: offset in the plane to the start of data; usually 0, * unless there is a header in front of the data * @@ -616,6 +619,7 @@ struct v4l2_plane { union { __u32 mem_offset; unsigned long userptr; + __s32 fd; } m; __u32 data_offset; __u32 reserved[11]; @@ -640,6 +644,8 @@ struct v4l2_plane { * (or a "cookie" that should be passed to mmap() as offset) * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR; * a userspace pointer pointing to this buffer + * @fd: for non-multiplanar buffers with memory == V4L2_MEMORY_DMABUF; + * a userspace file descriptor associated with this buffer * @planes: for multiplanar buffers; userspace pointer to the array of plane * info structs for this buffer * @length: size in bytes of the buffer (NOT its payload) for single-plane @@ -666,6 +672,7 @@ struct v4l2_buffer { __u32 offset; unsigned long userptr; struct v4l2_plane *planes; + __s32 fd; } m; __u32 length; __u32 reserved2; -- cgit v1.2.3 From c538404869b69db543ce23cf041192c192a65330 Mon Sep 17 00:00:00 2001 From: Sumit Semwal Date: Thu, 14 Jun 2012 10:37:37 -0300 Subject: [media] v4l: vb2: add support for shared buffer (dma_buf) This patch adds support for DMABUF memory type in videobuf2. It calls relevant APIs of dma_buf for v4l reqbuf / qbuf / dqbuf operations. For this version, the support is for videobuf2 as a user of the shared buffer; so the allocation of the buffer is done outside of V4L2. [A sample allocator of dma-buf shared buffer is given at [1]] [1]: Rob Clark's DRM: https://github.com/robclark/kernel-omap4/commits/drmplane-dmabuf [original work in the PoC for buffer sharing] Signed-off-by: Tomasz Stanislawski Signed-off-by: Sumit Semwal Signed-off-by: Sumit Semwal Acked-by: Laurent Pinchart Acked-by: Hans Verkuil Tested-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- include/media/videobuf2-core.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'include') diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index e04252a9fea6..689ae4ac2572 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -16,6 +16,7 @@ #include #include #include +#include struct vb2_alloc_ctx; struct vb2_fileio_data; @@ -41,6 +42,20 @@ struct vb2_fileio_data; * argument to other ops in this structure * @put_userptr: inform the allocator that a USERPTR buffer will no longer * be used + * @attach_dmabuf: attach a shared struct dma_buf for a hardware operation; + * used for DMABUF memory types; alloc_ctx is the alloc context + * dbuf is the shared dma_buf; returns NULL on failure; + * allocator private per-buffer structure on success; + * this needs to be used for further accesses to the buffer + * @detach_dmabuf: inform the exporter of the buffer that the current DMABUF + * buffer is no longer used; the buf_priv argument is the + * allocator private per-buffer structure previously returned + * from the attach_dmabuf callback + * @map_dmabuf: request for access to the dmabuf from allocator; the allocator + * of dmabuf is informed that this driver is going to use the + * dmabuf + * @unmap_dmabuf: releases access control to the dmabuf - allocator is notified + * that this driver is done using the dmabuf for now * @vaddr: return a kernel virtual address to a given memory buffer * associated with the passed private structure or NULL if no * such mapping exists @@ -56,6 +71,8 @@ struct vb2_fileio_data; * Required ops for USERPTR types: get_userptr, put_userptr. * Required ops for MMAP types: alloc, put, num_users, mmap. * Required ops for read/write access types: alloc, put, num_users, vaddr + * Required ops for DMABUF types: attach_dmabuf, detach_dmabuf, map_dmabuf, + * unmap_dmabuf. */ struct vb2_mem_ops { void *(*alloc)(void *alloc_ctx, unsigned long size); @@ -65,6 +82,12 @@ struct vb2_mem_ops { unsigned long size, int write); void (*put_userptr)(void *buf_priv); + void *(*attach_dmabuf)(void *alloc_ctx, struct dma_buf *dbuf, + unsigned long size, int write); + void (*detach_dmabuf)(void *buf_priv); + int (*map_dmabuf)(void *buf_priv); + void (*unmap_dmabuf)(void *buf_priv); + void *(*vaddr)(void *buf_priv); void *(*cookie)(void *buf_priv); @@ -75,6 +98,8 @@ struct vb2_mem_ops { struct vb2_plane { void *mem_priv; + struct dma_buf *dbuf; + unsigned int dbuf_mapped; }; /** @@ -83,12 +108,14 @@ struct vb2_plane { * @VB2_USERPTR: driver supports USERPTR with streaming API * @VB2_READ: driver supports read() style access * @VB2_WRITE: driver supports write() style access + * @VB2_DMABUF: driver supports DMABUF with streaming API */ enum vb2_io_modes { VB2_MMAP = (1 << 0), VB2_USERPTR = (1 << 1), VB2_READ = (1 << 2), VB2_WRITE = (1 << 3), + VB2_DMABUF = (1 << 4), }; /** -- cgit v1.2.3 From 3e0c2f2046665bf580273b69ab18d9c76a550e34 Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Thu, 14 Jun 2012 10:37:43 -0300 Subject: [media] v4l: vb2: add prepare/finish callbacks to allocators This patch adds support for prepare/finish callbacks in VB2 allocators. These callback are used for buffer flushing. Signed-off-by: Marek Szyprowski Acked-by: Laurent Pinchart Acked-by: Hans Verkuil Tested-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- include/media/videobuf2-core.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 689ae4ac2572..24b9c90194f2 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -56,6 +56,10 @@ struct vb2_fileio_data; * dmabuf * @unmap_dmabuf: releases access control to the dmabuf - allocator is notified * that this driver is done using the dmabuf for now + * @prepare: called every time the buffer is passed from userspace to the + * driver, useful for cache synchronisation, optional + * @finish: called every time the buffer is passed back from the driver + * to the userspace, also optional * @vaddr: return a kernel virtual address to a given memory buffer * associated with the passed private structure or NULL if no * such mapping exists @@ -82,6 +86,9 @@ struct vb2_mem_ops { unsigned long size, int write); void (*put_userptr)(void *buf_priv); + void (*prepare)(void *buf_priv); + void (*finish)(void *buf_priv); + void *(*attach_dmabuf)(void *alloc_ctx, struct dma_buf *dbuf, unsigned long size, int write); void (*detach_dmabuf)(void *buf_priv); -- cgit v1.2.3 From c60520fa50cd86d64bc8ebb34300ddc4ca91393d Mon Sep 17 00:00:00 2001 From: Marek Szyprowski Date: Thu, 14 Jun 2012 11:32:21 -0300 Subject: [media] v4l: vb2-dma-contig: let mmap method to use dma_mmap_coherent call Let mmap method to use dma_mmap_coherent call. Moreover, this patch removes vb2_mmap_pfn_range from videobuf2 helpers as it was suggested by Laurent Pinchart. The function is no longer used in vb2 code. Signed-off-by: Marek Szyprowski Signed-off-by: Tomasz Stanislawski Acked-by: Laurent Pinchart Acked-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/videobuf2-memops.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include') 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; int vb2_get_contig_userptr(unsigned long vaddr, unsigned long size, struct vm_area_struct **res_vma, dma_addr_t *res_pa); -int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr, - unsigned long size, - const struct vm_operations_struct *vm_ops, - void *priv); - struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma); void vb2_put_vma(struct vm_area_struct *vma); -- cgit v1.2.3 From b799d09a157da71566e8013a62073435550cab6d Mon Sep 17 00:00:00 2001 From: Tomasz Stanislawski Date: Thu, 14 Jun 2012 11:32:23 -0300 Subject: [media] v4l: add buffer exporting via dmabuf This patch adds extension to V4L2 api. A new ioctl VIDIOC_EXPBUF is added. The ioctl is used to export an mmap buffer as a DMABUF file descriptor. Signed-off-by: Tomasz Stanislawski Signed-off-by: Kyungmin Park Acked-by: Hans Verkuil Tested-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-ioctl.h | 2 ++ include/uapi/linux/videodev2.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'include') 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 { int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b); int (*vidioc_querybuf)(struct file *file, void *fh, struct v4l2_buffer *b); int (*vidioc_qbuf) (struct file *file, void *fh, struct v4l2_buffer *b); + int (*vidioc_expbuf) (struct file *file, void *fh, + struct v4l2_exportbuffer *e); int (*vidioc_dqbuf) (struct file *file, void *fh, struct v4l2_buffer *b); int (*vidioc_create_bufs)(struct file *file, void *fh, struct v4l2_create_buffers *b); diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 91ac83b21c20..3cf3e946e331 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -694,6 +694,33 @@ struct v4l2_buffer { #define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800 #define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000 +/** + * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor + * + * @index: id number of the buffer + * @type: enum v4l2_buf_type; buffer type (type == *_MPLANE for + * multiplanar buffers); + * @plane: index of the plane to be exported, 0 for single plane queues + * @flags: flags for newly created file, currently only O_CLOEXEC is + * supported, refer to manual of open syscall for more details + * @fd: file descriptor associated with DMABUF (set by driver) + * + * Contains data used for exporting a video buffer as DMABUF file descriptor. + * The buffer is identified by a 'cookie' returned by VIDIOC_QUERYBUF + * (identical to the cookie used to mmap() the buffer to userspace). All + * reserved fields must be set to zero. The field reserved0 is expected to + * become a structure 'type' allowing an alternative layout of the structure + * content. Therefore this field should not be used for any other extensions. + */ +struct v4l2_exportbuffer { + __u32 type; /* enum v4l2_buf_type */ + __u32 index; + __u32 plane; + __u32 flags; + __s32 fd; + __u32 reserved[11]; +}; + /* * O V E R L A Y P R E V I E W */ @@ -1895,6 +1922,7 @@ struct v4l2_create_buffers { #define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer) #define VIDIOC_OVERLAY _IOW('V', 14, int) #define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer) +#define VIDIOC_EXPBUF _IOWR('V', 16, struct v4l2_exportbuffer) #define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer) #define VIDIOC_STREAMON _IOW('V', 18, int) #define VIDIOC_STREAMOFF _IOW('V', 19, int) -- cgit v1.2.3 From 83ae7c5a1b5b5cd4380ff70797e4c5dcfb61a70d Mon Sep 17 00:00:00 2001 From: Tomasz Stanislawski Date: Thu, 14 Jun 2012 11:32:24 -0300 Subject: [media] v4l: vb2: add buffer exporting via dmabuf This patch adds extension to videobuf2-core. It allow to export an mmap buffer as a DMABUF file descriptor. Signed-off-by: Tomasz Stanislawski Signed-off-by: Kyungmin Park Acked-by: Laurent Pinchart Acked-by: Hans Verkuil Tested-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- include/media/v4l2-mem2mem.h | 3 +++ include/media/videobuf2-core.h | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'include') 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, int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, struct v4l2_buffer *buf); +int v4l2_m2m_expbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, + struct v4l2_exportbuffer *eb); + int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, enum v4l2_buf_type type); int 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 24b9c90194f2..9cfd4ee9e56f 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -81,6 +81,7 @@ struct vb2_fileio_data; struct vb2_mem_ops { void *(*alloc)(void *alloc_ctx, unsigned long size); void (*put)(void *buf_priv); + struct dma_buf *(*get_dmabuf)(void *buf_priv); void *(*get_userptr)(void *alloc_ctx, unsigned long vaddr, unsigned long size, int write); @@ -363,6 +364,7 @@ int __must_check vb2_queue_init(struct vb2_queue *q); void vb2_queue_release(struct vb2_queue *q); int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b); +int vb2_expbuf(struct vb2_queue *q, struct v4l2_exportbuffer *eb); int vb2_dqbuf(struct vb2_queue *q, struct v4l2_buffer *b, bool nonblocking); int vb2_streamon(struct vb2_queue *q, enum v4l2_buf_type type); @@ -472,6 +474,8 @@ int vb2_ioctl_qbuf(struct file *file, void *priv, struct v4l2_buffer *p); int vb2_ioctl_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p); int vb2_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type i); int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i); +int vb2_ioctl_expbuf(struct file *file, void *priv, + struct v4l2_exportbuffer *p); /* struct v4l2_file_operations helpers */ -- cgit v1.2.3 From babde1c243b25592038dd7193867a49729e3d505 Mon Sep 17 00:00:00 2001 From: Sylwester Nawrocki Date: Wed, 22 Aug 2012 20:09:18 -0300 Subject: [media] V4L: Add driver for S3C24XX/S3C64XX SoC series camera interface This patch adds V4L2 driver for Samsung S3C24XX/S3C64XX SoC series camera interface. The driver exposes a subdev device node for CAMIF pixel resolution and crop control and two video capture nodes - for the "codec" and "preview" data paths. It has been tested on Mini2440 (s3c2440) and Mini6410 (s3c6410) board with gstreamer and mplayer. Signed-off-by: Sylwester Nawrocki Signed-off-by: Tomasz Figa Signed-off-by: Andrey Gusakov Signed-off-by: Mauro Carvalho Chehab --- include/media/s3c_camif.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 include/media/s3c_camif.h (limited to 'include') 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 @@ +/* + * s3c24xx/s3c64xx SoC series Camera Interface (CAMIF) driver + * + * Copyright (C) 2012 Sylwester Nawrocki + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#ifndef MEDIA_S3C_CAMIF_ +#define MEDIA_S3C_CAMIF_ + +#include +#include + +/** + * struct s3c_camif_sensor_info - an image sensor description + * @i2c_board_info: pointer to an I2C sensor subdevice board info + * @clock_frequency: frequency of the clock the host provides to a sensor + * @mbus_type: media bus type + * @i2c_bus_num: i2c control bus id the sensor is attached to + * @flags: the parallel bus flags defining signals polarity (V4L2_MBUS_*) + * @use_field: 1 if parallel bus FIELD signal is used (only s3c64xx) + */ +struct s3c_camif_sensor_info { + struct i2c_board_info i2c_board_info; + unsigned long clock_frequency; + enum v4l2_mbus_type mbus_type; + u16 i2c_bus_num; + u16 flags; + u8 use_field; +}; + +struct s3c_camif_plat_data { + struct s3c_camif_sensor_info sensor; + int (*gpio_get)(void); + int (*gpio_put)(void); +}; + +/* Platform default helper functions */ +int s3c_camif_gpio_get(void); +int s3c_camif_gpio_put(void); + +#endif /* MEDIA_S3C_CAMIF_ */ -- cgit v1.2.3