Re: ir-kbd-i2c.c: Multiple events from single keypress

2010-11-24 Thread Pavel Hofman
Pavel Hofman napsal(a):
 Hi,
 
 The remote Control coming with Hauppauge HVR1110 (module ir-kbd-i2c, the
 gray model hauppauge=1) produces multiple events from single even short
 key presses on archlinux, kernel 2.6.35.
 
 The variable old in struct IR_i2c:
 
 /* Used to avoid fast repeating */
 unsigned char  old;
 
 does not seem to be used anywhere in the code.
 
 Please is there a way to solve this problem in the driver, or is it
 necessary to handle the superfluous multiple events in lircd? The former
  would let us use the simple inputlircd :-)
 
 If it is possible/feasible, please let me know what debuging information
 to provide.
 
 Thanks a lot in advance,
 
 Pavel Hofman.

My fault, http://www.lirc.org/faq.html explains the multiple events. It
would not make sense to build suppress_repeat functionality into the
kernel-space driver. In the end, lirc was simple to setup.

Sorry for the un-researched enquiry.

Pavel.


--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 7/7] v4l: videobuf2: add CMA allocator

2010-11-24 Thread Sewoon Park
Hi~
Simply comments below

Marek Szyprowski Saturday, November 20, 2010 12:56 AM Wrote:

snip
 +/*
 + * videobuf2-cma.h - CMA memory allocator for videobuf2
 + *
 + * Copyright (C) 2010 Samsung Electronics
 + *
 + * Author: Pawel Osciak p.osc...@samsung.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation.
 + */
 +
 +static inline unsigned long vb2_cma_plane_paddr(struct vb2_buffer *vb,
 + unsigned int plane_no)
 +{
 + return (unsigned long)vb2_plane_cookie(vb, plane_no);

vb2_plane_cookie() function is in the videobuf2-core.
So, this header file should include media/videobuf2-core.h

 +}
 +
 +struct vb2_alloc_ctx *vb2_cma_init(struct device *dev, const char *type,
 + unsigned long alignment);
 +void vb2_cma_cleanup(struct vb2_alloc_ctx *alloc_ctx);
 +
 +struct vb2_alloc_ctx **vb2_cma_init_multi(struct device *dev,
 +   unsigned int num_planes, const char *types[],
 +   unsigned long alignments[]);
 +void vb2_cma_cleanup_multi(struct vb2_alloc_ctx **alloc_ctxes);
 +
 +struct vb2_alloc_ctx *vb2_cma_init(struct device *dev, const char *type,
 + unsigned long alignment);
 +void vb2_cma_cleanup(struct vb2_alloc_ctx *alloc_ctx);
 +
 --
 1.7.1.569.g6f426
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-media in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] media: fix casting issues in timberdale logiwin

2010-11-24 Thread Richard Röjfors
On 11/23/2010 09:39 PM, Jarod Wilson wrote:
 I get warnings about casting to and from pointers and integers of
 different sizes w/current code, this silences them.
 
 Signed-off-by: Jarod Wilson ja...@redhat.com

Looks good, and works.

Acked-by: Richard Röjfors richard.rojf...@pelagicore.com

 ---
  drivers/media/video/timblogiw.c |6 --
  1 files changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/video/timblogiw.c b/drivers/media/video/timblogiw.c
 index 48989e5..4da3625 100644
 --- a/drivers/media/video/timblogiw.c
 +++ b/drivers/media/video/timblogiw.c
 @@ -148,7 +148,9 @@ static void timblogiw_dma_cb(void *data)
  
  static bool timblogiw_dma_filter_fn(struct dma_chan *chan, void 
 *filter_param)
  {
 - return chan-chan_id == (int)filter_param;
 + int chan_id = *(int *)filter_param;
 +
 + return chan-chan_id == chan_id;
  }
  
  /* IOCTL functions */
 @@ -670,7 +672,7 @@ static int timblogiw_open(struct file *file)
  
   /* find the DMA channel */
   fh-chan = dma_request_channel(mask, timblogiw_dma_filter_fn,
 - (void *)lw-pdata.dma_channel);
 + (void *)(unsigned long)lw-pdata.dma_channel);
   if (!fh-chan) {
   dev_err(vdev-dev, Failed to get DMA channel\n);
   kfree(fh);


-- 
=
Richard Röjfors
Software Architect
Pelagicore AB
Ekelundsgatan 4, 6tr, SE-411 18 Gothenburg, Sweden
Mobile: +46 (0)708 88 97 91
E-Mail: richard.rojf...@pelagicore.com
=

=== NOTE ===
The information contained in this E-mail message is
intended only for use of the individual or entity
named above. If the reader of this message  is not
the intended recipient, or the employee or agent
responsible to deliver it to the intended recipient,
you are hereby notified that any dissemination,
distribution or copying of this communication is
strictly prohibited.
=
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Just compile cx23885

2010-11-24 Thread Josu Lazkano
Hello everybody!

I have a Tevii S470 DVB-S2 tuner. I configure it this way:

mkdir /usr/local/src/dvb
cd /usr/local/src/dvb
wget http://tevii.com/100315_Beta_linux_tevii_ds3000.rar
unrar x 100315_Beta_linux_tevii_ds3000.rar
cp dvb-fe-ds3000.fw /lib/firmware/
tar xjvf linux-tevii-ds3000.tar.bz2
cd linux-tevii-ds3000
make  make install

When I execute make it compile lots of drivers/modules, I just need
the cx23885 one.

Is possible to compile just this driver/module?
Is this the correct way to get working my tuner?

When I configure this way (all the drivers/modules) it works well, but
I want to get just the modules I really need.

Thanks for all your help and best regards.

-- 
Josu Lazkano
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-dvb] dvbstream fails to tune QAM-256

2010-11-24 Thread Nico Sabbi

David Liontooth ha scritto:

On 11/19/2010 11:51 PM, David Liontooth wrote:


I'm using Debian's dvbstream 0.6+cvs20090621-1 to capture video and 
closed captioning to file.


If I tune with azap, dvbstream works fine, but I can't get it to tune 
on its own.


In the Debian source code, I activated DVB_ATSC by adding -DDVB_ATSC 
to CFLAGS in the Makefile.


dvbstream -f 64500 -qam 256 -v 49 a 52 -o  test.ts

gives me the error Unknown FE type.

Suggestions? Is this a problem with an API that has changed since 
dvbstream's last release?


If I change tune.h to allow DVB API =3 major instead of just ==3, I 
get this (this is a very lightly patched version to allow 8 cards):


# dvbstream -f 621000 -qam 256 -v 8192 -a 8192 -s 6875 -n 10 -o:test.ts
dvbstream v0.7.01 - (C) Dave Chapman 2001-2004
Released under the GPL.
Latest version available from http://dvbtools.sourceforge.net
Open file test.ts
Tuning to 621000 MHz
Using DVB card Samsung S5H1411 QAM/8VSB Frontend, freq=621000
tuning ATSC to 62100, modulation=5
Getting frontend status
Event:  Frequency: 62100
Modulation: 5
Bit error rate: 0
Signal strength: 0
SNR: 0
UNC: 0
FE_STATUS: FE_HAS_SIGNAL FE_HAS_LOCK FE_HAS_CARRIER FE_HAS_VITERBI 
FE_HAS_SYNC


MAP 0, file test.ts: From -1 secs, To -1 secs, 0 PIDs -
dvbstream will stop after 10 seconds (0 minutes)
Streaming 1 stream
Caught signal 1 - closing cleanly.

So it tries to tune, and succeeds in a manner of speaking -- if I try 
to tune to an unavailable frequency, it will fail; here we can see it 
locks. However, the Signal strength is zero and the file is empty.


What happened with the ATSC QAM-256 tuning in between DVB API 3.1 and 
now? I'm running 2.6.32.5, with DVB API 5.1.


Cheers,
Dave




it's the usual debian idiocy to package only official releases.
I refuse to release anything, so unless Dave does it you should use a 
fresh cvs checkout from sourceforge,

where the limitation was removed years ago.

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Zooming with V4L2

2010-11-24 Thread Laurent Pinchart
Hi Shuzhen,

On Monday 22 November 2010 23:51:41 Shuzhen Wang wrote:
 Hello, Laurent,
 
 I Get the logic you have behind using cropping/scaling.
 
 The reason I wanted to use V4L2_CID_ZOOM_ABSOLUTE are that the application
 will have a simpler interface to control zoom level supported by the
 hardware (yet may be less flexible). In other words, the driver gives out
 the zoom range, and the application doesn't need to calculated different
 cropping windows. By doing this we don't add policies into the driver,
 because in our implementation the request is forwarded by the driver to a
 user space daemon, who in turn talks back to the driver to control the
 hardware.

That's even worse. No userspace daemons please.

 I guess I will need to conform to the cropping/scaling interface then.

-- 
Regards,

Laurent Pinchart
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/6] davinci vpbe: display driver for DM644X

2010-11-24 Thread Manjunath Hadli
This driver is written for Texas Instruments's DM644X VPBE IP.
This SoC supports 2 video planes and 2 OSD planes as part of its
OSD (On Screen Display) block.

At present, the patches conatin the basic support of DM644X V4L2 
driver, and subsequent patch sets would add support for external 
encoders,other DMXXX family SoC and fbdev support.

   VPBE V4L2 driver design
==

File partitioning
-
V4L2 display device driver
drivers/media/video/davinci/vpbe_display.c
drivers/media/video/davinci/vpbe_display.h

VPBE display controller
drivers/media/video/davinci/vpbe.c
drivers/media/video/davinci/vpbe.h

VPBE venc sub device driver
drivers/media/video/davinci/vpbe_venc.c
drivers/media/video/davinci/vpbe_venc.h
drivers/media/video/davinci/vpbe_venc_regs.h

VPBE osd driver
drivers/media/video/davinci/vpbe_osd.c
drivers/media/video/davinci/vpbe_osd.h
drivers/media/video/davinci/vpbe_osd_regs.h

Functional partitioning
---

Consists of following (in the same order as the list under file
partitioning):-

1. V4L2 display driver
   Implements video2 and video3 device nodes and
   provides v4l2 device interface to manage VID0 and VID1 layers.

2. Display controller
   Loads up venc, osd and external encoders such as ths8200. It provides
   a set of API calls to V4L2 drivers to set the output/standards
   in the venc or external sub devices. It also provides
   a device object to access the services from osd sub device
   using sub device ops. The connection of external encoders to venc LCD
   controller port is done at init time based on default output and standard
   selection or at run time when application change the output through
   V4L2 IOCTLs.

   When connetected to an external encoder, vpbe controller is also responsible
   for setting up the interface between venc and external encoders based on
   board specific settings (specified in board-xxx-evm.c). This allowes
   interfacing external encoders such as ths8200. The setup_if_config()
   is implemented for this as well as configure_venc() (part of the next patch)
   API to set timings in venc for a specific display resolution.As of this
   patch series, the interconnection and enabling ans setting of the external
   encoders is not present, and would be a part of the next patch series.

3. Venc sub device
   Responsible for setting outputs provides through internal dacs and also
   setting timings at LCD controller port when external encoders are connected
   at the port or LCD panel timings required. When external encoder/LCD panel
   is connected, the timings for a specific standard/preset is retrieved from
   the board specific table and the values are used to set the timings in
   venc using non-standard timing mode.

   Support LCD Panel displays using the venc. For example to support a Logic
   PD display, it requires setting up the LCD controller port with a set of
   timings for the resolution supported and setting the dot clock. So we could
   add the available outputs as a board specific entry ( i.e add the LogicPD
   output name to board-xxx-evm.c). A table of timings for various LCDs
   supported cab be maintained in the board specific setup file to support
   various LCD displays.

4. osd sub device
   Osd sub device implements all osd layer management and hardware specific
   features. In the legacy drivers (LSPxxx), the hardware specific features
   are configured through proprietary IOCTLs at the fb device interface. Since
   sub devices are going to support device nodes, application will be able
   to configure the hardware feayture directly by opening the osd sub device
   node and by calling the related IOCTL. So these proprietary IOCTLs are
   to be removed from the FB Device driver when doing up port of these drivers 
to
   mainline kernel. The V4L2 and FB device nodes supports only IOCTLS as per
   the associated spec. The rest of the IOCTLs are to be moved to osd and
   venc sub devices.

Current status:-

A build tested version of vpbe controller is available.

Following are TBDs.

vpbe display controller
   - review and modify the handling of external encoders.
   - add support for selecting external encoder as default at probe time.

vpbe venc sub device
   - add timings for supporting ths8200
   - add support for LogicPD LCD.

v4l2 driver
   - A version is already developed which is to be cleaned up and unit tested

FB drivers
   - Add support for fbdev drivers.- Ready and part of subsequent patches.

Manjunath Hadli (6):
  davinci vpbe: V4L2 display driver for DM644X SoC
  davinci vpbe: VPBE display driver
  davinci vpbe: OSD(On Screen Display) block
  davinci vpbe: VENC( Video Encoder) implementation
  davinci vpbe: platform specific additions
  davinci vpbe: Build infrastructure for VPBE driver

 arch/arm/mach-davinci/board-dm644x-evm.c   

[PATCH v2 2/6] davinci vpbe: VPBE display driver

2010-11-24 Thread Manjunath Hadli
This patch implements the coe functionality of the dislay driver,
mainly controlling the VENC and other encoders, and acting as
the one point interface for the man V4L2 driver.This implements
the cre of each of the V4L2 IOCTLs.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Muralidharan Karicheri m-kariche...@ti.com
---
 drivers/media/video/davinci/vpbe.c |  853 
 include/media/davinci/vpbe.h   |  187 
 2 files changed, 1040 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/davinci/vpbe.c
 create mode 100644 include/media/davinci/vpbe.h

diff --git a/drivers/media/video/davinci/vpbe.c 
b/drivers/media/video/davinci/vpbe.c
new file mode 100644
index 000..b367082
--- /dev/null
+++ b/drivers/media/video/davinci/vpbe.c
@@ -0,0 +1,853 @@
+/*
+ * Copyright (C) 2010 Texas Instruments Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License.
+ *
+ * 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 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
+ */
+#include linux/kernel.h
+#include linux/init.h
+#include linux/module.h
+#include linux/errno.h
+#include linux/fs.h
+#include linux/string.h
+#include linux/wait.h
+#include linux/time.h
+#include linux/platform_device.h
+#include linux/io.h
+#include linux/slab.h
+#include linux/clk.h
+#include linux/err.h
+
+#include media/v4l2-device.h
+#include media/davinci/vpbe_types.h
+#include media/davinci/vpbe.h
+#include media/davinci/vpss.h
+
+
+#define VPBE_DEFAULT_OUTPUTComposite
+#define VPBE_DEFAULT_MODE  ntsc
+
+static char *def_output = VPBE_DEFAULT_OUTPUT;
+static char *def_mode = VPBE_DEFAULT_MODE;
+static  struct osd_state *osd_device;
+static struct venc_platform_data *venc_device;
+static int debug;
+
+module_param(def_output, charp, S_IRUGO);
+module_param(def_mode, charp, S_IRUGO);
+module_param(debug, int, 0644);
+
+MODULE_PARM_DESC(def_output, vpbe output name (default:Composite));
+MODULE_PARM_DESC(ef_mode, vpbe output mode name (default:ntsc);
+MODULE_PARM_DESC(debug, Debug level 0-1);
+
+MODULE_DESCRIPTION(TI DMXXX VPBE Display controller);
+MODULE_LICENSE(GPL);
+MODULE_AUTHOR(Texas Instruments);
+
+/**
+ * vpbe_current_encoder_info - Get config info for current encoder
+ * @vpbe_dev - vpbe device ptr
+ *
+ * Return ptr to current encoder config info
+ */
+static struct encoder_config_info*
+vpbe_current_encoder_info(struct vpbe_device *vpbe_dev)
+{
+   struct vpbe_display_config *vpbe_config = vpbe_dev-cfg;
+   int index = vpbe_dev-current_sd_index;
+   return ((index == 0) ? vpbe_config-venc :
+   vpbe_config-ext_encoders[index-1]);
+}
+
+/**
+ * vpbe_find_encoder_sd_index - Given a name find encoder sd index
+ *
+ * @vpbe_config - ptr to vpbe cfg
+ * @output_index - index used by application
+ *
+ * Return sd index of the encoder
+ */
+static int vpbe_find_encoder_sd_index(struct vpbe_display_config *vpbe_config,
+int index)
+{
+   char *encoder_name = vpbe_config-outputs[index].subdev_name;
+   int i;
+
+   /* Venc is always first */
+   if (!strcmp(encoder_name, vpbe_config-venc.module_name))
+   return 0;
+
+   for (i = 0; i  vpbe_config-num_ext_encoders; i++) {
+   if (!strcmp(encoder_name,
+vpbe_config-ext_encoders[i].module_name))
+   return i+1;
+   }
+   return -EINVAL;
+}
+
+/**
+ * vpbe_g_cropcap - Get crop capabilities of the display
+ * @vpbe_dev - vpbe device ptr
+ * @cropcap - cropcap is a ptr to struct v4l2_cropcap
+ *
+ * Update the crop capabilities in crop cap for current
+ * mode
+ */
+static int vpbe_g_cropcap(struct vpbe_device *vpbe_dev,
+ struct v4l2_cropcap *cropcap)
+{
+   if (NULL == cropcap)
+   return -EINVAL;
+   cropcap-bounds.left = 0;
+   cropcap-bounds.top = 0;
+   cropcap-bounds.width = vpbe_dev-current_timings.xres;
+   cropcap-bounds.height = vpbe_dev-current_timings.yres;
+   cropcap-defrect = cropcap-bounds;
+   return 0;
+}
+
+/**
+ * vpbe_enum_outputs - enumerate outputs
+ * @vpbe_dev - vpbe device ptr
+ * @output - ptr to v4l2_output structure
+ *
+ * Enumerates the outputs available at the vpbe display
+ * returns the status, -EINVAL if end of output list
+ */
+static int vpbe_enum_outputs(struct vpbe_device *vpbe_dev,
+struct v4l2_output 

[PATCH v2 3/6] davinci vpbe: OSD(On Screen Display) block

2010-11-24 Thread Manjunath Hadli
This patch implements the functionality of the OSD block
of the VPBE.The OSD in total supports 4 planes or Video
sources - 2 mainly RGB and 2 Video. The patch implements general
handling of all the planes, with specific emphasis on the Video
plane capabilities as the Video planes are supported through the
V4L2 driver.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Muralidharan Karicheri m-kariche...@ti.com
---
 drivers/media/video/davinci/vpbe_osd.c  | 1208 +++
 drivers/media/video/davinci/vpbe_osd_regs.h |  389 +
 include/media/davinci/vpbe_osd.h|  397 +
 3 files changed, 1994 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/davinci/vpbe_osd.c
 create mode 100644 drivers/media/video/davinci/vpbe_osd_regs.h
 create mode 100644 include/media/davinci/vpbe_osd.h

diff --git a/drivers/media/video/davinci/vpbe_osd.c 
b/drivers/media/video/davinci/vpbe_osd.c
new file mode 100644
index 000..64371b5
--- /dev/null
+++ b/drivers/media/video/davinci/vpbe_osd.c
@@ -0,0 +1,1208 @@
+/*
+ * Copyright (C) 2007-2010 Texas Instruments Inc
+ * Copyright (C) 2007 MontaVista Software, Inc.
+ *
+ * Andy Lowe (al...@mvista.com), MontaVista Software
+ * - Initial version
+ * Murali Karicheri (mkarich...@gmail.com), Texas Instruments Ltd.
+ * - ported to sub device interface
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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 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
+ *
+ */
+#include linux/module.h
+#include linux/kernel.h
+#include linux/interrupt.h
+#include linux/platform_device.h
+#include linux/clk.h
+#include linux/slab.h
+
+#include mach/io.h
+#include mach/cputype.h
+#include mach/hardware.h
+
+#include media/davinci/vpss.h
+#include media/v4l2-device.h
+#include media/davinci/vpbe_types.h
+#include media/davinci/vpbe_osd.h
+
+#include linux/io.h
+#include vpbe_osd_regs.h
+
+#define MODULE_NAMEVPBE_OSD_SUBDEV_NAME
+
+/* register access routines */
+static inline u32 osd_read(struct osd_state *sd, u32 offset)
+{
+   struct osd_state *osd = sd;
+   return __raw_readl(osd-osd_base + offset);
+}
+
+static inline u32 osd_write(struct osd_state *sd, u32 val, u32 offset)
+{
+   struct osd_state *osd = sd;
+   __raw_writel(val, osd-osd_base + offset);
+   return val;
+}
+
+static inline u32 osd_set(struct osd_state *sd, u32 mask, u32 offset)
+{
+   struct osd_state *osd = sd;
+
+   u32 addr = osd-osd_base + offset;
+   u32 val = __raw_readl(addr) | mask;
+
+   __raw_writel(val, addr);
+   return val;
+}
+
+static inline u32 osd_clear(struct osd_state *sd, u32 mask, u32 offset)
+{
+   struct osd_state *osd = sd;
+   u32 addr = osd-osd_base + offset;
+   u32 val = __raw_readl(addr)  ~mask;
+
+   __raw_writel(val, addr);
+   return val;
+}
+
+static inline u32 osd_modify(struct osd_state *sd, u32 mask, u32 val,
+u32 offset)
+{
+   struct osd_state *osd = sd;
+
+   u32 addr = osd-osd_base + offset;
+   u32 new_val = (__raw_readl(addr)  ~mask) | (val  mask);
+   __raw_writel(new_val, addr);
+   return new_val;
+}
+
+/* define some macros for layer and pixfmt classification */
+#define is_osd_win(layer) (((layer) == WIN_OSD0) || ((layer) == WIN_OSD1))
+#define is_vid_win(layer) (((layer) == WIN_VID0) || ((layer) == WIN_VID1))
+#define is_rgb_pixfmt(pixfmt) \
+   (((pixfmt) == PIXFMT_RGB565) || ((pixfmt) == PIXFMT_RGB888))
+#define is_yc_pixfmt(pixfmt) \
+   (((pixfmt) == PIXFMT_YCbCrI) || ((pixfmt) == PIXFMT_YCrCbI) || \
+   ((pixfmt) == PIXFMT_NV12))
+#define MAX_WIN_SIZE OSD_VIDWIN0XP_V0X
+#define MAX_LINE_LENGTH (OSD_VIDWIN0OFST_V0LO  5)
+
+
+/**
+ * _osd_dm6446_vid0_pingpong() - field inversion fix for DM6446
+ * @sd - ptr to struct osd_state
+ * @field_inversion - inversion flag
+ * @fb_base_phys - frame buffer address
+ * @lconfig - ptr to layer config
+ *
+ * This routine implements a workaround for the field signal inversion silicon
+ * erratum described in Advisory 1.3.8 for the DM6446.  The fb_base_phys and
+ * lconfig parameters apply to the vid0 window.  This routine should be called
+ * whenever the vid0 layer configuration or start address is modified, or when
+ * the OSD field inversion setting is modified.
+ * Returns: 1 if the ping-pong buffers need to be toggled in 

[PATCH v2 4/6] davinci vpbe: VENC( Video Encoder) implementation

2010-11-24 Thread Manjunath Hadli
This patch adds the VENC or the Video encoder, whichis responsible
for the blending of al source planes and timing generation for Video
modes like NTSC, PAL and other digital outputs. the VENC implementation
currently supports COMPOSITE and COMPONENT outputs and NTSC and PAL
resolutions through the analog DACs. The venc block is implemented
as a subdevice, allowing for additional extenal and internal encoders
of other kind to plug-in.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Muralidharan Karicheri m-kariche...@ti.com
---
 drivers/media/video/davinci/vpbe_venc.c  |  575 ++
 drivers/media/video/davinci/vpbe_venc_regs.h |  189 +
 include/media/davinci/vpbe_venc.h|   41 ++
 3 files changed, 805 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/video/davinci/vpbe_venc.c
 create mode 100644 drivers/media/video/davinci/vpbe_venc_regs.h
 create mode 100644 include/media/davinci/vpbe_venc.h

diff --git a/drivers/media/video/davinci/vpbe_venc.c 
b/drivers/media/video/davinci/vpbe_venc.c
new file mode 100644
index 000..cbd20f2
--- /dev/null
+++ b/drivers/media/video/davinci/vpbe_venc.c
@@ -0,0 +1,575 @@
+/*
+ * Copyright (C) 2010 Texas Instruments Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 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 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
+ */
+#include linux/module.h
+#include linux/kernel.h
+#include linux/init.h
+#include linux/ctype.h
+#include linux/delay.h
+#include linux/device.h
+#include linux/interrupt.h
+#include linux/platform_device.h
+#include linux/videodev2.h
+#include linux/slab.h
+
+#include mach/hardware.h
+#include mach/mux.h
+#include mach/io.h
+#include mach/i2c.h
+
+#include linux/io.h
+
+#include media/davinci/vpbe_types.h
+#include media/davinci/vpbe_venc.h
+#include media/davinci/vpss.h
+#include media/v4l2-device.h
+
+#include vpbe_venc_regs.h
+
+#define MODULE_NAMEVPBE_VENC_SUBDEV_NAME
+
+static int debug = 2;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, Debug level 0-2);
+
+struct venc_state {
+   struct v4l2_subdev sd;
+   struct venc_callback *callback;
+   struct venc_platform_data *pdata;
+   /*enum v4l2_mbus_pixelcode if_params;*/
+   struct device *pdev;
+   u32 output;
+   v4l2_std_id std;
+   spinlock_t lock;
+   void __iomem *venc_base;
+   void __iomem *vdaccfg_reg;
+};
+
+static inline struct venc_state *to_state(struct v4l2_subdev *sd)
+{
+   return container_of(sd, struct venc_state, sd);
+}
+
+static inline u32 venc_read(struct v4l2_subdev *sd, u32 offset)
+{
+   struct venc_state *venc = to_state(sd);
+
+   return __raw_readl(venc-venc_base + offset);
+}
+
+static inline u32 venc_write(struct v4l2_subdev *sd, u32 offset, u32 val)
+{
+   struct venc_state *venc = to_state(sd);
+   __raw_writel(val, (venc-venc_base + offset));
+   return val;
+}
+
+static inline u32 venc_modify(struct v4l2_subdev *sd, u32 offset,
+u32 val, u32 mask)
+{
+   u32 new_val = (venc_read(sd, offset)  ~mask) | (val  mask);
+
+   venc_write(sd, offset, new_val);
+   return new_val;
+}
+
+static inline u32 vdaccfg_write(struct v4l2_subdev *sd, u32 val)
+{
+   struct venc_state *venc = to_state(sd);
+
+   __raw_writel(val, venc-vdaccfg_reg);
+
+   val = __raw_readl(venc-vdaccfg_reg);
+   return val;
+}
+
+/* This function sets the dac of the VPBE for various outputs
+ */
+static int venc_set_dac(struct v4l2_subdev *sd, u32 out_index)
+{
+   int ret = 0;
+
+   switch (out_index) {
+   case 0:
+   v4l2_dbg(debug, 1, sd, Setting output to Composite\n);
+   venc_write(sd, VENC_DACSEL, 0);
+   break;
+   case 1:
+   v4l2_dbg(debug, 1, sd, Setting output to S-Video\n);
+   venc_write(sd, VENC_DACSEL, 0x210);
+   break;
+   case  2:
+   venc_write(sd, VENC_DACSEL, 0x543);
+   break;
+   default:
+   ret = -EINVAL;
+   }
+   return ret;
+}
+
+static void enabledigitaloutput(struct v4l2_subdev *sd, int benable)
+{
+   v4l2_dbg(debug, 2, sd, enabledigitaloutput\n);
+
+   if (benable) {
+   venc_write(sd, VENC_VMOD, 0);
+   venc_write(sd, VENC_CVBS, 0);
+   venc_write(sd, 

[PATCH v2 5/6] davinci vpbe: platform specific additions

2010-11-24 Thread Manjunath Hadli
This patch implements the overall device creation for the Video
display driver, and addition of tables for the mode and output list.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Muralidharan Karicheri m-kariche...@ti.com
---
 arch/arm/mach-davinci/board-dm644x-evm.c|   81 --
 arch/arm/mach-davinci/dm644x.c  |  238 ++-
 arch/arm/mach-davinci/include/mach/dm644x.h |4 +
 3 files changed, 304 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c 
b/arch/arm/mach-davinci/board-dm644x-evm.c
index 34c8b41..1ca1456 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -166,18 +166,6 @@ static struct platform_device davinci_evm_nandflash_device 
= {
.resource   = davinci_evm_nandflash_resource,
 };
 
-static u64 davinci_fb_dma_mask = DMA_BIT_MASK(32);
-
-static struct platform_device davinci_fb_device = {
-   .name   = davincifb,
-   .id = -1,
-   .dev = {
-   .dma_mask   = davinci_fb_dma_mask,
-   .coherent_dma_mask  = DMA_BIT_MASK(32),
-   },
-   .num_resources = 0,
-};
-
 static struct tvp514x_platform_data tvp5146_pdata = {
.clk_polarity = 0,
.hs_polarity = 1,
@@ -606,8 +594,73 @@ static void __init evm_init_i2c(void)
i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info));
 }
 
+#define VENC_STD_ALL(V4L2_STD_NTSC | V4L2_STD_PAL)
+/* venc standards timings */
+static struct vpbe_enc_mode_info vbpe_enc_std_timings[] = {
+   {ntsc, VPBE_ENC_STD, {V4L2_STD_525_60}, 1, 720, 480,
+   {11, 10}, {3, 1001}, 0x79, 0, 0x10, 0, 0, 0, 0},
+   {pal, VPBE_ENC_STD, {V4L2_STD_625_50}, 1, 720, 576,
+   {54, 59}, {25, 1}, 0x7E, 0, 0x16, 0, 0, 0, 0},
+};
+
+/* venc dv preset timings */
+static struct vpbe_enc_mode_info vbpe_enc_preset_timings[] = {
+   {480p59_94, VPBE_ENC_DV_PRESET, {V4L2_DV_480P59_94}, 0, 720, 480,
+   {1, 1}, {5994, 100}, 0x80, 0, 0x20, 0, 0, 0, 0},
+   {576p50, VPBE_ENC_DV_PRESET, {V4L2_DV_576P50}, 0, 720, 576,
+   {1, 1}, {50, 1}, 0x7E, 0, 0x30, 0, 0, 0, 0},
+};
+
+/*
+ * The outputs available from VPBE + ecnoders. Keep the
+ * the order same as that of encoders. First that from venc followed by that
+ * from encoders. Index in the output refers to index on a particular encoder.
+ * Driver uses this index to pass it to encoder when it supports more than
+ * one output. Application uses index of the array to set an output.
+ */
+static struct vpbe_output dm644x_vpbe_outputs[] = {
+   {
+   .output = {
+   .index = 0,
+   .name = Composite,
+   .type = V4L2_OUTPUT_TYPE_ANALOG,
+   .std = VENC_STD_ALL,
+   .capabilities = V4L2_OUT_CAP_STD,
+   },
+   .subdev_name = VPBE_VENC_SUBDEV_NAME,
+   .default_mode = ntsc,
+   .num_modes = ARRAY_SIZE(vbpe_enc_std_timings),
+   .modes = vbpe_enc_std_timings,
+   .if_params = V4L2_MBUS_FMT_FIXED,
+   },
+   {
+   .output = {
+   .index = 1,
+   .name = Component,
+   .type = V4L2_OUTPUT_TYPE_ANALOG,
+   .capabilities = V4L2_OUT_CAP_PRESETS,
+   },
+   .subdev_name = VPBE_VENC_SUBDEV_NAME,
+   .default_mode = 480p59_94,
+   .num_modes = ARRAY_SIZE(vbpe_enc_preset_timings),
+   .modes = vbpe_enc_preset_timings,
+   .if_params = V4L2_MBUS_FMT_FIXED,
+   },
+};
+
+static struct vpbe_display_config vpbe_display_cfg = {
+   .module_name = dm644x-vpbe-display,
+   .i2c_adapter_id = 1,
+   .osd = {
+   .module_name = VPBE_OSD_SUBDEV_NAME,
+   },
+   .venc = {
+   .module_name = VPBE_VENC_SUBDEV_NAME,
+   },
+   .num_outputs = ARRAY_SIZE(dm644x_vpbe_outputs),
+   .outputs = dm644x_vpbe_outputs,
+};
 static struct platform_device *davinci_evm_devices[] __initdata = {
-   davinci_fb_device,
rtc_dev,
 };
 
@@ -620,6 +673,8 @@ davinci_evm_map_io(void)
 {
/* setup input configuration for VPFE input devices */
dm644x_set_vpfe_config(vpfe_cfg);
+   /* setup configuration for vpbe devices */
+   dm644x_set_vpbe_display_config(vpbe_display_cfg);
dm644x_init();
 }
 
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 5e5b0a7..bad5b89 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -640,6 +640,216 @@ void dm644x_set_vpfe_config(struct vpfe_config *cfg)
vpfe_capture_dev.dev.platform_data = cfg;
 }
 
+static struct resource dm644x_osd_resources[] = {
+   {
+   .start  = 0x01C72600,
+   .end= 0x01C72600 + 0x200,
+  

[PATCH v2 6/6] davinci vpbe: Build infrastructure for VPBE driver

2010-11-24 Thread Manjunath Hadli
This patch adds the build infra-structure for Davinci
VPBE dislay driver.

Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
Signed-off-by: Muralidharan Karicheri m-kariche...@ti.com
---
 drivers/media/video/davinci/Kconfig  |   22 ++
 drivers/media/video/davinci/Makefile |2 ++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/davinci/Kconfig 
b/drivers/media/video/davinci/Kconfig
index 6b19540..dab32d5 100644
--- a/drivers/media/video/davinci/Kconfig
+++ b/drivers/media/video/davinci/Kconfig
@@ -91,3 +91,25 @@ config VIDEO_ISIF
 
   To compile this driver as a module, choose M here: the
   module will be called vpfe.
+
+config VIDEO_DM644X_VPBE
+tristate DM644X VPBE HW module
+select VIDEO_VPSS_SYSTEM
+   select VIDEOBUF_DMA_CONTIG
+help
+   Enables VPBE modules used for display on a DM644x
+   SoC.
+
+   To compile this driver as a module, choose M here: the
+   module will be called vpbe.
+
+
+config VIDEO_VPBE_DISPLAY
+tristate VPBE V4L2 Display driver
+select VIDEO_DM644X_VPBE
+default y
+help
+   Enables VPBE V4L2 Display driver on a DMXXX device
+
+   To compile this driver as a module, choose M here: the
+   module will be called vpbe_display.
diff --git a/drivers/media/video/davinci/Makefile 
b/drivers/media/video/davinci/Makefile
index a379557..ae7dafb 100644
--- a/drivers/media/video/davinci/Makefile
+++ b/drivers/media/video/davinci/Makefile
@@ -16,3 +16,5 @@ obj-$(CONFIG_VIDEO_VPFE_CAPTURE) += vpfe_capture.o
 obj-$(CONFIG_VIDEO_DM6446_CCDC) += dm644x_ccdc.o
 obj-$(CONFIG_VIDEO_DM355_CCDC) += dm355_ccdc.o
 obj-$(CONFIG_VIDEO_ISIF) += isif.o
+obj-$(CONFIG_VIDEO_DM644X_VPBE) += vpbe.o vpbe_osd.o vpbe_venc.o
+obj-$(CONFIG_VIDEO_VPBE_DISPLAY) += vpbe_display.o
-- 
1.6.2.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: DVB-T2 tuner dismantled: PCTV Nanostick T2 290e

2010-11-24 Thread Anca Emanuel
Hi Steve Kerrison !

There are no developers available, sorry.
Mauro can not keep up with the mails. Just look at the last merge window.
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PULL] soc-camera: one fix for the mx2-camera driver

2010-11-24 Thread Guennadi Liakhovetski
Hi Mauro

The following changes since commit 3561d43fd289f590fdae672e5eb831b8d5cf0bf6:

  Linux 2.6.37-rc3 (2010-11-21 15:18:56 -0800)

are available in the git repository at:
  git://linuxtv.org/gliakhovetski/v4l-dvb.git 2.6.37-rc3-fixes

Baruch Siach (1):
  mx2_camera: fix pixel clock polarity configuration

 drivers/media/video/mx2_camera.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: DVB-T2 tuner dismantled: PCTV Nanostick T2 290e

2010-11-24 Thread steve
 Hi Steve Kerrison !

 There are no developers available, sorry.
 Mauro can not keep up with the mails. Just look at the last merge window.

Hi Anca,

That's a shame, but I will not be disheartened. I will see what I can
piece together in my spare time and do my best to make it easy to merge in
- it looks like the demod is the only new piece of hardware to deal with
so it might not be too bad (such is the optimist in me).

If anyone discovers this thread and wants to work with me to the same goal
then do please get in touch with me via stevekerrison.com.

Regards,
Steve.

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[cron job] v4l-dvb daily build: WARNINGS

2010-11-24 Thread Hans Verkuil
This message is generated daily by a cron job that builds v4l-dvb for
the kernels and architectures in the list below.

Results of the daily build of v4l-dvb:

date:Wed Nov 24 19:00:23 CET 2010
git master:   59365d136d205cc20fe666ca7f89b1c5001b0d5a
git media-master: gcc version:  i686-linux-gcc (GCC) 4.5.1
host hardware:x86_64
host os:  2.6.32.5

linux-git-armv5: WARNINGS
linux-git-armv5-davinci: WARNINGS
linux-git-armv5-ixp: WARNINGS
linux-git-armv5-omap2: WARNINGS
linux-git-i686: WARNINGS
linux-git-m32r: WARNINGS
linux-git-mips: WARNINGS
linux-git-powerpc64: WARNINGS
linux-git-x86_64: WARNINGS
spec-git: OK
sparse: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Wednesday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Wednesday.tar.bz2

The V4L-DVB specification from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: DVB-T2 tuner dismantled: PCTV Nanostick T2 290e

2010-11-24 Thread Konstantin Dimitrov
On Wed, Nov 24, 2010 at 6:44 PM,  st...@stevekerrison.com wrote:

 - it looks like the demod is the only new piece of hardware to deal with

and actually it makes DVB-T2 performance of that device very
questionable (at least in my opinion), because NXP silicon tuner
TDA18271 is old model and not DVB-T2 ready:

http://www.nxp.com/#/pip/pip=[pip=TDA18271HD]|pp=[t=pip,i=TDA18271HD]

like the new DVB-T2 ready NXP silicon tuner TDA18272:

http://www.nxp.com/#/pip/pip=[pip=TDA18272HN_SDS]|pp=[t=pip,i=TDA18272HN_SDS]

and so it's quite reasonable to assume that old silicon tuner designed
for DVB-T such as TDA18271 is not capable to provide optimal
performance for DVB-T2, which has high requirements for sure.

--konstantin
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -mmotm/-next] media: fix timblogiw kconfig build error

2010-11-24 Thread Randy Dunlap
From: Randy Dunlap randy.dun...@oracle.com

timblogiw uses dma() interfaces and it selects TIMB_DMA for that
support.  However, drivers/dma/ is not built unless
CONFIG_DMA_ENGINE is enabled, so select/enable that symbol also.

drivers/built-in.o: In function `timblogiw_close':
timblogiw.c:(.text+0x4419fe): undefined reference to `dma_release_channel'
drivers/built-in.o: In function `buffer_release':
timblogiw.c:(.text+0x441a8d): undefined reference to `dma_sync_wait'
drivers/built-in.o: In function `timblogiw_open':
timblogiw.c:(.text+0x44212b): undefined reference to `__dma_request_channel'

Signed-off-by: Randy Dunlap randy.dun...@oracle.com
---
 drivers/media/video/Kconfig |1 +
 1 file changed, 1 insertion(+)

--- mmotm-2010-1123-1612.orig/drivers/media/video/Kconfig
+++ mmotm-2010-1123-1612/drivers/media/video/Kconfig
@@ -669,6 +669,7 @@ config VIDEO_HEXIUM_GEMINI
 config VIDEO_TIMBERDALE
tristate Support for timberdale Video In/LogiWIN
depends on VIDEO_V4L2  I2C
+   select DMA_ENGINE
select TIMB_DMA
select VIDEO_ADV7180
select VIDEOBUF_DMA_CONTIG
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Zooming with V4L2

2010-11-24 Thread Shuzhen Wang
Hello, Laurent,

About using daemon, we have proprietary image processing and optimization
code that needs to sit between application and driver.

I wasn't working on V4L2 at the time, but this constraint was discussed
in the 2010 mini summit. And it was mentioned in section (1) of
http://www.linuxtv.org/news.php?entry=2010-06-22.mchehab.

Regards,
Shuzhen


-Original Message-
From: Laurent Pinchart [mailto:laurent.pinch...@ideasonboard.com] 
Sent: Wednesday, November 24, 2010 4:02 AM
To: Shuzhen Wang
Cc: linux-media@vger.kernel.org; 'Hans de Goede'
Subject: Re: Zooming with V4L2

Hi Shuzhen,

On Monday 22 November 2010 23:51:41 Shuzhen Wang wrote:
 Hello, Laurent,
 
 I Get the logic you have behind using cropping/scaling.
 
 The reason I wanted to use V4L2_CID_ZOOM_ABSOLUTE are that the application
 will have a simpler interface to control zoom level supported by the
 hardware (yet may be less flexible). In other words, the driver gives out
 the zoom range, and the application doesn't need to calculated different
 cropping windows. By doing this we don't add policies into the driver,
 because in our implementation the request is forwarded by the driver to a
 user space daemon, who in turn talks back to the driver to control the
 hardware.

That's even worse. No userspace daemons please.

 I guess I will need to conform to the cropping/scaling interface then.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: DVB-T2 tuner dismantled: PCTV Nanostick T2 290e

2010-11-24 Thread Steve Kerrison
Hi Konstantin,

That's an interesting observation, and a valid one given, for example,
the addition of QAM-256. I don't know enough about T or T2 to know how
the difference impact the tuner requirements.

Nevertheless, I can receive the T2 mux that is broadcast in my area. It
has to be through my roof antenna, and even when digital switchover is
complete here, I doubt that portable antennas will work particularly
well here then.

If PCTV had the option of using the better tuner, maybe they decided not
to because the cost of the Sony demod pushed up the BoM too far already.
Impossible to say for sure.

I guess we'll have to wait and see if somebody brings out a solution
with TDA18272/Sony demod combo before we can compare reception quality.

Regards,
-- 
Steve Kerrison MEng Hons.
http://www.stevekerrison.com/ 

-Original Message-
From: Konstantin Dimitrov kosio.dimit...@gmail.com
To: st...@stevekerrison.com
Cc: Anca Emanuel anca.eman...@gmail.com, linux-media@vger.kernel.org
Subject: Re: DVB-T2 tuner dismantled: PCTV Nanostick T2 290e
Date:   Wed, 24 Nov 2010 21:11:07 +0200

On Wed, Nov 24, 2010 at 6:44 PM,  st...@stevekerrison.com wrote:

 - it looks like the demod is the only new piece of hardware to deal with

and actually it makes DVB-T2 performance of that device very
questionable (at least in my opinion), because NXP silicon tuner
TDA18271 is old model and not DVB-T2 ready:

http://www.nxp.com/#/pip/pip=[pip=TDA18271HD]|pp=[t=pip,i=TDA18271HD]

like the new DVB-T2 ready NXP silicon tuner TDA18272:

http://www.nxp.com/#/pip/pip=[pip=TDA18272HN_SDS]|pp=[t=pip,i=TDA18272HN_SDS]

and so it's quite reasonable to assume that old silicon tuner designed
for DVB-T such as TDA18271 is not capable to provide optimal
performance for DVB-T2, which has high requirements for sure.

--konstantin
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Zooming with V4L2

2010-11-24 Thread Laurent Pinchart
Hi Shuzhen,

On Wednesday 24 November 2010 20:58:33 Shuzhen Wang wrote:
 Hello, Laurent,
 
 About using daemon, we have proprietary image processing and optimization
 code that needs to sit between application and driver.

That's a pretty common requirement, and there's nothing seriously wrong there 
(apart from the fact the code should be open, but that's another story :-)).

 I wasn't working on V4L2 at the time, but this constraint was discussed
 in the 2010 mini summit. And it was mentioned in section (1) of
 http://www.linuxtv.org/news.php?entry=2010-06-22.mchehab.

The proprietary image processing code should, as you mentioned, sit between 
the application and the driver. It can be implemented a a libv4l plugin, or as 
a daemon that a libv4l plugin talks to.

I got the impression from your last e-mail that the application was 
communicating directly with the driver, which then communicates with a 
userspace daemon. That's something you want to avoid. Apologies if I got it 
wrong.

-- 
Regards,

Laurent Pinchart
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ATSC Tuner in KWorld PC120-U PCI Hybrid ATSC (17de:a134)

2010-11-24 Thread hermann pitton

Hi,

Am Dienstag, den 23.11.2010, 17:34 -0500 schrieb Hooman B.:
 Hello!
 I've been trying to get the ATSC tuner in my KWorld PC120-U PCI Hybrid
 ATSC (17de:a134)
 to work with the latest v4l drivers from source (in Ubuntu).
 
 Right now, everything [capture, analog, radio, even IR] works - except
 the ATSC tuner (there is no
 front-end device). But that's the one thing I need working :-(

OK.

 Here's the output of lspci -nnvv
 
 03:01.0 Multimedia controller [0480]: Philips Semiconductors
 SAA7131/SAA7133/SAA7135 Video Broadcast Decoder [1131:7133] (rev d1)
 Subsystem: KWorld Computer Co. Ltd. Device [17de:a134]
 Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
 Stepping- SERR- FastB2B- DisINTx-
 Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium TAbort-
 TAbort- MAbort- SERR- PERR- INTx-
 Latency: 255 (63750ns min, 63750ns max)
 Interrupt: pin A routed to IRQ 16
 Region 0: Memory at fdaff000 (32-bit, non-prefetchable) [size=2K]
 Capabilities: access denied
 Kernel driver in use: saa7134
 Kernel modules: saa7134
 
 
 This is the most similar card that I forced in saa7134-cards.c:
 
 .vendor   = PCI_VENDOR_ID_PHILIPS,
 .device   = PCI_DEVICE_ID_PHILIPS_SAA7133,
 .subvendor= 0x17de,
 .subdevice= 0xa134,
 .driver_data  = SAA7134_BOARD_MSI_TVATANYWHERE_PLUS,
 
 
 The chips are : SAA7135HL/203 and TDA18271HDC2
 

Both variants of the MSI t...@nywhere Plus do not have any support for
digital TV.

You need to find out the type of digital channel decoder on your board
at first.

Then you check saa7134-dvb.c, if it is already supported on other cards.

You have to investigate the details of how the channel decoder is
employed, but with some luck can try with already supported cards.

If i2c traffic locks up and chips disappear from the bus, a cold boot
might be necessary to continue with testing.

Cheers,
Hermann




--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Problem with Compro T200 (TDA1004x) and tuning Hi

2010-11-24 Thread hermann pitton
Hi Mike,

Am Dienstag, den 23.11.2010, 13:36 + schrieb Mike Martin: 
 On 22 November 2010 19:43, hermann pitton hermann-pit...@arcor.de wrote:
 
  Am Montag, den 22.11.2010, 15:08 + schrieb Mike Martin:
  On 22 November 2010 06:08, hermann pitton hermann-pit...@arcor.de wrote:
   Hi Mike,
  
   Am Sonntag, den 21.11.2010, 17:58 + schrieb Mike Martin:
   I am trying to tune channels with this card (which seems to be
   installed OK). However the output is
  
   Using DVB card Philips TDA10046H DVB-T
   tuning DVB-T (in United Kingdom) to 497833000 Hz
   polling
   Getting frontend event
   FE_STATUS:
   polling
   polling
   polling
  
  
   usually, in the UK, this can be caused by the missing ability to detect
   some frequencies offsets by the tda10046.
  
   Since you have already a minus of 167000Hz, typically for the UK, in
   your initial scan/tuning file, this most common problem likely can be
   excluded.
  
   So there are eventually three variants causing the problem on a first
   idea.
  
   1. They changed to 498 MHz. (or did change something else too, auto
 is your friend in the initial scan file then, except for the freq.)
  
 
  tried that no difference
   2. Your overall signal is not good enough.
  
  well up until friday I was using a HVR900, until it decided to refuse
  to believe it was plugged into a USB2 bus, and it was working fine
 
   3. You sit on some kernel with some bug.
 
  [...]
 
  Well, it is still very easy to install the latest remaining v4l-dvb from
  hg/mercurial for a quick test too.
 
  I don't have your hardware, but all my stuff is still fine there so far.
 
  AFAIR, your device, added by Hartmut, has some sort of TD1316 without an
  extra tda9887 IF demodulator for analog reception soldered outside of
  the tuner on the PCB.
 
  However, it is in a loop for eeprom auto detection on the side of the
  bridge.
 
  If that fails, and for my experience four of five attempts to fiddle
  with that later did fail, you don't have a chance for any DVB either.
 
  You might have to force the card number in such a case, but I'm still
  far away from what might be going on and your report is without any
  details so far.
 
  Cheers,
  Hermann
 
 
 
 One problem is the last time I used it - it worked. Although that was
 in a different location/PC

yup, I know too it did work for years.

 Current system P4 Fedora 14, stock kernel
 
 output scandvb
 
 scanning uk-Aberdare_auto
 using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
 initial transponder 474167000 3 9 9 6 2 4 4
 initial transponder 482167000 3 9 9 6 2 4 4
 initial transponder 497833000 3 9 9 6 2 4 4
 initial transponder 506167000 3 9 9 6 2 4 4
 initial transponder 521833000 0 2 9 3 0 0 0
 initial transponder 530167000 0 2 9 3 0 0 0
  tune to: 
  474167000:INVERSION_AUTO:BANDWIDTH_AUTO:FEC_AUTO:FEC_AUTO:QAM_AUTO:TRANSMISSION_MODE_AUTO:GUARD_INTERVAL_AUTO:HIERARCHY_AUTO
 WARNING:  tuning failed!!!

One thing I forgot about, you might have to force the bandwidth too.

If that still fails, you might be on the road for bisecting through the
previous patches.

I can't even tell, how reliable bisecting can work currently.

However, it might be worth to test with the remaining v4l-dvb mercurial
code as a start.

Cheers,
Hermann













--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Zooming with V4L2

2010-11-24 Thread Shuzhen Wang
Laurent,

Thanks for the quick feedback.

Sorry if my previous email caused confusion. What I meant was that the
daemon subscribes to events from video0 device, and sends out ioctl commands
to control the hardware based on these events. So the kernel driver isn't
proactively communicating with the daemon.

But your comments about libv4l and daemon raise a good point. I will
take a look at libv4l, and see how it fits with daemon in my case.

Regards,
Shuzhen

-Original Message-
From: Laurent Pinchart [mailto:laurent.pinch...@ideasonboard.com] 
Sent: Wednesday, November 24, 2010 3:05 PM
To: Shuzhen Wang
Cc: linux-media@vger.kernel.org; 'Hans de Goede'
Subject: Re: Zooming with V4L2

Hi Shuzhen,

On Wednesday 24 November 2010 20:58:33 Shuzhen Wang wrote:
 Hello, Laurent,
 
 About using daemon, we have proprietary image processing and optimization
 code that needs to sit between application and driver.

That's a pretty common requirement, and there's nothing seriously wrong
there 
(apart from the fact the code should be open, but that's another story :-)).

 I wasn't working on V4L2 at the time, but this constraint was discussed
 in the 2010 mini summit. And it was mentioned in section (1) of
 http://www.linuxtv.org/news.php?entry=2010-06-22.mchehab.

The proprietary image processing code should, as you mentioned, sit between 
the application and the driver. It can be implemented a a libv4l plugin, or
as 
a daemon that a libv4l plugin talks to.

I got the impression from your last e-mail that the application was 
communicating directly with the driver, which then communicates with a 
userspace daemon. That's something you want to avoid. Apologies if I got it 
wrong.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v4 0/7] V4L2 subdev userspace API

2010-11-24 Thread Laurent Pinchart
Hi everybody,

Here's the fourth version of the V4L2 subdev userspace API patches. Nothing
new under the sun, the patches have just been rebased on top of 2.6.37-rc3.
You can find them as usual in  http://git.linuxtv.org/pinchartl/media.git
(media-0001-subdev-devnode branch).

Laurent Pinchart (6):
  v4l: Share code between video_usercopy and video_ioctl2
  v4l: subdev: Don't require core operations
  v4l: subdev: Merge v4l2_i2c_new_subdev_cfg and v4l2_i2c_new_subdev
  v4l: subdev: Add device node support
  v4l: subdev: Uninline the v4l2_subdev_init function
  v4l: subdev: Control ioctls support

Sakari Ailus (1):
  v4l: subdev: Events support

 Documentation/video4linux/v4l2-framework.txt |   52 ++
 drivers/media/radio/radio-si4713.c   |2 +-
 drivers/media/video/Makefile |2 +-
 drivers/media/video/cafe_ccic.c  |   12 +-
 drivers/media/video/davinci/vpfe_capture.c   |2 +-
 drivers/media/video/davinci/vpif_capture.c   |2 +-
 drivers/media/video/davinci/vpif_display.c   |2 +-
 drivers/media/video/ivtv/ivtv-i2c.c  |   12 +-
 drivers/media/video/s5p-fimc/fimc-capture.c  |3 +-
 drivers/media/video/sh_vou.c |2 +-
 drivers/media/video/soc_camera.c |2 +-
 drivers/media/video/v4l2-common.c|   22 ++-
 drivers/media/video/v4l2-dev.c   |   27 ++--
 drivers/media/video/v4l2-device.c|   24 +++-
 drivers/media/video/v4l2-ioctl.c |  216 +-
 drivers/media/video/v4l2-subdev.c|  179 +
 include/media/v4l2-common.h  |   21 +--
 include/media/v4l2-dev.h |   18 ++-
 include/media/v4l2-ioctl.h   |3 +
 include/media/v4l2-subdev.h  |   41 +++--
 20 files changed, 424 insertions(+), 220 deletions(-)
 create mode 100644 drivers/media/video/v4l2-subdev.c

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v4 1/7] v4l: Share code between video_usercopy and video_ioctl2

2010-11-24 Thread Laurent Pinchart
The two functions are mostly identical. They handle the copy_from_user
and copy_to_user operations related with V4L2 ioctls and call the real
ioctl handler.

Create a __video_usercopy function that implements the core of
video_usercopy and video_ioctl2, and call that function from both.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/v4l2-ioctl.c |  218 -
 1 files changed, 71 insertions(+), 147 deletions(-)

diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index dd9283f..1e01554 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -374,35 +374,62 @@ video_fix_command(unsigned int cmd)
 }
 #endif
 
-/*
- * Obsolete usercopy function - Should be removed soon
- */
-long
-video_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
+/* In some cases, only a few fields are used as input, i.e. when the app sets
+ * index and then the driver fills in the rest of the structure for the thing
+ * with that index.  We only need to copy up the first non-input field.  */
+static unsigned long cmd_input_size(unsigned int cmd)
+{
+   /* Size of structure up to and including 'field' */
+#define CMDINSIZE(cmd, type, field)\
+   case VIDIOC_##cmd:  \
+   return offsetof(struct v4l2_##type, field) +\
+   sizeof(((struct v4l2_##type *)0)-field);
+
+   switch (cmd) {
+   CMDINSIZE(ENUM_FMT, fmtdesc,type);
+   CMDINSIZE(G_FMT,format, type);
+   CMDINSIZE(QUERYBUF, buffer, type);
+   CMDINSIZE(G_PARM,   streamparm, type);
+   CMDINSIZE(ENUMSTD,  standard,   index);
+   CMDINSIZE(ENUMINPUT,input,  index);
+   CMDINSIZE(G_CTRL,   control,id);
+   CMDINSIZE(G_TUNER,  tuner,  index);
+   CMDINSIZE(QUERYCTRL,queryctrl,  id);
+   CMDINSIZE(QUERYMENU,querymenu,  index);
+   CMDINSIZE(ENUMOUTPUT,   output, index);
+   CMDINSIZE(G_MODULATOR,  modulator,  index);
+   CMDINSIZE(G_FREQUENCY,  frequency,  tuner);
+   CMDINSIZE(CROPCAP,  cropcap,type);
+   CMDINSIZE(G_CROP,   crop,   type);
+   CMDINSIZE(ENUMAUDIO,audio,  index);
+   CMDINSIZE(ENUMAUDOUT,   audioout,   index);
+   CMDINSIZE(ENCODER_CMD,  encoder_cmd,flags);
+   CMDINSIZE(TRY_ENCODER_CMD,  encoder_cmd,flags);
+   CMDINSIZE(G_SLICED_VBI_CAP, sliced_vbi_cap, type);
+   CMDINSIZE(ENUM_FRAMESIZES,  frmsizeenum,pixel_format);
+   CMDINSIZE(ENUM_FRAMEINTERVALS,  frmivalenum,height);
+   default:
+   return _IOC_SIZE(cmd);
+   }
+}
+
+static long
+__video_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
v4l2_kioctl func)
 {
charsbuf[128];
void*mbuf = NULL;
-   void*parg = NULL;
+   void*parg = (void *)arg;
longerr  = -EINVAL;
int is_ext_ctrl;
size_t  ctrls_size = 0;
void __user *user_ptr = NULL;
 
-#ifdef __OLD_VIDIOC_
-   cmd = video_fix_command(cmd);
-#endif
is_ext_ctrl = (cmd == VIDIOC_S_EXT_CTRLS || cmd == VIDIOC_G_EXT_CTRLS ||
   cmd == VIDIOC_TRY_EXT_CTRLS);
 
/*  Copy arguments into temp kernel buffer  */
-   switch (_IOC_DIR(cmd)) {
-   case _IOC_NONE:
-   parg = NULL;
-   break;
-   case _IOC_READ:
-   case _IOC_WRITE:
-   case (_IOC_WRITE | _IOC_READ):
+   if (_IOC_DIR(cmd) != _IOC_NONE) {
if (_IOC_SIZE(cmd) = sizeof(sbuf)) {
parg = sbuf;
} else {
@@ -414,11 +441,21 @@ video_usercopy(struct file *file, unsigned int cmd, 
unsigned long arg,
}
 
err = -EFAULT;
-   if (_IOC_DIR(cmd)  _IOC_WRITE)
-   if (copy_from_user(parg, (void __user *)arg, 
_IOC_SIZE(cmd)))
+   if (_IOC_DIR(cmd)  _IOC_WRITE) {
+   unsigned long n = cmd_input_size(cmd);
+
+   if (copy_from_user(parg, (void __user *)arg, n))
goto out;
-   break;
+
+   /* zero out anything we don't copy from userspace */
+   if (n  _IOC_SIZE(cmd))
+   memset((u8 *)parg + n, 0, _IOC_SIZE(cmd) - n);
+   } else {
+   /* read-only ioctl */
+   

[RFC/PATCH v4 2/7] v4l: subdev: Don't require core operations

2010-11-24 Thread Laurent Pinchart
There's no reason to require subdevices to implement the core
operations. Remove the check for non-NULL core operations when
initializing the subdev.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/media/v4l2-subdev.h |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index b0316a7..b636444 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -466,8 +466,7 @@ static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
const struct v4l2_subdev_ops *ops)
 {
INIT_LIST_HEAD(sd-list);
-   /* ops-core MUST be set */
-   BUG_ON(!ops || !ops-core);
+   BUG_ON(!ops);
sd-ops = ops;
sd-v4l2_dev = NULL;
sd-flags = 0;
-- 
1.7.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v4 3/7] v4l: subdev: Merge v4l2_i2c_new_subdev_cfg and v4l2_i2c_new_subdev

2010-11-24 Thread Laurent Pinchart
v4l2_i2c_new_subdev is a thin wrapper around v4l2_i2c_new_subdev_cfg,
which is itself a wrapper around v4l2_i2c_new_subdev_board.

The intermediate v4l2_i2c_new_subdev_cfg function is called directly by
the ivtv and cafe-ccic drivers only. Merge it with v4l2_i2c_new_subdev
and use v4l2_i2c_new_subdev_board in the ivtv and cafe-ccic drivers.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/cafe_ccic.c |   12 +---
 drivers/media/video/ivtv/ivtv-i2c.c |   12 +---
 drivers/media/video/v4l2-common.c   |7 ++-
 include/media/v4l2-common.h |   15 +--
 4 files changed, 21 insertions(+), 25 deletions(-)

diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index 7bc3667..ffbf8af 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -1992,6 +1992,7 @@ static int cafe_pci_probe(struct pci_dev *pdev,
 {
int ret;
struct cafe_camera *cam;
+   struct i2c_board_info info;
struct ov7670_config sensor_cfg = {
/* This controller only does SMBUS */
.use_smbus = true,
@@ -2065,9 +2066,14 @@ static int cafe_pci_probe(struct pci_dev *pdev,
sensor_cfg.clock_speed = 45;
 
cam-sensor_addr = 0x42;
-   cam-sensor = v4l2_i2c_new_subdev_cfg(cam-v4l2_dev, cam-i2c_adapter,
-   ov7670, ov7670, 0, sensor_cfg, cam-sensor_addr,
-   NULL);
+
+   memset(info, 0, sizeof(info));
+   strlcpy(info.type, ov7670, sizeof(info.type));
+   info.addr = cam-sensor_addr;
+   info.platform_data = sensor_cfg;
+
+   cam-sensor = v4l2_i2c_new_subdev_board(cam-v4l2_dev,
+   cam-i2c_adapter, info.type, info, NULL);
if (cam-sensor == NULL) {
ret = -ENODEV;
goto out_smbus;
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c 
b/drivers/media/video/ivtv/ivtv-i2c.c
index 9e8039a..9ec46d3 100644
--- a/drivers/media/video/ivtv/ivtv-i2c.c
+++ b/drivers/media/video/ivtv/ivtv-i2c.c
@@ -270,11 +270,17 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx)
adap, NULL, type, 0, I2C_ADDRS(hw_addrs[idx]));
} else if (hw == IVTV_HW_CX25840) {
struct cx25840_platform_data pdata;
+   struct i2c_board_info info;
 
pdata.pvr150_workaround = itv-pvr150_workaround;
-   sd = v4l2_i2c_new_subdev_cfg(itv-v4l2_dev,
-   adap, NULL, type, 0, pdata, hw_addrs[idx],
-   NULL);
+
+   memset(info, 0, sizeof(info));
+   strlcpy(info.type, type, sizeof(info.type));
+   info.addr = hw_addrs[idx];
+   info.platform_data = pdata;
+
+   sd = v4l2_i2c_new_subdev_board(itv-v4l2_dev, adap, NULL,
+  info, NULL);
} else {
sd = v4l2_i2c_new_subdev(itv-v4l2_dev,
adap, NULL, type, hw_addrs[idx], NULL);
diff --git a/drivers/media/video/v4l2-common.c 
b/drivers/media/video/v4l2-common.c
index 9294282..04ff164 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -431,10 +431,9 @@ error:
 }
 EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_board);
 
-struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev,
+struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
struct i2c_adapter *adapter,
const char *module_name, const char *client_type,
-   int irq, void *platform_data,
u8 addr, const unsigned short *probe_addrs)
 {
struct i2c_board_info info;
@@ -444,13 +443,11 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct 
v4l2_device *v4l2_dev,
memset(info, 0, sizeof(info));
strlcpy(info.type, client_type, sizeof(info.type));
info.addr = addr;
-   info.irq = irq;
-   info.platform_data = platform_data;
 
return v4l2_i2c_new_subdev_board(v4l2_dev, adapter, module_name,
info, probe_addrs);
 }
-EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_cfg);
+EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev);
 
 /* Return i2c client address of v4l2_subdev. */
 unsigned short v4l2_i2c_subdev_addr(struct v4l2_subdev *sd)
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 41dd480..98e0e35 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -139,24 +139,11 @@ struct v4l2_subdev_ops;
 /* Load an i2c module and return an initialized v4l2_subdev struct.
Only call request_module if module_name != NULL.
The client_type argument is the name of the chip that's on the adapter. */
-struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev,
+struct v4l2_subdev *v4l2_i2c_new_subdev(struct v4l2_device *v4l2_dev,
struct i2c_adapter 

[RFC/PATCH v4 4/7] v4l: subdev: Add device node support

2010-11-24 Thread Laurent Pinchart
Create a device node named subdevX for every registered subdev.

As the device node is registered before the subdev core::s_config
function is called, return -EGAIN on open until initialization
completes.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Vimarsh Zutshi vimarsh.zut...@nokia.com
---
 Documentation/video4linux/v4l2-framework.txt |   18 +++
 drivers/media/radio/radio-si4713.c   |2 +-
 drivers/media/video/Makefile |2 +-
 drivers/media/video/cafe_ccic.c  |2 +-
 drivers/media/video/davinci/vpfe_capture.c   |2 +-
 drivers/media/video/davinci/vpif_capture.c   |2 +-
 drivers/media/video/davinci/vpif_display.c   |2 +-
 drivers/media/video/ivtv/ivtv-i2c.c  |2 +-
 drivers/media/video/s5p-fimc/fimc-capture.c  |3 +-
 drivers/media/video/sh_vou.c |2 +-
 drivers/media/video/soc_camera.c |2 +-
 drivers/media/video/v4l2-common.c|   15 +-
 drivers/media/video/v4l2-dev.c   |   27 --
 drivers/media/video/v4l2-device.c|   24 +-
 drivers/media/video/v4l2-ioctl.c |2 +-
 drivers/media/video/v4l2-subdev.c|   66 ++
 include/media/v4l2-common.h  |6 ++-
 include/media/v4l2-dev.h |   18 ++-
 include/media/v4l2-ioctl.h   |3 +
 include/media/v4l2-subdev.h  |   16 ++-
 20 files changed, 178 insertions(+), 38 deletions(-)
 create mode 100644 drivers/media/video/v4l2-subdev.c

diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index f22f35c..4c9185a 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -319,6 +319,24 @@ controlled through GPIO pins. This distinction is only 
relevant when setting
 up the device, but once the subdev is registered it is completely transparent.
 
 
+V4L2 sub-device userspace API
+-
+
+Beside exposing a kernel API through the v4l2_subdev_ops structure, V4L2
+sub-devices can also be controlled directly by userspace applications.
+
+When a sub-device is registered, a device node named v4l-subdevX can be created
+in /dev. If the sub-device supports direct userspace configuration it must set
+the V4L2_SUBDEV_FL_HAS_DEVNODE flag before being registered.
+
+For I2C and SPI sub-devices, the v4l2_device driver can disable registration of
+the device node if it wants to control the sub-device on its own. In that case
+it must set the v4l2_i2c_new_subdev_board or v4l2_spi_new_subdev enable_devnode
+argument to 0. Setting the argument to 1 will only enable device node
+registration if the sub-device driver has set the V4L2_SUBDEV_FL_HAS_DEVNODE
+flag.
+
+
 I2C sub-device drivers
 --
 
diff --git a/drivers/media/radio/radio-si4713.c 
b/drivers/media/radio/radio-si4713.c
index 6a43578..a4440bf 100644
--- a/drivers/media/radio/radio-si4713.c
+++ b/drivers/media/radio/radio-si4713.c
@@ -292,7 +292,7 @@ static int radio_si4713_pdriver_probe(struct 
platform_device *pdev)
}
 
sd = v4l2_i2c_new_subdev_board(rsdev-v4l2_dev, adapter, NULL,
-   pdata-subdev_board_info, NULL);
+   pdata-subdev_board_info, NULL, 0);
if (!sd) {
dev_err(pdev-dev, Cannot get v4l2 subdevice\n);
rval = -ENODEV;
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index af79d47..adc1bd5 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -11,7 +11,7 @@ stkwebcam-objs:=  stk-webcam.o stk-sensor.o
 omap2cam-objs  :=  omap24xxcam.o omap24xxcam-dma.o
 
 videodev-objs  :=  v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o \
-   v4l2-event.o v4l2-ctrls.o
+   v4l2-event.o v4l2-ctrls.o v4l2-subdev.o
 
 # V4L2 core modules
 
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c
index ffbf8af..6a4e61e 100644
--- a/drivers/media/video/cafe_ccic.c
+++ b/drivers/media/video/cafe_ccic.c
@@ -2073,7 +2073,7 @@ static int cafe_pci_probe(struct pci_dev *pdev,
info.platform_data = sensor_cfg;
 
cam-sensor = v4l2_i2c_new_subdev_board(cam-v4l2_dev,
-   cam-i2c_adapter, info.type, info, NULL);
+   cam-i2c_adapter, info.type, info, NULL, 0);
if (cam-sensor == NULL) {
ret = -ENODEV;
goto out_smbus;
diff --git a/drivers/media/video/davinci/vpfe_capture.c 
b/drivers/media/video/davinci/vpfe_capture.c
index d8e38cc..df26d53 100644
--- a/drivers/media/video/davinci/vpfe_capture.c
+++ b/drivers/media/video/davinci/vpfe_capture.c
@@ -1988,7 +1988,7 @@ static __init int vpfe_probe(struct platform_device *pdev)
 

[RFC/PATCH v4 7/7] v4l: subdev: Events support

2010-11-24 Thread Laurent Pinchart
From: Sakari Ailus sakari.ai...@maxwell.research.nokia.com

Provide v4l2_subdevs with v4l2_event support. Subdev drivers only need very
little to support events.

Signed-off-by: Sakari Ailus sakari.ai...@maxwell.research.nokia.com
Signed-off-by: David Cohen david.co...@nokia.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/video4linux/v4l2-framework.txt |   18 ++
 drivers/media/video/v4l2-subdev.c|   75 +-
 include/media/v4l2-subdev.h  |   10 
 3 files changed, 102 insertions(+), 1 deletions(-)

diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index f683f63..4db1def 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -352,6 +352,24 @@ VIDIOC_TRY_EXT_CTRLS
controls can be also be accessed through one (or several) V4L2 device
nodes.
 
+VIDIOC_DQEVENT
+VIDIOC_SUBSCRIBE_EVENT
+VIDIOC_UNSUBSCRIBE_EVENT
+
+   The events ioctls are identical to the ones defined in V4L2. They
+   behave identically, with the only exception that they deal only with
+   events generated by the sub-device. Depending on the driver, those
+   events can also be reported by one (or several) V4L2 device nodes.
+
+   Sub-device drivers that want to use events need to set the
+   V4L2_SUBDEV_USES_EVENTS v4l2_subdev::flags and initialize
+   v4l2_subdev::nevents to events queue depth before registering the
+   sub-device. After registration events can be queued as usual on the
+   v4l2_subdev::devnode device node.
+
+   To properly support events, the poll() file operation is also
+   implemented.
+
 
 I2C sub-device drivers
 --
diff --git a/drivers/media/video/v4l2-subdev.c 
b/drivers/media/video/v4l2-subdev.c
index 806ec30..002281c 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -20,26 +20,68 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include linux/types.h
 #include linux/ioctl.h
+#include linux/slab.h
+#include linux/types.h
 #include linux/videodev2.h
 
 #include media/v4l2-device.h
 #include media/v4l2-ioctl.h
+#include media/v4l2-fh.h
+#include media/v4l2-event.h
 
 static int subdev_open(struct file *file)
 {
struct video_device *vdev = video_devdata(file);
struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
+   struct v4l2_fh *vfh;
+   int ret;
 
if (!sd-initialized)
return -EAGAIN;
 
+   if (sd-flags  V4L2_SUBDEV_FL_HAS_EVENTS) {
+   vfh = kzalloc(sizeof(*vfh), GFP_KERNEL);
+   if (vfh == NULL)
+   return -ENOMEM;
+
+   ret = v4l2_fh_init(vfh, vdev);
+   if (ret)
+   goto err;
+
+   ret = v4l2_event_init(vfh);
+   if (ret)
+   goto err;
+
+   ret = v4l2_event_alloc(vfh, sd-nevents);
+   if (ret)
+   goto err;
+
+   v4l2_fh_add(vfh);
+   file-private_data = vfh;
+   }
+
return 0;
+
+err:
+   if (vfh != NULL) {
+   v4l2_fh_exit(vfh);
+   kfree(vfh);
+   }
+
+   return ret;
 }
 
 static int subdev_close(struct file *file)
 {
+   struct v4l2_fh *vfh = file-private_data;
+
+   if (vfh != NULL) {
+   v4l2_fh_del(vfh);
+   v4l2_fh_exit(vfh);
+   kfree(vfh);
+   }
+
return 0;
 }
 
@@ -47,6 +89,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
 {
struct video_device *vdev = video_devdata(file);
struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
+   struct v4l2_fh *fh = file-private_data;
 
switch (cmd) {
case VIDIOC_QUERYCTRL:
@@ -70,6 +113,18 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
case VIDIOC_TRY_EXT_CTRLS:
return v4l2_subdev_call(sd, core, try_ext_ctrls, arg);
 
+   case VIDIOC_DQEVENT:
+   if (!(sd-flags  V4L2_SUBDEV_FL_HAS_EVENTS))
+   return -ENOIOCTLCMD;
+
+   return v4l2_event_dequeue(fh, arg, file-f_flags  O_NONBLOCK);
+
+   case VIDIOC_SUBSCRIBE_EVENT:
+   return v4l2_subdev_call(sd, core, subscribe_event, fh, arg);
+
+   case VIDIOC_UNSUBSCRIBE_EVENT:
+   return v4l2_subdev_call(sd, core, unsubscribe_event, fh, arg);
+
default:
return -ENOIOCTLCMD;
}
@@ -83,11 +138,29 @@ static long subdev_ioctl(struct file *file, unsigned int 
cmd,
return __video_usercopy(file, cmd, arg, subdev_do_ioctl);
 }
 
+static unsigned int subdev_poll(struct file *file, poll_table *wait)
+{
+   struct video_device *vdev = video_devdata(file);
+   struct v4l2_subdev *sd 

[RFC/PATCH v4 5/7] v4l: subdev: Uninline the v4l2_subdev_init function

2010-11-24 Thread Laurent Pinchart
The function isn't small or performance sensitive enough to be inlined.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/v4l2-subdev.c |   42 +---
 include/media/v4l2-subdev.h   |   16 +
 2 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/drivers/media/video/v4l2-subdev.c 
b/drivers/media/video/v4l2-subdev.c
index 00bd4b1..0deff78 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -1,22 +1,23 @@
 /*
- *  V4L2 subdevice support.
+ * V4L2 sub-device
  *
- *  Copyright (C) 2010 Nokia Corporation
+ * Copyright (C) 2010 Nokia Corporation
  *
- *  Contact: Laurent Pinchart laurent.pinch...@ideasonboard.com
+ * Contact: Laurent Pinchart laurent.pinch...@ideasonboard.com
+ * Sakari Ailus sakari.ai...@maxwell.research.nokia.com
  *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation.
+ * 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.
  *
- *  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.
+ * 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 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
+ * You should have received a copy of the GNU 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
  */
 
 #include linux/types.h
@@ -64,3 +65,18 @@ const struct v4l2_file_operations v4l2_subdev_fops = {
.unlocked_ioctl = subdev_ioctl,
.release = subdev_close,
 };
+
+void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops 
*ops)
+{
+   INIT_LIST_HEAD(sd-list);
+   BUG_ON(!ops);
+   sd-ops = ops;
+   sd-v4l2_dev = NULL;
+   sd-flags = 0;
+   sd-name[0] = '\0';
+   sd-grp_id = 0;
+   sd-dev_priv = NULL;
+   sd-host_priv = NULL;
+   sd-initialized = 1;
+}
+EXPORT_SYMBOL(v4l2_subdev_init);
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index de181db..90022f5 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -473,20 +473,8 @@ static inline void *v4l2_get_subdev_hostdata(const struct 
v4l2_subdev *sd)
return sd-host_priv;
 }
 
-static inline void v4l2_subdev_init(struct v4l2_subdev *sd,
-   const struct v4l2_subdev_ops *ops)
-{
-   INIT_LIST_HEAD(sd-list);
-   BUG_ON(!ops);
-   sd-ops = ops;
-   sd-v4l2_dev = NULL;
-   sd-flags = 0;
-   sd-name[0] = '\0';
-   sd-grp_id = 0;
-   sd-dev_priv = NULL;
-   sd-host_priv = NULL;
-   sd-initialized = 1;
-}
+void v4l2_subdev_init(struct v4l2_subdev *sd,
+ const struct v4l2_subdev_ops *ops);
 
 /* Call an ops of a v4l2_subdev, doing the right checks against
NULL pointers.
-- 
1.7.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v4 6/7] v4l: subdev: Control ioctls support

2010-11-24 Thread Laurent Pinchart
Pass the control-related ioctls to the subdev driver through the core
operations.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/video4linux/v4l2-framework.txt |   16 
 drivers/media/video/v4l2-subdev.c|   24 
 2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index 4c9185a..f683f63 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -336,6 +336,22 @@ argument to 0. Setting the argument to 1 will only enable 
device node
 registration if the sub-device driver has set the V4L2_SUBDEV_FL_HAS_DEVNODE
 flag.
 
+The device node handles a subset of the V4L2 API.
+
+VIDIOC_QUERYCTRL
+VIDIOC_QUERYMENU
+VIDIOC_G_CTRL
+VIDIOC_S_CTRL
+VIDIOC_G_EXT_CTRLS
+VIDIOC_S_EXT_CTRLS
+VIDIOC_TRY_EXT_CTRLS
+
+   The controls ioctls are identical to the ones defined in V4L2. They
+   behave identically, with the only exception that they deal only with
+   controls implemented in the sub-device. Depending on the driver, those
+   controls can be also be accessed through one (or several) V4L2 device
+   nodes.
+
 
 I2C sub-device drivers
 --
diff --git a/drivers/media/video/v4l2-subdev.c 
b/drivers/media/video/v4l2-subdev.c
index 0deff78..806ec30 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -45,7 +45,31 @@ static int subdev_close(struct file *file)
 
 static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 {
+   struct video_device *vdev = video_devdata(file);
+   struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
+
switch (cmd) {
+   case VIDIOC_QUERYCTRL:
+   return v4l2_subdev_call(sd, core, queryctrl, arg);
+
+   case VIDIOC_QUERYMENU:
+   return v4l2_subdev_call(sd, core, querymenu, arg);
+
+   case VIDIOC_G_CTRL:
+   return v4l2_subdev_call(sd, core, g_ctrl, arg);
+
+   case VIDIOC_S_CTRL:
+   return v4l2_subdev_call(sd, core, s_ctrl, arg);
+
+   case VIDIOC_G_EXT_CTRLS:
+   return v4l2_subdev_call(sd, core, g_ext_ctrls, arg);
+
+   case VIDIOC_S_EXT_CTRLS:
+   return v4l2_subdev_call(sd, core, s_ext_ctrls, arg);
+
+   case VIDIOC_TRY_EXT_CTRLS:
+   return v4l2_subdev_call(sd, core, try_ext_ctrls, arg);
+
default:
return -ENOIOCTLCMD;
}
-- 
1.7.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v6 00/12] Media controller (core and V4L2)

2010-11-24 Thread Laurent Pinchart
Hi everybody,

Here is the sixth version of the media controller core and V4L2 patches, and
the first one to be sent outside of the linux-media mailing list.

For those who haven't heard about the media controller yet, let me quote the
documentation (Documentation/DocBook/v4l/media-controller.xml).

Discovering a [media] device internal topology, and configuring it at runtime,
is one of the goals of the media controller API. To achieve this, hardware
devices are modelled as an oriented graph of building blocks called entities
connected through pads.

While originally developed to solve problems found in V4L and embedded devices,
the API aims at being useful (and hopefully used) by audio drivers as well,
especially for devices that combine video and audio capabilities.

I want to emphasize that the media controller API does *not* replace the V4L,
DVB or ALSA APIs. It complements them.

The first user of the media controller API is the OMAP3 ISP driver. You can
find it (as well as these patches and other V4L-specific patches) in a git tree
at http://git.linuxtv.org/pinchartl/media.git (media-0004-omap3isp branch). The
OMAP3 ISP driver patches are regularly posted for review on the linux-media
list.

I'm looking forward to the storm of comments that will start in response to
this e-mail. Hopefully it won't hurt (too much) :-).

Laurent Pinchart (10):
  media: Media device node support
  media: Media device
  media: Entities, pads and links
  media: Media device information query
  media: Entities, pads and links enumeration
  media: Links setup
  media: Entity locking and pipeline management
  v4l: Add a media_device pointer to the v4l2_device structure
  v4l: Make video_device inherit from media_entity
  v4l: Make v4l2_subdev inherit from media_entity

Sakari Ailus (2):
  media: Entity graph traversal
  media: Reference count and power handling

 Documentation/DocBook/media-entities.tmpl  |   24 +
 Documentation/DocBook/media.tmpl   |3 +
 Documentation/DocBook/v4l/media-controller.xml |   89 +++
 Documentation/DocBook/v4l/media-func-close.xml |   59 ++
 Documentation/DocBook/v4l/media-func-ioctl.xml |  116 
 Documentation/DocBook/v4l/media-func-open.xml  |   94 +++
 .../DocBook/v4l/media-ioc-device-info.xml  |  133 
 .../DocBook/v4l/media-ioc-enum-entities.xml|  287 +
 Documentation/DocBook/v4l/media-ioc-enum-links.xml |  202 ++
 Documentation/DocBook/v4l/media-ioc-setup-link.xml |   90 +++
 Documentation/media-framework.txt  |  380 +++
 Documentation/video4linux/v4l2-framework.txt   |   72 ++-
 drivers/media/Kconfig  |   13 +
 drivers/media/Makefile |   10 +-
 drivers/media/media-device.c   |  379 +++
 drivers/media/media-devnode.c  |  321 +
 drivers/media/media-entity.c   |  680 
 drivers/media/video/v4l2-dev.c |   47 ++-
 drivers/media/video/v4l2-device.c  |   52 ++-
 drivers/media/video/v4l2-subdev.c  |   41 ++-
 include/linux/Kbuild   |1 +
 include/linux/media.h  |  127 
 include/media/media-device.h   |   92 +++
 include/media/media-devnode.h  |   97 +++
 include/media/media-entity.h   |  144 +
 include/media/v4l2-dev.h   |7 +
 include/media/v4l2-device.h|4 +
 include/media/v4l2-subdev.h|   10 +
 28 files changed, 3547 insertions(+), 27 deletions(-)
 create mode 100644 Documentation/DocBook/v4l/media-controller.xml
 create mode 100644 Documentation/DocBook/v4l/media-func-close.xml
 create mode 100644 Documentation/DocBook/v4l/media-func-ioctl.xml
 create mode 100644 Documentation/DocBook/v4l/media-func-open.xml
 create mode 100644 Documentation/DocBook/v4l/media-ioc-device-info.xml
 create mode 100644 Documentation/DocBook/v4l/media-ioc-enum-entities.xml
 create mode 100644 Documentation/DocBook/v4l/media-ioc-enum-links.xml
 create mode 100644 Documentation/DocBook/v4l/media-ioc-setup-link.xml
 create mode 100644 Documentation/media-framework.txt
 create mode 100644 drivers/media/media-device.c
 create mode 100644 drivers/media/media-devnode.c
 create mode 100644 drivers/media/media-entity.c
 create mode 100644 include/linux/media.h
 create mode 100644 include/media/media-device.h
 create mode 100644 include/media/media-devnode.h
 create mode 100644 include/media/media-entity.h

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v6 01/12] media: Media device node support

2010-11-24 Thread Laurent Pinchart
The media_devnode structure provides support for registering and
unregistering character devices using a dynamic major number. Reference
counting is handled internally, making device drivers easier to write
without having to solve the open/disconnect race condition issue over
and over again.

The code is based on video/v4l2-dev.c.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/Kconfig |   13 ++
 drivers/media/Makefile|   10 +-
 drivers/media/media-devnode.c |  321 +
 include/media/media-devnode.h |   97 +
 4 files changed, 439 insertions(+), 2 deletions(-)
 create mode 100644 drivers/media/media-devnode.c
 create mode 100644 include/media/media-devnode.h

diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index a28541b..6b946e6 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -14,6 +14,19 @@ if MEDIA_SUPPORT
 comment Multimedia core support
 
 #
+# Media controller
+#
+
+config MEDIA_CONTROLLER
+   bool Media Controller API (EXPERIMENTAL)
+   depends on EXPERIMENTAL
+   ---help---
+ Enable the media controller API used to query media devices internal
+ topology and configure it dynamically.
+
+ This API is mostly used by camera interfaces in embedded platforms.
+
+#
 # V4L core and enabled API's
 #
 
diff --git a/drivers/media/Makefile b/drivers/media/Makefile
index 499b081..3a08991 100644
--- a/drivers/media/Makefile
+++ b/drivers/media/Makefile
@@ -2,7 +2,13 @@
 # Makefile for the kernel multimedia device drivers.
 #
 
+media-objs := media-devnode.o
+
+ifeq ($(CONFIG_MEDIA_CONTROLLER),y)
+  obj-$(CONFIG_MEDIA_SUPPORT) += media.o
+endif
+
 obj-y += common/ IR/ video/
 
-obj-$(CONFIG_VIDEO_DEV) += radio/
-obj-$(CONFIG_DVB_CORE)  += dvb/
+obj-$(CONFIG_VIDEO_DEV)+= radio/
+obj-$(CONFIG_DVB_CORE) += dvb/
diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c
new file mode 100644
index 000..7804b70
--- /dev/null
+++ b/drivers/media/media-devnode.c
@@ -0,0 +1,321 @@
+/*
+ * Media device node
+ *
+ * Copyright (C) 2010 Nokia Corporation
+ *
+ * Based on drivers/media/video/v4l2_dev.c code authored by
+ * Mauro Carvalho Chehab mche...@infradead.org (version 2)
+ * Alan Cox, a...@lxorguk.ukuu.org.uk (version 1)
+ *
+ * Contacts: Laurent Pinchart laurent.pinch...@ideasonboard.com
+ *  Sakari Ailus sakari.ai...@maxwell.research.nokia.com
+ *
+ * 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.
+ *
+ * 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 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
+ *
+ * --
+ *
+ * Generic media device node infrastructure to register and unregister
+ * character devices using a dynamic major number and proper reference
+ * counting.
+ */
+
+#include linux/errno.h
+#include linux/init.h
+#include linux/module.h
+#include linux/kernel.h
+#include linux/kmod.h
+#include linux/slab.h
+#include linux/mm.h
+#include linux/smp_lock.h
+#include linux/string.h
+#include linux/types.h
+#include linux/uaccess.h
+#include asm/system.h
+
+#include media/media-devnode.h
+
+#define MEDIA_NUM_DEVICES  256
+#define MEDIA_NAME media
+
+static dev_t media_dev_t;
+
+/*
+ * Active devices
+ */
+static DEFINE_MUTEX(media_devnode_lock);
+static DECLARE_BITMAP(media_devnode_nums, MEDIA_NUM_DEVICES);
+
+/* Called when the last user of the media device exits. */
+static void media_devnode_release(struct device *cd)
+{
+   struct media_devnode *mdev = to_media_devnode(cd);
+
+   mutex_lock(media_devnode_lock);
+
+   /* Delete the cdev on this minor as well */
+   cdev_del(mdev-cdev);
+
+   /* Mark device node number as free */
+   clear_bit(mdev-minor, media_devnode_nums);
+
+   mutex_unlock(media_devnode_lock);
+
+   /* Release media_devnode and perform other cleanups as needed. */
+   if (mdev-release)
+   mdev-release(mdev);
+}
+
+static struct bus_type media_bus_type = {
+   .name = MEDIA_NAME,
+};
+
+static ssize_t media_read(struct file *filp, char __user *buf,
+   size_t sz, loff_t *off)
+{
+   struct media_devnode *mdev = media_devnode_data(filp);
+
+   if (!mdev-fops-read)
+   return -EINVAL;
+   if (!media_devnode_is_registered(mdev))
+   return -EIO;
+   return mdev-fops-read(filp, buf, sz, off);
+}
+
+static ssize_t media_write(struct file *filp, 

[RFC/PATCH v6 02/12] media: Media device

2010-11-24 Thread Laurent Pinchart
The media_device structure abstracts functions common to all kind of
media devices (v4l2, dvb, alsa, ...). It manages media entities and
offers a userspace API to discover and configure the media device
internal topology.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/DocBook/media-entities.tmpl  |2 +
 Documentation/DocBook/media.tmpl   |3 +
 Documentation/DocBook/v4l/media-controller.xml |   56 +
 Documentation/media-framework.txt  |   68 
 drivers/media/Makefile |2 +-
 drivers/media/media-device.c   |  100 
 include/media/media-device.h   |   66 
 7 files changed, 296 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/DocBook/v4l/media-controller.xml
 create mode 100644 Documentation/media-framework.txt
 create mode 100644 drivers/media/media-device.c
 create mode 100644 include/media/media-device.h

diff --git a/Documentation/DocBook/media-entities.tmpl 
b/Documentation/DocBook/media-entities.tmpl
index be34dcb..61d6f11 100644
--- a/Documentation/DocBook/media-entities.tmpl
+++ b/Documentation/DocBook/media-entities.tmpl
@@ -321,6 +321,8 @@
 !ENTITY sub-media-entities SYSTEM media-entities.tmpl
 !ENTITY sub-media-indices SYSTEM media-indices.tmpl
 
+!ENTITY sub-media-controller SYSTEM v4l/media-controller.xml
+
 !-- Function Reference --
 !ENTITY close SYSTEM v4l/func-close.xml
 !ENTITY ioctl SYSTEM v4l/func-ioctl.xml
diff --git a/Documentation/DocBook/media.tmpl b/Documentation/DocBook/media.tmpl
index f11048d..73464b0 100644
--- a/Documentation/DocBook/media.tmpl
+++ b/Documentation/DocBook/media.tmpl
@@ -106,6 +106,9 @@ Foundation. A copy of the license is included in the 
chapter entitled
 sub-remote_controllers;
 /chapter
 /part
+part id=media_common
+sub-media-controller;
+/part
 
 sub-fdl-appendix;
 
diff --git a/Documentation/DocBook/v4l/media-controller.xml 
b/Documentation/DocBook/v4l/media-controller.xml
new file mode 100644
index 000..253ddb4
--- /dev/null
+++ b/Documentation/DocBook/v4l/media-controller.xml
@@ -0,0 +1,56 @@
+partinfo
+  authorgroup
+author
+  firstnameLaurent/firstname
+  surnamePinchart/surname
+  
affiliationaddressemaillaurent.pinch...@ideasonboard.com/email/address/affiliation
+  contribInitial version./contrib
+/author
+  /authorgroup
+  copyright
+year2010/year
+holderLaurent Pinchart/holder
+  /copyright
+
+  revhistory
+!-- Put document revisions here, newest first. --
+revision
+  revnumber1.0.0/revnumber
+  date2010-11-10/date
+  authorinitialslp/authorinitials
+  revremarkInitial revision/revremark
+/revision
+  /revhistory
+/partinfo
+
+titleMedia Controller API/title
+
+chapter id=media_controller
+  titleMedia Controller/title
+
+  section id=media-controller-intro
+titleIntroduction/title
+paraMedia devices increasingly handle multiple related functions. Many 
USB
+cameras include microphones, video capture hardware can also output video,
+or SoC camera interfaces also perform memory-to-memory operations similar 
to
+video codecs./para
+paraIndependent functions, even when implemented in the same hardware, 
can
+be modelled as separate devices. A USB camera with a microphone will be
+presented to userspace applications as V4L2 and ALSA capture devices. The
+devices' relationships (when using a webcam, end-users shouldn't have to
+manually select the associated USB microphone), while not made available
+directly to applications by the drivers, can usually be retrieved from
+sysfs./para
+paraWith more and more advanced SoC devices being introduced, the current
+approach will not scale. Device topologies are getting increasingly complex
+and can't always be represented by a tree structure. Hardware blocks are
+shared between different functions, creating dependencies between seemingly
+unrelated devices./para
+paraKernel abstraction APIs such as V4L2 and ALSA provide means for
+applications to access hardware parameters. As newer hardware expose an
+increasingly high number of those parameters, drivers need to guess what
+applications really require based on limited information, thereby
+implementing policies that belong to userspace./para
+paraThe media controller API aims at solving those problems./para
+  /section
+/chapter
diff --git a/Documentation/media-framework.txt 
b/Documentation/media-framework.txt
new file mode 100644
index 000..84fa43a
--- /dev/null
+++ b/Documentation/media-framework.txt
@@ -0,0 +1,68 @@
+Linux kernel media framework
+
+
+This document describes the Linux kernel media framework, its data structures,
+functions and their usage.
+
+
+Introduction
+
+
+The media controller API is documented in DocBook format in

[RFC/PATCH v6 03/12] media: Entities, pads and links

2010-11-24 Thread Laurent Pinchart
As video hardware pipelines become increasingly complex and
configurable, the current hardware description through v4l2 subdevices
reaches its limits. In addition to enumerating and configuring
subdevices, video camera drivers need a way to discover and modify at
runtime how those subdevices are connected. This is done through new
elements called entities, pads and links.

An entity is a basic media hardware building block. It can correspond to
a large variety of logical blocks such as physical hardware devices
(CMOS sensor for instance), logical hardware devices (a building block
in a System-on-Chip image processing pipeline), DMA channels or physical
connectors.

A pad is a connection endpoint through which an entity can interact with
other entities. Data (not restricted to video) produced by an entity
flows from the entity's output to one or more entity inputs. Pads should
not be confused with physical pins at chip boundaries.

A link is a point-to-point oriented connection between two pads, either
on the same entity or on different entities. Data flows from a source
pad to a sink pad.

Links are stored in the source entity. To make backwards graph walk
faster, a copy of all links is also stored in the sink entity. The copy
is known as a backlink and is only used to help graph traversal.

The entity API is made of three functions:

- media_entity_init() initializes an entity. The caller must provide an
array of pads as well as an estimated number of links. The links array
is allocated dynamically and will be reallocated if it grows beyond the
initial estimate.

- media_entity_cleanup() frees resources allocated for an entity. It
must be called during the cleanup phase after unregistering the entity
and before freeing it.

- media_entity_create_link() creates a link between two entities. An
entry in the link array of each entity is allocated and stores pointers
to source and sink pads.

When a media device is unregistered, all its entities are unregistered
automatically.

The code is based on Hans Verkuil hverk...@xs4all.nl initial work.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Sakari Ailus sakari.ai...@maxwell.research.nokia.com
---
 Documentation/DocBook/v4l/media-controller.xml |   20 +++
 Documentation/media-framework.txt  |  149 
 drivers/media/Makefile |2 +-
 drivers/media/media-device.c   |   53 +
 drivers/media/media-entity.c   |  147 +++
 include/media/media-device.h   |   19 +++
 include/media/media-entity.h   |  118 +++
 7 files changed, 507 insertions(+), 1 deletions(-)
 create mode 100644 drivers/media/media-entity.c
 create mode 100644 include/media/media-entity.h

diff --git a/Documentation/DocBook/v4l/media-controller.xml 
b/Documentation/DocBook/v4l/media-controller.xml
index 253ddb4..f89228d 100644
--- a/Documentation/DocBook/v4l/media-controller.xml
+++ b/Documentation/DocBook/v4l/media-controller.xml
@@ -53,4 +53,24 @@
 implementing policies that belong to userspace./para
 paraThe media controller API aims at solving those problems./para
   /section
+
+  section id=media-controller-model
+titleMedia device model/title
+paraDiscovering a device internal topology, and configuring it at 
runtime,
+is one of the goals of the media controller API. To achieve this, hardware
+devices are modelled as an oriented graph of building blocks called 
entities
+connected through pads./para
+paraAn entity is a basic media hardware or software building block. It 
can
+correspond to a large variety of logical blocks such as physical hardware
+devices (CMOS sensor for instance), logical hardware devices (a building
+block in a System-on-Chip image processing pipeline), DMA channels or
+physical connectors./para
+paraA pad is a connection endpoint through which an entity can interact
+with other entities. Data (not restricted to video) produced by an entity
+flows from the entity's output to one or more entity inputs. Pads should 
not
+be confused with physical pins at chip boundaries./para
+paraA link is a point-to-point oriented connection between two pads,
+either on the same entity or on different entities. Data flows from a 
source
+pad to a sink pad./para
+  /section
 /chapter
diff --git a/Documentation/media-framework.txt 
b/Documentation/media-framework.txt
index 84fa43a..0332162 100644
--- a/Documentation/media-framework.txt
+++ b/Documentation/media-framework.txt
@@ -13,6 +13,30 @@ Documentation/DocBook/v4l/media-controller.xml. This 
document will focus on
 the kernel-side implementation of the media framework.
 
 
+Abstract media device model
+---
+
+Discovering a device internal topology, and configuring it at runtime, is one
+of the goals of the media framework. To achieve this, 

[RFC/PATCH v6 05/12] media: Reference count and power handling

2010-11-24 Thread Laurent Pinchart
From: Sakari Ailus sakari.ai...@maxwell.research.nokia.com

Basically these are the interface functions:

media_entity_get() - acquire entity
media_entity_put() - release entity

If the entity is of node type, the power change is distributed to
all connected entities. For non-nodes it only affects that very
node. A mutex is used to serialise access to the entity graph.

In the background there's a depth-first search algorithm that traverses the
active links in the graph. All these functions parse the graph to implement
whatever they're to do.

The module counters are increased/decreased in media_entity_get/put to
prevent module unloading when an entity is referenced.

Signed-off-by: Sakari Ailus sakari.ai...@maxwell.research.nokia.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Stanimir Varbanov svarba...@mm-sol.com
---
 Documentation/media-framework.txt |   37 +
 drivers/media/media-device.c  |1 +
 drivers/media/media-entity.c  |  146 +
 include/media/media-device.h  |4 +
 include/media/media-entity.h  |   15 
 5 files changed, 203 insertions(+), 0 deletions(-)

diff --git a/Documentation/media-framework.txt 
b/Documentation/media-framework.txt
index 27a38a1..9fdbc50 100644
--- a/Documentation/media-framework.txt
+++ b/Documentation/media-framework.txt
@@ -257,3 +257,40 @@ When the graph traversal is complete the function will 
return NULL.
 Graph traversal can be interrupted at any moment. No cleanup function call is
 required and the graph structure can be freed normally.
 
+
+Reference counting and power handling
+-
+
+Before accessing type-specific entities operations (such as the V4L2
+sub-device operations), drivers must acquire a reference to the entity. This
+ensures that the entity will be powered on and ready to accept requests.
+Similarly, after being done with an entity, drivers must release the
+reference.
+
+   media_entity_get(struct media_entity *entity)
+
+The function will increase the entity reference count. If the entity is a node
+(MEDIA_ENTITY_TYPE_NODE type), the reference count of all entities it is
+connected to, both directly or indirectly, through active links is increased.
+This ensures that the whole media pipeline will be ready to process
+
+Acquiring a reference to an entity increases the media device module reference
+count to prevent module unloading when an entity is being used.
+
+media_entity_get will return a pointer to the entity if successful, or NULL
+otherwise.
+
+   media_entity_put(struct media_entity *entity)
+
+The function will decrease the entity reference count and, for node entities,
+like media_entity_get, the reference count of all connected entities. Calling
+media_entity_put with a NULL argument is valid and will return immediately.
+
+When the first reference to an entity is acquired, or the last reference
+released, the entity's set_power operation is called. Entity drivers must
+implement the operation if they need to perform any power management task,
+such as turning powers or clocks on or off. If no power management is
+required, drivers don't need to provide a set_power operation. The operation
+is allowed to fail when turning power on, in which case the media_entity_get
+function will return NULL.
+
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 2163610..52e5985 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -73,6 +73,7 @@ int __must_check media_device_register(struct media_device 
*mdev)
mdev-entity_id = 1;
INIT_LIST_HEAD(mdev-entities);
spin_lock_init(mdev-lock);
+   mutex_init(mdev-graph_mutex);
 
/* Register the device node. */
mdev-devnode.fops = media_device_fops;
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 6230f74..c15f16b 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -23,6 +23,7 @@
 #include linux/module.h
 #include linux/slab.h
 #include media/media-entity.h
+#include media/media-device.h
 
 /**
  * media_entity_init - Initialize a media entity
@@ -196,6 +197,151 @@ media_entity_graph_walk_next(struct media_entity_graph 
*graph)
 EXPORT_SYMBOL_GPL(media_entity_graph_walk_next);
 
 /* 
-
+ * Power state handling
+ */
+
+/* Apply use count to an entity. */
+static void media_entity_use_apply_one(struct media_entity *entity, int change)
+{
+   entity-use_count += change;
+   WARN_ON(entity-use_count  0);
+}
+
+/*
+ * Apply use count change to an entity and change power state based on
+ * new use count.
+ */
+static int media_entity_power_apply_one(struct media_entity *entity, int 
change)
+{
+   int ret;
+
+   if (entity-use_count == 0  change  0 
+   entity-ops  entity-ops-set_power) {
+ 

[RFC/PATCH v6 06/12] media: Media device information query

2010-11-24 Thread Laurent Pinchart
Create the following ioctl and implement it at the media device level to
query device information.

- MEDIA_IOC_DEVICE_INFO: Query media device information

The ioctl and its data structure are defined in the new kernel header
linux/media.h available to userspace applications.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/DocBook/media-entities.tmpl  |   12 ++
 Documentation/DocBook/v4l/media-controller.xml |   10 ++
 Documentation/DocBook/v4l/media-func-close.xml |   59 +
 Documentation/DocBook/v4l/media-func-ioctl.xml |  116 +
 Documentation/DocBook/v4l/media-func-open.xml  |   94 ++
 .../DocBook/v4l/media-ioc-device-info.xml  |  132 
 drivers/media/media-device.c   |   57 +
 include/linux/Kbuild   |1 +
 include/linux/media.h  |   45 +++
 include/media/media-device.h   |3 +
 10 files changed, 529 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/DocBook/v4l/media-func-close.xml
 create mode 100644 Documentation/DocBook/v4l/media-func-ioctl.xml
 create mode 100644 Documentation/DocBook/v4l/media-func-open.xml
 create mode 100644 Documentation/DocBook/v4l/media-ioc-device-info.xml
 create mode 100644 include/linux/media.h

diff --git a/Documentation/DocBook/media-entities.tmpl 
b/Documentation/DocBook/media-entities.tmpl
index 61d6f11..6af3375 100644
--- a/Documentation/DocBook/media-entities.tmpl
+++ b/Documentation/DocBook/media-entities.tmpl
@@ -11,6 +11,10 @@
 !ENTITY func-select link 
linkend='func-select'functionselect()/function/link
 !ENTITY func-write link 
linkend='func-write'functionwrite()/function/link
 
+!ENTITY media-func-close link 
linkend='media-func-close'functionclose()/function/link
+!ENTITY media-func-ioctl link 
linkend='media-func-ioctl'functionioctl()/function/link
+!ENTITY media-func-open link 
linkend='media-func-open'functionopen()/function/link
+
 !-- Ioctls --
 !ENTITY VIDIOC-CROPCAP link 
linkend='vidioc-cropcap'constantVIDIOC_CROPCAP/constant/link
 !ENTITY VIDIOC-DBG-G-CHIP-IDENT link 
linkend='vidioc-dbg-g-chip-ident'constantVIDIOC_DBG_G_CHIP_IDENT/constant/link
@@ -87,6 +91,8 @@
 !ENTITY VIDIOC-TRY-FMT link 
linkend='vidioc-g-fmt'constantVIDIOC_TRY_FMT/constant/link
 !ENTITY VIDIOC-UNSUBSCRIBE-EVENT link 
linkend='vidioc-subscribe-event'constantVIDIOC_UNSUBSCRIBE_EVENT/constant/link
 
+!ENTITY MEDIA-IOC-DEVICE-INFO link 
linkend='media-ioc-device-info'constantMEDIA_IOC_DEVICE_INFO/constant/link
+
 !-- Types --
 !ENTITY v4l2-std-id link linkend='v4l2-std-id'v4l2_std_id/link
 
@@ -181,6 +187,8 @@
 !ENTITY v4l2-vbi-format structnbsp;link 
linkend='v4l2-vbi-format'v4l2_vbi_format/link
 !ENTITY v4l2-window structnbsp;link 
linkend='v4l2-window'v4l2_window/link
 
+!ENTITY media-device-info structnbsp;link 
linkend='media-device-info'media_device_info/link
+
 !-- Error Codes --
 !ENTITY EACCES errorcodeEACCES/errorcode error code
 !ENTITY EAGAIN errorcodeEAGAIN/errorcode error code
@@ -322,6 +330,10 @@
 !ENTITY sub-media-indices SYSTEM media-indices.tmpl
 
 !ENTITY sub-media-controller SYSTEM v4l/media-controller.xml
+!ENTITY sub-media-open SYSTEM v4l/media-func-open.xml
+!ENTITY sub-media-close SYSTEM v4l/media-func-close.xml
+!ENTITY sub-media-ioctl SYSTEM v4l/media-func-ioctl.xml
+!ENTITY sub-media-ioc-device-info SYSTEM v4l/media-ioc-device-info.xml
 
 !-- Function Reference --
 !ENTITY close SYSTEM v4l/func-close.xml
diff --git a/Documentation/DocBook/v4l/media-controller.xml 
b/Documentation/DocBook/v4l/media-controller.xml
index f89228d..a46b786 100644
--- a/Documentation/DocBook/v4l/media-controller.xml
+++ b/Documentation/DocBook/v4l/media-controller.xml
@@ -74,3 +74,13 @@
 pad to a sink pad./para
   /section
 /chapter
+
+appendix id=media-user-func
+  titleFunction Reference/title
+  !-- Keep this alphabetically sorted. --
+  sub-media-open;
+  sub-media-close;
+  sub-media-ioctl;
+  !-- All ioctls go here. --
+  sub-media-ioc-device-info;
+/appendix
diff --git a/Documentation/DocBook/v4l/media-func-close.xml 
b/Documentation/DocBook/v4l/media-func-close.xml
new file mode 100644
index 000..be149c8
--- /dev/null
+++ b/Documentation/DocBook/v4l/media-func-close.xml
@@ -0,0 +1,59 @@
+refentry id=media-func-close
+  refmeta
+refentrytitlemedia close()/refentrytitle
+manvol;
+  /refmeta
+
+  refnamediv
+refnamemedia-close/refname
+refpurposeClose a media device/refpurpose
+  /refnamediv
+
+  refsynopsisdiv
+funcsynopsis
+  funcsynopsisinfo#include lt;unistd.hgt;/funcsynopsisinfo
+  funcprototype
+   funcdefint functionclose/function/funcdef
+   paramdefint parameterfd/parameter/paramdef
+  /funcprototype
+/funcsynopsis
+  /refsynopsisdiv
+
+  refsect1
+titleArguments/title
+
+variablelist
+  varlistentry
+   termparameterfd/parameter/term
+   

[RFC/PATCH v6 07/12] media: Entities, pads and links enumeration

2010-11-24 Thread Laurent Pinchart
Create the following two ioctls and implement them at the media device
level to enumerate entities, pads and links.

- MEDIA_IOC_ENUM_ENTITIES: Enumerate entities and their properties
- MEDIA_IOC_ENUM_LINKS: Enumerate all pads and links for a given entity

Entity IDs can be non-contiguous. Userspace applications should
enumerate entities using the MEDIA_ENTITY_ID_FLAG_NEXT flag. When the
flag is set in the entity ID, the MEDIA_IOC_ENUM_ENTITIES will return
the next entity with an ID bigger than the requested one.

Only forward links that originate at one of the entity's source pads are
returned during the enumeration process.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Sakari Ailus sakari.ai...@maxwell.research.nokia.com
---
 Documentation/DocBook/media-entities.tmpl  |8 +
 Documentation/DocBook/v4l/media-controller.xml |2 +
 .../DocBook/v4l/media-ioc-device-info.xml  |3 +-
 .../DocBook/v4l/media-ioc-enum-entities.xml|  287 
 Documentation/DocBook/v4l/media-ioc-enum-links.xml |  202 ++
 drivers/media/media-device.c   |  123 +
 include/linux/media.h  |   81 ++
 include/media/media-entity.h   |   24 +--
 8 files changed, 706 insertions(+), 24 deletions(-)
 create mode 100644 Documentation/DocBook/v4l/media-ioc-enum-entities.xml
 create mode 100644 Documentation/DocBook/v4l/media-ioc-enum-links.xml

diff --git a/Documentation/DocBook/media-entities.tmpl 
b/Documentation/DocBook/media-entities.tmpl
index 6af3375..6e7dae4 100644
--- a/Documentation/DocBook/media-entities.tmpl
+++ b/Documentation/DocBook/media-entities.tmpl
@@ -92,6 +92,8 @@
 !ENTITY VIDIOC-UNSUBSCRIBE-EVENT link 
linkend='vidioc-subscribe-event'constantVIDIOC_UNSUBSCRIBE_EVENT/constant/link
 
 !ENTITY MEDIA-IOC-DEVICE-INFO link 
linkend='media-ioc-device-info'constantMEDIA_IOC_DEVICE_INFO/constant/link
+!ENTITY MEDIA-IOC-ENUM-ENTITIES link 
linkend='media-ioc-enum-entities'constantMEDIA_IOC_ENUM_ENTITIES/constant/link
+!ENTITY MEDIA-IOC-ENUM-LINKS link 
linkend='media-ioc-enum-links'constantMEDIA_IOC_ENUM_LINKS/constant/link
 
 !-- Types --
 !ENTITY v4l2-std-id link linkend='v4l2-std-id'v4l2_std_id/link
@@ -188,6 +190,10 @@
 !ENTITY v4l2-window structnbsp;link 
linkend='v4l2-window'v4l2_window/link
 
 !ENTITY media-device-info structnbsp;link 
linkend='media-device-info'media_device_info/link
+!ENTITY media-entity-desc structnbsp;link 
linkend='media-entity-desc'media_entity_desc/link
+!ENTITY media-links-enum structnbsp;link 
linkend='media-links-enum'media_links_enum/link
+!ENTITY media-pad-desc structnbsp;link 
linkend='media-pad-desc'media_pad_desc/link
+!ENTITY media-link-desc structnbsp;link 
linkend='media-link-desc'media_link_desc/link
 
 !-- Error Codes --
 !ENTITY EACCES errorcodeEACCES/errorcode error code
@@ -334,6 +340,8 @@
 !ENTITY sub-media-close SYSTEM v4l/media-func-close.xml
 !ENTITY sub-media-ioctl SYSTEM v4l/media-func-ioctl.xml
 !ENTITY sub-media-ioc-device-info SYSTEM v4l/media-ioc-device-info.xml
+!ENTITY sub-media-ioc-enum-entities SYSTEM v4l/media-ioc-enum-entities.xml
+!ENTITY sub-media-ioc-enum-links SYSTEM v4l/media-ioc-enum-links.xml
 
 !-- Function Reference --
 !ENTITY close SYSTEM v4l/func-close.xml
diff --git a/Documentation/DocBook/v4l/media-controller.xml 
b/Documentation/DocBook/v4l/media-controller.xml
index a46b786..2c4fd2b 100644
--- a/Documentation/DocBook/v4l/media-controller.xml
+++ b/Documentation/DocBook/v4l/media-controller.xml
@@ -83,4 +83,6 @@
   sub-media-ioctl;
   !-- All ioctls go here. --
   sub-media-ioc-device-info;
+  sub-media-ioc-enum-entities;
+  sub-media-ioc-enum-links;
 /appendix
diff --git a/Documentation/DocBook/v4l/media-ioc-device-info.xml 
b/Documentation/DocBook/v4l/media-ioc-device-info.xml
index ffd0fb8..aa25c31 100644
--- a/Documentation/DocBook/v4l/media-ioc-device-info.xml
+++ b/Documentation/DocBook/v4l/media-ioc-device-info.xml
@@ -27,7 +27,8 @@
   varlistentry
termparameterfd/parameter/term
listitem
- parafd;/para
+ paraFile descriptor returned by
+ link 
linkend='media-func-open'functionopen()/function/link./para
/listitem
   /varlistentry
   varlistentry
diff --git a/Documentation/DocBook/v4l/media-ioc-enum-entities.xml 
b/Documentation/DocBook/v4l/media-ioc-enum-entities.xml
new file mode 100644
index 000..edb1acc
--- /dev/null
+++ b/Documentation/DocBook/v4l/media-ioc-enum-entities.xml
@@ -0,0 +1,287 @@
+refentry id=media-ioc-enum-entities
+  refmeta
+refentrytitleioctl MEDIA_IOC_ENUM_ENTITIES/refentrytitle
+manvol;
+  /refmeta
+
+  refnamediv
+refnameMEDIA_IOC_ENUM_ENTITIES/refname
+refpurposeEnumerate entities and their properties/refpurpose
+  /refnamediv
+
+  refsynopsisdiv
+funcsynopsis
+  funcprototype
+   funcdefint functionioctl/function/funcdef
+   paramdefint 

[RFC/PATCH v6 08/12] media: Links setup

2010-11-24 Thread Laurent Pinchart
Create the following ioctl and implement it at the media device level to
setup links.

- MEDIA_IOC_SETUP_LINK: Modify the properties of a given link

The only property that can currently be modified is the ACTIVE link flag
to activate/deactivate a link. Links marked with the IMMUTABLE link flag
can not be activated or deactivated.

Activating and deactivating a link has effects on entities' use count.
Those changes are automatically propagated through the graph.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Stanimir Varbanov svarba...@mm-sol.com
Signed-off-by: Sakari Ailus sakari.ai...@maxwell.research.nokia.com
---
 Documentation/DocBook/media-entities.tmpl  |2 +
 Documentation/DocBook/v4l/media-controller.xml |1 +
 Documentation/DocBook/v4l/media-ioc-setup-link.xml |   90 +
 Documentation/media-framework.txt  |   49 +
 drivers/media/media-device.c   |   45 +
 drivers/media/media-entity.c   |  208 
 include/linux/media.h  |1 +
 include/media/media-entity.h   |8 +
 8 files changed, 404 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/DocBook/v4l/media-ioc-setup-link.xml

diff --git a/Documentation/DocBook/media-entities.tmpl 
b/Documentation/DocBook/media-entities.tmpl
index 6e7dae4..679c585 100644
--- a/Documentation/DocBook/media-entities.tmpl
+++ b/Documentation/DocBook/media-entities.tmpl
@@ -94,6 +94,7 @@
 !ENTITY MEDIA-IOC-DEVICE-INFO link 
linkend='media-ioc-device-info'constantMEDIA_IOC_DEVICE_INFO/constant/link
 !ENTITY MEDIA-IOC-ENUM-ENTITIES link 
linkend='media-ioc-enum-entities'constantMEDIA_IOC_ENUM_ENTITIES/constant/link
 !ENTITY MEDIA-IOC-ENUM-LINKS link 
linkend='media-ioc-enum-links'constantMEDIA_IOC_ENUM_LINKS/constant/link
+!ENTITY MEDIA-IOC-SETUP-LINK link 
linkend='media-ioc-setup-link'constantMEDIA_IOC_SETUP_LINK/constant/link
 
 !-- Types --
 !ENTITY v4l2-std-id link linkend='v4l2-std-id'v4l2_std_id/link
@@ -342,6 +343,7 @@
 !ENTITY sub-media-ioc-device-info SYSTEM v4l/media-ioc-device-info.xml
 !ENTITY sub-media-ioc-enum-entities SYSTEM v4l/media-ioc-enum-entities.xml
 !ENTITY sub-media-ioc-enum-links SYSTEM v4l/media-ioc-enum-links.xml
+!ENTITY sub-media-ioc-setup-link SYSTEM v4l/media-ioc-setup-link.xml
 
 !-- Function Reference --
 !ENTITY close SYSTEM v4l/func-close.xml
diff --git a/Documentation/DocBook/v4l/media-controller.xml 
b/Documentation/DocBook/v4l/media-controller.xml
index 2c4fd2b..2dc25e1 100644
--- a/Documentation/DocBook/v4l/media-controller.xml
+++ b/Documentation/DocBook/v4l/media-controller.xml
@@ -85,4 +85,5 @@
   sub-media-ioc-device-info;
   sub-media-ioc-enum-entities;
   sub-media-ioc-enum-links;
+  sub-media-ioc-setup-link;
 /appendix
diff --git a/Documentation/DocBook/v4l/media-ioc-setup-link.xml 
b/Documentation/DocBook/v4l/media-ioc-setup-link.xml
new file mode 100644
index 000..84323d0
--- /dev/null
+++ b/Documentation/DocBook/v4l/media-ioc-setup-link.xml
@@ -0,0 +1,90 @@
+refentry id=media-ioc-setup-link
+  refmeta
+refentrytitleioctl MEDIA_IOC_SETUP_LINK/refentrytitle
+manvol;
+  /refmeta
+
+  refnamediv
+refnameMEDIA_IOC_SETUP_LINK/refname
+refpurposeModify the properties of a link/refpurpose
+  /refnamediv
+
+  refsynopsisdiv
+funcsynopsis
+  funcprototype
+   funcdefint functionioctl/function/funcdef
+   paramdefint parameterfd/parameter/paramdef
+   paramdefint parameterrequest/parameter/paramdef
+   paramdefstruct media_link_desc *parameterargp/parameter/paramdef
+  /funcprototype
+/funcsynopsis
+  /refsynopsisdiv
+
+  refsect1
+titleArguments/title
+
+variablelist
+  varlistentry
+   termparameterfd/parameter/term
+   listitem
+ paraFile descriptor returned by
+ link 
linkend='media-func-open'functionopen()/function/link./para
+   /listitem
+  /varlistentry
+  varlistentry
+   termparameterrequest/parameter/term
+   listitem
+ paraMEDIA_IOC_ENUM_LINKS/para
+   /listitem
+  /varlistentry
+  varlistentry
+   termparameterargp/parameter/term
+   listitem
+ para/para
+   /listitem
+  /varlistentry
+/variablelist
+  /refsect1
+
+  refsect1
+titleDescription/title
+
+paraTo change link properties applications fill a media-link-desc; with
+link identification information (source and sink pad) and the new requested
+link flags. They then call the MEDIA_IOC_SETUP_LINK ioctl with a pointer to
+that structure./para
+paraThe only configurable property is the constantACTIVE/constant 
link
+flag to activate/deactivate a link. Links marked with the
+constantIMMUTABLE/constant link flag can not be activated or
+deactivated./para
+paraLink activation has no side effect on other links. If an active link
+at the sink pad prevents the link from being 

[RFC/PATCH v6 10/12] v4l: Add a media_device pointer to the v4l2_device structure

2010-11-24 Thread Laurent Pinchart
The pointer will later be used to register/unregister media entities
when registering/unregistering a v4l2_subdev or a video_device.

With the introduction of media devices, device drivers need to store a
pointer to a driver-specific structure in the device's drvdata.
v4l2_device can't claim ownership of the drvdata anymore.

To maintain compatibility with drivers that rely on v4l2_device storing
a pointer to itself in the device's drvdata, v4l2_device_register() will
keep doing so if the drvdata is NULL.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/video4linux/v4l2-framework.txt |   17 -
 drivers/media/video/v4l2-device.c|   13 +++--
 include/media/v4l2-device.h  |4 
 3 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index 4db1def..aeb2a22 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -83,11 +83,17 @@ You must register the device instance:
 
v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev);
 
-Registration will initialize the v4l2_device struct and link dev-driver_data
-to v4l2_dev. If v4l2_dev-name is empty then it will be set to a value derived
-from dev (driver name followed by the bus_id, to be precise). If you set it
-up before calling v4l2_device_register then it will be untouched. If dev is
-NULL, then you *must* setup v4l2_dev-name before calling v4l2_device_register.
+Registration will initialize the v4l2_device struct. If the dev-driver_data
+field is NULL, it will be linked to v4l2_dev. Drivers that use the media
+device framework in addition to the V4L2 framework need to set
+dev-driver_data manually to point to the driver-specific device structure
+that embed the struct v4l2_device instance. This is achieved by a
+dev_set_drvdata() call before registering the V4L2 device instance.
+
+If v4l2_dev-name is empty then it will be set to a value derived from dev
+(driver name followed by the bus_id, to be precise). If you set it up before
+calling v4l2_device_register then it will be untouched. If dev is NULL, then
+you *must* setup v4l2_dev-name before calling v4l2_device_register.
 
 You can use v4l2_device_set_name() to set the name based on a driver name and
 a driver-global atomic_t instance. This will generate names like ivtv0, ivtv1,
@@ -108,6 +114,7 @@ You unregister with:
 
v4l2_device_unregister(struct v4l2_device *v4l2_dev);
 
+If the dev-driver_data field points to v4l2_dev, it will be reset to NULL.
 Unregistering will also automatically unregister all subdevs from the device.
 
 If you have a hotpluggable device (e.g. a USB device), then when a disconnect
diff --git a/drivers/media/video/v4l2-device.c 
b/drivers/media/video/v4l2-device.c
index 318e911..8447466 100644
--- a/drivers/media/video/v4l2-device.c
+++ b/drivers/media/video/v4l2-device.c
@@ -46,9 +46,8 @@ int v4l2_device_register(struct device *dev, struct 
v4l2_device *v4l2_dev)
if (!v4l2_dev-name[0])
snprintf(v4l2_dev-name, sizeof(v4l2_dev-name), %s %s,
dev-driver-name, dev_name(dev));
-   if (dev_get_drvdata(dev))
-   v4l2_warn(v4l2_dev, Non-NULL drvdata on register\n);
-   dev_set_drvdata(dev, v4l2_dev);
+   if (!dev_get_drvdata(dev))
+   dev_set_drvdata(dev, v4l2_dev);
return 0;
 }
 EXPORT_SYMBOL_GPL(v4l2_device_register);
@@ -71,10 +70,12 @@ EXPORT_SYMBOL_GPL(v4l2_device_set_name);
 
 void v4l2_device_disconnect(struct v4l2_device *v4l2_dev)
 {
-   if (v4l2_dev-dev) {
+   if (v4l2_dev-dev == NULL)
+   return;
+
+   if (dev_get_drvdata(v4l2_dev-dev) == v4l2_dev)
dev_set_drvdata(v4l2_dev-dev, NULL);
-   v4l2_dev-dev = NULL;
-   }
+   v4l2_dev-dev = NULL;
 }
 EXPORT_SYMBOL_GPL(v4l2_device_disconnect);
 
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index 6648036..b649c74 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -21,6 +21,7 @@
 #ifndef _V4L2_DEVICE_H
 #define _V4L2_DEVICE_H
 
+#include media/media-device.h
 #include media/v4l2-subdev.h
 
 /* Each instance of a V4L2 device should create the v4l2_device struct,
@@ -39,6 +40,9 @@ struct v4l2_device {
   Note: dev might be NULL if there is no parent device
   as is the case with e.g. ISA devices. */
struct device *dev;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+   struct media_device *mdev;
+#endif
/* used to keep track of the registered subdevs */
struct list_head subdevs;
/* lock this struct; can be used by the driver as well if this
-- 
1.7.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  

[RFC/PATCH v6 11/12] v4l: Make video_device inherit from media_entity

2010-11-24 Thread Laurent Pinchart
V4L2 devices are media entities. As such they need to inherit from
(include) the media_entity structure.

When registering/unregistering the device, the media entity is
automatically registered/unregistered. The entity is acquired on device
open and released on device close.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Sakari Ailus sakari.ai...@maxwell.research.nokia.com
---
 Documentation/video4linux/v4l2-framework.txt |   38 +++--
 drivers/media/video/v4l2-dev.c   |   47 +++---
 include/media/v4l2-dev.h |7 
 3 files changed, 84 insertions(+), 8 deletions(-)

diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index aeb2a22..f231bc20 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -71,6 +71,10 @@ sub-device instances, the video_device struct stores V4L2 
device node data
 and in the future a v4l2_fh struct will keep track of filehandle instances
 (this is not yet implemented).
 
+The V4L2 framework also optionally integrates with the media framework. If a
+driver sets the struct v4l2_device mdev field, sub-devices and video nodes
+will automatically appear in the media framework as entities.
+
 
 struct v4l2_device
 --
@@ -84,11 +88,14 @@ You must register the device instance:
v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev);
 
 Registration will initialize the v4l2_device struct. If the dev-driver_data
-field is NULL, it will be linked to v4l2_dev. Drivers that use the media
-device framework in addition to the V4L2 framework need to set
+field is NULL, it will be linked to v4l2_dev.
+
+Drivers that want integration with the media device framework need to set
 dev-driver_data manually to point to the driver-specific device structure
 that embed the struct v4l2_device instance. This is achieved by a
-dev_set_drvdata() call before registering the V4L2 device instance.
+dev_set_drvdata() call before registering the V4L2 device instance. They must
+also set the struct v4l2_device mdev field to point to a properly initialized
+and registered media_device instance.
 
 If v4l2_dev-name is empty then it will be set to a value derived from dev
 (driver name followed by the bus_id, to be precise). If you set it up before
@@ -532,6 +539,21 @@ If you use v4l2_ioctl_ops, then you should set either 
.unlocked_ioctl or
 The v4l2_file_operations struct is a subset of file_operations. The main
 difference is that the inode argument is omitted since it is never used.
 
+If integration with the media framework is needed, you must initialize the
+media_entity struct embedded in the video_device struct (entity field) by
+calling media_entity_init():
+
+   struct media_pad *pad = my_vdev-pad;
+   int err;
+
+   err = media_entity_init(vdev-entity, 1, pad, 0);
+
+The pads array must have been previously initialized. There is no need to
+manually set the struct media_entity type and name fields.
+
+A reference to the entity will be automatically acquired/released when the
+video device is opened/closed.
+
 v4l2_file_operations and locking
 
 
@@ -561,6 +583,9 @@ for you.
return err;
}
 
+If the v4l2_device parent device has a non-NULL mdev field, the video device
+entity will be automatically registered with the media device.
+
 Which device is registered depends on the type argument. The following
 types exist:
 
@@ -636,6 +661,13 @@ release, of course) will return an error as well.
 When the last user of the video device node exits, then the vdev-release()
 callback is called and you can do the final cleanup there.
 
+Don't forget to cleanup the media entity associated with the video device if
+it has been initialized:
+
+   media_entity_cleanup(vdev-entity);
+
+This can be done from the release callback.
+
 
 video_device helper functions
 -
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
index 035db52..511e1ee 100644
--- a/drivers/media/video/v4l2-dev.c
+++ b/drivers/media/video/v4l2-dev.c
@@ -278,6 +278,9 @@ static int v4l2_mmap(struct file *filp, struct 
vm_area_struct *vm)
 static int v4l2_open(struct inode *inode, struct file *filp)
 {
struct video_device *vdev;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+   struct media_entity *entity = NULL;
+#endif
int ret = 0;
 
/* Check if the video device is available */
@@ -291,6 +294,16 @@ static int v4l2_open(struct inode *inode, struct file 
*filp)
/* and increase the device refcount */
video_get(vdev);
mutex_unlock(videodev_lock);
+#if defined(CONFIG_MEDIA_CONTROLLER)
+   if (vdev-v4l2_dev  vdev-v4l2_dev-mdev) {
+   entity = media_entity_get(vdev-entity);
+   if (!entity) {
+   ret = 

[RFC/PATCH v6 12/12] v4l: Make v4l2_subdev inherit from media_entity

2010-11-24 Thread Laurent Pinchart
V4L2 subdevices are media entities. As such they need to inherit from
(include) the media_entity structure.

When registering/unregistering the subdevice, the media entity is
automatically registered/unregistered. The entity is acquired on device
open and released on device close.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Sakari Ailus sakari.ai...@maxwell.research.nokia.com
---
 Documentation/video4linux/v4l2-framework.txt |   23 ++
 drivers/media/video/v4l2-device.c|   39 
 drivers/media/video/v4l2-subdev.c|   41 -
 include/media/v4l2-subdev.h  |   10 ++
 4 files changed, 104 insertions(+), 9 deletions(-)

diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index f231bc20..d0fb880 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -268,6 +268,26 @@ A sub-device driver initializes the v4l2_subdev struct 
using:
 Afterwards you need to initialize subdev-name with a unique name and set the
 module owner. This is done for you if you use the i2c helper functions.
 
+If integration with the media framework is needed, you must initialize the
+media_entity struct embedded in the v4l2_subdev struct (entity field) by
+calling media_entity_init():
+
+   struct media_pad *pads = my_sd-pads;
+   int err;
+
+   err = media_entity_init(sd-entity, npads, pads, 0);
+
+The pads array must have been previously initialized. There is no need to
+manually set the struct media_entity type and name fields, but the revision
+field must be initialized if needed.
+
+A reference to the entity will be automatically acquired/released when the
+subdev device node (if any) is opened/closed.
+
+Don't forget to cleanup the media entity before the sub-device is destroyed:
+
+   media_entity_cleanup(sd-entity);
+
 A device (bridge) driver needs to register the v4l2_subdev with the
 v4l2_device:
 
@@ -277,6 +297,9 @@ This can fail if the subdev module disappeared before it 
could be registered.
 After this function was called successfully the subdev-dev field points to
 the v4l2_device.
 
+If the v4l2_device parent device has a non-NULL mdev field, the sub-device
+entity will be automatically registered with the media device.
+
 You can unregister a sub-device using:
 
v4l2_device_unregister_subdev(sd);
diff --git a/drivers/media/video/v4l2-device.c 
b/drivers/media/video/v4l2-device.c
index 8447466..7ac4d0f 100644
--- a/drivers/media/video/v4l2-device.c
+++ b/drivers/media/video/v4l2-device.c
@@ -115,8 +115,11 @@ void v4l2_device_unregister(struct v4l2_device *v4l2_dev)
 EXPORT_SYMBOL_GPL(v4l2_device_unregister);
 
 int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
-   struct v4l2_subdev *sd)
+   struct v4l2_subdev *sd)
 {
+#if defined(CONFIG_MEDIA_CONTROLLER)
+   struct media_entity *entity = sd-entity;
+#endif
struct video_device *vdev;
int err;
 
@@ -134,7 +137,16 @@ int v4l2_device_register_subdev(struct v4l2_device 
*v4l2_dev,
err = v4l2_ctrl_add_handler(v4l2_dev-ctrl_handler, sd-ctrl_handler);
if (err)
return err;
-
+#if defined(CONFIG_MEDIA_CONTROLLER)
+   /* Register the entity. */
+   if (v4l2_dev-mdev) {
+   err = media_device_register_entity(v4l2_dev-mdev, entity);
+   if (err  0) {
+   module_put(sd-owner);
+   return err;
+   }
+   }
+#endif
sd-v4l2_dev = v4l2_dev;
spin_lock(v4l2_dev-lock);
list_add_tail(sd-list, v4l2_dev-subdevs);
@@ -149,26 +161,39 @@ int v4l2_device_register_subdev(struct v4l2_device 
*v4l2_dev,
if (sd-flags  V4L2_SUBDEV_FL_HAS_DEVNODE) {
err = __video_register_device(vdev, VFL_TYPE_SUBDEV, -1, 1,
  sd-owner);
-   if (err  0)
+   if (err  0) {
v4l2_device_unregister_subdev(sd);
+   return err;
+   }
}
-
-   return err;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+   entity-v4l.major = VIDEO_MAJOR;
+   entity-v4l.minor = vdev-minor;
+#endif
+   return 0;
 }
 EXPORT_SYMBOL_GPL(v4l2_device_register_subdev);
 
 void v4l2_device_unregister_subdev(struct v4l2_subdev *sd)
 {
+   struct v4l2_device *v4l2_dev;
+
/* return if it isn't registered */
if (sd == NULL || sd-v4l2_dev == NULL)
return;
 
-   spin_lock(sd-v4l2_dev-lock);
+   v4l2_dev = sd-v4l2_dev;
+
+   spin_lock(v4l2_dev-lock);
list_del(sd-list);
-   spin_unlock(sd-v4l2_dev-lock);
+   spin_unlock(v4l2_dev-lock);
sd-v4l2_dev = NULL;
 
module_put(sd-owner);
+#if defined(CONFIG_MEDIA_CONTROLLER)
+  

[RFC/PATCH v4 00/12] Sub-device pad-level operations

2010-11-24 Thread Laurent Pinchart
Hi everybody,

Here's the fourth version of the sub-device pad-level operations patches.
Compared to the previous version enums have been replaced by fixed-size fields
in public structures, and the patches have been rebased on top of 2.6.37-rc3.

You can find the patches in  http://git.linuxtv.org/pinchartl/media.git as
usual (media-0003-subdev-pad branch).

Antti Koskipaa (1):
  v4l: v4l2_subdev userspace crop API

Laurent Pinchart (10):
  v4l: Move the media/v4l2-mediabus.h header to include/linux
  v4l: Replace enums with fixed-sized fields in public structure
  v4l: Rename V4L2_MBUS_FMT_GREY8_1X8 to V4L2_MBUS_FMT_Y8_1X8
  v4l: Group media bus pixel codes by types and sort them
alphabetically
  v4l: Add 8-bit YUYV on 16-bit bus and SGRBG10 media bus pixel codes
  v4l: Add remaining RAW10 patterns w DPCM pixel code variants
  v4l: v4l2_subdev pad-level operations
  v4l: v4l2_subdev userspace format API - documentation binary files
  v4l: v4l2_subdev userspace format API
  v4l: v4l2_subdev userspace frame interval API

Stanimir Varbanov (1):
  v4l: Create v4l2 subdev file handle structure

 Documentation/DocBook/Makefile |5 +-
 Documentation/DocBook/media-entities.tmpl  |   26 +
 Documentation/DocBook/v4l/bayer.pdf|  Bin 0 - 12116 bytes
 Documentation/DocBook/v4l/bayer.png|  Bin 0 - 9725 bytes
 Documentation/DocBook/v4l/dev-subdev.xml   |  307 +++
 Documentation/DocBook/v4l/pipeline.pdf |  Bin 0 - 20276 bytes
 Documentation/DocBook/v4l/pipeline.png |  Bin 0 - 12130 bytes
 Documentation/DocBook/v4l/subdev-formats.xml   | 2410 
 Documentation/DocBook/v4l/v4l2.xml |7 +
 Documentation/DocBook/v4l/vidioc-streamon.xml  |9 +
 .../v4l/vidioc-subdev-enum-frame-interval.xml  |  146 ++
 .../DocBook/v4l/vidioc-subdev-enum-frame-size.xml  |  148 ++
 .../DocBook/v4l/vidioc-subdev-enum-mbus-code.xml   |  113 +
 Documentation/DocBook/v4l/vidioc-subdev-g-crop.xml |  143 ++
 Documentation/DocBook/v4l/vidioc-subdev-g-fmt.xml  |  168 ++
 .../DocBook/v4l/vidioc-subdev-g-frame-interval.xml |  135 ++
 drivers/media/Kconfig  |9 +
 drivers/media/video/mt9m001.c  |2 +-
 drivers/media/video/mt9v022.c  |4 +-
 drivers/media/video/ov6650.c   |   10 +-
 drivers/media/video/sh_mobile_csi2.c   |6 +-
 drivers/media/video/soc_mediabus.c |2 +-
 drivers/media/video/v4l2-subdev.c  |  175 ++-
 include/linux/Kbuild   |2 +
 include/linux/v4l2-mediabus.h  |  104 +
 include/linux/v4l2-subdev.h|  141 ++
 include/media/soc_mediabus.h   |3 +-
 include/media/v4l2-mediabus.h  |   61 +-
 include/media/v4l2-subdev.h|   55 +
 29 files changed, 4089 insertions(+), 102 deletions(-)
 create mode 100644 Documentation/DocBook/v4l/bayer.pdf
 create mode 100644 Documentation/DocBook/v4l/bayer.png
 create mode 100644 Documentation/DocBook/v4l/dev-subdev.xml
 create mode 100644 Documentation/DocBook/v4l/pipeline.pdf
 create mode 100644 Documentation/DocBook/v4l/pipeline.png
 create mode 100644 Documentation/DocBook/v4l/subdev-formats.xml
 create mode 100644 
Documentation/DocBook/v4l/vidioc-subdev-enum-frame-interval.xml
 create mode 100644 Documentation/DocBook/v4l/vidioc-subdev-enum-frame-size.xml
 create mode 100644 Documentation/DocBook/v4l/vidioc-subdev-enum-mbus-code.xml
 create mode 100644 Documentation/DocBook/v4l/vidioc-subdev-g-crop.xml
 create mode 100644 Documentation/DocBook/v4l/vidioc-subdev-g-fmt.xml
 create mode 100644 Documentation/DocBook/v4l/vidioc-subdev-g-frame-interval.xml
 create mode 100644 include/linux/v4l2-mediabus.h
 create mode 100644 include/linux/v4l2-subdev.h

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v4 02/12] v4l: Replace enums with fixed-sized fields in public structure

2010-11-24 Thread Laurent Pinchart
The v4l2_mbus_framefmt structure will be part of the public userspace
API and used (albeit indirectly) as an ioctl argument. As such, its size
must be fixed across userspace ABIs.

Replace the v4l2_field and v4l2_colorspace enums by __u32 fields.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/linux/v4l2-mediabus.h |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h
index a62cd64..a25e19f 100644
--- a/include/linux/v4l2-mediabus.h
+++ b/include/linux/v4l2-mediabus.h
@@ -63,16 +63,16 @@ enum v4l2_mbus_pixelcode {
  * struct v4l2_mbus_framefmt - frame format on the media bus
  * @width: frame width
  * @height:frame height
- * @code:  data format code
- * @field: used interlacing type
- * @colorspace:colorspace of the data
+ * @code:  data format code (from enum v4l2_mbus_pixelcode)
+ * @field: used interlacing type (from enum v4l2_field)
+ * @colorspace:colorspace of the data (from enum v4l2_colorspace)
  */
 struct v4l2_mbus_framefmt {
-   __u32   width;
-   __u32   height;
-   __u32   code;
-   enum v4l2_field field;
-   enum v4l2_colorspacecolorspace;
+   __u32   width;
+   __u32   height;
+   __u32   code;
+   __u32   field;
+   __u32   colorspace;
 };
 
 #endif
-- 
1.7.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v4 01/12] v4l: Move the media/v4l2-mediabus.h header to include/linux

2010-11-24 Thread Laurent Pinchart
The header defines the v4l2_mbus_framefmt structure which will be used
by the V4L2 subdevs userspace API.

Change the type of the v4l2_mbus_framefmt::code field to __u32, as enum
sizes can differ between different ABIs on the same architectures.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/linux/Kbuild  |1 +
 include/linux/v4l2-mediabus.h |   78 +
 include/media/soc_mediabus.h  |3 +-
 include/media/v4l2-mediabus.h |   61 +---
 4 files changed, 81 insertions(+), 62 deletions(-)
 create mode 100644 include/linux/v4l2-mediabus.h

diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 26e0a7f..796e1d8 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -366,6 +366,7 @@ header-y += unistd.h
 header-y += usbdevice_fs.h
 header-y += utime.h
 header-y += utsname.h
+header-y += v4l2-mediabus.h
 header-y += veth.h
 header-y += vhost.h
 header-y += videodev.h
diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h
new file mode 100644
index 000..a62cd64
--- /dev/null
+++ b/include/linux/v4l2-mediabus.h
@@ -0,0 +1,78 @@
+/*
+ * Media Bus API header
+ *
+ * Copyright (C) 2009, Guennadi Liakhovetski g.liakhovet...@gmx.de
+ *
+ * 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 __LINUX_V4L2_MEDIABUS_H
+#define __LINUX_V4L2_MEDIABUS_H
+
+#include linux/types.h
+#include linux/videodev2.h
+
+/*
+ * These pixel codes uniquely identify data formats on the media bus. Mostly
+ * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
+ * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
+ * data format is fixed. Additionally, 2X8 means that one pixel is 
transferred
+ * in two 8-bit samples, BE or LE specify in which order those samples are
+ * transferred over the bus: LE means that the least significant bits are
+ * transferred first, BE means that the most significant bits are transferred
+ * first, and PADHI and PADLO define which bits - low or high, in the
+ * incomplete high byte, are filled with padding bits.
+ */
+enum v4l2_mbus_pixelcode {
+   V4L2_MBUS_FMT_FIXED = 1,
+   V4L2_MBUS_FMT_YUYV8_2X8,
+   V4L2_MBUS_FMT_YVYU8_2X8,
+   V4L2_MBUS_FMT_UYVY8_2X8,
+   V4L2_MBUS_FMT_VYUY8_2X8,
+   V4L2_MBUS_FMT_YVYU10_2X10,
+   V4L2_MBUS_FMT_YUYV10_2X10,
+   V4L2_MBUS_FMT_YVYU10_1X20,
+   V4L2_MBUS_FMT_YUYV10_1X20,
+   V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE,
+   V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE,
+   V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE,
+   V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE,
+   V4L2_MBUS_FMT_RGB565_2X8_LE,
+   V4L2_MBUS_FMT_RGB565_2X8_BE,
+   V4L2_MBUS_FMT_BGR565_2X8_LE,
+   V4L2_MBUS_FMT_BGR565_2X8_BE,
+   V4L2_MBUS_FMT_SBGGR8_1X8,
+   V4L2_MBUS_FMT_SBGGR10_1X10,
+   V4L2_MBUS_FMT_GREY8_1X8,
+   V4L2_MBUS_FMT_Y10_1X10,
+   V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE,
+   V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE,
+   V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE,
+   V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE,
+   V4L2_MBUS_FMT_SGRBG8_1X8,
+   V4L2_MBUS_FMT_SBGGR12_1X12,
+   V4L2_MBUS_FMT_YUYV8_1_5X8,
+   V4L2_MBUS_FMT_YVYU8_1_5X8,
+   V4L2_MBUS_FMT_UYVY8_1_5X8,
+   V4L2_MBUS_FMT_VYUY8_1_5X8,
+};
+
+/**
+ * struct v4l2_mbus_framefmt - frame format on the media bus
+ * @width: frame width
+ * @height:frame height
+ * @code:  data format code
+ * @field: used interlacing type
+ * @colorspace:colorspace of the data
+ */
+struct v4l2_mbus_framefmt {
+   __u32   width;
+   __u32   height;
+   __u32   code;
+   enum v4l2_field field;
+   enum v4l2_colorspacecolorspace;
+};
+
+#endif
diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h
index 037cd7b..6243147 100644
--- a/include/media/soc_mediabus.h
+++ b/include/media/soc_mediabus.h
@@ -12,8 +12,7 @@
 #define SOC_MEDIABUS_H
 
 #include linux/videodev2.h
-
-#include media/v4l2-mediabus.h
+#include linux/v4l2-mediabus.h
 
 /**
  * enum soc_mbus_packing - data packing types on the media-bus
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
index 8e65598..971c7fa 100644
--- a/include/media/v4l2-mediabus.h
+++ b/include/media/v4l2-mediabus.h
@@ -11,66 +11,7 @@
 #ifndef V4L2_MEDIABUS_H
 #define V4L2_MEDIABUS_H
 
-/*
- * These pixel codes uniquely identify data formats on the media bus. Mostly
- * they correspond to similarly named V4L2_PIX_FMT_* formats, format 0 is
- * reserved, V4L2_MBUS_FMT_FIXED shall be used by host-client pairs, where the
- * data format is fixed. Additionally, 2X8 means that one pixel is 
transferred
- * in two 8-bit samples, BE or LE specify in 

[RFC/PATCH v4 03/12] v4l: Rename V4L2_MBUS_FMT_GREY8_1X8 to V4L2_MBUS_FMT_Y8_1X8

2010-11-24 Thread Laurent Pinchart
For consistency with the V4L2_MBUS_FMT_Y10_1X10 format.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/video/mt9m001.c|2 +-
 drivers/media/video/mt9v022.c|4 ++--
 drivers/media/video/ov6650.c |   10 +-
 drivers/media/video/sh_mobile_csi2.c |6 +++---
 drivers/media/video/soc_mediabus.c   |2 +-
 include/linux/v4l2-mediabus.h|2 +-
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c
index fcb4cd9..3aaedf6 100644
--- a/drivers/media/video/mt9m001.c
+++ b/drivers/media/video/mt9m001.c
@@ -79,7 +79,7 @@ static const struct mt9m001_datafmt mt9m001_colour_fmts[] = {
 static const struct mt9m001_datafmt mt9m001_monochrome_fmts[] = {
/* Order important - see above */
{V4L2_MBUS_FMT_Y10_1X10, V4L2_COLORSPACE_JPEG},
-   {V4L2_MBUS_FMT_GREY8_1X8, V4L2_COLORSPACE_JPEG},
+   {V4L2_MBUS_FMT_Y8_1X8, V4L2_COLORSPACE_JPEG},
 };
 
 struct mt9m001 {
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c
index b96171c..56dd4fc 100644
--- a/drivers/media/video/mt9v022.c
+++ b/drivers/media/video/mt9v022.c
@@ -95,7 +95,7 @@ static const struct mt9v022_datafmt mt9v022_colour_fmts[] = {
 static const struct mt9v022_datafmt mt9v022_monochrome_fmts[] = {
/* Order important - see above */
{V4L2_MBUS_FMT_Y10_1X10, V4L2_COLORSPACE_JPEG},
-   {V4L2_MBUS_FMT_GREY8_1X8, V4L2_COLORSPACE_JPEG},
+   {V4L2_MBUS_FMT_Y8_1X8, V4L2_COLORSPACE_JPEG},
 };
 
 struct mt9v022 {
@@ -392,7 +392,7 @@ static int mt9v022_s_fmt(struct v4l2_subdev *sd,
 * icd-try_fmt(), datawidth is from our supported format list
 */
switch (mf-code) {
-   case V4L2_MBUS_FMT_GREY8_1X8:
+   case V4L2_MBUS_FMT_Y8_1X8:
case V4L2_MBUS_FMT_Y10_1X10:
if (mt9v022-model != V4L2_IDENT_MT9V022IX7ATM)
return -EINVAL;
diff --git a/drivers/media/video/ov6650.c b/drivers/media/video/ov6650.c
index cf93de9..fe8e3eb 100644
--- a/drivers/media/video/ov6650.c
+++ b/drivers/media/video/ov6650.c
@@ -207,7 +207,7 @@ static enum v4l2_mbus_pixelcode ov6650_codes[] = {
V4L2_MBUS_FMT_YVYU8_2X8,
V4L2_MBUS_FMT_VYUY8_2X8,
V4L2_MBUS_FMT_SBGGR8_1X8,
-   V4L2_MBUS_FMT_GREY8_1X8,
+   V4L2_MBUS_FMT_Y8_1X8,
 };
 
 static const struct v4l2_queryctrl ov6650_controls[] = {
@@ -800,7 +800,7 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct 
v4l2_mbus_framefmt *mf)
 
/* select color matrix configuration for given color encoding */
switch (code) {
-   case V4L2_MBUS_FMT_GREY8_1X8:
+   case V4L2_MBUS_FMT_Y8_1X8:
dev_dbg(client-dev, pixel format GREY8_1X8\n);
coma_mask |= COMA_RGB | COMA_WORD_SWAP | COMA_BYTE_SWAP;
coma_set |= COMA_BW;
@@ -846,7 +846,7 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct 
v4l2_mbus_framefmt *mf)
}
priv-code = code;
 
-   if (code == V4L2_MBUS_FMT_GREY8_1X8 ||
+   if (code == V4L2_MBUS_FMT_Y8_1X8 ||
code == V4L2_MBUS_FMT_SBGGR8_1X8) {
coml_mask = COML_ONE_CHANNEL;
coml_set = 0;
@@ -936,8 +936,8 @@ static int ov6650_try_fmt(struct v4l2_subdev *sd,
 
switch (mf-code) {
case V4L2_MBUS_FMT_Y10_1X10:
-   mf-code = V4L2_MBUS_FMT_GREY8_1X8;
-   case V4L2_MBUS_FMT_GREY8_1X8:
+   mf-code = V4L2_MBUS_FMT_Y8_1X8;
+   case V4L2_MBUS_FMT_Y8_1X8:
case V4L2_MBUS_FMT_YVYU8_2X8:
case V4L2_MBUS_FMT_YUYV8_2X8:
case V4L2_MBUS_FMT_VYUY8_2X8:
diff --git a/drivers/media/video/sh_mobile_csi2.c 
b/drivers/media/video/sh_mobile_csi2.c
index 84a6468..dd1b81b 100644
--- a/drivers/media/video/sh_mobile_csi2.c
+++ b/drivers/media/video/sh_mobile_csi2.c
@@ -56,7 +56,7 @@ static int sh_csi2_try_fmt(struct v4l2_subdev *sd,
switch (mf-code) {
case V4L2_MBUS_FMT_UYVY8_2X8:   /* YUV422 */
case V4L2_MBUS_FMT_YUYV8_1_5X8: /* YUV420 */
-   case V4L2_MBUS_FMT_GREY8_1X8:   /* RAW8 */
+   case V4L2_MBUS_FMT_Y8_1X8:  /* RAW8 */
case V4L2_MBUS_FMT_SBGGR8_1X8:
case V4L2_MBUS_FMT_SGRBG8_1X8:
break;
@@ -67,7 +67,7 @@ static int sh_csi2_try_fmt(struct v4l2_subdev *sd,
break;
case SH_CSI2I:
switch (mf-code) {
-   case V4L2_MBUS_FMT_GREY8_1X8:   /* RAW8 */
+   case V4L2_MBUS_FMT_Y8_1X8:  /* RAW8 */
case V4L2_MBUS_FMT_SBGGR8_1X8:
case V4L2_MBUS_FMT_SGRBG8_1X8:
case V4L2_MBUS_FMT_SBGGR10_1X10:/* RAW10 */
@@ -111,7 +111,7 @@ static int sh_csi2_s_fmt(struct v4l2_subdev *sd,
case V4L2_MBUS_FMT_RGB565_2X8_BE:
tmp |= 0x22;/* RGB565 */

[RFC/PATCH v4 05/12] v4l: Add 8-bit YUYV on 16-bit bus and SGRBG10 media bus pixel codes

2010-11-24 Thread Laurent Pinchart
Add the following media bus format code definitions:

- V4L2_MBUS_FMT_SGRBG10_1X10 for 10-bit GRBG Bayer
- V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 for 10-bit DPCM compressed GRBG Bayer
- V4L2_MBUS_FMT_YUYV16_1X16 for 8-bit YUYV on 16-bit bus
- V4L2_MBUS_FMT_UYVY16_1X16 for 8-bit UYVY on 16-bit bus
- V4L2_MBUS_FMT_YVYU16_1X16 for 8-bit YVYU on 16-bit bus
- V4L2_MBUS_FMT_VYUY16_1X16 for 8-bit VYUY on 16-bit bus

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/linux/v4l2-mediabus.h |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h
index ed5ac25..b091366 100644
--- a/include/linux/v4l2-mediabus.h
+++ b/include/linux/v4l2-mediabus.h
@@ -47,7 +47,7 @@ enum v4l2_mbus_pixelcode {
V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
 
-   /* YUV (including grey) - next is 0x200f */
+   /* YUV (including grey) - next is 0x2013 */
V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002,
V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003,
@@ -60,17 +60,23 @@ enum v4l2_mbus_pixelcode {
V4L2_MBUS_FMT_Y10_1X10 = 0x200a,
V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b,
V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c,
+   V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f,
+   V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010,
+   V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011,
+   V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012,
V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
 
-   /* Bayer - next is 0x3009 */
+   /* Bayer - next is 0x300b */
V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001,
V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
+   V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009,
V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003,
V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004,
V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005,
V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006,
V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007,
+   V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a,
V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008,
 };
 
-- 
1.7.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v4 06/12] v4l: Add remaining RAW10 patterns w DPCM pixel code variants

2010-11-24 Thread Laurent Pinchart
This adds following formats:
- V4L2_MBUS_FMT_SRGGB10_1X10
- V4L2_MBUS_FMT_SGBRG10_1X10
- V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8
- V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8
- V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8

Signed-off-by: Sergio Aguirre saagui...@ti.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/linux/v4l2-mediabus.h |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h
index b091366..99cfd38 100644
--- a/include/linux/v4l2-mediabus.h
+++ b/include/linux/v4l2-mediabus.h
@@ -67,16 +67,21 @@ enum v4l2_mbus_pixelcode {
V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
 
-   /* Bayer - next is 0x300b */
+   /* Bayer - next is 0x3010 */
V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001,
V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
+   V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b,
+   V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c,
V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009,
+   V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 0x300d,
V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003,
V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004,
V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005,
V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006,
V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007,
+   V4L2_MBUS_FMT_SGBRG10_1X10 = 0x300e,
V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a,
+   V4L2_MBUS_FMT_SRGGB10_1X10 = 0x300f,
V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008,
 };
 
-- 
1.7.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v4 08/12] v4l: v4l2_subdev pad-level operations

2010-11-24 Thread Laurent Pinchart
Add a v4l2_subdev_pad_ops structure for the operations that need to be
performed at the pad level such as format-related operations.

Pad format-related operations use v4l2_mbus_framefmt instead of
v4l2_format.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/media/v4l2-subdev.h |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index f8704ff..0a9a864 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -42,6 +42,7 @@ struct v4l2_ctrl_handler;
 struct v4l2_event_subscription;
 struct v4l2_fh;
 struct v4l2_subdev;
+struct v4l2_subdev_fh;
 struct tuner_setup;
 
 /* decode_vbi_line */
@@ -414,6 +415,9 @@ struct v4l2_subdev_ir_ops {
struct v4l2_subdev_ir_parameters *params);
 };
 
+struct v4l2_subdev_pad_ops {
+};
+
 struct v4l2_subdev_ops {
const struct v4l2_subdev_core_ops   *core;
const struct v4l2_subdev_tuner_ops  *tuner;
@@ -422,6 +426,7 @@ struct v4l2_subdev_ops {
const struct v4l2_subdev_vbi_ops*vbi;
const struct v4l2_subdev_ir_ops *ir;
const struct v4l2_subdev_sensor_ops *sensor;
+   const struct v4l2_subdev_pad_ops*pad;
 };
 
 #define V4L2_SUBDEV_NAME_SIZE 32
-- 
1.7.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v4 07/12] v4l: Create v4l2 subdev file handle structure

2010-11-24 Thread Laurent Pinchart
From: Stanimir Varbanov svarba...@mm-sol.com

Used for storing subdev information per file handle and hold V4L2 file
handle.

Signed-off-by: Stanimir Varbanov svarba...@mm-sol.com
Signed-off-by: Antti Koskipaa antti.koski...@nokia.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/Kconfig |9 
 drivers/media/video/v4l2-subdev.c |   84 +
 include/media/v4l2-subdev.h   |   29 +
 3 files changed, 95 insertions(+), 27 deletions(-)

diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig
index 6b946e6..eaf4734 100644
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -82,6 +82,15 @@ config VIDEO_V4L1_COMPAT
 
  If you are unsure as to whether this is required, answer Y.
 
+config VIDEO_V4L2_SUBDEV_API
+   bool V4L2 sub-device userspace API (EXPERIMENTAL)
+   depends on VIDEO_DEV  MEDIA_CONTROLLER  EXPERIMENTAL
+   ---help---
+ Enables the V4L2 sub-device pad-level userspace API used to configure
+ video format, size and frame rate between hardware blocks.
+
+ This API is mostly used by camera interfaces in embedded platforms.
+
 #
 # DVB Core
 #
diff --git a/drivers/media/video/v4l2-subdev.c 
b/drivers/media/video/v4l2-subdev.c
index 3f09e23..56ad9b2 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -30,39 +30,69 @@
 #include media/v4l2-fh.h
 #include media/v4l2-event.h
 
+static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)
+{
+#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
+   /* Allocate try format and crop in the same memory block */
+   fh-try_fmt = kzalloc((sizeof(*fh-try_fmt) + sizeof(*fh-try_crop))
+ * sd-entity.num_pads, GFP_KERNEL);
+   if (fh-try_fmt == NULL)
+   return -ENOMEM;
+
+   fh-try_crop = (struct v4l2_rect *)
+   (fh-try_fmt + sd-entity.num_pads);
+#endif
+   return 0;
+}
+
+static void subdev_fh_free(struct v4l2_subdev_fh *fh)
+{
+#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
+   kfree(fh-try_fmt);
+   fh-try_fmt = NULL;
+   fh-try_crop = NULL;
+#endif
+}
+
 static int subdev_open(struct file *file)
 {
struct video_device *vdev = video_devdata(file);
struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
+   struct v4l2_subdev_fh *subdev_fh;
 #if defined(CONFIG_MEDIA_CONTROLLER)
struct media_entity *entity;
 #endif
-   struct v4l2_fh *vfh = NULL;
int ret;
 
if (!sd-initialized)
return -EAGAIN;
 
-   if (sd-flags  V4L2_SUBDEV_FL_HAS_EVENTS) {
-   vfh = kzalloc(sizeof(*vfh), GFP_KERNEL);
-   if (vfh == NULL)
-   return -ENOMEM;
+   subdev_fh = kzalloc(sizeof(*subdev_fh), GFP_KERNEL);
+   if (subdev_fh == NULL)
+   return -ENOMEM;
 
-   ret = v4l2_fh_init(vfh, vdev);
-   if (ret)
-   goto err;
+   ret = subdev_fh_init(subdev_fh, sd);
+   if (ret) {
+   kfree(subdev_fh);
+   return ret;
+   }
+
+   ret = v4l2_fh_init(subdev_fh-vfh, vdev);
+   if (ret)
+   goto err;
 
-   ret = v4l2_event_init(vfh);
+   if (sd-flags  V4L2_SUBDEV_FL_HAS_EVENTS) {
+   ret = v4l2_event_init(subdev_fh-vfh);
if (ret)
goto err;
 
-   ret = v4l2_event_alloc(vfh, sd-nevents);
+   ret = v4l2_event_alloc(subdev_fh-vfh, sd-nevents);
if (ret)
goto err;
-
-   v4l2_fh_add(vfh);
-   file-private_data = vfh;
}
+
+   v4l2_fh_add(subdev_fh-vfh);
+   file-private_data = subdev_fh-vfh;
 #if defined(CONFIG_MEDIA_CONTROLLER)
if (sd-v4l2_dev-mdev) {
entity = media_entity_get(sd-entity);
@@ -75,11 +105,10 @@ static int subdev_open(struct file *file)
return 0;
 
 err:
-   if (vfh != NULL) {
-   v4l2_fh_del(vfh);
-   v4l2_fh_exit(vfh);
-   kfree(vfh);
-   }
+   v4l2_fh_del(subdev_fh-vfh);
+   v4l2_fh_exit(subdev_fh-vfh);
+   subdev_fh_free(subdev_fh);
+   kfree(subdev_fh);
 
return ret;
 }
@@ -91,16 +120,17 @@ static int subdev_close(struct file *file)
struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
 #endif
struct v4l2_fh *vfh = file-private_data;
+   struct v4l2_subdev_fh *subdev_fh = to_v4l2_subdev_fh(vfh);
 
 #if defined(CONFIG_MEDIA_CONTROLLER)
if (sd-v4l2_dev-mdev)
media_entity_put(sd-entity);
 #endif
-   if (vfh != NULL) {
-   v4l2_fh_del(vfh);
-   v4l2_fh_exit(vfh);
-   kfree(vfh);
-   }
+   v4l2_fh_del(vfh);
+   v4l2_fh_exit(vfh);
+   subdev_fh_free(subdev_fh);
+   kfree(subdev_fh);
+   file-private_data = NULL;
 
return 

[RFC/PATCH v4 04/12] v4l: Group media bus pixel codes by types and sort them alphabetically

2010-11-24 Thread Laurent Pinchart
Adding new pixel codes at the end of the enumeration will soon create a
mess, so group the pixel codes by type and sort them by bus_width, bits
per component, samples per pixel and order of subsamples.

As the codes are part of the kernel ABI their value can't change when a
new code is inserted in the enumeration, so they are given an explicit
numerical value. When inserting a new pixel code developers must use and
update the next free value.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/linux/v4l2-mediabus.h |   77 
 1 files changed, 46 insertions(+), 31 deletions(-)

diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h
index 1171cac..ed5ac25 100644
--- a/include/linux/v4l2-mediabus.h
+++ b/include/linux/v4l2-mediabus.h
@@ -24,39 +24,54 @@
  * transferred first, BE means that the most significant bits are transferred
  * first, and PADHI and PADLO define which bits - low or high, in the
  * incomplete high byte, are filled with padding bits.
+ *
+ * The pixel codes are grouped by type, bus_width, bits per component, samples
+ * per pixel and order of subsamples. Numerical values are sorted using generic
+ * numerical sort order (8 thus comes before 10).
+ *
+ * As their value can't change when a new pixel code is inserted in the
+ * enumeration, the pixel codes are explicitly given a numerical value. The 
next
+ * free values for each category are listed below, update them when inserting
+ * new pixel codes.
  */
 enum v4l2_mbus_pixelcode {
-   V4L2_MBUS_FMT_FIXED = 1,
-   V4L2_MBUS_FMT_YUYV8_2X8,
-   V4L2_MBUS_FMT_YVYU8_2X8,
-   V4L2_MBUS_FMT_UYVY8_2X8,
-   V4L2_MBUS_FMT_VYUY8_2X8,
-   V4L2_MBUS_FMT_YVYU10_2X10,
-   V4L2_MBUS_FMT_YUYV10_2X10,
-   V4L2_MBUS_FMT_YVYU10_1X20,
-   V4L2_MBUS_FMT_YUYV10_1X20,
-   V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE,
-   V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE,
-   V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE,
-   V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE,
-   V4L2_MBUS_FMT_RGB565_2X8_LE,
-   V4L2_MBUS_FMT_RGB565_2X8_BE,
-   V4L2_MBUS_FMT_BGR565_2X8_LE,
-   V4L2_MBUS_FMT_BGR565_2X8_BE,
-   V4L2_MBUS_FMT_SBGGR8_1X8,
-   V4L2_MBUS_FMT_SBGGR10_1X10,
-   V4L2_MBUS_FMT_Y8_1X8,
-   V4L2_MBUS_FMT_Y10_1X10,
-   V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE,
-   V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE,
-   V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE,
-   V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE,
-   V4L2_MBUS_FMT_SGRBG8_1X8,
-   V4L2_MBUS_FMT_SBGGR12_1X12,
-   V4L2_MBUS_FMT_YUYV8_1_5X8,
-   V4L2_MBUS_FMT_YVYU8_1_5X8,
-   V4L2_MBUS_FMT_UYVY8_1_5X8,
-   V4L2_MBUS_FMT_VYUY8_1_5X8,
+   V4L2_MBUS_FMT_FIXED = 0x0001,
+
+   /* RGB - next is 0x1009 */
+   V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001,
+   V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002,
+   V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003,
+   V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 0x1004,
+   V4L2_MBUS_FMT_BGR565_2X8_BE = 0x1005,
+   V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
+   V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
+   V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
+
+   /* YUV (including grey) - next is 0x200f */
+   V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
+   V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002,
+   V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003,
+   V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004,
+   V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005,
+   V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006,
+   V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007,
+   V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008,
+   V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009,
+   V4L2_MBUS_FMT_Y10_1X10 = 0x200a,
+   V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b,
+   V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c,
+   V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
+   V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
+
+   /* Bayer - next is 0x3009 */
+   V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001,
+   V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002,
+   V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003,
+   V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004,
+   V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005,
+   V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006,
+   V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007,
+   V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008,
 };
 
 /**
-- 
1.7.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v4 12/12] v4l: v4l2_subdev userspace crop API

2010-11-24 Thread Laurent Pinchart
From: Antti Koskipaa antti.koski...@nokia.com

This patch adds the VIDIOC_SUBDEV_S_CROP and G_CROP ioctls to the
userland API. CROPCAP is not implemented because it's redundant.

Signed-off-by: Antti Koskipaa antti.koski...@nokia.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/DocBook/media-entities.tmpl  |4 +
 Documentation/DocBook/v4l/dev-subdev.xml   |   33 +
 Documentation/DocBook/v4l/v4l2.xml |1 +
 Documentation/DocBook/v4l/vidioc-subdev-g-crop.xml |  143 
 drivers/media/video/v4l2-subdev.c  |   26 
 include/linux/v4l2-subdev.h|   15 ++
 include/media/v4l2-subdev.h|4 +
 7 files changed, 226 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/DocBook/v4l/vidioc-subdev-g-crop.xml

diff --git a/Documentation/DocBook/media-entities.tmpl 
b/Documentation/DocBook/media-entities.tmpl
index 4af3c2e..157d147 100644
--- a/Documentation/DocBook/media-entities.tmpl
+++ b/Documentation/DocBook/media-entities.tmpl
@@ -88,8 +88,10 @@
 !ENTITY VIDIOC-S-TUNER link 
linkend='vidioc-g-tuner'constantVIDIOC_S_TUNER/constant/link
 !ENTITY VIDIOC-SUBDEV-ENUM-FRAME-SIZE link 
linkend='vidioc-subdev-enum-frame-size'constantVIDIOC_SUBDEV_ENUM_FRAME_SIZE/constant/link
 !ENTITY VIDIOC-SUBDEV-ENUM-MBUS-CODE link 
linkend='vidioc-subdev-enum-mbus-code'constantVIDIOC_SUBDEV_ENUM_MBUS_CODE/constant/link
+!ENTITY VIDIOC-SUBDEV-G-CROP link 
linkend='vidioc-subdev-g-crop'constantVIDIOC_SUBDEV_G_CROP/constant/link
 !ENTITY VIDIOC-SUBDEV-G-FMT link 
linkend='vidioc-subdev-g-fmt'constantVIDIOC_SUBDEV_G_FMT/constant/link
 !ENTITY VIDIOC-SUBDEV-G-FRAME-INTERVAL link 
linkend='vidioc-subdev-g-frame-interval'constantVIDIOC_SUBDEV_G_FRAME_INTERVAL/constant/link
+!ENTITY VIDIOC-SUBDEV-S-CROP link 
linkend='vidioc-subdev-g-crop'constantVIDIOC_SUBDEV_S_CROP/constant/link
 !ENTITY VIDIOC-SUBDEV-S-FMT link 
linkend='vidioc-subdev-g-fmt'constantVIDIOC_SUBDEV_S_FMT/constant/link
 !ENTITY VIDIOC-SUBDEV-S-FRAME-INTERVAL link 
linkend='vidioc-subdev-g-frame-interval'constantVIDIOC_SUBDEV_S_FRAME_INTERVAL/constant/link
 !ENTITY VIDIOC-TRY-ENCODER-CMD link 
linkend='vidioc-encoder-cmd'constantVIDIOC_TRY_ENCODER_CMD/constant/link
@@ -195,6 +197,7 @@
 !ENTITY v4l2-subdev-frame-interval structnbsp;link 
linkend='v4l2-subdev-frame-interval'v4l2_subdev_frame_interval/link
 !ENTITY v4l2-subdev-frame-interval-enum structnbsp;link 
linkend='v4l2-subdev-frame-interval-enum'v4l2_subdev_frame_interval_enum/link
 !ENTITY v4l2-subdev-frame-size-enum structnbsp;link 
linkend='v4l2-subdev-frame-size-enum'v4l2_subdev_frame_size_enum/link
+!ENTITY v4l2-subdev-crop structnbsp;link 
linkend='v4l2-subdev-crop'v4l2_subdev_crop/link
 !ENTITY v4l2-subdev-format structnbsp;link 
linkend='v4l2-subdev-format'v4l2_subdev_format/link
 !ENTITY v4l2-subdev-mbus-code-enum structnbsp;link 
linkend='v4l2-subdev-mbus-code-enum'v4l2_subdev_mbus_code_enum/link
 !ENTITY v4l2-standard structnbsp;link 
linkend='v4l2-standard'v4l2_standard/link
@@ -333,6 +336,7 @@
 !ENTITY sub-subdev-enum-frame-size SYSTEM 
v4l/vidioc-subdev-enum-frame-size.xml
 !ENTITY sub-subdev-enum-mbus-code SYSTEM 
v4l/vidioc-subdev-enum-mbus-code.xml
 !ENTITY sub-subdev-formats SYSTEM v4l/subdev-formats.xml
+!ENTITY sub-subdev-g-crop SYSTEM v4l/vidioc-subdev-g-crop.xml
 !ENTITY sub-subdev-g-fmt SYSTEM v4l/vidioc-subdev-g-fmt.xml
 !ENTITY sub-subdev-g-frame-interval SYSTEM 
v4l/vidioc-subdev-g-frame-interval.xml
 !ENTITY sub-capture-c SYSTEM v4l/capture.c.xml
diff --git a/Documentation/DocBook/v4l/dev-subdev.xml 
b/Documentation/DocBook/v4l/dev-subdev.xml
index 12fdca4..a8da916 100644
--- a/Documentation/DocBook/v4l/dev-subdev.xml
+++ b/Documentation/DocBook/v4l/dev-subdev.xml
@@ -269,6 +269,39 @@
   /para
 /section
 
+section
+  titleCropping and scaling/title
+
+  paraMany sub-devices support cropping frames on their input or output
+  pads (or possible even on both). Cropping is used to select the area of
+  interest in an image, typically on a video sensor or video decoder. It 
can
+  also be used as part of digital zoom implementations to select the area 
of
+  the image that will be scaled up./para
+
+  paraCrop settings are defined by a crop rectangle and represented in a
+  v4l2-rect; by the coordinates of the top left corner and the rectangle
+  size. Both the coordinates and sizes are expressed in pixels./para
+
+  paraThe crop rectangle is retrieved and set using the
+  VIDIOC-SUBDEV-G-CROP; and VIDIOC-SUBDEV-S-CROP; ioctls. Like for pad
+  formats, drivers store try and active crop rectangles. The format
+  negotiation mechanism applies to crop settings as well./para
+
+  paraOn input pads, cropping is applied relatively to the current pad
+  format. The pad format represents the image size as received by the
+  sub-device from the previous block in 

[RFC/PATCH v4 11/12] v4l: v4l2_subdev userspace frame interval API

2010-11-24 Thread Laurent Pinchart
The three new ioctl VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL,
VIDIOC_SUBDEV_G_FRAME_INTERVAL and VIDIOC_SUBDEV_S_FRAME_INTERVAL can be
used to enumerate and configure a subdev's frame rate from userspace.

Two new video::g/s_frame_interval subdev operations are introduced to
support those ioctls. The existing video::g/s_parm operations are
deprecated and shouldn't be used anymore.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Sakari Ailus sakari.ai...@maxwell.research.nokia.com
---
 Documentation/DocBook/media-entities.tmpl  |6 +
 Documentation/DocBook/v4l/v4l2.xml |2 +
 .../v4l/vidioc-subdev-enum-frame-interval.xml  |  146 
 .../DocBook/v4l/vidioc-subdev-g-frame-interval.xml |  135 ++
 drivers/media/video/v4l2-subdev.c  |   16 ++
 include/linux/v4l2-subdev.h|   36 +
 include/media/v4l2-subdev.h|7 +
 7 files changed, 348 insertions(+), 0 deletions(-)
 create mode 100644 
Documentation/DocBook/v4l/vidioc-subdev-enum-frame-interval.xml
 create mode 100644 Documentation/DocBook/v4l/vidioc-subdev-g-frame-interval.xml

diff --git a/Documentation/DocBook/media-entities.tmpl 
b/Documentation/DocBook/media-entities.tmpl
index 538f8fe..4af3c2e 100644
--- a/Documentation/DocBook/media-entities.tmpl
+++ b/Documentation/DocBook/media-entities.tmpl
@@ -89,7 +89,9 @@
 !ENTITY VIDIOC-SUBDEV-ENUM-FRAME-SIZE link 
linkend='vidioc-subdev-enum-frame-size'constantVIDIOC_SUBDEV_ENUM_FRAME_SIZE/constant/link
 !ENTITY VIDIOC-SUBDEV-ENUM-MBUS-CODE link 
linkend='vidioc-subdev-enum-mbus-code'constantVIDIOC_SUBDEV_ENUM_MBUS_CODE/constant/link
 !ENTITY VIDIOC-SUBDEV-G-FMT link 
linkend='vidioc-subdev-g-fmt'constantVIDIOC_SUBDEV_G_FMT/constant/link
+!ENTITY VIDIOC-SUBDEV-G-FRAME-INTERVAL link 
linkend='vidioc-subdev-g-frame-interval'constantVIDIOC_SUBDEV_G_FRAME_INTERVAL/constant/link
 !ENTITY VIDIOC-SUBDEV-S-FMT link 
linkend='vidioc-subdev-g-fmt'constantVIDIOC_SUBDEV_S_FMT/constant/link
+!ENTITY VIDIOC-SUBDEV-S-FRAME-INTERVAL link 
linkend='vidioc-subdev-g-frame-interval'constantVIDIOC_SUBDEV_S_FRAME_INTERVAL/constant/link
 !ENTITY VIDIOC-TRY-ENCODER-CMD link 
linkend='vidioc-encoder-cmd'constantVIDIOC_TRY_ENCODER_CMD/constant/link
 !ENTITY VIDIOC-TRY-EXT-CTRLS link 
linkend='vidioc-g-ext-ctrls'constantVIDIOC_TRY_EXT_CTRLS/constant/link
 !ENTITY VIDIOC-TRY-FMT link 
linkend='vidioc-g-fmt'constantVIDIOC_TRY_FMT/constant/link
@@ -190,6 +192,8 @@
 !ENTITY v4l2-sliced-vbi-cap structnbsp;link 
linkend='v4l2-sliced-vbi-cap'v4l2_sliced_vbi_cap/link
 !ENTITY v4l2-sliced-vbi-data structnbsp;link 
linkend='v4l2-sliced-vbi-data'v4l2_sliced_vbi_data/link
 !ENTITY v4l2-sliced-vbi-format structnbsp;link 
linkend='v4l2-sliced-vbi-format'v4l2_sliced_vbi_format/link
+!ENTITY v4l2-subdev-frame-interval structnbsp;link 
linkend='v4l2-subdev-frame-interval'v4l2_subdev_frame_interval/link
+!ENTITY v4l2-subdev-frame-interval-enum structnbsp;link 
linkend='v4l2-subdev-frame-interval-enum'v4l2_subdev_frame_interval_enum/link
 !ENTITY v4l2-subdev-frame-size-enum structnbsp;link 
linkend='v4l2-subdev-frame-size-enum'v4l2_subdev_frame_size_enum/link
 !ENTITY v4l2-subdev-format structnbsp;link 
linkend='v4l2-subdev-format'v4l2_subdev_format/link
 !ENTITY v4l2-subdev-mbus-code-enum structnbsp;link 
linkend='v4l2-subdev-mbus-code-enum'v4l2_subdev_mbus_code_enum/link
@@ -325,10 +329,12 @@
 !ENTITY sub-reqbufs SYSTEM v4l/vidioc-reqbufs.xml
 !ENTITY sub-s-hw-freq-seek SYSTEM v4l/vidioc-s-hw-freq-seek.xml
 !ENTITY sub-streamon SYSTEM v4l/vidioc-streamon.xml
+!ENTITY sub-subdev-enum-frame-interval SYSTEM 
v4l/vidioc-subdev-enum-frame-interval.xml
 !ENTITY sub-subdev-enum-frame-size SYSTEM 
v4l/vidioc-subdev-enum-frame-size.xml
 !ENTITY sub-subdev-enum-mbus-code SYSTEM 
v4l/vidioc-subdev-enum-mbus-code.xml
 !ENTITY sub-subdev-formats SYSTEM v4l/subdev-formats.xml
 !ENTITY sub-subdev-g-fmt SYSTEM v4l/vidioc-subdev-g-fmt.xml
+!ENTITY sub-subdev-g-frame-interval SYSTEM 
v4l/vidioc-subdev-g-frame-interval.xml
 !ENTITY sub-capture-c SYSTEM v4l/capture.c.xml
 !ENTITY sub-keytable-c SYSTEM v4l/keytable.c.xml
 !ENTITY sub-v4l2grab-c SYSTEM v4l/v4l2grab.c.xml
diff --git a/Documentation/DocBook/v4l/v4l2.xml 
b/Documentation/DocBook/v4l/v4l2.xml
index 695e3bf..e6225e0 100644
--- a/Documentation/DocBook/v4l/v4l2.xml
+++ b/Documentation/DocBook/v4l/v4l2.xml
@@ -478,9 +478,11 @@ and discussions on the V4L mailing list./revremark
 sub-reqbufs;
 sub-s-hw-freq-seek;
 sub-streamon;
+sub-subdev-enum-frame-interval;
 sub-subdev-enum-frame-size;
 sub-subdev-enum-mbus-code;
 sub-subdev-g-fmt;
+sub-subdev-g-frame-interval;
 sub-subscribe-event;
 !-- End of ioctls. --
 sub-mmap;
diff --git a/Documentation/DocBook/v4l/vidioc-subdev-enum-frame-interval.xml 
b/Documentation/DocBook/v4l/vidioc-subdev-enum-frame-interval.xml
new file mode 100644
index 000..bcea9d49
--- 

[RFC/PATCH v3 1/7] v4l: subdev: Generic ioctl support

2010-11-24 Thread Laurent Pinchart
Instead of returning an error when receiving an ioctl call with an
unsupported command, forward the call to the subdev core::ioctl handler.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 Documentation/video4linux/v4l2-framework.txt |5 +
 drivers/media/video/v4l2-subdev.c|2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index d0fb880..1bb5f22 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -407,6 +407,11 @@ VIDIOC_UNSUBSCRIBE_EVENT
To properly support events, the poll() file operation is also
implemented.
 
+Private ioctls
+
+   All ioctls not in the above list are passed directly to the sub-device
+   driver through the core::ioctl operation.
+
 
 I2C sub-device drivers
 --
diff --git a/drivers/media/video/v4l2-subdev.c 
b/drivers/media/video/v4l2-subdev.c
index 438c70f..b57be91 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -267,7 +267,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int 
cmd, void *arg)
}
 #endif
default:
-   return -ENOIOCTLCMD;
+   return v4l2_subdev_call(sd, core, ioctl, cmd, arg);
}
 
return 0;
-- 
1.7.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v3 4/7] v4l: Include linux/videodev2.h in media/v4l2-ctrls.h

2010-11-24 Thread Laurent Pinchart
The later makes extensive use of structures defined in the former.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/media/v4l2-ctrls.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
index 9b7bea9..3b133b7 100644
--- a/include/media/v4l2-ctrls.h
+++ b/include/media/v4l2-ctrls.h
@@ -23,6 +23,7 @@
 
 #include linux/list.h
 #include linux/device.h
+#include linux/videodev2.h
 
 /* forward references */
 struct v4l2_ctrl_handler;
-- 
1.7.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v3 2/7] v4l: Remove module_name argument to the v4l2_i2c_new_subdev* functions

2010-11-24 Thread Laurent Pinchart
The argument isn't used anymore by the functions, remove it.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/radio/radio-si4713.c|2 +-
 drivers/media/video/au0828/au0828-cards.c |4 ++--
 drivers/media/video/bt8xx/bttv-cards.c|   22 +++---
 drivers/media/video/cafe_ccic.c   |2 +-
 drivers/media/video/cx18/cx18-i2c.c   |8 
 drivers/media/video/cx231xx/cx231xx-cards.c   |4 ++--
 drivers/media/video/cx23885/cx23885-cards.c   |2 +-
 drivers/media/video/cx23885/cx23885-video.c   |4 ++--
 drivers/media/video/cx88/cx88-cards.c |9 -
 drivers/media/video/cx88/cx88-video.c |7 +++
 drivers/media/video/davinci/vpfe_capture.c|1 -
 drivers/media/video/davinci/vpif_capture.c|1 -
 drivers/media/video/davinci/vpif_display.c|2 +-
 drivers/media/video/em28xx/em28xx-cards.c |   18 +-
 drivers/media/video/fsl-viu.c |2 +-
 drivers/media/video/ivtv/ivtv-i2c.c   |   23 ++-
 drivers/media/video/mxb.c |   12 ++--
 drivers/media/video/pvrusb2/pvrusb2-hdw.c |6 ++
 drivers/media/video/s5p-fimc/fimc-capture.c   |3 +--
 drivers/media/video/saa7134/saa7134-cards.c   |8 
 drivers/media/video/saa7134/saa7134-core.c|4 ++--
 drivers/media/video/sh_vou.c  |2 +-
 drivers/media/video/soc_camera.c  |2 +-
 drivers/media/video/usbvision/usbvision-i2c.c |6 +++---
 drivers/media/video/v4l2-common.c |   15 +--
 drivers/media/video/via-camera.c  |2 +-
 drivers/media/video/vino.c|4 ++--
 drivers/media/video/zoran/zoran_card.c|5 ++---
 drivers/staging/go7007/go7007-driver.c|2 +-
 drivers/staging/tm6000/tm6000-cards.c |4 ++--
 include/media/v4l2-common.h   |9 +++--
 31 files changed, 88 insertions(+), 107 deletions(-)

diff --git a/drivers/media/radio/radio-si4713.c 
b/drivers/media/radio/radio-si4713.c
index a4440bf..24c9947 100644
--- a/drivers/media/radio/radio-si4713.c
+++ b/drivers/media/radio/radio-si4713.c
@@ -291,7 +291,7 @@ static int radio_si4713_pdriver_probe(struct 
platform_device *pdev)
goto unregister_v4l2_dev;
}
 
-   sd = v4l2_i2c_new_subdev_board(rsdev-v4l2_dev, adapter, NULL,
+   sd = v4l2_i2c_new_subdev_board(rsdev-v4l2_dev, adapter,
pdata-subdev_board_info, NULL, 0);
if (!sd) {
dev_err(pdev-dev, Cannot get v4l2 subdevice\n);
diff --git a/drivers/media/video/au0828/au0828-cards.c 
b/drivers/media/video/au0828/au0828-cards.c
index 0453816..01be89f 100644
--- a/drivers/media/video/au0828/au0828-cards.c
+++ b/drivers/media/video/au0828/au0828-cards.c
@@ -212,7 +212,7 @@ void au0828_card_setup(struct au0828_dev *dev)
   be abstracted out if we ever need to support a different
   demod) */
sd = v4l2_i2c_new_subdev(dev-v4l2_dev, dev-i2c_adap,
-   NULL, au8522, 0x8e  1, NULL);
+   au8522, 0x8e  1, NULL);
if (sd == NULL)
printk(KERN_ERR analog subdev registration failed\n);
}
@@ -221,7 +221,7 @@ void au0828_card_setup(struct au0828_dev *dev)
if (dev-board.tuner_type != TUNER_ABSENT) {
/* Load the tuner module, which does the attach */
sd = v4l2_i2c_new_subdev(dev-v4l2_dev, dev-i2c_adap,
-   NULL, tuner, dev-board.tuner_addr, NULL);
+   tuner, dev-board.tuner_addr, NULL);
if (sd == NULL)
printk(KERN_ERR tuner subdev registration fail\n);
 
diff --git a/drivers/media/video/bt8xx/bttv-cards.c 
b/drivers/media/video/bt8xx/bttv-cards.c
index 87d8b00..49efcf6 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -3529,7 +3529,7 @@ void __devinit bttv_init_card2(struct bttv *btv)
struct v4l2_subdev *sd;
 
sd = v4l2_i2c_new_subdev(btv-c.v4l2_dev,
-   btv-c.i2c_adap, NULL, saa6588, 0, addrs);
+   btv-c.i2c_adap, saa6588, 0, addrs);
btv-has_saa6588 = (sd != NULL);
}
 
@@ -3554,7 +3554,7 @@ void __devinit bttv_init_card2(struct bttv *btv)
};
 
btv-sd_msp34xx = v4l2_i2c_new_subdev(btv-c.v4l2_dev,
-   btv-c.i2c_adap, NULL, msp3400, 0, addrs);
+   btv-c.i2c_adap, msp3400, 0, addrs);
if (btv-sd_msp34xx)
return;
goto no_audio;
@@ -3568,7 +3568,7 @@ void __devinit bttv_init_card2(struct bttv *btv)
};
 
if 

[RFC/PATCH v3 3/7] v4l: Add subdev sensor g_skip_frames operation

2010-11-24 Thread Laurent Pinchart
Some buggy sensors generate corrupt frames when the stream is started.
This new operation return the number of corrupt frames to skip when
starting the stream.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 include/media/v4l2-subdev.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 4704a0a..356d16475e 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -343,9 +343,13 @@ struct v4l2_subdev_vbi_ops {
  *   This is needed for some sensors, which always corrupt
  *   several top lines of the output image, or which send their
  *   metadata in them.
+ * @g_skip_frames: number of frames to skip at stream start. This is needed for
+ *buggy sensors that generate faulty frames when they are
+ *turned on.
  */
 struct v4l2_subdev_sensor_ops {
int (*g_skip_top_lines)(struct v4l2_subdev *sd, u32 *lines);
+   int (*g_skip_frames)(struct v4l2_subdev *sd, u32 *frames);
 };
 
 /*
-- 
1.7.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v3 6/7] omap3: Export omap3isp platform device structure

2010-11-24 Thread Laurent Pinchart
From: Stanimir Varbanov svarba...@mm-sol.com

The omap3isp platform device requires platform data. As the data can be
provided by a kernel module, the device can't be registered during arch
initialization.

Remove the omap3isp platform device registration from
omap_init_camera(), and export the platform device structure to let
board code register/unregister it.

Signed-off-by: Stanimir Varbanov svarba...@mm-sol.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 arch/arm/mach-omap2/devices.c |   18 --
 arch/arm/mach-omap2/devices.h |   17 +
 2 files changed, 33 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-omap2/devices.h

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index d5da345..c2275d3 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -34,6 +34,8 @@
 #include mux.h
 #include control.h
 
+#include devices.h
+
 #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
 
 static struct resource cam_resources[] = {
@@ -144,16 +146,28 @@ static struct resource omap3isp_resources[] = {
}
 };
 
-static struct platform_device omap3isp_device = {
+static void omap3isp_release(struct device *dev)
+{
+   /* Zero the device structure to avoid re-initialization complaints from
+* kobject when the device will be re-registered.
+*/
+   memset(dev, 0, sizeof(*dev));
+   dev-release = omap3isp_release;
+}
+
+struct platform_device omap3isp_device = {
.name   = omap3isp,
.id = -1,
.num_resources  = ARRAY_SIZE(omap3isp_resources),
.resource   = omap3isp_resources,
+   .dev = {
+   .release= omap3isp_release,
+   },
 };
+EXPORT_SYMBOL_GPL(omap3isp_device);
 
 static inline void omap_init_camera(void)
 {
-   platform_device_register(omap3isp_device);
 }
 #else
 static inline void omap_init_camera(void)
diff --git a/arch/arm/mach-omap2/devices.h b/arch/arm/mach-omap2/devices.h
new file mode 100644
index 000..f312d49
--- /dev/null
+++ b/arch/arm/mach-omap2/devices.h
@@ -0,0 +1,17 @@
+/*
+ * arch/arm/mach-omap2/devices.h
+ *
+ * OMAP2 platform device setup/initialization
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP_DEVICES_H
+#define __ARCH_ARM_MACH_OMAP_DEVICES_H
+
+extern struct platform_device omap3isp_device;
+
+#endif
-- 
1.7.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v3 5/7] ARM: OMAP3: Update Camera ISP definitions for OMAP3630

2010-11-24 Thread Laurent Pinchart
From: Tuukka Toivonen tuukka.o.toivo...@nokia.com

Add new/changed base address definitions and resources for
OMAP3630 ISP.

The OMAP3430 CSI2PHY block is same as the OMAP3630 CSIPHY2
block. But the later name is chosen as it gives more symmetry
to the names.

Signed-off-by: Tuukka Toivonen tuukka.o.toivo...@nokia.com
Signed-off-by: Vimarsh Zutshi vimarsh.zut...@nokia.com
---
 arch/arm/mach-omap2/devices.c  |   28 
 arch/arm/plat-omap/include/plat/omap34xx.h |   16 
 2 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 5a0c148..d5da345 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -109,13 +109,33 @@ static struct resource omap3isp_resources[] = {
.flags  = IORESOURCE_MEM,
},
{
-   .start  = OMAP3430_ISP_CSI2A_BASE,
-   .end= OMAP3430_ISP_CSI2A_END,
+   .start  = OMAP3430_ISP_CSI2A_REGS1_BASE,
+   .end= OMAP3430_ISP_CSI2A_REGS1_END,
.flags  = IORESOURCE_MEM,
},
{
-   .start  = OMAP3430_ISP_CSI2PHY_BASE,
-   .end= OMAP3430_ISP_CSI2PHY_END,
+   .start  = OMAP3430_ISP_CSIPHY2_BASE,
+   .end= OMAP3430_ISP_CSIPHY2_END,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = OMAP3630_ISP_CSI2A_REGS2_BASE,
+   .end= OMAP3630_ISP_CSI2A_REGS2_END,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = OMAP3630_ISP_CSI2C_REGS1_BASE,
+   .end= OMAP3630_ISP_CSI2C_REGS1_END,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = OMAP3630_ISP_CSIPHY1_BASE,
+   .end= OMAP3630_ISP_CSIPHY1_END,
+   .flags  = IORESOURCE_MEM,
+   },
+   {
+   .start  = OMAP3630_ISP_CSI2C_REGS2_BASE,
+   .end= OMAP3630_ISP_CSI2C_REGS2_END,
.flags  = IORESOURCE_MEM,
},
{
diff --git a/arch/arm/plat-omap/include/plat/omap34xx.h 
b/arch/arm/plat-omap/include/plat/omap34xx.h
index 98fc8b4..b9e8588 100644
--- a/arch/arm/plat-omap/include/plat/omap34xx.h
+++ b/arch/arm/plat-omap/include/plat/omap34xx.h
@@ -56,8 +56,12 @@
 #define OMAP3430_ISP_RESZ_BASE (OMAP3430_ISP_BASE + 0x1000)
 #define OMAP3430_ISP_SBL_BASE  (OMAP3430_ISP_BASE + 0x1200)
 #define OMAP3430_ISP_MMU_BASE  (OMAP3430_ISP_BASE + 0x1400)
-#define OMAP3430_ISP_CSI2A_BASE(OMAP3430_ISP_BASE + 0x1800)
-#define OMAP3430_ISP_CSI2PHY_BASE  (OMAP3430_ISP_BASE + 0x1970)
+#define OMAP3430_ISP_CSI2A_REGS1_BASE  (OMAP3430_ISP_BASE + 0x1800)
+#define OMAP3430_ISP_CSIPHY2_BASE  (OMAP3430_ISP_BASE + 0x1970)
+#define OMAP3630_ISP_CSI2A_REGS2_BASE  (OMAP3430_ISP_BASE + 0x19C0)
+#define OMAP3630_ISP_CSI2C_REGS1_BASE  (OMAP3430_ISP_BASE + 0x1C00)
+#define OMAP3630_ISP_CSIPHY1_BASE  (OMAP3430_ISP_BASE + 0x1D70)
+#define OMAP3630_ISP_CSI2C_REGS2_BASE  (OMAP3430_ISP_BASE + 0x1DC0)
 
 #define OMAP3430_ISP_END   (OMAP3430_ISP_BASE + 0x06F)
 #define OMAP3430_ISP_CBUFF_END (OMAP3430_ISP_CBUFF_BASE   + 0x077)
@@ -69,8 +73,12 @@
 #define OMAP3430_ISP_RESZ_END  (OMAP3430_ISP_RESZ_BASE+ 0x0AB)
 #define OMAP3430_ISP_SBL_END   (OMAP3430_ISP_SBL_BASE + 0x0FB)
 #define OMAP3430_ISP_MMU_END   (OMAP3430_ISP_MMU_BASE + 0x06F)
-#define OMAP3430_ISP_CSI2A_END (OMAP3430_ISP_CSI2A_BASE   + 0x16F)
-#define OMAP3430_ISP_CSI2PHY_END   (OMAP3430_ISP_CSI2PHY_BASE + 0x007)
+#define OMAP3430_ISP_CSI2A_REGS1_END   (OMAP3430_ISP_CSI2A_REGS1_BASE + 0x16F)
+#define OMAP3430_ISP_CSIPHY2_END   (OMAP3430_ISP_CSIPHY2_BASE + 0x00B)
+#define OMAP3630_ISP_CSI2A_REGS2_END   (OMAP3630_ISP_CSI2A_REGS2_BASE + 0x3F)
+#define OMAP3630_ISP_CSI2C_REGS1_END   (OMAP3630_ISP_CSI2C_REGS1_BASE + 0x16F)
+#define OMAP3630_ISP_CSIPHY1_END   (OMAP3630_ISP_CSIPHY1_BASE + 0x00B)
+#define OMAP3630_ISP_CSI2C_REGS2_END   (OMAP3630_ISP_CSI2C_REGS2_BASE + 0x3F)
 
 #define OMAP34XX_HSUSB_OTG_BASE(L4_34XX_BASE + 0xAB000)
 #define OMAP34XX_USBTLL_BASE   (L4_34XX_BASE + 0x62000)
-- 
1.7.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC/PATCH v3 0/7] OMAP3 ISP driver

2010-11-24 Thread Laurent Pinchart
Hi everybody,

Here's the third version of the OMAP3 ISP driver patches, updated to
2.6.37-rc3 and the latest changes in the media controller and sub-device APIs.

You can find the patches in http://git.linuxtv.org/pinchartl/media.git as
usual (media-00043-omap3isp).

The v4l: Remove module_name argument to the v4l2_i2c_new_subdev* functions
patch comes from Mauro's linux-next tree and won't be needed anymore when it
will be merged to the mainline kernel.

The v4l: Add subdev sensor g_skip_frames operation patch has been discussed
on the linux-media mailing list and acked.

The v4l: subdev: Generic ioctl support will be discussed separately on the
list in the near future.

The driver is in a better shape than last time, and its public API has been
cleaned up quite a lot. We still have a couple of private ioctls that will
need to change (that's on my loong todo list).

Laurent Pinchart (5):
  v4l: subdev: Generic ioctl support
  v4l: Remove module_name argument to the v4l2_i2c_new_subdev*
functions
  v4l: Add subdev sensor g_skip_frames operation
  v4l: Include linux/videodev2.h in media/v4l2-ctrls.h
  OMAP3 ISP driver

Stanimir Varbanov (1):
  omap3: Export omap3isp platform device structure

Tuukka Toivonen (1):
  ARM: OMAP3: Update Camera ISP definitions for OMAP3630

 Documentation/video4linux/v4l2-framework.txt  |5 +
 arch/arm/mach-omap2/devices.c |   46 +-
 arch/arm/mach-omap2/devices.h |   17 +
 arch/arm/plat-omap/include/plat/omap34xx.h|   16 +-
 drivers/media/radio/radio-si4713.c|2 +-
 drivers/media/video/Kconfig   |   15 +
 drivers/media/video/Makefile  |2 +
 drivers/media/video/au0828/au0828-cards.c |4 +-
 drivers/media/video/bt8xx/bttv-cards.c|   22 +-
 drivers/media/video/cafe_ccic.c   |2 +-
 drivers/media/video/cx18/cx18-i2c.c   |8 +-
 drivers/media/video/cx231xx/cx231xx-cards.c   |4 +-
 drivers/media/video/cx23885/cx23885-cards.c   |2 +-
 drivers/media/video/cx23885/cx23885-video.c   |4 +-
 drivers/media/video/cx88/cx88-cards.c |9 +-
 drivers/media/video/cx88/cx88-video.c |7 +-
 drivers/media/video/davinci/vpfe_capture.c|1 -
 drivers/media/video/davinci/vpif_capture.c|1 -
 drivers/media/video/davinci/vpif_display.c|2 +-
 drivers/media/video/em28xx/em28xx-cards.c |   18 +-
 drivers/media/video/fsl-viu.c |2 +-
 drivers/media/video/isp/Makefile  |   13 +
 drivers/media/video/isp/cfa_coef_table.h  |  601 +++
 drivers/media/video/isp/gamma_table.h |   90 +
 drivers/media/video/isp/isp.c | 1977 ++
 drivers/media/video/isp/isp.h |  400 +
 drivers/media/video/isp/ispccdc.c | 2189 +
 drivers/media/video/isp/ispccdc.h |  220 +++
 drivers/media/video/isp/ispccp2.c | 1100 +
 drivers/media/video/isp/ispccp2.h |  101 ++
 drivers/media/video/isp/ispcsi2.c | 1265 ++
 drivers/media/video/isp/ispcsi2.h |  169 ++
 drivers/media/video/isp/ispcsiphy.c   |  246 +++
 drivers/media/video/isp/ispcsiphy.h   |   77 +
 drivers/media/video/isp/isph3a.h  |  117 ++
 drivers/media/video/isp/isph3a_aewb.c |  356 
 drivers/media/video/isp/isph3a_af.c   |  410 +
 drivers/media/video/isp/isphist.c |  505 ++
 drivers/media/video/isp/isphist.h |   40 +
 drivers/media/video/isp/isppreview.c  | 2091 +++
 drivers/media/video/isp/isppreview.h  |  214 +++
 drivers/media/video/isp/ispqueue.c| 1135 +
 drivers/media/video/isp/ispqueue.h|  184 +++
 drivers/media/video/isp/ispreg.h  | 1655 +++
 drivers/media/video/isp/ispresizer.c  | 1711 +++
 drivers/media/video/isp/ispresizer.h  |  149 ++
 drivers/media/video/isp/ispstat.c | 1093 
 drivers/media/video/isp/ispstat.h |  168 ++
 drivers/media/video/isp/ispvideo.c| 1199 ++
 drivers/media/video/isp/ispvideo.h|  183 ++
 drivers/media/video/isp/luma_enhance_table.h  |  154 ++
 drivers/media/video/isp/noise_filter_table.h  |   90 +
 drivers/media/video/ivtv/ivtv-i2c.c   |   23 +-
 drivers/media/video/mxb.c |   12 +-
 drivers/media/video/pvrusb2/pvrusb2-hdw.c |6 +-
 drivers/media/video/s5p-fimc/fimc-capture.c   |3 +-
 drivers/media/video/saa7134/saa7134-cards.c   |8 +-
 drivers/media/video/saa7134/saa7134-core.c|4 +-
 drivers/media/video/sh_vou.c  |2 +-
 drivers/media/video/soc_camera.c  |2 +-
 drivers/media/video/usbvision/usbvision-i2c.c |6 +-
 drivers/media/video/v4l2-common.c |   15 +-
 

Re: [RFC/PATCH v3 0/7] OMAP3 ISP driver

2010-11-24 Thread Laurent Pinchart
Hi,

I've managed not to CC the linux-omap mailing list when sending this patch 
set. That's probably what I should have expected from sending patches in the 
middle of the night :-(

I've resent the patches to linux-o...@vger.kernel.org now, please try to CC 
them when answering. Sorry about the inconvenience.

-- 
Regards,

Laurent Pinchart
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: ATSC Tuner in KWorld PC120-U PCI Hybrid ATSC (17de:a134)

2010-11-24 Thread Hooman B.
Thanks,

I see the drivers for both TDA18271HDC2 and TDA8290 loaded.
I thought TDA18271HDC2 was the digital channel decoder, isn't it? Is
the digital channel decoder different from the digital tuner??
Should be looking for a different chip?

Based on these to chips, I added my card in  saa7134_tda8290_callback
to call saa7134_tda8290_18271_callback and here is the output of my
dmesg:
[  828.879454] dvb_init() allocating 1 frontend
[  829.180234] nxt200x: nxt200x_readbytes: i2c read error (addr 0x0a, err == -5)
[  829.180244] Unknown/Unsupported NXT chip: 00 00 00 00 00
[  829.180542] saa7133[0]/dvb: frontend initialization failed

Hooman

On Wed, Nov 24, 2010 at 7:21 PM, hermann pitton hermann-pit...@arcor.de wrote:

 Hi,

 Am Dienstag, den 23.11.2010, 17:34 -0500 schrieb Hooman B.:
 Hello!
 I've been trying to get the ATSC tuner in my KWorld PC120-U PCI Hybrid
 ATSC (17de:a134)
 to work with the latest v4l drivers from source (in Ubuntu).

 Right now, everything [capture, analog, radio, even IR] works - except
 the ATSC tuner (there is no
 front-end device). But that's the one thing I need working :-(

 OK.

 Here's the output of lspci -nnvv
 
 03:01.0 Multimedia controller [0480]: Philips Semiconductors
 SAA7131/SAA7133/SAA7135 Video Broadcast Decoder [1131:7133] (rev d1)
 Subsystem: KWorld Computer Co. Ltd. Device [17de:a134]
 Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr-
 Stepping- SERR- FastB2B- DisINTx-
 Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium TAbort-
 TAbort- MAbort- SERR- PERR- INTx-
 Latency: 255 (63750ns min, 63750ns max)
 Interrupt: pin A routed to IRQ 16
 Region 0: Memory at fdaff000 (32-bit, non-prefetchable) [size=2K]
 Capabilities: access denied
 Kernel driver in use: saa7134
 Kernel modules: saa7134
 

 This is the most similar card that I forced in saa7134-cards.c:
 
                 .vendor       = PCI_VENDOR_ID_PHILIPS,
                 .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
                 .subvendor    = 0x17de,
                 .subdevice    = 0xa134,
                 .driver_data  = SAA7134_BOARD_MSI_TVATANYWHERE_PLUS,
 

 The chips are : SAA7135HL/203 and TDA18271HDC2


 Both variants of the MSI t...@nywhere Plus do not have any support for
 digital TV.

 You need to find out the type of digital channel decoder on your board
 at first.

 Then you check saa7134-dvb.c, if it is already supported on other cards.

 You have to investigate the details of how the channel decoder is
 employed, but with some luck can try with already supported cards.

 If i2c traffic locks up and chips disappear from the bus, a cold boot
 might be necessary to continue with testing.

 Cheers,
 Hermann





--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: linux-next: Tree for November 23

2010-11-24 Thread Stephen Rothwell
Hi Anca,

On Tue, 23 Nov 2010 19:11:41 +0200 Anca Emanuel anca.eman...@gmail.com wrote:

 Stephen, It is possible to have an automatic test report for
 (in)successful boot on major 5 distributions ?

Theoretically, yes :-)

We will keep it in mind.

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/


pgprGyn5B6ABh.pgp
Description: PGP signature


RE: [PATCH 07/10] MCDE: Add display subsystem framework

2010-11-24 Thread Jimmy RUBIN
Hi,

  +struct kobj_type ovly_type = {
  +   .release = overlay_release,
  +};
 
 You certainly should not define a new kobj_type for use in a device
 driver.
 This is an internal data structure of the linux core code. It might
 make
 sense if you were trying to become the new frame buffer layer
 maintainer
 and rewrite all the existing drivers to be based on the concept of
 overlays, but even then there is probably a better way.
 
 Maybe you were thinking of using kref instead of kobj?
 

Good point, I looked at kref and that is what we want to do.

  +int __init mcde_dss_init(void)
  +{
  +   return 0;
  +}
  +
  +void mcde_dss_exit(void)
  +{
  +}
 
 If they don't do anything, don't define them.
 
Agree, will remove them

/Jimmy
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html