Hauppauge WinTV HVR850 2040:b140 unusable with cx231xx

2013-12-11 Thread Connor Behan
I ordered an HVR850 USB TV tuner, planning to use it with an NTSC cable input. 
The LinuxTV.org page 
http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-850 said that there 
were three different models, so I checked and mine is 2040:b140... the last one 
to be supported. A discussion post 
http://www.linuxtv.org/wiki/index.php/Talk:Hauppauge_WinTV-HVR-850#Possibly_Valuable_Information
 there said that the card was working as of 2013 but my experience has been 
closer to these ones:

https://mailman.archlinux.org/pipermail/arch-general/2011-September/021962.html
http://www.spinics.net/lists/linux-media/msg49030.html

Since it was my first time using v4l, I didn't know what modules to load. Upon 
inserting the tuner, I saw 16 new modules autoloaded: media, tuner, videodev, 
videobuf_core, videobuf_vmalloc, v4l2_common, rc_core, cx25840, cx2341x, 
cx231xx, cx231xx_alsa, cx231xx_dvb, dvb_core, tda18271, tea5767, lgdt3305. This 
creates a few new device nodes:

/dev/dvb/adapter0/demux0*
/dev/dvb/adapter0/dvr0*
/dev/dvb/adapter0/frontend0*
/dev/dvb/adapter0/net0*
/dev/v4l
/dev/vbi0
/dev/video*
/dev/video0

The ones with asterisk are only created sometimes. The dmesg output was quite 
problematic (first_dmesg http://paste.ubuntu.com/6555061/) and I later found 
out this was because of lgdt3305_attach() and tda18271_attach(). If I 
explicitly modprobe lgdt3305 and tda18271 before inserting the tuner, I get 
something better (second_dmesg http://paste.ubuntu.com/6555075/). However, 
one troubling thing is __tda18271_write_regs failing with -32. This is probably 
the very first call to __tda18271_write_regs being done in 
tda18271_init_regs(). So the registers on this chip that is essential to use 
the analog part of the tuner are not initialized. When I try to actually use 
the tuner, the same error appears again (third_dmesg 
http://paste.ubuntu.com/6555081/).

I was testing it with the command mplayer -tv 
driver=v4l2:device=/dev/video0:norm=NTSC:chanlist=us-cable tv:// and seeing a 
green screen. But I also see a black screen when using xawtv and a 0 byte file 
when using cat /dev/video0  foo. I tried a few different machines and kernel 
versions.

Some people have suggested patches. One was a user named Jimbo on 
http://www.kernellabs.com/blog/?p=1445 (I'm guessing the polaris4 link is 
broken because that was merged to mailine?) Anyway he said that 
HAUPPAUGE_USBLIVE2 workarounds for error -71 might need to be there for 
HAUPPAUGE_EXETER. I tried this and it didn't work. One person who blogged about 
trouble with the HAUPPAUGE_USBLIVE2 
http://csharpnews.wordpress.com/2011/06/15/usb-live-2-on-ubuntu-shows-only-black-screen/
 said it was fixed by getting rid of a value |= (1  7). I tried this and it 
also didn't work.

Before I dangerously try any more patches when I don't know what they do... do 
you guys know how to fix this?




signature.asc
Description: OpenPGP digital signature


RE: [RFCv4 PATCH 7/8] vb2: return ENODATA in start_streaming in case of too few buffers.

2013-12-11 Thread Kamil Debski
Hi,

 From: Hans Verkuil [mailto:hverk...@xs4all.nl]
 Sent: Tuesday, December 10, 2013 8:52 AM
 
 As Guennadi mentioned in his review, ENODATA will be replaced by
 ENOBUFS, which is more appropriate.
 
 Prabhakar, Kamil, Tomasz, are you OK with this patch provided
 s/ENODATA/ENOBUFS/ ?

The patch looks good. However, shouldn't the documentation be changed too?

Now it says: [1]
(...) Accordingly the output hardware is disabled, no video signal is
produced until VIDIOC_STREAMON has been called. The ioctl will succeed
only when at least one output buffer is in the incoming queue. (...)

If I understand correctly, now the ioctl will succeed with no buffers
queued. Apart from the above you have my ack.

Acked-by: Kamil Debski k.deb...@samsung.com

Best wishes,
-- 
Kamil Debski
Samsung RD Institute Poland

[1] - http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-streamon.html

 
 On 12/09/2013 02:43 PM, Hans Verkuil wrote:
  From: Hans Verkuil hans.verk...@cisco.com
 
  This works together with the retry_start_streaming mechanism to allow
  userspace to start streaming even if not all required buffers have
 been queued.
 
  Signed-off-by: Hans Verkuil hans.verk...@cisco.com
  Cc: Lad, Prabhakar prabhakar.cse...@gmail.com
  Cc: Tomasz Stanislawski t.stanisl...@samsung.com
  Cc: Kyungmin Park kyungmin.p...@samsung.com
  Cc: Kamil Debski k.deb...@samsung.com
  Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
  ---
   drivers/media/platform/davinci/vpbe_display.c   | 2 +-
   drivers/media/platform/davinci/vpif_capture.c   | 2 +-
   drivers/media/platform/davinci/vpif_display.c   | 2 +-
   drivers/media/platform/s5p-mfc/s5p_mfc_enc.c| 2 +-
   drivers/media/platform/s5p-tv/mixer_video.c | 2 +-
   drivers/media/platform/soc_camera/mx2_camera.c  | 2 +-
  drivers/staging/media/davinci_vpfe/vpfe_video.c | 2 ++
   7 files changed, 8 insertions(+), 6 deletions(-)
 
  diff --git a/drivers/media/platform/davinci/vpbe_display.c
  b/drivers/media/platform/davinci/vpbe_display.c
  index eac472b..53be7fc 100644
  --- a/drivers/media/platform/davinci/vpbe_display.c
  +++ b/drivers/media/platform/davinci/vpbe_display.c
  @@ -347,7 +347,7 @@ static int vpbe_start_streaming(struct vb2_queue
 *vq, unsigned int count)
  /* If buffer queue is empty, return error */
  if (list_empty(layer-dma_queue)) {
  v4l2_err(vpbe_dev-v4l2_dev, buffer queue is empty\n);
  -   return -EINVAL;
  +   return -ENODATA;
  }
  /* Get the next frame from the buffer queue */
  layer-next_frm = layer-cur_frm = list_entry(layer-
 dma_queue.next,
  diff --git a/drivers/media/platform/davinci/vpif_capture.c
  b/drivers/media/platform/davinci/vpif_capture.c
  index 52ac5e6..4b04a27 100644
  --- a/drivers/media/platform/davinci/vpif_capture.c
  +++ b/drivers/media/platform/davinci/vpif_capture.c
  @@ -277,7 +277,7 @@ static int vpif_start_streaming(struct vb2_queue
 *vq, unsigned int count)
  if (list_empty(common-dma_queue)) {
  spin_unlock_irqrestore(common-irqlock, flags);
  vpif_dbg(1, debug, buffer queue is empty\n);
  -   return -EIO;
  +   return -ENODATA;
  }
 
  /* Get the next frame from the buffer queue */ diff --git
  a/drivers/media/platform/davinci/vpif_display.c
  b/drivers/media/platform/davinci/vpif_display.c
  index c31bcf1..c5070dc 100644
  --- a/drivers/media/platform/davinci/vpif_display.c
  +++ b/drivers/media/platform/davinci/vpif_display.c
  @@ -239,7 +239,7 @@ static int vpif_start_streaming(struct vb2_queue
 *vq, unsigned int count)
  if (list_empty(common-dma_queue)) {
  spin_unlock_irqrestore(common-irqlock, flags);
  vpif_err(buffer queue is empty\n);
  -   return -EIO;
  +   return -ENODATA;
  }
 
  /* Get the next frame from the buffer queue */ diff --git
  a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
  b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
  index 4ff3b6c..3bdfe85 100644
  --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
  +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
  @@ -1863,7 +1863,7 @@ static int s5p_mfc_start_streaming(struct
 vb2_queue *q, unsigned int count)
  if (ctx-src_bufs_cnt  ctx-pb_count) {
  mfc_err(Need minimum %d OUTPUT buffers\n,
  ctx-pb_count);
  -   return -EINVAL;
  +   return -ENODATA;
  }
  }
 
  diff --git a/drivers/media/platform/s5p-tv/mixer_video.c
  b/drivers/media/platform/s5p-tv/mixer_video.c
  index 81b97db..220ec31 100644
  --- a/drivers/media/platform/s5p-tv/mixer_video.c
  +++ b/drivers/media/platform/s5p-tv/mixer_video.c
  @@ -948,7 +948,7 @@ static int start_streaming(struct vb2_queue *vq,
  unsigned int count)
 
  if (count == 0) {
  mxr_dbg(mdev, no output buffers queued\n);
  -   return -EINVAL;
  +   return -ENODATA;
  }
 
  /* block any changes in output 

Re: [RFCv4 PATCH 7/8] vb2: return ENODATA in start_streaming in case of too few buffers.

2013-12-11 Thread Hans Verkuil
Hi Kamil,

On 12/11/13 11:27, Kamil Debski wrote:
 Hi,
 
 From: Hans Verkuil [mailto:hverk...@xs4all.nl]
 Sent: Tuesday, December 10, 2013 8:52 AM

 As Guennadi mentioned in his review, ENODATA will be replaced by
 ENOBUFS, which is more appropriate.

 Prabhakar, Kamil, Tomasz, are you OK with this patch provided
 s/ENODATA/ENOBUFS/ ?
 
 The patch looks good. However, shouldn't the documentation be changed too?
 
 Now it says: [1]
 (...) Accordingly the output hardware is disabled, no video signal is
 produced until VIDIOC_STREAMON has been called. The ioctl will succeed
 only when at least one output buffer is in the incoming queue. (...)
 
 If I understand correctly, now the ioctl will succeed with no buffers
 queued.

That's true *only* for drivers using vb2. As long as not all drivers are
converted (which is a *very* long-term project) I don't think i can change
the documentation.

Regards,

Hans

 Apart from the above you have my ack.
 
 Acked-by: Kamil Debski k.deb...@samsung.com
 
 Best wishes,
 
--
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] v4l2-dev: Add tracepoints for QBUF and DQBUF

2013-12-11 Thread Mauro Carvalho Chehab
Hans,

Em Wed, 11 Dec 2013 08:29:58 +0100
Hans Verkuil hverk...@xs4all.nl escreveu:

 On 12/10/2013 09:53 PM, Mauro Carvalho Chehab wrote:
  Em Sat, 23 Nov 2013 17:54:48 +0100
  Hans Verkuil hverk...@xs4all.nl escreveu:
  
  On 11/23/2013 05:30 PM, Sylwester Nawrocki wrote:
  Hi,
 
  On 11/23/2013 12:25 PM, Hans Verkuil wrote:
  Hi Wade,
 
  On 11/22/2013 08:48 PM, Wade Farnsworth wrote:
  Add tracepoints to the QBUF and DQBUF ioctls to enable rudimentary
  performance measurements using standard kernel tracers.
 
  Signed-off-by: Wade Farnsworthwade_farnswo...@mentor.com
  ---
 
  This is the update to the RFC patch I posted a few weeks back.  I've 
  added
  several bits of metadata to the tracepoint output per Mauro's 
  suggestion.
 
  I don't like this. All v4l2 ioctls can already be traced by doing e.g.
  echo 1 (or echo 2)/sys/class/video4linux/video0/debug.
 
  So this code basically duplicates that functionality. It would be nice 
  to be able
  to tie in the existing tracing code (v4l2-ioctl.c) into tracepoints.
 
  I think it would be really nice to have this kind of support for standard
  traces at the v4l2 subsystem. Presumably it could even gradually replace
  the v4l2 custom debug infrastructure.
 
  If I understand things correctly, the current tracing/profiling 
  infrastructure
  is much less invasive than inserting printks all over, which may cause 
  changes
  in control flow. I doubt the system could be reliably profiled by 
  enabling all
  those debug prints.
 
  So my vote would be to add support for standard tracers, like in other
  subsystems in the kernel.
 
  The reason for the current system is to trace which ioctls are called in
  what order by a misbehaving application. It's very useful for that,
  especially when trying to debug user problems.
 
  I don't mind switching to tracepoints as long as this functionality is
  kept one way or another.
  
  I agree with Sylwester: we should move to tracepoints, and this is a good
  start.
 
 As I mentioned, I don't mind switching to tracepoints, but not in the way the
 current patch does it. I certainly don't agree with you merging this patch
 as-is without further discussion.

Let's not mix the subjects here. There are two different demands that can be
either fulfilled by the same solution or by different ones:
1) To have a way to enable debugging all parameters passed from/to
userspace;
2) To be able to measure the driver (and core) performance while
streaming.

This patch's scope is to solve (2), by allowing userspace to hook the two
ioctls that queues/dequeues streaming buffers.

With that regards, what's wrong on this patch? I couldn't see anything bad
there. It is not meant to solve (1).

Before this patch, all we have is (1), as a non-dynamic printk is too
intrusive to be used for performance measurement. So, there's no way to
measure how much time a buffer takes to be filled.

In a matter of fact, in the case you didn't noticed, we are already somewhat
moving to traces, as several drivers are now using dynamic_printk for debug 
messages, Yet, lots of drivers still use either their own normal
printk-based debug macros.

Now, you're proposing to use the same solution for (1) too. 

Ok, we can go on that direction, but this is a separate issue. Converting
the v4l2-ioctl to use tracepoints is the easiest part. However, there are
several things to consider, if we decide to use it for debug purposes:

a) It will likely require to convert all printks to dynamic ones, as we
want to have all debug messages serialized.

Let me explain it better: if some debug messages come via the standard 
printk mechanism while others come via traces, we loose the capability
of receiving the messages at the same order that they were produced, and
it could be harder if not impossible to synchronize them into the right
order.

b) It may make sense to write an userspace tool similar to the rasdaemon
[1] to allow controlling the debug output. That tool directly reads the
events from the raw tracing queues, formatting the data on userspace and
hooking only the events that are needed. 

Currently, the rasdaemon has inside part of the code used by a perf
tool copied on it (as this code is not inside any library yet). However,
that code is being prepared to be used as a library. So, it should be
even easier to write such tool in a near future.

[1] https://git.fedorahosted.org/cgit/rasdaemon.git/

c) I don't think that tracepoints are the right mechanism for a post-mortem
analysis[2]. E. g. if the Kernel crashes, a printk-based mechanism will 
output something, but I'm not sure if doing the same is possible with traces
(e. g. forcing the trace messages to go to to tty).

You should notice that, with the dynamic_printk macros, it is possible to
compile the Kernel to use normal printk macros for debug macros.

However, if we convert the ioctl printk's to tracepoints, we may still
need to have a fallback printk mechanism for ioctl debug 

[GIT PULL for v3.13-rc4] media fixes

2013-12-11 Thread Mauro Carvalho Chehab
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Linus,

Please pull from:
  git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 
v4l_for_linus

For a dvb core deadlock fix, a couple videobuf2 fixes an a series of media
driver fixes.

Thank you!
Mauro

The following changes since commit 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae:

  Linux 3.13-rc1 (2013-11-22 11:30:55 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 
v4l_for_linus

for you to fetch changes up to 64c832a4f79542809d6c10b8ec6225ff8b76092e:

  [media] videobuf2-dma-sg: fix possible memory leak (2013-12-10 05:40:57 -0200)

- 
Alexey Khoroshilov (1):
  [media] dvb_demux: fix deadlock in dmx_section_feed_release_filter()

Antti Palosaari (4):
  [media] af9035: add [0413:6a05] Leadtek WinFast DTV Dongle Dual
  [media] af9035: fix broken I2C and USB I/O
  [media] af9033: fix broken I2C
  [media] rtl2830: add parent for I2C adapter

Dan Carpenter (2):
  [media] cx231xx: use after free on error path in probe
  [media] af9035: unlock on error in af9035_i2c_master_xfer()

Evgeny Plehov (1):
  [media] cxd2820r_c: fix if_ctl calculation

Felipe Pena (1):
  [media] technisat-usb2: fix typo in variable name

Geert Uytterhoeven (1):
  [media] radio-shark: Mark shark_resume_leds() inline to kill compiler 
warning

Georg Kaindl (1):
  [media] usbtv: Add support for PAL video source

Geyslan G. Bem (1):
  [media] videobuf2-dma-sg: fix possible memory leak

Hans Verkuil (4):
  [media] bttv: don't setup the controls if there are no video devices
  [media] tef6862/radio-tea5764: actually assign clamp result
  [media] wm8775: fix broken audio routing
  [media] vb2: regression fix: always set length field.

Hans de Goede (2):
  [media] gspca_sunplus: Add new usb-id for 06d6:0041
  [media] radio-shark2: Mark shark_resume_leds() inline to kill compiler 
warning

Jonathan McCrohan (1):
  [media] media_tree: Fix spelling errors

Laurent Pinchart (1):
  [media] v4l: omap3isp: Don't check for missing get_fmt op on remote subdev

Libin Yang (2):
  [media] marvell-ccic: drop resource free in driver remove
  [media] media: marvell-ccic: use devm to release clk

Michael Krufky (1):
  [media] dvb_demux: clean up whitespace in comments from previous patch 
(trivial)

Ondrej Zary (1):
  [media] gspca-stk1135: Add delay after configuring clock

Philipp Zabel (1):
  [media] videobuf2: Add support for file access mode flags for DMABUF 
exporting

Ricardo Ribalda (2):
  [media] em28xx-video: Swap release order to avoid lock nesting
  [media] ths7303: Declare as static a private function

Sachin Kamat (1):
  [media] mt9p031: Include linux/of.h header

Wei Yongjun (2):
  [media] v4l: vsp1: Fix error return code in vsp1_video_init()
  [media] saa7164: fix return value check in saa7164_initdev()

 Documentation/DocBook/media/v4l/vidioc-expbuf.xml |   8 +-
 drivers/media/common/siano/smscoreapi.h   |   4 +-
 drivers/media/common/siano/smsdvb.h   |   2 +-
 drivers/media/dvb-core/dvb_demux.c|   9 +-
 drivers/media/dvb-frontends/af9033.c  |  12 +-
 drivers/media/dvb-frontends/cxd2820r_c.c  |   2 +-
 drivers/media/dvb-frontends/dib8000.c |   4 +-
 drivers/media/dvb-frontends/drxk_hard.c   |  18 +--
 drivers/media/dvb-frontends/rtl2830.c |   1 +
 drivers/media/i2c/adv7183_regs.h  |   6 +-
 drivers/media/i2c/adv7604.c   |   2 +-
 drivers/media/i2c/adv7842.c   |   2 +-
 drivers/media/i2c/ir-kbd-i2c.c|   2 +-
 drivers/media/i2c/m5mols/m5mols_controls.c|   2 +-
 drivers/media/i2c/mt9p031.c   |   1 +
 drivers/media/i2c/s5c73m3/s5c73m3-core.c  |   2 +-
 drivers/media/i2c/s5c73m3/s5c73m3.h   |   2 +-
 drivers/media/i2c/saa7115.c   |   2 +-
 drivers/media/i2c/soc_camera/ov5642.c |   2 +-
 drivers/media/i2c/ths7303.c   |   3 +-
 drivers/media/i2c/wm8775.c|   4 +-
 drivers/media/pci/bt8xx/bttv-driver.c |   3 +-
 drivers/media/pci/cx18/cx18-driver.h  |   2 +-
 drivers/media/pci/cx23885/cx23885-417.c   |   2 +-
 drivers/media/pci/pluto2/pluto2.c |   2 +-
 drivers/media/pci/saa7164/saa7164-core.c  |   4 +-
 drivers/media/platform/coda.c |   2 +-
 drivers/media/platform/exynos4-is/fimc-core.c |   2 +-
 drivers/media/platform/exynos4-is/media-dev.c |   2 +-
 drivers/media/platform/marvell-ccic/mmp-driver.c  |  46 +-
 drivers/media/platform/omap3isp/isp.c |   2 +-
 drivers/media/platform/omap3isp/ispvideo.c|   7 +-
 drivers/media/platform/s5p-mfc/regs-mfc.h  

Re: [PATCH] v4l2-dev: Add tracepoints for QBUF and DQBUF

2013-12-11 Thread Hans Verkuil
Hi Mauro,

On 12/11/13 11:44, Mauro Carvalho Chehab wrote:
 Hans,
 
 Em Wed, 11 Dec 2013 08:29:58 +0100
 Hans Verkuil hverk...@xs4all.nl escreveu:
 
 On 12/10/2013 09:53 PM, Mauro Carvalho Chehab wrote:
 Em Sat, 23 Nov 2013 17:54:48 +0100
 Hans Verkuil hverk...@xs4all.nl escreveu:

 On 11/23/2013 05:30 PM, Sylwester Nawrocki wrote:
 Hi,

 On 11/23/2013 12:25 PM, Hans Verkuil wrote:
 Hi Wade,

 On 11/22/2013 08:48 PM, Wade Farnsworth wrote:
 Add tracepoints to the QBUF and DQBUF ioctls to enable rudimentary
 performance measurements using standard kernel tracers.

 Signed-off-by: Wade Farnsworthwade_farnswo...@mentor.com
 ---

 This is the update to the RFC patch I posted a few weeks back.  I've 
 added
 several bits of metadata to the tracepoint output per Mauro's 
 suggestion.

 I don't like this. All v4l2 ioctls can already be traced by doing e.g.
 echo 1 (or echo 2)/sys/class/video4linux/video0/debug.

 So this code basically duplicates that functionality. It would be nice 
 to be able
 to tie in the existing tracing code (v4l2-ioctl.c) into tracepoints.

 I think it would be really nice to have this kind of support for standard
 traces at the v4l2 subsystem. Presumably it could even gradually replace
 the v4l2 custom debug infrastructure.

 If I understand things correctly, the current tracing/profiling 
 infrastructure
 is much less invasive than inserting printks all over, which may cause 
 changes
 in control flow. I doubt the system could be reliably profiled by 
 enabling all
 those debug prints.

 So my vote would be to add support for standard tracers, like in other
 subsystems in the kernel.

 The reason for the current system is to trace which ioctls are called in
 what order by a misbehaving application. It's very useful for that,
 especially when trying to debug user problems.

 I don't mind switching to tracepoints as long as this functionality is
 kept one way or another.

 I agree with Sylwester: we should move to tracepoints, and this is a good
 start.

 As I mentioned, I don't mind switching to tracepoints, but not in the way the
 current patch does it. I certainly don't agree with you merging this patch
 as-is without further discussion.
 
 Let's not mix the subjects here. There are two different demands that can be
 either fulfilled by the same solution or by different ones:
   1) To have a way to enable debugging all parameters passed from/to
 userspace;
   2) To be able to measure the driver (and core) performance while
 streaming.
 
 This patch's scope is to solve (2), by allowing userspace to hook the two
 ioctls that queues/dequeues streaming buffers.
 
 With that regards, what's wrong on this patch? I couldn't see anything bad
 there. It is not meant to solve (1).

I have two problems with it: 

1) Right now it is just checking for two ioctls, but as soon as we add more
tracepoints you get another switch on the ioctl command, something I've tried
to avoid by creating the table. So a table-oriented implementation would be
much preferred.

2) It duplicates the already existing code to dump the v4l2_buffer struct.
Is there a way to have just one copy of that? I was hoping Wade could look
into that, and if not, then it is something I can explore (although finding
time is an issue).

Bottom line as far as I am concerned: it was merged while I have outstanding
questions.

If there are good technical reasons why the two problems stated above can't
be easily resolved, then I will reconsider, but for now I think it is too early
to merge. For the record, I don't think I mentioned the first problem in my
original reply, it's something I noticed yesterday while looking at the patch
again.

 
 Before this patch, all we have is (1), as a non-dynamic printk is too
 intrusive to be used for performance measurement. So, there's no way to
 measure how much time a buffer takes to be filled.

Having tracepoints here doesn't tell you anything about that. At best it gives
you information about the jitter.

How are these tracepoints supposed to be used? What information will they
provide? Are tracepoints expected to be limited to QBUF/DQBUF? Or other
ioctls/fops as well? If so, which ones?

I just have too many questions and I'd like to see some answers before something
like this is merged in the v4l2 core.

Rereading my older replies I see that I wasn't particularly clear about what
my objections to the patch were, for which I apologies.

Nevertheless, I stand by my opinion that this patch needs more discussion.

Wade, I appreciate it if you can give some more insights into how you are
using this and what it gives you.

 In a matter of fact, in the case you didn't noticed, we are already somewhat
 moving to traces, as several drivers are now using dynamic_printk for debug 
 messages, Yet, lots of drivers still use either their own normal
 printk-based debug macros.
 
 Now, you're proposing to use the same solution for (1) too. 
 
 Ok, we can go on that direction, but this is a separate 

Re: [PATCH v3] staging: media: davinci_vpfe: Rewrite return statement in vpfe_video.c

2013-12-11 Thread Laurent Pinchart
Hi Lisa,

Thank you for the patch.

On Tuesday 10 December 2013 22:09:22 Lisa Nguyen wrote:
 Rewrite the return statement in vpfe_video.c. This will prevent
 the checkpatch.pl script from generating a warning saying
 to remove () from this particular return statement.
 
 Signed-off-by: Lisa Nguyen l...@xenapiadmin.com

Acked-by; Laurent Pinchart laurent.pinch...@ideasonboard.com

 ---
 Changes since v3:
 - Removed () from return statement per Laurent Pinchart's suggestion
 
  drivers/staging/media/davinci_vpfe/vpfe_video.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c
 b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 24d98a6..3b036be
 100644
 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
 +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
 @@ -346,7 +346,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline
 *pipe) }
   mutex_unlock(mdev-graph_mutex);
 
 - return (ret == 0) ? ret : -ETIMEDOUT ;
 + return ret ? -ETIMEDOUT : 0;
  }
 
  /*
-- 
Regards,

Laurent Pinchart

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


[PATCH v3] v4l: sh_vou: Fix warnings due to improper casts and printk formats

2013-12-11 Thread Laurent Pinchart
Use the %zu and %pad printk specifiers to print size_t and dma_addr_t
variables. This fixes warnings on platforms where dma_addr_t has a
different size than int.

Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
Cc: Mauro Carvalho Chehab m.che...@samsung.com
Cc: linux-media@vger.kernel.org
Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com
---
 drivers/media/platform/sh_vou.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/sh_vou.c b/drivers/media/platform/sh_vou.c
index 4f30341..65c9f18 100644
--- a/drivers/media/platform/sh_vou.c
+++ b/drivers/media/platform/sh_vou.c
@@ -286,7 +286,7 @@ static int sh_vou_buf_prepare(struct videobuf_queue *vq,
vb-size = vb-height * bytes_per_line;
if (vb-baddr  vb-bsize  vb-size) {
/* User buffer too small */
-   dev_warn(vq-dev, User buffer too small: [%u] @ %lx\n,
+   dev_warn(vq-dev, User buffer too small: [%zu] @ %lx\n,
 vb-bsize, vb-baddr);
return -EINVAL;
}
@@ -302,9 +302,10 @@ static int sh_vou_buf_prepare(struct videobuf_queue *vq,
}
 
dev_dbg(vou_dev-v4l2_dev.dev,
-   %s(): fmt #%d, %u bytes per line, phys 0x%x, type %d, state 
%d\n,
+   %s(): fmt #%d, %u bytes per line, phys %pad, type %d, state 
%d\n,
__func__, vou_dev-pix_idx, bytes_per_line,
-   videobuf_to_dma_contig(vb), vb-memory, vb-state);
+   ({ dma_addr_t addr = videobuf_to_dma_contig(vb); addr; }),
+   vb-memory, vb-state);
 
return 0;
 }
-- 
Regards,

Laurent Pinchart

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


Re: [PATCH] v4l2-dev: Add tracepoints for QBUF and DQBUF

2013-12-11 Thread Mauro Carvalho Chehab
Em Wed, 11 Dec 2013 12:53:55 +0100
Hans Verkuil hverk...@xs4all.nl escreveu:

 Hi Mauro,
 
 On 12/11/13 11:44, Mauro Carvalho Chehab wrote:
  Hans,
  
  Em Wed, 11 Dec 2013 08:29:58 +0100
  Hans Verkuil hverk...@xs4all.nl escreveu:
  
  On 12/10/2013 09:53 PM, Mauro Carvalho Chehab wrote:
  Em Sat, 23 Nov 2013 17:54:48 +0100
  Hans Verkuil hverk...@xs4all.nl escreveu:
 
  On 11/23/2013 05:30 PM, Sylwester Nawrocki wrote:
  Hi,
 
  On 11/23/2013 12:25 PM, Hans Verkuil wrote:
  Hi Wade,
 
  On 11/22/2013 08:48 PM, Wade Farnsworth wrote:
  Add tracepoints to the QBUF and DQBUF ioctls to enable rudimentary
  performance measurements using standard kernel tracers.
 
  Signed-off-by: Wade Farnsworthwade_farnswo...@mentor.com
  ---
 
  This is the update to the RFC patch I posted a few weeks back.  I've 
  added
  several bits of metadata to the tracepoint output per Mauro's 
  suggestion.
 
  I don't like this. All v4l2 ioctls can already be traced by doing e.g.
  echo 1 (or echo 2)/sys/class/video4linux/video0/debug.
 
  So this code basically duplicates that functionality. It would be nice 
  to be able
  to tie in the existing tracing code (v4l2-ioctl.c) into tracepoints.
 
  I think it would be really nice to have this kind of support for 
  standard
  traces at the v4l2 subsystem. Presumably it could even gradually replace
  the v4l2 custom debug infrastructure.
 
  If I understand things correctly, the current tracing/profiling 
  infrastructure
  is much less invasive than inserting printks all over, which may cause 
  changes
  in control flow. I doubt the system could be reliably profiled by 
  enabling all
  those debug prints.
 
  So my vote would be to add support for standard tracers, like in other
  subsystems in the kernel.
 
  The reason for the current system is to trace which ioctls are called in
  what order by a misbehaving application. It's very useful for that,
  especially when trying to debug user problems.
 
  I don't mind switching to tracepoints as long as this functionality is
  kept one way or another.
 
  I agree with Sylwester: we should move to tracepoints, and this is a good
  start.
 
  As I mentioned, I don't mind switching to tracepoints, but not in the way 
  the
  current patch does it. I certainly don't agree with you merging this patch
  as-is without further discussion.
  
  Let's not mix the subjects here. There are two different demands that can be
  either fulfilled by the same solution or by different ones:
  1) To have a way to enable debugging all parameters passed from/to
  userspace;
  2) To be able to measure the driver (and core) performance while
  streaming.
  
  This patch's scope is to solve (2), by allowing userspace to hook the two
  ioctls that queues/dequeues streaming buffers.
  
  With that regards, what's wrong on this patch? I couldn't see anything bad
  there. It is not meant to solve (1).
 
 I have two problems with it: 
 
 1) Right now it is just checking for two ioctls, but as soon as we add more
 tracepoints you get another switch on the ioctl command, something I've tried
 to avoid by creating the table. So a table-oriented implementation would be
 much preferred.

From performance measurement PoV, I don't see any reason to add it to any
other ioctl. Of course if we revisit it and other traces become needed,
then we should use a table approach instead.

 
 2) It duplicates the already existing code to dump the v4l2_buffer struct.
 Is there a way to have just one copy of that? I was hoping Wade could look
 into that, and if not, then it is something I can explore (although finding
 time is an issue).

Having implemented tracepoints myself, I'd say that the answer is no.

Let me give you an example.

The ras:aer_event trace is a simple tracepoint that also uses the 
__print_flags() macro. It is implemented at include/trace/events/ras.h
as:

#define aer_correctable_errors  \
{BIT(0),Receiver Error},  \
{BIT(6),Bad TLP}, \
{BIT(7),Bad DLLP},\
{BIT(8),RELAY_NUM Rollover},  \
{BIT(12),   Replay Timer Timeout},\
{BIT(13),   Advisory Non-Fatal}

#define aer_uncorrectable_errors\
{BIT(4),Data Link Protocol},  \
{BIT(12),   Poisoned TLP},\
{BIT(13),   Flow Control Protocol},   \
{BIT(14),   Completion Timeout},  \
{BIT(15),   Completer Abort}, \
{BIT(16),   Unexpected Completion},   \
{BIT(17),   Receiver Overflow},   \
{BIT(18),   Malformed TLP},   \
{BIT(19),   ECRC},\
{BIT(20),   Unsupported Request}

TRACE_EVENT(aer_event,
TP_PROTO(const char *dev_name,
 const u32 status,
 const u8 severity),


Re: [PATCH 06/15] v4l: sh_vou: Enable driver compilation with COMPILE_TEST

2013-12-11 Thread Laurent Pinchart
Hi Mauro,

Could you please pick this patch up for v3.14 ?

On Wednesday 27 November 2013 02:18:28 Laurent Pinchart wrote:
 This helps increasing build testing coverage.
 
 Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
 Cc: Mauro Carvalho Chehab m.che...@samsung.com
 Cc: linux-media@vger.kernel.org
 Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com
 Acked-by: Simon Horman ho...@verge.net.au
 ---
  drivers/media/platform/Kconfig | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
 index d7f0249..7f6ea65 100644
 --- a/drivers/media/platform/Kconfig
 +++ b/drivers/media/platform/Kconfig
 @@ -36,7 +36,8 @@ source drivers/media/platform/blackfin/Kconfig
  config VIDEO_SH_VOU
   tristate SuperH VOU video output driver
   depends on MEDIA_CAMERA_SUPPORT
 - depends on VIDEO_DEV  ARCH_SHMOBILE  I2C
 + depends on VIDEO_DEV  I2C
 + depends on ARCH_SHMOBILE || COMPILE_TEST
   select VIDEOBUF_DMA_CONTIG
   help
 Support for the Video Output Unit (VOU) on SuperH SoCs.
-- 
Regards,

Laurent Pinchart

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


Re: Patch mceusb: fix invalid urb interval

2013-12-11 Thread Sean Young
On Sun, Nov 10, 2013 at 10:50:45AM +, Martin Kittel wrote:
 Hi,
 
 I had trouble getting my MCE remote control to work on my new Intel
 mainboard. It was working fine with older boards but with the new board
 there would be no reply from the remote just after the setup package was
 received during the init phase.
 I traced the problem down to the mceusb_dev_recv function where the received
 urb is resubmitted again. The problem is that my new board is so blazing
 fast that the initial urb was processed in less than a single 125
 microsecond interval, so the urb as it was received had urb-interval set to 
 0.
 As the urb is just resubmitted as it came in it now had an invalid interval
 set and was rejected.
 The patch just resets urb-interval to its initial value and adds some error
 diagnostics (which would have saved me a lot of time during my analysis).

What mceusb devices is this? Could you provide lsusb -vvv output please?

Also what usb hub are you using? Another user is reporting problems with an
xhci hub.


Sean
--
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] v4l2-dev: Add tracepoints for QBUF and DQBUF

2013-12-11 Thread Hans Verkuil
On 12/11/13 13:44, Mauro Carvalho Chehab wrote:
 Em Wed, 11 Dec 2013 12:53:55 +0100
 Hans Verkuil hverk...@xs4all.nl escreveu:
 
 Hi Mauro,

 On 12/11/13 11:44, Mauro Carvalho Chehab wrote:
 Hans,

 Em Wed, 11 Dec 2013 08:29:58 +0100
 Hans Verkuil hverk...@xs4all.nl escreveu:

 On 12/10/2013 09:53 PM, Mauro Carvalho Chehab wrote:
 Em Sat, 23 Nov 2013 17:54:48 +0100
 Hans Verkuil hverk...@xs4all.nl escreveu:

 On 11/23/2013 05:30 PM, Sylwester Nawrocki wrote:
 Hi,

 On 11/23/2013 12:25 PM, Hans Verkuil wrote:
 Hi Wade,

 On 11/22/2013 08:48 PM, Wade Farnsworth wrote:
 Add tracepoints to the QBUF and DQBUF ioctls to enable rudimentary
 performance measurements using standard kernel tracers.

 Signed-off-by: Wade Farnsworthwade_farnswo...@mentor.com
 ---

 This is the update to the RFC patch I posted a few weeks back.  I've 
 added
 several bits of metadata to the tracepoint output per Mauro's 
 suggestion.

 I don't like this. All v4l2 ioctls can already be traced by doing e.g.
 echo 1 (or echo 2)/sys/class/video4linux/video0/debug.

 So this code basically duplicates that functionality. It would be nice 
 to be able
 to tie in the existing tracing code (v4l2-ioctl.c) into tracepoints.

 I think it would be really nice to have this kind of support for 
 standard
 traces at the v4l2 subsystem. Presumably it could even gradually replace
 the v4l2 custom debug infrastructure.

 If I understand things correctly, the current tracing/profiling 
 infrastructure
 is much less invasive than inserting printks all over, which may cause 
 changes
 in control flow. I doubt the system could be reliably profiled by 
 enabling all
 those debug prints.

 So my vote would be to add support for standard tracers, like in other
 subsystems in the kernel.

 The reason for the current system is to trace which ioctls are called in
 what order by a misbehaving application. It's very useful for that,
 especially when trying to debug user problems.

 I don't mind switching to tracepoints as long as this functionality is
 kept one way or another.

 I agree with Sylwester: we should move to tracepoints, and this is a good
 start.

 As I mentioned, I don't mind switching to tracepoints, but not in the way 
 the
 current patch does it. I certainly don't agree with you merging this patch
 as-is without further discussion.

 Let's not mix the subjects here. There are two different demands that can be
 either fulfilled by the same solution or by different ones:
 1) To have a way to enable debugging all parameters passed from/to
 userspace;
 2) To be able to measure the driver (and core) performance while
 streaming.

 This patch's scope is to solve (2), by allowing userspace to hook the two
 ioctls that queues/dequeues streaming buffers.

 With that regards, what's wrong on this patch? I couldn't see anything bad
 there. It is not meant to solve (1).

 I have two problems with it: 

 1) Right now it is just checking for two ioctls, but as soon as we add more
 tracepoints you get another switch on the ioctl command, something I've tried
 to avoid by creating the table. So a table-oriented implementation would be
 much preferred.
 
 From performance measurement PoV, I don't see any reason to add it to any
 other ioctl.

But perhaps this makes sense as well for read() and write()? Possibly poll()?

 Of course if we revisit it and other traces become needed,
 then we should use a table approach instead.
 

 2) It duplicates the already existing code to dump the v4l2_buffer struct.
 Is there a way to have just one copy of that? I was hoping Wade could look
 into that, and if not, then it is something I can explore (although finding
 time is an issue).
 
 Having implemented tracepoints myself, I'd say that the answer is no.
 
 Let me give you an example.
 
 The ras:aer_event trace is a simple tracepoint that also uses the 
 __print_flags() macro. It is implemented at include/trace/events/ras.h
 as:
 
 #define aer_correctable_errors\
   {BIT(0),Receiver Error},  \
   {BIT(6),Bad TLP}, \
   {BIT(7),Bad DLLP},\
   {BIT(8),RELAY_NUM Rollover},  \
   {BIT(12),   Replay Timer Timeout},\
   {BIT(13),   Advisory Non-Fatal}
 
 #define aer_uncorrectable_errors  \
   {BIT(4),Data Link Protocol},  \
   {BIT(12),   Poisoned TLP},\
   {BIT(13),   Flow Control Protocol},   \
   {BIT(14),   Completion Timeout},  \
   {BIT(15),   Completer Abort}, \
   {BIT(16),   Unexpected Completion},   \
   {BIT(17),   Receiver Overflow},   \
   {BIT(18),   Malformed TLP},   \
   {BIT(19),   ECRC},\
   {BIT(20),   Unsupported Request}
 
 TRACE_EVENT(aer_event,
   TP_PROTO(const char *dev_name,
const u32 status,

Re: Fwd: dib8000 scanning not working on 3.10.3

2013-12-11 Thread Ezequiel Garcia
Hi Javier,

On Tue, Dec 10, 2013 at 04:46:16PM -0200, Javier Búcar wrote:
 
 The issue remain on kernel 3.12.3

I'll try to push a fixed kernel (with some patches reverted), so you can
try.

Will you be able to try a mainline-like kernel? I'll push a git branch,
so it'll be something like this:

  git://git.free-electrons.com/users/ezequiel-garcia/linux/

It won't happen anytime soon, but I'll try to do it before the end of
the year.
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.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] v4l2-dev: Add tracepoints for QBUF and DQBUF

2013-12-11 Thread Mauro Carvalho Chehab
Em Wed, 11 Dec 2013 14:15:23 +0100
Hans Verkuil hverk...@xs4all.nl escreveu:

 On 12/11/13 13:44, Mauro Carvalho Chehab wrote:
  Em Wed, 11 Dec 2013 12:53:55 +0100
  Hans Verkuil hverk...@xs4all.nl escreveu:
  
  Hi Mauro,
 
  On 12/11/13 11:44, Mauro Carvalho Chehab wrote:
  Hans,
 
  Em Wed, 11 Dec 2013 08:29:58 +0100
  Hans Verkuil hverk...@xs4all.nl escreveu:
 
  On 12/10/2013 09:53 PM, Mauro Carvalho Chehab wrote:
  Em Sat, 23 Nov 2013 17:54:48 +0100
  Hans Verkuil hverk...@xs4all.nl escreveu:
 
  On 11/23/2013 05:30 PM, Sylwester Nawrocki wrote:
  Hi,
 
  On 11/23/2013 12:25 PM, Hans Verkuil wrote:
  Hi Wade,
 
  On 11/22/2013 08:48 PM, Wade Farnsworth wrote:
  Add tracepoints to the QBUF and DQBUF ioctls to enable rudimentary
  performance measurements using standard kernel tracers.
 
  Signed-off-by: Wade Farnsworthwade_farnswo...@mentor.com
  ---
 
  This is the update to the RFC patch I posted a few weeks back.  
  I've added
  several bits of metadata to the tracepoint output per Mauro's 
  suggestion.
 
  I don't like this. All v4l2 ioctls can already be traced by doing 
  e.g.
  echo 1 (or echo 2)/sys/class/video4linux/video0/debug.
 
  So this code basically duplicates that functionality. It would be 
  nice to be able
  to tie in the existing tracing code (v4l2-ioctl.c) into tracepoints.
 
  I think it would be really nice to have this kind of support for 
  standard
  traces at the v4l2 subsystem. Presumably it could even gradually 
  replace
  the v4l2 custom debug infrastructure.
 
  If I understand things correctly, the current tracing/profiling 
  infrastructure
  is much less invasive than inserting printks all over, which may 
  cause 
  changes
  in control flow. I doubt the system could be reliably profiled by 
  enabling all
  those debug prints.
 
  So my vote would be to add support for standard tracers, like in other
  subsystems in the kernel.
 
  The reason for the current system is to trace which ioctls are called 
  in
  what order by a misbehaving application. It's very useful for that,
  especially when trying to debug user problems.
 
  I don't mind switching to tracepoints as long as this functionality is
  kept one way or another.
 
  I agree with Sylwester: we should move to tracepoints, and this is a 
  good
  start.
 
  As I mentioned, I don't mind switching to tracepoints, but not in the 
  way the
  current patch does it. I certainly don't agree with you merging this 
  patch
  as-is without further discussion.
 
  Let's not mix the subjects here. There are two different demands that can 
  be
  either fulfilled by the same solution or by different ones:
1) To have a way to enable debugging all parameters passed from/to
  userspace;
2) To be able to measure the driver (and core) performance while
  streaming.
 
  This patch's scope is to solve (2), by allowing userspace to hook the two
  ioctls that queues/dequeues streaming buffers.
 
  With that regards, what's wrong on this patch? I couldn't see anything bad
  there. It is not meant to solve (1).
 
  I have two problems with it: 
 
  1) Right now it is just checking for two ioctls, but as soon as we add more
  tracepoints you get another switch on the ioctl command, something I've 
  tried
  to avoid by creating the table. So a table-oriented implementation would be
  much preferred.
  
  From performance measurement PoV, I don't see any reason to add it to any
  other ioctl.
 
 But perhaps this makes sense as well for read() and write()? Possibly poll()?

Could be, but, in this case, it won't be at the ioctl table.

  Of course if we revisit it and other traces become needed,
  then we should use a table approach instead.
  
 
  2) It duplicates the already existing code to dump the v4l2_buffer struct.
  Is there a way to have just one copy of that? I was hoping Wade could look
  into that, and if not, then it is something I can explore (although finding
  time is an issue).
  
  Having implemented tracepoints myself, I'd say that the answer is no.
  
  Let me give you an example.
  
  The ras:aer_event trace is a simple tracepoint that also uses the 
  __print_flags() macro. It is implemented at include/trace/events/ras.h
  as:
  
  #define aer_correctable_errors  \
  {BIT(0),Receiver Error},  \
  {BIT(6),Bad TLP}, \
  {BIT(7),Bad DLLP},\
  {BIT(8),RELAY_NUM Rollover},  \
  {BIT(12),   Replay Timer Timeout},\
  {BIT(13),   Advisory Non-Fatal}
  
  #define aer_uncorrectable_errors\
  {BIT(4),Data Link Protocol},  \
  {BIT(12),   Poisoned TLP},\
  {BIT(13),   Flow Control Protocol},   \
  {BIT(14),   Completion Timeout},  \
  {BIT(15),   Completer Abort}, \
  {BIT(16),   Unexpected Completion},   \
  {BIT(17),   Receiver Overflow},  

pctv 290e fails with kernel 3.12.3

2013-12-11 Thread Robin Becker
Apologies if this is the wrong place to report this. I am running arch linux on 
a 64 bit machine. Currently I am stuck on


Linux bunyip 3.12.2-1-ARCH #1 SMP PREEMPT Fri Nov 29 21:14:15 CET 2013 x86_64 
GNU/Linux


If I upgrade to the next kernel in line linux-3.12.3-1-x86_64.pkg.tar.xz I see 
failures during boot and my two usb tv devices fail.


From lsusb -v


Bus 002 Device 005: ID 2013:024f PCTV Systems nanoStick T2 290e
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  idVendor   0x2013 PCTV Systems
  idProduct  0x024f nanoStick T2 290e
  bcdDevice1.00
  iManufacturer   1 PCTV Systems
  iProduct2 PCTV 290e
  iSerial 3 0010V0M9
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   55
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0
bmAttributes 0x80
  (Bus Powered)
MaxPower  500mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   2
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass  0
  bInterfaceProtocol  0
  iInterface  0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84  EP 4 IN
bmAttributes1
  Transfer TypeIsochronous
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x  1x 0 bytes
bInterval   1
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x85  EP 5 IN
bmAttributes1
  Transfer TypeIsochronous
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x  1x 0 bytes
bInterval   1
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   1
  bNumEndpoints   2
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass  0
  bInterfaceProtocol  0
  iInterface  0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84  EP 4 IN
bmAttributes1
  Transfer TypeIsochronous
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x03ac  1x 940 bytes
bInterval   1
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
   bEndpointAddress 0x85  EP 5 IN
bmAttributes1
  Transfer TypeIsochronous
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x03ac  1x 940 bytes
bInterval   1
Device Qualifier (for other device speed):
  bLength10
  bDescriptorType 6
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  bNumConfigurations  1
Device Status: 0x
  (Bus Powered)

Bus 002 Device 004: ID 2013:024f PCTV Systems nanoStick T2 290e
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  idVendor   0x2013 PCTV Systems
  idProduct  0x024f nanoStick T2 290e
  bcdDevice1.00
  iManufacturer   1 PCTV Systems
  iProduct2 PCTV 290e
  iSerial 3 00101286
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   55
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0
bmAttributes 0x80
  (Bus Powered)
MaxPower  500mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   2
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass  0
  bInterfaceProtocol  0
  iInterface  0
  Endpoint Descriptor:
bLength  

Re: [PATCH] v4l2-dev: Add tracepoints for QBUF and DQBUF

2013-12-11 Thread Wade Farnsworth
Hi Hans,

Hans Verkuil wrote:
 On 12/11/13 13:44, Mauro Carvalho Chehab wrote:
 Em Wed, 11 Dec 2013 12:53:55 +0100
 Hans Verkuil hverk...@xs4all.nl escreveu:

 Hi Mauro,

 On 12/11/13 11:44, Mauro Carvalho Chehab wrote:
 Hans,

 Em Wed, 11 Dec 2013 08:29:58 +0100
 Hans Verkuil hverk...@xs4all.nl escreveu:

 On 12/10/2013 09:53 PM, Mauro Carvalho Chehab wrote:
 Em Sat, 23 Nov 2013 17:54:48 +0100
 Hans Verkuil hverk...@xs4all.nl escreveu:

 On 11/23/2013 05:30 PM, Sylwester Nawrocki wrote:
 Hi,

 On 11/23/2013 12:25 PM, Hans Verkuil wrote:
 Hi Wade,

 On 11/22/2013 08:48 PM, Wade Farnsworth wrote:
 Add tracepoints to the QBUF and DQBUF ioctls to enable rudimentary
 performance measurements using standard kernel tracers.

 Signed-off-by: Wade Farnsworthwade_farnswo...@mentor.com
 ---

 This is the update to the RFC patch I posted a few weeks back.  I've 
 added
 several bits of metadata to the tracepoint output per Mauro's 
 suggestion.

 I don't like this. All v4l2 ioctls can already be traced by doing e.g.
 echo 1 (or echo 2)/sys/class/video4linux/video0/debug.

 So this code basically duplicates that functionality. It would be 
 nice to be able
 to tie in the existing tracing code (v4l2-ioctl.c) into tracepoints.

 I think it would be really nice to have this kind of support for 
 standard
 traces at the v4l2 subsystem. Presumably it could even gradually 
 replace
 the v4l2 custom debug infrastructure.

 If I understand things correctly, the current tracing/profiling 
 infrastructure
 is much less invasive than inserting printks all over, which may cause 
 changes
 in control flow. I doubt the system could be reliably profiled by 
 enabling all
 those debug prints.

 So my vote would be to add support for standard tracers, like in other
 subsystems in the kernel.

 The reason for the current system is to trace which ioctls are called in
 what order by a misbehaving application. It's very useful for that,
 especially when trying to debug user problems.

 I don't mind switching to tracepoints as long as this functionality is
 kept one way or another.

 I agree with Sylwester: we should move to tracepoints, and this is a good
 start.

 As I mentioned, I don't mind switching to tracepoints, but not in the way 
 the
 current patch does it. I certainly don't agree with you merging this patch
 as-is without further discussion.

 Let's not mix the subjects here. There are two different demands that can 
 be
 either fulfilled by the same solution or by different ones:
1) To have a way to enable debugging all parameters passed from/to
 userspace;
2) To be able to measure the driver (and core) performance while
 streaming.

 This patch's scope is to solve (2), by allowing userspace to hook the two
 ioctls that queues/dequeues streaming buffers.

 With that regards, what's wrong on this patch? I couldn't see anything bad
 there. It is not meant to solve (1).

 I have two problems with it: 

 1) Right now it is just checking for two ioctls, but as soon as we add more
 tracepoints you get another switch on the ioctl command, something I've 
 tried
 to avoid by creating the table. So a table-oriented implementation would be
 much preferred.

 From performance measurement PoV, I don't see any reason to add it to any
 other ioctl.
 
 But perhaps this makes sense as well for read() and write()? Possibly poll()?
 
 Of course if we revisit it and other traces become needed,
 then we should use a table approach instead.


 2) It duplicates the already existing code to dump the v4l2_buffer struct.
 Is there a way to have just one copy of that? I was hoping Wade could look
 into that, and if not, then it is something I can explore (although finding
 time is an issue).

 Having implemented tracepoints myself, I'd say that the answer is no.

 Let me give you an example.

 The ras:aer_event trace is a simple tracepoint that also uses the 
 __print_flags() macro. It is implemented at include/trace/events/ras.h
 as:

 #define aer_correctable_errors   \
  {BIT(0),Receiver Error},  \
  {BIT(6),Bad TLP}, \
  {BIT(7),Bad DLLP},\
  {BIT(8),RELAY_NUM Rollover},  \
  {BIT(12),   Replay Timer Timeout},\
  {BIT(13),   Advisory Non-Fatal}

 #define aer_uncorrectable_errors \
  {BIT(4),Data Link Protocol},  \
  {BIT(12),   Poisoned TLP},\
  {BIT(13),   Flow Control Protocol},   \
  {BIT(14),   Completion Timeout},  \
  {BIT(15),   Completer Abort}, \
  {BIT(16),   Unexpected Completion},   \
  {BIT(17),   Receiver Overflow},   \
  {BIT(18),   Malformed TLP},   \
  {BIT(19),   ECRC},\
  {BIT(20),   Unsupported Request}

 TRACE_EVENT(aer_event,
  TP_PROTO(const char *dev_name,
   const u32 

[GIT PULL FOR v3.14] More OMAP3 ISP patches

2013-12-11 Thread Laurent Pinchart
Hi Mauro,

The following changes since commit 989af88339db26345e23271dae1089d949c4a0f1:

  [media] v4l: vsp1: Add LUT support (2013-12-11 09:25:20 -0200)

are available in the git repository at:

  git://linuxtv.org/pinchartl/media.git omap3isp/next

for you to fetch changes up to 16fb2398942d3b2fc765d09adfc6c4ec52843149:

  omap3isp: Fix buffer flags handling when querying buffer (2013-12-11 
16:52:02 +0100)


Laurent Pinchart (2):
  omap3isp: Use devm_ioremap_resource()
  omap3isp: Fix buffer flags handling when querying buffer

Sylwester Nawrocki (1):
  omap3isp: Modify clocks registration to avoid circular references

 drivers/media/platform/omap3isp/isp.c  | 47 +
 drivers/media/platform/omap3isp/isp.h  |  3 +--
 drivers/media/platform/omap3isp/ispqueue.c |  2 ++
 3 files changed, 24 insertions(+), 28 deletions(-)

-- 
Regards,

Laurent Pinchart

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


[GIT PULL FOR v3.14] V4L2 OF fixes

2013-12-11 Thread Laurent Pinchart
Hi Mauro,

The following changes since commit 989af88339db26345e23271dae1089d949c4a0f1:

  [media] v4l: vsp1: Add LUT support (2013-12-11 09:25:20 -0200)

are available in the git repository at:

  git://linuxtv.org/pinchartl/media.git v4l2/core

for you to fetch changes up to 4b3ee9dbee6e2b806ce0bc041066d8c73c0e850c:

  v4l: of: Drop endpoint node reference in v4l2_of_get_remote_port() 
(2013-12-11 16:55:37 +0100)


Laurent Pinchart (3):
  v4l: of: Return an int in v4l2_of_parse_endpoint()
  v4l: of: Remove struct v4l2_of_endpoint remote field
  v4l: of: Drop endpoint node reference in v4l2_of_get_remote_port()

 drivers/media/v4l2-core/v4l2-of.c | 10 +++---
 include/media/v4l2-of.h   |  6 ++
 2 files changed, 9 insertions(+), 7 deletions(-)

-- 
Regards,

Laurent Pinchart

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


[PATCH v2 0/7] Atmel ISI fixes and improvements

2013-12-11 Thread Laurent Pinchart
Hello,

Here's the second version of a set of miscellaneous fixes and improvement
patches for the atmel-isi driver. Please see individual commit messages for
more information.

Patch 5/7 makes the MCK clock optional. The goal is to remove it completely,
but we first need to port boards to the new clock handling mechanism. The
patch in itself will not have any effect until then, but getting it in v3.14
will help with dependency management for arch/ changes in the next kernel
versions.

Josh told me he isn't planning to send a pull request for the atmel-isi driver
for v3.14 so I'll send one with this series in a couple of days.

Changes compared to v1:

- Added patches 6/7 and 7/7
- Rebased on the latest linuxtv master branch

Josh Wu (2):
  v4l: atmel-isi: remove SOF wait in start_streaming()
  v4l: atmel-isi: Should clear bits before set the hardware register

Laurent Pinchart (5):
  v4l: atmel-isi: Use devm_* managed allocators
  v4l: atmel-isi: Defer clock (un)preparation to enable/disable time
  v4l: atmel-isi: Reset the ISI when starting the stream
  v4l: atmel-isi: Make the MCK clock optional
  v4l: atmel-isi: Fix color component ordering

 drivers/media/platform/soc_camera/atmel-isi.c | 179 --
 include/media/atmel-isi.h |   2 +
 2 files changed, 55 insertions(+), 126 deletions(-)

-- 
Regards,

Laurent Pinchart

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


[PATCH v2 4/7] v4l: atmel-isi: Reset the ISI when starting the stream

2013-12-11 Thread Laurent Pinchart
The queue setup operation isn't the right place to reset the ISI. Move
the reset call to the start streaming operation.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Acked-by: Josh Wu josh...@atmel.com
---
 drivers/media/platform/soc_camera/atmel-isi.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index ea8816c..ae2c8c1 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -241,16 +241,6 @@ static int queue_setup(struct vb2_queue *vq, const struct 
v4l2_format *fmt,
struct soc_camera_host *ici = to_soc_camera_host(icd-parent);
struct atmel_isi *isi = ici-priv;
unsigned long size;
-   int ret;
-
-   /* Reset ISI */
-   ret = atmel_isi_wait_status(isi, WAIT_ISI_RESET);
-   if (ret  0) {
-   dev_err(icd-parent, Reset ISI timed out\n);
-   return ret;
-   }
-   /* Disable all interrupts */
-   isi_writel(isi, ISI_INTDIS, ~0UL);
 
size = icd-sizeimage;
 
@@ -390,6 +380,16 @@ static int start_streaming(struct vb2_queue *vq, unsigned 
int count)
struct soc_camera_host *ici = to_soc_camera_host(icd-parent);
struct atmel_isi *isi = ici-priv;
u32 sr = 0;
+   int ret;
+
+   /* Reset ISI */
+   ret = atmel_isi_wait_status(isi, WAIT_ISI_RESET);
+   if (ret  0) {
+   dev_err(icd-parent, Reset ISI timed out\n);
+   return ret;
+   }
+   /* Disable all interrupts */
+   isi_writel(isi, ISI_INTDIS, ~0UL);
 
spin_lock_irq(isi-lock);
/* Clear any pending interrupt */
-- 
1.8.3.2

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


[PATCH v2 1/7] v4l: atmel-isi: remove SOF wait in start_streaming()

2013-12-11 Thread Laurent Pinchart
From: Josh Wu josh...@atmel.com

when a userspace applications calls the VIDIOC_STREAMON ioctl. The
V4L2 core calls the soc_camera_streamon function, which is responsible
for starting the video stream. It does so by first starting the atmel-isi
host by a call to the vb2_streamon function, and then starting the sensor
by a call to the video.s_stream sensor subdev operation.

That means we wait for a SOF in start_streaming() before call sensor's
s_stream(). It is possible no VSYNC interrupt arrive as the sensor
hasn't been started yet.

To avoid such case, this patch remove the code to wait for the VSYNC
interrupt. And such code is not necessary.

Reported-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Signed-off-by: Josh Wu josh...@atmel.com
---
 drivers/media/platform/soc_camera/atmel-isi.c | 47 +--
 1 file changed, 1 insertion(+), 46 deletions(-)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index 1044856..b46c0ed 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -34,13 +34,6 @@
 #define MIN_FRAME_RATE 15
 #define FRAME_INTERVAL_MILLI_SEC   (1000 / MIN_FRAME_RATE)
 
-/* ISI states */
-enum {
-   ISI_STATE_IDLE = 0,
-   ISI_STATE_READY,
-   ISI_STATE_WAIT_SOF,
-};
-
 /* Frame buffer descriptor */
 struct fbd {
/* Physical address of the frame buffer */
@@ -75,11 +68,6 @@ struct atmel_isi {
void __iomem*regs;
 
int sequence;
-   /* State of the ISI module in capturing mode */
-   int state;
-
-   /* Wait queue for waiting for SOF */
-   wait_queue_head_t   vsync_wq;
 
struct vb2_alloc_ctx*alloc_ctx;
 
@@ -207,12 +195,6 @@ static irqreturn_t isi_interrupt(int irq, void *dev_id)
isi_writel(isi, ISI_INTDIS, ISI_CTRL_DIS);
ret = IRQ_HANDLED;
} else {
-   if ((pending  ISI_SR_VSYNC) 
-   (isi-state == ISI_STATE_IDLE)) {
-   isi-state = ISI_STATE_READY;
-   wake_up_interruptible(isi-vsync_wq);
-   ret = IRQ_HANDLED;
-   }
if (likely(pending  ISI_SR_CXFR_DONE))
ret = atmel_isi_handle_streaming(isi);
}
@@ -407,43 +389,17 @@ static int start_streaming(struct vb2_queue *vq, unsigned 
int count)
struct soc_camera_device *icd = soc_camera_from_vb2q(vq);
struct soc_camera_host *ici = to_soc_camera_host(icd-parent);
struct atmel_isi *isi = ici-priv;
-
u32 sr = 0;
-   int ret;
 
spin_lock_irq(isi-lock);
-   isi-state = ISI_STATE_IDLE;
-   /* Clear any pending SOF interrupt */
+   /* Clear any pending interrupt */
sr = isi_readl(isi, ISI_STATUS);
-   /* Enable VSYNC interrupt for SOF */
-   isi_writel(isi, ISI_INTEN, ISI_SR_VSYNC);
-   isi_writel(isi, ISI_CTRL, ISI_CTRL_EN);
-   spin_unlock_irq(isi-lock);
-
-   dev_dbg(icd-parent, Waiting for SOF\n);
-   ret = wait_event_interruptible(isi-vsync_wq,
-  isi-state != ISI_STATE_IDLE);
-   if (ret)
-   goto err;
-
-   if (isi-state != ISI_STATE_READY) {
-   ret = -EIO;
-   goto err;
-   }
 
-   spin_lock_irq(isi-lock);
-   isi-state = ISI_STATE_WAIT_SOF;
-   isi_writel(isi, ISI_INTDIS, ISI_SR_VSYNC);
if (count)
start_dma(isi, isi-active);
spin_unlock_irq(isi-lock);
 
return 0;
-err:
-   isi-active = NULL;
-   isi-sequence = 0;
-   INIT_LIST_HEAD(isi-video_buffer_list);
-   return ret;
 }
 
 /* abort streaming and wait for last buffer */
@@ -965,7 +921,6 @@ static int atmel_isi_probe(struct platform_device *pdev)
isi-pdata = pdata;
isi-active = NULL;
spin_lock_init(isi-lock);
-   init_waitqueue_head(isi-vsync_wq);
INIT_LIST_HEAD(isi-video_buffer_list);
INIT_LIST_HEAD(isi-dma_desc_head);
 
-- 
1.8.3.2

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


[PATCH v2 6/7] v4l: atmel-isi: Fix color component ordering

2013-12-11 Thread Laurent Pinchart
The ISI_CFG2.YCC_SWAP field controls color component ordering. The
datasheet lists the following orderings for the memory formats.

YCC_SWAPByte 0  Byte 1  Byte 2  Byte 3
00: Default Cb(i)   Y(i)Cr(i)   Y(i+1)
01: Mode1   Cr(i)   Y(i)Cb(i)   Y(i+1)
10: Mode2   Y(i)Cb(i)   Y(i+1)  Cr(i)
11: Mode3   Y(i)Cr(i)   Y(i+1)  Cb(i)

This is based on a sensor format set to CbYCrY (UYVY). The driver
hardcodes the output memory format to YUYV, configure the ordering
accordingly.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Acked-by: Josh Wu josh...@atmel.com
---
 drivers/media/platform/soc_camera/atmel-isi.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index 3e8d412..9c4cadc 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -112,16 +112,16 @@ static int configure_geometry(struct atmel_isi *isi, u32 
width,
case V4L2_MBUS_FMT_Y8_1X8:
cr = ISI_CFG2_GRAYSCALE;
break;
-   case V4L2_MBUS_FMT_UYVY8_2X8:
+   case V4L2_MBUS_FMT_VYUY8_2X8:
cr = ISI_CFG2_YCC_SWAP_MODE_3;
break;
-   case V4L2_MBUS_FMT_VYUY8_2X8:
+   case V4L2_MBUS_FMT_UYVY8_2X8:
cr = ISI_CFG2_YCC_SWAP_MODE_2;
break;
-   case V4L2_MBUS_FMT_YUYV8_2X8:
+   case V4L2_MBUS_FMT_YVYU8_2X8:
cr = ISI_CFG2_YCC_SWAP_MODE_1;
break;
-   case V4L2_MBUS_FMT_YVYU8_2X8:
+   case V4L2_MBUS_FMT_YUYV8_2X8:
cr = ISI_CFG2_YCC_SWAP_DEFAULT;
break;
/* RGB, TODO */
-- 
1.8.3.2

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


[PATCH v2 5/7] v4l: atmel-isi: Make the MCK clock optional

2013-12-11 Thread Laurent Pinchart
ISI_MCK is the sensor master clock. It should be handled by the sensor
driver directly, as the ISI has no use for that clock. Make the clock
optional here while platforms transition to the correct model.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Acked-by: Josh Wu josh...@atmel.com
---
 drivers/media/platform/soc_camera/atmel-isi.c | 36 ---
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index ae2c8c1..3e8d412 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -725,10 +725,12 @@ static int isi_camera_clock_start(struct soc_camera_host 
*ici)
if (ret)
return ret;
 
-   ret = clk_prepare_enable(isi-mck);
-   if (ret) {
-   clk_disable_unprepare(isi-pclk);
-   return ret;
+   if (!IS_ERR(isi-mck)) {
+   ret = clk_prepare_enable(isi-mck);
+   if (ret) {
+   clk_disable_unprepare(isi-pclk);
+   return ret;
+   }
}
 
return 0;
@@ -739,7 +741,8 @@ static void isi_camera_clock_stop(struct soc_camera_host 
*ici)
 {
struct atmel_isi *isi = ici-priv;
 
-   clk_disable_unprepare(isi-mck);
+   if (!IS_ERR(isi-mck))
+   clk_disable_unprepare(isi-mck);
clk_disable_unprepare(isi-pclk);
 }
 
@@ -883,7 +886,7 @@ static int atmel_isi_probe(struct platform_device *pdev)
struct isi_platform_data *pdata;
 
pdata = dev-platform_data;
-   if (!pdata || !pdata-data_width_flags || !pdata-mck_hz) {
+   if (!pdata || !pdata-data_width_flags) {
dev_err(pdev-dev,
No config available for Atmel ISI\n);
return -EINVAL;
@@ -905,18 +908,21 @@ static int atmel_isi_probe(struct platform_device *pdev)
INIT_LIST_HEAD(isi-video_buffer_list);
INIT_LIST_HEAD(isi-dma_desc_head);
 
-   /* Get ISI_MCK, provided by programmable clock or external clock */
+   /* ISI_MCK is the sensor master clock. It should be handled by the
+* sensor driver directly, as the ISI has no use for that clock. Make
+* the clock optional here while platforms transition to the correct
+* model.
+*/
isi-mck = devm_clk_get(dev, isi_mck);
-   if (IS_ERR(isi-mck)) {
-   dev_err(dev, Failed to get isi_mck\n);
-   return PTR_ERR(isi-mck);
+   if (!IS_ERR(isi-mck)) {
+   /* Set ISI_MCK's frequency, it should be faster than pixel
+* clock.
+*/
+   ret = clk_set_rate(isi-mck, pdata-mck_hz);
+   if (ret  0)
+   return ret;
}
 
-   /* Set ISI_MCK's frequency, it should be faster than pixel clock */
-   ret = clk_set_rate(isi-mck, pdata-mck_hz);
-   if (ret  0)
-   return ret;
-
isi-p_fb_descriptors = dma_alloc_coherent(pdev-dev,
sizeof(struct fbd) * MAX_BUFFER_NUM,
isi-fb_descriptors_phys,
-- 
1.8.3.2

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


[PATCH v2 3/7] v4l: atmel-isi: Defer clock (un)preparation to enable/disable time

2013-12-11 Thread Laurent Pinchart
The PCLK and MCK clocks are prepared and unprepared at probe and remove
time. Clock (un)preparation isn't needed before enabling/disabling the
clocks, and the enable/disable operation happen in non-atomic context.
We can thus defer (un)preparation to enable/disable time.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Acked-by: Josh Wu josh...@atmel.com
---
 drivers/media/platform/soc_camera/atmel-isi.c | 35 ++-
 1 file changed, 8 insertions(+), 27 deletions(-)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index faa7f8d..ea8816c 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -721,13 +721,13 @@ static int isi_camera_clock_start(struct soc_camera_host 
*ici)
struct atmel_isi *isi = ici-priv;
int ret;
 
-   ret = clk_enable(isi-pclk);
+   ret = clk_prepare_enable(isi-pclk);
if (ret)
return ret;
 
-   ret = clk_enable(isi-mck);
+   ret = clk_prepare_enable(isi-mck);
if (ret) {
-   clk_disable(isi-pclk);
+   clk_disable_unprepare(isi-pclk);
return ret;
}
 
@@ -739,8 +739,8 @@ static void isi_camera_clock_stop(struct soc_camera_host 
*ici)
 {
struct atmel_isi *isi = ici-priv;
 
-   clk_disable(isi-mck);
-   clk_disable(isi-pclk);
+   clk_disable_unprepare(isi-mck);
+   clk_disable_unprepare(isi-pclk);
 }
 
 static unsigned int isi_camera_poll(struct file *file, poll_table *pt)
@@ -869,9 +869,6 @@ static int atmel_isi_remove(struct platform_device *pdev)
isi-p_fb_descriptors,
isi-fb_descriptors_phys);
 
-   clk_unprepare(isi-mck);
-   clk_unprepare(isi-pclk);
-
return 0;
 }
 
@@ -902,10 +899,6 @@ static int atmel_isi_probe(struct platform_device *pdev)
if (IS_ERR(isi-pclk))
return PTR_ERR(isi-pclk);
 
-   ret = clk_prepare(isi-pclk);
-   if (ret)
-   return ret;
-
isi-pdata = pdata;
isi-active = NULL;
spin_lock_init(isi-lock);
@@ -916,27 +909,21 @@ static int atmel_isi_probe(struct platform_device *pdev)
isi-mck = devm_clk_get(dev, isi_mck);
if (IS_ERR(isi-mck)) {
dev_err(dev, Failed to get isi_mck\n);
-   ret = PTR_ERR(isi-mck);
-   goto err_clk_get_mck;
+   return PTR_ERR(isi-mck);
}
 
-   ret = clk_prepare(isi-mck);
-   if (ret)
-   goto err_clk_prepare_mck;
-
/* Set ISI_MCK's frequency, it should be faster than pixel clock */
ret = clk_set_rate(isi-mck, pdata-mck_hz);
if (ret  0)
-   goto err_set_mck_rate;
+   return ret;
 
isi-p_fb_descriptors = dma_alloc_coherent(pdev-dev,
sizeof(struct fbd) * MAX_BUFFER_NUM,
isi-fb_descriptors_phys,
GFP_KERNEL);
if (!isi-p_fb_descriptors) {
-   ret = -ENOMEM;
dev_err(pdev-dev, Can't allocate descriptors!\n);
-   goto err_alloc_descriptors;
+   return -ENOMEM;
}
 
for (i = 0; i  MAX_BUFFER_NUM; i++) {
@@ -1002,12 +989,6 @@ err_alloc_ctx:
sizeof(struct fbd) * MAX_BUFFER_NUM,
isi-p_fb_descriptors,
isi-fb_descriptors_phys);
-err_alloc_descriptors:
-err_set_mck_rate:
-   clk_unprepare(isi-mck);
-err_clk_prepare_mck:
-err_clk_get_mck:
-   clk_unprepare(isi-pclk);
 
return ret;
 }
-- 
1.8.3.2

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


[PATCH v2 7/7] v4l: atmel-isi: Should clear bits before set the hardware register

2013-12-11 Thread Laurent Pinchart
From: Josh Wu josh...@atmel.com

In the ISI driver it reads the config register to get original value,
then set the correct FRATE_DIV and YCC_SWAP_MODE directly. This will
cause some bits overlap.

So we need to clear these bits first, then set correct value. This patch
fix it.

Signed-off-by: Josh Wu josh...@atmel.com
Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/platform/soc_camera/atmel-isi.c | 3 +++
 include/media/atmel-isi.h | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index 9c4cadc..4835173 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -132,6 +132,8 @@ static int configure_geometry(struct atmel_isi *isi, u32 
width,
isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
 
cfg2 = isi_readl(isi, ISI_CFG2);
+   /* Set YCC swap mode */
+   cfg2 = ~ISI_CFG2_YCC_SWAP_MODE_MASK;
cfg2 |= cr;
/* Set width */
cfg2 = ~(ISI_CFG2_IM_HSIZE_MASK);
@@ -346,6 +348,7 @@ static void start_dma(struct atmel_isi *isi, struct 
frame_buffer *buffer)
isi_writel(isi, ISI_DMA_C_CTRL, ISI_DMA_CTRL_FETCH | ISI_DMA_CTRL_DONE);
isi_writel(isi, ISI_DMA_CHER, ISI_DMA_CHSR_C_CH);
 
+   cfg1 = ~ISI_CFG1_FRATE_DIV_MASK;
/* Enable linked list */
cfg1 |= isi-pdata-frate | ISI_CFG1_DISCR;
 
diff --git a/include/media/atmel-isi.h b/include/media/atmel-isi.h
index 6568230..2b02347 100644
--- a/include/media/atmel-isi.h
+++ b/include/media/atmel-isi.h
@@ -56,6 +56,7 @@
 #defineISI_CFG1_FRATE_DIV_6(5  8)
 #defineISI_CFG1_FRATE_DIV_7(6  8)
 #defineISI_CFG1_FRATE_DIV_8(7  8)
+#defineISI_CFG1_FRATE_DIV_MASK (7  8)
 #define ISI_CFG1_DISCR (1  11)
 #define ISI_CFG1_FULL_MODE (1  12)
 
@@ -66,6 +67,7 @@
 #defineISI_CFG2_YCC_SWAP_MODE_1(1  28)
 #defineISI_CFG2_YCC_SWAP_MODE_2(2  28)
 #defineISI_CFG2_YCC_SWAP_MODE_3(3  28)
+#defineISI_CFG2_YCC_SWAP_MODE_MASK (3  28)
 #define ISI_CFG2_IM_VSIZE_OFFSET   0
 #define ISI_CFG2_IM_HSIZE_OFFSET   16
 #define ISI_CFG2_IM_VSIZE_MASK (0x7FF  ISI_CFG2_IM_VSIZE_OFFSET)
-- 
1.8.3.2

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


[PATCH v2 2/7] v4l: atmel-isi: Use devm_* managed allocators

2013-12-11 Thread Laurent Pinchart
This simplifies error and cleanup code paths.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Acked-by: Josh Wu josh...@atmel.com
---
 drivers/media/platform/soc_camera/atmel-isi.c | 56 +--
 1 file changed, 19 insertions(+), 37 deletions(-)

diff --git a/drivers/media/platform/soc_camera/atmel-isi.c 
b/drivers/media/platform/soc_camera/atmel-isi.c
index b46c0ed..faa7f8d 100644
--- a/drivers/media/platform/soc_camera/atmel-isi.c
+++ b/drivers/media/platform/soc_camera/atmel-isi.c
@@ -862,7 +862,6 @@ static int atmel_isi_remove(struct platform_device *pdev)
struct atmel_isi *isi = container_of(soc_host,
struct atmel_isi, soc_host);
 
-   free_irq(isi-irq, isi);
soc_camera_host_unregister(soc_host);
vb2_dma_contig_cleanup_ctx(isi-alloc_ctx);
dma_free_coherent(pdev-dev,
@@ -870,12 +869,8 @@ static int atmel_isi_remove(struct platform_device *pdev)
isi-p_fb_descriptors,
isi-fb_descriptors_phys);
 
-   iounmap(isi-regs);
clk_unprepare(isi-mck);
-   clk_put(isi-mck);
clk_unprepare(isi-pclk);
-   clk_put(isi-pclk);
-   kfree(isi);
 
return 0;
 }
@@ -884,7 +879,6 @@ static int atmel_isi_probe(struct platform_device *pdev)
 {
unsigned int irq;
struct atmel_isi *isi;
-   struct clk *pclk;
struct resource *regs;
int ret, i;
struct device *dev = pdev-dev;
@@ -898,26 +892,20 @@ static int atmel_isi_probe(struct platform_device *pdev)
return -EINVAL;
}
 
-   regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!regs)
-   return -ENXIO;
-
-   pclk = clk_get(pdev-dev, isi_clk);
-   if (IS_ERR(pclk))
-   return PTR_ERR(pclk);
-
-   ret = clk_prepare(pclk);
-   if (ret)
-   goto err_clk_prepare_pclk;
-
-   isi = kzalloc(sizeof(struct atmel_isi), GFP_KERNEL);
+   isi = devm_kzalloc(pdev-dev, sizeof(struct atmel_isi), GFP_KERNEL);
if (!isi) {
-   ret = -ENOMEM;
dev_err(pdev-dev, Can't allocate interface!\n);
-   goto err_alloc_isi;
+   return -ENOMEM;
}
 
-   isi-pclk = pclk;
+   isi-pclk = devm_clk_get(pdev-dev, isi_clk);
+   if (IS_ERR(isi-pclk))
+   return PTR_ERR(isi-pclk);
+
+   ret = clk_prepare(isi-pclk);
+   if (ret)
+   return ret;
+
isi-pdata = pdata;
isi-active = NULL;
spin_lock_init(isi-lock);
@@ -925,11 +913,11 @@ static int atmel_isi_probe(struct platform_device *pdev)
INIT_LIST_HEAD(isi-dma_desc_head);
 
/* Get ISI_MCK, provided by programmable clock or external clock */
-   isi-mck = clk_get(dev, isi_mck);
+   isi-mck = devm_clk_get(dev, isi_mck);
if (IS_ERR(isi-mck)) {
dev_err(dev, Failed to get isi_mck\n);
ret = PTR_ERR(isi-mck);
-   goto err_clk_get;
+   goto err_clk_get_mck;
}
 
ret = clk_prepare(isi-mck);
@@ -964,9 +952,10 @@ static int atmel_isi_probe(struct platform_device *pdev)
goto err_alloc_ctx;
}
 
-   isi-regs = ioremap(regs-start, resource_size(regs));
-   if (!isi-regs) {
-   ret = -ENOMEM;
+   regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   isi-regs = devm_ioremap_resource(pdev-dev, regs);
+   if (IS_ERR(isi-regs)) {
+   ret = PTR_ERR(isi-regs);
goto err_ioremap;
}
 
@@ -983,7 +972,7 @@ static int atmel_isi_probe(struct platform_device *pdev)
goto err_req_irq;
}
 
-   ret = request_irq(irq, isi_interrupt, 0, isi, isi);
+   ret = devm_request_irq(pdev-dev, irq, isi_interrupt, 0, isi, isi);
if (ret) {
dev_err(pdev-dev, Unable to request irq %d\n, irq);
goto err_req_irq;
@@ -1005,9 +994,7 @@ static int atmel_isi_probe(struct platform_device *pdev)
return 0;
 
 err_register_soc_camera_host:
-   free_irq(isi-irq, isi);
 err_req_irq:
-   iounmap(isi-regs);
 err_ioremap:
vb2_dma_contig_cleanup_ctx(isi-alloc_ctx);
 err_alloc_ctx:
@@ -1019,13 +1006,8 @@ err_alloc_descriptors:
 err_set_mck_rate:
clk_unprepare(isi-mck);
 err_clk_prepare_mck:
-   clk_put(isi-mck);
-err_clk_get:
-   kfree(isi);
-err_alloc_isi:
-   clk_unprepare(pclk);
-err_clk_prepare_pclk:
-   clk_put(pclk);
+err_clk_get_mck:
+   clk_unprepare(isi-pclk);
 
return ret;
 }
-- 
1.8.3.2

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


Re: [PATCH v3] staging: media: davinci_vpfe: Rewrite return statement in vpfe_video.c

2013-12-11 Thread Prabhakar Lad
Hi Lisa,

Thanks for the patch.

On Wed, Dec 11, 2013 at 11:39 AM, Lisa Nguyen l...@xenapiadmin.com wrote:
 Rewrite the return statement in vpfe_video.c. This will prevent
 the checkpatch.pl script from generating a warning saying
 to remove () from this particular return statement.

 Signed-off-by: Lisa Nguyen l...@xenapiadmin.com

Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com

Will be queueing it for 3.14.

Regrads,
--Prabhakar Lad

 ---
 Changes since v3:
 - Removed () from return statement per Laurent Pinchart's suggestion

  drivers/staging/media/davinci_vpfe/vpfe_video.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c 
 b/drivers/staging/media/davinci_vpfe/vpfe_video.c
 index 24d98a6..3b036be 100644
 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
 +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
 @@ -346,7 +346,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline 
 *pipe)
 }
 mutex_unlock(mdev-graph_mutex);

 -   return (ret == 0) ? ret : -ETIMEDOUT ;
 +   return ret ? -ETIMEDOUT : 0;
  }

  /*
 --
 1.7.9.5

--
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 PULL FOR v3.14] DaVinci VPFE trivial fixes

2013-12-11 Thread Prabhakar Lad
Hi Mauro,

Please pull the following patches for davinci vpfe driver.

Regards,
--Prabhakar Lad


The following changes since commit 989af88339db26345e23271dae1089d949c4a0f1:

  [media] v4l: vsp1: Add LUT support (2013-12-11 09:25:20 -0200)

are available in the git repository at:

  http://linuxtv.org/git/mhadli/v4l-dvb-davinci_devices.git for_mauro

for you to fetch changes up to 189ac0f9249a6d4856531ecc60b65f77f50210a0:

  staging: media: davinci_vpfe: Rewrite return statement in
vpfe_video.c (2013-12-11 22:32:12 +0530)


Lisa Nguyen (2):
  staging: media: davinci_vpfe: Remove spaces before semicolons
  staging: media: davinci_vpfe: Rewrite return statement in vpfe_video.c

 drivers/staging/media/davinci_vpfe/dm365_ipipe.c   |2 +-
 .../staging/media/davinci_vpfe/dm365_ipipe_hw.c|4 ++--
 drivers/staging/media/davinci_vpfe/dm365_isif.c|2 +-
 drivers/staging/media/davinci_vpfe/vpfe_video.c|2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
--
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 mceusb: fix invalid urb interval

2013-12-11 Thread Martin Kittel
Hi Mauro, hi Sean,

thanks for considering the patch. I have added an updated version at the
end of this mail.

Regarding the info Sean was requesting, it is indeed an xhci hub. I also
added the details of the remote itself.

Please let me know if there is anything missing.

Best wishes,

Martin.


lsusb -vvv
--
Bus 001 Device 002: ID 2304:0225 Pinnacle Systems, Inc. Remote Kit
Infrared Transceiver
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize0 8
  idVendor   0x2304 Pinnacle Systems, Inc.
  idProduct  0x0225 Remote Kit Infrared Transceiver
  bcdDevice0.01
  iManufacturer   1 Pinnacle Systems
  iProduct2 PCTV Remote USB
  iSerial 5 7FFF
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   32
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  3 StandardConfiguration
bmAttributes 0xa0
  (Bus Powered)
  Remote Wakeup
MaxPower  100mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   2
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass  0
  bInterfaceProtocol  0
  iInterface  4 StandardInterface
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81  EP 1 IN
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval  10
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02  EP 2 OUT
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval  10
Device Status: 0x
  (Bus Powered)

---

From 67589c156e4b205821dda67f7e96804224c24cb8 Mon Sep 17 00:00:00 2001
From: Martin Kittel li...@martin-kittel.de
Date: Wed, 11 Dec 2013 21:08:49 +0100
Subject: [PATCH] mceusb: fix invalid urb interval

With very fast usb hubs it can happen that urbs are processed
in less than a single 126 microsecond interval. Such an urb has
urb-interval set to 0 on receive and s rejected on resubmit.
Make sure urb-interval is reset to its initial value before
resubmitting it.

Signed-off-by: Martin Kittel li...@martin-kittel.de
---
 drivers/media/rc/mceusb.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 3c76101..6652f6a 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -1030,7 +1030,7 @@ static void mceusb_process_ir_data(struct
mceusb_dev *ir, int buf_len)
 static void mceusb_dev_recv(struct urb *urb)
 {
struct mceusb_dev *ir;
-   int buf_len;
+   int buf_len, res;

if (!urb)
return;
@@ -1067,7 +1067,10 @@ static void mceusb_dev_recv(struct urb *urb)
break;
}

-   usb_submit_urb(urb, GFP_ATOMIC);
+   urb-interval = ir-usb_ep_out-bInterval; /* reset urb interval */
+   res = usb_submit_urb(urb, GFP_ATOMIC);
+   if (res)
+   mce_dbg(ir-dev, restart request FAILED! (res=%d)\n, res);
 }

 static void mceusb_get_emulator_version(struct mceusb_dev *ir)
-- 
1.8.4.rc3



--
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 RFC 4/4] v4l: 1 Hz resolution flag for tuners

2013-12-11 Thread Antti Palosaari
Add V4L2_TUNER_CAP_1HZ for 1 Hz resolution.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 include/uapi/linux/videodev2.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 6c6a601..1bac6c4 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -1349,6 +1349,7 @@ struct v4l2_modulator {
 #define V4L2_TUNER_CAP_RDS_CONTROLS0x0200
 #define V4L2_TUNER_CAP_FREQ_BANDS  0x0400
 #define V4L2_TUNER_CAP_HWSEEK_PROG_LIM 0x0800
+#define V4L2_TUNER_CAP_1HZ 0x1000
 
 /*  Flags for the 'rxsubchans' field */
 #define V4L2_TUNER_SUB_MONO0x0001
-- 
1.8.4.2

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


[PATCH RFC 0/4] SDR API set ADC and RF frequency

2013-12-11 Thread Antti Palosaari
Here is small example what it looks like when v4l2-ctl is used.

[crope@localhost v4l2-ctl]$ 
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --all
Driver Info (not using libv4l2):
Driver name   : rtl2832_sdr
Card type : Realtek RTL2832U SDR
Bus info  : usb-:00:13.2-2
Driver version: 3.13.0
Capabilities  : 0x85010001
Video Capture
Tuner
Read/Write
Streaming
Device Capabilities
Device Caps   : 0x05010001
Video Capture
Tuner
Read/Write
Streaming
Priority: 2
Frequency for tuner 0: 0 (0.00 MHz)
Tuner 0:
Name : ADC
Capabilities : 1 Hz freq-bands 
Frequency range  : 0.30 MHz - 3.20 MHz
Video input : 0 (SDR data: ok)

User Controls
 tuner_gain (int): min=0 max=102 step=1 default=0 
value=0
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=1 --all
Driver Info (not using libv4l2):
Driver name   : rtl2832_sdr
Card type : Realtek RTL2832U SDR
Bus info  : usb-:00:13.2-2
Driver version: 3.13.0
Capabilities  : 0x85010001
Video Capture
Tuner
Read/Write
Streaming
Device Capabilities
Device Caps   : 0x05010001
Video Capture
Tuner
Read/Write
Streaming
Priority: 2
Frequency for tuner 1: 0 (0.00 MHz)
Tuner 1:
Name : RF
Capabilities : 62.5 Hz freq-bands 
Frequency range  : 50.000 MHz - 1500.000 MHz
Video input : 0 (SDR data: ok)

User Controls
 tuner_gain (int): min=0 max=102 step=1 default=0 
value=0
(reverse-i-search)`en': gedit drivers/media/radio/radio-ke^Ce.c
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=0 
--list-freq-bands
ioctl: VIDIOC_ENUM_FREQ_BANDS
Index  : 0
Modulation : Unknown
Capability : 1 Hz freq-bands 
Frequency Range: 0.30 MHz - 0.30 MHz

Index  : 1
Modulation : Unknown
Capability : 1 Hz freq-bands 
Frequency Range: 0.91 MHz - 2.80 MHz

Index  : 2
Modulation : Unknown
Capability : 1 Hz freq-bands 
Frequency Range: 3.20 MHz - 3.20 MHz
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=1 
--list-freq-bands
ioctl: VIDIOC_ENUM_FREQ_BANDS
Index  : 0
Modulation : Unknown
Capability : 62.5 Hz freq-bands 
Frequency Range: 50.000 MHz - 1500.000 MHz
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=0 
--set-freq=0.30
Frequency for tuner 0 set to 30 (0.30 MHz)
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=0 --get-freq
Frequency for tuner 0: 30 (0.30 MHz)
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=1 
--set-freq=100
Frequency for tuner 1 set to 160 (100.00 MHz)
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=1 --get-freq
Frequency for tuner 1: 160 (100.00 MHz)
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=1 --all
Driver Info (not using libv4l2):
Driver name   : rtl2832_sdr
Card type : Realtek RTL2832U SDR
Bus info  : usb-:00:13.2-2
Driver version: 3.13.0
Capabilities  : 0x85010001
Video Capture
Tuner
Read/Write
Streaming
Device Capabilities
Device Caps   : 0x05010001
Video Capture
Tuner
Read/Write
Streaming
Priority: 2
Frequency for tuner 1: 160 (100.00 MHz)
Tuner 1:
Name : RF
Capabilities : 62.5 Hz freq-bands 
Frequency range  : 50.000 MHz - 1500.000 MHz
Video input : 0 (SDR data: ok)

User Controls
 tuner_gain (int): min=0 max=102 step=1 default=0 
value=0
[crope@localhost v4l2-ctl]$ ./v4l2-ctl -d /dev/sdr0 --tuner-index=0 --all
Driver Info (not using libv4l2):
Driver name   : rtl2832_sdr
Card type : Realtek RTL2832U SDR
Bus info  : usb-:00:13.2-2
Driver version: 3.13.0
Capabilities  : 0x85010001
Video Capture
Tuner
Read/Write
Streaming
Device Capabilities
Device Caps   : 0x05010001
Video Capture
Tuner
Read/Write
Streaming
Priority: 2
Frequency for tuner 0: 30 (0.30 MHz)
Tuner 0:
Name : ADC
Capabilities : 1 Hz freq-bands 
  

[PATCH RFC 1/4] v4l2-core: don't clear VIDIOC_G_FREQUENCY tuner type

2013-12-11 Thread Antti Palosaari
No need to clear as it will be overridden in every case when
v4l_g_frequency() is called. We will need that value later when
new tuner types are defined.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/v4l2-core/v4l2-ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index 68e6b5e..bc10684 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -2013,7 +2013,7 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
IOCTL_INFO_STD(VIDIOC_S_AUDOUT, vidioc_s_audout, v4l_print_audioout, 
INFO_FL_PRIO),
IOCTL_INFO_FNC(VIDIOC_G_MODULATOR, v4l_g_modulator, 
v4l_print_modulator, INFO_FL_CLEAR(v4l2_modulator, index)),
IOCTL_INFO_STD(VIDIOC_S_MODULATOR, vidioc_s_modulator, 
v4l_print_modulator, INFO_FL_PRIO),
-   IOCTL_INFO_FNC(VIDIOC_G_FREQUENCY, v4l_g_frequency, 
v4l_print_frequency, INFO_FL_CLEAR(v4l2_frequency, tuner)),
+   IOCTL_INFO_FNC(VIDIOC_G_FREQUENCY, v4l_g_frequency, 
v4l_print_frequency, INFO_FL_CLEAR(v4l2_frequency, type)),
IOCTL_INFO_FNC(VIDIOC_S_FREQUENCY, v4l_s_frequency, 
v4l_print_frequency, INFO_FL_PRIO),
IOCTL_INFO_FNC(VIDIOC_CROPCAP, v4l_cropcap, v4l_print_cropcap, 
INFO_FL_CLEAR(v4l2_cropcap, type)),
IOCTL_INFO_FNC(VIDIOC_G_CROP, v4l_g_crop, v4l_print_crop, 
INFO_FL_CLEAR(v4l2_crop, type)),
-- 
1.8.4.2

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


[PATCH RFC 3/4] v4l: add new tuner types for SDR

2013-12-11 Thread Antti Palosaari
Define tuner types V4L2_TUNER_ADC and V4L2_TUNER_SDR for SDR usage.

ADC is used for setting sampling rate (sampling frequency) to SDR
device.

Another tuner type, SDR, is possible RF tuner. Is is used to
down-convert RF frequency to range ADC could sample. It is optional
for SDR device.

Also add checks to VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY and
VIDIOC_ENUM_FREQ_BANDS only allow these two tuner types when device
type is SDR (VFL_TYPE_SDR).

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/v4l2-core/v4l2-ioctl.c | 38 +---
 include/uapi/linux/videodev2.h   |  2 ++
 2 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index bc10684..ee91a9f 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1288,8 +1288,13 @@ static int v4l_g_frequency(const struct v4l2_ioctl_ops 
*ops,
struct video_device *vfd = video_devdata(file);
struct v4l2_frequency *p = arg;
 
-   p-type = (vfd-vfl_type == VFL_TYPE_RADIO) ?
-   V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
+   if (vfd-vfl_type == VFL_TYPE_SDR) {
+   if (p-type != V4L2_TUNER_ADC  p-type != V4L2_TUNER_SDR)
+   return -EINVAL;
+   } else {
+   p-type = (vfd-vfl_type == VFL_TYPE_RADIO) ?
+   V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
+   }
return ops-vidioc_g_frequency(file, fh, p);
 }
 
@@ -1300,10 +1305,16 @@ static int v4l_s_frequency(const struct v4l2_ioctl_ops 
*ops,
const struct v4l2_frequency *p = arg;
enum v4l2_tuner_type type;
 
-   type = (vfd-vfl_type == VFL_TYPE_RADIO) ?
-   V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
-   if (p-type != type)
-   return -EINVAL;
+   if (vfd-vfl_type == VFL_TYPE_SDR) {
+   if (p-type != V4L2_TUNER_ADC  p-type != V4L2_TUNER_SDR)
+   return -EINVAL;
+   type = p-type;
+   } else {
+   type = (vfd-vfl_type == VFL_TYPE_RADIO) ?
+   V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
+   if (type != p-type)
+   return -EINVAL;
+   }
return ops-vidioc_s_frequency(file, fh, p);
 }
 
@@ -1882,11 +1893,16 @@ static int v4l_enum_freq_bands(const struct 
v4l2_ioctl_ops *ops,
enum v4l2_tuner_type type;
int err;
 
-   type = (vfd-vfl_type == VFL_TYPE_RADIO) ?
-   V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
-
-   if (type != p-type)
-   return -EINVAL;
+   if (vfd-vfl_type == VFL_TYPE_SDR) {
+   if (p-type != V4L2_TUNER_ADC  p-type != V4L2_TUNER_SDR)
+   return -EINVAL;
+   type = p-type;
+   } else {
+   type = (vfd-vfl_type == VFL_TYPE_RADIO) ?
+   V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
+   if (type != p-type)
+   return -EINVAL;
+   }
if (ops-vidioc_enum_freq_bands)
return ops-vidioc_enum_freq_bands(file, fh, p);
if (is_valid_ioctl(vfd, VIDIOC_G_TUNER)) {
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index b8ee9048..6c6a601 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -159,6 +159,8 @@ enum v4l2_tuner_type {
V4L2_TUNER_RADIO = 1,
V4L2_TUNER_ANALOG_TV = 2,
V4L2_TUNER_DIGITAL_TV= 3,
+   V4L2_TUNER_ADC   = 4,
+   V4L2_TUNER_SDR   = 5,
 };
 
 enum v4l2_memory {
-- 
1.8.4.2

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


Re: pctv 290e fails with kernel 3.12.3

2013-12-11 Thread Antti Palosaari

Hello

On 11.12.2013 16:41, Robin Becker wrote:

Apologies if this is the wrong place to report this. I am running arch
linux on a 64 bit machine. Currently I am stuck on

Linux bunyip 3.12.2-1-ARCH #1 SMP PREEMPT Fri Nov 29 21:14:15 CET 2013
x86_64 GNU/Linux

If I upgrade to the next kernel in line linux-3.12.3-1-x86_64.pkg.tar.xz
I see failures during boot and my two usb tv devices fail.


That is yet another device which broke due to latest dynamic stack alloc 
removal patches, which gone to stable almost zero testing...


I suspect that patch could fix the issue:
https://linuxtv.org/patch/20317/

Could you test?

regards
Antti








 From lsusb -v


Bus 002 Device 005: ID 2013:024f PCTV Systems nanoStick T2 290e
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  idVendor   0x2013 PCTV Systems
  idProduct  0x024f nanoStick T2 290e
  bcdDevice1.00
  iManufacturer   1 PCTV Systems
  iProduct2 PCTV 290e
  iSerial 3 0010V0M9
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   55
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0
bmAttributes 0x80
  (Bus Powered)
MaxPower  500mA
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   2
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass  0
  bInterfaceProtocol  0
  iInterface  0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84  EP 4 IN
bmAttributes1
  Transfer TypeIsochronous
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x  1x 0 bytes
bInterval   1
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x85  EP 5 IN
bmAttributes1
  Transfer TypeIsochronous
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x  1x 0 bytes
bInterval   1
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   1
  bNumEndpoints   2
  bInterfaceClass   255 Vendor Specific Class
  bInterfaceSubClass  0
  bInterfaceProtocol  0
  iInterface  0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84  EP 4 IN
bmAttributes1
  Transfer TypeIsochronous
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x03ac  1x 940 bytes
bInterval   1
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
   bEndpointAddress 0x85  EP 5 IN
bmAttributes1
  Transfer TypeIsochronous
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x03ac  1x 940 bytes
bInterval   1
Device Qualifier (for other device speed):
  bLength10
  bDescriptorType 6
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  bNumConfigurations  1
Device Status: 0x
  (Bus Powered)

Bus 002 Device 004: ID 2013:024f PCTV Systems nanoStick T2 290e
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass0 (Defined at Interface level)
  bDeviceSubClass 0
  bDeviceProtocol 0
  bMaxPacketSize064
  idVendor   0x2013 PCTV Systems
  idProduct  0x024f nanoStick T2 290e
  bcdDevice1.00
  iManufacturer   1 PCTV Systems
  iProduct2 PCTV 290e
  iSerial 3 00101286
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   55
bNumInterfaces  1
bConfigurationValue 1
iConfiguration  0
bmAttributes 0x80
  (Bus Powered)
MaxPower  500mA
Interface Descriptor:
  bLength 9
  bDescriptorType   

Re: [PATCH 0/4] Bugfixes for UVC gadget test application

2013-12-11 Thread Laurent Pinchart
Hi Robert,

On Tuesday 10 December 2013 12:40:33 Robert Baldyga wrote:
 Hello,
 
 This patchset fixes UVC gadget test application, created by Laurent Pinchart
 (git tree available here: git://git.ideasonboard.org/uvc-gadget.git), with
 applied patches created by Bhupesh Sharma (which can be found here:
 http://www.spinics.net/lists/linux-usb/msg84376.html).
 
 It improves video-capture device handling, and adds few other fixes.
 More details can be found in commit messages.

Thank you for the patches. This is a nice reminder that I still haven't 
reviewed Bhupesh's patches. I've tried to get back to them, but the size of 
the first patch makes it too complex to review for the limited time I have 
now. Unless the UVC gadget: Add support for integration with a video-capture 
device and other fixes patch gets split in smaller chunks I won't have time 
to handle it before February at the earliest.

 Best regards
 Robert Baldyga
 Samsung RD Institute Poland
 
 Robert Baldyga (4):
   closing uvc file when init fails
   remove set_format from uvc_events_process_data
   fix v4l2 stream handling
   remove flooding debugs
 
  uvc-gadget.c |   68  +-
  1 file changed, 10 insertions(+), 58 deletions(-)

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH 0/4] Bugfixes for UVC gadget test application

2013-12-11 Thread Laurent Pinchart
Hi Robert,

[Repost with Bhupesh's hopefully correct e-mail address]

On Tuesday 10 December 2013 12:40:33 Robert Baldyga wrote:
 Hello,
 
 This patchset fixes UVC gadget test application, created by Laurent Pinchart
 (git tree available here: git://git.ideasonboard.org/uvc-gadget.git), with
 applied patches created by Bhupesh Sharma (which can be found here:
 http://www.spinics.net/lists/linux-usb/msg84376.html).
 
 It improves video-capture device handling, and adds few other fixes.
 More details can be found in commit messages.

Thank you for the patches. This is a nice reminder that I still haven't 
reviewed Bhupesh's patches. I've tried to get back to them, but the size of 
the first patch makes it too complex to review for the limited time I have 
now. Unless the UVC gadget: Add support for integration with a video-capture 
device and other fixes patch gets split in smaller chunks I won't have time 
to handle it before February at the earliest.

 Best regards
 Robert Baldyga
 Samsung RD Institute Poland
 
 Robert Baldyga (4):
   closing uvc file when init fails
   remove set_format from uvc_events_process_data
   fix v4l2 stream handling
   remove flooding debugs
 
  uvc-gadget.c |   68  +-
  1 file changed, 10 insertions(+), 58 deletions(-)

-- 
Regards,

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


v4l2 dmabuf test on Ubuntu 13.10 with logitech c210 camera

2013-12-11 Thread Zhao, Halley
Hi experts:
With Laurent Pinchart's test case: 
http://www.mail-archive.com/linux-media@vger.kernel.org/msg54806.html
I update it to work on my PC (haswell) with Ubuntu 13.10 + c210 camera:
https://gitorious.org/halley-test/v4l2-dmabuf-test

the loop keeps running, however, video scene almost doesn't update.
Anyone know the reason, does Ubuntu13.10 (3.11 linux kernel) includes all the 
necessary parts for dmabuf support in uvc camera?

Thanks.

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


cron job: media_tree daily build: ERRORS

2013-12-11 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Thu Dec 12 04:00:31 CET 2013
git branch: test
git hash:   989af88339db26345e23271dae1089d949c4a0f1
gcc version:i686-linux-gcc (GCC) 4.8.1
sparse version: 0.4.5-rc1
host hardware:  x86_64
host os:3.12-0.slh.2-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: WARNINGS
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: WARNINGS
linux-2.6.31.14-i686: ERRORS
linux-2.6.32.27-i686: ERRORS
linux-2.6.33.7-i686: ERRORS
linux-2.6.34.7-i686: ERRORS
linux-2.6.35.9-i686: ERRORS
linux-2.6.36.4-i686: ERRORS
linux-2.6.37.6-i686: ERRORS
linux-2.6.38.8-i686: ERRORS
linux-2.6.39.4-i686: ERRORS
linux-3.0.60-i686: ERRORS
linux-3.1.10-i686: ERRORS
linux-3.2.37-i686: ERRORS
linux-3.3.8-i686: ERRORS
linux-3.4.27-i686: ERRORS
linux-3.5.7-i686: ERRORS
linux-3.6.11-i686: ERRORS
linux-3.7.4-i686: ERRORS
linux-3.8-i686: ERRORS
linux-3.9.2-i686: ERRORS
linux-3.10.1-i686: ERRORS
linux-3.11.1-i686: ERRORS
linux-3.12-i686: ERRORS
linux-3.13-rc1-i686: ERRORS
linux-2.6.31.14-x86_64: ERRORS
linux-2.6.32.27-x86_64: ERRORS
linux-2.6.33.7-x86_64: ERRORS
linux-2.6.34.7-x86_64: ERRORS
linux-2.6.35.9-x86_64: ERRORS
linux-2.6.36.4-x86_64: ERRORS
linux-2.6.37.6-x86_64: ERRORS
linux-2.6.38.8-x86_64: ERRORS
linux-2.6.39.4-x86_64: ERRORS
linux-3.0.60-x86_64: ERRORS
linux-3.1.10-x86_64: ERRORS
linux-3.2.37-x86_64: ERRORS
linux-3.3.8-x86_64: ERRORS
linux-3.4.27-x86_64: ERRORS
linux-3.5.7-x86_64: ERRORS
linux-3.6.11-x86_64: ERRORS
linux-3.7.4-x86_64: ERRORS
linux-3.8-x86_64: ERRORS
linux-3.9.2-x86_64: ERRORS
linux-3.10.1-x86_64: ERRORS
linux-3.11.1-x86_64: ERRORS
linux-3.12-x86_64: ERRORS
linux-3.13-rc1-x86_64: ERRORS
apps: WARNINGS
spec-git: OK
sparse version: 0.4.5-rc1
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

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


[PATCH -next] [media] radio-bcm2048: fix missing unlock on error in bcm2048_rds_fifo_receive()

2013-12-11 Thread Wei Yongjun
From: Wei Yongjun yongjun_...@trendmicro.com.cn

Add the missing unlock before return from function bcm2048_rds_fifo_receive()
in the error handling case.

Signed-off-by: Wei Yongjun yongjun_...@trendmicro.com.cn
---
 drivers/staging/media/bcm2048/radio-bcm2048.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c 
b/drivers/staging/media/bcm2048/radio-bcm2048.c
index 494ec39..37ff899 100644
--- a/drivers/staging/media/bcm2048/radio-bcm2048.c
+++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
@@ -1767,6 +1767,7 @@ static void bcm2048_rds_fifo_receive(struct 
bcm2048_device *bdev)
bdev-rds_info.radio_text, bdev-fifo_size);
if (err != 2) {
dev_err(bdev-client-dev, RDS Read problem\n);
+   mutex_unlock(bdev-mutex);
return;
}
 

--
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 RFC 3/4] v4l: add new tuner types for SDR

2013-12-11 Thread Hans Verkuil
On 12/12/2013 12:54 AM, Antti Palosaari wrote:
 Define tuner types V4L2_TUNER_ADC and V4L2_TUNER_SDR for SDR usage.
 
 ADC is used for setting sampling rate (sampling frequency) to SDR
 device.
 
 Another tuner type, SDR, is possible RF tuner. Is is used to
 down-convert RF frequency to range ADC could sample. It is optional
 for SDR device.
 
 Also add checks to VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY and
 VIDIOC_ENUM_FREQ_BANDS only allow these two tuner types when device
 type is SDR (VFL_TYPE_SDR).

Shouldn't you also adapt s_hw_freq_seek?

 
 Signed-off-by: Antti Palosaari cr...@iki.fi
 ---
  drivers/media/v4l2-core/v4l2-ioctl.c | 38 
 +---
  include/uapi/linux/videodev2.h   |  2 ++
  2 files changed, 29 insertions(+), 11 deletions(-)
 
 diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
 b/drivers/media/v4l2-core/v4l2-ioctl.c
 index bc10684..ee91a9f 100644
 --- a/drivers/media/v4l2-core/v4l2-ioctl.c
 +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
 @@ -1288,8 +1288,13 @@ static int v4l_g_frequency(const struct v4l2_ioctl_ops 
 *ops,
   struct video_device *vfd = video_devdata(file);
   struct v4l2_frequency *p = arg;
  
 - p-type = (vfd-vfl_type == VFL_TYPE_RADIO) ?
 - V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
 + if (vfd-vfl_type == VFL_TYPE_SDR) {
 + if (p-type != V4L2_TUNER_ADC  p-type != V4L2_TUNER_SDR)
 + return -EINVAL;

This isn't right. p-type is returned by the driver, not set by the user.
In the case of TYPE_SDR I would just set it to TUNER_SDR and let the driver
update it for ADC tuners. You can also just leave it alone. This does make
the assumption that SDR and ADC tuners are always separate tuners. I.e., not
like radio and TV tuners that can be one physical tuner with two mutually
exclusive modes. It's my understanding that that is by definition true for
SDR.

 + } else {
 + p-type = (vfd-vfl_type == VFL_TYPE_RADIO) ?
 + V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
 + }
   return ops-vidioc_g_frequency(file, fh, p);
  }
  
 @@ -1300,10 +1305,16 @@ static int v4l_s_frequency(const struct 
 v4l2_ioctl_ops *ops,
   const struct v4l2_frequency *p = arg;
   enum v4l2_tuner_type type;
  
 - type = (vfd-vfl_type == VFL_TYPE_RADIO) ?
 - V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
 - if (p-type != type)
 - return -EINVAL;
 + if (vfd-vfl_type == VFL_TYPE_SDR) {
 + if (p-type != V4L2_TUNER_ADC  p-type != V4L2_TUNER_SDR)
 + return -EINVAL;
 + type = p-type;
 + } else {
 + type = (vfd-vfl_type == VFL_TYPE_RADIO) ?
 + V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
 + if (type != p-type)
 + return -EINVAL;
 + }
   return ops-vidioc_s_frequency(file, fh, p);
  }
  
 @@ -1882,11 +1893,16 @@ static int v4l_enum_freq_bands(const struct 
 v4l2_ioctl_ops *ops,
   enum v4l2_tuner_type type;
   int err;
  
 - type = (vfd-vfl_type == VFL_TYPE_RADIO) ?
 - V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
 -
 - if (type != p-type)
 - return -EINVAL;
 + if (vfd-vfl_type == VFL_TYPE_SDR) {
 + if (p-type != V4L2_TUNER_ADC  p-type != V4L2_TUNER_SDR)
 + return -EINVAL;
 + type = p-type;
 + } else {
 + type = (vfd-vfl_type == VFL_TYPE_RADIO) ?
 + V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
 + if (type != p-type)
 + return -EINVAL;
 + }
   if (ops-vidioc_enum_freq_bands)
   return ops-vidioc_enum_freq_bands(file, fh, p);
   if (is_valid_ioctl(vfd, VIDIOC_G_TUNER)) {
 diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
 index b8ee9048..6c6a601 100644
 --- a/include/uapi/linux/videodev2.h
 +++ b/include/uapi/linux/videodev2.h
 @@ -159,6 +159,8 @@ enum v4l2_tuner_type {
   V4L2_TUNER_RADIO = 1,
   V4L2_TUNER_ANALOG_TV = 2,
   V4L2_TUNER_DIGITAL_TV= 3,
 + V4L2_TUNER_ADC   = 4,
 + V4L2_TUNER_SDR   = 5,
  };
  
  enum v4l2_memory {
 

Regards,

Hans
--
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 RFC 4/4] v4l: 1 Hz resolution flag for tuners

2013-12-11 Thread Hans Verkuil
On 12/12/2013 12:54 AM, Antti Palosaari wrote:
 Add V4L2_TUNER_CAP_1HZ for 1 Hz resolution.
 
 Signed-off-by: Antti Palosaari cr...@iki.fi
 ---
  include/uapi/linux/videodev2.h | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
 index 6c6a601..1bac6c4 100644
 --- a/include/uapi/linux/videodev2.h
 +++ b/include/uapi/linux/videodev2.h
 @@ -1349,6 +1349,7 @@ struct v4l2_modulator {
  #define V4L2_TUNER_CAP_RDS_CONTROLS  0x0200
  #define V4L2_TUNER_CAP_FREQ_BANDS0x0400
  #define V4L2_TUNER_CAP_HWSEEK_PROG_LIM   0x0800
 +#define V4L2_TUNER_CAP_1HZ   0x1000
  
  /*  Flags for the 'rxsubchans' field */
  #define V4L2_TUNER_SUB_MONO  0x0001
 

I was wondering, do the band modulation systems (V4L2_BAND_MODULATION_VSB etc.) 
cover SDR?

Anyway, I'm happy with this patch series. As far as I am concerned, the next 
step would
be to add documention and I would also recommend updating v4l2-compliance. 
Writing docs
and adding compliance tests has proven useful in the past to discover ambiguous 
API specs.

Regards,

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