Re: Linux V4L2 support dual stream video capture device

2010-09-15 Thread Hans Verkuil
On Wednesday, September 15, 2010 07:57:22 Kim, HeungJun wrote:
 Hi Laurent, and Hans,
 
 I checked media frameworks, it was helpful for me, but It's not usable on my
 case. Because, before defining the device for using media frameworks, the
 device must be defined by some other device like FB, ALSA, DVB, etc. But,
 this H/W Block is no way to define using any other method in current V4L2
 frameworks.

Yes, there is. You missed the important part about how the media framework 
models
sub-devices. In your block diagram the media API would not only list the v4l
device nodes, but also the sensor and HW Block A and B as sub-devices.

The media API allows you to reconfigure the links between the subdevices and
the device nodes, so you can decide how the video flows through the system.

In addition, the sub-devices will get their own device node so you can control
them from userspace. This gives you much more precise control over your system.

 So, I wanna listen to your advices about this cases.
 
 It has 2 modes, the Preview mode to have Capturing  FIFOing capability, and
 the Capture mode to DMAing capabilitiy. Exactly, in Preview mode, it dosen't
 need any other V4L2 IOCTL calls related with buffer, like VIDIOC_REQBUFS,
 VIDIOC_QUERYBUFS, and mmap() operation. Using just VIDIOC_S_FMT IOCTL calls,
 is able to define this block. Because, it has no buffers. The QBUF and DQBUF
 looping, also is same any other V4L2 driver working process. On the other
 hand, In Capture mode, the same stream of Preview mode, is able to get using
 WDMA. So, at this mode, it need V4L2 IOCTL calls related with buffers.

So in preview mode the video goes from the sensor to block A, then to block B
(using the internal FIFO), then then it goes to an LCD or something like that?

And in capture mode it goes from the sensor to Block A and then to the DMA
engine? Or does it also go through block B first? It's not clear from your
description.

Regards,

Hans

 
 I would show this SoC's media H/W Blocks flowchart briefly.
 
 
 
 +--+
 | FIFO Link|
 +---|   using  |---+
 |   |   Internal SRAM  |   |
+---+|   +--+   |
| C ||  |
| C |   ++---+
 +---+
| D |   |  H/W Block A   ||  H/W Block B
 |
|   |   +---++   Vsync issued
 +---+
| S +---+ Sensor| Pre -  |   using Interrupt  |Post -
 |
| E |   | Interface | Processor  |   recognized at|   Processor
 |
| N |   ++--++   H/W Block B
 +-+-+
| S ||  |   |
| O |+--+   |
| R | Vsync issued  | DMA Link
+---+ using Interrupt   |
  recognized in H/W Block A |
|
  
 +---+-+
|   DMA Bus
 |
  
 +-+
 
 If the flowchart is crashed, copy and paste in the notepad or something.
 In the fixed size font, it will looks well.
 
 Actualy my opinion, any other buf_type is needed to define in such case,
 like a V4L2_BUF_FLAG_FIFO, not using media framework. 
 
 Thanks to reading, and I'll wait any advises and opinions.
 
 Regards,
 HeungJun, Kim
 
 
 
  -Original Message-
  From: linux-media-ow...@vger.kernel.org [mailto:linux-media-
  ow...@vger.kernel.org] On Behalf Of Laurent Pinchart
  Sent: Tuesday, September 14, 2010 6:53 PM
  To: Theodore Kilgore
  Cc: Wang, Wen W; linux-media@vger.kernel.org; Zhang, Xiaolin; Huang, Kai;
  Hu, Gang A
  Subject: Re: Linux V4L2 support dual stream video capture device
  
  Hi Theodore,
  
  On Monday 13 September 2010 19:17:48 Theodore Kilgore wrote:
   On Mon, 13 Sep 2010, Laurent Pinchart wrote:
On Friday 07 May 2010 20:20:38 Wang, Wen W wrote:
 Hi all,

 I'm wondering if V4L2 framework supports dual stream video capture
 device that transfer a preview stream and a regular stream (still
 capture or video capture) at the same time.

 We are developing a device driver with such capability. Our proposal
  to
 do this in V4L2 framework is to have two device nodes, one as
  primary
 node for still/video capture and one for preview.
   
If the device supports multiple simultaneous video streams, multiple
video nodes is the way to go.
   
 The primary still/video capture device node is used for device
 

RE: how can deal with the stream in only on-the-fly-output available HW block??

2010-09-15 Thread Kim, HeungJun
Sorry, I miss sending msg into any other thread.
Send with the right thread, Again.

Thanks,
HeungJun Kim


--

Hi Laurent, and Hans,

I checked media frameworks, it was helpful for me, but It's not usable on my
case. Because, before defining the device for using media frameworks, the
device must be defined by some other device like FB, ALSA, DVB, etc. But,
this H/W Block is no way to define using any other method in current V4L2
frameworks.

So, I wanna listen to your advices about this cases.

It has 2 modes, the Preview mode to have Capturing  FIFOing capability, and
the Capture mode to DMAing capabilitiy. Exactly, in Preview mode, it dosen't
need any other V4L2 IOCTL calls related with buffer, like VIDIOC_REQBUFS,
VIDIOC_QUERYBUFS, and mmap() operation. Using just VIDIOC_S_FMT IOCTL calls,
is able to define this block. Because, it has no buffers. The QBUF and DQBUF
looping, also is same any other V4L2 driver working process. On the other
hand, In Capture mode, the same stream of Preview mode, is able to get using
WDMA. So, at this mode, it need V4L2 IOCTL calls related with buffers.

I would show this SoC's media H/W Blocks flowchart briefly.



+--+
| FIFO Link|
+---|   using  |---+
|   |   Internal SRAM  |   |
   +---+|   +--+   |
   | C ||  |
   | C |   ++---+
+---+
   | D |   |  H/W Block A   ||  H/W Block B
|
   |   |   +---++   Vsync issued
+---+
   | S +---+ Sensor| Pre -  |   using Interrupt  |Post -
|
   | E |   | Interface | Processor  |   recognized at|   Processor
|
   | N |   ++--++   H/W Block B
+-+-+
   | S ||  |   |
   | O |+--+   |
   | R | Vsync issued  | DMA Link
   +---+ using Interrupt   |
 recognized in H/W Block A |
   |
 
+---+-+
   |   DMA Bus
|
 
+-+

If the flowchart is crashed, copy and paste in the notepad or something.
In the fixed size font, it will looks well.

Actualy my opinion, any other buf_type is needed to define in such case,
like a V4L2_BUF_FLAG_FIFO, not using media framework. 

Thanks to reading, and I'll wait any advises and opinions.

Regards,
HeungJun, Kim


 -Original Message-
 From: Kim, HeungJun [mailto:riverful@samsung.com]
 Sent: Tuesday, September 14, 2010 2:11 PM
 To: 'linux-media@vger.kernel.org'; 'laurent.pinch...@ideasonboard.com';
 'hverk...@xs4all.nl'
 Cc: 'inki@samsung.com'; 'kyungmin.p...@samsung.com'
 Subject: how can deal with the stream in only on-the-fly-output available
 HW block??
 
 
 
 -Original Message-
 From: Kim, HeungJun [mailto:riverful@samsung.com]
 Sent: Tuesday, September 14, 2010 2:02 PM
 To: 'laurent.pinch...@ideasonboard.com'; 'hverk...@xs4all.nl'
 Subject: RE: how can deal with the stream in only on-the-fly-output
 available HW block??
 
  On Monday, September 13, 2010 14:10:55 Kim, HeungJun wrote:
   Hi all,
  
  
  
   What if some SoC's specific HW block supports only on-the-fly mode for
   stream output??
 
  What do you mean with 'on-the-fly mode'? Does that mean that two HW
 blocks
  are linked together so that the video stream goes directly from one to
 the
  other without ever being DMA-ed to memory?
 
 You're right. It's linked with internal SRAM FIFO. So, syncing streams
 with both blocks is kept with VSync Interrupt. It's not using DMA-ed to
 memory in this mode.
 
 
  
   In this case, what is the suitable buf_type??
 
  Suitable buf_type for doing what?
 
 I wanna define this blocks topology with V4L2 APIs. But, I don't find
 suitable buf_type or any definitions in the V4L2 APIs with current SoC's
 block media topology.
 
 
  You probably need the upcoming media API to be able to correctly deal
 with
  these issues. Check the mailing list for the patches done by Laurent
  Pinchart.
 
  The current V4L2 API is really not able to handle changes in the
 internal
  video stream topology.
 
 Thanks to Hans. It's very helpful.
 I'll check Laurent's media topology patches.
 
 
 Hello, Laurent,
 
 I'm googling and find your patches, so I'm checking with. But, where can I
 get your patches?? Probably, I would find in this page :
 

Re: Leadtek DTV2000DS remote

2010-09-15 Thread Gregory Orange
Shall I assume that noone has had any experience with one of these
devices? From some input from other sources, I'm now not sure if I
lack a kernel module, or perhaps the firmware for this device isn't
supported (or somesuch - a bit confused on that).

In any case, pretty well everything is now working including EIT at
last. The remote is all I lack. I have no idea who else to ask or what
to try, so I may try borrowing a different remote. I'm all Googled out
(:

Regards,
Greg.

On 9 September 2010 22:11, Gregory Orange gregory.ora...@gmail.com wrote:
 Hi all, first post.

 I have a newly purchased Leadtek DTV2000DS dual tuner card in my
 machine, configured and running in Mythbuntu 10.04 (after installing
 latest v4l-dvb from source). I am having a bit of trouble getting the
 supplied remote control working. Is anyone here able to assist? I
 asked on the LIRC sf.net list and after a bit of back and forth I was
 directed to see if you guys can help me. In particular I wonder if the
 author of dvb_usb_af9015 and af9013 is around - hmm, seems to be Antti
 Palosaari, who seems to be a fairly recent poster. Don't get me wrong
 though - anyone who can assist would be great (:

 I have confirmed that the hardware works - I installed the drivers in
 a Windows boot, and the remote works.

 In terms of driver support I'm not sure exactly what I'm looking for,
 but there is this line in dmesg:
 [   22.263721] input: IR-receiver inside an USB DVB receiver as
 /devices/pci:00/:00:0e.0/:02:0a.2/usb2/2-1/input/input5

 cat /proc/bus/input/devices yields
 I: Bus=0003 Vendor=0413 Product=6a04 Version=0200
 N: Name=IR-receiver inside an USB DVB receiver
 P: Phys=usb-:02:0a.2-1/ir0
 S: Sysfs=/devices/pci:00/:00:0e.0/:02:0a.2/usb2/2-1/input/input5
 U: Uniq=
 H: Handlers=kbd event5
 B: EV=3
 B: KEY=108fc310 2802891 0 0 0 0 118000 200180 4803 e1680 0 10 ffe

 So I've been using /dev/input/event5 in my tests. I have tried using
 evtest, mode2, and irw to no avail. I get no indication of any signal
 coming from the remote. Am I missing a kernel driver module? Any
 further advice or specific experience with this device would be
 gratefully welcomed.

 Cheers,
 Greg.

 --
 Gregory Orange




-- 
Gregory Orange
--
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: how can deal with the stream in only on-the-fly-output available HW block??

2010-09-15 Thread Kim, HeungJun
Hi Hans,

I mistake to send msg on the wrong threads, and also there is mis-
understanding cause of a lack of my explanation about this. so I wanna
fix up the agenda about this on this thread, again.

 Yes, there is. You missed the important part about how the media framework
 models
 sub-devices. In your block diagram the media API would not only list the
 v4l
 device nodes, but also the sensor and HW Block A and B as sub-devices.
 
 The media API allows you to reconfigure the links between the subdevices
 and
 the device nodes, so you can decide how the video flows through the
system.
 
 In addition, the sub-devices will get their own device node so you can
 control
 them from userspace. This gives you much more precise control over your
 system.

The H/W Blocks is connected with AMBA bus with the core(ARM926EJS).
And it is already made by platform device now. We base the kernel
version 2.6.34. Sorry for not informing this before.

But, if using media framework or any other ideas is right for V4L2
frameworks, I intend to change this code.

 So in preview mode the video goes from the sensor to block A, then to
 block B
 (using the internal FIFO), then then it goes to an LCD or something like
 that?

Yes, you're right.

 
 And in capture mode it goes from the sensor to Block A and then to the DMA
 engine? Or does it also go through block B first? It's not clear from your
 description.

The first thing is right. It is decided in the Block A, whether FIFO
in preview mode or DMA in capture mode. After Block A take the stream 
from sensor to DMA-ed memory, The Block B can get the streams from
Block A's DMA-ed memory in the capture mode. 

so I one more try the diagram,

a) In preview mode


   +-+
   |FIFO Link|
   +---|  using  |---+
   |   |  Internal SRAM  |   |
   +---+   |   +-+   |
   | C |   | |
   | C |  ++--+  +-+
   | D |  |  H/W Block A  |--| H/W Block B |
   |   |  +---+---+  Vsync issued+-+
   | S +--+ Sensor| Pre - |  using interrupt | Post -  |
   | E |  | Interface | Processor |  recognized at   | Processor   |
   | N |  ++--+---+  H/W Block B +-+---+
   | S |   |  ||
   | O |   +--+|
   | R |Vsync issued   | DMA 
   +---+using interrupt| Link
recognized |
in H/W Block A |
   |
   +---+---+
   | DMA Bus   |
   +---+


b) In capture mode

   +-+
   |FIFO Link|
   |  using  |
   |  Internal SRAM  |
   +---+   +-+
   | C | 
   | C |  ++--+  +-+
   | D |  |  H/W Block A  |--| H/W Block B |
   |   |  +---+---+  Vsync issued+-+
   | S +--+ Sensor| Pre - |  using interrupt | Post -  |
   | E |  | Interface | Processor |  recognized at   | Processor   |
   | N |  ++--+---+  H/W Block B +-+---+
   | S |   |  |   | 
   | O |   +--+   |
   | R |Vsync issued  ++ 
   +---+using interrupt| DMA
recognized | Link
in H/W Block A |
   |
   +---+---+
   | DMA Bus   |
   +---+

As you see, in the preview mode the SoC use path like (Sensor)-(Block A)
-(FIFO)-(Block B)-(DMA), and in the capture mode it use (Sensor)-
(Block A)-(DMA). So, Taken together, the conclusion is under here.

1) the Blocks A and B are SoC-integrated using AMBA bus.
2) in the preview mode, it's no way to define buf_type using V4L2 classic
method. (cause of no buffers)
3) in the preview mode, there is another option is using media 

Re: [PATCH v1 7/7] v4l: videobuf2: add CMA allocator

2010-09-15 Thread han jonghun
Hello,

In vb2_cma_put if buf-refcount is 0, cma_free is called.
But vb2_cma_put is usually called from munmap.
In my opinion cma_free should be called from VIDIOC_REQBUFS(0) not munmap.

BRs,

2010/9/9 Pawel Osciak p.osc...@samsung.com:
 Add support for the CMA contiguous memory allocator to videobuf2.

 Signed-off-by: Pawel Osciak p.osc...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
  drivers/media/video/Kconfig         |    5 +
  drivers/media/video/Makefile        |    2 +
  drivers/media/video/videobuf2-cma.c |  250 
 +++
  include/media/videobuf2-cma.h       |   25 
  4 files changed, 282 insertions(+), 0 deletions(-)
  create mode 100644 drivers/media/video/videobuf2-cma.c
  create mode 100644 include/media/videobuf2-cma.h

 diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
 index c2ea549..b63f377 100644
 --- a/drivers/media/video/Kconfig
 +++ b/drivers/media/video/Kconfig
 @@ -65,6 +65,11 @@ config VIDEOBUF2_VMALLOC
        select VIDEOBUF2_GEN_MEMOPS
        tristate

 +config VIDEOBUF2_CMA
 +       depends on CMA
 +       select VIDEOBUF2_CORE
 +       select VIDEOBUF2_GEN_MEMOPS
 +       tristate

  #
  # Multimedia Video device configuration
 diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
 index 20d359d..4146700 100644
 --- a/drivers/media/video/Makefile
 +++ b/drivers/media/video/Makefile
 @@ -128,6 +128,8 @@ obj-$(CONFIG_VIDEOBUF2_VMALLOC)             += 
 videobuf2_vmalloc.o
  videobuf2_vmalloc-y                    := videobuf2-vmalloc.o \
                                           videobuf2-memops.o

 +obj-$(CONFIG_VIDEOBUF2_CMA)            += videobuf2_cma.o
 +videobuf2_cma-y                                := videobuf2-cma.o 
 videobuf2-memops.o

  obj-$(CONFIG_V4L2_MEM2MEM_DEV) += v4l2-mem2mem.o

 diff --git a/drivers/media/video/videobuf2-cma.c 
 b/drivers/media/video/videobuf2-cma.c
 new file mode 100644
 index 000..c51e5a8
 --- /dev/null
 +++ b/drivers/media/video/videobuf2-cma.c
 @@ -0,0 +1,250 @@
 +/*
 + * videobuf2-cma.c - 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.
 + */
 +
 +#include linux/module.h
 +#include linux/slab.h
 +#include linux/cma.h
 +#include linux/mm.h
 +#include linux/sched.h
 +#include linux/file.h
 +
 +#include media/videobuf2-core.h
 +#include media/videobuf2-memops.h
 +
 +struct vb2_cma_conf {
 +       struct vb2_alloc_ctx    alloc_ctx;
 +       struct device           *dev;
 +       const char              *type;
 +       unsigned long           alignment;
 +};
 +
 +struct vb2_cma_buf {
 +       struct vb2_cma_conf     *conf;
 +       dma_addr_t              paddr;
 +       unsigned long           size;
 +       unsigned int            refcount;
 +       struct vm_area_struct   *vma;
 +};
 +
 +static void *vb2_cma_alloc(const struct vb2_alloc_ctx *alloc_ctx,
 +                               unsigned long size)
 +{
 +       struct vb2_cma_conf *conf =
 +               container_of(alloc_ctx, struct vb2_cma_conf, alloc_ctx);
 +       struct vb2_cma_buf *buf;
 +
 +       buf = kzalloc(sizeof *buf, GFP_KERNEL);
 +       if (!buf)
 +               return ERR_PTR(-ENOMEM);
 +
 +       buf-paddr = cma_alloc(conf-dev, conf-type, size, conf-alignment);
 +       if (!buf-paddr) {
 +               printk(KERN_ERR cma_alloc of size %ld failed\n, size);
 +               kfree(buf);
 +               return ERR_PTR(-ENOMEM);
 +       }
 +
 +       buf-conf = conf;
 +       buf-size = size;
 +       buf-refcount++;
 +
 +       printk(KERN_DEBUG Allocated cma mem of size %ld at paddr=0x%08x\n,
 +                       buf-size, buf-paddr);
 +
 +       return buf;
 +}
 +
 +static void vb2_cma_put(void *buf_priv)
 +{
 +       struct vb2_cma_buf *buf = buf_priv;
 +
 +       buf-refcount--;
 +
 +       if (0 == buf-refcount) {
 +               cma_free(buf-paddr);
 +               kfree(buf);
 +       }
 +}
 +
 +static unsigned long vb2_cma_paddr(void *buf_priv)
 +{
 +       struct vb2_cma_buf *buf = buf_priv;
 +
 +       return buf-paddr;
 +}
 +
 +static unsigned int vb2_cma_num_users(void *buf_priv)
 +{
 +       struct vb2_cma_buf *buf = buf_priv;
 +
 +       return buf-refcount;
 +}
 +
 +static void vb2_cma_vm_open(struct vm_area_struct *vma)
 +{
 +       struct vb2_cma_buf *buf = vma-vm_private_data;
 +
 +       printk(KERN_DEBUG %s cma_priv: %p, refcount: %d, 
 +                       vma: %08lx-%08lx\n, __func__, buf, buf-refcount,
 +                       vma-vm_start, vma-vm_end);
 +
 +       buf-refcount++;
 +}
 +
 +static void vb2_cma_vm_close(struct vm_area_struct *vma)
 +{
 +       struct vb2_cma_buf *buf = vma-vm_private_data;
 +
 +       printk(KERN_DEBUG %s cma_priv: %p, 

Re: [PATCH v9 1/4] V4L2: Add seek spacing and FM RX class.

2010-09-15 Thread Matti J. Aaltonen
Hello.

On Wed, 2010-09-08 at 20:35 +0200, ext Mauro Carvalho Chehab wrote:

  +   case V4L2_CID_FM_BAND:  return FM Band;
 
 There's no need for a FM control, as there's already an ioctl pair that 
 allows get/set the frequency
 bandwidth: VIDIOC_S_TUNER and VIDIOC_G_TUNER. So, the entire patch here seems 
 uneeded/unwanted.

Yes I agree, we can manage without having BAND support, but it isn't
completely covered by VIDIOC_S_TUNER and VIDIOC_G_TUNER. Actually it
would have had the biggest effect on the HW seek operation. For example
without V4L2_CID_FM_BAND using wl1273  FM radio, which supports two
bands, you need to do two seeks and band switch for every HW_SEEK IOCTL
and those seeks are kind of slow operations to begin with. You have
probably taken this into consideration but I wanted point this out
anyway... Could the seek struct have a band indicator?

B.R.
Matti


--
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] DSM-CC question

2010-09-15 Thread Simon Kilvington
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

also have a look at my rb-download code,

http://redbutton.sourceforge.net/

this gets around the problem of having to know the directory structure
before you download files by using symlinks - ie you download the files
as they arrive on the carousel, then when you get a directory you create
the directory but make all the file entries in it symlinks - if the
files have already arrived, then the links point to them, if the files
haven't arrived yet, you just have some dangling symlinks until they do

this means you don't have to worry about trying to cache files in memory
before you can write them to disc and so makes the whole thing a lot
simpler to implement

On 14/09/10 22:06, Marc Murphy wrote:
 Have a look at libdsmcc. It will write by default to /tmp/cache I have 
 modified my test software to notify of a new file or updated file version. 
 
 Hope this helps
 
 Marc
 
 Sent from my iPhone
 
 On 14 Sep 2010, at 21:31, Suchita Gupta suchitagu...@yahoo.com wrote:
 
 Hi,

 First of all, I am new to this list, so I am not sire if this is right place 
 for 
 this question.
 If not, please forgive me and point me to right list.

 I am writing a DSMCC decoding implementation to persist it to local 
 filesystem.
 I am unable to understand few thiings related to srg

 I know, it represents the top level directory. But how do I get the name of 
 this 
 directory?
 I can extract the names of subdirs and files using name components but where 
 is 
 the name of top level directory?

 Also, as far as I understand it, I can't start writing to the local 
 filesystem 
 until I have acquired the whole carousel.

 Can, anyone please provide me some guidance.

 Thanks in Advance,
 rs




 ___
 linux-dvb users mailing list
 For V4L/DVB development, please use instead linux-media@vger.kernel.org
 linux-...@linuxtv.org
 http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

 
 ___
 linux-dvb users mailing list
 For V4L/DVB development, please use instead linux-media@vger.kernel.org
 linux-...@linuxtv.org
 http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
 
 

- -- 
Simon Kilvington


-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyQlHUACgkQmt9ZifioJSwN7QCffyS4wY25IMysdwFcJEUS/Aaw
JBEAoIGShJ/kxMvOT73o7vEqfXMNKr/r
=Jf4M
-END PGP SIGNATURE-
--
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] firedtv driver: support for PSK8 for S2 devices. To watch HD.

2010-09-15 Thread Stefan Richter
Tommy Jonsson wrote at linux-media:
 This is the first i have ever developed for linux, cant really wrap my
 head around how to submit this..
 Hope im sending this correctly, diff made with 'hg diff' from latest
 hg clone http://linuxtv.org/hg/v4l-dvb;
 
 It adds support for tuning with PSK8 modulation, pilot and rolloff
 with the S2 versions of firedtv.
 
 Signed-off-by: Tommy Jonsson quazz...@gmail.com
[...]

Excellent!  This has been on the wishlist of FireDTV/FloppyDTV-S2 owners for
quite some time.

The patch was a little bit mangled by the mail user agent, and there appear to
be some whitespace issues in it.  I will have a closer look at it later today
and repost the patch so that Mauro can apply it without manual intervention.
-- 
Stefan Richter
-=-==-=- =--= -
http://arcgraph.de/sr/
--
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] firedtv driver: support for PSK8 for S2 devices. To watch HD.

2010-09-15 Thread Stefan Richter
Tommy Jonsson wrote:
 --- a/linux/drivers/media/dvb/firewire/firedtv-avc.c  Fri Sep 03
 00:28:05 2010 -0300
 +++ b/linux/drivers/media/dvb/firewire/firedtv-avc.c  Sun Sep 12
 06:52:02 2010 +0200
[...]
 @@ -368,10 +369,30 @@
   c-operand[12] = 0;
 
   if (fdtv-type == FIREDTV_DVB_S2) {
 - c-operand[13] = 0x1;
 - c-operand[14] = 0xff;
 - c-operand[15] = 0xff;
 -
 + if (fe-dtv_property_cache.delivery_system == SYS_DVBS2) {
 + switch (fe-dtv_property_cache.modulation) {
 + case QAM_16:c-operand[13] = 0x1; break;
 + case QPSK:  c-operand[13] = 0x2; break;
 + case PSK_8: c-operand[13] = 0x3; break;
 + default:c-operand[13] = 0x2; break;
 + }
 + switch (fe-dtv_property_cache.rolloff) {
 + case ROLLOFF_AUTO:  c-operand[14] = 0x2; break;
 + case ROLLOFF_35:c-operand[14] = 0x2; break;
 + case ROLLOFF_20:c-operand[14] = 0x0; break;
 + case ROLLOFF_25:c-operand[14] = 0x1; break;
 + /* case ROLLOFF_NONE:   c-operand[14] = 0xff; break; */
 + }
 + switch (fe-dtv_property_cache.pilot) {
 + case PILOT_AUTO:c-operand[15] = 0x0; break;
 + case PILOT_OFF: c-operand[15] = 0x0; break;
 + case PILOT_ON:  c-operand[15] = 0x1; break;
 + }
 + } else {
 + c-operand[13] = 0x1;  /* auto modulation */
 + c-operand[14] = 0xff; /* disable rolloff */
 + c-operand[15] = 0xff; /* disable pilot */
 + }
   return 16;

Is it correct that there is no default: case for operand[14] and [15]?

   } else {
   return 13;
 @@ -548,7 +569,7 @@
   return 17 + add_pid_filter(fdtv, c-operand[17]);
  }
 
 -int avc_tuner_dsd(struct firedtv *fdtv,
 +int avc_tuner_dsd(struct dvb_frontend *fe, struct firedtv *fdtv,
 struct dvb_frontend_parameters *params)
  {
   struct avc_command_frame *c = (void *)fdtv-avc_data;

The frontend can be accessed via fdtv-fe also.  (I can change this together
with the whitespace things if you agree.)

 @@ -561,7 +582,7 @@
 
   switch (fdtv-type) {
   case FIREDTV_DVB_S:
 - case FIREDTV_DVB_S2: pos = avc_tuner_tuneqpsk(fdtv, params); break;
 + case FIREDTV_DVB_S2: pos = avc_tuner_tuneqpsk(fe, fdtv, params); break;
   case FIREDTV_DVB_C: pos = avc_tuner_dsd_dvb_c(fdtv, params); break;
   case FIREDTV_DVB_T: pos = avc_tuner_dsd_dvb_t(fdtv, params); break;
   default:
 diff -r 6e0befab696a linux/drivers/media/dvb/firewire/firedtv-fe.c
 --- a/linux/drivers/media/dvb/firewire/firedtv-fe.c   Fri Sep 03
 00:28:05 2010 -0300
 +++ b/linux/drivers/media/dvb/firewire/firedtv-fe.c   Sun Sep 12
 06:52:02 2010 +0200
[...]
 @@ -155,6 +156,17 @@
   return -EOPNOTSUPP;
  }
 
 +static int fdtv_get_property(struct dvb_frontend *fe,
 + struct dtv_property *tvp)
 +{
 + return 0;
 +}
 +static int fdtv_set_property(struct dvb_frontend *fe,
 + struct dtv_property *tvp)
 +{
 + return 0;
 +}
 +
  void fdtv_frontend_init(struct firedtv *fdtv)
  {
   struct dvb_frontend_ops *ops = fdtv-fe.ops;
 @@ -166,6 +178,9 @@
   ops-set_frontend   = fdtv_set_frontend;
   ops-get_frontend   = fdtv_get_frontend;
 
 + ops-get_property   = fdtv_get_property;
 + ops-set_property   = fdtv_set_property;
 +
   ops-read_status= fdtv_read_status;
   ops-read_ber   = fdtv_read_ber;
   ops-read_signal_strength   = fdtv_read_signal_strength;
[...]

(Hmm, note to self:  Can't DVB core provide empty default methods?)
-- 
Stefan Richter
-=-==-=- =--= -
http://arcgraph.de/sr/
--
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: pwc driver breakage in recent(ish) kernels (for old hardware)

2010-09-15 Thread Hans Verkuil

 Hi everyone,

 I've been using a Logitech Sphere for years on various projects. This
 model is probably from the first batch ever made. In lsusb it shows up
 as

 046d:08b5 Logitech, Inc. QuickCam Sphere

 It's a bit troublesome, because on older kernel versions (~2.4.x,
 ~2.6.2x) I never had a single issue with this hardware at all, on
 several different platforms ranging from x86 to x86_64, to arm
 (ep93xx), etc. However, somewhere between then and now, the pwc driver
 underwent some changes rendering this device unusable in any recent
 kernel. All of my old apps and new apps (including cheese, mplayer,
 etc) simply hang indefinitely waiting to read a single frame (using
 the v4l2 mmap api). The v4l2 read api also hangs indefinitely (using
 pwcgrab). A few of the very old apps that I have also use the v4l1
 api, with a 2.4.26 kernel, and that actually works.

 I can verify that the hardware itself is fine on windows (also using
 very old drivers from Logitech).

 Who has been working on this driver? What were the major changes that
 have been applied? I'm guessing that the bridge / sensor init sequence
 has been messed up somehow. Any ideas?

You're in luck. I fixed this last weekend. It turns out that the
/dev/videoX device is created too soon and the HAL daemon starts to use it
immediately causing some initialization to go wrong or something like
that. Moving the creation of /dev/videoX to the end fixed this issue.

This bug has been there probably for a long time, but it is only triggered
if some other process opens the device node immediately.

Check out the pwc patch I posted last weekend.

Regards,

  Hans


 Cheers,

 Chris
 --
 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



-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco

--
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: pwc driver breakage in recent(ish) kernels (for old hardware)

2010-09-15 Thread Devin Heitmueller
On Wed, Sep 15, 2010 at 11:59 AM, Hans Verkuil hverk...@xs4all.nl wrote:
 You're in luck. I fixed this last weekend. It turns out that the
 /dev/videoX device is created too soon and the HAL daemon starts to use it
 immediately causing some initialization to go wrong or something like
 that. Moving the creation of /dev/videoX to the end fixed this issue.

 This bug has been there probably for a long time, but it is only triggered
 if some other process opens the device node immediately.

The HAL daemon opening devices immediately problem a pretty common
bug with bridges (especially for hybrid devices) and I've fixed it for
the ones I've seen.  I'm surprised we don't get reports of this more
often.

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com
--
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] firedtv driver: support for PSK8 for S2 devices. To watch HD.

2010-09-15 Thread Tommy Jonsson
Nice, thanks! I used gmail, never used a mailing-list or dealt with
patches before.
Never developed or even looked at the Linux source, so there might be
some strangeness in the code :]
I recently fixed a server-box and started using TvHeadend. Noticed
that the psk8 didn't work,
so i put the card back in a windows box and sniffed out the difference.

On Wed, Sep 15, 2010 at 1:48 PM, Stefan Richter
stef...@s5r6.in-berlin.de wrote:
 Tommy Jonsson wrote at linux-media:
 This is the first i have ever developed for linux, cant really wrap my
 head around how to submit this..
 Hope im sending this correctly, diff made with 'hg diff' from latest
 hg clone http://linuxtv.org/hg/v4l-dvb;

 It adds support for tuning with PSK8 modulation, pilot and rolloff
 with the S2 versions of firedtv.

 Signed-off-by: Tommy Jonsson quazz...@gmail.com
 [...]

 Excellent!  This has been on the wishlist of FireDTV/FloppyDTV-S2 owners for
 quite some time.

 The patch was a little bit mangled by the mail user agent, and there appear to
 be some whitespace issues in it.  I will have a closer look at it later today
 and repost the patch so that Mauro can apply it without manual intervention.
 --
 Stefan Richter
 -=-==-=- =--= -
 http://arcgraph.de/sr/

--
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: [GIT PATCHES FOR 2.6.37] Remove V4L1 support from the pwc driver

2010-09-15 Thread Hans Verkuil
On Sunday, September 12, 2010 22:26:11 Hans Verkuil wrote:
 Thanks to Hans de Goede for supplying me with a Philips webcam to test this
 driver with!
 
 And other news on the V4L1 front:
 
 I have since learned that the stradis driver has only ever worked for kernel 
 2.2.
 I did contact the company and unless they want to work on it this driver can 
 be
 removed soon.
 
 I'm waiting for test results on the cpia2 driver. If it works, then the V4L1
 support can be removed from that driver as well.
 
 Regards,
 
   Hans
 
 The following changes since commit 57fef3eb74a04716a8dd18af0ac510ec4f71bc05:
   Richard Zidlicky (1):
 V4L/DVB: dvb: fix smscore_getbuffer() logic
 
 are available in the git repository at:
 
   ssh://linuxtv.org/git/hverkuil/v4l-dvb.git pwc
 
 Hans Verkuil (1):
   pwc: fully convert driver to V4L2

As requested by Mauro I also added:

  pwc: remove BKL

Tested with the Philips webcam.

Regards,

Hans

 
  drivers/media/video/pwc/Kconfig  |2 +-
  drivers/media/video/pwc/pwc-ctrl.c   |   20 +-
  drivers/media/video/pwc/pwc-if.c |   23 +-
  drivers/media/video/pwc/pwc-misc.c   |4 +-
  drivers/media/video/pwc/pwc-uncompress.c |2 +-
  drivers/media/video/pwc/pwc-v4l.c|  322 
 +-
  drivers/media/video/pwc/pwc.h|6 +-
  7 files changed, 40 insertions(+), 339 deletions(-)
 
 

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG, part of Cisco
--
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] firedtv driver: support for PSK8 for S2 devices. To watch HD.

2010-09-15 Thread Tommy Jonsson
Oh, read the first question a bit wrong, yeah i have missed the
default case for 14  15.
Should probably be AUTO/35  AUTO/OFF.

On Wed, Sep 15, 2010 at 1:58 PM, Stefan Richter
stef...@s5r6.in-berlin.de wrote:
 Tommy Jonsson wrote:
 --- a/linux/drivers/media/dvb/firewire/firedtv-avc.c  Fri Sep 03
 00:28:05 2010 -0300
 +++ b/linux/drivers/media/dvb/firewire/firedtv-avc.c  Sun Sep 12
 06:52:02 2010 +0200
 [...]
 @@ -368,10 +369,30 @@
               c-operand[12] = 0;

       if (fdtv-type == FIREDTV_DVB_S2) {
 -             c-operand[13] = 0x1;
 -             c-operand[14] = 0xff;
 -             c-operand[15] = 0xff;
 -
 +             if (fe-dtv_property_cache.delivery_system == SYS_DVBS2) {
 +                     switch (fe-dtv_property_cache.modulation) {
 +                     case QAM_16:            c-operand[13] = 0x1; break;
 +                     case QPSK:              c-operand[13] = 0x2; break;
 +                     case PSK_8:             c-operand[13] = 0x3; break;
 +                     default:                c-operand[13] = 0x2; break;
 +                     }
 +                     switch (fe-dtv_property_cache.rolloff) {
 +                     case ROLLOFF_AUTO:      c-operand[14] = 0x2; break;
 +                     case ROLLOFF_35:        c-operand[14] = 0x2; break;
 +                     case ROLLOFF_20:        c-operand[14] = 0x0; break;
 +                     case ROLLOFF_25:        c-operand[14] = 0x1; break;
 +                     /* case ROLLOFF_NONE:   c-operand[14] = 0xff; break; 
 */
 +                     }
 +                     switch (fe-dtv_property_cache.pilot) {
 +                     case PILOT_AUTO:        c-operand[15] = 0x0; break;
 +                     case PILOT_OFF:         c-operand[15] = 0x0; break;
 +                     case PILOT_ON:          c-operand[15] = 0x1; break;
 +                     }
 +             } else {
 +                     c-operand[13] = 0x1;  /* auto modulation */
 +                     c-operand[14] = 0xff; /* disable rolloff */
 +                     c-operand[15] = 0xff; /* disable pilot */
 +             }
               return 16;

 Is it correct that there is no default: case for operand[14] and [15]?

       } else {
               return 13;
 @@ -548,7 +569,7 @@
       return 17 + add_pid_filter(fdtv, c-operand[17]);
  }

 -int avc_tuner_dsd(struct firedtv *fdtv,
 +int avc_tuner_dsd(struct dvb_frontend *fe, struct firedtv *fdtv,
                 struct dvb_frontend_parameters *params)
  {
       struct avc_command_frame *c = (void *)fdtv-avc_data;

 The frontend can be accessed via fdtv-fe also.  (I can change this together
 with the whitespace things if you agree.)

 @@ -561,7 +582,7 @@

       switch (fdtv-type) {
       case FIREDTV_DVB_S:
 -     case FIREDTV_DVB_S2: pos = avc_tuner_tuneqpsk(fdtv, params); break;
 +     case FIREDTV_DVB_S2: pos = avc_tuner_tuneqpsk(fe, fdtv, params); break;
       case FIREDTV_DVB_C: pos = avc_tuner_dsd_dvb_c(fdtv, params); break;
       case FIREDTV_DVB_T: pos = avc_tuner_dsd_dvb_t(fdtv, params); break;
       default:
 diff -r 6e0befab696a linux/drivers/media/dvb/firewire/firedtv-fe.c
 --- a/linux/drivers/media/dvb/firewire/firedtv-fe.c   Fri Sep 03
 00:28:05 2010 -0300
 +++ b/linux/drivers/media/dvb/firewire/firedtv-fe.c   Sun Sep 12
 06:52:02 2010 +0200
 [...]
 @@ -155,6 +156,17 @@
       return -EOPNOTSUPP;
  }

 +static int fdtv_get_property(struct dvb_frontend *fe,
 +                             struct dtv_property *tvp)
 +{
 +     return 0;
 +}
 +static int fdtv_set_property(struct dvb_frontend *fe,
 +                             struct dtv_property *tvp)
 +{
 +     return 0;
 +}
 +
  void fdtv_frontend_init(struct firedtv *fdtv)
  {
       struct dvb_frontend_ops *ops = fdtv-fe.ops;
 @@ -166,6 +178,9 @@
       ops-set_frontend               = fdtv_set_frontend;
       ops-get_frontend               = fdtv_get_frontend;

 +     ops-get_property               = fdtv_get_property;
 +     ops-set_property               = fdtv_set_property;
 +
       ops-read_status                = fdtv_read_status;
       ops-read_ber                   = fdtv_read_ber;
       ops-read_signal_strength       = fdtv_read_signal_strength;
 [...]

 (Hmm, note to self:  Can't DVB core provide empty default methods?)
 --
 Stefan Richter
 -=-==-=- =--= -
 http://arcgraph.de/sr/

--
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: Fw: [linux-dvb] DSM-CC question

2010-09-15 Thread Peter Evertz
Or take a look at mhp or dsmcc plugins for vdr. Both not activ 
projects, but both have a dsmcc implementation.


Are you working on a hbbtv solution ?

Simon Liddicott schrieb:

Have you had a look at the code for redbutton?

http://redbutton.sourceforge.net/

Si

On 14 September 2010 21:32, Suchita Gupta suchitagu...@yahoo.com wrote:
  

Hi,

First of all, I am new to this list, so I am not sire if this is right place for

this question.
If not, please forgive me and point me to right list.

I am writing a DSMCC decoding implementation to persist it to local filesystem.
I am unable to understand few thiings related to srg

I know, it represents the top level directory. But how do I get the name of this

directory?
I can extract the names of subdirs and files using name components but where is
the name of top level directory?

Also, as far as I understand it, I can't start writing to the local filesystem
until I have acquired the whole carousel.

Can, anyone please provide me some guidance.

Thanks in Advance,
rs




___
linux-dvb users mailing list
For V4L/DVB development, please use instead linux-media@vger.kernel.org
linux-...@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb




--
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
  


--
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


[GIT PATCHES FOR 2.6.37] Remove v4l2-i2c-drv.h and most of i2c-id.h

2010-09-15 Thread Hans Verkuil
Mauro, Jean, Janne,

This patch series finally retires the hackish v4l2-i2c-drv.h. It served 
honorably,
but now that the hg repository no longer supports kernels 2.6.26 it is time to
remove it.

Note that this patch series builds on the vtx-removal patch series.

Several patches at the end remove unused i2c-id.h includes and remove bogus uses
of the I2C_HW_ defines (as found in i2c-id.h).

After applying this patch series I get the following if I grep for
I2C_HW_ in the kernel sources:

skip some false positives in drivers/gpu
drivers/staging/lirc/lirc_i2c.c:if (adap-id == 
I2C_HW_B_CX2388x)
drivers/staging/lirc/lirc_i2c.c:if (adap-id == 
I2C_HW_B_CX2388x) {
drivers/staging/lirc/lirc_zilog.c:#ifdef I2C_HW_B_HDPVR
drivers/staging/lirc/lirc_zilog.c:  if (ir-c_rx.adapter-id == 
I2C_HW_B_HDPVR) {
drivers/staging/lirc/lirc_zilog.c:#ifdef I2C_HW_B_HDPVR
drivers/staging/lirc/lirc_zilog.c:  if (ir-c_rx.adapter-id == 
I2C_HW_B_HDPVR)
drivers/video/riva/rivafb-i2c.c:chan-adapter.id= 
I2C_HW_B_RIVA;
drivers/media/video/ir-kbd-i2c.c:   if (ir-c-adapter-id == 
I2C_HW_SAA7134  ir-c-addr == 0x30)
drivers/media/video/ir-kbd-i2c.c:   if (adap-id == 
I2C_HW_B_CX2388x) {
drivers/media/video/saa7134/saa7134-i2c.c:  .id= I2C_HW_SAA7134,
drivers/media/video/cx88/cx88-i2c.c:core-i2c_adap.id = I2C_HW_B_CX2388x;
drivers/media/video/cx88/cx88-vp3054-i2c.c: vp3054_i2c-adap.id = 
I2C_HW_B_CX2388x;

Jean, I guess the one in rivafb-i2c.c can just be removed, right?

Janne, the HDPVR checks in lirc no longer work since hdpvr never sets the
adapter ID (nor should it). This lirc code should be checked. I haven't
been following the IR changes, but there must be a better way of doing this.

The same is true for the CX2388x and SAA7134 checks. These all relate to the
IR subsystem.

Once we fixed these remaining users of the i2c-id.h defines, then Jean can
remove that header together with the adapter's 'id' field.

Regards,

Hans

The following changes since commit 991403c594f666a2ed46297c592c60c3b9f4e1e2:
  Mauro Carvalho Chehab (1):
V4L/DVB: cx231xx: Avoid an OOPS when card is unknown (card=0)

are available in the git repository at:

  ssh://linuxtv.org/git/hverkuil/v4l-dvb.git i2c

Hans Verkuil (49):
  saa5246a/saa5249: Remove obsolete teletext drivers
  videotext: remove this obsolete API
  Documentation: update now that the vtx/videotext API has been removed.
  Merge branch 'vtx' into i2c

The patches above are the same as the vtx patch series posted before. This
patch series requires that vtx is merged first as there is no point to convert
i2c drivers that are going to be removed anyway!

  vp27smpx: remove obsolete v4l2-i2c-drv.h header
  wm8739: remove obsolete v4l2-i2c-drv.h header
  cs5345: remove obsolete v4l2-i2c-drv.h header
  saa717x: remove obsolete v4l2-i2c-drv.h header
  saa7115: remove obsolete v4l2-i2c-drv.h header.
  tda9840: remove obsolete v4l2-i2c-drv.h header
  ov7670: remove obsolete v4l2-i2c-drv.h header
  mt9v011: remove obsolete v4l2-i2c-drv.h header
  upd64031a: remove obsolete v4l2-i2c-drv.h header
  saa6588: remove obsolete v4l2-i2c-drv.h header
  saa6752hs: remove obsolete v4l2-i2c-drv.h header
  bt819: remove obsolete v4l2-i2c-drv.h header
  indycam: remove obsolete v4l2-i2c-drv.h header
  m52790: remove obsolete v4l2-i2c-drv.h header
  saa7185: remove obsolete v4l2-i2c-drv.h header
  msp3400: remove obsolete v4l2-i2c-drv.h header
  bt866: remove obsolete v4l2-i2c-drv.h header
  tea6415c: remove obsolete v4l2-i2c-drv.h header
  tvaudio: remove obsolete v4l2-i2c-drv.h header
  wm8775: remove obsolete v4l2-i2c-drv.h header
  adv7175: remove obsolete v4l2-i2c-drv.h header
  saa7191: remove obsolete v4l2-i2c-drv.h header
  bt856: remove obsolete v4l2-i2c-drv.h header
  tlv320aic23b: remove obsolete v4l2-i2c-drv.h header
  tuner: remove obsolete v4l2-i2c-drv.h header
  tda9875: remove obsolete v4l2-i2c-drv.h header
  saa7110: remove obsolete v4l2-i2c-drv.h header
  tda7432: remove obsolete v4l2-i2c-drv.h header
  tea6420: remove obsolete v4l2-i2c-drv.h header
  cs53l32a: remove obsolete v4l2-i2c-drv.h header
  vpx3220: remove obsolete v4l2-i2c-drv.h header
  tvp5150: remove obsolete v4l2-i2c-drv.h header
  upd64083: remove obsolete v4l2-i2c-drv.h header
  saa7127: remove obsolete v4l2-i2c-drv.h header
  cx25840: remove obsolete v4l2-i2c-drv.h header
  adv7170: remove obsolete v4l2-i2c-drv.h header
  ks0127: remove obsolete v4l2_i2c_drv.h header
  au8522_decoder: remove obsolete v4l2-i2c-drv.h header
  s2250: remove obsolete v4l2-i2c-drv.h header
  v4l: remove unused i2c-id.h headers
  tvaudio: remove obsolete tda8425 initialization
  saa7146/tuner: remove mxb hack
  ir-kbd-i2c: remove obsolete 

Re: Leadtek DTV2000DS remote

2010-09-15 Thread Antti Palosaari
Leadtek WinFast DTV2000DS remote is not supported at all. Leadtek 
WinFast DTV Dongle Gold remote is. If you can compile and install latest 
drivers from http://git.linuxtv.org/anttip/media_tree.git af9015 tree I 
can add support for that remote rather easily.


Antti



On 09/15/2010 10:45 AM, Gregory Orange wrote:

Shall I assume that noone has had any experience with one of these
devices? From some input from other sources, I'm now not sure if I
lack a kernel module, or perhaps the firmware for this device isn't
supported (or somesuch - a bit confused on that).

In any case, pretty well everything is now working including EIT at
last. The remote is all I lack. I have no idea who else to ask or what
to try, so I may try borrowing a different remote. I'm all Googled out
(:

Regards,
Greg.

On 9 September 2010 22:11, Gregory Orangegregory.ora...@gmail.com  wrote:

Hi all, first post.

I have a newly purchased Leadtek DTV2000DS dual tuner card in my
machine, configured and running in Mythbuntu 10.04 (after installing
latest v4l-dvb from source). I am having a bit of trouble getting the
supplied remote control working. Is anyone here able to assist? I
asked on the LIRC sf.net list and after a bit of back and forth I was
directed to see if you guys can help me. In particular I wonder if the
author of dvb_usb_af9015 and af9013 is around - hmm, seems to be Antti
Palosaari, who seems to be a fairly recent poster. Don't get me wrong
though - anyone who can assist would be great (:

I have confirmed that the hardware works - I installed the drivers in
a Windows boot, and the remote works.

In terms of driver support I'm not sure exactly what I'm looking for,
but there is this line in dmesg:
[   22.263721] input: IR-receiver inside an USB DVB receiver as
/devices/pci:00/:00:0e.0/:02:0a.2/usb2/2-1/input/input5

cat /proc/bus/input/devices yields
I: Bus=0003 Vendor=0413 Product=6a04 Version=0200
N: Name=IR-receiver inside an USB DVB receiver
P: Phys=usb-:02:0a.2-1/ir0
S: Sysfs=/devices/pci:00/:00:0e.0/:02:0a.2/usb2/2-1/input/input5
U: Uniq=
H: Handlers=kbd event5
B: EV=3
B: KEY=108fc310 2802891 0 0 0 0 118000 200180 4803 e1680 0 10 ffe

So I've been using /dev/input/event5 in my tests. I have tried using
evtest, mode2, and irw to no avail. I get no indication of any signal
coming from the remote. Am I missing a kernel driver module? Any
further advice or specific experience with this device would be
gratefully welcomed.

Cheers,
Greg.

--
Gregory Orange








--
http://palosaari.fi/
--
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 v1 1/7] v4l: add videobuf2 Video for Linux 2 driver framework

2010-09-15 Thread Pawel Osciak

Hello Mauro,

Thank you for the review. Please see my responses inline.
Please also note that my e-mail address has changed.

On 09/09/2010 07:29 PM, Mauro Carvalho Chehab wrote:

Em 09-09-2010 06:19, Pawel Osciak escreveu:

Videobuf2 is a Video for Linux 2 API-compatible driver framework for
multimedia devices. It acts as an intermediate layer between userspace
applications and device drivers. It also provides low-level, modular
memory management functions for drivers.

Videobuf2 eases driver development, reduces drivers' code size and

aids in

proper and consistent implementation of V4L2 API in drivers.

Videobuf2 memory management backend is fully modular. This allows custom
memory management routines for devices and platforms with non-standard
memory management requirements to be plugged in, without changing the
high-level buffer management functions and API.

The framework provides:
- implementations of streaming I/O V4L2 ioctls and file operations
- high-level video buffer, video queue and state management functions
- video buffer memory allocation and management

Signed-off-by: Pawel Osciakp.osc...@samsung.com
Signed-off-by: Kyungmin Parkkyungmin.p...@samsung.com
---
  drivers/media/video/Kconfig  |3 +
  drivers/media/video/Makefile |2 +
  drivers/media/video/videobuf2-core.c | 1457++
  include/media/videobuf2-core.h   |  337 
  4 files changed, 1799 insertions(+), 0 deletions(-)
  create mode 100644 drivers/media/video/videobuf2-core.c
  create mode 100644 include/media/videobuf2-core.h



(snip)


+/**
+ * __vb2_wait_for_done_vb() - wait for a buffer to become available
+ * for dequeuing
+ *
+ * Will sleep if required for nonblocking == false.
+ */
+static int __vb2_wait_for_done_vb(struct vb2_queue *q, int nonblocking)
+{
+   int retval = 0;
+
+checks:
+   if (!q-streaming) {
+   dprintk(1, Streaming off, will not wait for buffers\n);
+   retval = -EINVAL;
+   goto end;
+   }
+
+   /*
+* Buffers may be added to vb_done_list without holding the vb_lock,
+* but removal is performed only while holding both vb_lock and the
+* vb_done_lock spinlock. Thus we can be sure that as long as we hold
+* vb_lock, the list will remain not empty if this check succeeds.
+*/
+   if (list_empty(q-done_list)) {
+   if (nonblocking) {
+   dprintk(1, Nonblocking and no buffers to dequeue, 
+   will not wait\n);
+   retval = -EAGAIN;
+   goto end;
+   }
+
+   /*
+* We are streaming and nonblocking, wait for another buffer to
+* become ready or for streamoff. vb_lock is released to allow
+* streamoff or qbuf to be called while waiting.
+*/
+   mutex_unlock(q-vb_lock);


There's no mutex_lock before this call inside this function... It doesn't
seem to be a good idea to call it with a mutex locked, and having aunlock/lock
inside the fuction. The better would be to call it with mutexunlocked and let it
lock/unlock where needed.



Hm, this might be tricky... I am pretty sure we have to hold the vb_lock for the
duration of dqbuf, so I cannot call it without holding the vb_lock. Would you
prefer to put that whole code into dqbuf? Sorry, I am not sure I understood you
correctly here...


+   /*
+* Although the mutex is released here, we will be reevaluating
+* both conditions again after reacquiring it.
+*/
+   dprintk(3, Will sleep waiting for buffers\n);
+   retval = wait_event_interruptible(q-done_wq,
+   !list_empty(q-done_list) || !q-streaming);


I think you could have a race condition here, as you're checking forlist_empty
without a lock. The better approach would be to do something like:

static int vb2_is_videobuf_empty(struct vb2_queue *q)
{
int is_empty;

mutex_lock(q-vb_lock);

is_empty = list_empty(q-done_list);

mutex_unlock(q-vb_lock);

return is_empty;
}

static int __vb2_wait_for_done_vb(struct vb2_queue *q, int nonblocking)
{
...
retval = wait_event_interruptible(q-done_wq,vb2_is_videobuf_empty(q) || 
!q-streaming);
...
}

This way, you'll always have the mutex locked when checking for listempty.

Btw, shouldn't it be using, instead a spinlock?



There are two locks to be considered here:
- vb_lock - main mutex protecting most of the calls
- done_lock - a spinlock protecting done_list

Both vb_lock and done_lock have to be held to remove items from the
done_list, but only done_lock has to be held to add items to the
done_list.

After we check the done_list and find it non-empty, it will
stay that way as long as we hold vb_lock. It is possible that
new 

Re: [PATCH v1 7/7] v4l: videobuf2: add CMA allocator

2010-09-15 Thread Pawel Osciak

Hello,

On 09/15/2010 10:55 AM, han jonghun wrote:

Hello,

In vb2_cma_put if buf-refcount is 0, cma_free is called.
But vb2_cma_put is usually called from munmap.
In my opinion cma_free should be called from VIDIOC_REQBUFS(0) not munmap.



cma_free has to be called from both, since we do not always call
VIDIOC_REQBUFS(0) after finishing. If an application just closes
the file descriptor (or even dies), we need a way to clean up the
memory.

--
Best regards,
Pawel Osciak
--
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 5/6] Input: ati-remote2 - switch to using new keycode interface

2010-09-15 Thread Ville Syrjälä
On Mon, Sep 13, 2010 at 09:28:07AM -0700, Dmitry Torokhov wrote:
 On Thu, Sep 09, 2010 at 03:40:04PM +0300, Ville Syrjälä wrote:
  On Wed, Sep 08, 2010 at 12:42:05AM -0700, Dmitry Torokhov wrote:
   Switch the code to use new style of getkeycode and setkeycode
   methods to allow retrieving and setting keycodes not only by
   their scancodes but also by index.
   
   Signed-off-by: Dmitry Torokhov d...@mail.ru
   ---
   
drivers/input/misc/ati_remote2.c |   93 
   +++---
1 files changed, 65 insertions(+), 28 deletions(-)
   
   diff --git a/drivers/input/misc/ati_remote2.c 
   b/drivers/input/misc/ati_remote2.c
   index 2325765..b2e0d82 100644
   --- a/drivers/input/misc/ati_remote2.c
   +++ b/drivers/input/misc/ati_remote2.c
   @@ -483,51 +483,88 @@ static void ati_remote2_complete_key(struct urb 
   *urb)
}

static int ati_remote2_getkeycode(struct input_dev *idev,
   -   unsigned int scancode, unsigned int *keycode)
   +   struct input_keymap_entry *ke)
{
 struct ati_remote2 *ar2 = input_get_drvdata(idev);
 unsigned int mode;
   - int index;
   + int offset;
   + unsigned int index;
   + unsigned int scancode;
   +
   + if (ke-flags  INPUT_KEYMAP_BY_INDEX) {
   + index = ke-index;
   + if (index = (ATI_REMOTE2_MODES - 1) *
 
  That -1 looks wrong. Same in setkeycode().
  
 
 Yes, indeed. Thanks for noticing.

I fixed this bug locally and gave this a short whirl with my RWII.
I tried both the old and new style keycode ioctls. Everything
worked as expected.

So if you want more tags feel free to add my Acked-by and Tested-by
for this (assuming the off-by-one fix is included) and you can add my
Tested-by for patch 1/6 as well.

-- 
Ville Syrjälä
syrj...@sci.fi
http://www.sci.fi/~syrjala/
--
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 5/6] Input: ati-remote2 - switch to using new keycode interface

2010-09-15 Thread Dmitry Torokhov
On Thu, Sep 16, 2010 at 12:04:19AM +0300, Ville Syrjälä wrote:
 On Mon, Sep 13, 2010 at 09:28:07AM -0700, Dmitry Torokhov wrote:
  On Thu, Sep 09, 2010 at 03:40:04PM +0300, Ville Syrjälä wrote:
   On Wed, Sep 08, 2010 at 12:42:05AM -0700, Dmitry Torokhov wrote:
Switch the code to use new style of getkeycode and setkeycode
methods to allow retrieving and setting keycodes not only by
their scancodes but also by index.

Signed-off-by: Dmitry Torokhov d...@mail.ru
---

 drivers/input/misc/ati_remote2.c |   93 
+++---
 1 files changed, 65 insertions(+), 28 deletions(-)

diff --git a/drivers/input/misc/ati_remote2.c 
b/drivers/input/misc/ati_remote2.c
index 2325765..b2e0d82 100644
--- a/drivers/input/misc/ati_remote2.c
+++ b/drivers/input/misc/ati_remote2.c
@@ -483,51 +483,88 @@ static void ati_remote2_complete_key(struct urb 
*urb)
 }
 
 static int ati_remote2_getkeycode(struct input_dev *idev,
- unsigned int scancode, unsigned int 
*keycode)
+ struct input_keymap_entry *ke)
 {
struct ati_remote2 *ar2 = input_get_drvdata(idev);
unsigned int mode;
-   int index;
+   int offset;
+   unsigned int index;
+   unsigned int scancode;
+
+   if (ke-flags  INPUT_KEYMAP_BY_INDEX) {
+   index = ke-index;
+   if (index = (ATI_REMOTE2_MODES - 1) *
  
   That -1 looks wrong. Same in setkeycode().
   
  
  Yes, indeed. Thanks for noticing.
 
 I fixed this bug locally and gave this a short whirl with my RWII.
 I tried both the old and new style keycode ioctls. Everything
 worked as expected.
 
 So if you want more tags feel free to add my Acked-by and Tested-by
 for this (assuming the off-by-one fix is included)

Thank you very much for reviewing and testing it Ville, I will surely
add the tags.

 and you can add my
 Tested-by for patch 1/6 as well.
 

This one is already in public branch; I prefer not to rewind unless
there are compile or other major issues

-- 
Dmitry
--
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] V4L/DVB: v4l: fsl-viu.c: add slab.h include to fix compile breakage

2010-09-15 Thread Anatolij Gustschin
mpc512x kernel configurations without SPI support do not build:

drivers/media/video/fsl-viu.c: In function 'viu_open':
drivers/media/video/fsl-viu.c:1248: error: implicit declaration of function 
'kzalloc'
drivers/media/video/fsl-viu.c:1248: warning: assignment makes pointer from 
integer without a cast
drivers/media/video/fsl-viu.c: In function 'viu_release':
drivers/media/video/fsl-viu.c:1335: error: implicit declaration of function 
'kfree'

If CONFIG_SPI is enabled, the slab.h will be included in
linux/spi/spi.h which is included by media/v4l2-common.h
and the fsl_viu.c driver builds.

Let's incluce linux/slab.h directly to fix the build breakage.

Signed-off-by: Anatolij Gustschin ag...@denx.de
---
 drivers/media/video/fsl-viu.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c
index 43d208f..0b318be 100644
--- a/drivers/media/video/fsl-viu.c
+++ b/drivers/media/video/fsl-viu.c
@@ -22,6 +22,7 @@
 #include linux/interrupt.h
 #include linux/io.h
 #include linux/of_platform.h
+#include linux/slab.h
 #include linux/version.h
 #include media/v4l2-common.h
 #include media/v4l2-device.h
-- 
1.7.0.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


[PATCH] drivers/media/video/ivtv/ivtvfb.c: prevent reading uninitialized stack memory

2010-09-15 Thread Dan Rosenberg
The FBIOGET_VBLANK device ioctl allows unprivileged users to read 16
bytes of uninitialized stack memory, because the reserved member of
the fb_vblank struct declared on the stack is not altered or zeroed
before being copied back to the user.  This patch takes care of it.

Signed-off-by: Dan Rosenberg dan.j.rosenb...@gmail.com

--- linux-2.6.35.4.orig/drivers/media/video/ivtv/ivtvfb.c   2010-08-26 
19:47:12.0 -0400
+++ linux-2.6.35.4/drivers/media/video/ivtv/ivtvfb.c2010-09-15 
14:16:46.797375399 -0400
@@ -458,6 +458,8 @@ static int ivtvfb_ioctl(struct fb_info *
struct fb_vblank vblank;
u32 trace;
 
+   memset(vblank, 0, sizeof(struct fb_vblank));
+
vblank.flags = FB_VBLANK_HAVE_COUNT 
|FB_VBLANK_HAVE_VCOUNT |
FB_VBLANK_HAVE_VSYNC;
trace = read_reg(IVTV_REG_DEC_LINE_FIELD)  16;




--
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 1/8] V4L/DVB: radio-si470x: remove the BKL lock used internally at the driver

2010-09-15 Thread Mauro Carvalho Chehab
diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c 
b/drivers/media/radio/si470x/radio-si470x-usb.c
index 5ec13e5..392e84f 100644
--- a/drivers/media/radio/si470x/radio-si470x-usb.c
+++ b/drivers/media/radio/si470x/radio-si470x-usb.c
@@ -517,7 +517,7 @@ int si470x_fops_open(struct file *file)
struct si470x_device *radio = video_drvdata(file);
int retval;
 
-   lock_kernel();
+   mutex_lock(radio-lock);
radio-users++;
 
retval = usb_autopm_get_interface(radio-intf);
@@ -558,7 +558,7 @@ int si470x_fops_open(struct file *file)
}
 
 done:
-   unlock_kernel();
+   mutex_unlock(radio-lock);
return retval;
 }
 
@@ -577,7 +577,7 @@ int si470x_fops_release(struct file *file)
goto done;
}
 
-   mutex_lock(radio-disconnect_lock);
+   mutex_lock(radio-lock);
radio-users--;
if (radio-users == 0) {
/* shutdown interrupt handler */
@@ -591,7 +591,7 @@ int si470x_fops_release(struct file *file)
video_unregister_device(radio-videodev);
kfree(radio-int_in_buffer);
kfree(radio-buffer);
-   mutex_unlock(radio-disconnect_lock);
+   mutex_unlock(radio-lock);
kfree(radio);
goto done;
}
@@ -603,7 +603,7 @@ int si470x_fops_release(struct file *file)
retval = si470x_stop(radio);
usb_autopm_put_interface(radio-intf);
}
-   mutex_unlock(radio-disconnect_lock);
+   mutex_unlock(radio-lock);
 done:
return retval;
 }
@@ -661,7 +661,6 @@ static int si470x_usb_driver_probe(struct usb_interface 
*intf,
radio-disconnected = 0;
radio-usbdev = interface_to_usbdev(intf);
radio-intf = intf;
-   mutex_init(radio-disconnect_lock);
mutex_init(radio-lock);
 
iface_desc = intf-cur_altsetting;
@@ -830,7 +829,7 @@ static void si470x_usb_driver_disconnect(struct 
usb_interface *intf)
 {
struct si470x_device *radio = usb_get_intfdata(intf);
 
-   mutex_lock(radio-disconnect_lock);
+   mutex_lock(radio-lock);
radio-disconnected = 1;
usb_set_intfdata(intf, NULL);
if (radio-users == 0) {
@@ -843,10 +842,10 @@ static void si470x_usb_driver_disconnect(struct 
usb_interface *intf)
kfree(radio-int_in_buffer);
video_unregister_device(radio-videodev);
kfree(radio-buffer);
-   mutex_unlock(radio-disconnect_lock);
+   mutex_unlock(radio-lock);
kfree(radio);
} else {
-   mutex_unlock(radio-disconnect_lock);
+   mutex_unlock(radio-lock);
}
 }
 
diff --git a/drivers/media/radio/si470x/radio-si470x.h 
b/drivers/media/radio/si470x/radio-si470x.h
index 3cd0a29..d3d86ba 100644
--- a/drivers/media/radio/si470x/radio-si470x.h
+++ b/drivers/media/radio/si470x/radio-si470x.h
@@ -177,7 +177,6 @@ struct si470x_device {
 
/* driver management */
unsigned char disconnected;
-   struct mutex disconnect_lock;
 #endif
 
 #if defined(CONFIG_I2C_SI470X) || defined(CONFIG_I2C_SI470X_MODULE)
-- 
1.7.1


--
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 3/8] V4L/DVB: bttv-driver: document functions using mutex_lock

2010-09-15 Thread Mauro Carvalho Chehab
There are a few ancillary static routines used by ioctl functions
that takes bttv lock internally. As we'll be adding the same lock
for all ioctl's that need, we need to properly document them, to
avoid doing double locks

Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com

diff --git a/drivers/media/video/bt8xx/bttv-driver.c 
b/drivers/media/video/bt8xx/bttv-driver.c
index 38c7f78..fcafe2f 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -842,7 +842,7 @@ static const struct v4l2_queryctrl *ctrl_by_id(int id)
 RESOURCE_OVERLAY)
 
 static
-int check_alloc_btres(struct bttv *btv, struct bttv_fh *fh, int bit)
+int check_alloc_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bit)
 {
int xbits; /* mutual exclusive resources */
 
@@ -935,7 +935,7 @@ disclaim_video_lines(struct bttv *btv)
 }
 
 static
-void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits)
+void free_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bits)
 {
if ((fh-resources  bits) != bits) {
/* trying to free ressources not allocated by us ... */
@@ -1682,7 +1682,7 @@ bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh,
kfree(old);
}
if (NULL == new)
-   free_btres(btv,fh,RESOURCE_OVERLAY);
+   free_btres_lock(btv,fh,RESOURCE_OVERLAY);
dprintk(switch_overlay: done\n);
return retval;
 }
@@ -2124,7 +2124,7 @@ bttv_crop_adjust  (struct bttv_crop * c,
also adjust the current cropping parameters to get closer to the
desired image size. */
 static int
-limit_scaled_size   (struct bttv_fh *   fh,
+limit_scaled_size_lock   (struct bttv_fh *   fh,
 __s32 *width,
 __s32 *height,
 enum v4l2_fieldfield,
@@ -2238,7 +2238,7 @@ limit_scaled_size   (struct bttv_fh *   
fh,
may also adjust the current cropping parameters to get closer
to the desired window size. */
 static int
-verify_window  (struct bttv_fh *   fh,
+verify_window_lock (struct bttv_fh *   fh,
 struct v4l2_window *   win,
 intadjust_size,
 intadjust_crop)
@@ -2292,7 +2292,7 @@ verify_window (struct bttv_fh *   
fh,
win-w.width -= win-w.left  ~width_mask;
win-w.left = (win-w.left - width_mask - 1)  width_mask;
 
-   rc = limit_scaled_size(fh, win-w.width, win-w.height,
+   rc = limit_scaled_size_lock(fh, win-w.width, win-w.height,
   field, width_mask,
   /* width_bias: round down */ 0,
   adjust_size, adjust_crop);
@@ -2303,7 +2303,7 @@ verify_window (struct bttv_fh *   
fh,
return 0;
 }
 
-static int setup_window(struct bttv_fh *fh, struct bttv *btv,
+static int setup_window_lock(struct bttv_fh *fh, struct bttv *btv,
struct v4l2_window *win, int fixup)
 {
struct v4l2_clip *clips = NULL;
@@ -2313,7 +2313,7 @@ static int setup_window(struct bttv_fh *fh, struct bttv 
*btv,
return -EINVAL;
if (!(fh-ovfmt-flags  FORMAT_FLAGS_PACKED))
return -EINVAL;
-   retval = verify_window(fh, win,
+   retval = verify_window_lock(fh, win,
   /* adjust_size */ fixup,
   /* adjust_crop */ fixup);
if (0 != retval)
@@ -2516,7 +2516,7 @@ static int bttv_try_fmt_vid_cap(struct file *file, void 
*priv,
width = f-fmt.pix.width;
height = f-fmt.pix.height;
 
-   rc = limit_scaled_size(fh, width, height, field,
+   rc = limit_scaled_size_lock(fh, width, height, field,
   /* width_mask: 4 pixels */ ~3,
   /* width_bias: nearest */ 2,
   /* adjust_size */ 1,
@@ -2536,7 +2536,7 @@ static int bttv_try_fmt_vid_overlay(struct file *file, 
void *priv,
 {
struct bttv_fh *fh = priv;
 
-   return verify_window(fh, f-fmt.win,
+   return verify_window_lock(fh, f-fmt.win,
/* adjust_size */ 1,
/* adjust_crop */ 0);
 }
@@ -2563,7 +2563,7 @@ static int bttv_s_fmt_vid_cap(struct file *file, void 
*priv,
height = f-fmt.pix.height;
field = f-fmt.pix.field;
 
-   retval = limit_scaled_size(fh, width, height, f-fmt.pix.field,
+   retval = limit_scaled_size_lock(fh, width, height, f-fmt.pix.field,
   /* width_mask: 4 pixels */ ~3,
   /* width_bias: nearest */ 2,
   /* adjust_size 

[PATCH 4/8] V4L/DVB: bttv: fix driver lock and remove explicit calls to BKL

2010-09-15 Thread Mauro Carvalho Chehab
Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com

diff --git a/drivers/media/video/bt8xx/bttv-driver.c 
b/drivers/media/video/bt8xx/bttv-driver.c
index fcafe2f..5f5cd4a 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -1859,21 +1859,25 @@ static int bttv_s_std(struct file *file, void *priv, 
v4l2_std_id *id)
unsigned int i;
int err;
 
+   mutex_lock(btv-lock);
err = v4l2_prio_check(btv-prio, fh-prio);
-   if (0 != err)
-   return err;
+   if (err)
+   goto err;
 
for (i = 0; i  BTTV_TVNORMS; i++)
if (*id  bttv_tvnorms[i].v4l2_id)
break;
-   if (i == BTTV_TVNORMS)
-   return -EINVAL;
+   if (i == BTTV_TVNORMS) {
+   err = -EINVAL;
+   goto err;
+   }
 
-   mutex_lock(btv-lock);
set_tvnorm(btv, i);
+
+err:
mutex_unlock(btv-lock);
 
-   return 0;
+   return err;
 }
 
 static int bttv_querystd(struct file *file, void *f, v4l2_std_id *id)
@@ -1893,10 +1897,13 @@ static int bttv_enum_input(struct file *file, void 
*priv,
 {
struct bttv_fh *fh = priv;
struct bttv *btv = fh-btv;
-   int n;
+   int rc = 0;
 
-   if (i-index = bttv_tvcards[btv-c.type].video_inputs)
-   return -EINVAL;
+   mutex_lock(btv-lock);
+   if (i-index = bttv_tvcards[btv-c.type].video_inputs) {
+   rc = -EINVAL;
+   goto err;
+   }
 
i-type = V4L2_INPUT_TYPE_CAMERA;
i-audioset = 1;
@@ -1919,10 +1926,12 @@ static int bttv_enum_input(struct file *file, void 
*priv,
i-status |= V4L2_IN_ST_NO_H_LOCK;
}
 
-   for (n = 0; n  BTTV_TVNORMS; n++)
-   i-std |= bttv_tvnorms[n].v4l2_id;
+   i-std = BTTV_NORMS;
 
-   return 0;
+err:
+   mutex_unlock(btv-lock);
+
+   return rc;
 }
 
 static int bttv_g_input(struct file *file, void *priv, unsigned int *i)
@@ -1930,7 +1939,10 @@ static int bttv_g_input(struct file *file, void *priv, 
unsigned int *i)
struct bttv_fh *fh = priv;
struct bttv *btv = fh-btv;
 
+   mutex_lock(btv-lock);
*i = btv-input;
+   mutex_unlock(btv-lock);
+
return 0;
 }
 
@@ -1941,15 +1953,19 @@ static int bttv_s_input(struct file *file, void *priv, 
unsigned int i)
 
int err;
 
-   err = v4l2_prio_check(btv-prio, fh-prio);
-   if (0 != err)
-   return err;
-
-   if (i  bttv_tvcards[btv-c.type].video_inputs)
-   return -EINVAL;
-
mutex_lock(btv-lock);
+   err = v4l2_prio_check(btv-prio, fh-prio);
+   if (unlikely(err))
+   goto err;
+
+   if (i  bttv_tvcards[btv-c.type].video_inputs) {
+   err = -EINVAL;
+   goto err;
+   }
+
set_input(btv, i, btv-tvnorm);
+
+err:
mutex_unlock(btv-lock);
return 0;
 }
@@ -1961,22 +1977,25 @@ static int bttv_s_tuner(struct file *file, void *priv,
struct bttv *btv = fh-btv;
int err;
 
-   err = v4l2_prio_check(btv-prio, fh-prio);
-   if (0 != err)
-   return err;
-
-   if (btv-tuner_type == TUNER_ABSENT)
-   return -EINVAL;
-
-   if (0 != t-index)
+   if (unlikely(0 != t-index))
return -EINVAL;
 
mutex_lock(btv-lock);
+   if (unlikely(btv-tuner_type == TUNER_ABSENT)) {
+   err = -EINVAL;
+   goto err;
+   }
+
+   err = v4l2_prio_check(btv-prio, fh-prio);
+   if (unlikely(err))
+   goto err;
+
bttv_call_all(btv, tuner, s_tuner, t);
 
if (btv-audio_mode_gpio)
btv-audio_mode_gpio(btv, t, 1);
 
+err:
mutex_unlock(btv-lock);
 
return 0;
@@ -1988,8 +2007,10 @@ static int bttv_g_frequency(struct file *file, void 
*priv,
struct bttv_fh *fh  = priv;
struct bttv *btv = fh-btv;
 
+   mutex_lock(btv-lock);
f-type = btv-radio_user ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
f-frequency = btv-freq;
+   mutex_unlock(btv-lock);
 
return 0;
 }
@@ -2001,21 +2022,26 @@ static int bttv_s_frequency(struct file *file, void 
*priv,
struct bttv *btv = fh-btv;
int err;
 
-   err = v4l2_prio_check(btv-prio, fh-prio);
-   if (0 != err)
-   return err;
-
if (unlikely(f-tuner != 0))
return -EINVAL;
+
+   mutex_lock(btv-lock);
+   err = v4l2_prio_check(btv-prio, fh-prio);
+   if (unlikely(err))
+   goto err;
+
if (unlikely(f-type != (btv-radio_user
-   ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV)))
-   return -EINVAL;
-   mutex_lock(btv-lock);
+   ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV))) {
+   err = -EINVAL;
+   goto err;
+   }
btv-freq = f-frequency;
bttv_call_all(btv, 

[PATCH 5/8] V4L/DVB: bttv: use unlocked ioctl

2010-09-15 Thread Mauro Carvalho Chehab
Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com

diff --git a/drivers/media/video/bt8xx/bttv-driver.c 
b/drivers/media/video/bt8xx/bttv-driver.c
index 5f5cd4a..8d1b222 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -3419,13 +3419,13 @@ bttv_mmap(struct file *file, struct vm_area_struct *vma)
 
 static const struct v4l2_file_operations bttv_fops =
 {
-   .owner= THIS_MODULE,
-   .open = bttv_open,
-   .release  = bttv_release,
-   .ioctl= video_ioctl2,
-   .read = bttv_read,
-   .mmap = bttv_mmap,
-   .poll = bttv_poll,
+   .owner= THIS_MODULE,
+   .open = bttv_open,
+   .release  = bttv_release,
+   .unlocked_ioctl   = video_ioctl2,
+   .read = bttv_read,
+   .mmap = bttv_mmap,
+   .poll = bttv_poll,
 };
 
 static const struct v4l2_ioctl_ops bttv_ioctl_ops = {
-- 
1.7.1


--
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 2/8] V4L/DVB: radio-si470x: use unlocked ioctl

2010-09-15 Thread Mauro Carvalho Chehab
Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com

diff --git a/drivers/media/radio/si470x/radio-si470x-common.c 
b/drivers/media/radio/si470x/radio-si470x-common.c
index 9927a59..61be988 100644
--- a/drivers/media/radio/si470x/radio-si470x-common.c
+++ b/drivers/media/radio/si470x/radio-si470x-common.c
@@ -408,17 +408,15 @@ done:
 /*
  * si470x_rds_on - switch on rds reception
  */
-int si470x_rds_on(struct si470x_device *radio)
+static int si470x_rds_on(struct si470x_device *radio)
 {
int retval;
 
/* sysconfig 1 */
-   mutex_lock(radio-lock);
radio-registers[SYSCONFIG1] |= SYSCONFIG1_RDS;
retval = si470x_set_register(radio, SYSCONFIG1);
if (retval  0)
radio-registers[SYSCONFIG1] = ~SYSCONFIG1_RDS;
-   mutex_unlock(radio-lock);
 
return retval;
 }
@@ -440,6 +438,7 @@ static ssize_t si470x_fops_read(struct file *file, char 
__user *buf,
unsigned int block_count = 0;
 
/* switch on rds reception */
+   mutex_lock(radio-lock);
if ((radio-registers[SYSCONFIG1]  SYSCONFIG1_RDS) == 0)
si470x_rds_on(radio);
 
@@ -480,9 +479,9 @@ static ssize_t si470x_fops_read(struct file *file, char 
__user *buf,
buf += 3;
retval += 3;
}
-   mutex_unlock(radio-lock);
 
 done:
+   mutex_unlock(radio-lock);
return retval;
 }
 
@@ -497,8 +496,11 @@ static unsigned int si470x_fops_poll(struct file *file,
int retval = 0;
 
/* switch on rds reception */
+
+   mutex_lock(radio-lock);
if ((radio-registers[SYSCONFIG1]  SYSCONFIG1_RDS) == 0)
si470x_rds_on(radio);
+   mutex_unlock(radio-lock);
 
poll_wait(file, radio-read_queue, pts);
 
@@ -516,7 +518,7 @@ static const struct v4l2_file_operations si470x_fops = {
.owner  = THIS_MODULE,
.read   = si470x_fops_read,
.poll   = si470x_fops_poll,
-   .ioctl  = video_ioctl2,
+   .unlocked_ioctl = video_ioctl2,
.open   = si470x_fops_open,
.release= si470x_fops_release,
 };
@@ -572,6 +574,7 @@ static int si470x_vidioc_g_ctrl(struct file *file, void 
*priv,
struct si470x_device *radio = video_drvdata(file);
int retval = 0;
 
+   mutex_lock(radio-lock);
/* safety checks */
retval = si470x_disconnect_check(radio);
if (retval)
@@ -594,6 +597,8 @@ done:
if (retval  0)
dev_warn(radio-videodev-dev,
get control failed with %d\n, retval);
+
+   mutex_unlock(radio-lock);
return retval;
 }
 
@@ -607,6 +612,7 @@ static int si470x_vidioc_s_ctrl(struct file *file, void 
*priv,
struct si470x_device *radio = video_drvdata(file);
int retval = 0;
 
+   mutex_lock(radio-lock);
/* safety checks */
retval = si470x_disconnect_check(radio);
if (retval)
@@ -633,6 +639,7 @@ done:
if (retval  0)
dev_warn(radio-videodev-dev,
set control failed with %d\n, retval);
+   mutex_unlock(radio-lock);
return retval;
 }
 
@@ -662,6 +669,7 @@ static int si470x_vidioc_g_tuner(struct file *file, void 
*priv,
struct si470x_device *radio = video_drvdata(file);
int retval = 0;
 
+   mutex_lock(radio-lock);
/* safety checks */
retval = si470x_disconnect_check(radio);
if (retval)
@@ -737,6 +745,7 @@ done:
if (retval  0)
dev_warn(radio-videodev-dev,
get tuner failed with %d\n, retval);
+   mutex_unlock(radio-lock);
return retval;
 }
 
@@ -750,6 +759,7 @@ static int si470x_vidioc_s_tuner(struct file *file, void 
*priv,
struct si470x_device *radio = video_drvdata(file);
int retval = 0;
 
+   mutex_lock(radio-lock);
/* safety checks */
retval = si470x_disconnect_check(radio);
if (retval)
@@ -776,6 +786,7 @@ done:
if (retval  0)
dev_warn(radio-videodev-dev,
set tuner failed with %d\n, retval);
+   mutex_unlock(radio-lock);
return retval;
 }
 
@@ -790,6 +801,7 @@ static int si470x_vidioc_g_frequency(struct file *file, 
void *priv,
int retval = 0;
 
/* safety checks */
+   mutex_lock(radio-lock);
retval = si470x_disconnect_check(radio);
if (retval)
goto done;
@@ -806,6 +818,7 @@ done:
if (retval  0)
dev_warn(radio-videodev-dev,
get frequency failed with %d\n, retval);
+   mutex_unlock(radio-lock);
return retval;
 }
 
@@ -819,6 +832,7 @@ static int si470x_vidioc_s_frequency(struct file *file, 
void *priv,
struct si470x_device *radio = video_drvdata(file);
int retval = 0;
 
+   mutex_lock(radio-lock);
/* safety checks */
 

[PATCH 6/8] V4L/DVB: cx88: Remove BKL

2010-09-15 Thread Mauro Carvalho Chehab
Signed-off-by: Mauro Carvalho Chehab mche...@redhat.com

diff --git a/drivers/media/video/cx88/cx88-blackbird.c 
b/drivers/media/video/cx88/cx88-blackbird.c
index e46e1ce..ec32995 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1057,7 +1057,7 @@ static int mpeg_open(struct file *file)
 
dprintk( 1, %s\n, __func__);
 
-   lock_kernel();
+   mutex_lock(dev-core-lock);
 
/* Make sure we can acquire the hardware */
drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD);
@@ -1065,7 +1065,7 @@ static int mpeg_open(struct file *file)
err = drv-request_acquire(drv);
if(err != 0) {
dprintk(1,%s: Unable to acquire hardware, %d\n, 
__func__, err);
-   unlock_kernel();
+   mutex_unlock(dev-core-lock);;
return err;
}
}
@@ -1073,7 +1073,7 @@ static int mpeg_open(struct file *file)
if (!atomic_read(dev-core-mpeg_users)  
blackbird_initialize_codec(dev)  0) {
if (drv)
drv-request_release(drv);
-   unlock_kernel();
+   mutex_unlock(dev-core-lock);
return -EINVAL;
}
dprintk(1, open dev=%s\n, video_device_node_name(vdev));
@@ -1083,7 +1083,7 @@ static int mpeg_open(struct file *file)
if (NULL == fh) {
if (drv)
drv-request_release(drv);
-   unlock_kernel();
+   mutex_unlock(dev-core-lock);
return -ENOMEM;
}
file-private_data = fh;
@@ -1099,10 +1099,9 @@ static int mpeg_open(struct file *file)
/* FIXME: locking against other video device */
cx88_set_scale(dev-core, dev-width, dev-height,
fh-mpegq.field);
-   unlock_kernel();
 
atomic_inc(dev-core-mpeg_users);
-
+   mutex_unlock(dev-core-lock);
return 0;
 }
 
@@ -1120,8 +1119,11 @@ static int mpeg_release(struct file *file)
videobuf_stop(fh-mpegq);
 
videobuf_mmap_free(fh-mpegq);
+
+   mutex_lock(dev-core-lock);
file-private_data = NULL;
kfree(fh);
+   mutex_unlock(dev-core-lock);
 
/* Make sure we release the hardware */
drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD);
diff --git a/drivers/media/video/cx88/cx88-video.c 
b/drivers/media/video/cx88/cx88-video.c
index 0fab65c..381398d 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -769,19 +769,14 @@ static int video_open(struct file *file)
break;
}
 
-   lock_kernel();
-
-   core = dev-core;
-
dprintk(1, open dev=%s radio=%d type=%s\n,
video_device_node_name(vdev), radio, v4l2_type_names[type]);
 
/* allocate + initialize per filehandle data */
fh = kzalloc(sizeof(*fh),GFP_KERNEL);
-   if (NULL == fh) {
-   unlock_kernel();
+   if (unlikely(!fh))
return -ENOMEM;
-   }
+
file-private_data = fh;
fh-dev  = dev;
fh-radio= radio;
@@ -790,6 +785,9 @@ static int video_open(struct file *file)
fh-height   = 240;
fh-fmt  = format_by_fourcc(V4L2_PIX_FMT_BGR24);
 
+   mutex_lock(core-lock);
+   core = dev-core;
+
videobuf_queue_sg_init(fh-vidq, cx8800_video_qops,
dev-pci-dev, dev-slock,
V4L2_BUF_TYPE_VIDEO_CAPTURE,
@@ -826,9 +824,9 @@ static int video_open(struct file *file)
}
call_all(core, tuner, s_radio);
}
-   unlock_kernel();
 
atomic_inc(core-users);
+   mutex_unlock(core-lock);
 
return 0;
 }
@@ -920,10 +918,11 @@ static int video_release(struct file *file)
 
videobuf_mmap_free(fh-vidq);
videobuf_mmap_free(fh-vbiq);
+
+   mutex_lock(dev-core-lock);
file-private_data = NULL;
kfree(fh);
 
-   mutex_lock(dev-core-lock);
if(atomic_dec_and_test(dev-core-users))
call_all(dev-core, core, s_power, 0);
mutex_unlock(dev-core-lock);
-- 
1.7.1


--
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] drivers/media/video/ivtv/ivtvfb.c: prevent reading uninitialized stack memory

2010-09-15 Thread Andy Walls
Acked-by: Andy Walls awa...@md.metrocast.net

By tomorrow evening I'll put this in my repo and ask for Mauro to pull it.

Regards,
Andy

Dan Rosenberg drosenb...@vsecurity.com wrote:

The FBIOGET_VBLANK device ioctl allows unprivileged users to read 16
bytes of uninitialized stack memory, because the reserved member of
the fb_vblank struct declared on the stack is not altered or zeroed
before being copied back to the user.  This patch takes care of it.

Signed-off-by: Dan Rosenberg dan.j.rosenb...@gmail.com

--- linux-2.6.35.4.orig/drivers/media/video/ivtv/ivtvfb.c  2010-08-26 
19:47:12.0 -0400
+++ linux-2.6.35.4/drivers/media/video/ivtv/ivtvfb.c   2010-09-15 
14:16:46.797375399 -0400
@@ -458,6 +458,8 @@ static int ivtvfb_ioctl(struct fb_info *
   struct fb_vblank vblank;
   u32 trace;
 
+  memset(vblank, 0, sizeof(struct fb_vblank));
+
   vblank.flags = FB_VBLANK_HAVE_COUNT 
 |FB_VBLANK_HAVE_VCOUNT |
   FB_VBLANK_HAVE_VSYNC;
   trace = read_reg(IVTV_REG_DEC_LINE_FIELD)  16;






[PATCH 0/8] Removal of BKL part 1

2010-09-15 Thread Mauro Carvalho Chehab
This patch series remove direct calls for BKL on some V4L drivers. It also uses
.unlocked_ioctl for some of those drivers.

This is a work in progress, as I'm doing the conversion manually. We still need 
to 
touch on the drivers bellow, just due to explicit call to BKL:

drivers/media/video/tlg2300/pd-main.c
drivers/media/video/se401.c
drivers/media/video/zoran/zoran_driver.c
drivers/media/video/cx23885/cx23885-417.c
drivers/media/video/cx23885/cx23885-video.c
drivers/media/video/usbvideo/vicam.c
drivers/media/video/usbvision/usbvision-video.c
drivers/media/video/dabusb.c
drivers/media/video/pwc/pwc-if.c
drivers/media/video/v4l2-dev.c
drivers/media/video/stk-webcam.c

Probably, there are more drivers still using .ioctl, instead of .unsigned_ioctl.

The patches here were not tested yet. Help is needed to test them and to review
the patch series.

Mauro Carvalho Chehab (8):
  V4L/DVB: radio-si470x: remove the BKL lock used internally at the
driver
  V4L/DVB: radio-si470x: use unlocked ioctl
  V4L/DVB: bttv-driver: document functions using mutex_lock
  V4L/DVB: bttv: fix driver lock and remove explicit calls to BKL
  V4L/DVB: bttv: use unlocked ioctl
  V4L/DVB: cx88: Remove BKL
  V4L/DVB: Deprecate cpia driver (used for parallel port webcams)
  V4L/DVB: Deprecate stradis driver

 Documentation/feature-removal-schedule.txt   |   17 +-
 drivers/media/radio/si470x/radio-si470x-common.c |   27 +-
 drivers/media/radio/si470x/radio-si470x-usb.c|   17 +-
 drivers/media/radio/si470x/radio-si470x.h|2 -
 drivers/media/video/Kconfig  |   48 -
 drivers/media/video/Makefile |4 -
 drivers/media/video/bt8xx/bttv-driver.c  |  269 +-
 drivers/media/video/cpia.c   | 4032 --
 drivers/media/video/cpia.h   |  432 ---
 drivers/media/video/cpia_pp.c|  869 -
 drivers/media/video/cpia_usb.c   |  640 
 drivers/media/video/cx88/cx88-blackbird.c|   14 +-
 drivers/media/video/cx88/cx88-video.c|   17 +-
 drivers/media/video/stradis.c| 2213 
 drivers/staging/Kconfig  |2 +
 drivers/staging/Makefile |1 +
 drivers/staging/cpia/Kconfig |   39 +
 drivers/staging/cpia/Makefile|5 +
 drivers/staging/cpia/TODO|8 +
 drivers/staging/cpia/cpia.c  | 4032 ++
 drivers/staging/cpia/cpia.h  |  432 +++
 drivers/staging/cpia/cpia_pp.c   |  869 +
 drivers/staging/cpia/cpia_usb.c  |  640 
 drivers/staging/stradis/Kconfig  |7 +
 drivers/staging/stradis/Makefile |3 +
 drivers/staging/stradis/TODO |6 +
 drivers/staging/stradis/stradis.c| 2213 
 27 files changed, 8496 insertions(+), 8362 deletions(-)
 delete mode 100644 drivers/media/video/cpia.c
 delete mode 100644 drivers/media/video/cpia.h
 delete mode 100644 drivers/media/video/cpia_pp.c
 delete mode 100644 drivers/media/video/cpia_usb.c
 delete mode 100644 drivers/media/video/stradis.c
 create mode 100644 drivers/staging/cpia/Kconfig
 create mode 100644 drivers/staging/cpia/Makefile
 create mode 100644 drivers/staging/cpia/TODO
 create mode 100644 drivers/staging/cpia/cpia.c
 create mode 100644 drivers/staging/cpia/cpia.h
 create mode 100644 drivers/staging/cpia/cpia_pp.c
 create mode 100644 drivers/staging/cpia/cpia_usb.c
 create mode 100644 drivers/staging/stradis/Kconfig
 create mode 100644 drivers/staging/stradis/Makefile
 create mode 100644 drivers/staging/stradis/TODO
 create mode 100644 drivers/staging/stradis/stradis.c

--
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


HVR 1600 Distortion

2010-09-15 Thread Josh Borke
I've recently noticed some distortion coming from my hvr1600 when
viewing analog channels.  It happens to all analog channels with some
slightly better than others.  I am running Fedora 12 linux with kernel
version 2.6.32.21-166.

Output of lspci -v:

02:0a.0 Multimedia video controller: Conexant Systems, Inc. CX23418
Single-Chip MPEG-2 Encoder with Integrated Analog Video/Broadcast
Audio Decoder
Subsystem: Hauppauge computer works Inc. WinTV HVR-1600
Flags: bus master, medium devsel, latency 64, IRQ 10
Memory at c000 (32-bit, non-prefetchable) [size=64M]
Capabilities: [44] Vital Product Data
Capabilities: [4c] Power Management version 2
Kernel driver in use: cx18
Kernel modules: cx18

I know I need to include more information but I'm not sure what to
include.  Any help would be appreciated.

Thanks,
-josh
--
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 0/4] IR/imon: split out mouse events and fix bugs

2010-09-15 Thread Jarod Wilson
These patches make the imon driver slightly less distasteful. The meat of
the changes are from David's patch to split the IR mouse mode and
panel/knob events out onto their own input device, leaving just IR keys to
come through the IR device. This facilitates further abstraction of the
ir/rc-core interface, but allows us to get these patches in ahead of
David's major reshuffle that is targeted for post-2.6.37-rc1 (basically,
after Dmitry's large keycode patches are merged in mainline).

Additionally, while David's patch unknowingly addressed many of the issues
in https://bugzilla.kernel.org/show_bug.cgi?id=16351, there are a few more
issues addressed by the spinlock patch (at least, in theory, since in
practice, it doesn't really seem to matter much to me, but Anssi suggested
that some locking may be a good idea in the bug :).

Finally, there's a bit of reshuffling of auto-config bits for the 0xffdc
imon devices so the mce-only ones get set up w/the mce key table by
default instead of the imon pad one (based on input from Anders Eriksson
over on the lirc list).

David Härdeman (1):
  imon: split mouse events to a separate input dev

Jarod Wilson (3):
  IR: export ir_keyup so imon driver can use it directly
  IR/imon: protect ictx's kc and last_keycode w/spinlock
  IR/imon: set up mce-only devices w/mce keytable

 drivers/media/IR/imon.c|  583 +++-
 drivers/media/IR/ir-keytable.c |3 +-
 include/media/ir-core.h|1 +
 3 files changed, 344 insertions(+), 243 deletions(-)

-- 
Jarod Wilson
ja...@redhat.com

--
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 1/4] IR: export ir_keyup so imon driver can use it directly

2010-09-15 Thread Jarod Wilson
From d31919ac08ba9a203bd673bbed18e78293ceaa68 Mon Sep 17 00:00:00 2001
From: Jarod Wilson ja...@redhat.com
Date: Wed, 15 Sep 2010 14:31:12 -0400
Subject: [PATCH 1/4] IR: export ir_keyup so imon driver can use it directly
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The imon driver currently reimplements its own version of ir_keyup
(along with key release timer functionality also already present in the
core IR code). A follow-up imon patch will make use of ir_keyup and the
IR stack's key release code.

Trivial extraction from David Härdeman's pending rc-core merge and
device interface abstraction patchset to facilitate merging a patch
based on his imon input dev split patch ahead of the larger churn, which
is slated for post-2.6.37-rc1 (after Dmitry's large keycode patches are
merged in mainline).

Signed-off-by: Jarod Wilson ja...@redhat.com
---
 drivers/media/IR/ir-keytable.c |3 ++-
 include/media/ir-core.h|1 +
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index 7961d59..59510cd 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -285,7 +285,7 @@ EXPORT_SYMBOL_GPL(ir_g_keycode_from_table);
  * This routine is used to signal that a key has been released on the
  * remote control. It reports a keyup input event via input_report_key().
  */
-static void ir_keyup(struct ir_input_dev *ir)
+void ir_keyup(struct ir_input_dev *ir)
 {
if (!ir-keypressed)
return;
@@ -295,6 +295,7 @@ static void ir_keyup(struct ir_input_dev *ir)
input_sync(ir-input_dev);
ir-keypressed = false;
 }
+EXPORT_SYMBOL_GPL(ir_keyup);
 
 /**
  * ir_timer_keyup() - generates a keyup event after a timeout
diff --git a/include/media/ir-core.h b/include/media/ir-core.h
index eb7fddf..4dd43d4 100644
--- a/include/media/ir-core.h
+++ b/include/media/ir-core.h
@@ -157,6 +157,7 @@ void ir_input_unregister(struct input_dev *input_dev);
 
 void ir_repeat(struct input_dev *dev);
 void ir_keydown(struct input_dev *dev, int scancode, u8 toggle);
+void ir_keyup(struct ir_input_dev *ir);
 u32 ir_g_keycode_from_table(struct input_dev *input_dev, u32 scancode);
 
 /* From ir-raw-event.c */
-- 
1.7.2.2


-- 
Jarod Wilson
ja...@redhat.com

--
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 2/4] imon: split mouse events to a separate input dev

2010-09-15 Thread Jarod Wilson
From 4ceb1642b756e7a11753c6fae645806d2514c54a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20H=C3=A4rdeman?= da...@hardeman.nu
Date: Wed, 15 Sep 2010 14:42:07 -0400
Subject: [PATCH 2/4] imon: split mouse events to a separate input dev
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is a stab at separating the mouse (and front panel/knob) events
out to a separate input device. This is necessary in preparation for
the next patch which makes the rc-core input dev opaque to rc
drivers.

I can't verify the correctness of the patch beyond the fact that it
compiles without warnings. The driver has resisted most of my
attempts at understanding it properly...for example, the double calls
to le64_to_cpu() and be64_to_cpu() which are applied in
imon_incoming_packet() and imon_panel_key_lookup() would amount
to a bswab64() call, irregardless of the cpu endianness, and I think
the code wouldn't have worked on a big-endian machine...

Signed-off-by: David Härdeman da...@hardeman.nu

- Minor alterations to apply with minimal core IR changes
- Use timer for imon keys too, since its entirely possible for the
  receiver to miss release codes (either by way of another key being
  pressed while the first is held or by the remote pointing away from
  the recevier when the key is release. yes, I know, its ugly).
- Bump driver version number, since this is a fairly significant change
  (for the much much better).

Tested successfully w/an imon knob receiver.

Signed-off-by: Jarod Wilson ja...@redhat.com
---
 drivers/media/IR/imon.c |  273 +++---
 1 files changed, 160 insertions(+), 113 deletions(-)

diff --git a/drivers/media/IR/imon.c b/drivers/media/IR/imon.c
index c185422..d36fe72 100644
--- a/drivers/media/IR/imon.c
+++ b/drivers/media/IR/imon.c
@@ -44,7 +44,7 @@
 #define MOD_AUTHOR Jarod Wilson ja...@wilsonet.com
 #define MOD_DESC   Driver for SoundGraph iMON MultiMedia IR/Display
 #define MOD_NAME   imon
-#define MOD_VERSION0.9.1
+#define MOD_VERSION0.9.2
 
 #define DISPLAY_MINOR_BASE 144
 #define DEVICE_NAMElcd%d
@@ -121,21 +121,25 @@ struct imon_context {
u16 vendor; /* usb vendor ID */
u16 product;/* usb product ID */
 
-   struct input_dev *idev; /* input device for remote */
+   struct input_dev *rdev; /* input device for remote */
+   struct input_dev *idev; /* input device for panel  IR mouse */
struct input_dev *touch;/* input device for touchscreen */
 
u32 kc; /* current input keycode */
u32 last_keycode;   /* last reported input keycode */
+   u32 rc_scancode;/* the computed remote scancode */
+   u8 rc_toggle;   /* the computed remote toggle bit */
u64 ir_type;/* iMON or MCE (RC6) IR protocol? */
-   u8 mce_toggle_bit;  /* last mce toggle bit */
bool release_code;  /* some keys send a release code */
 
u8 display_type;/* store the display type */
bool pad_mouse; /* toggle kbd(0)/mouse(1) mode */
 
+   char name_rdev[128];/* rc input device name */
+   char phys_rdev[64]; /* rc input device phys path */
+
char name_idev[128];/* input device name */
char phys_idev[64]; /* input device phys path */
-   struct timer_list itimer;   /* input device timer, need for rc6 */
 
char name_touch[128];   /* touch screen name */
char phys_touch[64];/* touch screen phys path */
@@ -956,17 +960,6 @@ static void usb_tx_callback(struct urb *urb)
 }
 
 /**
- * mce/rc6 keypresses have no distinct release code, use timer
- */
-static void imon_mce_timeout(unsigned long data)
-{
-   struct imon_context *ictx = (struct imon_context *)data;
-
-   input_report_key(ictx-idev, ictx-last_keycode, 0);
-   input_sync(ictx-idev);
-}
-
-/**
  * report touchscreen input
  */
 static void imon_touch_display_timeout(unsigned long data)
@@ -1006,9 +999,6 @@ int imon_ir_change_protocol(void *priv, u64 ir_type)
dev_dbg(dev, Configuring IR receiver for MCE protocol\n);
ir_proto_packet[0] = 0x01;
pad_mouse = false;
-   init_timer(ictx-itimer);
-   ictx-itimer.data = (unsigned long)ictx;
-   ictx-itimer.function = imon_mce_timeout;
break;
case IR_TYPE_UNKNOWN:
case IR_TYPE_OTHER:
@@ -1147,20 +1137,21 @@ static int stabilize(int a, int b, u16 timeout, u16 
threshold)
return result;
 }
 
-static u32 imon_remote_key_lookup(struct imon_context *ictx, u32 hw_code)
+static u32 imon_remote_key_lookup(struct imon_context *ictx, u32 scancode)
 {
-   u32 scancode = be32_to_cpu(hw_code);
  

[PATCH 3/4] IR/imon: protect ictx's kc and last_keycode w/spinlock

2010-09-15 Thread Jarod Wilson
From 1fd62121d93ca507ec6f2f692121f853a2c46889 Mon Sep 17 00:00:00 2001
From: Jarod Wilson ja...@redhat.com
Date: Wed, 15 Sep 2010 14:56:03 -0400
Subject: [PATCH 3/4] IR/imon: protect ictx's kc and last_keycode w/spinlock

Lest we get our keycodes wrong... Thus far, in practice, I've not found
it to actually matter, but its one of the issues raised in
https://bugzilla.kernel.org/show_bug.cgi?id=16351 that wasn't addressed
by converting to using native IR keydown/up functions.

Signed-off-by: Jarod Wilson ja...@redhat.com
---
 drivers/media/IR/imon.c |   52 +-
 1 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/drivers/media/IR/imon.c b/drivers/media/IR/imon.c
index d36fe72..4b73b8e 100644
--- a/drivers/media/IR/imon.c
+++ b/drivers/media/IR/imon.c
@@ -1,7 +1,7 @@
 /*
  *   imon.c:   input and display driver for SoundGraph iMON IR/VFD/LCD
  *
- *   Copyright(C) 2009  Jarod Wilson ja...@wilsonet.com
+ *   Copyright(C) 2010  Jarod Wilson ja...@wilsonet.com
  *   Portions based on the original lirc_imon driver,
  * Copyright(C) 2004  Venky Raju(d...@venky.ws)
  *
@@ -125,6 +125,7 @@ struct imon_context {
struct input_dev *idev; /* input device for panel  IR mouse */
struct input_dev *touch;/* input device for touchscreen */
 
+   spinlock_t kc_lock; /* make sure we get keycodes right */
u32 kc; /* current input keycode */
u32 last_keycode;   /* last reported input keycode */
u32 rc_scancode;/* the computed remote scancode */
@@ -1210,6 +1211,9 @@ static bool imon_mouse_event(struct imon_context *ictx,
u8 right_shift = 1;
bool mouse_input = true;
int dir = 0;
+   unsigned long flags;
+
+   spin_lock_irqsave(ictx-kc_lock, flags);
 
/* newer iMON device PAD or mouse button */
if (ictx-product != 0xffdc  (buf[0]  0x01)  len == 5) {
@@ -1241,6 +1245,8 @@ static bool imon_mouse_event(struct imon_context *ictx,
} else
mouse_input = false;
 
+   spin_unlock_irqrestore(ictx-kc_lock, flags);
+
if (mouse_input) {
dev_dbg(ictx-dev, sending mouse data via input subsystem\n);
 
@@ -1255,7 +1261,9 @@ static bool imon_mouse_event(struct imon_context *ictx,
 buf[1]  right_shift  0x1);
}
input_sync(ictx-idev);
+   spin_lock_irqsave(ictx-kc_lock, flags);
ictx-last_keycode = ictx-kc;
+   spin_unlock_irqrestore(ictx-kc_lock, flags);
}
 
return mouse_input;
@@ -1278,6 +1286,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, 
unsigned char *buf)
char rel_x = 0x00, rel_y = 0x00;
u16 timeout, threshold;
u32 scancode = KEY_RESERVED;
+   unsigned long flags;
 
/*
 * The imon directional pad functions more like a touchpad. Bytes 3  4
@@ -1301,7 +1310,11 @@ static void imon_pad_to_keys(struct imon_context *ictx, 
unsigned char *buf)
dir = stabilize((int)rel_x, (int)rel_y,
timeout, threshold);
if (!dir) {
+   spin_lock_irqsave(ictx-kc_lock,
+ flags);
ictx-kc = KEY_UNKNOWN;
+   spin_unlock_irqrestore(ictx-kc_lock,
+  flags);
return;
}
buf[2] = dir  0xFF;
@@ -1363,7 +1376,9 @@ static void imon_pad_to_keys(struct imon_context *ictx, 
unsigned char *buf)
dir = stabilize((int)rel_x, (int)rel_y,
timeout, threshold);
if (!dir) {
+   spin_lock_irqsave(ictx-kc_lock, flags);
ictx-kc = KEY_UNKNOWN;
+   spin_unlock_irqrestore(ictx-kc_lock, flags);
return;
}
buf[2] = dir  0xFF;
@@ -1392,8 +1407,11 @@ static void imon_pad_to_keys(struct imon_context *ictx, 
unsigned char *buf)
}
}
 
-   if (scancode)
+   if (scancode) {
+   spin_lock_irqsave(ictx-kc_lock, flags);
ictx-kc = imon_remote_key_lookup(ictx, scancode);
+   spin_unlock_irqrestore(ictx-kc_lock, flags);
+   }
 }
 
 /**
@@ -1405,6 +1423,9 @@ static int imon_parse_press_type(struct imon_context 
*ictx,
 unsigned char *buf, u8 ktype)
 {
int press_type = 0;
+   unsigned long flags;
+
+   spin_lock_irqsave(ictx-kc_lock, flags);