Re: [Linaro-mm-sig] [PATCH v4 3/4] mutex: Add ww tests to lib/locking-selftest.c. v4

2013-05-29 Thread Daniel Vetter
On Tue, May 28, 2013 at 11:12 PM, Maarten Lankhorst
maarten.lankho...@canonical.com wrote:
 +static void ww_test_spin_nest_unlocked(void)
 +{
 +raw_spin_lock_nest_lock(lock_A, o.base);
 +U(A);
 +}
 I don't quite see the point of this one here ...
 It's a lockdep test that was missing. o.base is not locked. So lock_A is 
 being nested into an unlocked lock, resulting in a lockdep error.

Sounds like a different patch then ...

 +
 +static void ww_test_unneeded_slow(void)
 +{
 +int ret;
 +
 +WWAI(t);
 +
 +ww_mutex_lock_slow(o, t);
 +}
 I think checking the _slow debug stuff would be neat, i.e.
 - fail/success tests for properly unlocking all held locks
 - fail/success tests for lock_slow acquiring the right lock.

 Otherwise I didn't spot anything that seems missing in these self-tests
 here.

 Yes it would be nice, doing so is left as an excercise for the reviewer, who 
 failed to raise this point sooner. ;-)

Hm, I guess I've volunteered myself to look into this a bit ;-)
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
--
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


[REVIEWv2 PATCH 0/3] hdpvr: various fixes

2013-05-29 Thread Hans Verkuil
The first patch fixes a bug in querystd: if there is no signal, then
querystd should return V4L2_STD_UNKNOWN. There are more drivers that
return the wrong value here, I have a patch series pending to fix that
and also to improve the spec.

The second does a code cleanup that improves readability, but it doesn't
change the logic.

The third patch is based on a patch from Mauro and a patch from Leo:

https://patchwork.linuxtv.org/patch/18573/
https://linuxtv.org/patch/18399/

This improves the error handling in case usb_control_msg() returns an
error.

Changes since v1:

- Also return the low-level usb_control_msg error in the vidioc_g_fmt_vid_cap
  case.

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


[REVIEWv2 PATCH 1/3] hdpvr: fix querystd 'unknown format' return.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

If no format has been detected, then querystd should return V4L2_STD_UNKNOWN,
not V4L2_STD_ALL.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/hdpvr/hdpvr-video.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c 
b/drivers/media/usb/hdpvr/hdpvr-video.c
index 2d02b49..81018c4 100644
--- a/drivers/media/usb/hdpvr/hdpvr-video.c
+++ b/drivers/media/usb/hdpvr/hdpvr-video.c
@@ -613,7 +613,7 @@ static int vidioc_querystd(struct file *file, void *_fh, 
v4l2_std_id *a)
struct hdpvr_fh *fh = _fh;
int ret;
 
-   *a = V4L2_STD_ALL;
+   *a = V4L2_STD_UNKNOWN;
if (dev-options.video_input == HDPVR_COMPONENT)
return fh-legacy_mode ? 0 : -ENODATA;
ret = get_video_info(dev, vid_info);
-- 
1.7.10.4

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


[REVIEWv2 PATCH 3/3] hdpvr: improve error handling

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

get_video_info() should never return EFAULT, instead it should return
the low-level usb_control_msg() error. Add a valid field to the hdpvr_video_info
struct so the driver can easily check if a valid format was detected.

Whenever get_video_info is called and it returns an error (e.g. usb_control_msg
failed), then return that error to userspace as well.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/hdpvr/hdpvr-control.c |   21 +
 drivers/media/usb/hdpvr/hdpvr-video.c   |   18 +++---
 drivers/media/usb/hdpvr/hdpvr.h |1 +
 3 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/drivers/media/usb/hdpvr/hdpvr-control.c 
b/drivers/media/usb/hdpvr/hdpvr-control.c
index df6bcb5..6053661 100644
--- a/drivers/media/usb/hdpvr/hdpvr-control.c
+++ b/drivers/media/usb/hdpvr/hdpvr-control.c
@@ -49,6 +49,7 @@ int get_video_info(struct hdpvr_device *dev, struct 
hdpvr_video_info *vidinf)
 {
int ret;
 
+   vidinf-valid = false;
mutex_lock(dev-usbc_mutex);
ret = usb_control_msg(dev-udev,
  usb_rcvctrlpipe(dev-udev, 0),
@@ -56,11 +57,6 @@ int get_video_info(struct hdpvr_device *dev, struct 
hdpvr_video_info *vidinf)
  0x1400, 0x0003,
  dev-usbc_buf, 5,
  1000);
-   if (ret == 5) {
-   vidinf-width   = dev-usbc_buf[1]  8 | dev-usbc_buf[0];
-   vidinf-height  = dev-usbc_buf[3]  8 | dev-usbc_buf[2];
-   vidinf-fps = dev-usbc_buf[4];
-   }
 
 #ifdef HDPVR_DEBUG
if (hdpvr_debug  MSG_INFO) {
@@ -73,14 +69,15 @@ int get_video_info(struct hdpvr_device *dev, struct 
hdpvr_video_info *vidinf)
 #endif
mutex_unlock(dev-usbc_mutex);
 
-   if ((ret  0  ret != 5) ||/* fail if unexpected byte count returned */
-   !vidinf-width ||   /* preserve original behavior -  */
-   !vidinf-height ||  /* fail if no signal is detected */
-   !vidinf-fps) {
-   ret = -EFAULT;
-   }
+   if (ret  0)
+   return ret;
 
-   return ret  0 ? ret : 0;
+   vidinf-width   = dev-usbc_buf[1]  8 | dev-usbc_buf[0];
+   vidinf-height  = dev-usbc_buf[3]  8 | dev-usbc_buf[2];
+   vidinf-fps = dev-usbc_buf[4];
+   vidinf-valid   = vidinf-width  vidinf-height  vidinf-fps;
+
+   return 0;
 }
 
 int get_input_lines_info(struct hdpvr_device *dev)
diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c 
b/drivers/media/usb/hdpvr/hdpvr-video.c
index e947105..4f8567a 100644
--- a/drivers/media/usb/hdpvr/hdpvr-video.c
+++ b/drivers/media/usb/hdpvr/hdpvr-video.c
@@ -285,7 +285,10 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev)
return -EAGAIN;
 
ret = get_video_info(dev, vidinf);
-   if (ret) {
+   if (ret  0)
+   return ret;
+
+   if (!vidinf.valid) {
msleep(250);
v4l2_dbg(MSG_INFO, hdpvr_debug, dev-v4l2_dev,
no video signal at input %d\n, 
dev-options.video_input);
@@ -617,15 +620,12 @@ static int vidioc_querystd(struct file *file, void *_fh, 
v4l2_std_id *a)
if (dev-options.video_input == HDPVR_COMPONENT)
return fh-legacy_mode ? 0 : -ENODATA;
ret = get_video_info(dev, vid_info);
-   if (ret)
-   return 0;
-   if (vid_info.width == 720 
+   if (vid_info.valid  vid_info.width == 720 
(vid_info.height == 480 || vid_info.height == 576)) {
*a = (vid_info.height == 480) ?
V4L2_STD_525_60 : V4L2_STD_625_50;
}
-
-   return 0;
+   return ret;
 }
 
 static int vidioc_s_dv_timings(struct file *file, void *_fh,
@@ -679,6 +679,8 @@ static int vidioc_query_dv_timings(struct file *file, void 
*_fh,
return -ENODATA;
ret = get_video_info(dev, vid_info);
if (ret)
+   return ret;
+   if (!vid_info.valid)
return -ENOLCK;
interlaced = vid_info.fps = 30;
for (i = 0; i  ARRAY_SIZE(hdpvr_dv_timings); i++) {
@@ -1008,7 +1010,9 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void 
*_fh,
struct hdpvr_video_info vid_info;
 
ret = get_video_info(dev, vid_info);
-   if (ret)
+   if (ret  0)
+   return ret;
+   if (!vid_info.valid)
return -EFAULT;
f-fmt.pix.width = vid_info.width;
f-fmt.pix.height = vid_info.height;
diff --git a/drivers/media/usb/hdpvr/hdpvr.h b/drivers/media/usb/hdpvr/hdpvr.h
index 808ea7a..dc685d4 100644
--- a/drivers/media/usb/hdpvr/hdpvr.h
+++ b/drivers/media/usb/hdpvr/hdpvr.h
@@ -154,6 +154,7 @@ struct hdpvr_video_info {
u16 width;
u16 height;
u8  fps;
+   boolvalid;
 

[REVIEWv2 PATCH 2/3] hdpvr: code cleanup

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Remove an unnecessary 'else' and invert a condition which makes the code
more readable.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/hdpvr/hdpvr-video.c |   54 -
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c 
b/drivers/media/usb/hdpvr/hdpvr-video.c
index 81018c4..e947105 100644
--- a/drivers/media/usb/hdpvr/hdpvr-video.c
+++ b/drivers/media/usb/hdpvr/hdpvr-video.c
@@ -281,43 +281,43 @@ static int hdpvr_start_streaming(struct hdpvr_device *dev)
 
if (dev-status == STATUS_STREAMING)
return 0;
-   else if (dev-status != STATUS_IDLE)
+   if (dev-status != STATUS_IDLE)
return -EAGAIN;
 
ret = get_video_info(dev, vidinf);
+   if (ret) {
+   msleep(250);
+   v4l2_dbg(MSG_INFO, hdpvr_debug, dev-v4l2_dev,
+   no video signal at input %d\n, 
dev-options.video_input);
+   return -EAGAIN;
+   }
 
-   if (!ret) {
-   v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev-v4l2_dev,
-video signal: %dx%d@%dhz\n, vidinf.width,
-vidinf.height, vidinf.fps);
+   v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev-v4l2_dev,
+   video signal: %dx%d@%dhz\n, vidinf.width,
+   vidinf.height, vidinf.fps);
 
-   /* start streaming 2 request */
-   ret = usb_control_msg(dev-udev,
- usb_sndctrlpipe(dev-udev, 0),
- 0xb8, 0x38, 0x1, 0, NULL, 0, 8000);
-   v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev-v4l2_dev,
-encoder start control request returned %d\n, ret);
-   if (ret  0)
-   return ret;
+   /* start streaming 2 request */
+   ret = usb_control_msg(dev-udev,
+   usb_sndctrlpipe(dev-udev, 0),
+   0xb8, 0x38, 0x1, 0, NULL, 0, 8000);
+   v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev-v4l2_dev,
+   encoder start control request returned %d\n, ret);
+   if (ret  0)
+   return ret;
 
-   ret = hdpvr_config_call(dev, CTRL_START_STREAMING_VALUE, 0x00);
-   if (ret)
-   return ret;
+   ret = hdpvr_config_call(dev, CTRL_START_STREAMING_VALUE, 0x00);
+   if (ret)
+   return ret;
 
-   dev-status = STATUS_STREAMING;
+   dev-status = STATUS_STREAMING;
 
-   INIT_WORK(dev-worker, hdpvr_transmit_buffers);
-   queue_work(dev-workqueue, dev-worker);
+   INIT_WORK(dev-worker, hdpvr_transmit_buffers);
+   queue_work(dev-workqueue, dev-worker);
 
-   v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev-v4l2_dev,
-streaming started\n);
+   v4l2_dbg(MSG_BUFFER, hdpvr_debug, dev-v4l2_dev,
+   streaming started\n);
 
-   return 0;
-   }
-   msleep(250);
-   v4l2_dbg(MSG_INFO, hdpvr_debug, dev-v4l2_dev,
-no video signal at input %d\n, dev-options.video_input);
-   return -EAGAIN;
+   return 0;
 }
 
 
-- 
1.7.10.4

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


Re: [RFC] [media] mem2mem: add support for hardware buffered queue

2013-05-29 Thread Sylwester Nawrocki
Hello Philip,

On 05/22/2013 12:17 PM, Philipp Zabel wrote:
 On mem2mem decoders with a hardware bitstream ringbuffer, to drain the
 buffer at the end of the stream, remaining frames might need to be decoded
 without additional input buffers being provided, and after calling streamoff
 on the v4l2 output queue. This also allows a driver to copy input buffers
 into their bitstream ringbuffer and immediately mark them as done to be
 dequeued.
 
 The motivation for this patch is hardware assisted h.264 reordering support
 in the coda driver. For high profile streams, the coda can hold back
 out-of-order frames, causing a few mem2mem device runs in the beginning, that
 don't produce any decompressed buffer at the v4l2 capture side. At the same
 time, the last few frames can be decoded from the bitstream with mem2mem 
 device
 runs that don't need a new input buffer at the v4l2 output side. A streamoff
 on the v4l2 output side can be used to put the decoder into the ringbuffer
 draining end-of-stream mode.

 Signed-off-by: Philipp Zabel p.za...@pengutronix.de
 ---
  drivers/media/v4l2-core/v4l2-mem2mem.c | 26 --
  include/media/v4l2-mem2mem.h   |  3 +++
  2 files changed, 23 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c 
 b/drivers/media/v4l2-core/v4l2-mem2mem.c
 index 357efa4..52818cd 100644
 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c
 +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
 @@ -196,6 +196,10 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev 
 *m2m_dev)
   * 2) at least one destination buffer has to be queued,
   * 3) streaming has to be on.
   *
 + * If a queue is buffered (for example a decoder hardware ringbuffer that has
 + * to be drained before doing streamoff), allow scheduling without v4l2 
 buffers
 + * on that queue and even when the queue is not streaming anymore.

Does it mean you want to be able to queue buffers on e.g. OUTPUT queue, while
this queue is in STREAM OFF state ?

Or do you really want to be able to to queue/dequeue buffers on CAPTURE queue,
while the OUTPUT queue is in STREAM OFF state ?

   * There may also be additional, custom requirements. In such case the driver
   * should supply a custom callback (job_ready in v4l2_m2m_ops) that should
   * return 1 if the instance is ready.
 @@ -210,7 +214,7 @@ static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx 
 *m2m_ctx)
   m2m_dev = m2m_ctx-m2m_dev;
   dprintk(Trying to schedule a job for m2m_ctx: %p\n, m2m_ctx);
  
 - if (!m2m_ctx-out_q_ctx.q.streaming
 + if ((!m2m_ctx-out_q_ctx.q.streaming  !m2m_ctx-out_q_ctx.buffered)

This seems a bit asymmetric. Even if a driver sets 'buffered' on the capture
queue nothing really changes, right ?

Thanks,
Sylwester

   || !m2m_ctx-cap_q_ctx.q.streaming) {
   dprintk(Streaming needs to be on for both queues\n);
   return;
 @@ -224,7 +228,7 @@ static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx 
 *m2m_ctx)
   }
  
   spin_lock_irqsave(m2m_ctx-out_q_ctx.rdy_spinlock, flags);
 - if (list_empty(m2m_ctx-out_q_ctx.rdy_queue)) {
 + if (list_empty(m2m_ctx-out_q_ctx.rdy_queue)  
 !m2m_ctx-out_q_ctx.buffered) {
   spin_unlock_irqrestore(m2m_ctx-out_q_ctx.rdy_spinlock, flags);
   spin_unlock_irqrestore(m2m_dev-job_spinlock, flags_job);
   dprintk(No input buffers available\n);
 @@ -434,9 +438,11 @@ int v4l2_m2m_streamoff(struct file *file, struct 
 v4l2_m2m_ctx *m2m_ctx,
  
   m2m_dev = m2m_ctx-m2m_dev;
   spin_lock_irqsave(m2m_dev-job_spinlock, flags_job);
 - /* We should not be scheduled anymore, since we're dropping a queue. */
 - INIT_LIST_HEAD(m2m_ctx-queue);
 - m2m_ctx-job_flags = 0;gmane.linux.drivers.video-input-infrastructure   
 if (list_empty(m2m_ctx-cap_q_ctx.rdy_queue))
 + if (!q_ctx-buffered) {
 + /* We should not be scheduled anymore, since we're dropping a 
 queue. */
 + INIT_LIST_HEAD(m2m_ctx-queue);
 + m2m_ctx-job_flags = 0;
 + }
  
   spin_lock_irqsave(q_ctx-rdy_spinlock, flags);
   /* Drop queue, since streamoff returns device to the same state as after
 @@ -444,7 +450,7 @@ int v4l2_m2m_streamoff(struct file *file, struct 
 v4l2_m2m_ctx *m2m_ctx,
   INIT_LIST_HEAD(q_ctx-rdy_queue);
   spin_unlock_irqrestore(q_ctx-rdy_spinlock, flags);
  
 - if (m2m_dev-curr_ctx == m2m_ctx) {
 + if (!q_ctx-buffered  (m2m_dev-curr_ctx == m2m_ctx)) {
   m2m_dev-curr_ctx = NULL;
   wake_up(m2m_ctx-finished);
   }
 @@ -640,6 +646,14 @@ err:
  }if (list_empty(m2m_ctx-cap_q_ctx.rdy_queue))
  EXPORT_SYMBOL_GPL(v4l2_m2m_ctx_init);
  
 +void v4l2_m2m_queue_set_buffered(struct vb2_queue *vq)
 +{
 + struct v4l2_m2m_queue_ctx *q_ctx = container_of(vq, struct 
 v4l2_m2m_queue_ctx, q);
 +
 + q_ctx-buffered = true;
 +}
 +EXPORT_SYMBOL_GPL(v4l2_m2m_queue_set_buffered);
 +
  /**
   * v4l2_m2m_ctx_release() - release m2m 

RE: [RFC] [media] mem2mem: add support for hardware buffered queue

2013-05-29 Thread Kamil Debski
Hi Philipp, Hans,

 On mem2mem decoders with a hardware bitstream ringbuffer, to drain the
 buffer at the end of the stream, remaining frames might need to be
 decoded without additional input buffers being provided, and after
 calling streamoff on the v4l2 output queue. This also allows a driver
 to copy input buffers into their bitstream ringbuffer and immediately
 mark them as done to be dequeued.
 
 The motivation for this patch is hardware assisted h.264 reordering
 support in the coda driver. For high profile streams, the coda can hold
 back out-of-order frames, causing a few mem2mem device runs in the
 beginning, that don't produce any decompressed buffer at the v4l2
 capture side. At the same time, the last few frames can be decoded from
 the bitstream with mem2mem device runs that don't need a new input
 buffer at the v4l2 output side. A streamoff on the v4l2 output side can
 be used to put the decoder into the ringbuffer draining end-of-stream
 mode.

If I remember correctly the main goal of introducing the m2m framework
was to support simple mem2mem devices where one input buffer = one output
buffer. In other cases m2m was not to be used. 

An example of such mem2mem driver, which does not use m2m framework is
MFC. It uses videobuf2 directly and it is wholly up to the driver how
will it control the queues, stream on/off and so on. You can then have
one OUTPUT buffer generate multiple CAPTURE buffer, multiple OUTPUT
buffers generate a single CAPTURE buffer. Consume OUTPUT buffer without
generating CAPTURE buffer (e.g. when starting decoding) and produce
CAPTURE buffers without consuming OUTPUT buffers (e.g. when finishing
decoding).

I think that stream off should not be used to signal EOS. For this we
have EOS event. You mentioned the EOS buffer flag. This is the idea
originally proposed by Andrzej Hajda, after some lengthy discussions
with v4l community this idea was changed to use an EOS event.

I was all for the EOS buffer flag, but after discussion with Mauro I
understood his arguments. We can get back to this discussion, if we
are sure that events are not enough. Please also note that we need to
keep backward compatibility.

Original EOS buffer flag patches by Andrzej and part of the discussion
can be found here:
1) https://linuxtv.org/patch/10624/
2) https://linuxtv.org/patch/11373/

Best wishes,
Kamil Debski


--
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: [RFC] [media] mem2mem: add support for hardware buffered queue

2013-05-29 Thread Philipp Zabel
Hi Sylwester,

Am Mittwoch, den 29.05.2013, 11:32 +0200 schrieb Sylwester Nawrocki:
 Hello Philip,
 
 On 05/22/2013 12:17 PM, Philipp Zabel wrote:
  On mem2mem decoders with a hardware bitstream ringbuffer, to drain the
  buffer at the end of the stream, remaining frames might need to be decoded
  without additional input buffers being provided, and after calling streamoff
  on the v4l2 output queue. This also allows a driver to copy input buffers
  into their bitstream ringbuffer and immediately mark them as done to be
  dequeued.
  
  The motivation for this patch is hardware assisted h.264 reordering support
  in the coda driver. For high profile streams, the coda can hold back
  out-of-order frames, causing a few mem2mem device runs in the beginning, 
  that
  don't produce any decompressed buffer at the v4l2 capture side. At the same
  time, the last few frames can be decoded from the bitstream with mem2mem 
  device
  runs that don't need a new input buffer at the v4l2 output side. A streamoff
  on the v4l2 output side can be used to put the decoder into the ringbuffer
  draining end-of-stream mode.
 
  Signed-off-by: Philipp Zabel p.za...@pengutronix.de
  ---
   drivers/media/v4l2-core/v4l2-mem2mem.c | 26 --
   include/media/v4l2-mem2mem.h   |  3 +++
   2 files changed, 23 insertions(+), 6 deletions(-)
  
  diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c 
  b/drivers/media/v4l2-core/v4l2-mem2mem.c
  index 357efa4..52818cd 100644
  --- a/drivers/media/v4l2-core/v4l2-mem2mem.c
  +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
  @@ -196,6 +196,10 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev 
  *m2m_dev)
* 2) at least one destination buffer has to be queued,
* 3) streaming has to be on.
*
  + * If a queue is buffered (for example a decoder hardware ringbuffer that 
  has
  + * to be drained before doing streamoff), allow scheduling without v4l2 
  buffers
  + * on that queue and even when the queue is not streaming anymore.
 
 Does it mean you want to be able to queue buffers on e.g. OUTPUT queue, while
 this queue is in STREAM OFF state ?

No.

 Or do you really want to be able to to queue/dequeue buffers on CAPTURE queue,
 while the OUTPUT queue is in STREAM OFF state ?

Yes.

The CODA decoder needs the encoded OUTPUT frames to be copied into a
single bitstream ringbuffer. The OUTPUT buffers can be copied and
dequeued immediately, as long as there is enough space in the bitstream
buffer. Depending on the bitstream type, a few buffers need to be in the
bitstream for the CODA to be able to run. To be able to drain the
bitstream buffer and extract the last few frames, a stream-end bit needs
to be set, after which no new frames can be added to the bitstream
ringbuffer.

To get the last few frames of a stream decoded, I wanted to use
STREAMOFF on the OUTPUT queue (which sets stream-end mode in hardware)
and then continue to call DQBUF on the CAPTURE queue to have the driver
decode the remaining frames. When DQBUF is called on the last frame, the
driver sends the EOS event.

Kamil doesn't want STREAMOFF on the OUTPUT side to be used to put a
decoder into stream-end mode, I'll address that in the other mail.

* There may also be additional, custom requirements. In such case the 
  driver
* should supply a custom callback (job_ready in v4l2_m2m_ops) that should
* return 1 if the instance is ready.
  @@ -210,7 +214,7 @@ static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx 
  *m2m_ctx)
  m2m_dev = m2m_ctx-m2m_dev;
  dprintk(Trying to schedule a job for m2m_ctx: %p\n, m2m_ctx);
   
  -   if (!m2m_ctx-out_q_ctx.q.streaming
  +   if ((!m2m_ctx-out_q_ctx.q.streaming  !m2m_ctx-out_q_ctx.buffered)
 
 This seems a bit asymmetric. Even if a driver sets 'buffered' on the capture
 queue nothing really changes, right ?

That's only because I had no need of (and no way to test) buffered
capture queues. It should probably be made symmetric.

regards
Philipp

 Thanks,
 Sylwester
 
  || !m2m_ctx-cap_q_ctx.q.streaming) {
  dprintk(Streaming needs to be on for both queues\n);
  return;
  @@ -224,7 +228,7 @@ static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx 
  *m2m_ctx)
  }
   
  spin_lock_irqsave(m2m_ctx-out_q_ctx.rdy_spinlock, flags);
  -   if (list_empty(m2m_ctx-out_q_ctx.rdy_queue)) {
  +   if (list_empty(m2m_ctx-out_q_ctx.rdy_queue)  
  !m2m_ctx-out_q_ctx.buffered) {
  spin_unlock_irqrestore(m2m_ctx-out_q_ctx.rdy_spinlock, flags);
  spin_unlock_irqrestore(m2m_dev-job_spinlock, flags_job);
  dprintk(No input buffers available\n);
  @@ -434,9 +438,11 @@ int v4l2_m2m_streamoff(struct file *file, struct 
  v4l2_m2m_ctx *m2m_ctx,
   
  m2m_dev = m2m_ctx-m2m_dev;
  spin_lock_irqsave(m2m_dev-job_spinlock, flags_job);
  -   /* We should not be scheduled anymore, since we're dropping a queue. */
  -   INIT_LIST_HEAD(m2m_ctx-queue);
  -   m2m_ctx-job_flags = 

[PATCHv1 00/38] Remove VIDIOC_DBG_G_CHIP_IDENT

2013-05-29 Thread Hans Verkuil
With the introduction in 3.10 of the new superior VIDIOC_DBG_G_CHIP_INFO
ioctl there is no longer any need for the DBG_G_CHIP_IDENT ioctl or the
v4l2-chip-ident.h header. The V4L2 core is now responsible for handling
the G_CHIP_INFO ioctl. Only if a bridge driver has multiple address ranges
represented as different 'chips' does a bridge driver have to implement the
g_chip_info handler.

This patch series removes all code related to the old CHIP_IDENT ioctl and
the v4l2-chip-ident.h header.

See the documentation of the new VIDIOC_DBG_G_CHIP_INFO ioctl:

http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-dbg-g-chip-info.html

It also fixes a number of bugs relating to the VIDIOC_DBG_G/S_REGISTER
ioctls: adding/fixing register address checks where appropriate, and
set the size field correctly (not all drivers set that field).

This patch series simplifies drivers substantially and deletes almost
2900 lines in total.

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


[PATCHv1 01/38] v4l2-ioctl: dbg_g/s_register: only match BRIDGE and SUBDEV types.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Drop support for V4L2_CHIP_MATCH_I2C_DRIVER/ADDR and V4L2_CHIP_MATCH_AC97
types. The following patches will remove support for those in the drivers
as well.

This means that bridge drivers no longer have to check for the match.type
field in their g/s_register implementations. Only if they also implement
g_chip_info do they still have to check the match.addr field, otherwise the
core will check for that as well.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/v4l2-core/v4l2-ioctl.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index f81bda1..60b8c25 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1807,7 +1807,8 @@ static int v4l_dbg_g_register(const struct v4l2_ioctl_ops 
*ops,
return v4l2_subdev_call(sd, core, g_register, 
p);
return -EINVAL;
}
-   if (ops-vidioc_g_register)
+   if (ops-vidioc_g_register  p-match.type == V4L2_CHIP_MATCH_BRIDGE 
+   (ops-vidioc_g_chip_info || p-match.addr == 0))
return ops-vidioc_g_register(file, fh, p);
return -EINVAL;
 #else
@@ -1834,7 +1835,8 @@ static int v4l_dbg_s_register(const struct v4l2_ioctl_ops 
*ops,
return v4l2_subdev_call(sd, core, s_register, 
p);
return -EINVAL;
}
-   if (ops-vidioc_s_register)
+   if (ops-vidioc_s_register  p-match.type == V4L2_CHIP_MATCH_BRIDGE 
+   (ops-vidioc_g_chip_info || p-match.addr == 0))
return ops-vidioc_s_register(file, fh, p);
return -EINVAL;
 #else
-- 
1.7.10.4

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


[PATCHv1 04/38] saa7115: add back the dropped 'found' message.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

The saa7115 driver used to show a 'chip found' message during probe. This
was accidentally dropped during recent commits. Add it back as it is quite
useful.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/saa7115.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index 18cf0bf..4daa81c 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1735,6 +1735,8 @@ static int saa711x_probe(struct i2c_client *client,
sd = state-sd;
v4l2_i2c_subdev_init(sd, client, saa711x_ops);
 
+   v4l_info(client, %s found @ 0x%x (%s)\n, name,
+client-addr  1, client-adapter-name);
hdl = state-hdl;
v4l2_ctrl_handler_init(hdl, 6);
/* add in ascending ID order */
-- 
1.7.10.4

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


[PATCHv1 03/38] cx18: remove g_chip_ident support.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

The av-core is really a subdev, so there is no need anymore to act as if it
is a 'second' bridge chip.

As a result of this the g_chip_ident implementation can be completely dropped.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Andy Walls awa...@md.metrocast.net
---
 drivers/media/pci/cx18/cx18-av-core.c |   32 --
 drivers/media/pci/cx18/cx18-av-core.h |1 -
 drivers/media/pci/cx18/cx18-ioctl.c   |   78 +++--
 3 files changed, 7 insertions(+), 104 deletions(-)

diff --git a/drivers/media/pci/cx18/cx18-av-core.c 
b/drivers/media/pci/cx18/cx18-av-core.c
index ba8caf0..c4890a4 100644
--- a/drivers/media/pci/cx18/cx18-av-core.c
+++ b/drivers/media/pci/cx18/cx18-av-core.c
@@ -22,7 +22,6 @@
  *  02110-1301, USA.
  */
 
-#include media/v4l2-chip-ident.h
 #include cx18-driver.h
 #include cx18-io.h
 #include cx18-cards.h
@@ -1231,31 +1230,12 @@ static int cx18_av_log_status(struct v4l2_subdev *sd)
return 0;
 }
 
-static inline int cx18_av_dbg_match(const struct v4l2_dbg_match *match)
-{
-   return match-type == V4L2_CHIP_MATCH_HOST  match-addr == 1;
-}
-
-static int cx18_av_g_chip_ident(struct v4l2_subdev *sd,
-   struct v4l2_dbg_chip_ident *chip)
-{
-   struct cx18_av_state *state = to_cx18_av_state(sd);
-
-   if (cx18_av_dbg_match(chip-match)) {
-   chip-ident = state-id;
-   chip-revision = state-rev;
-   }
-   return 0;
-}
-
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 static int cx18_av_g_register(struct v4l2_subdev *sd,
  struct v4l2_dbg_register *reg)
 {
struct cx18 *cx = v4l2_get_subdevdata(sd);
 
-   if (!cx18_av_dbg_match(reg-match))
-   return -EINVAL;
if ((reg-reg  0x3) != 0)
return -EINVAL;
reg-size = 4;
@@ -1268,8 +1248,6 @@ static int cx18_av_s_register(struct v4l2_subdev *sd,
 {
struct cx18 *cx = v4l2_get_subdevdata(sd);
 
-   if (!cx18_av_dbg_match(reg-match))
-   return -EINVAL;
if ((reg-reg  0x3) != 0)
return -EINVAL;
cx18_av_write4(cx, reg-reg  0x0ffc, reg-val);
@@ -1282,17 +1260,9 @@ static const struct v4l2_ctrl_ops cx18_av_ctrl_ops = {
 };
 
 static const struct v4l2_subdev_core_ops cx18_av_general_ops = {
-   .g_chip_ident = cx18_av_g_chip_ident,
.log_status = cx18_av_log_status,
.load_fw = cx18_av_load_fw,
.reset = cx18_av_reset,
-   .g_ctrl = v4l2_subdev_g_ctrl,
-   .s_ctrl = v4l2_subdev_s_ctrl,
-   .s_ext_ctrls = v4l2_subdev_s_ext_ctrls,
-   .try_ext_ctrls = v4l2_subdev_try_ext_ctrls,
-   .g_ext_ctrls = v4l2_subdev_g_ext_ctrls,
-   .queryctrl = v4l2_subdev_queryctrl,
-   .querymenu = v4l2_subdev_querymenu,
.s_std = cx18_av_s_std,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
.g_register = cx18_av_g_register,
@@ -1340,8 +1310,6 @@ int cx18_av_probe(struct cx18 *cx)
int err;
 
state-rev = cx18_av_read4(cx, CXADEC_CHIP_CTRL)  0x;
-   state-id = ((state-rev  4) == CXADEC_CHIP_TYPE_MAKO)
-   ? V4L2_IDENT_CX23418_843 : V4L2_IDENT_UNKNOWN;
 
state-vid_input = CX18_AV_COMPOSITE7;
state-aud_input = CX18_AV_AUDIO8;
diff --git a/drivers/media/pci/cx18/cx18-av-core.h 
b/drivers/media/pci/cx18/cx18-av-core.h
index e9c69d9..4c559e8 100644
--- a/drivers/media/pci/cx18/cx18-av-core.h
+++ b/drivers/media/pci/cx18/cx18-av-core.h
@@ -104,7 +104,6 @@ struct cx18_av_state {
enum cx18_av_audio_input aud_input;
u32 audclk_freq;
int audmode;
-   u32 id;
u32 rev;
int is_initialized;
 
diff --git a/drivers/media/pci/cx18/cx18-ioctl.c 
b/drivers/media/pci/cx18/cx18-ioctl.c
index aee7b6d..414b0ec 100644
--- a/drivers/media/pci/cx18/cx18-ioctl.c
+++ b/drivers/media/pci/cx18/cx18-ioctl.c
@@ -39,7 +39,6 @@
 #include cx18-cards.h
 #include cx18-av-core.h
 #include media/tveeprom.h
-#include media/v4l2-chip-ident.h
 
 u16 cx18_service2vbi(int type)
 {
@@ -362,73 +361,16 @@ static int cx18_s_fmt_sliced_vbi_cap(struct file *file, 
void *fh,
return 0;
 }
 
-static int cx18_g_chip_ident(struct file *file, void *fh,
-   struct v4l2_dbg_chip_ident *chip)
-{
-   struct cx18 *cx = fh2id(fh)-cx;
-   int err = 0;
-
-   chip-ident = V4L2_IDENT_NONE;
-   chip-revision = 0;
-   switch (chip-match.type) {
-   case V4L2_CHIP_MATCH_HOST:
-   switch (chip-match.addr) {
-   case 0:
-   chip-ident = V4L2_IDENT_CX23418;
-   chip-revision = cx18_read_reg(cx, 0xC72028);
-   break;
-   case 1:
-   /*
-* The A/V decoder is always present, but in the rare
-* case that the card doesn't have analog, we don't
-* use it.  We find it w/o using the 

[PATCHv1 05/38] ivtv: remove g_chip_ident

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

g_chip_ident was used to determine if a saa7114 or saa7115 was used. Instead
just check the subdev name.

After that the g_chip_ident function can be removed.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Andy Walls awa...@md.metrocast.net
---
 drivers/media/pci/ivtv/ivtv-driver.c |8 +--
 drivers/media/pci/ivtv/ivtv-ioctl.c  |   41 --
 2 files changed, 5 insertions(+), 44 deletions(-)

diff --git a/drivers/media/pci/ivtv/ivtv-driver.c 
b/drivers/media/pci/ivtv/ivtv-driver.c
index 07b8460..db61452 100644
--- a/drivers/media/pci/ivtv/ivtv-driver.c
+++ b/drivers/media/pci/ivtv/ivtv-driver.c
@@ -58,7 +58,6 @@
 #include linux/dma-mapping.h
 #include media/tveeprom.h
 #include media/saa7115.h
-#include media/v4l2-chip-ident.h
 #include tuner-xc2028.h
 
 /* If you have already X v4l cards, then set this to X. This way
@@ -968,15 +967,10 @@ static void ivtv_load_and_init_modules(struct ivtv *itv)
}
 
if (hw  IVTV_HW_SAA711X) {
-   struct v4l2_dbg_chip_ident v;
-
/* determine the exact saa711x model */
itv-hw_flags = ~IVTV_HW_SAA711X;
 
-   v.match.type = V4L2_CHIP_MATCH_I2C_DRIVER;
-   strlcpy(v.match.name, saa7115, sizeof(v.match.name));
-   ivtv_call_hw(itv, IVTV_HW_SAA711X, core, g_chip_ident, v);
-   if (v.ident == V4L2_IDENT_SAA7114) {
+   if (strstr(itv-sd_video-name, saa7114)) {
itv-hw_flags |= IVTV_HW_SAA7114;
/* VBI is not yet supported by the saa7114 driver. */
itv-v4l2_cap = 
~(V4L2_CAP_SLICED_VBI_CAPTURE|V4L2_CAP_VBI_CAPTURE);
diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c 
b/drivers/media/pci/ivtv/ivtv-ioctl.c
index 3e281ec..944300f 100644
--- a/drivers/media/pci/ivtv/ivtv-ioctl.c
+++ b/drivers/media/pci/ivtv/ivtv-ioctl.c
@@ -34,7 +34,6 @@
 #include ivtv-cards.h
 #include media/saa7127.h
 #include media/tveeprom.h
-#include media/v4l2-chip-ident.h
 #include media/v4l2-event.h
 #include linux/dvb/audio.h
 
@@ -692,24 +691,6 @@ static int ivtv_s_fmt_vid_out_overlay(struct file *file, 
void *fh, struct v4l2_f
return ret;
 }
 
-static int ivtv_g_chip_ident(struct file *file, void *fh, struct 
v4l2_dbg_chip_ident *chip)
-{
-   struct ivtv *itv = fh2id(fh)-itv;
-
-   chip-ident = V4L2_IDENT_NONE;
-   chip-revision = 0;
-   if (chip-match.type == V4L2_CHIP_MATCH_HOST) {
-   if (v4l2_chip_match_host(chip-match))
-   chip-ident = itv-has_cx23415 ? V4L2_IDENT_CX23415 : 
V4L2_IDENT_CX23416;
-   return 0;
-   }
-   if (chip-match.type != V4L2_CHIP_MATCH_I2C_DRIVER 
-   chip-match.type != V4L2_CHIP_MATCH_I2C_ADDR)
-   return -EINVAL;
-   /* TODO: is this correct? */
-   return ivtv_call_all_err(itv, core, g_chip_ident, chip);
-}
-
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 static int ivtv_itvc(struct ivtv *itv, bool get, u64 reg, u64 *val)
 {
@@ -736,29 +717,16 @@ static int ivtv_g_register(struct file *file, void *fh, 
struct v4l2_dbg_register
 {
struct ivtv *itv = fh2id(fh)-itv;
 
-   if (v4l2_chip_match_host(reg-match)) {
-   reg-size = 4;
-   return ivtv_itvc(itv, true, reg-reg, reg-val);
-   }
-   /* TODO: subdev errors should not be ignored, this should become a
-  subdev helper function. */
-   ivtv_call_all(itv, core, g_register, reg);
-   return 0;
+   reg-size = 4;
+   return ivtv_itvc(itv, true, reg-reg, reg-val);
 }
 
 static int ivtv_s_register(struct file *file, void *fh, const struct 
v4l2_dbg_register *reg)
 {
struct ivtv *itv = fh2id(fh)-itv;
+   u64 val = reg-val;
 
-   if (v4l2_chip_match_host(reg-match)) {
-   u64 val = reg-val;
-
-   return ivtv_itvc(itv, false, reg-reg, val);
-   }
-   /* TODO: subdev errors should not be ignored, this should become a
-  subdev helper function. */
-   ivtv_call_all(itv, core, s_register, reg);
-   return 0;
+   return ivtv_itvc(itv, false, reg-reg, val);
 }
 #endif
 
@@ -1912,7 +1880,6 @@ static const struct v4l2_ioctl_ops ivtv_ioctl_ops = {
.vidioc_try_fmt_vid_out_overlay = ivtv_try_fmt_vid_out_overlay,
.vidioc_try_fmt_sliced_vbi_out  = ivtv_try_fmt_sliced_vbi_out,
.vidioc_g_sliced_vbi_cap= ivtv_g_sliced_vbi_cap,
-   .vidioc_g_chip_ident= ivtv_g_chip_ident,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
.vidioc_g_register  = ivtv_g_register,
.vidioc_s_register  = ivtv_s_register,
-- 
1.7.10.4

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


[PATCHv1 02/38] v4l2: remove g_chip_ident from bridge drivers where it is easy to do so.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

VIDIOC_DBG_G_CHIP_IDENT has been replaced by VIDIOC_DBG_G_CHIP_INFO. Remove
g_chip_ident support from bridge drivers since it is no longer needed.

This patch takes care of all the trivial cases.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
Cc: st...@linuxtv.org
Cc: Scott Jiang scott.jiang.li...@gmail.com
Cc: Lad, Prabhakar prabhakar.cse...@gmail.com
Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
Cc: Jonathan Corbet cor...@lwn.net
Cc: Ezequiel Garcia elezegar...@gmail.com
Cc: Devin Heitmueller dheitmuel...@kernellabs.com
Cc: Andrey Smirnov andrew.smir...@gmail.com
---
 drivers/media/common/saa7146/saa7146_video.c   |   23 -
 drivers/media/pci/bt8xx/bttv-driver.c  |   38 --
 drivers/media/pci/saa7134/saa7134-empress.c|   17 --
 drivers/media/pci/saa7134/saa7134-video.c  |4 --
 drivers/media/pci/saa7146/mxb.c|   15 ++
 drivers/media/pci/saa7164/saa7164-encoder.c|   37 -
 drivers/media/pci/saa7164/saa7164-vbi.c|9 
 drivers/media/pci/saa7164/saa7164.h|1 -
 drivers/media/platform/blackfin/bfin_capture.c |   41 ---
 drivers/media/platform/davinci/vpif_capture.c  |   66 
 drivers/media/platform/davinci/vpif_display.c  |   66 
 drivers/media/platform/sh_vou.c|   31 ---
 drivers/media/platform/soc_camera/soc_camera.c |   34 
 drivers/media/platform/via-camera.c|   16 --
 drivers/media/radio/radio-si476x.c |   11 
 drivers/media/usb/au0828/au0828-video.c|   39 --
 drivers/media/usb/em28xx/em28xx-video.c|   66 +++-
 drivers/media/usb/stk1160/stk1160-v4l.c|   41 ---
 18 files changed, 10 insertions(+), 545 deletions(-)

diff --git a/drivers/media/common/saa7146/saa7146_video.c 
b/drivers/media/common/saa7146/saa7146_video.c
index fe907f2..3077949 100644
--- a/drivers/media/common/saa7146/saa7146_video.c
+++ b/drivers/media/common/saa7146/saa7146_video.c
@@ -1,7 +1,6 @@
 #define pr_fmt(fmt) KBUILD_MODNAME :  fmt
 
 #include media/saa7146_vv.h
-#include media/v4l2-chip-ident.h
 #include media/v4l2-event.h
 #include media/v4l2-ctrls.h
 #include linux/module.h
@@ -988,26 +987,6 @@ static int vidioc_streamoff(struct file *file, void *__fh, 
enum v4l2_buf_type ty
return err;
 }
 
-static int vidioc_g_chip_ident(struct file *file, void *__fh,
-   struct v4l2_dbg_chip_ident *chip)
-{
-   struct saa7146_fh *fh = __fh;
-   struct saa7146_dev *dev = fh-dev;
-
-   chip-ident = V4L2_IDENT_NONE;
-   chip-revision = 0;
-   if (chip-match.type == V4L2_CHIP_MATCH_HOST) {
-   if (v4l2_chip_match_host(chip-match))
-   chip-ident = V4L2_IDENT_SAA7146;
-   return 0;
-   }
-   if (chip-match.type != V4L2_CHIP_MATCH_I2C_DRIVER 
-   chip-match.type != V4L2_CHIP_MATCH_I2C_ADDR)
-   return -EINVAL;
-   return v4l2_device_call_until_err(dev-v4l2_dev, 0,
-   core, g_chip_ident, chip);
-}
-
 const struct v4l2_ioctl_ops saa7146_video_ioctl_ops = {
.vidioc_querycap = vidioc_querycap,
.vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
@@ -1018,7 +997,6 @@ const struct v4l2_ioctl_ops saa7146_video_ioctl_ops = {
.vidioc_g_fmt_vid_overlay= vidioc_g_fmt_vid_overlay,
.vidioc_try_fmt_vid_overlay  = vidioc_try_fmt_vid_overlay,
.vidioc_s_fmt_vid_overlay= vidioc_s_fmt_vid_overlay,
-   .vidioc_g_chip_ident = vidioc_g_chip_ident,
 
.vidioc_overlay  = vidioc_overlay,
.vidioc_g_fbuf   = vidioc_g_fbuf,
@@ -1039,7 +1017,6 @@ const struct v4l2_ioctl_ops saa7146_video_ioctl_ops = {
 const struct v4l2_ioctl_ops saa7146_vbi_ioctl_ops = {
.vidioc_querycap = vidioc_querycap,
.vidioc_g_fmt_vbi_cap= vidioc_g_fmt_vbi_cap,
-   .vidioc_g_chip_ident = vidioc_g_chip_ident,
 
.vidioc_reqbufs  = vidioc_reqbufs,
.vidioc_querybuf = vidioc_querybuf,
diff --git a/drivers/media/pci/bt8xx/bttv-driver.c 
b/drivers/media/pci/bt8xx/bttv-driver.c
index a334c94..bfcfa3e 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -50,7 +50,6 @@
 #include media/v4l2-common.h
 #include media/v4l2-ioctl.h
 #include media/v4l2-event.h
-#include media/v4l2-chip-ident.h
 #include media/tvaudio.h
 #include media/msp3400.h
 
@@ -1907,28 +1906,6 @@ static int bttv_log_status(struct file *file, void *f)
return 0;
 }
 
-static int bttv_g_chip_ident(struct file *file, void *f, struct 
v4l2_dbg_chip_ident *chip)
-{
-   struct bttv_fh *fh  = f;
-   struct bttv *btv = fh-btv;
-
-   chip-ident = V4L2_IDENT_NONE;
- 

[PATCHv1 06/38] cx23885: remove g_chip_ident.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Replace g_chip_ident by g_chip_info. Note that the IR support is implemented
as a subdev, so this part no longer needs to be handled as a 'bridge' chip.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Steven Toth st...@linuxtv.org
---
 drivers/media/pci/cx23885/cx23885-417.c   |2 +-
 drivers/media/pci/cx23885/cx23885-ioctl.c |  139 ++---
 drivers/media/pci/cx23885/cx23885-ioctl.h |4 +-
 drivers/media/pci/cx23885/cx23885-video.c |2 +-
 drivers/media/pci/cx23885/cx23888-ir.c|   27 --
 5 files changed, 29 insertions(+), 145 deletions(-)

diff --git a/drivers/media/pci/cx23885/cx23885-417.c 
b/drivers/media/pci/cx23885/cx23885-417.c
index 6dea11a..68568d3 100644
--- a/drivers/media/pci/cx23885/cx23885-417.c
+++ b/drivers/media/pci/cx23885/cx23885-417.c
@@ -1690,8 +1690,8 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
.vidioc_log_status   = vidioc_log_status,
.vidioc_querymenu= vidioc_querymenu,
.vidioc_queryctrl= vidioc_queryctrl,
-   .vidioc_g_chip_ident = cx23885_g_chip_ident,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
+   .vidioc_g_chip_info  = cx23885_g_chip_info,
.vidioc_g_register   = cx23885_g_register,
.vidioc_s_register   = cx23885_s_register,
 #endif
diff --git a/drivers/media/pci/cx23885/cx23885-ioctl.c 
b/drivers/media/pci/cx23885/cx23885-ioctl.c
index 00f5125..271d69d 100644
--- a/drivers/media/pci/cx23885/cx23885-ioctl.c
+++ b/drivers/media/pci/cx23885/cx23885-ioctl.c
@@ -24,93 +24,21 @@
 #include cx23885.h
 #include cx23885-ioctl.h
 
-#include media/v4l2-chip-ident.h
-
-int cx23885_g_chip_ident(struct file *file, void *fh,
-struct v4l2_dbg_chip_ident *chip)
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+int cx23885_g_chip_info(struct file *file, void *fh,
+struct v4l2_dbg_chip_info *chip)
 {
struct cx23885_dev *dev = ((struct cx23885_fh *)fh)-dev;
-   int err = 0;
-   u8 rev;
-
-   chip-ident = V4L2_IDENT_NONE;
-   chip-revision = 0;
-   switch (chip-match.type) {
-   case V4L2_CHIP_MATCH_HOST:
-   switch (chip-match.addr) {
-   case 0:
-   rev = cx_read(RDR_CFG2)  0xff;
-   switch (dev-pci-device) {
-   case 0x8852:
-   /* rev 0x04 could be '885 or '888. Pick '888. */
-   if (rev == 0x04)
-   chip-ident = V4L2_IDENT_CX23888;
-   else
-   chip-ident = V4L2_IDENT_CX23885;
-   break;
-   case 0x8880:
-   if (rev == 0x0e || rev == 0x0f)
-   chip-ident = V4L2_IDENT_CX23887;
-   else
-   chip-ident = V4L2_IDENT_CX23888;
-   break;
-   default:
-   chip-ident = V4L2_IDENT_UNKNOWN;
-   break;
-   }
-   chip-revision = (dev-pci-device  16) | (rev  8) |
-(dev-hwrevision  0xff);
-   break;
-   case 1:
-   if (dev-v4l_device != NULL) {
-   chip-ident = V4L2_IDENT_CX23417;
-   chip-revision = 0;
-   }
-   break;
-   case 2:
-   /*
-* The integrated IR controller on the CX23888 is
-* host chip 2.  It may not be used/initialized or sd_ir
-* may be pointing at the cx25840 subdevice for the
-* IR controller on the CX23885.  Thus we find it
-* without using the dev-sd_ir pointer.
-*/
-   call_hw(dev, CX23885_HW_888_IR, core, g_chip_ident,
-   chip);
-   break;
-   default:
-   err = -EINVAL; /* per V4L2 spec */
-   break;
-   }
-   break;
-   case V4L2_CHIP_MATCH_I2C_DRIVER:
-   /* If needed, returns V4L2_IDENT_AMBIGUOUS without extra work */
-   call_all(dev, core, g_chip_ident, chip);
-   break;
-   case V4L2_CHIP_MATCH_I2C_ADDR:
-   /*
-* We could return V4L2_IDENT_UNKNOWN, but we don't do the work
-* to look if a chip is at the address with no driver.  That's a
-* dangerous thing to do with EEPROMs anyway.
-*/
-   call_all(dev, core, g_chip_ident, chip);
-   break;
-   default:

[PATCHv1 07/38] cx88: remove g_chip_ident.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Remove g_chip_ident from cx88. Also remove the v4l2-chip-ident.h include.
The board code used defines from v4l2-chip-ident.h to tell the driver which
audio chip is used. Replace this with a cx88-specific enum.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
---
 drivers/media/pci/cx88/cx88-alsa.c  |6 +++---
 drivers/media/pci/cx88/cx88-cards.c |   12 ++--
 drivers/media/pci/cx88/cx88-video.c |   27 +--
 drivers/media/pci/cx88/cx88.h   |8 ++--
 4 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/drivers/media/pci/cx88/cx88-alsa.c 
b/drivers/media/pci/cx88/cx88-alsa.c
index 27d6262..ce02105 100644
--- a/drivers/media/pci/cx88/cx88-alsa.c
+++ b/drivers/media/pci/cx88/cx88-alsa.c
@@ -615,7 +615,7 @@ static int snd_cx88_volume_put(struct snd_kcontrol 
*kcontrol,
int changed = 0;
u32 old;
 
-   if (core-board.audio_chip == V4L2_IDENT_WM8775)
+   if (core-board.audio_chip == CX88_AUDIO_WM8775)
snd_cx88_wm8775_volume_put(kcontrol, value);
 
left = value-value.integer.value[0]  0x3f;
@@ -682,7 +682,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol 
*kcontrol,
vol ^= bit;
cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol);
/* Pass mute onto any WM8775 */
-   if ((core-board.audio_chip == V4L2_IDENT_WM8775) 
+   if ((core-board.audio_chip == CX88_AUDIO_WM8775) 
((16) == bit))
wm8775_s_ctrl(core, V4L2_CID_AUDIO_MUTE, 0 != (vol  
bit));
ret = 1;
@@ -903,7 +903,7 @@ static int cx88_audio_initdev(struct pci_dev *pci,
goto error;
 
/* If there's a wm8775 then add a Line-In ALC switch */
-   if (core-board.audio_chip == V4L2_IDENT_WM8775)
+   if (core-board.audio_chip == CX88_AUDIO_WM8775)
snd_ctl_add(card, snd_ctl_new1(snd_cx88_alc_switch, chip));
 
strcpy (card-driver, CX88x);
diff --git a/drivers/media/pci/cx88/cx88-cards.c 
b/drivers/media/pci/cx88/cx88-cards.c
index a87a0e1..e18a7ac 100644
--- a/drivers/media/pci/cx88/cx88-cards.c
+++ b/drivers/media/pci/cx88/cx88-cards.c
@@ -744,7 +744,7 @@ static const struct cx88_board cx88_boards[] = {
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
/* Some variants use a tda9874 and so need the tvaudio module. 
*/
-   .audio_chip = V4L2_IDENT_TVAUDIO,
+   .audio_chip = CX88_AUDIO_TVAUDIO,
.input  = {{
.type   = CX88_VMUX_TELEVISION,
.vmux   = 0,
@@ -976,7 +976,7 @@ static const struct cx88_board cx88_boards[] = {
.radio_type = UNSET,
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
-   .audio_chip = V4L2_IDENT_WM8775,
+   .audio_chip = CX88_AUDIO_WM8775,
.i2sinputcntl   = 2,
.input  = {{
.type   = CX88_VMUX_DVB,
@@ -1014,7 +1014,7 @@ static const struct cx88_board cx88_boards[] = {
.radio_type = UNSET,
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
-   .audio_chip = V4L2_IDENT_WM8775,
+   .audio_chip = CX88_AUDIO_WM8775,
.input  = {{
.type   = CX88_VMUX_DVB,
.vmux   = 0,
@@ -1376,7 +1376,7 @@ static const struct cx88_board cx88_boards[] = {
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
.tda9887_conf   = TDA9887_PRESENT,
-   .audio_chip = V4L2_IDENT_WM8775,
+   .audio_chip = CX88_AUDIO_WM8775,
.input  = {{
.type   = CX88_VMUX_TELEVISION,
.vmux   = 0,
@@ -1461,7 +1461,7 @@ static const struct cx88_board cx88_boards[] = {
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
.tda9887_conf   = TDA9887_PRESENT,
-   .audio_chip = V4L2_IDENT_WM8775,
+   .audio_chip = CX88_AUDIO_WM8775,
/*
 * gpio0 as reported by Mike Crash mike AT mikecrash.com
 */
@@ -1929,7 +1929,7 @@ static const struct cx88_board cx88_boards[] = {
.tuner_addr = ADDR_UNSET,
.radio_addr = ADDR_UNSET,
.tda9887_conf   = TDA9887_PRESENT,
-   .audio_chip = V4L2_IDENT_WM8775,
+   .audio_chip = CX88_AUDIO_WM8775,
/*
 * GPIO0 (WINTV2000)
 *
diff --git a/drivers/media/pci/cx88/cx88-video.c 
b/drivers/media/pci/cx88/cx88-video.c
index 

[PATCHv1 13/38] v4l2: remove obsolete v4l2_chip_match_host().

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

This function is no longer needed since it is now the responsibility of the
v4l2 core to check if the DBG_G/S_REGISTER and DBG_G_CHIP_INFO ioctls are
called for the bridge driver or not.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/usb/usbvision/usbvision-video.c |4 
 drivers/media/v4l2-core/v4l2-common.c |   11 ---
 include/media/v4l2-common.h   |1 -
 3 files changed, 16 deletions(-)

diff --git a/drivers/media/usb/usbvision/usbvision-video.c 
b/drivers/media/usb/usbvision/usbvision-video.c
index d34c2af..f959197 100644
--- a/drivers/media/usb/usbvision/usbvision-video.c
+++ b/drivers/media/usb/usbvision/usbvision-video.c
@@ -467,8 +467,6 @@ static int vidioc_g_register(struct file *file, void *priv,
struct usb_usbvision *usbvision = video_drvdata(file);
int err_code;
 
-   if (!v4l2_chip_match_host(reg-match))
-   return -EINVAL;
/* NT100x has a 8-bit register space */
err_code = usbvision_read_reg(usbvision, reg-reg0xff);
if (err_code  0) {
@@ -488,8 +486,6 @@ static int vidioc_s_register(struct file *file, void *priv,
struct usb_usbvision *usbvision = video_drvdata(file);
int err_code;
 
-   if (!v4l2_chip_match_host(reg-match))
-   return -EINVAL;
/* NT100x has a 8-bit register space */
err_code = usbvision_write_reg(usbvision, reg-reg  0xff, reg-val);
if (err_code  0) {
diff --git a/drivers/media/v4l2-core/v4l2-common.c 
b/drivers/media/v4l2-core/v4l2-common.c
index 3fed63f..5fd7660 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -227,17 +227,6 @@ u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 
id)
 }
 EXPORT_SYMBOL(v4l2_ctrl_next);
 
-int v4l2_chip_match_host(const struct v4l2_dbg_match *match)
-{
-   switch (match-type) {
-   case V4L2_CHIP_MATCH_BRIDGE:
-   return match-addr == 0;
-   default:
-   return 0;
-   }
-}
-EXPORT_SYMBOL(v4l2_chip_match_host);
-
 #if IS_ENABLED(CONFIG_I2C)
 int v4l2_chip_match_i2c_client(struct i2c_client *c, const struct 
v4l2_dbg_match *match)
 {
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index 1d93c48..e7821fb 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -106,7 +106,6 @@ struct i2c_client; /* forward reference */
 int v4l2_chip_match_i2c_client(struct i2c_client *c, const struct 
v4l2_dbg_match *match);
 int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct 
v4l2_dbg_chip_ident *chip,
u32 ident, u32 revision);
-int v4l2_chip_match_host(const struct v4l2_dbg_match *match);
 
 /* - */
 
-- 
1.7.10.4

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


[PATCHv1 09/38] gspca: remove g_chip_ident

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Remove g_chip_ident and replace it with g_chip_info.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Hans de Goede hdego...@redhat.com
Cc: Brian Johnson brij...@gmail.com
---
 drivers/media/usb/gspca/gspca.c   |   32 +-
 drivers/media/usb/gspca/gspca.h   |6 ++--
 drivers/media/usb/gspca/pac7302.c |   19 +--
 drivers/media/usb/gspca/sn9c20x.c |   67 +
 4 files changed, 34 insertions(+), 90 deletions(-)

diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
index 5995ec4..b7ae872 100644
--- a/drivers/media/usb/gspca/gspca.c
+++ b/drivers/media/usb/gspca/gspca.c
@@ -1029,33 +1029,35 @@ static int gspca_get_mode(struct gspca_dev *gspca_dev,
 }
 
 #ifdef CONFIG_VIDEO_ADV_DEBUG
-static int vidioc_g_register(struct file *file, void *priv,
-   struct v4l2_dbg_register *reg)
+static int vidioc_g_chip_info(struct file *file, void *priv,
+   struct v4l2_dbg_chip_info *chip)
 {
struct gspca_dev *gspca_dev = video_drvdata(file);
 
gspca_dev-usb_err = 0;
-   return gspca_dev-sd_desc-get_register(gspca_dev, reg);
+   if (gspca_dev-sd_desc-get_chip_info)
+   return gspca_dev-sd_desc-get_chip_info(gspca_dev, chip);
+   return chip-match.addr ? -EINVAL : 0;
 }
 
-static int vidioc_s_register(struct file *file, void *priv,
-   const struct v4l2_dbg_register *reg)
+static int vidioc_g_register(struct file *file, void *priv,
+   struct v4l2_dbg_register *reg)
 {
struct gspca_dev *gspca_dev = video_drvdata(file);
 
gspca_dev-usb_err = 0;
-   return gspca_dev-sd_desc-set_register(gspca_dev, reg);
+   return gspca_dev-sd_desc-get_register(gspca_dev, reg);
 }
-#endif
 
-static int vidioc_g_chip_ident(struct file *file, void *priv,
-   struct v4l2_dbg_chip_ident *chip)
+static int vidioc_s_register(struct file *file, void *priv,
+   const struct v4l2_dbg_register *reg)
 {
struct gspca_dev *gspca_dev = video_drvdata(file);
 
gspca_dev-usb_err = 0;
-   return gspca_dev-sd_desc-get_chip_ident(gspca_dev, chip);
+   return gspca_dev-sd_desc-set_register(gspca_dev, reg);
 }
+#endif
 
 static int vidioc_enum_fmt_vid_cap(struct file *file, void  *priv,
struct v4l2_fmtdesc *fmtdesc)
@@ -1974,10 +1976,10 @@ static const struct v4l2_ioctl_ops dev_ioctl_ops = {
.vidioc_enum_framesizes = vidioc_enum_framesizes,
.vidioc_enum_frameintervals = vidioc_enum_frameintervals,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
+   .vidioc_g_chip_info = vidioc_g_chip_info,
.vidioc_g_register  = vidioc_g_register,
.vidioc_s_register  = vidioc_s_register,
 #endif
-   .vidioc_g_chip_ident= vidioc_g_chip_ident,
.vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
.vidioc_unsubscribe_event = v4l2_event_unsubscribe,
 };
@@ -2086,14 +2088,10 @@ int gspca_dev_probe2(struct usb_interface *intf,
v4l2_disable_ioctl_locking(gspca_dev-vdev, VIDIOC_DQBUF);
v4l2_disable_ioctl_locking(gspca_dev-vdev, VIDIOC_QBUF);
v4l2_disable_ioctl_locking(gspca_dev-vdev, VIDIOC_QUERYBUF);
-   if (!gspca_dev-sd_desc-get_chip_ident)
-   v4l2_disable_ioctl(gspca_dev-vdev, VIDIOC_DBG_G_CHIP_IDENT);
 #ifdef CONFIG_VIDEO_ADV_DEBUG
-   if (!gspca_dev-sd_desc-get_chip_ident ||
-   !gspca_dev-sd_desc-get_register)
+   if (!gspca_dev-sd_desc-get_register)
v4l2_disable_ioctl(gspca_dev-vdev, VIDIOC_DBG_G_REGISTER);
-   if (!gspca_dev-sd_desc-get_chip_ident ||
-   !gspca_dev-sd_desc-set_register)
+   if (!gspca_dev-sd_desc-set_register)
v4l2_disable_ioctl(gspca_dev-vdev, VIDIOC_DBG_S_REGISTER);
 #endif
if (!gspca_dev-sd_desc-get_jcomp)
diff --git a/drivers/media/usb/gspca/gspca.h b/drivers/media/usb/gspca/gspca.h
index ef8efeb..ac0b11f 100644
--- a/drivers/media/usb/gspca/gspca.h
+++ b/drivers/media/usb/gspca/gspca.h
@@ -78,8 +78,8 @@ typedef int (*cam_get_reg_op) (struct gspca_dev *,
struct v4l2_dbg_register *);
 typedef int (*cam_set_reg_op) (struct gspca_dev *,
const struct v4l2_dbg_register *);
-typedef int (*cam_ident_op) (struct gspca_dev *,
-   struct v4l2_dbg_chip_ident *);
+typedef int (*cam_chip_info_op) (struct gspca_dev *,
+   struct v4l2_dbg_chip_info *);
 typedef void (*cam_streamparm_op) (struct gspca_dev *,
  struct v4l2_streamparm *);
 typedef void (*cam_pkt_op) (struct gspca_dev *gspca_dev,
@@ -112,8 +112,8 @@ struct sd_desc {
 #ifdef CONFIG_VIDEO_ADV_DEBUG
cam_set_reg_op set_register;
cam_get_reg_op get_register;
+   cam_chip_info_op get_chip_info;
 #endif
-   cam_ident_op 

[PATCHv1 16/38] indycam: remove g_chip_ident op.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

This is no longer needed since the core now handles this through 
DBG_G_CHIP_INFO.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/platform/indycam.c |   12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/media/platform/indycam.c b/drivers/media/platform/indycam.c
index 5482363..f1d192b 100644
--- a/drivers/media/platform/indycam.c
+++ b/drivers/media/platform/indycam.c
@@ -23,7 +23,6 @@
 #include linux/videodev2.h
 #include linux/i2c.h
 #include media/v4l2-device.h
-#include media/v4l2-chip-ident.h
 
 #include indycam.h
 
@@ -283,20 +282,9 @@ static int indycam_s_ctrl(struct v4l2_subdev *sd, struct 
v4l2_control *ctrl)
 
 /* I2C-interface */
 
-static int indycam_g_chip_ident(struct v4l2_subdev *sd,
-   struct v4l2_dbg_chip_ident *chip)
-{
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
-   struct indycam *camera = to_indycam(sd);
-
-   return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_INDYCAM,
-  camera-version);
-}
-
 /* --- */
 
 static const struct v4l2_subdev_core_ops indycam_core_ops = {
-   .g_chip_ident = indycam_g_chip_ident,
.g_ctrl = indycam_g_ctrl,
.s_ctrl = indycam_s_ctrl,
 };
-- 
1.7.10.4

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


[PATCHv1 11/38] marvell-ccic: remove g_chip_ident.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Remove g_chip_ident. This driver used some of the V4L2_IDENT defines, replace
those with a driver-specific enum. This makes it possible to drop the
v4l2-chip-ident.h define as well.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Jonathan Corbet cor...@lwn.net
---
 drivers/media/platform/marvell-ccic/cafe-driver.c |3 +-
 drivers/media/platform/marvell-ccic/mcam-core.c   |   55 +++--
 drivers/media/platform/marvell-ccic/mcam-core.h   |8 ++-
 drivers/media/platform/marvell-ccic/mmp-driver.c  |3 +-
 4 files changed, 16 insertions(+), 53 deletions(-)

diff --git a/drivers/media/platform/marvell-ccic/cafe-driver.c 
b/drivers/media/platform/marvell-ccic/cafe-driver.c
index d030f9b..7b07fc5 100644
--- a/drivers/media/platform/marvell-ccic/cafe-driver.c
+++ b/drivers/media/platform/marvell-ccic/cafe-driver.c
@@ -27,7 +27,6 @@
 #include linux/slab.h
 #include linux/videodev2.h
 #include media/v4l2-device.h
-#include media/v4l2-chip-ident.h
 #include linux/device.h
 #include linux/wait.h
 #include linux/delay.h
@@ -469,7 +468,7 @@ static int cafe_pci_probe(struct pci_dev *pdev,
goto out;
cam-pdev = pdev;
mcam = cam-mcam;
-   mcam-chip_id = V4L2_IDENT_CAFE;
+   mcam-chip_id = MCAM_CAFE;
spin_lock_init(mcam-dev_lock);
init_waitqueue_head(cam-smbus_wait);
mcam-plat_power_up = cafe_ctlr_power_up;
diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c 
b/drivers/media/platform/marvell-ccic/mcam-core.c
index 64ab91e..a187161 100644
--- a/drivers/media/platform/marvell-ccic/mcam-core.c
+++ b/drivers/media/platform/marvell-ccic/mcam-core.c
@@ -23,7 +23,6 @@
 #include media/v4l2-device.h
 #include media/v4l2-ioctl.h
 #include media/v4l2-ctrls.h
-#include media/v4l2-chip-ident.h
 #include media/ov7670.h
 #include media/videobuf2-vmalloc.h
 #include media/videobuf2-dma-contig.h
@@ -336,7 +335,7 @@ static void mcam_ctlr_dma_vmalloc(struct mcam_camera *cam)
mcam_reg_clear_bit(cam, REG_CTRL1, C1_TWOBUFS);
} else
mcam_reg_set_bit(cam, REG_CTRL1, C1_TWOBUFS);
-   if (cam-chip_id == V4L2_IDENT_CAFE)
+   if (cam-chip_id == MCAM_CAFE)
mcam_reg_write(cam, REG_UBAR, 0); /* 32 bits only */
 }
 
@@ -796,7 +795,6 @@ static int __mcam_cam_reset(struct mcam_camera *cam)
  */
 static int mcam_cam_init(struct mcam_camera *cam)
 {
-   struct v4l2_dbg_chip_ident chip;
int ret;
 
mutex_lock(cam-s_mutex);
@@ -804,24 +802,8 @@ static int mcam_cam_init(struct mcam_camera *cam)
cam_warn(cam, Cam init with device in funky state %d,
cam-state);
ret = __mcam_cam_reset(cam);
-   if (ret)
-   goto out;
-   chip.ident = V4L2_IDENT_NONE;
-   chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR;
-   chip.match.addr = cam-sensor_addr;
-   ret = sensor_call(cam, core, g_chip_ident, chip);
-   if (ret)
-   goto out;
-   cam-sensor_type = chip.ident;
-   if (cam-sensor_type != V4L2_IDENT_OV7670) {
-   cam_err(cam, Unsupported sensor type 0x%x, cam-sensor_type);
-   ret = -EINVAL;
-   goto out;
-   }
-/* Get/set parameters? */
-   ret = 0;
+   /* Get/set parameters? */
cam-state = S_IDLE;
-out:
mcam_ctlr_power_down(cam);
mutex_unlock(cam-s_mutex);
return ret;
@@ -1392,20 +1374,6 @@ static int mcam_vidioc_s_parm(struct file *filp, void 
*priv,
return ret;
 }
 
-static int mcam_vidioc_g_chip_ident(struct file *file, void *priv,
-   struct v4l2_dbg_chip_ident *chip)
-{
-   struct mcam_camera *cam = priv;
-
-   chip-ident = V4L2_IDENT_NONE;
-   chip-revision = 0;
-   if (v4l2_chip_match_host(chip-match)) {
-   chip-ident = cam-chip_id;
-   return 0;
-   }
-   return sensor_call(cam, core, g_chip_ident, chip);
-}
-
 static int mcam_vidioc_enum_framesizes(struct file *filp, void *priv,
struct v4l2_frmsizeenum *sizes)
 {
@@ -1436,12 +1404,9 @@ static int mcam_vidioc_g_register(struct file *file, 
void *priv,
 {
struct mcam_camera *cam = priv;
 
-   if (v4l2_chip_match_host(reg-match)) {
-   reg-val = mcam_reg_read(cam, reg-reg);
-   reg-size = 4;
-   return 0;
-   }
-   return sensor_call(cam, core, g_register, reg);
+   reg-val = mcam_reg_read(cam, reg-reg);
+   reg-size = 4;
+   return 0;
 }
 
 static int mcam_vidioc_s_register(struct file *file, void *priv,
@@ -1449,11 +1414,8 @@ static int mcam_vidioc_s_register(struct file *file, 
void *priv,
 {
struct mcam_camera *cam = priv;
 
-   if (v4l2_chip_match_host(reg-match)) {
-   mcam_reg_write(cam, reg-reg, reg-val);
-   return 0;
-   }
-   return sensor_call(cam, core, s_register, reg);
+   mcam_reg_write(cam, 

[PATCHv1 14/38] au8522_decoder: remove g_chip_ident op.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

This is no longer needed since the core now handles this through 
DBG_G_CHIP_INFO.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Devin Heitmueller dheitmuel...@kernellabs.com
---
 drivers/media/dvb-frontends/au8522_decoder.c |   17 -
 1 file changed, 17 deletions(-)

diff --git a/drivers/media/dvb-frontends/au8522_decoder.c 
b/drivers/media/dvb-frontends/au8522_decoder.c
index 9d159b4..23a0d05 100644
--- a/drivers/media/dvb-frontends/au8522_decoder.c
+++ b/drivers/media/dvb-frontends/au8522_decoder.c
@@ -35,7 +35,6 @@
 #include linux/i2c.h
 #include linux/delay.h
 #include media/v4l2-common.h
-#include media/v4l2-chip-ident.h
 #include media/v4l2-device.h
 #include au8522.h
 #include au8522_priv.h
@@ -524,11 +523,8 @@ static int au8522_s_ctrl(struct v4l2_ctrl *ctrl)
 static int au8522_g_register(struct v4l2_subdev *sd,
 struct v4l2_dbg_register *reg)
 {
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
struct au8522_state *state = to_state(sd);
 
-   if (!v4l2_chip_match_i2c_client(client, reg-match))
-   return -EINVAL;
reg-val = au8522_readreg(state, reg-reg  0x);
return 0;
 }
@@ -536,11 +532,8 @@ static int au8522_g_register(struct v4l2_subdev *sd,
 static int au8522_s_register(struct v4l2_subdev *sd,
 const struct v4l2_dbg_register *reg)
 {
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
struct au8522_state *state = to_state(sd);
 
-   if (!v4l2_chip_match_i2c_client(client, reg-match))
-   return -EINVAL;
au8522_writereg(state, reg-reg, reg-val  0xff);
return 0;
 }
@@ -632,20 +625,10 @@ static int au8522_g_tuner(struct v4l2_subdev *sd, struct 
v4l2_tuner *vt)
return 0;
 }
 
-static int au8522_g_chip_ident(struct v4l2_subdev *sd,
-  struct v4l2_dbg_chip_ident *chip)
-{
-   struct au8522_state *state = to_state(sd);
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
-
-   return v4l2_chip_ident_i2c_client(client, chip, state-id, state-rev);
-}
-
 /* --- */
 
 static const struct v4l2_subdev_core_ops au8522_core_ops = {
.log_status = v4l2_ctrl_subdev_log_status,
-   .g_chip_ident = au8522_g_chip_ident,
.reset = au8522_reset,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
.g_register = au8522_g_register,
-- 
1.7.10.4

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


[PATCHv1 17/38] soc_camera sensors: remove g_chip_ident op.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

This is no longer needed since the core now handles this through 
DBG_G_CHIP_INFO.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
---
 drivers/media/i2c/soc_camera/imx074.c |   19 
 drivers/media/i2c/soc_camera/mt9m001.c|   33 ++--
 drivers/media/i2c/soc_camera/mt9m111.c|   33 ++--
 drivers/media/i2c/soc_camera/mt9t031.c|   32 ++--
 drivers/media/i2c/soc_camera/mt9t112.c|   16 --
 drivers/media/i2c/soc_camera/mt9v022.c|   47 -
 drivers/media/i2c/soc_camera/ov2640.c |   16 --
 drivers/media/i2c/soc_camera/ov5642.c |   19 
 drivers/media/i2c/soc_camera/ov6650.c |   12 
 drivers/media/i2c/soc_camera/ov772x.c |   16 --
 drivers/media/i2c/soc_camera/ov9640.c |   16 --
 drivers/media/i2c/soc_camera/ov9740.c |   17 ---
 drivers/media/i2c/soc_camera/rj54n1cb0c.c |   31 ++-
 drivers/media/i2c/soc_camera/tw9910.c |   14 -
 14 files changed, 21 insertions(+), 300 deletions(-)

diff --git a/drivers/media/i2c/soc_camera/imx074.c 
b/drivers/media/i2c/soc_camera/imx074.c
index a2a5cbb..a315d43 100644
--- a/drivers/media/i2c/soc_camera/imx074.c
+++ b/drivers/media/i2c/soc_camera/imx074.c
@@ -19,7 +19,6 @@
 
 #include media/soc_camera.h
 #include media/v4l2-subdev.h
-#include media/v4l2-chip-ident.h
 
 /* IMX074 registers */
 
@@ -251,23 +250,6 @@ static int imx074_s_stream(struct v4l2_subdev *sd, int 
enable)
return reg_write(client, MODE_SELECT, !!enable);
 }
 
-static int imx074_g_chip_ident(struct v4l2_subdev *sd,
-  struct v4l2_dbg_chip_ident *id)
-{
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
-
-   if (id-match.type != V4L2_CHIP_MATCH_I2C_ADDR)
-   return -EINVAL;
-
-   if (id-match.addr != client-addr)
-   return -ENODEV;
-
-   id-ident   = V4L2_IDENT_IMX074;
-   id-revision= 0;
-
-   return 0;
-}
-
 static int imx074_s_power(struct v4l2_subdev *sd, int on)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -299,7 +281,6 @@ static struct v4l2_subdev_video_ops imx074_subdev_video_ops 
= {
 };
 
 static struct v4l2_subdev_core_ops imx074_subdev_core_ops = {
-   .g_chip_ident   = imx074_g_chip_ident,
.s_power= imx074_s_power,
 };
 
diff --git a/drivers/media/i2c/soc_camera/mt9m001.c 
b/drivers/media/i2c/soc_camera/mt9m001.c
index dd90898..3f1f437 100644
--- a/drivers/media/i2c/soc_camera/mt9m001.c
+++ b/drivers/media/i2c/soc_camera/mt9m001.c
@@ -17,7 +17,6 @@
 #include media/soc_camera.h
 #include media/soc_mediabus.h
 #include media/v4l2-subdev.h
-#include media/v4l2-chip-ident.h
 #include media/v4l2-ctrls.h
 
 /*
@@ -97,7 +96,6 @@ struct mt9m001 {
const struct mt9m001_datafmt *fmt;
const struct mt9m001_datafmt *fmts;
int num_fmts;
-   int model;  /* V4L2_IDENT_MT9M001* codes from v4l2-chip-ident.h */
unsigned int total_h;
unsigned short y_skip_top;  /* Lines to skip at the top */
 };
@@ -320,36 +318,15 @@ static int mt9m001_try_fmt(struct v4l2_subdev *sd,
return 0;
 }
 
-static int mt9m001_g_chip_ident(struct v4l2_subdev *sd,
-   struct v4l2_dbg_chip_ident *id)
-{
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
-   struct mt9m001 *mt9m001 = to_mt9m001(client);
-
-   if (id-match.type != V4L2_CHIP_MATCH_I2C_ADDR)
-   return -EINVAL;
-
-   if (id-match.addr != client-addr)
-   return -ENODEV;
-
-   id-ident   = mt9m001-model;
-   id-revision= 0;
-
-   return 0;
-}
-
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 static int mt9m001_g_register(struct v4l2_subdev *sd,
  struct v4l2_dbg_register *reg)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
 
-   if (reg-match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg-reg  0xff)
+   if (reg-reg  0xff)
return -EINVAL;
 
-   if (reg-match.addr != client-addr)
-   return -ENODEV;
-
reg-size = 2;
reg-val = reg_read(client, reg-reg);
 
@@ -364,12 +341,9 @@ static int mt9m001_s_register(struct v4l2_subdev *sd,
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
 
-   if (reg-match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg-reg  0xff)
+   if (reg-reg  0xff)
return -EINVAL;
 
-   if (reg-match.addr != client-addr)
-   return -ENODEV;
-
if (reg_write(client, reg-reg, reg-val)  0)
return -EIO;
 
@@ -505,11 +479,9 @@ static int mt9m001_video_probe(struct 
soc_camera_subdev_desc *ssdd,
switch (data) {
case 0x8411:
case 0x8421:
-   mt9m001-model = V4L2_IDENT_MT9M001C12ST;

[PATCHv1 15/38] radio: remove g_chip_ident op.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

This is no longer needed since the core now handles this through 
DBG_G_CHIP_INFO.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/radio/saa7706h.c |   10 --
 drivers/media/radio/tef6862.c  |   14 --
 2 files changed, 24 deletions(-)

diff --git a/drivers/media/radio/saa7706h.c b/drivers/media/radio/saa7706h.c
index 06c06cc..d1f30d6 100644
--- a/drivers/media/radio/saa7706h.c
+++ b/drivers/media/radio/saa7706h.c
@@ -25,7 +25,6 @@
 #include linux/i2c.h
 #include linux/slab.h
 #include media/v4l2-device.h
-#include media/v4l2-chip-ident.h
 
 #define DRIVER_NAME saa7706h
 
@@ -349,16 +348,7 @@ static int saa7706h_s_ctrl(struct v4l2_subdev *sd, struct 
v4l2_control *ctrl)
return -EINVAL;
 }
 
-static int saa7706h_g_chip_ident(struct v4l2_subdev *sd,
-   struct v4l2_dbg_chip_ident *chip)
-{
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
-
-   return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_SAA7706H, 0);
-}
-
 static const struct v4l2_subdev_core_ops saa7706h_core_ops = {
-   .g_chip_ident = saa7706h_g_chip_ident,
.queryctrl = saa7706h_queryctrl,
.g_ctrl = saa7706h_g_ctrl,
.s_ctrl = saa7706h_s_ctrl,
diff --git a/drivers/media/radio/tef6862.c b/drivers/media/radio/tef6862.c
index 82c6c94..d78afbb 100644
--- a/drivers/media/radio/tef6862.c
+++ b/drivers/media/radio/tef6862.c
@@ -25,7 +25,6 @@
 #include linux/slab.h
 #include media/v4l2-ioctl.h
 #include media/v4l2-device.h
-#include media/v4l2-chip-ident.h
 
 #define DRIVER_NAME tef6862
 
@@ -136,14 +135,6 @@ static int tef6862_g_frequency(struct v4l2_subdev *sd, 
struct v4l2_frequency *f)
return 0;
 }
 
-static int tef6862_g_chip_ident(struct v4l2_subdev *sd,
-   struct v4l2_dbg_chip_ident *chip)
-{
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
-
-   return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_TEF6862, 0);
-}
-
 static const struct v4l2_subdev_tuner_ops tef6862_tuner_ops = {
.g_tuner = tef6862_g_tuner,
.s_tuner = tef6862_s_tuner,
@@ -151,12 +142,7 @@ static const struct v4l2_subdev_tuner_ops 
tef6862_tuner_ops = {
.g_frequency = tef6862_g_frequency,
 };
 
-static const struct v4l2_subdev_core_ops tef6862_core_ops = {
-   .g_chip_ident = tef6862_g_chip_ident,
-};
-
 static const struct v4l2_subdev_ops tef6862_ops = {
-   .core = tef6862_core_ops,
.tuner = tef6862_tuner_ops,
 };
 
-- 
1.7.10.4

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


[PATCHv1 27/38] mxb: check register address when reading/writing a register.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Prevent out-of-range register accesses.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/pci/saa7146/mxb.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c
index 8d17769..33abe33 100644
--- a/drivers/media/pci/saa7146/mxb.c
+++ b/drivers/media/pci/saa7146/mxb.c
@@ -669,6 +669,8 @@ static int vidioc_g_register(struct file *file, void *fh, 
struct v4l2_dbg_regist
 {
struct saa7146_dev *dev = ((struct saa7146_fh *)fh)-dev;
 
+   if (reg-reg  pci_resource_len(dev-pci, 0) - 4)
+   return -EINVAL;
reg-val = saa7146_read(dev, reg-reg);
reg-size = 4;
return 0;
@@ -678,6 +680,8 @@ static int vidioc_s_register(struct file *file, void *fh, 
const struct v4l2_dbg_
 {
struct saa7146_dev *dev = ((struct saa7146_fh *)fh)-dev;
 
+   if (reg-reg  pci_resource_len(dev-pci, 0) - 4)
+   return -EINVAL;
saa7146_write(dev, reg-reg, reg-val);
return 0;
 }
-- 
1.7.10.4

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


[PATCHv1 19/38] cx25840: remove the v4l2-chip-ident.h include

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Replace the V4L2_IDENT_ macros from v4l2-chip-ident.h with driver specific
defines.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Andy Walls awa...@md.metrocast.net
---
 drivers/media/i2c/cx25840/cx25840-core.c |   50 +++---
 drivers/media/i2c/cx25840/cx25840-core.h |   34 +---
 2 files changed, 48 insertions(+), 36 deletions(-)

diff --git a/drivers/media/i2c/cx25840/cx25840-core.c 
b/drivers/media/i2c/cx25840/cx25840-core.c
index 6fbdad4..2e3771d 100644
--- a/drivers/media/i2c/cx25840/cx25840-core.c
+++ b/drivers/media/i2c/cx25840/cx25840-core.c
@@ -497,7 +497,7 @@ static void cx23885_initialize(struct i2c_client *client)
 
/* Sys PLL */
switch (state-id) {
-   case V4L2_IDENT_CX23888_AV:
+   case CX23888_AV:
/*
 * 50.0 MHz * (0xb + 0xe8ba26/0x200)/4 = 5 * 28.636363 MHz
 * 572.73 MHz before post divide
@@ -510,7 +510,7 @@ static void cx23885_initialize(struct i2c_client *client)
cx25840_write4(client, 0x42c, 0x4260);
cx25840_write4(client, 0x44c, 0x161f1000);
break;
-   case V4L2_IDENT_CX23887_AV:
+   case CX23887_AV:
/*
 * 25.0 MHz * (0x16 + 0x1d1744c/0x200)/4 = 5 * 28.636363 MHz
 * 572.73 MHz before post divide
@@ -518,7 +518,7 @@ static void cx23885_initialize(struct i2c_client *client)
cx25840_write4(client, 0x11c, 0x01d1744c);
cx25840_write4(client, 0x118, 0x0416);
break;
-   case V4L2_IDENT_CX23885_AV:
+   case CX23885_AV:
default:
/*
 * 28.636363 MHz * (0x14 + 0x0/0x200)/4 = 5 * 28.636363 MHz
@@ -545,7 +545,7 @@ static void cx23885_initialize(struct i2c_client *client)
 
/* HVR1850 */
switch (state-id) {
-   case V4L2_IDENT_CX23888_AV:
+   case CX23888_AV:
/* 888/HVR1250 specific */
cx25840_write4(client, 0x10c, 0x1333);
cx25840_write4(client, 0x108, 0x0515);
@@ -569,7 +569,7 @@ static void cx23885_initialize(struct i2c_client *client)
 * 48 ksps, 16 bits/sample, x16 multiplier = 12.288 MHz
 */
switch (state-id) {
-   case V4L2_IDENT_CX23888_AV:
+   case CX23888_AV:
/*
 * 50.0 MHz * (0x7 + 0x0bedfa4/0x200)/3 = 122.88 MHz
 * 368.64 MHz before post divide
@@ -579,7 +579,7 @@ static void cx23885_initialize(struct i2c_client *client)
cx25840_write4(client, 0x114, 0x017dbf48);
cx25840_write4(client, 0x110, 0x000a030e);
break;
-   case V4L2_IDENT_CX23887_AV:
+   case CX23887_AV:
/*
 * 25.0 MHz * (0xe + 0x17dbf48/0x200)/3 = 122.88 MHz
 * 368.64 MHz before post divide
@@ -588,7 +588,7 @@ static void cx23885_initialize(struct i2c_client *client)
cx25840_write4(client, 0x114, 0x017dbf48);
cx25840_write4(client, 0x110, 0x000a030e);
break;
-   case V4L2_IDENT_CX23885_AV:
+   case CX23885_AV:
default:
/*
 * 28.636363 MHz * (0xc + 0x1bf0c9e/0x200)/3 = 122.88 MHz
@@ -5110,18 +5110,18 @@ static u32 get_cx2388x_ident(struct i2c_client *client)
ret = cx25840_read4(client, 0x300);
if (((ret  0x)  16) == (ret  0x)) {
/* No DIF */
-   ret = V4L2_IDENT_CX23885_AV;
+   ret = CX23885_AV;
} else {
/* CX23887 has a broken DIF, but the registers
 * appear valid (but unused), good enough to detect. */
-   ret = V4L2_IDENT_CX23887_AV;
+   ret = CX23887_AV;
}
} else if (cx25840_read4(client, 0x300)  0x0fff) {
/* DIF PLL Freq Word reg exists; chip must be a CX23888 */
-   ret = V4L2_IDENT_CX23888_AV;
+   ret = CX23888_AV;
} else {
v4l_err(client, Unable to detect h/w, assuming cx23887\n);
-   ret = V4L2_IDENT_CX23887_AV;
+   ret = CX23887_AV;
}
 
/* Back into digital power down */
@@ -5135,7 +5135,7 @@ static int cx25840_probe(struct i2c_client *client,
struct cx25840_state *state;
struct v4l2_subdev *sd;
int default_volume;
-   u32 id = V4L2_IDENT_NONE;
+   u32 id;
u16 device_id;
 
/* Check if the adapter supports the needed features */
@@ -5151,14 +5151,14 @@ static int cx25840_probe(struct i2c_client *client,
/* The high byte of the device ID should be
 * 0x83 for the cx2583x and 0x84 for the cx2584x */
if ((device_id  0xff00) == 0x8300) {
-   id = 

[PATCHv1 12/38] tveeprom: remove v4l2-chip-ident.h include.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Replace the V4L2_IDENT_* usage with tveeprom-specific defines. This header
is deprecated, so those defines shouldn't be used anymore.

The em28xx driver is the only one that uses the tveeprom audio_processor
field, so that has been updated to use the new tveeprom AUDPROC define.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
---
 drivers/media/common/tveeprom.c |  142 ++-
 drivers/media/usb/em28xx/em28xx-cards.c |3 +-
 include/media/tveeprom.h|   11 +++
 3 files changed, 78 insertions(+), 78 deletions(-)

diff --git a/drivers/media/common/tveeprom.c b/drivers/media/common/tveeprom.c
index cc1e172..c7dace6 100644
--- a/drivers/media/common/tveeprom.c
+++ b/drivers/media/common/tveeprom.c
@@ -40,7 +40,6 @@
 #include media/tuner.h
 #include media/tveeprom.h
 #include media/v4l2-common.h
-#include media/v4l2-chip-ident.h
 
 MODULE_DESCRIPTION(i2c Hauppauge eeprom decoder driver);
 MODULE_AUTHOR(John Klar);
@@ -67,13 +66,10 @@ MODULE_PARM_DESC(debug, Debug level (0-1));
  * The Hauppauge eeprom uses an 8bit field to determine which
  * tuner formats the tuner supports.
  */
-static struct HAUPPAUGE_TUNER_FMT
-{
+static const struct {
int id;
-   char *name;
-}
-hauppauge_tuner_fmt[] =
-{
+   const char * const name;
+} hauppauge_tuner_fmt[] = {
{ V4L2_STD_UNKNOWN,UNKNOWN },
{ V4L2_STD_UNKNOWN,FM },
{ V4L2_STD_B|V4L2_STD_GH,  PAL(B/G) },
@@ -88,13 +84,10 @@ hauppauge_tuner_fmt[] =
supplying this information. Note that many tuners where only used for
testing and never made it to the outside world. So you will only see
a subset in actual produced cards. */
-static struct HAUPPAUGE_TUNER
-{
+static const struct {
int  id;
-   char *name;
-}
-hauppauge_tuner[] =
-{
+   const char * const name;
+} hauppauge_tuner[] = {
/* 0-9 */
{ TUNER_ABSENT, None },
{ TUNER_ABSENT, External },
@@ -298,69 +291,66 @@ hauppauge_tuner[] =
{ TUNER_ABSENT, NXP 18272S},
 };
 
-/* Use V4L2_IDENT_AMBIGUOUS for those audio 'chips' that are
+/* Use TVEEPROM_AUDPROC_INTERNAL for those audio 'chips' that are
  * internal to a video chip, i.e. not a separate audio chip. */
-static struct HAUPPAUGE_AUDIOIC
-{
+static const struct {
u32   id;
-   char *name;
-}
-audioIC[] =
-{
+   const char * const name;
+} audio_ic[] = {
/* 0-4 */
-   { V4L2_IDENT_NONE,  None  },
-   { V4L2_IDENT_UNKNOWN,   TEA6300   },
-   { V4L2_IDENT_UNKNOWN,   TEA6320   },
-   { V4L2_IDENT_UNKNOWN,   TDA9850   },
-   { V4L2_IDENT_MSPX4XX,   MSP3400C  },
+   { TVEEPROM_AUDPROC_NONE,  None  },
+   { TVEEPROM_AUDPROC_OTHER, TEA6300   },
+   { TVEEPROM_AUDPROC_OTHER, TEA6320   },
+   { TVEEPROM_AUDPROC_OTHER, TDA9850   },
+   { TVEEPROM_AUDPROC_MSP,   MSP3400C  },
/* 5-9 */
-   { V4L2_IDENT_MSPX4XX,   MSP3410D  },
-   { V4L2_IDENT_MSPX4XX,   MSP3415   },
-   { V4L2_IDENT_MSPX4XX,   MSP3430   },
-   { V4L2_IDENT_MSPX4XX,   MSP3438   },
-   { V4L2_IDENT_UNKNOWN,   CS5331},
+   { TVEEPROM_AUDPROC_MSP,   MSP3410D  },
+   { TVEEPROM_AUDPROC_MSP,   MSP3415   },
+   { TVEEPROM_AUDPROC_MSP,   MSP3430   },
+   { TVEEPROM_AUDPROC_MSP,   MSP3438   },
+   { TVEEPROM_AUDPROC_OTHER, CS5331},
/* 10-14 */
-   { V4L2_IDENT_MSPX4XX,   MSP3435   },
-   { V4L2_IDENT_MSPX4XX,   MSP3440   },
-   { V4L2_IDENT_MSPX4XX,   MSP3445   },
-   { V4L2_IDENT_MSPX4XX,   MSP3411   },
-   { V4L2_IDENT_MSPX4XX,   MSP3416   },
+   { TVEEPROM_AUDPROC_MSP,   MSP3435   },
+   { TVEEPROM_AUDPROC_MSP,   MSP3440   },
+   { TVEEPROM_AUDPROC_MSP,   MSP3445   },
+   { TVEEPROM_AUDPROC_MSP,   MSP3411   },
+   { TVEEPROM_AUDPROC_MSP,   MSP3416   },
/* 15-19 */
-   { V4L2_IDENT_MSPX4XX,   MSP3425   },
-   { V4L2_IDENT_MSPX4XX,   MSP3451   },
-   { V4L2_IDENT_MSPX4XX,   MSP3418   },
-   { V4L2_IDENT_UNKNOWN,   Type 0x12 },
-   { V4L2_IDENT_UNKNOWN,   OKI7716   },
+   { TVEEPROM_AUDPROC_MSP,   MSP3425   },
+   { TVEEPROM_AUDPROC_MSP,   MSP3451   },
+   { TVEEPROM_AUDPROC_MSP,   MSP3418   },
+   { TVEEPROM_AUDPROC_OTHER, Type 0x12 },
+   { TVEEPROM_AUDPROC_OTHER, OKI7716   },
/* 20-24 */
-   { V4L2_IDENT_MSPX4XX,   MSP4410   },
-   { V4L2_IDENT_MSPX4XX,   MSP4420   },
-   { V4L2_IDENT_MSPX4XX,   MSP4440   },
-   { V4L2_IDENT_MSPX4XX,   MSP4450   },
-   { V4L2_IDENT_MSPX4XX,   MSP4408   },
+   { TVEEPROM_AUDPROC_MSP,   MSP4410   },
+   { TVEEPROM_AUDPROC_MSP,   MSP4420   },
+   { TVEEPROM_AUDPROC_MSP,   MSP4440   },
+   { TVEEPROM_AUDPROC_MSP,   MSP4450   },
+   { TVEEPROM_AUDPROC_MSP,   MSP4408   },
/* 

[PATCHv1 34/38] media/i2c: fill in missing reg-size fields.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Prabhakar Lad prabhakar.cse...@gmail.com
Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
---
 drivers/media/i2c/ak881x.c |1 +
 drivers/media/i2c/soc_camera/mt9t031.c |1 +
 drivers/media/i2c/soc_camera/tw9910.c  |1 +
 drivers/media/i2c/tvp7002.c|1 +
 4 files changed, 4 insertions(+)

diff --git a/drivers/media/i2c/ak881x.c b/drivers/media/i2c/ak881x.c
index fcd8a3f..c14e667 100644
--- a/drivers/media/i2c/ak881x.c
+++ b/drivers/media/i2c/ak881x.c
@@ -69,6 +69,7 @@ static int ak881x_g_register(struct v4l2_subdev *sd,
if (reg-reg  0x26)
return -EINVAL;
 
+   reg-size = 1;
reg-val = reg_read(client, reg-reg);
 
if (reg-val  0x)
diff --git a/drivers/media/i2c/soc_camera/mt9t031.c 
b/drivers/media/i2c/soc_camera/mt9t031.c
index 1d2cc27..8f71c9a 100644
--- a/drivers/media/i2c/soc_camera/mt9t031.c
+++ b/drivers/media/i2c/soc_camera/mt9t031.c
@@ -398,6 +398,7 @@ static int mt9t031_g_register(struct v4l2_subdev *sd,
if (reg-reg  0xff)
return -EINVAL;
 
+   reg-size = 1;
reg-val = reg_read(client, reg-reg);
 
if (reg-val  0x)
diff --git a/drivers/media/i2c/soc_camera/tw9910.c 
b/drivers/media/i2c/soc_camera/tw9910.c
index 8a2ac24..b5407df 100644
--- a/drivers/media/i2c/soc_camera/tw9910.c
+++ b/drivers/media/i2c/soc_camera/tw9910.c
@@ -527,6 +527,7 @@ static int tw9910_g_register(struct v4l2_subdev *sd,
if (reg-reg  0xff)
return -EINVAL;
 
+   reg-size = 1;
ret = i2c_smbus_read_byte_data(client, reg-reg);
if (ret  0)
return ret;
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index c2d0280..36ad565 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -722,6 +722,7 @@ static int tvp7002_g_register(struct v4l2_subdev *sd,
 
ret = tvp7002_read(sd, reg-reg  0xff, val);
reg-val = val;
+   reg-size = 1;
return ret;
 }
 
-- 
1.7.10.4

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


[PATCHv1 23/38] DocBook: remove references to the dropped VIDIOC_DBG_G_CHIP_IDENT ioctl.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
---
 Documentation/DocBook/media/v4l/compat.xml |   14 +-
 Documentation/DocBook/media/v4l/v4l2.xml   |   11 +-
 .../DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml  |  271 
 .../DocBook/media/v4l/vidioc-dbg-g-chip-info.xml   |   17 +-
 .../DocBook/media/v4l/vidioc-dbg-g-register.xml|   40 +--
 5 files changed, 24 insertions(+), 329 deletions(-)
 delete mode 100644 Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml

diff --git a/Documentation/DocBook/media/v4l/compat.xml 
b/Documentation/DocBook/media/v4l/compat.xml
index f43542a..0c7195e 100644
--- a/Documentation/DocBook/media/v4l/compat.xml
+++ b/Documentation/DocBook/media/v4l/compat.xml
@@ -2254,7 +2254,7 @@ video encoding./para
   orderedlist
listitem
  paraThe constantVIDIOC_G_CHIP_IDENT/constant ioctl was renamed
-to constantVIDIOC_G_CHIP_IDENT_OLD/constant and VIDIOC-DBG-G-CHIP-IDENT;
+to constantVIDIOC_G_CHIP_IDENT_OLD/constant and 
constantVIDIOC_DBG_G_CHIP_IDENT/constant
 was introduced in its place. The old struct 
structnamev4l2_chip_ident/structname
 was renamed to structname 
id=v4l2-chip-ident-oldv4l2_chip_ident_old/structname./para
/listitem
@@ -2513,6 +2513,16 @@ that used it. It was originally scheduled for removal in 
2.6.35.
   /orderedlist
 /section
 
+section
+  titleV4L2 in Linux 3.11/title
+  orderedlist
+listitem
+ paraRemove obsolete constantVIDIOC_DBG_G_CHIP_IDENT/constant 
ioctl.
+ /para
+/listitem
+  /orderedlist
+/section
+
 section id=other
   titleRelation of V4L2 to other Linux multimedia APIs/title
 
@@ -2596,7 +2606,7 @@ and may change in the future./para
 ioctls./para
 /listitem
 listitem
- paraVIDIOC-DBG-G-CHIP-IDENT; ioctl./para
+ paraVIDIOC-DBG-G-CHIP-INFO; ioctl./para
 /listitem
 listitem
  paraVIDIOC-ENUM-DV-TIMINGS;, VIDIOC-QUERY-DV-TIMINGS; and
diff --git a/Documentation/DocBook/media/v4l/v4l2.xml 
b/Documentation/DocBook/media/v4l/v4l2.xml
index bfc93cd..8469fe1 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -141,6 +141,14 @@ structs, ioctls) must be noted in more detail in the 
history chapter
 applications. --
 
   revision
+   revnumber3.11/revnumber
+   date2013-05-26/date
+   authorinitialshv/authorinitials
+   revremarkRemove obsolete VIDIOC_DBG_G_CHIP_IDENT ioctl.
+   /revremark
+  /revision
+
+  revision
revnumber3.10/revnumber
date2013-03-25/date
authorinitialshv/authorinitials
@@ -493,7 +501,7 @@ and discussions on the V4L mailing list./revremark
 /partinfo
 
 titleVideo for Linux Two API Specification/title
- subtitleRevision 3.9/subtitle
+ subtitleRevision 3.11/subtitle
 
   chapter id=common
 sub-common;
@@ -547,7 +555,6 @@ and discussions on the V4L mailing list./revremark
 !-- All ioctls go here. --
 sub-create-bufs;
 sub-cropcap;
-sub-dbg-g-chip-ident;
 sub-dbg-g-chip-info;
 sub-dbg-g-register;
 sub-decoder-cmd;
diff --git a/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml 
b/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml
deleted file mode 100644
index 921e185..000
--- a/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-ident.xml
+++ /dev/null
@@ -1,271 +0,0 @@
-refentry id=vidioc-dbg-g-chip-ident
-  refmeta
-refentrytitleioctl VIDIOC_DBG_G_CHIP_IDENT/refentrytitle
-manvol;
-  /refmeta
-
-  refnamediv
-refnameVIDIOC_DBG_G_CHIP_IDENT/refname
-refpurposeIdentify the chips on a TV card/refpurpose
-  /refnamediv
-
-  refsynopsisdiv
-funcsynopsis
-  funcprototype
-   funcdefint functionioctl/function/funcdef
-   paramdefint parameterfd/parameter/paramdef
-   paramdefint parameterrequest/parameter/paramdef
-   paramdefstruct v4l2_dbg_chip_ident
-*parameterargp/parameter/paramdef
-  /funcprototype
-/funcsynopsis
-  /refsynopsisdiv
-
-  refsect1
-titleArguments/title
-
-variablelist
-  varlistentry
-   termparameterfd/parameter/term
-   listitem
- parafd;/para
-   /listitem
-  /varlistentry
-  varlistentry
-   termparameterrequest/parameter/term
-   listitem
- paraVIDIOC_DBG_G_CHIP_IDENT/para
-   /listitem
-  /varlistentry
-  varlistentry
-   termparameterargp/parameter/term
-   listitem
- para/para
-   /listitem
-  /varlistentry
-/variablelist
-  /refsect1
-
-  refsect1
-titleDescription/title
-
-note
-  titleExperimental/title
-
-  paraThis is an link
-linkend=experimentalexperimental/link interface and may change in
-the future./para
-/note
-
-paraFor driver debugging purposes this ioctl allows test
-applications to query the driver 

[PATCHv1 26/38] saa7134: check register address in g_register.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Prevent reading out-of-range register values.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
---
 drivers/media/pci/saa7134/saa7134-video.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/saa7134/saa7134-video.c 
b/drivers/media/pci/saa7134/saa7134-video.c
index 737e643..db4cc1c 100644
--- a/drivers/media/pci/saa7134/saa7134-video.c
+++ b/drivers/media/pci/saa7134/saa7134-video.c
@@ -2258,7 +2258,7 @@ static int vidioc_g_register (struct file *file, void 
*priv,
struct saa7134_fh *fh = priv;
struct saa7134_dev *dev = fh-dev;
 
-   reg-val = saa_readb(reg-reg);
+   reg-val = saa_readb(reg-reg  0xff);
reg-size = 1;
return 0;
 }
@@ -2269,7 +2269,7 @@ static int vidioc_s_register (struct file *file, void 
*priv,
struct saa7134_fh *fh = priv;
struct saa7134_dev *dev = fh-dev;
 
-   saa_writeb(reg-reg0xff, reg-val);
+   saa_writeb(reg-reg  0xff, reg-val);
return 0;
 }
 #endif
-- 
1.7.10.4

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


[PATCHv1 22/38] v4l2-core: remove support for obsolete VIDIOC_DBG_G_CHIP_IDENT.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

This has been replaced by the new and much better VIDIOC_DBG_G_CHIP_INFO.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
---
 drivers/media/v4l2-core/v4l2-compat-ioctl32.c |1 -
 drivers/media/v4l2-core/v4l2-dev.c|1 -
 drivers/media/v4l2-core/v4l2-ioctl.c  |   28 --
 include/media/v4l2-chip-ident.h   |  354 -
 include/media/v4l2-ioctl.h|2 -
 include/media/v4l2-subdev.h   |4 +-
 include/uapi/linux/videodev2.h|   17 +-
 7 files changed, 4 insertions(+), 403 deletions(-)
 delete mode 100644 include/media/v4l2-chip-ident.h

diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 
b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index f129551..8f7a6a4 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -1074,7 +1074,6 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int 
cmd, unsigned long arg)
case VIDIOC_TRY_DECODER_CMD:
case VIDIOC_DBG_S_REGISTER:
case VIDIOC_DBG_G_REGISTER:
-   case VIDIOC_DBG_G_CHIP_IDENT:
case VIDIOC_S_HW_FREQ_SEEK:
case VIDIOC_S_DV_TIMINGS:
case VIDIOC_G_DV_TIMINGS:
diff --git a/drivers/media/v4l2-core/v4l2-dev.c 
b/drivers/media/v4l2-core/v4l2-dev.c
index 5923c5d..fb3fcde 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -596,7 +596,6 @@ static void determine_valid_ioctls(struct video_device 
*vdev)
set_bit(_IOC_NR(VIDIOC_DBG_G_REGISTER), valid_ioctls);
set_bit(_IOC_NR(VIDIOC_DBG_S_REGISTER), valid_ioctls);
 #endif
-   SET_VALID_IOCTL(ops, VIDIOC_DBG_G_CHIP_IDENT, vidioc_g_chip_ident);
/* yes, really vidioc_subscribe_event */
SET_VALID_IOCTL(ops, VIDIOC_DQEVENT, vidioc_subscribe_event);
SET_VALID_IOCTL(ops, VIDIOC_SUBSCRIBE_EVENT, vidioc_subscribe_event);
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index 60b8c25..7a7f5f0 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -26,7 +26,6 @@
 #include media/v4l2-fh.h
 #include media/v4l2-event.h
 #include media/v4l2-device.h
-#include media/v4l2-chip-ident.h
 #include media/videobuf2-core.h
 
 /* Zero out the end of the struct pointed to by p.  Everything after, but
@@ -624,20 +623,6 @@ static void v4l_print_decoder_cmd(const void *arg, bool 
write_only)
pr_info(pts=%llu\n, p-stop.pts);
 }
 
-static void v4l_print_dbg_chip_ident(const void *arg, bool write_only)
-{
-   const struct v4l2_dbg_chip_ident *p = arg;
-
-   pr_cont(type=%u, , p-match.type);
-   if (p-match.type == V4L2_CHIP_MATCH_I2C_DRIVER)
-   pr_cont(name=%.*s, ,
-   (int)sizeof(p-match.name), p-match.name);
-   else
-   pr_cont(addr=%u, , p-match.addr);
-   pr_cont(chip_ident=%u, revision=0x%x\n,
-   p-ident, p-revision);
-}
-
 static void v4l_print_dbg_chip_info(const void *arg, bool write_only)
 {
const struct v4l2_dbg_chip_info *p = arg;
@@ -1844,18 +1829,6 @@ static int v4l_dbg_s_register(const struct 
v4l2_ioctl_ops *ops,
 #endif
 }
 
-static int v4l_dbg_g_chip_ident(const struct v4l2_ioctl_ops *ops,
-   struct file *file, void *fh, void *arg)
-{
-   struct v4l2_dbg_chip_ident *p = arg;
-
-   p-ident = V4L2_IDENT_NONE;
-   p-revision = 0;
-   if (p-match.type == V4L2_CHIP_MATCH_SUBDEV)
-   return -EINVAL;
-   return ops-vidioc_g_chip_ident(file, fh, p);
-}
-
 static int v4l_dbg_g_chip_info(const struct v4l2_ioctl_ops *ops,
struct file *file, void *fh, void *arg)
 {
@@ -2105,7 +2078,6 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
IOCTL_INFO_STD(VIDIOC_TRY_DECODER_CMD, vidioc_try_decoder_cmd, 
v4l_print_decoder_cmd, 0),
IOCTL_INFO_FNC(VIDIOC_DBG_S_REGISTER, v4l_dbg_s_register, 
v4l_print_dbg_register, 0),
IOCTL_INFO_FNC(VIDIOC_DBG_G_REGISTER, v4l_dbg_g_register, 
v4l_print_dbg_register, 0),
-   IOCTL_INFO_FNC(VIDIOC_DBG_G_CHIP_IDENT, v4l_dbg_g_chip_ident, 
v4l_print_dbg_chip_ident, 0),
IOCTL_INFO_FNC(VIDIOC_S_HW_FREQ_SEEK, v4l_s_hw_freq_seek, 
v4l_print_hw_freq_seek, INFO_FL_PRIO),
IOCTL_INFO_STD(VIDIOC_S_DV_TIMINGS, vidioc_s_dv_timings, 
v4l_print_dv_timings, INFO_FL_PRIO),
IOCTL_INFO_STD(VIDIOC_G_DV_TIMINGS, vidioc_g_dv_timings, 
v4l_print_dv_timings, 0),
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
deleted file mode 100644
index 543f89c..000
--- a/include/media/v4l2-chip-ident.h
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
-v4l2 chip identifiers header
-
-This header provides a list of chip identifiers that can be returned
-through the VIDIOC_DBG_G_CHIP_IDENT ioctl.

[PATCHv1 35/38] cx18: fix register range check

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Ensure that the register is aligned to a dword, otherwise the range check
could fail since it assumes dword alignment.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Andy Walls awa...@md.metrocast.net
---
 drivers/media/pci/cx18/cx18-ioctl.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/pci/cx18/cx18-ioctl.c 
b/drivers/media/pci/cx18/cx18-ioctl.c
index 414b0ec..1110bcb 100644
--- a/drivers/media/pci/cx18/cx18-ioctl.c
+++ b/drivers/media/pci/cx18/cx18-ioctl.c
@@ -367,6 +367,8 @@ static int cx18_g_register(struct file *file, void *fh,
 {
struct cx18 *cx = fh2id(fh)-cx;
 
+   if (reg-reg  0x3)
+   return -EINVAL;
if (reg-reg = CX18_MEM_OFFSET + CX18_MEM_SIZE)
return -EINVAL;
reg-size = 4;
@@ -379,6 +381,8 @@ static int cx18_s_register(struct file *file, void *fh,
 {
struct cx18 *cx = fh2id(fh)-cx;
 
+   if (reg-reg  0x3)
+   return -EINVAL;
if (reg-reg = CX18_MEM_OFFSET + CX18_MEM_SIZE)
return -EINVAL;
cx18_write_enc(cx, reg-val, reg-reg);
-- 
1.7.10.4

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


[PATCHv1 37/38] ivtv: fix register range check

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Ensure that the register is aligned to a dword, otherwise the range check
could fail since it assumes dword alignment.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Andy Walls awa...@md.metrocast.net
---
 drivers/media/pci/ivtv/ivtv-ioctl.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c 
b/drivers/media/pci/ivtv/ivtv-ioctl.c
index 944300f..807b275 100644
--- a/drivers/media/pci/ivtv/ivtv-ioctl.c
+++ b/drivers/media/pci/ivtv/ivtv-ioctl.c
@@ -696,6 +696,8 @@ static int ivtv_itvc(struct ivtv *itv, bool get, u64 reg, 
u64 *val)
 {
volatile u8 __iomem *reg_start;
 
+   if (reg  0x3)
+   return -EINVAL;
if (reg = IVTV_REG_OFFSET  reg  IVTV_REG_OFFSET + IVTV_REG_SIZE)
reg_start = itv-reg_mem - IVTV_REG_OFFSET;
else if (itv-has_cx23415  reg = IVTV_DECODER_OFFSET 
-- 
1.7.10.4

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


[PATCHv1 30/38] au0828: set reg-size.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

The size field wasn't filled in.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Devin Heitmueller dheitmuel...@kernellabs.com
---
 drivers/media/usb/au0828/au0828-video.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/usb/au0828/au0828-video.c 
b/drivers/media/usb/au0828/au0828-video.c
index 4944a36..f615454 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -1759,6 +1759,7 @@ static int vidioc_g_register(struct file *file, void 
*priv,
struct au0828_dev *dev = fh-dev;
 
reg-val = au0828_read(dev, reg-reg);
+   reg-size = 1;
return 0;
 }
 
-- 
1.7.10.4

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


[PATCHv1 08/38] saa6752hs: drop obsolete g_chip_ident.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

This op and the v4l2-chip-ident.h header are no longer needed.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
---
 drivers/media/pci/saa7134/saa6752hs.c |   14 --
 1 file changed, 14 deletions(-)

diff --git a/drivers/media/pci/saa7134/saa6752hs.c 
b/drivers/media/pci/saa7134/saa6752hs.c
index f147b05..244b286 100644
--- a/drivers/media/pci/saa7134/saa6752hs.c
+++ b/drivers/media/pci/saa7134/saa6752hs.c
@@ -35,7 +35,6 @@
 #include linux/videodev2.h
 #include media/v4l2-device.h
 #include media/v4l2-common.h
-#include media/v4l2-chip-ident.h
 #include linux/init.h
 #include linux/crc32.h
 
@@ -92,7 +91,6 @@ static const struct v4l2_format v4l2_format_table[] =
 
 struct saa6752hs_state {
struct v4l2_subdevsd;
-   int   chip;
u32   revision;
int   has_ac3;
struct saa6752hs_mpeg_params  params;
@@ -914,19 +912,9 @@ static int saa6752hs_s_std(struct v4l2_subdev *sd, 
v4l2_std_id std)
return 0;
 }
 
-static int saa6752hs_g_chip_ident(struct v4l2_subdev *sd, struct 
v4l2_dbg_chip_ident *chip)
-{
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
-   struct saa6752hs_state *h = to_state(sd);
-
-   return v4l2_chip_ident_i2c_client(client,
-   chip, h-chip, h-revision);
-}
-
 /* --- */
 
 static const struct v4l2_subdev_core_ops saa6752hs_core_ops = {
-   .g_chip_ident = saa6752hs_g_chip_ident,
.init = saa6752hs_init,
.queryctrl = saa6752hs_queryctrl,
.querymenu = saa6752hs_querymenu,
@@ -963,11 +951,9 @@ static int saa6752hs_probe(struct i2c_client *client,
 
i2c_master_send(client, addr, 1);
i2c_master_recv(client, data, sizeof(data));
-   h-chip = V4L2_IDENT_SAA6752HS;
h-revision = (data[8]  8) | data[9];
h-has_ac3 = 0;
if (h-revision == 0x0206) {
-   h-chip = V4L2_IDENT_SAA6752HS_AC3;
h-has_ac3 = 1;
v4l_info(client, support AC-3\n);
}
-- 
1.7.10.4

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


[PATCHv1 21/38] v4l2-int-device: remove unused chip_ident reference.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
---
 include/media/v4l2-int-device.h |3 ---
 1 file changed, 3 deletions(-)

diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h
index e6aa231..0286c95 100644
--- a/include/media/v4l2-int-device.h
+++ b/include/media/v4l2-int-device.h
@@ -220,8 +220,6 @@ enum v4l2_int_ioctl_num {
vidioc_int_reset_num,
/* VIDIOC_INT_INIT */
vidioc_int_init_num,
-   /* VIDIOC_DBG_G_CHIP_IDENT */
-   vidioc_int_g_chip_ident_num,
 
/*
 *
@@ -303,6 +301,5 @@ V4L2_INT_WRAPPER_1(enum_frameintervals, struct 
v4l2_frmivalenum, *);
 
 V4L2_INT_WRAPPER_0(reset);
 V4L2_INT_WRAPPER_0(init);
-V4L2_INT_WRAPPER_1(g_chip_ident, int, *);
 
 #endif
-- 
1.7.10.4

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


[PATCHv1 28/38] vpbe_display: drop g/s_register ioctls.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

These are no longer needed: register access to subdevices no longer needs
the bridge driver to forward them.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Prabhakar Lad prabhakar.cse...@gmail.com
---
 drivers/media/platform/davinci/vpbe_display.c |   29 -
 1 file changed, 29 deletions(-)

diff --git a/drivers/media/platform/davinci/vpbe_display.c 
b/drivers/media/platform/davinci/vpbe_display.c
index 1c4ba89..48cb0da 100644
--- a/drivers/media/platform/davinci/vpbe_display.c
+++ b/drivers/media/platform/davinci/vpbe_display.c
@@ -1578,31 +1578,6 @@ static int vpbe_display_release(struct file *file)
return 0;
 }
 
-#ifdef CONFIG_VIDEO_ADV_DEBUG
-static int vpbe_display_g_register(struct file *file, void *priv,
-   struct v4l2_dbg_register *reg)
-{
-   struct v4l2_dbg_match *match = reg-match;
-   struct vpbe_fh *fh = file-private_data;
-   struct vpbe_device *vpbe_dev = fh-disp_dev-vpbe_dev;
-
-   if (match-type = 2) {
-   v4l2_subdev_call(vpbe_dev-venc,
-core,
-g_register,
-reg);
-   }
-
-   return 0;
-}
-
-static int vpbe_display_s_register(struct file *file, void *priv,
-   const struct v4l2_dbg_register *reg)
-{
-   return 0;
-}
-#endif
-
 /* vpbe capture ioctl operations */
 static const struct v4l2_ioctl_ops vpbe_ioctl_ops = {
.vidioc_querycap = vpbe_display_querycap,
@@ -1629,10 +1604,6 @@ static const struct v4l2_ioctl_ops vpbe_ioctl_ops = {
.vidioc_s_dv_timings = vpbe_display_s_dv_timings,
.vidioc_g_dv_timings = vpbe_display_g_dv_timings,
.vidioc_enum_dv_timings  = vpbe_display_enum_dv_timings,
-#ifdef CONFIG_VIDEO_ADV_DEBUG
-   .vidioc_g_register   = vpbe_display_g_register,
-   .vidioc_s_register   = vpbe_display_s_register,
-#endif
 };
 
 static struct v4l2_file_operations vpbe_fops = {
-- 
1.7.10.4

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


[PATCHv1 24/38] v4l2-framework: replace g_chip_ident by g_std in the examples.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

The framework documentation used the g_chip_ident op as an example. This
op has been removed, so replace its use in the examples by the g_std op.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
---
 Documentation/video4linux/v4l2-framework.txt   |   13 ++---
 Documentation/zh_CN/video4linux/v4l2-framework.txt |   13 ++---
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/Documentation/video4linux/v4l2-framework.txt 
b/Documentation/video4linux/v4l2-framework.txt
index a300b28..24353ec 100644
--- a/Documentation/video4linux/v4l2-framework.txt
+++ b/Documentation/video4linux/v4l2-framework.txt
@@ -246,7 +246,6 @@ may be NULL if the subdev driver does not support anything 
from that category.
 It looks like this:
 
 struct v4l2_subdev_core_ops {
-   int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident 
*chip);
int (*log_status)(struct v4l2_subdev *sd);
int (*init)(struct v4l2_subdev *sd, u32 val);
...
@@ -346,24 +345,24 @@ Afterwards the subdev module can be unloaded and sd-dev 
== NULL.
 
 You can call an ops function either directly:
 
-   err = sd-ops-core-g_chip_ident(sd, chip);
+   err = sd-ops-core-g_std(sd, norm);
 
 but it is better and easier to use this macro:
 
-   err = v4l2_subdev_call(sd, core, g_chip_ident, chip);
+   err = v4l2_subdev_call(sd, core, g_std, norm);
 
 The macro will to the right NULL pointer checks and returns -ENODEV if subdev
-is NULL, -ENOIOCTLCMD if either subdev-core or subdev-core-g_chip_ident is
-NULL, or the actual result of the subdev-ops-core-g_chip_ident ops.
+is NULL, -ENOIOCTLCMD if either subdev-core or subdev-core-g_std is
+NULL, or the actual result of the subdev-ops-core-g_std ops.
 
 It is also possible to call all or a subset of the sub-devices:
 
-   v4l2_device_call_all(v4l2_dev, 0, core, g_chip_ident, chip);
+   v4l2_device_call_all(v4l2_dev, 0, core, g_std, norm);
 
 Any subdev that does not support this ops is skipped and error results are
 ignored. If you want to check for errors use this:
 
-   err = v4l2_device_call_until_err(v4l2_dev, 0, core, g_chip_ident, 
chip);
+   err = v4l2_device_call_until_err(v4l2_dev, 0, core, g_std, norm);
 
 Any error except -ENOIOCTLCMD will exit the loop with that error. If no
 errors (except -ENOIOCTLCMD) occurred, then 0 is returned.
diff --git a/Documentation/zh_CN/video4linux/v4l2-framework.txt 
b/Documentation/zh_CN/video4linux/v4l2-framework.txt
index 44c1d93..0da95db 100644
--- a/Documentation/zh_CN/video4linux/v4l2-framework.txt
+++ b/Documentation/zh_CN/video4linux/v4l2-framework.txt
@@ -247,7 +247,6 @@ i2c_client 结构体,i2c_set_clientdata() 函数可用于保存一个 v4l2_sub
 这些结构体定义如下:
 
 struct v4l2_subdev_core_ops {
-   int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident 
*chip);
int (*log_status)(struct v4l2_subdev *sd);
int (*init)(struct v4l2_subdev *sd, u32 val);
...
@@ -337,24 +336,24 @@ subdev-dev 域就指向了 v4l2_device。
 
 注册之设备后,可通过以下方式直接调用其操作函数:
 
-   err = sd-ops-core-g_chip_ident(sd, chip);
+   err = sd-ops-core-g_std(sd, norm);
 
 但使用如下宏会比较容易且合适:
 
-   err = v4l2_subdev_call(sd, core, g_chip_ident, chip);
+   err = v4l2_subdev_call(sd, core, g_std, norm);
 
 这个宏将会做 NULL 指针检查,如果 subdev 为 NULL,则返回-ENODEV;如果
-subdev-core 或 subdev-core-g_chip_ident 为 NULL,则返回 -ENOIOCTLCMD;
-否则将返回 subdev-ops-core-g_chip_ident ops 调用的实际结果。
+subdev-core 或 subdev-core-g_std 为 NULL,则返回 -ENOIOCTLCMD;
+否则将返回 subdev-ops-core-g_std ops 调用的实际结果。
 
 有时也可能同时调用所有或一系列子设备的某个操作函数:
 
-   v4l2_device_call_all(v4l2_dev, 0, core, g_chip_ident, chip);
+   v4l2_device_call_all(v4l2_dev, 0, core, g_std, norm);
 
 任何不支持此操作的子设备都会被跳过,并忽略错误返回值。但如果你需要
 检查出错码,则可使用如下函数:
 
-   err = v4l2_device_call_until_err(v4l2_dev, 0, core, g_chip_ident, 
chip);
+   err = v4l2_device_call_until_err(v4l2_dev, 0, core, g_std, norm);
 
 除 -ENOIOCTLCMD 外的任何错误都会跳出循环并返回错误值。如果(除 -ENOIOCTLCMD
 外)没有错误发生,则返回 0。
-- 
1.7.10.4

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


[PATCHv1 33/38] pvrusb2: drop g/s_register ioctls.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Register access to subdevices no longer needs bridge support for those
ioctls. The v4l2 core handles that these days.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Mike Isely is...@isely.net
---
 drivers/media/usb/pvrusb2/pvrusb2-hdw.c  |   36 --
 drivers/media/usb/pvrusb2/pvrusb2-hdw.h  |9 
 drivers/media/usb/pvrusb2/pvrusb2-v4l2.c |   34 
 3 files changed, 79 deletions(-)

diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c 
b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
index 01d1c2d..d329209 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
@@ -5162,39 +5162,3 @@ static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw)
} while(0); LOCK_GIVE(hdw-ctl_lock);
return result;
 }
-
-
-int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
-const struct v4l2_dbg_match *match, u64 reg_id,
-int setFl, u64 *val_ptr)
-{
-#ifdef CONFIG_VIDEO_ADV_DEBUG
-   struct v4l2_dbg_register req;
-   int stat = 0;
-   int okFl = 0;
-
-   req.match = *match;
-   req.reg = reg_id;
-   if (setFl) req.val = *val_ptr;
-   /* It would be nice to know if a sub-device answered the request */
-   v4l2_device_call_all(hdw-v4l2_dev, 0, core, g_register, req);
-   if (!setFl) *val_ptr = req.val;
-   if (okFl) {
-   return stat;
-   }
-   return -EINVAL;
-#else
-   return -ENOSYS;
-#endif
-}
-
-
-/*
-  Stuff for Emacs to see, in order to encourage consistent editing style:
-  *** Local Variables: ***
-  *** mode: c ***
-  *** fill-column: 75 ***
-  *** tab-width: 8 ***
-  *** c-basic-offset: 8 ***
-  *** End: ***
-  */
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.h 
b/drivers/media/usb/pvrusb2/pvrusb2-hdw.h
index 91bae93..1a135cf 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.h
+++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.h
@@ -234,15 +234,6 @@ int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *,enum 
pvr2_v4l_type index);
 void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,
 enum pvr2_v4l_type index,int);
 
-/* Direct read/write access to chip's registers:
-   match - specify criteria to identify target chip (this is a v4l dbg struct)
-   reg_id  - register number to access
-   setFl   - true to set the register, false to read it
-   val_ptr - storage location for source / result. */
-int pvr2_hdw_register_access(struct pvr2_hdw *,
-const struct v4l2_dbg_match *match, u64 reg_id,
-int setFl, u64 *val_ptr);
-
 /* The following entry points are all lower level things you normally don't
want to worry about. */
 
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c 
b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
index a8a65fa..82f619b 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c
@@ -800,36 +800,6 @@ static int pvr2_log_status(struct file *file, void *priv)
return 0;
 }
 
-#ifdef CONFIG_VIDEO_ADV_DEBUG
-static int pvr2_g_register(struct file *file, void *priv, struct 
v4l2_dbg_register *req)
-{
-   struct pvr2_v4l2_fh *fh = file-private_data;
-   struct pvr2_hdw *hdw = fh-channel.mc_head-hdw;
-   u64 val;
-   int ret;
-
-   ret = pvr2_hdw_register_access(
-   hdw, req-match, req-reg,
-   0, val);
-   req-val = val;
-   return ret;
-}
-
-static int pvr2_s_register(struct file *file, void *priv, const struct 
v4l2_dbg_register *req)
-{
-   struct pvr2_v4l2_fh *fh = file-private_data;
-   struct pvr2_hdw *hdw = fh-channel.mc_head-hdw;
-   u64 val;
-   int ret;
-
-   val = req-val;
-   ret = pvr2_hdw_register_access(
-   hdw, req-match, req-reg,
-   1, val);
-   return ret;
-}
-#endif
-
 static const struct v4l2_ioctl_ops pvr2_ioctl_ops = {
.vidioc_querycap= pvr2_querycap,
.vidioc_g_priority  = pvr2_g_priority,
@@ -864,10 +834,6 @@ static const struct v4l2_ioctl_ops pvr2_ioctl_ops = {
.vidioc_g_ext_ctrls = pvr2_g_ext_ctrls,
.vidioc_s_ext_ctrls = pvr2_s_ext_ctrls,
.vidioc_try_ext_ctrls   = pvr2_try_ext_ctrls,
-#ifdef CONFIG_VIDEO_ADV_DEBUG
-   .vidioc_g_register  = pvr2_g_register,
-   .vidioc_s_register  = pvr2_s_register,
-#endif
 };
 
 static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip)
-- 
1.7.10.4

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


[PATCHv1 31/38] cx231xx: the reg-size field wasn't filled in.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
---
 drivers/media/usb/cx231xx/cx231xx-video.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index 54cdd4d..9906261 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -1272,36 +1272,43 @@ int cx231xx_g_register(struct file *file, void *priv,
(u16)reg-reg, value, 4);
reg-val = value[0] | value[1]  8 |
value[2]  16 | value[3]  24;
+   reg-size = 4;
break;
case 1: /* AFE - read byte */
ret = cx231xx_read_i2c_data(dev, AFE_DEVICE_ADDRESS,
(u16)reg-reg, 2, data, 1);
reg-val = data;
+   reg-size = 1;
break;
case 2: /* Video Block - read byte */
ret = cx231xx_read_i2c_data(dev, VID_BLK_I2C_ADDRESS,
(u16)reg-reg, 2, data, 1);
reg-val = data;
+   reg-size = 1;
break;
case 3: /* I2S block - read byte */
ret = cx231xx_read_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS,
(u16)reg-reg, 1, data, 1);
reg-val = data;
+   reg-size = 1;
break;
case 4: /* AFE - read dword */
ret = cx231xx_read_i2c_data(dev, AFE_DEVICE_ADDRESS,
(u16)reg-reg, 2, data, 4);
reg-val = data;
+   reg-size = 4;
break;
case 5: /* Video Block - read dword */
ret = cx231xx_read_i2c_data(dev, VID_BLK_I2C_ADDRESS,
(u16)reg-reg, 2, data, 4);
reg-val = data;
+   reg-size = 4;
break;
case 6: /* I2S Block - read dword */
ret = cx231xx_read_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS,
(u16)reg-reg, 1, data, 4);
reg-val = data;
+   reg-size = 4;
break;
default:
return -EINVAL;
-- 
1.7.10.4

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


[PATCHv1 32/38] sn9c20x: the reg-size field wasn't filled in.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Hans de Goede hdego...@redhat.com
Cc: Brian Johnson brij...@gmail.com
---
 drivers/media/usb/gspca/sn9c20x.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/usb/gspca/sn9c20x.c 
b/drivers/media/usb/gspca/sn9c20x.c
index 23b71f9..f4453d5 100644
--- a/drivers/media/usb/gspca/sn9c20x.c
+++ b/drivers/media/usb/gspca/sn9c20x.c
@@ -1557,6 +1557,7 @@ static int sd_dbg_g_register(struct gspca_dev *gspca_dev,
 {
struct sd *sd = (struct sd *) gspca_dev;
 
+   reg-size = 1;
switch (reg-match.addr) {
case 0:
if (reg-reg  0x1000 || reg-reg  0x11ff)
@@ -1568,6 +1569,7 @@ static int sd_dbg_g_register(struct gspca_dev *gspca_dev,
if (sd-sensor = SENSOR_MT9V011 
sd-sensor = SENSOR_MT9M112) {
i2c_r2(gspca_dev, reg-reg, (u16 *) reg-val);
+   reg-size = 2;
} else {
i2c_r1(gspca_dev, reg-reg, (u8 *) reg-val);
}
-- 
1.7.10.4

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


[PATCHv1 20/38] v4l2-common: remove unused v4l2_chip_match/ident_i2c_client functions

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
---
 drivers/media/v4l2-core/v4l2-common.c |   47 +
 include/media/v4l2-common.h   |9 ---
 2 files changed, 1 insertion(+), 55 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-common.c 
b/drivers/media/v4l2-core/v4l2-common.c
index 5fd7660..3b2a760 100644
--- a/drivers/media/v4l2-core/v4l2-common.c
+++ b/drivers/media/v4l2-core/v4l2-common.c
@@ -61,7 +61,6 @@
 #include media/v4l2-common.h
 #include media/v4l2-device.h
 #include media/v4l2-ctrls.h
-#include media/v4l2-chip-ident.h
 
 #include linux/videodev2.h
 
@@ -227,51 +226,9 @@ u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 
id)
 }
 EXPORT_SYMBOL(v4l2_ctrl_next);
 
-#if IS_ENABLED(CONFIG_I2C)
-int v4l2_chip_match_i2c_client(struct i2c_client *c, const struct 
v4l2_dbg_match *match)
-{
-   int len;
-
-   if (c == NULL || match == NULL)
-   return 0;
-
-   switch (match-type) {
-   case V4L2_CHIP_MATCH_I2C_DRIVER:
-   if (c-driver == NULL || c-driver-driver.name == NULL)
-   return 0;
-   len = strlen(c-driver-driver.name);
-   return len  !strncmp(c-driver-driver.name, match-name, 
len);
-   case V4L2_CHIP_MATCH_I2C_ADDR:
-   return c-addr == match-addr;
-   case V4L2_CHIP_MATCH_SUBDEV:
-   return 1;
-   default:
-   return 0;
-   }
-}
-EXPORT_SYMBOL(v4l2_chip_match_i2c_client);
-
-int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct 
v4l2_dbg_chip_ident *chip,
-   u32 ident, u32 revision)
-{
-   if (!v4l2_chip_match_i2c_client(c, chip-match))
-   return 0;
-   if (chip-ident == V4L2_IDENT_NONE) {
-   chip-ident = ident;
-   chip-revision = revision;
-   }
-   else {
-   chip-ident = V4L2_IDENT_AMBIGUOUS;
-   chip-revision = 0;
-   }
-   return 0;
-}
-EXPORT_SYMBOL(v4l2_chip_ident_i2c_client);
-
-/* - */
-
 /* I2C Helper functions */
 
+#if IS_ENABLED(CONFIG_I2C)
 
 void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client,
const struct v4l2_subdev_ops *ops)
@@ -290,8 +247,6 @@ void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct 
i2c_client *client,
 }
 EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_init);
 
-
-
 /* Load an i2c sub-device. */
 struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev,
struct i2c_adapter *adapter, struct i2c_board_info *info,
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index e7821fb..015ff82 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -100,15 +100,6 @@ u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 
id);
 
 /* - */
 
-/* Register/chip ident helper function */
-
-struct i2c_client; /* forward reference */
-int v4l2_chip_match_i2c_client(struct i2c_client *c, const struct 
v4l2_dbg_match *match);
-int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct 
v4l2_dbg_chip_ident *chip,
-   u32 ident, u32 revision);
-
-/* - */
-
 /* I2C Helper functions */
 
 struct i2c_driver;
-- 
1.7.10.4

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


[PATCH for v3.10] DocBook/media/v4l: update version number.

2013-05-29 Thread Hans Verkuil
The version number was still 3.9: update to 3.10.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 Documentation/DocBook/media/v4l/v4l2.xml |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/v4l2.xml 
b/Documentation/DocBook/media/v4l/v4l2.xml
index bfc93cd..bfe823d 100644
--- a/Documentation/DocBook/media/v4l/v4l2.xml
+++ b/Documentation/DocBook/media/v4l/v4l2.xml
@@ -493,7 +493,7 @@ and discussions on the V4L mailing list./revremark
 /partinfo
 
 titleVideo for Linux Two API Specification/title
- subtitleRevision 3.9/subtitle
+ subtitleRevision 3.10/subtitle
 
   chapter id=common
 sub-common;
-- 
1.7.10.4

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


[PATCHv1 25/38] DocBook: remove obsolete note from the dbg_g_register doc.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml |9 -
 1 file changed, 9 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml 
b/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml
index 8d554db..b3f6100 100644
--- a/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml
@@ -105,15 +105,6 @@ present with the VIDIOC-DBG-G-CHIP-INFO; ioctl./para
 constantV4L2_CHIP_MATCH_SUBDEV/constant,
 structfieldmatch.addr/structfield selects the nth sub-device./para
 
-note
-  titleSuccess not guaranteed/title
-
-  paraDue to a flaw in the Linux i2c; bus driver these ioctls may
-return successfully without actually reading or writing a register. To
-catch the most likely failure we recommend a VIDIOC-DBG-G-CHIP-INFO;
-call confirming the presence of the selected i2c; chip./para
-/note
-
 paraThese ioctls are optional, not all drivers may support them.
 However when a driver supports these ioctls it must also support
 VIDIOC-DBG-G-CHIP-INFO;. Conversely it may support
-- 
1.7.10.4

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


[PATCHv1 38/38] DocBook/media/v4l: update VIDIOC_DBG_ documentation

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

- Remove the On failure the structure remains unchanged. part since
  that isn't necessarily true.
- Document the 'size' field.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 .../DocBook/media/v4l/vidioc-dbg-g-chip-info.xml|3 +--
 .../DocBook/media/v4l/vidioc-dbg-g-register.xml |   15 ++-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-info.xml 
b/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-info.xml
index 706989d..4c4603c 100644
--- a/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-info.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-dbg-g-chip-info.xml
@@ -73,8 +73,7 @@ fields of a v4l2-dbg-chip-info;
 and call constantVIDIOC_DBG_G_CHIP_INFO/constant with a pointer to
 this structure. On success the driver stores information about the
 selected chip in the structfieldname/structfield and
-structfieldflags/structfield fields. On failure the structure
-remains unchanged./para
+structfieldflags/structfield fields./para
 
 paraWhen structfieldmatch.type/structfield is
 constantV4L2_CHIP_MATCH_BRIDGE/constant,
diff --git a/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml 
b/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml
index b3f6100..3d038e7 100644
--- a/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-dbg-g-register.xml
@@ -76,7 +76,7 @@ compiled with the constantCONFIG_VIDEO_ADV_DEBUG/constant 
option
 to enable these ioctls./para
 
 paraTo write a register applications must initialize all fields
-of a v4l2-dbg-register; and call
+of a v4l2-dbg-register; except for structfieldsize/structfield and call
 constantVIDIOC_DBG_S_REGISTER/constant with a pointer to this
 structure. The structfieldmatch.type/structfield and
 structfieldmatch.addr/structfield or structfieldmatch.name/structfield
@@ -91,8 +91,8 @@ written into the register./para
 structfieldreg/structfield fields, and call
 constantVIDIOC_DBG_G_REGISTER/constant with a pointer to this
 structure. On success the driver stores the register value in the
-structfieldval/structfield field. On failure the structure remains
-unchanged./para
+structfieldval/structfield field and the size (in bytes) of the
+value in structfieldsize/structfield./para
 
 paraWhen structfieldmatch.type/structfield is
 constantV4L2_CHIP_MATCH_BRIDGE/constant,
@@ -120,7 +120,7 @@ LinuxTV v4l-dvb repository; see ulink
 url=http://linuxtv.org/repo/;http://linuxtv.org/repo//ulink for
 access instructions./para
 
-!-- Note for convenience vidioc-dbg-g-chip-ident.sgml
+!-- Note for convenience vidioc-dbg-g-chip-info.sgml
 contains a duplicate of this table. --
 table pgwide=1 frame=none id=v4l2-dbg-match
   titlestruct structnamev4l2_dbg_match/structname/title
@@ -169,6 +169,11 @@ to the structfieldtype/structfield field. Currently 
unused./entry
entryHow to match the chip, see xref linkend=v4l2-dbg-match 
/./entry
  /row
  row
+   entry__u32/entry
+   entrystructfieldsize/structfield/entry
+   entryThe register size in bytes./entry
+ /row
+ row
entry__u64/entry
entrystructfieldreg/structfield/entry
entryA register number./entry
@@ -183,7 +188,7 @@ register./entry
   /tgroup
 /table
 
-!-- Note for convenience vidioc-dbg-g-chip-ident.sgml
+!-- Note for convenience vidioc-dbg-g-chip-info.sgml
 contains a duplicate of this table. --
 table pgwide=1 frame=none id=chip-match-types
   titleChip Match Types/title
-- 
1.7.10.4

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


[PATCHv1 29/38] marvell-ccic: check register address.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Prevent out-of-range register accesses.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Jonathan Corbet cor...@lwn.net
---
 drivers/media/platform/marvell-ccic/cafe-driver.c |1 +
 drivers/media/platform/marvell-ccic/mcam-core.c   |4 
 drivers/media/platform/marvell-ccic/mcam-core.h   |1 +
 drivers/media/platform/marvell-ccic/mmp-driver.c  |1 +
 4 files changed, 7 insertions(+)

diff --git a/drivers/media/platform/marvell-ccic/cafe-driver.c 
b/drivers/media/platform/marvell-ccic/cafe-driver.c
index 7b07fc5..1f079ff 100644
--- a/drivers/media/platform/marvell-ccic/cafe-driver.c
+++ b/drivers/media/platform/marvell-ccic/cafe-driver.c
@@ -500,6 +500,7 @@ static int cafe_pci_probe(struct pci_dev *pdev,
printk(KERN_ERR Unable to ioremap cafe-ccic regs\n);
goto out_disable;
}
+   mcam-regs_size = pci_resource_len(pdev, 0);
ret = request_irq(pdev-irq, cafe_irq, IRQF_SHARED, cafe-ccic, cam);
if (ret)
goto out_iounmap;
diff --git a/drivers/media/platform/marvell-ccic/mcam-core.c 
b/drivers/media/platform/marvell-ccic/mcam-core.c
index a187161..c69cfc4 100644
--- a/drivers/media/platform/marvell-ccic/mcam-core.c
+++ b/drivers/media/platform/marvell-ccic/mcam-core.c
@@ -1404,6 +1404,8 @@ static int mcam_vidioc_g_register(struct file *file, void 
*priv,
 {
struct mcam_camera *cam = priv;
 
+   if (reg-reg  cam-regs_size - 4)
+   return -EINVAL;
reg-val = mcam_reg_read(cam, reg-reg);
reg-size = 4;
return 0;
@@ -1414,6 +1416,8 @@ static int mcam_vidioc_s_register(struct file *file, void 
*priv,
 {
struct mcam_camera *cam = priv;
 
+   if (reg-reg  cam-regs_size - 4)
+   return -EINVAL;
mcam_reg_write(cam, reg-reg, reg-val);
return 0;
 }
diff --git a/drivers/media/platform/marvell-ccic/mcam-core.h 
b/drivers/media/platform/marvell-ccic/mcam-core.h
index 46b6ea3..520c8de 100644
--- a/drivers/media/platform/marvell-ccic/mcam-core.h
+++ b/drivers/media/platform/marvell-ccic/mcam-core.h
@@ -101,6 +101,7 @@ struct mcam_camera {
 */
struct i2c_adapter *i2c_adapter;
unsigned char __iomem *regs;
+   unsigned regs_size; /* size in bytes of the register space */
spinlock_t dev_lock;
struct device *dev; /* For messages, dma alloc */
enum mcam_chip_id chip_id;
diff --git a/drivers/media/platform/marvell-ccic/mmp-driver.c 
b/drivers/media/platform/marvell-ccic/mmp-driver.c
index cadad64..a634888 100644
--- a/drivers/media/platform/marvell-ccic/mmp-driver.c
+++ b/drivers/media/platform/marvell-ccic/mmp-driver.c
@@ -202,6 +202,7 @@ static int mmpcam_probe(struct platform_device *pdev)
ret = -ENODEV;
goto out_free;
}
+   mcam-regs_size = resource_size(res);
/*
 * Power/clock memory is elsewhere; get it too.  Perhaps this
 * should really be managed outside of this driver?
-- 
1.7.10.4

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


[PATCHv1 36/38] cx88: fix register mask.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Ensure that the register is aligned to a dword, otherwise the read could
read out-of-range data.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
---
 drivers/media/pci/cx88/cx88-video.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/cx88/cx88-video.c 
b/drivers/media/pci/cx88/cx88-video.c
index 6b3a9ae..c3af4aa 100644
--- a/drivers/media/pci/cx88/cx88-video.c
+++ b/drivers/media/pci/cx88/cx88-video.c
@@ -1362,7 +1362,7 @@ static int vidioc_g_register (struct file *file, void *fh,
struct cx88_core *core = ((struct cx8800_fh*)fh)-dev-core;
 
/* cx2388x has a 24-bit register space */
-   reg-val = cx_read(reg-reg  0xff);
+   reg-val = cx_read(reg-reg  0xfc);
reg-size = 4;
return 0;
 }
@@ -1372,7 +1372,7 @@ static int vidioc_s_register (struct file *file, void *fh,
 {
struct cx88_core *core = ((struct cx8800_fh*)fh)-dev-core;
 
-   cx_write(reg-reg  0xff, reg-val);
+   cx_write(reg-reg  0xfc, reg-val);
return 0;
 }
 #endif
-- 
1.7.10.4

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


[PATCHv1 10/38] cx231xx: remove g_chip_ident.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Remove g_chip_ident and replace it with g_chip_info.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Mauro Carvalho Chehab mche...@redhat.com
---
 drivers/media/usb/cx231xx/cx231xx-417.c|1 -
 drivers/media/usb/cx231xx/cx231xx-avcore.c |1 -
 drivers/media/usb/cx231xx/cx231xx-cards.c  |1 -
 drivers/media/usb/cx231xx/cx231xx-vbi.c|1 -
 drivers/media/usb/cx231xx/cx231xx-video.c  |  417 +++-
 drivers/media/usb/cx231xx/cx231xx.h|2 +-
 6 files changed, 103 insertions(+), 320 deletions(-)

diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c 
b/drivers/media/usb/cx231xx/cx231xx-417.c
index f548db8..2f63029 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -1840,7 +1840,6 @@ static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
.vidioc_streamon = vidioc_streamon,
.vidioc_streamoff= vidioc_streamoff,
.vidioc_log_status   = vidioc_log_status,
-   .vidioc_g_chip_ident = cx231xx_g_chip_ident,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
.vidioc_g_register   = cx231xx_g_register,
.vidioc_s_register   = cx231xx_s_register,
diff --git a/drivers/media/usb/cx231xx/cx231xx-avcore.c 
b/drivers/media/usb/cx231xx/cx231xx-avcore.c
index 235ba65..89de00b 100644
--- a/drivers/media/usb/cx231xx/cx231xx-avcore.c
+++ b/drivers/media/usb/cx231xx/cx231xx-avcore.c
@@ -35,7 +35,6 @@
 
 #include media/v4l2-common.h
 #include media/v4l2-ioctl.h
-#include media/v4l2-chip-ident.h
 
 #include cx231xx.h
 #include cx231xx-dif.h
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c 
b/drivers/media/usb/cx231xx/cx231xx-cards.c
index 13249e5..27948e1 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -29,7 +29,6 @@
 #include media/tuner.h
 #include media/tveeprom.h
 #include media/v4l2-common.h
-#include media/v4l2-chip-ident.h
 
 #include media/cx25840.h
 #include dvb-usb-ids.h
diff --git a/drivers/media/usb/cx231xx/cx231xx-vbi.c 
b/drivers/media/usb/cx231xx/cx231xx-vbi.c
index 1340ff2..c027942 100644
--- a/drivers/media/usb/cx231xx/cx231xx-vbi.c
+++ b/drivers/media/usb/cx231xx/cx231xx-vbi.c
@@ -32,7 +32,6 @@
 
 #include media/v4l2-common.h
 #include media/v4l2-ioctl.h
-#include media/v4l2-chip-ident.h
 #include media/msp3400.h
 #include media/tuner.h
 
diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c 
b/drivers/media/usb/cx231xx/cx231xx-video.c
index cd22147..54cdd4d 100644
--- a/drivers/media/usb/cx231xx/cx231xx-video.c
+++ b/drivers/media/usb/cx231xx/cx231xx-video.c
@@ -36,7 +36,6 @@
 #include media/v4l2-common.h
 #include media/v4l2-ioctl.h
 #include media/v4l2-event.h
-#include media/v4l2-chip-ident.h
 #include media/msp3400.h
 #include media/tuner.h
 
@@ -1228,179 +1227,86 @@ int cx231xx_s_frequency(struct file *file, void *priv,
return rc;
 }
 
-int cx231xx_g_chip_ident(struct file *file, void *fh,
-   struct v4l2_dbg_chip_ident *chip)
+#ifdef CONFIG_VIDEO_ADV_DEBUG
+
+int cx231xx_g_chip_info(struct file *file, void *fh,
+   struct v4l2_dbg_chip_info *chip)
 {
-   chip-ident = V4L2_IDENT_NONE;
-   chip-revision = 0;
-   if (chip-match.type == V4L2_CHIP_MATCH_HOST) {
-   if (v4l2_chip_match_host(chip-match))
-   chip-ident = V4L2_IDENT_CX23100;
+   switch (chip-match.addr) {
+   case 0: /* Cx231xx - internal registers */
+   return 0;
+   case 1: /* AFE - read byte */
+   strlcpy(chip-name, AFE (byte), sizeof(chip-name));
+   return 0;
+   case 2: /* Video Block - read byte */
+   strlcpy(chip-name, Video (byte), sizeof(chip-name));
+   return 0;
+   case 3: /* I2S block - read byte */
+   strlcpy(chip-name, I2S (byte), sizeof(chip-name));
+   return 0;
+   case 4: /* AFE - read dword */
+   strlcpy(chip-name, AFE (dword), sizeof(chip-name));
+   return 0;
+   case 5: /* Video Block - read dword */
+   strlcpy(chip-name, Video (dword), sizeof(chip-name));
+   return 0;
+   case 6: /* I2S Block - read dword */
+   strlcpy(chip-name, I2S (dword), sizeof(chip-name));
return 0;
}
return -EINVAL;
 }
 
-#ifdef CONFIG_VIDEO_ADV_DEBUG
-
-/*
-  -R, --list-registers=type=host/i2cdrv/i2caddr,
-   chip=chip[,min=addr,max=addr]
-dump registers from min to max [VIDIOC_DBG_G_REGISTER]
-  -r, --set-register=type=host/i2cdrv/i2caddr,
-   chip=chip,reg=addr,val=val
-set the register [VIDIOC_DBG_S_REGISTER]
-
-  if type == host, then chip is the hosts chip ID (default 0)
-  if type == i2cdrv (default), then chip is the I2C driver name or ID
-  if type == i2caddr, then chip is the 7-bit 

Re: [RFC] [media] mem2mem: add support for hardware buffered queue

2013-05-29 Thread Philipp Zabel
Hi Kamil,

Am Mittwoch, den 29.05.2013, 11:54 +0200 schrieb Kamil Debski:
 Hi Philipp, Hans,
 
  On mem2mem decoders with a hardware bitstream ringbuffer, to drain the
  buffer at the end of the stream, remaining frames might need to be
  decoded without additional input buffers being provided, and after
  calling streamoff on the v4l2 output queue. This also allows a driver
  to copy input buffers into their bitstream ringbuffer and immediately
  mark them as done to be dequeued.
  
  The motivation for this patch is hardware assisted h.264 reordering
  support in the coda driver. For high profile streams, the coda can hold
  back out-of-order frames, causing a few mem2mem device runs in the
  beginning, that don't produce any decompressed buffer at the v4l2
  capture side. At the same time, the last few frames can be decoded from
  the bitstream with mem2mem device runs that don't need a new input
  buffer at the v4l2 output side. A streamoff on the v4l2 output side can
  be used to put the decoder into the ringbuffer draining end-of-stream
  mode.
 
 If I remember correctly the main goal of introducing the m2m framework
 was to support simple mem2mem devices where one input buffer = one output
 buffer. In other cases m2m was not to be used. 

The m2m context / queue handling and job scheduling are very useful even
for drivers that don't always produce one CAPTURE buffer from one OUTPUT
buffer, just as you drescribe below.
The CODA encoder path fits the m2m model perfectly. I'd prefer not to
duplicate most of mem2mem just because the decoder doesn't.

There's two things that this patch allows me to do:
a) running mem2mem device_run with an empty OUTPUT queue, which is
   something I'd really like to make possible.
b) running mem2mem device_run with the OUTPUT queue in STREAM OFF, which
   I needed to get the remaining buffers out. But maybe there is a
   better way to do this while keeping the output queue streaming.

 An example of such mem2mem driver, which does not use m2m framework is
 MFC. It uses videobuf2 directly and it is wholly up to the driver how
 will it control the queues, stream on/off and so on. You can then have
 one OUTPUT buffer generate multiple CAPTURE buffer, multiple OUTPUT
 buffers generate a single CAPTURE buffer. Consume OUTPUT buffer without
 generating CAPTURE buffer (e.g. when starting decoding) and produce
 CAPTURE buffers without consuming OUTPUT buffers (e.g. when finishing
 decoding).

 I think that stream off should not be used to signal EOS. For this we
 have EOS event. You mentioned the EOS buffer flag. This is the idea
 originally proposed by Andrzej Hajda, after some lengthy discussions
 with v4l community this idea was changed to use an EOS event.

I'm not set on using STREAMOFF to signal the stream-end condition to the
hardware, but after switching to stream-end mode, no new frames should
be queued, so I thought it fit quite well. It also allows to prepare the
OUTPUT buffers (S_FMT/REQBUFS) for the next STREAMON while the CAPTURE
side is still draining the bitstream, although that's probably not a
very useful feature.
I could instead have userspace signal the driver via an EOS buffer flag
or any other mechanism. Then the OUTPUT queue would be kept streaming,
but hold back all buffers queued via QBUF until the last buffer is
dequeued from the CAPTURE queue.

 I was all for the EOS buffer flag, but after discussion with Mauro I
 understood his arguments. We can get back to this discussion, if we
 are sure that events are not enough. Please also note that we need to
 keep backward compatibility.

Maybe I've missed something, but I thought the EOS signal is only for
the driver to signal to userspace that the currently dequeued frame is
the last one?
I need userspace to signal to the driver that it won't queue any new
OUTPUT buffers, but still wants to dequeue the remaining CAPTURE buffers
until the bitstream buffer is empty.

 Original EOS buffer flag patches by Andrzej and part of the discussion
 can be found here:
 1) https://linuxtv.org/patch/10624/
 2) https://linuxtv.org/patch/11373/
 
 Best wishes,
 Kamil Debski

regards
Philipp

--
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: [RFC] [media] mem2mem: add support for hardware buffered queue

2013-05-29 Thread Andrzej Hajda
Hi Philipp,

On 05/29/2013 01:13 PM, Philipp Zabel wrote:
 Hi Kamil,

 Am Mittwoch, den 29.05.2013, 11:54 +0200 schrieb Kamil Debski:
 Hi Philipp, Hans,

 On mem2mem decoders with a hardware bitstream ringbuffer, to drain the
 buffer at the end of the stream, remaining frames might need to be
 decoded without additional input buffers being provided, and after
 calling streamoff on the v4l2 output queue. This also allows a driver
 to copy input buffers into their bitstream ringbuffer and immediately
 mark them as done to be dequeued.

 The motivation for this patch is hardware assisted h.264 reordering
 support in the coda driver. For high profile streams, the coda can hold
 back out-of-order frames, causing a few mem2mem device runs in the
 beginning, that don't produce any decompressed buffer at the v4l2
 capture side. At the same time, the last few frames can be decoded from
 the bitstream with mem2mem device runs that don't need a new input
 buffer at the v4l2 output side. A streamoff on the v4l2 output side can
 be used to put the decoder into the ringbuffer draining end-of-stream
 mode.
 If I remember correctly the main goal of introducing the m2m framework
 was to support simple mem2mem devices where one input buffer = one output
 buffer. In other cases m2m was not to be used. 
 The m2m context / queue handling and job scheduling are very useful even
 for drivers that don't always produce one CAPTURE buffer from one OUTPUT
 buffer, just as you drescribe below.
 The CODA encoder path fits the m2m model perfectly. I'd prefer not to
 duplicate most of mem2mem just because the decoder doesn't.

 There's two things that this patch allows me to do:
 a) running mem2mem device_run with an empty OUTPUT queue, which is
something I'd really like to make possible.
 b) running mem2mem device_run with the OUTPUT queue in STREAM OFF, which
I needed to get the remaining buffers out. But maybe there is a
better way to do this while keeping the output queue streaming.

 An example of such mem2mem driver, which does not use m2m framework is
 MFC. It uses videobuf2 directly and it is wholly up to the driver how
 will it control the queues, stream on/off and so on. You can then have
 one OUTPUT buffer generate multiple CAPTURE buffer, multiple OUTPUT
 buffers generate a single CAPTURE buffer. Consume OUTPUT buffer without
 generating CAPTURE buffer (e.g. when starting decoding) and produce
 CAPTURE buffers without consuming OUTPUT buffers (e.g. when finishing
 decoding).

 I think that stream off should not be used to signal EOS. For this we
 have EOS event. You mentioned the EOS buffer flag. This is the idea
 originally proposed by Andrzej Hajda, after some lengthy discussions
 with v4l community this idea was changed to use an EOS event.
 I'm not set on using STREAMOFF to signal the stream-end condition to the
 hardware, but after switching to stream-end mode, no new frames should
 be queued, so I thought it fit quite well. It also allows to prepare the
 OUTPUT buffers (S_FMT/REQBUFS) for the next STREAMON while the CAPTURE
 side is still draining the bitstream, although that's probably not a
 very useful feature.
 I could instead have userspace signal the driver via an EOS buffer flag
 or any other mechanism. Then the OUTPUT queue would be kept streaming,
 but hold back all buffers queued via QBUF until the last buffer is
 dequeued from the CAPTURE queue.

 I was all for the EOS buffer flag, but after discussion with Mauro I
 understood his arguments. We can get back to this discussion, if we
 are sure that events are not enough. Please also note that we need to
 keep backward compatibility.
 Maybe I've missed something, but I thought the EOS signal is only for
 the driver to signal to userspace that the currently dequeued frame is
 the last one?
 I need userspace to signal to the driver that it won't queue any new
 OUTPUT buffers, but still wants to dequeue the remaining CAPTURE buffers
 until the bitstream buffer is empty.
In MFC encoder I have used:
- event V4L2_EVENT_EOS by driver to signal EOS to user,
- VIDIOC_ENCODER_CMD with cmd=V4L2_ENC_CMD_STOP by
user to signal EOS to driver.
It works, but IMO it would look much natural/simpler with EOS buffer flag.

 Original EOS buffer flag patches by Andrzej and part of the discussion
 can be found here:
 1) https://linuxtv.org/patch/10624/
 2) https://linuxtv.org/patch/11373/

 Best wishes,
 Kamil Debski
 regards
 Philipp



--
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 1/2] [media] v4l2-mem2mem: add v4l2_m2m_create_bufs helper

2013-05-29 Thread Kamil Debski
Hi,

Thanks for the patch. May I ask you to use use checkpath next time
and keep whitespaces tidy? This time I fixed it (spaces changed to a tab).

Checkpatch:
--
ERROR: code indent should use tabs where possible
#41: FILE: drivers/media/v4l2-core/v4l2-mem2mem.c:384:
+return vb2_create_bufs(vq, create);$

WARNING: please, no spaces at the start of a line
#41: FILE: drivers/media/v4l2-core/v4l2-mem2mem.c:384:
+return vb2_create_bufs(vq, create);$

total: 1 errors, 1 warnings, 28 lines checked

Fix:
--
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c
b/drivers/media/v4l2-core/v4l2-mem2mem.c
index 674e5a0..a756170 100644
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
@@ -381,7 +381,7 @@ int v4l2_m2m_create_bufs(struct file *file, struct
v4l2_m2m_ctx *m2m_ctx,
struct vb2_queue *vq;
 
vq = v4l2_m2m_get_vq(m2m_ctx, create-format.type);
-return vb2_create_bufs(vq, create);
+   return vb2_create_bufs(vq, create);
 }
 EXPORT_SYMBOL_GPL(v4l2_m2m_create_bufs);


Best wishes,
-- 
Kamil Debski
Linux Kernel Developer
Samsung RD Institute Poland


 -Original Message-
 From: linux-media-ow...@vger.kernel.org [mailto:linux-media-
 ow...@vger.kernel.org] On Behalf Of Philipp Zabel
 Sent: Tuesday, May 21, 2013 10:16 AM
 To: linux-media@vger.kernel.org
 Cc: Mauro Carvalho Chehab; Javier Martin; Pawel Osciak; John Sheu;
 Philipp Zabel
 Subject: [PATCH 1/2] [media] v4l2-mem2mem: add v4l2_m2m_create_bufs
 helper
 
 Signed-off-by: Philipp Zabel p.za...@pengutronix.de
 ---
  drivers/media/v4l2-core/v4l2-mem2mem.c | 14 ++
  include/media/v4l2-mem2mem.h   |  2 ++
  2 files changed, 16 insertions(+)
 
 diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c
 b/drivers/media/v4l2-core/v4l2-mem2mem.c
 index 66f599f..357efa4 100644
 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c
 +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
 @@ -372,6 +372,20 @@ int v4l2_m2m_dqbuf(struct file *file, struct
 v4l2_m2m_ctx *m2m_ctx,  EXPORT_SYMBOL_GPL(v4l2_m2m_dqbuf);
 
  /**
 + * v4l2_m2m_create_bufs() - create a source or destination buffer,
 +depending
 + * on the type
 + */
 +int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx
 *m2m_ctx,
 +  struct v4l2_create_buffers *create) {
 + struct vb2_queue *vq;
 +
 + vq = v4l2_m2m_get_vq(m2m_ctx, create-format.type);
 +return vb2_create_bufs(vq, create); }
 +EXPORT_SYMBOL_GPL(v4l2_m2m_create_bufs);
 +
 +/**
   * v4l2_m2m_expbuf() - export a source or destination buffer,
 depending on
   * the type
   */
 diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-
 mem2mem.h index d3eef01..0f4555b 100644
 --- a/include/media/v4l2-mem2mem.h
 +++ b/include/media/v4l2-mem2mem.h
 @@ -110,6 +110,8 @@ int v4l2_m2m_qbuf(struct file *file, struct
 v4l2_m2m_ctx *m2m_ctx,
 struct v4l2_buffer *buf);
  int v4l2_m2m_dqbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
  struct v4l2_buffer *buf);
 +int v4l2_m2m_create_bufs(struct file *file, struct v4l2_m2m_ctx
 *m2m_ctx,
 +  struct v4l2_create_buffers *create);
 
  int v4l2_m2m_expbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
  struct v4l2_exportbuffer *eb);
 --
 1.8.2.rc2
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-media
 in the body of a message to majord...@vger.kernel.org More majordomo
 info at  http://vger.kernel.org/majordomo-info.html


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


RE: [PATCH 0/9] CODA patches in preparation for decoding support

2013-05-29 Thread Kamil Debski
Hi,

Patches 5/9 an 6/9 have a style issues (Line  80) found by checkpatch.
Can you comment on this?

Also patch 8/9 does not apply cleanly to my branch. I think that it might be
because
I am missing patches that were taken by Hans.

Warnings from checkpatch:

Patch 5/9

WARNING: line over 80 characters
#73: FILE: drivers/media/platform/coda.c:959:
+   coda_parabuf_write(ctx, i * 3 + 2, paddr + ysize + ysize/4);
/* Cr */

WARNING: line over 80 characters
#99: FILE: drivers/media/platform/coda.c:961:
+   if (dev-devtype-product != CODA_DX6  fourcc ==
V4L2_PIX_FMT_H264)

WARNING: line over 80 characters
#100: FILE: drivers/media/platform/coda.c:962:
+   coda_parabuf_write(ctx, 96 + i,
ctx-internal_frames[i].paddr + ysize + ysize/4 + ysize/4);

total: 0 errors, 3 warnings, 76 lines checked

Patch 6/9
WARNING: line over 80 characters
#186: FILE: drivers/media/platform/coda.c:293:
+   CODA_CODEC(CODADX6_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420,
V4L2_PIX_FMT_H264,  720, 576),

WARNING: line over 80 characters
#187: FILE: drivers/media/platform/coda.c:294:
+   CODA_CODEC(CODADX6_MODE_ENCODE_MP4,  V4L2_PIX_FMT_YUV420,
V4L2_PIX_FMT_MPEG4, 720, 576),

WARNING: line over 80 characters
#191: FILE: drivers/media/platform/coda.c:298:
+   CODA_CODEC(CODA7_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420,
V4L2_PIX_FMT_H264,   1280, 720),

WARNING: line over 80 characters
#192: FILE: drivers/media/platform/coda.c:299:
+   CODA_CODEC(CODA7_MODE_ENCODE_MP4,  V4L2_PIX_FMT_YUV420,
V4L2_PIX_FMT_MPEG4,  1280, 720),

WARNING: line over 80 characters
#584: FILE: drivers/media/platform/coda.c:1110:
+   value |= (q_data_src-height  CODADX6_PICHEIGHT_MASK) 
CODA_PICHEIGHT_OFFSET;

WARNING: line over 80 characters
#588: FILE: drivers/media/platform/coda.c:1114:
+   value |= (q_data_src-height  CODA7_PICHEIGHT_MASK) 
CODA_PICHEIGHT_OFFSET;

total: 0 errors, 6 warnings, 603 lines checked

Best wishes,
-- 
Kamil Debski
Linux Kernel Developer
Samsung RD Institute Poland


 -Original Message-
 From: linux-media-ow...@vger.kernel.org [mailto:linux-media-
 ow...@vger.kernel.org] On Behalf Of Philipp Zabel
 Sent: Thursday, May 23, 2013 4:43 PM
 To: linux-media@vger.kernel.org
 Cc: Javier Martin; Hans Verkuil
 Subject: [PATCH 0/9] CODA patches in preparation for decoding support
 
 The following patch series contains a few fixes and cleanups in
 preparation for decoding support.
 I've simplified the parameter buffer setup code, changed the hardware
 command register access locking for multi-instance support on CODA7,
 and added a list of supported codecs per device type, where each codec
 can have its own frame size limitation.
 
 I intend follow up with a series that adds h.264 decoding support for
 CODA7541 (i.MX53) and CODA960 (i.MX6), but what I'll send to the list
 exactly depends a bit on whether the mem2mem changes in the patch
 [media] mem2mem: add support for hardware buffered queue
 will be accepted.
 
 regards
 Philipp
 
 ---
  drivers/media/platform/coda.c | 600
 +++
 +++
 ---
  drivers/media/platform/coda.h |  11 ++-
  2 files changed, 326 insertions(+), 285 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


--
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: [RFC] [media] mem2mem: add support for hardware buffered queue

2013-05-29 Thread Kamil Debski
Hi,

 -Original Message-
 From: Philipp Zabel [mailto:p.za...@pengutronix.de]
 Sent: Wednesday, May 29, 2013 1:13 PM
 To: Kamil Debski
 Cc: linux-media@vger.kernel.org; 'Mauro Carvalho Chehab'; 'Pawel
 Osciak'; 'John Sheu'; 'Hans Verkuil'; Marek Szyprowski; Andrzej Hajda
 Subject: Re: [RFC] [media] mem2mem: add support for hardware buffered
 queue
 
 Hi Kamil,
 
 Am Mittwoch, den 29.05.2013, 11:54 +0200 schrieb Kamil Debski:
  Hi Philipp, Hans,
 
   On mem2mem decoders with a hardware bitstream ringbuffer, to drain
   the buffer at the end of the stream, remaining frames might need to
   be decoded without additional input buffers being provided, and
   after calling streamoff on the v4l2 output queue. This also allows
 a
   driver to copy input buffers into their bitstream ringbuffer and
   immediately mark them as done to be dequeued.
  
   The motivation for this patch is hardware assisted h.264 reordering
   support in the coda driver. For high profile streams, the coda can
   hold back out-of-order frames, causing a few mem2mem device runs in
   the beginning, that don't produce any decompressed buffer at the
   v4l2 capture side. At the same time, the last few frames can be
   decoded from the bitstream with mem2mem device runs that don't need
   a new input buffer at the v4l2 output side. A streamoff on the v4l2
   output side can be used to put the decoder into the ringbuffer
   draining end-of-stream mode.
 
  If I remember correctly the main goal of introducing the m2m
 framework
  was to support simple mem2mem devices where one input buffer = one
  output buffer. In other cases m2m was not to be used.
 
 The m2m context / queue handling and job scheduling are very useful
 even for drivers that don't always produce one CAPTURE buffer from one
 OUTPUT buffer, just as you drescribe below.
 The CODA encoder path fits the m2m model perfectly. I'd prefer not to
 duplicate most of mem2mem just because the decoder doesn't.
 
 There's two things that this patch allows me to do:
 a) running mem2mem device_run with an empty OUTPUT queue, which is
something I'd really like to make possible.
 b) running mem2mem device_run with the OUTPUT queue in STREAM OFF,
 which
I needed to get the remaining buffers out. But maybe there is a
better way to do this while keeping the output queue streaming.
 
  An example of such mem2mem driver, which does not use m2m framework
 is
  MFC. It uses videobuf2 directly and it is wholly up to the driver how
  will it control the queues, stream on/off and so on. You can then
 have
  one OUTPUT buffer generate multiple CAPTURE buffer, multiple OUTPUT
  buffers generate a single CAPTURE buffer. Consume OUTPUT buffer
  without generating CAPTURE buffer (e.g. when starting decoding) and
  produce CAPTURE buffers without consuming OUTPUT buffers (e.g. when
  finishing decoding).
 
  I think that stream off should not be used to signal EOS. For this we
  have EOS event. You mentioned the EOS buffer flag. This is the idea
  originally proposed by Andrzej Hajda, after some lengthy discussions
  with v4l community this idea was changed to use an EOS event.
 
 I'm not set on using STREAMOFF to signal the stream-end condition to
 the hardware, but after switching to stream-end mode, no new frames
 should be queued, so I thought it fit quite well. It also allows to
 prepare the OUTPUT buffers (S_FMT/REQBUFS) for the next STREAMON while
 the CAPTURE side is still draining the bitstream, although that's
 probably not a very useful feature.
 I could instead have userspace signal the driver via an EOS buffer flag
 or any other mechanism. Then the OUTPUT queue would be kept streaming,
 but hold back all buffers queued via QBUF until the last buffer is
 dequeued from the CAPTURE queue.
 
  I was all for the EOS buffer flag, but after discussion with Mauro I
  understood his arguments. We can get back to this discussion, if we
  are sure that events are not enough. Please also note that we need to
  keep backward compatibility.
 
 Maybe I've missed something, but I thought the EOS signal is only for
 the driver to signal to userspace that the currently dequeued frame is
 the last one?
 I need userspace to signal to the driver that it won't queue any new
 OUTPUT buffers, but still wants to dequeue the remaining CAPTURE
 buffers until the bitstream buffer is empty.

Right, I mixed that with EOS command. EOS command should be used to
signal end of stream. Also queueing a buffer with bytesused = 0 can
signal that to the driver (this is kept for backward compatibility).

 
  Original EOS buffer flag patches by Andrzej and part of the
 discussion
  can be found here:
  1) https://linuxtv.org/patch/10624/
  2) https://linuxtv.org/patch/11373/
 
  Best wishes,
  Kamil Debski
 
 regards
 Philipp

Best wishes,
Kamil


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

Re: [RFC] [media] mem2mem: add support for hardware buffered queue

2013-05-29 Thread Philipp Zabel
Hi Andrzej,

Am Mittwoch, den 29.05.2013, 14:05 +0200 schrieb Andrzej Hajda:
 Hi Philipp,
 
 On 05/29/2013 01:13 PM, Philipp Zabel wrote:
  Hi Kamil,
 
  Am Mittwoch, den 29.05.2013, 11:54 +0200 schrieb Kamil Debski:
  Hi Philipp, Hans,
 
  On mem2mem decoders with a hardware bitstream ringbuffer, to drain the
  buffer at the end of the stream, remaining frames might need to be
  decoded without additional input buffers being provided, and after
  calling streamoff on the v4l2 output queue. This also allows a driver
  to copy input buffers into their bitstream ringbuffer and immediately
  mark them as done to be dequeued.
 
  The motivation for this patch is hardware assisted h.264 reordering
  support in the coda driver. For high profile streams, the coda can hold
  back out-of-order frames, causing a few mem2mem device runs in the
  beginning, that don't produce any decompressed buffer at the v4l2
  capture side. At the same time, the last few frames can be decoded from
  the bitstream with mem2mem device runs that don't need a new input
  buffer at the v4l2 output side. A streamoff on the v4l2 output side can
  be used to put the decoder into the ringbuffer draining end-of-stream
  mode.
  If I remember correctly the main goal of introducing the m2m framework
  was to support simple mem2mem devices where one input buffer = one output
  buffer. In other cases m2m was not to be used. 
  The m2m context / queue handling and job scheduling are very useful even
  for drivers that don't always produce one CAPTURE buffer from one OUTPUT
  buffer, just as you drescribe below.
  The CODA encoder path fits the m2m model perfectly. I'd prefer not to
  duplicate most of mem2mem just because the decoder doesn't.
 
  There's two things that this patch allows me to do:
  a) running mem2mem device_run with an empty OUTPUT queue, which is
 something I'd really like to make possible.
  b) running mem2mem device_run with the OUTPUT queue in STREAM OFF, which
 I needed to get the remaining buffers out. But maybe there is a
 better way to do this while keeping the output queue streaming.
 
  An example of such mem2mem driver, which does not use m2m framework is
  MFC. It uses videobuf2 directly and it is wholly up to the driver how
  will it control the queues, stream on/off and so on. You can then have
  one OUTPUT buffer generate multiple CAPTURE buffer, multiple OUTPUT
  buffers generate a single CAPTURE buffer. Consume OUTPUT buffer without
  generating CAPTURE buffer (e.g. when starting decoding) and produce
  CAPTURE buffers without consuming OUTPUT buffers (e.g. when finishing
  decoding).
 
  I think that stream off should not be used to signal EOS. For this we
  have EOS event. You mentioned the EOS buffer flag. This is the idea
  originally proposed by Andrzej Hajda, after some lengthy discussions
  with v4l community this idea was changed to use an EOS event.
  I'm not set on using STREAMOFF to signal the stream-end condition to the
  hardware, but after switching to stream-end mode, no new frames should
  be queued, so I thought it fit quite well. It also allows to prepare the
  OUTPUT buffers (S_FMT/REQBUFS) for the next STREAMON while the CAPTURE
  side is still draining the bitstream, although that's probably not a
  very useful feature.
  I could instead have userspace signal the driver via an EOS buffer flag
  or any other mechanism. Then the OUTPUT queue would be kept streaming,
  but hold back all buffers queued via QBUF until the last buffer is
  dequeued from the CAPTURE queue.
 
  I was all for the EOS buffer flag, but after discussion with Mauro I
  understood his arguments. We can get back to this discussion, if we
  are sure that events are not enough. Please also note that we need to
  keep backward compatibility.
  Maybe I've missed something, but I thought the EOS signal is only for
  the driver to signal to userspace that the currently dequeued frame is
  the last one?
  I need userspace to signal to the driver that it won't queue any new
  OUTPUT buffers, but still wants to dequeue the remaining CAPTURE buffers
  until the bitstream buffer is empty.
 In MFC encoder I have used:
 - event V4L2_EVENT_EOS by driver to signal EOS to user,
 - VIDIOC_ENCODER_CMD with cmd=V4L2_ENC_CMD_STOP by
 user to signal EOS to driver.
 It works, but IMO it would look much natural/simpler with EOS buffer flag.

Ok, thank you. I agree the buffer flag feels more natural, but this will
work. I'll use VIDIOC_DECODER_CMD with cmd=V4L2_DEC_CMD_STOP and
V4L2_EVENT_EOS for this.

regards
Philipp

--
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 1/2] [media] v4l2-mem2mem: add v4l2_m2m_create_bufs helper

2013-05-29 Thread Philipp Zabel
Am Mittwoch, den 29.05.2013, 14:28 +0200 schrieb Kamil Debski:
 Hi,
 
 Thanks for the patch. May I ask you to use use checkpath next time
 and keep whitespaces tidy? This time I fixed it (spaces changed to a tab).

Yes, thanks

regards
Philipp


--
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/9] CODA patches in preparation for decoding support

2013-05-29 Thread Philipp Zabel
Am Mittwoch, den 29.05.2013, 14:28 +0200 schrieb Kamil Debski:
 Hi,
 
 Patches 5/9 an 6/9 have a style issues (Line  80) found by checkpatch.
 Can you comment on this?

I think that especially with the CODA_CODEC array, readability is
improved by overstepping the 80 character barrier.

 Also patch 8/9 does not apply cleanly to my branch. I think that it might be
 because
 I am missing patches that were taken by Hans.

That is correct. I should have mentioned those are prerequisites.

regards
Philipp

 Warnings from checkpatch:
 
 Patch 5/9
 
 WARNING: line over 80 characters
 #73: FILE: drivers/media/platform/coda.c:959:
 + coda_parabuf_write(ctx, i * 3 + 2, paddr + ysize + ysize/4);
 /* Cr */
 
 WARNING: line over 80 characters
 #99: FILE: drivers/media/platform/coda.c:961:
 + if (dev-devtype-product != CODA_DX6  fourcc ==
 V4L2_PIX_FMT_H264)
 
 WARNING: line over 80 characters
 #100: FILE: drivers/media/platform/coda.c:962:
 + coda_parabuf_write(ctx, 96 + i,
 ctx-internal_frames[i].paddr + ysize + ysize/4 + ysize/4);
 
 total: 0 errors, 3 warnings, 76 lines checked
 
 Patch 6/9
 WARNING: line over 80 characters
 #186: FILE: drivers/media/platform/coda.c:293:
 + CODA_CODEC(CODADX6_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420,
 V4L2_PIX_FMT_H264,  720, 576),
 
 WARNING: line over 80 characters
 #187: FILE: drivers/media/platform/coda.c:294:
 + CODA_CODEC(CODADX6_MODE_ENCODE_MP4,  V4L2_PIX_FMT_YUV420,
 V4L2_PIX_FMT_MPEG4, 720, 576),
 
 WARNING: line over 80 characters
 #191: FILE: drivers/media/platform/coda.c:298:
 + CODA_CODEC(CODA7_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420,
 V4L2_PIX_FMT_H264,   1280, 720),
 
 WARNING: line over 80 characters
 #192: FILE: drivers/media/platform/coda.c:299:
 + CODA_CODEC(CODA7_MODE_ENCODE_MP4,  V4L2_PIX_FMT_YUV420,
 V4L2_PIX_FMT_MPEG4,  1280, 720),
 
 WARNING: line over 80 characters
 #584: FILE: drivers/media/platform/coda.c:1110:
 + value |= (q_data_src-height  CODADX6_PICHEIGHT_MASK) 
 CODA_PICHEIGHT_OFFSET;
 
 WARNING: line over 80 characters
 #588: FILE: drivers/media/platform/coda.c:1114:
 + value |= (q_data_src-height  CODA7_PICHEIGHT_MASK) 
 CODA_PICHEIGHT_OFFSET;
 
 total: 0 errors, 6 warnings, 603 lines checked
 
 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


[GIT PULL FOR v3.10] mem2mem fixes for 3.10

2013-05-29 Thread Kamil Debski
The following changes since commit 6719a4974600fdaa4a3ac2ea2aed819a35d06605:

  [media] staging/solo6x10: select the desired font (2013-05-27 09:38:57
-0300)

are available in the git repository at:

  git://git.linuxtv.org/kdebski/media.git fixes-for-3.10

for you to fetch changes up to d1b03ab0b4273bbe2c0680c2d66e984060ab501b:

  s5p-mfc: Add NULL check for allocated buffer (2013-05-29 16:06:14 +0200)


??? (2):
  media: vb2: return for polling if a buffer is available
  media: v4l2-mem2mem: return for polling if a buffer is available

Andrzej Hajda (3):
  s5p-mfc: separate encoder parameters for h264 and mpeg4
  s5p-mfc: v4l2 controls setup routine moved to initialization code
  s5p-mfc: added missing end-of-lines in debug messages

Arun Kumar K (2):
  s5p-mfc: Update v6 encoder buffer alloc
  s5p-mfc: Remove special clock usage in driver

John Sheu (1):
  v4l2: mem2mem: save irq flags correctly

Philipp Zabel (2):
  v4l2-mem2mem: add v4l2_m2m_create_bufs helper
  coda: v4l2-compliance fix: add VIDIOC_CREATE_BUFS support

Sachin Kamat (1):
  s5p-mfc: Add NULL check for allocated buffer

Sylwester Nawrocki (1):
  s5p-mfc: Remove unused s5p_mfc_get_decoded_status_v6() function

 drivers/media/platform/coda.c   |9 +++
 drivers/media/platform/s5p-mfc/s5p_mfc.c|8 +--
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |6 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c   |2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_debug.h  |4 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c|   20 +++---
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|   82
---
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c |4 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |   53 +--
 drivers/media/platform/s5p-mfc/s5p_mfc_pm.c |   23 +--
 drivers/media/v4l2-core/v4l2-mem2mem.c  |   39 ---
 drivers/media/v4l2-core/videobuf2-core.c|3 +-
 include/media/v4l2-mem2mem.h|2 +
 13 files changed, 136 insertions(+), 119 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


[GIT PULL FOR v3.11] Next features in mem2mem drivers

2013-05-29 Thread Kamil Debski
The following changes since commit 7eac97d7e714429f7ef1ba5d35f94c07f4c34f8e:

  [media] media: pci: remove duplicate checks for EPERM (2013-05-27 09:34:56
-0300)

are available in the git repository at:

  git://git.linuxtv.org/kdebski/media.git master

for you to fetch changes up to 413833e6da43c96272b7b98ccc8e90ff0a925e41:

  coda: do not call v4l2_m2m_job_finish from .job_abort (2013-05-29 15:10:39
+0200)


Philipp Zabel (9):
  coda: fix ENC_SEQ_OPTION for CODA7
  coda: frame stride must be a multiple of 8
  coda: stop setting bytesused in buf_prepare
  coda: clear registers in coda_hw_init
  coda: simplify parameter buffer setup code
  coda: per-product list of codecs instead of list of formats
  coda: add coda_encode_header helper function
  coda: replace completion with mutex
  coda: do not call v4l2_m2m_job_finish from .job_abort

 drivers/media/platform/coda.c |  600
++---
 drivers/media/platform/coda.h |   11 +-
 2 files changed, 326 insertions(+), 285 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


[RFC PATCH 00/14] QUERYSTD fixes

2013-05-29 Thread Hans Verkuil
This patch series cleans up various drivers with respect to their
VIDIOC_QUERYSTD behavior. The main reason for doing this is to ensure
that the correct std value is returned when there is no signal detected.
It should return V4L2_STD_UNKNOWN. Due to a poorly worded specification
several drivers returned STD_ALL.

As mentioned in an old RFC the current behavior is inconsistent:

- saa7115, ks0127, saa7191 return 0 with std set to V4L2_STD_ALL
- adv7180, vpx3220 return 0 with std set to V4L2_STD_UNKNOWN
- saa7110 returns 0 with std set to the current std
- bt819 and bttv do not handle this case at all, and just pick 50 Hz or 60 Hz
- tvp514x returns -EINVAL.

Besides fixing this I also update the documentation and fix the misuse
of s_std(V4L2_STD_ALL) in several drivers. V4L2_STD_ALL is sometimes used
to enable autodetect mode, which is non-standard and in general should not
be done: if a receiver switches from a 60 Hz to a 50 Hz format automatically,
then this can in theory lead to buffer overruns in a DMA engine since a 50 Hz
frame is larger than the 60 Hz frame.

This behavior is removed in those drivers where it is clearly bogus.

After this patch series the following drivers still have problems:

- adv7180: supports the non-standard autodetect mode
- sta2x11: ditto (uses adv7180)

The adv7180 driver should implement querystd in the same manner as the adv7183
driver, and then the sta2x11 can be fixed as well.

- timblogiw: this calls querystd whenever a video node is opened. That's
  obviously a bad idea, but it's a fair amount of work to fix this and nobody
  I know can test this driver.

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


[RFC PATCH 01/14] adv7183: fix querystd

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

If no signal is detected, return V4L2_STD_UNKNOWN. Otherwise AND the standard
with the detected standards.

Note that the v4l2 core initializes the std with tvnorms before calling the
querystd ioctl.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Cc: Scott Jiang scott.jiang.li...@gmail.com
---
 drivers/media/i2c/adv7183.c |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/media/i2c/adv7183.c b/drivers/media/i2c/adv7183.c
index 7c48e22..b5e51d8 100644
--- a/drivers/media/i2c/adv7183.c
+++ b/drivers/media/i2c/adv7183.c
@@ -375,28 +375,28 @@ static int adv7183_querystd(struct v4l2_subdev *sd, 
v4l2_std_id *std)
reg = adv7183_read(sd, ADV7183_STATUS_1);
switch ((reg  0x4)  0x7) {
case 0:
-   *std = V4L2_STD_NTSC;
+   *std = V4L2_STD_NTSC;
break;
case 1:
-   *std = V4L2_STD_NTSC_443;
+   *std = V4L2_STD_NTSC_443;
break;
case 2:
-   *std = V4L2_STD_PAL_M;
+   *std = V4L2_STD_PAL_M;
break;
case 3:
-   *std = V4L2_STD_PAL_60;
+   *std = V4L2_STD_PAL_60;
break;
case 4:
-   *std = V4L2_STD_PAL;
+   *std = V4L2_STD_PAL;
break;
case 5:
-   *std = V4L2_STD_SECAM;
+   *std = V4L2_STD_SECAM;
break;
case 6:
-   *std = V4L2_STD_PAL_Nc;
+   *std = V4L2_STD_PAL_Nc;
break;
case 7:
-   *std = V4L2_STD_SECAM;
+   *std = V4L2_STD_SECAM;
break;
default:
*std = V4L2_STD_UNKNOWN;
-- 
1.7.10.4

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


[RFC PATCH 03/14] ks0127: fix querystd

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Return V4L2_STD_UNKNOWN if no signal is detected.
Otherwise AND the standard mask with the detected standards.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/ks0127.c |   17 -
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/ks0127.c b/drivers/media/i2c/ks0127.c
index c722776..f7250e5 100644
--- a/drivers/media/i2c/ks0127.c
+++ b/drivers/media/i2c/ks0127.c
@@ -616,17 +616,24 @@ static int ks0127_status(struct v4l2_subdev *sd, u32 
*pstatus, v4l2_std_id *pstd
 {
int stat = V4L2_IN_ST_NO_SIGNAL;
u8 status;
-   v4l2_std_id std = V4L2_STD_ALL;
+   v4l2_std_id std = pstd ? *pstd : V4L2_STD_ALL;
 
status = ks0127_read(sd, KS_STAT);
if (!(status  0x20))/* NOVID not set */
stat = 0;
-   if (!(status  0x01)) /* CLOCK set */
+   if (!(status  0x01)) {   /* CLOCK set */
stat |= V4L2_IN_ST_NO_COLOR;
-   if ((status  0x08))   /* PALDET set */
-   std = V4L2_STD_PAL;
+   std = V4L2_STD_UNKNOWN;
+   } else {
+   if ((status  0x08))   /* PALDET set */
+   std = V4L2_STD_PAL;
+   else
+   std = V4L2_STD_NTSC;
+   }
+   if ((status  0x10))   /* PALDET set */
+   std = V4L2_STD_525_60;
else
-   std = V4L2_STD_NTSC;
+   std = V4L2_STD_625_50;
if (pstd)
*pstd = std;
if (pstatus)
-- 
1.7.10.4

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


[RFC PATCH 02/14] bt819: fix querystd

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Return V4L2_STD_UNKNOWN if no signal is detected.
Otherwise AND the standard mask with the detected standards.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/bt819.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/bt819.c b/drivers/media/i2c/bt819.c
index ee9ed67..3c0a5ab 100644
--- a/drivers/media/i2c/bt819.c
+++ b/drivers/media/i2c/bt819.c
@@ -217,15 +217,17 @@ static int bt819_status(struct v4l2_subdev *sd, u32 
*pstatus, v4l2_std_id *pstd)
struct bt819 *decoder = to_bt819(sd);
int status = bt819_read(decoder, 0x00);
int res = V4L2_IN_ST_NO_SIGNAL;
-   v4l2_std_id std;
+   v4l2_std_id std = pstd ? *pstd : V4L2_STD_ALL;
 
if ((status  0x80))
res = 0;
+   else
+   std = V4L2_STD_UNKNOWN;
 
if ((status  0x10))
-   std = V4L2_STD_PAL;
+   std = V4L2_STD_PAL;
else
-   std = V4L2_STD_NTSC;
+   std = V4L2_STD_NTSC;
if (pstd)
*pstd = std;
if (pstatus)
-- 
1.7.10.4

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


[RFC PATCH 04/14] saa7110: fix querystd

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Return V4L2_STD_UNKNOWN if no signal is detected.
Otherwise AND the standard mask with the detected standards.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/saa7110.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/saa7110.c b/drivers/media/i2c/saa7110.c
index e4026aa..5480a18 100644
--- a/drivers/media/i2c/saa7110.c
+++ b/drivers/media/i2c/saa7110.c
@@ -203,7 +203,7 @@ static v4l2_std_id determine_norm(struct v4l2_subdev *sd)
status = saa7110_read(sd);
if (status  0x40) {
v4l2_dbg(1, debug, sd, status=0x%02x (no signal)\n, status);
-   return decoder-norm;   /* no change*/
+   return V4L2_STD_UNKNOWN;
}
if ((status  3) == 0) {
saa7110_write(sd, 0x06, 0x83);
@@ -265,7 +265,7 @@ static int saa7110_g_input_status(struct v4l2_subdev *sd, 
u32 *pstatus)
 
 static int saa7110_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
 {
-   *(v4l2_std_id *)std = determine_norm(sd);
+   *std = determine_norm(sd);
return 0;
 }
 
-- 
1.7.10.4

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


[RFC PATCH 06/14] saa7191: fix querystd

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Return V4L2_STD_UNKNOWN if no signal is detected.
Otherwise AND the standard mask with the detected standards.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/saa7191.c |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/media/i2c/saa7191.c b/drivers/media/i2c/saa7191.c
index 84f7899..9d8ea2a 100644
--- a/drivers/media/i2c/saa7191.c
+++ b/drivers/media/i2c/saa7191.c
@@ -272,7 +272,7 @@ static int saa7191_querystd(struct v4l2_subdev *sd, 
v4l2_std_id *norm)
 
dprintk(SAA7191 extended signal auto-detection...\n);
 
-   *norm = V4L2_STD_NTSC | V4L2_STD_PAL | V4L2_STD_SECAM;
+   *norm = V4L2_STD_NTSC | V4L2_STD_PAL | V4L2_STD_SECAM;
stdc = ~SAA7191_STDC_SECS;
ctl3 = ~(SAA7191_CTL3_FSEL);
 
@@ -303,7 +303,7 @@ static int saa7191_querystd(struct v4l2_subdev *sd, 
v4l2_std_id *norm)
if (status  SAA7191_STATUS_FIDT) {
/* 60Hz signal - NTSC */
dprintk(60Hz signal: NTSC\n);
-   *norm = V4L2_STD_NTSC;
+   *norm = V4L2_STD_NTSC;
return 0;
}
 
@@ -325,12 +325,13 @@ static int saa7191_querystd(struct v4l2_subdev *sd, 
v4l2_std_id *norm)
if (status  SAA7191_STATUS_FIDT) {
dprintk(No 50Hz signal\n);
saa7191_s_std(sd, old_norm);
-   return -EAGAIN;
+   *norm = V4L2_STD_UNKNOWN;
+   return 0;
}
 
if (status  SAA7191_STATUS_CODE) {
dprintk(PAL\n);
-   *norm = V4L2_STD_PAL;
+   *norm = V4L2_STD_PAL;
return saa7191_s_std(sd, old_norm);
}
 
@@ -350,18 +351,19 @@ static int saa7191_querystd(struct v4l2_subdev *sd, 
v4l2_std_id *norm)
/* not 50Hz ? */
if (status  SAA7191_STATUS_FIDT) {
dprintk(No 50Hz signal\n);
-   err = -EAGAIN;
+   *norm = V4L2_STD_UNKNOWN;
goto out;
}
 
if (status  SAA7191_STATUS_CODE) {
/* Color detected - SECAM */
dprintk(SECAM\n);
-   *norm = V4L2_STD_SECAM;
+   *norm = V4L2_STD_SECAM;
return saa7191_s_std(sd, old_norm);
}
 
dprintk(No color detected with SECAM - Going back to PAL.\n);
+   *norm = V4L2_STD_UNKNOWN;
 
 out:
return saa7191_s_std(sd, old_norm);
-- 
1.7.10.4

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


[RFC PATCH 05/14] saa7115: fix querystd

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Return V4L2_STD_UNKNOWN if no signal is detected.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/saa7115.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index 18cf0bf..e247fdd 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -1420,6 +1420,7 @@ static int saa711x_querystd(struct v4l2_subdev *sd, 
v4l2_std_id *std)
*std = V4L2_STD_SECAM;
break;
default:
+   *std = V4L2_STD_UNKNOWN;
/* Can't detect anything */
break;
}
@@ -1428,8 +1429,10 @@ static int saa711x_querystd(struct v4l2_subdev *sd, 
v4l2_std_id *std)
v4l2_dbg(1, debug, sd, Status byte 2 (0x1f)=0x%02x\n, reg1f);
 
/* horizontal/vertical not locked */
-   if (reg1f  0x40)
+   if (reg1f  0x40) {
+   *std = V4L2_STD_UNKNOWN;
goto ret;
+   }
 
if (reg1f  0x20)
*std = V4L2_STD_525_60;
-- 
1.7.10.4

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


[RFC PATCH 11/14] v4l2-ioctl: clarify querystd comment.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Improve the querystd comment.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/v4l2-core/v4l2-ioctl.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c 
b/drivers/media/v4l2-core/v4l2-ioctl.c
index f81bda1..768f606 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1407,10 +1407,10 @@ static int v4l_querystd(const struct v4l2_ioctl_ops 
*ops,
v4l2_std_id *p = arg;
 
/*
-* If nothing detected, it should return all supported
-* standard.
-* Drivers just need to mask the std argument, in order
-* to remove the standards that don't apply from the mask.
+* If no signal is detected, then the driver should return
+* V4L2_STD_UNKNOWN. Otherwise it should return tvnorms with
+* any standards that do not apply removed.
+*
 * This means that tuners, audio and video decoders can join
 * their efforts to improve the standards detection.
 */
-- 
1.7.10.4

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


[RFC PATCH 08/14] vpx3220: fix querystd

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Return V4L2_STD_UNKNOWN if no signal is detected.
Otherwise AND the standard mask with the detected standards.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/vpx3220.c |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/vpx3220.c b/drivers/media/i2c/vpx3220.c
index f02e74b..02c1e39 100644
--- a/drivers/media/i2c/vpx3220.c
+++ b/drivers/media/i2c/vpx3220.c
@@ -297,7 +297,7 @@ static int vpx3220_init(struct v4l2_subdev *sd, u32 val)
 static int vpx3220_status(struct v4l2_subdev *sd, u32 *pstatus, v4l2_std_id 
*pstd)
 {
int res = V4L2_IN_ST_NO_SIGNAL, status;
-   v4l2_std_id std = 0;
+   v4l2_std_id std = pstd ? *pstd : V4L2_STD_ALL;
 
status = vpx3220_fp_read(sd, 0x0f3);
 
@@ -314,19 +314,21 @@ static int vpx3220_status(struct v4l2_subdev *sd, u32 
*pstatus, v4l2_std_id *pst
case 0x10:
case 0x14:
case 0x18:
-   std = V4L2_STD_PAL;
+   std = V4L2_STD_PAL;
break;
 
case 0x08:
-   std = V4L2_STD_SECAM;
+   std = V4L2_STD_SECAM;
break;
 
case 0x04:
case 0x0c:
case 0x1c:
-   std = V4L2_STD_NTSC;
+   std = V4L2_STD_NTSC;
break;
}
+   } else {
+   std = V4L2_STD_UNKNOWN;
}
if (pstd)
*pstd = std;
-- 
1.7.10.4

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


[RFC PATCH 10/14] zoran: remove bogus autodetect mode in set_norm

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Currently, if the norm set is V4L2_STD_ALL, then autodetect the current
standard and use that. This is non-standard behavior, and in fact it hasn't
worked for a very long time: before s_std is called in this driver, the
v4l2 core will mask it with the tvnorms field. So even if the application
passes V4L2_STD_ALL, the zoran driver will always see a subset of that.

Since nobody ever complained about this we just remove this non-standard
functionality.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/pci/zoran/zoran_driver.c |   23 ---
 1 file changed, 23 deletions(-)

diff --git a/drivers/media/pci/zoran/zoran_driver.c 
b/drivers/media/pci/zoran/zoran_driver.c
index 1168a84..4ec2708 100644
--- a/drivers/media/pci/zoran/zoran_driver.c
+++ b/drivers/media/pci/zoran/zoran_driver.c
@@ -1456,29 +1456,6 @@ zoran_set_norm (struct zoran *zr,
return -EINVAL;
}
 
-   if (norm == V4L2_STD_ALL) {
-   unsigned int status = 0;
-   v4l2_std_id std = 0;
-
-   decoder_call(zr, video, querystd, std);
-   decoder_call(zr, core, s_std, std);
-
-   /* let changes come into effect */
-   ssleep(2);
-
-   decoder_call(zr, video, g_input_status, status);
-   if (status  V4L2_IN_ST_NO_SIGNAL) {
-   dprintk(1,
-   KERN_ERR
-   %s: %s - no norm detected\n,
-   ZR_DEVNAME(zr), __func__);
-   /* reset norm */
-   decoder_call(zr, core, s_std, zr-norm);
-   return -EIO;
-   }
-
-   norm = std;
-   }
if (norm  V4L2_STD_SECAM)
zr-timing = zr-card.tvn[2];
else if (norm  V4L2_STD_NTSC)
-- 
1.7.10.4

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


[RFC PATCH 14/14] cx23885: don't implement querystd if it doesn't do anything.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

cx23885 redirects querystd to g_std. That's pointless, just drop querystd
support.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/pci/cx23885/cx23885-417.c   |1 -
 drivers/media/pci/cx23885/cx23885-video.c |1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/media/pci/cx23885/cx23885-417.c 
b/drivers/media/pci/cx23885/cx23885-417.c
index 6dea11a..0a5f81d 100644
--- a/drivers/media/pci/cx23885/cx23885-417.c
+++ b/drivers/media/pci/cx23885/cx23885-417.c
@@ -1661,7 +1661,6 @@ static struct v4l2_file_operations mpeg_fops = {
 };
 
 static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
-   .vidioc_querystd = vidioc_g_std,
.vidioc_g_std= vidioc_g_std,
.vidioc_s_std= vidioc_s_std,
.vidioc_enum_input   = vidioc_enum_input,
diff --git a/drivers/media/pci/cx23885/cx23885-video.c 
b/drivers/media/pci/cx23885/cx23885-video.c
index ed08c89..776e553 100644
--- a/drivers/media/pci/cx23885/cx23885-video.c
+++ b/drivers/media/pci/cx23885/cx23885-video.c
@@ -1743,7 +1743,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
.vidioc_dqbuf = vidioc_dqbuf,
.vidioc_s_std = vidioc_s_std,
.vidioc_g_std = vidioc_g_std,
-   .vidioc_querystd  = vidioc_g_std,
.vidioc_enum_input= vidioc_enum_input,
.vidioc_g_input   = vidioc_g_input,
.vidioc_s_input   = vidioc_s_input,
-- 
1.7.10.4

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


[RFC PATCH 07/14] tvp514x: fix querystd

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Return V4L2_STD_UNKNOWN if no signal is detected.
Otherwise AND the standard mask with the detected standards.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/tvp514x.c |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index 7438e01..c2b343b 100644
--- a/drivers/media/i2c/tvp514x.c
+++ b/drivers/media/i2c/tvp514x.c
@@ -543,8 +543,6 @@ static int tvp514x_querystd(struct v4l2_subdev *sd, 
v4l2_std_id *std_id)
if (std_id == NULL)
return -EINVAL;
 
-   *std_id = V4L2_STD_UNKNOWN;
-
/* To query the standard the TVP514x must power on the ADCs. */
if (!decoder-streaming) {
tvp514x_s_stream(sd, 1);
@@ -553,8 +551,10 @@ static int tvp514x_querystd(struct v4l2_subdev *sd, 
v4l2_std_id *std_id)
 
/* query the current standard */
current_std = tvp514x_query_current_std(sd);
-   if (current_std == STD_INVALID)
+   if (current_std == STD_INVALID) {
+   *std_id = V4L2_STD_UNKNOWN;
return 0;
+   }
 
input_sel = decoder-input;
 
@@ -595,10 +595,12 @@ static int tvp514x_querystd(struct v4l2_subdev *sd, 
v4l2_std_id *std_id)
}
/* check whether signal is locked */
sync_lock_status = tvp514x_read_reg(sd, REG_STATUS1);
-   if (lock_mask != (sync_lock_status  lock_mask))
+   if (lock_mask != (sync_lock_status  lock_mask)) {
+   *std_id = V4L2_STD_UNKNOWN;
return 0;   /* No input detected */
+   }
 
-   *std_id = decoder-std_list[current_std].standard.id;
+   *std_id = decoder-std_list[current_std].standard.id;
 
v4l2_dbg(1, debug, sd, Current STD: %s\n,
decoder-std_list[current_std].standard.name);
-- 
1.7.10.4

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


[RFC PATCH 12/14] DocBook/media/v4l: clarify the QUERYSTD documentation.

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

Explicitly mention that this ioctl should return V4L2_STD_UNKNOWN if
not signal was detected.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 Documentation/DocBook/media/v4l/vidioc-querystd.xml |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/DocBook/media/v4l/vidioc-querystd.xml 
b/Documentation/DocBook/media/v4l/vidioc-querystd.xml
index fe80a18..2223485 100644
--- a/Documentation/DocBook/media/v4l/vidioc-querystd.xml
+++ b/Documentation/DocBook/media/v4l/vidioc-querystd.xml
@@ -54,7 +54,8 @@ standard automatically. To do so, applications call constant
 VIDIOC_QUERYSTD/constant with a pointer to a v4l2-std-id; type. The
 driver stores here a set of candidates, this can be a single flag or a
 set of supported standards if for example the hardware can only
-distinguish between 50 and 60 Hz systems. When detection is not
+distinguish between 50 and 60 Hz systems. If no signal was detected,
+then the driver will return V4L2_STD_UNKNOWN. When detection is not
 possible or fails, the set must contain all standards supported by the
 current video input or output./para
 
-- 
1.7.10.4

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


[RFC PATCH 13/14] tvp5150: fix s_std support

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

- do exact matching for special formats like PAL-M
- drop autodetect support: it's non-standard, and it is bogus as well since 
there
  is no way to get back the detected standard since neither g_std nor querystd 
are
  implemented.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/tvp5150.c |8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index b3cf266..0e95e5e 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -727,13 +727,11 @@ static int tvp5150_set_std(struct v4l2_subdev *sd, 
v4l2_std_id std)
 
/* First tests should be against specific std */
 
-   if (std == V4L2_STD_ALL) {
-   fmt = VIDEO_STD_AUTO_SWITCH_BIT;/* Autodetect mode */
-   } else if (std  V4L2_STD_NTSC_443) {
+   if (std == V4L2_STD_NTSC_443) {
fmt = VIDEO_STD_NTSC_4_43_BIT;
-   } else if (std  V4L2_STD_PAL_M) {
+   } else if (std == V4L2_STD_PAL_M) {
fmt = VIDEO_STD_PAL_M_BIT;
-   } else if (std  (V4L2_STD_PAL_N | V4L2_STD_PAL_Nc)) {
+   } else if (std == V4L2_STD_PAL_N || std == V4L2_STD_PAL_Nc) {
fmt = VIDEO_STD_PAL_COMBINATION_N_BIT;
} else {
/* Then, test against generic ones */
-- 
1.7.10.4

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


[RFC PATCH 09/14] bttv: fix querystd

2013-05-29 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

AND the standard mask with the detected standards.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/pci/bt8xx/bttv-driver.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/bt8xx/bttv-driver.c 
b/drivers/media/pci/bt8xx/bttv-driver.c
index a334c94..555d37c 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -1761,9 +1761,9 @@ static int bttv_querystd(struct file *file, void *f, 
v4l2_std_id *id)
struct bttv *btv = fh-btv;
 
if (btread(BT848_DSTATUS)  BT848_DSTATUS_NUML)
-   *id = V4L2_STD_625_50;
+   *id = V4L2_STD_625_50;
else
-   *id = V4L2_STD_525_60;
+   *id = V4L2_STD_525_60;
return 0;
 }
 
-- 
1.7.10.4

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


Re: Keene

2013-05-29 Thread Hans Verkuil
On Fri April 19 2013 11:11:27 Antti Palosaari wrote:
 On 04/19/2013 10:12 AM, Hans Verkuil wrote:
  On Wed April 17 2013 21:45:24 Antti Palosaari wrote:
  On 04/15/2013 09:55 AM, Hans Verkuil wrote:
  On Fri April 12 2013 02:11:41 Antti Palosaari wrote:
  Hello Hans,
  That device is working very, thank you for it. Anyhow, I noticed two 
  things.
 
  1) it does not start transmitting just after I plug it - I have to
  retune it!
  Output says it is tuned to 95.16 MHz by default, but it is not.
  After I issue retune, just to same channel it starts working.
  $ v4l2-ctl -d /dev/radio0 --set-freq=95.16
 
  Can you try this patch:
 
 
  It does not resolve the problem. It is quite strange behavior. After I
  install modules, and modules are unload, plug stick in first time, it
  usually (not every-time) starts TX. But when I replug it without
  unloading modules, it will never start TX. Tx is started always when I
  set freq using v4l2-ctl.
 
  If you replace 'false' by 'true' in the cmd_main, does that make it work?
  I'm fairly certain that's the problem.
 
 Nope, I replaces all 'false' with 'true' and problem remains. When 
 modules were unload and device is plugged it starts TX. When I replug it 
 doesn't start anymore.
 
 I just added msleep(1000); just before keene_cmd_main() in .probe() and 
 now it seems to work every-time. So it is definitely timing issue. I 
 will try to find out some smallest suitable value for sleep and and sent 
 patch.

Have you had time to find a smaller msleep value?

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


[PATCH for v3.10] cx88: fix NULL pointer dereference

2013-05-29 Thread Hans Verkuil
This fixes a NULL pointer deference when loading the cx88_dvb module for a
Hauppauge HVR4000.

The bugzilla bug report is here:

https://bugzilla.kernel.org/show_bug.cgi?id=56271

The cause is that the wm8775 is optional, so even though the board info says
there is one, it doesn't have to be there. Checking whether the module was
actually loaded is much safer.

Note that this driver is quite buggy when it comes to unloading and reloading
modules. Unloading cx8800 and reloading it again will still cause a crash,
most likely because either the i2c bus isn't unloaded at the right time and/or
the v4l2_device_unregister isn't called at the right time.

Signed-off-by: Hans Verkuil hans.verk...@cisco.com
Reported-by: Sebastian Frei sebast...@familie-frei.net

diff --git a/drivers/media/pci/cx88/cx88-alsa.c 
b/drivers/media/pci/cx88/cx88-alsa.c
index 27d6262..aba5b1c 100644
--- a/drivers/media/pci/cx88/cx88-alsa.c
+++ b/drivers/media/pci/cx88/cx88-alsa.c
@@ -615,7 +615,7 @@ static int snd_cx88_volume_put(struct snd_kcontrol 
*kcontrol,
int changed = 0;
u32 old;
 
-   if (core-board.audio_chip == V4L2_IDENT_WM8775)
+   if (core-sd_wm8775)
snd_cx88_wm8775_volume_put(kcontrol, value);
 
left = value-value.integer.value[0]  0x3f;
@@ -682,8 +682,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol 
*kcontrol,
vol ^= bit;
cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol);
/* Pass mute onto any WM8775 */
-   if ((core-board.audio_chip == V4L2_IDENT_WM8775) 
-   ((16) == bit))
+   if (core-sd_wm8775  ((16) == bit))
wm8775_s_ctrl(core, V4L2_CID_AUDIO_MUTE, 0 != (vol  
bit));
ret = 1;
}
@@ -903,7 +902,7 @@ static int cx88_audio_initdev(struct pci_dev *pci,
goto error;
 
/* If there's a wm8775 then add a Line-In ALC switch */
-   if (core-board.audio_chip == V4L2_IDENT_WM8775)
+   if (core-sd_wm8775)
snd_ctl_add(card, snd_ctl_new1(snd_cx88_alc_switch, chip));
 
strcpy (card-driver, CX88x);
diff --git a/drivers/media/pci/cx88/cx88-video.c 
b/drivers/media/pci/cx88/cx88-video.c
index e3f6181..62255bf 100644
--- a/drivers/media/pci/cx88/cx88-video.c
+++ b/drivers/media/pci/cx88/cx88-video.c
@@ -385,8 +385,7 @@ int cx88_video_mux(struct cx88_core *core, unsigned int 
input)
/* The wm8775 module has the 2 route hardwired into
   the initialization. Some boards may use different
   routes for different inputs. HVR-1300 surely does */
-   if (core-board.audio_chip 
-   core-board.audio_chip == V4L2_IDENT_WM8775) {
+   if (core-sd_wm8775) {
call_all(core, audio, s_routing,
 INPUT(input).audioroute, 0, 0);
}
@@ -771,8 +770,7 @@ static int video_open(struct file *file)
cx_write(MO_GP1_IO, core-board.radio.gpio1);
cx_write(MO_GP2_IO, core-board.radio.gpio2);
if (core-board.radio.audioroute) {
-   if(core-board.audio_chip 
-   core-board.audio_chip == V4L2_IDENT_WM8775) {
+   if (core-sd_wm8775) {
call_all(core, audio, s_routing,
core-board.radio.audioroute, 0, 0);
}
@@ -959,7 +957,7 @@ static int cx8800_s_aud_ctrl(struct v4l2_ctrl *ctrl)
u32 value,mask;
 
/* Pass changes onto any WM8775 */
-   if (core-board.audio_chip == V4L2_IDENT_WM8775) {
+   if (core-sd_wm8775) {
switch (ctrl-id) {
case V4L2_CID_AUDIO_MUTE:
wm8775_s_ctrl(core, ctrl-id, ctrl-val);
--
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: Keene

2013-05-29 Thread Antti Palosaari

On 05/29/2013 05:26 PM, Hans Verkuil wrote:

On Fri April 19 2013 11:11:27 Antti Palosaari wrote:

On 04/19/2013 10:12 AM, Hans Verkuil wrote:

On Wed April 17 2013 21:45:24 Antti Palosaari wrote:

On 04/15/2013 09:55 AM, Hans Verkuil wrote:

On Fri April 12 2013 02:11:41 Antti Palosaari wrote:

Hello Hans,
That device is working very, thank you for it. Anyhow, I noticed two things.

1) it does not start transmitting just after I plug it - I have to
retune it!
Output says it is tuned to 95.16 MHz by default, but it is not.
After I issue retune, just to same channel it starts working.
$ v4l2-ctl -d /dev/radio0 --set-freq=95.16


Can you try this patch:



It does not resolve the problem. It is quite strange behavior. After I
install modules, and modules are unload, plug stick in first time, it
usually (not every-time) starts TX. But when I replug it without
unloading modules, it will never start TX. Tx is started always when I
set freq using v4l2-ctl.


If you replace 'false' by 'true' in the cmd_main, does that make it work?
I'm fairly certain that's the problem.


Nope, I replaces all 'false' with 'true' and problem remains. When
modules were unload and device is plugged it starts TX. When I replug it
doesn't start anymore.

I just added msleep(1000); just before keene_cmd_main() in .probe() and
now it seems to work every-time. So it is definitely timing issue. I
will try to find out some smallest suitable value for sleep and and sent
patch.


Have you had time to find a smaller msleep value?


Nope, but I will do it today (if I don't meet any problems when 
upgrading to latest master).


regards
Antti

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


cron job: media_tree daily build: WARNINGS

2013-05-29 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:   Wed May 29 19:00:20 CEST 2013
git branch: test
git hash:   7eac97d7e714429f7ef1ba5d35f94c07f4c34f8e
gcc version:i686-linux-gcc (GCC) 4.8.0
host hardware:  x86_64
host os:3.8-3.slh.2-amd64

linux-git-arm-davinci: OK
linux-git-arm-exynos: WARNINGS
linux-git-arm-omap: WARNINGS
linux-git-blackfin: WARNINGS
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.31.14-i686: WARNINGS
linux-2.6.32.27-i686: WARNINGS
linux-2.6.33.7-i686: WARNINGS
linux-2.6.34.7-i686: WARNINGS
linux-2.6.35.9-i686: WARNINGS
linux-2.6.36.4-i686: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: WARNINGS
linux-3.10-rc1-i686: WARNINGS
linux-3.1.10-i686: WARNINGS
linux-3.2.37-i686: WARNINGS
linux-3.3.8-i686: WARNINGS
linux-3.4.27-i686: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-2.6.31.14-x86_64: WARNINGS
linux-2.6.32.27-x86_64: WARNINGS
linux-2.6.33.7-x86_64: WARNINGS
linux-2.6.34.7-x86_64: WARNINGS
linux-2.6.35.9-x86_64: WARNINGS
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: WARNINGS
linux-3.10-rc1-x86_64: WARNINGS
linux-3.1.10-x86_64: WARNINGS
linux-3.2.37-x86_64: WARNINGS
linux-3.3.8-x86_64: WARNINGS
linux-3.4.27-x86_64: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
apps: WARNINGS
spec-git: OK
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

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

The 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 v5] adv7180: add more subdev video ops

2013-05-29 Thread Sergei Shtylyov
From: Vladimir Barinov vladimir.bari...@cogentembedded.com

Add subdev video ops for ADV7180 video decoder.  This makes decoder usable on
the soc-camera drivers.

Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com
[Sergei: renamed adv7180_try_mbus_fmt() to adv7180_mbus_fmt().]
Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com

---
This patch is against the 'media_tree.git' repo.

Changes from version 4:
- renamed adv7180_try_mbus_fmt() to adv7180_mbus_fmt().

Changes from version 3:
- set the field format independent of a video standard in try_mbus_fmt() method;
- removed adv7180_g_mbus_fmt(), adv7180_g_mbus_fmt(), and the 'fmt' field from
  'struct adv7180_state', and so use adv7180_try_mbus_fmt()  to implement both
  g_mbus_fmt() and s_mbus_fmt() methods;
- removed cropcap() method.

Changes from version 2:
- set the field format depending on video standard in try_mbus_fmt() method;
- removed querystd() method calls from try_mbus_fmt() and cropcap() methods;
- removed g_crop() method.

 drivers/media/i2c/adv7180.c |   46 
 1 file changed, 46 insertions(+)

Index: media_tree/drivers/media/i2c/adv7180.c
===
--- media_tree.orig/drivers/media/i2c/adv7180.c
+++ media_tree/drivers/media/i2c/adv7180.c
@@ -1,6 +1,8 @@
 /*
  * adv7180.c Analog Devices ADV7180 video decoder driver
  * Copyright (c) 2009 Intel Corporation
+ * Copyright (C) 2013 Cogent Embedded, Inc.
+ * Copyright (C) 2013 Renesas Solutions Corp.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -397,10 +399,54 @@ static void adv7180_exit_controls(struct
v4l2_ctrl_handler_free(state-ctrl_hdl);
 }
 
+static int adv7180_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned int index,
+enum v4l2_mbus_pixelcode *code)
+{
+   if (index  0)
+   return -EINVAL;
+
+   *code = V4L2_MBUS_FMT_YUYV8_2X8;
+
+   return 0;
+}
+
+static int adv7180_mbus_fmt(struct v4l2_subdev *sd,
+   struct v4l2_mbus_framefmt *fmt)
+{
+   struct adv7180_state *state = to_state(sd);
+
+   fmt-code = V4L2_MBUS_FMT_YUYV8_2X8;
+   fmt-colorspace = V4L2_COLORSPACE_SMPTE170M;
+   fmt-field = V4L2_FIELD_INTERLACED;
+   fmt-width = 720;
+   fmt-height = state-curr_norm  V4L2_STD_525_60 ? 480 : 576;
+
+   return 0;
+}
+
+static int adv7180_g_mbus_config(struct v4l2_subdev *sd,
+struct v4l2_mbus_config *cfg)
+{
+   /*
+* The ADV7180 sensor supports BT.601/656 output modes.
+* The BT.656 is default and not yet configurable by s/w.
+*/
+   cfg-flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING |
+V4L2_MBUS_DATA_ACTIVE_HIGH;
+   cfg-type = V4L2_MBUS_BT656;
+
+   return 0;
+}
+
 static const struct v4l2_subdev_video_ops adv7180_video_ops = {
.querystd = adv7180_querystd,
.g_input_status = adv7180_g_input_status,
.s_routing = adv7180_s_routing,
+   .enum_mbus_fmt = adv7180_enum_mbus_fmt,
+   .try_mbus_fmt = adv7180_mbus_fmt,
+   .g_mbus_fmt = adv7180_mbus_fmt,
+   .s_mbus_fmt = adv7180_mbus_fmt,
+   .g_mbus_config = adv7180_g_mbus_config,
 };
 
 static const struct v4l2_subdev_core_ops adv7180_core_ops = {
--
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 v6] V4L2: I2C: ML86V7667 video decoder driver

2013-05-29 Thread Sergei Shtylyov
From: Vladimir Barinov vladimir.bari...@cogentembedded.com

Add OKI Semiconductor ML86V7667 video decoder driver.

Signed-off-by: Vladimir Barinov vladimir.bari...@cogentembedded.com
[Sergei: added v4l2_device_unregister_subdev() call to the error cleanup path
of ml86v7667_probe(), renamed ml86v7667_try_mbus_fmt() to ml86v7667_mbus_fmt(),
killed v4l2_chip_match_i2c_client() checks in the [gs]_register() methods, fixed
the prototype of the s_register() method, did some cleanup.]
Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com

---
This patch is against the 'media_tree.git' repo.

Changes since version 5:
- renamed ml86v7667_try_mbus_fmt() to ml86v7667_mbus_fmt();
- killed v4l2_chip_match_i2c_client() checks in the [gs]_register() methods;
- fixed the prototype of the s_register() method -- it was causing a compilation
  warning).

Changes since version 4:
- set the field format independent of a video standard in try_mbus_fmt() method;
- removed ml86v7667_g_mbus_fmt(), ml86v7667_g_mbus_fmt(), and the 'fmt'  field
  from 'struct ml86v7667_priv', and so use ml86v7667_try_mbus_fmt() to implement
  both g_mbus_fmt() and s_mbus_fmt() methods;
- removed cropcap() method;
- removed permission check from g_register() and s_register() methods.

Changes since version 3:
- set the field format depending on video standard in try_mbus_fmt() method;
- refreshed the patch.

Changes since version 2:
- removed now unused #include;
- fixed querystd() method to return currently detected video standard;
- switched from using V4L2_STD_[PAL|NTSC] to using V4L2_STD_[625_50|525_60].

Changes since the original posting:
- fixed ACCC_CHROMA_CB_MASK;
- got rid of the autodetection feature;
- removed querystd() method calls from other methods;
- removed deprecated g_chip_ident() method.

 drivers/media/i2c/Kconfig |9 
 drivers/media/i2c/Makefile|1 
 drivers/media/i2c/ml86v7667.c |  431 ++
 3 files changed, 441 insertions(+)

Index: media_tree/drivers/media/i2c/Kconfig
===
--- media_tree.orig/drivers/media/i2c/Kconfig
+++ media_tree/drivers/media/i2c/Kconfig
@@ -245,6 +245,15 @@ config VIDEO_KS0127
  To compile this driver as a module, choose M here: the
  module will be called ks0127.
 
+config VIDEO_ML86V7667
+   tristate OKI ML86V7667 video decoder
+   depends on VIDEO_V4L2  I2C
+   ---help---
+ Support for the OKI Semiconductor ML86V7667 video decoder.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ml86v7667.
+
 config VIDEO_SAA7110
tristate Philips SAA7110 video decoder
depends on VIDEO_V4L2  I2C
Index: media_tree/drivers/media/i2c/Makefile
===
--- media_tree.orig/drivers/media/i2c/Makefile
+++ media_tree/drivers/media/i2c/Makefile
@@ -70,3 +70,4 @@ obj-$(CONFIG_VIDEO_AS3645A)   += as3645a.o
 obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o
 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
 obj-$(CONFIG_VIDEO_IR_I2C)  += ir-kbd-i2c.o
+obj-$(CONFIG_VIDEO_ML86V7667)  += ml86v7667.o
Index: media_tree/drivers/media/i2c/ml86v7667.c
===
--- /dev/null
+++ media_tree/drivers/media/i2c/ml86v7667.c
@@ -0,0 +1,431 @@
+/*
+ * OKI Semiconductor ML86V7667 video decoder driver
+ *
+ * Author: Vladimir Barinov sou...@cogentembedded.com
+ * Copyright (C) 2013 Cogent Embedded, Inc.
+ * Copyright (C) 2013 Renesas Solutions Corp.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include linux/init.h
+#include linux/module.h
+#include linux/i2c.h
+#include linux/slab.h
+#include linux/videodev2.h
+#include media/v4l2-subdev.h
+#include media/v4l2-device.h
+#include media/v4l2-ioctl.h
+#include media/v4l2-ctrls.h
+
+#define DRV_NAME ml86v7667
+
+/* Subaddresses */
+#define MRA_REG0x00 /* Mode Register A */
+#define MRC_REG0x02 /* Mode Register C */
+#define LUMC_REG   0x0C /* Luminance Control */
+#define CLC_REG0x10 /* Contrast level control */
+#define SSEPL_REG  0x11 /* Sync separation level */
+#define CHRCA_REG  0x12 /* Chrominance Control A */
+#define ACCC_REG   0x14 /* ACC Loop filter  Chrominance control */
+#define ACCRC_REG  0x15 /* ACC Reference level control */
+#define HUE_REG0x16 /* Hue control */
+#define ADC2_REG   0x1F /* ADC Register 2 */
+#define PLLR1_REG  0x20 /* PLL Register 1 */
+#define STATUS_REG 0x2C /* STATUS Register */
+
+/* Mode Register A register 

[RFC 2/3] saa7115: Remove unneeded register change for gm7113c

2013-05-29 Thread Jon Arne Jørgensen
On video std change, the driver would disable the automatic field
detection on the gm7113c chip, and force either 50Hz or 60Hz.
Don't do this any more.

Signed-off-by: Jon Arne Jørgensen jona...@jonarne.no
---
 drivers/media/i2c/saa7115.c | 25 ++---
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index 4403679..ccfaac9 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -453,23 +453,6 @@ static const unsigned char saa7115_cfg_50hz_video[] = {
 
 /* == SAA7715 VIDEO templates (end) ===  */
 
-/* == GM7113C VIDEO templates =  */
-static const unsigned char gm7113c_cfg_60hz_video[] = {
-   R_08_SYNC_CNTL, 0x68,   /* 0xBO: auto detection, 0x68 = 
NTSC */
-   R_0E_CHROMA_CNTL_1, 0x07,   /* video autodetection is on */
-
-   0x00, 0x00
-};
-
-static const unsigned char gm7113c_cfg_50hz_video[] = {
-   R_08_SYNC_CNTL, 0x28,   /* 0x28 = PAL */
-   R_0E_CHROMA_CNTL_1, 0x07,
-
-   0x00, 0x00
-};
-
-/* == GM7113C VIDEO templates (end) ===  */
-
 
 static const unsigned char saa7115_cfg_vbi_on[] = {
R_80_GLOBAL_CNTL_1, 0x00,   /* reset tasks */
@@ -955,16 +938,12 @@ static void saa711x_set_v4lstd(struct v4l2_subdev *sd, 
v4l2_std_id std)
// This works for NTSC-M, SECAM-L and the 50Hz PAL variants.
if (std  V4L2_STD_525_60) {
v4l2_dbg(1, debug, sd, decoder set standard 60 Hz\n);
-   if (state-ident == V4L2_IDENT_GM7113C)
-   saa711x_writeregs(sd, gm7113c_cfg_60hz_video);
-   else
+   if (state-ident != V4L2_IDENT_GM7113C)
saa711x_writeregs(sd, saa7115_cfg_60hz_video);
saa711x_set_size(sd, 720, 480);
} else {
v4l2_dbg(1, debug, sd, decoder set standard 50 Hz\n);
-   if (state-ident == V4L2_IDENT_GM7113C)
-   saa711x_writeregs(sd, gm7113c_cfg_50hz_video);
-   else
+   if (state-ident != V4L2_IDENT_GM7113C)
saa711x_writeregs(sd, saa7115_cfg_50hz_video);
saa711x_set_size(sd, 720, 576);
}
-- 
1.8.2.3

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


[RFC 1/3] saa7115: Set saa7113 init to values from datasheet

2013-05-29 Thread Jon Arne Jørgensen
Change all default values in the initial setup table to match the table
in the datasheet.

Signed-off-by: Jon Arne Jørgensen jona...@jonarne.no
---
 drivers/media/i2c/saa7115.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index d6f589a..4403679 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -223,12 +223,12 @@ static const unsigned char saa7111_init[] = {
 static const unsigned char saa7113_init[] = {
R_01_INC_DELAY, 0x08,
R_02_INPUT_CNTL_1, 0xc2,
-   R_03_INPUT_CNTL_2, 0x30,
+   R_03_INPUT_CNTL_2, 0x33,
R_04_INPUT_CNTL_3, 0x00,
R_05_INPUT_CNTL_4, 0x00,
-   R_06_H_SYNC_START, 0x89,
+   R_06_H_SYNC_START, 0xe9,
R_07_H_SYNC_STOP, 0x0d,
-   R_08_SYNC_CNTL, 0x88,
+   R_08_SYNC_CNTL, 0x98,
R_09_LUMA_CNTL, 0x01,
R_0A_LUMA_BRIGHT_CNTL, 0x80,
R_0B_LUMA_CONTRAST_CNTL, 0x47,
@@ -236,11 +236,11 @@ static const unsigned char saa7113_init[] = {
R_0D_CHROMA_HUE_CNTL, 0x00,
R_0E_CHROMA_CNTL_1, 0x01,
R_0F_CHROMA_GAIN_CNTL, 0x2a,
-   R_10_CHROMA_CNTL_2, 0x08,
+   R_10_CHROMA_CNTL_2, 0x00,
R_11_MODE_DELAY_CNTL, 0x0c,
-   R_12_RT_SIGNAL_CNTL, 0x07,
+   R_12_RT_SIGNAL_CNTL, 0x01,
R_13_RT_X_PORT_OUT_CNTL, 0x00,
-   R_14_ANAL_ADC_COMPAT_CNTL, 0x00,
+   R_14_ANAL_ADC_COMPAT_CNTL, 0x00,/* RESERVED */
R_15_VGATE_START_FID_CHG, 0x00,
R_16_VGATE_STOP, 0x00,
R_17_MISC_VGATE_CONF_AND_MSB, 0x00,
-- 
1.8.2.3

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


[RFC 0/3] saa7115: Implement i2c_board_info.platform_data

2013-05-29 Thread Jon Arne Jørgensen
This patch set adds handling of the i2c_board_info struct to the saa7115 driver.
The main goal of this patch is to give the different devices with the gm7113c
chip an opportunity to configure the chip to their needs.

I've only implemented the overrides I know are necessary to get the stk1160
and the smi2021 drivers to work.

The first patch in the series sets the saa7113 init table to the defaults
according to the datasheet. Maybe it's better to add a new initialization
table for the gm7113c chip to avoid breaking devices that depend on the
settings as they are now?
That would introduce some unneeded code duplication.

Jon Arne Jørgensen (3):
  saa7115: Set saa7113 init to values from datasheet
  saa7115: [gm7113c] Remove unneeded register change
  saa7115: Implement i2c_board_info.platform data

 drivers/media/i2c/saa7115.c |  91 
 include/media/saa7115.h | 109 
 2 files changed, 170 insertions(+), 30 deletions(-)

-- 
1.8.2.3

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


[RFC 3/3] saa7115: Implement i2c_board_info.platform data

2013-05-29 Thread Jon Arne Jørgensen
Implement i2c_board_info.platform_data handling in the driver so we can
make device specific changes to the chips we support.

Signed-off-by: Jon Arne Jørgensen jona...@jonarne.no
---
 drivers/media/i2c/saa7115.c |  62 +++--
 include/media/saa7115.h | 109 
 2 files changed, 166 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index ccfaac9..8e915c7 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -228,7 +228,7 @@ static const unsigned char saa7113_init[] = {
R_05_INPUT_CNTL_4, 0x00,
R_06_H_SYNC_START, 0xe9,
R_07_H_SYNC_STOP, 0x0d,
-   R_08_SYNC_CNTL, 0x98,
+   R_08_SYNC_CNTL, SAA7113_R08_DEFAULT,
R_09_LUMA_CNTL, 0x01,
R_0A_LUMA_BRIGHT_CNTL, 0x80,
R_0B_LUMA_CONTRAST_CNTL, 0x47,
@@ -236,11 +236,10 @@ static const unsigned char saa7113_init[] = {
R_0D_CHROMA_HUE_CNTL, 0x00,
R_0E_CHROMA_CNTL_1, 0x01,
R_0F_CHROMA_GAIN_CNTL, 0x2a,
-   R_10_CHROMA_CNTL_2, 0x00,
+   R_10_CHROMA_CNTL_2, SAA7113_R10_DEFAULT,
R_11_MODE_DELAY_CNTL, 0x0c,
-   R_12_RT_SIGNAL_CNTL, 0x01,
-   R_13_RT_X_PORT_OUT_CNTL, 0x00,
-   R_14_ANAL_ADC_COMPAT_CNTL, 0x00,/* RESERVED */
+   R_12_RT_SIGNAL_CNTL, SAA7113_R12_DEFAULT,
+   R_13_RT_X_PORT_OUT_CNTL, SAA7113_R13_DEFAULT,
R_15_VGATE_START_FID_CHG, 0x00,
R_16_VGATE_STOP, 0x00,
R_17_MISC_VGATE_CONF_AND_MSB, 0x00,
@@ -1583,6 +1582,53 @@ static const struct v4l2_subdev_ops saa711x_ops = {
 
 /* --- */
 
+static void saa7115_load_platform_data(struct saa711x_state *state,
+  struct saa7115_platform_data *data)
+{
+   struct v4l2_subdev *sd = state-sd;
+   u8 work;
+
+   switch (state-ident) {
+   case V4L2_IDENT_GM7113C:
+   if (data-saa7113_r08_htc !=
+   (SAA7113_R08_DEFAULT  SAA7113_R08_HTC_MASK)) {
+   work = saa711x_read(sd, R_08_SYNC_CNTL);
+   saa711x_write(sd, R_08_SYNC_CNTL, (work  0xe7) |
+   (data-saa7113_r08_htc  3));
+   }
+   if (data-saa7113_r10_ofts !=
+   (SAA7113_R10_DEFAULT  SAA7113_R10_OFTS_MASK)) {
+   work = saa711x_read(sd, R_10_CHROMA_CNTL_2);
+   saa711x_write(sd, R_10_CHROMA_CNTL_2, (work  0x3f) |
+   (data-saa7113_r10_ofts  6));
+   }
+   if (data-saa7113_r10_vrln !=
+   (SAA7113_R10_DEFAULT  SAA7113_R10_VRLN_MASK)) {
+   work = saa711x_read(sd, R_10_CHROMA_CNTL_2);
+   saa711x_write(sd, R_10_CHROMA_CNTL_2, (work  0xf7) |
+   (1  3));
+   }
+   if (data-saa7113_r12_rts0 !=
+   (SAA7113_R12_DEFAULT  SAA7113_R12_RTS0_MASK)) {
+   work = saa711x_read(sd, R_12_RT_SIGNAL_CNTL);
+   saa711x_write(sd, R_12_RT_SIGNAL_CNTL, (work  0xf0) |
+   data-saa7113_r12_rts0);
+   }
+   if (data-saa7113_r12_rts1 !=
+   (SAA7113_R12_DEFAULT  SAA7113_R12_RTS1_MASK)) {
+   work = saa711x_read(sd, R_12_RT_SIGNAL_CNTL);
+   saa711x_write(sd, R_12_RT_SIGNAL_CNTL, (work  0x0f) |
+   (data-saa7113_r12_rts1  4));
+   }
+   if (data-saa7113_r13_adlsb !=
+   (SAA7113_R13_DEFAULT  SAA7113_R13_ADLSB_MASK)) {
+   work = saa711x_read(sd, R_13_RT_X_PORT_OUT_CNTL);
+   saa711x_write(sd, R_13_RT_X_PORT_OUT_CNTL,
+   (work  0x7f) | (1  7));
+   }
+   }
+}
+
 /**
  * saa711x_detect_chip - Detects the saa711x (or clone) variant
  * @client:I2C client structure.
@@ -1769,6 +1815,12 @@ static int saa711x_probe(struct i2c_client *client,
}
if (state-ident  V4L2_IDENT_SAA7111A)
saa711x_writeregs(sd, saa7115_init_misc);
+
+   if (client-dev.platform_data) {
+   struct saa7115_platform_data *data = client-dev.platform_data;
+   saa7115_load_platform_data(state, data);
+   }
+
saa711x_set_v4lstd(sd, V4L2_STD_NTSC);
v4l2_ctrl_handler_setup(hdl);
 
diff --git a/include/media/saa7115.h b/include/media/saa7115.h
index 4079186..7bb4a11 100644
--- a/include/media/saa7115.h
+++ b/include/media/saa7115.h
@@ -64,5 +64,114 @@
 #define SAA7115_FREQ_FL_APLL (1  2) /* SA 3A[3], APLL, SAA7114/5 
only */
 #define SAA7115_FREQ_FL_DOUBLE_ASCLK (1  3) /* SA 39, LRDIV, SAA7114/5 only 
*/
 
+/* SAA7113 (and GM7113) Register settings */
+/* 

Re: [RFC 0/3] saa7115: Implement i2c_board_info.platform_data

2013-05-29 Thread Jon Arne Jørgensen
On Wed, May 29, 2013 at 10:41:15PM +0200, Jon Arne Jørgensen wrote:
 This patch set adds handling of the i2c_board_info struct to the saa7115 
 driver.
 The main goal of this patch is to give the different devices with the gm7113c
 chip an opportunity to configure the chip to their needs.
 
 I've only implemented the overrides I know are necessary to get the stk1160
 and the smi2021 drivers to work.
 
 The first patch in the series sets the saa7113 init table to the defaults
 according to the datasheet. Maybe it's better to add a new initialization
 table for the gm7113c chip to avoid breaking devices that depend on the
 settings as they are now?
 That would introduce some unneeded code duplication.


Hi,
I just realized that there are som grave errors in patch 3 in the
series.

I'll fix them and repost this series.

Best regards,
Jon Arne Jørgensen
 
 Jon Arne Jørgensen (3):
   saa7115: Set saa7113 init to values from datasheet
   saa7115: [gm7113c] Remove unneeded register change
   saa7115: Implement i2c_board_info.platform data
 
  drivers/media/i2c/saa7115.c |  91 
  include/media/saa7115.h | 109 
 
  2 files changed, 170 insertions(+), 30 deletions(-)
 
 -- 
 1.8.2.3
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-media in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 3/3] saa7115: Implement i2c_board_info.platform data

2013-05-29 Thread Jon Arne Jørgensen
On Wed, May 29, 2013 at 10:41:18PM +0200, Jon Arne Jørgensen wrote:
 Implement i2c_board_info.platform_data handling in the driver so we can
 make device specific changes to the chips we support.
 
 Signed-off-by: Jon Arne Jørgensen jona...@jonarne.no
 ---
  drivers/media/i2c/saa7115.c |  62 +++--
  include/media/saa7115.h | 109 
 
  2 files changed, 166 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
 index ccfaac9..8e915c7 100644
 --- a/drivers/media/i2c/saa7115.c
 +++ b/drivers/media/i2c/saa7115.c
 @@ -228,7 +228,7 @@ static const unsigned char saa7113_init[] = {
   R_05_INPUT_CNTL_4, 0x00,
   R_06_H_SYNC_START, 0xe9,
   R_07_H_SYNC_STOP, 0x0d,
 - R_08_SYNC_CNTL, 0x98,
 + R_08_SYNC_CNTL, SAA7113_R08_DEFAULT,
   R_09_LUMA_CNTL, 0x01,
   R_0A_LUMA_BRIGHT_CNTL, 0x80,
   R_0B_LUMA_CONTRAST_CNTL, 0x47,
 @@ -236,11 +236,10 @@ static const unsigned char saa7113_init[] = {
   R_0D_CHROMA_HUE_CNTL, 0x00,
   R_0E_CHROMA_CNTL_1, 0x01,
   R_0F_CHROMA_GAIN_CNTL, 0x2a,
 - R_10_CHROMA_CNTL_2, 0x00,
 + R_10_CHROMA_CNTL_2, SAA7113_R10_DEFAULT,
   R_11_MODE_DELAY_CNTL, 0x0c,
 - R_12_RT_SIGNAL_CNTL, 0x01,
 - R_13_RT_X_PORT_OUT_CNTL, 0x00,
 - R_14_ANAL_ADC_COMPAT_CNTL, 0x00,/* RESERVED */
 + R_12_RT_SIGNAL_CNTL, SAA7113_R12_DEFAULT,
 + R_13_RT_X_PORT_OUT_CNTL, SAA7113_R13_DEFAULT,
   R_15_VGATE_START_FID_CHG, 0x00,
   R_16_VGATE_STOP, 0x00,
   R_17_MISC_VGATE_CONF_AND_MSB, 0x00,
 @@ -1583,6 +1582,53 @@ static const struct v4l2_subdev_ops saa711x_ops = {
  
  /* --- */
  
 +static void saa7115_load_platform_data(struct saa711x_state *state,
 +struct saa7115_platform_data *data)
 +{
 + struct v4l2_subdev *sd = state-sd;
 + u8 work;
 +
 + switch (state-ident) {
 + case V4L2_IDENT_GM7113C:
 + if (data-saa7113_r08_htc !=
 + (SAA7113_R08_DEFAULT  SAA7113_R08_HTC_MASK)) {
 + work = saa711x_read(sd, R_08_SYNC_CNTL);
 + saa711x_write(sd, R_08_SYNC_CNTL, (work  0xe7) |
 + (data-saa7113_r08_htc  3));
 + }
 + if (data-saa7113_r10_ofts !=
 + (SAA7113_R10_DEFAULT  SAA7113_R10_OFTS_MASK)) {
 + work = saa711x_read(sd, R_10_CHROMA_CNTL_2);
 + saa711x_write(sd, R_10_CHROMA_CNTL_2, (work  0x3f) |
 + (data-saa7113_r10_ofts  6));
 + }
 + if (data-saa7113_r10_vrln !=
 + (SAA7113_R10_DEFAULT  SAA7113_R10_VRLN_MASK)) {
 + work = saa711x_read(sd, R_10_CHROMA_CNTL_2);
 + saa711x_write(sd, R_10_CHROMA_CNTL_2, (work  0xf7) |
 + (1  3));
 + }
 + if (data-saa7113_r12_rts0 !=
 + (SAA7113_R12_DEFAULT  SAA7113_R12_RTS0_MASK)) {
 + work = saa711x_read(sd, R_12_RT_SIGNAL_CNTL);
 + saa711x_write(sd, R_12_RT_SIGNAL_CNTL, (work  0xf0) |
 + data-saa7113_r12_rts0);
 + }
 + if (data-saa7113_r12_rts1 !=
 + (SAA7113_R12_DEFAULT  SAA7113_R12_RTS1_MASK)) {
 + work = saa711x_read(sd, R_12_RT_SIGNAL_CNTL);
 + saa711x_write(sd, R_12_RT_SIGNAL_CNTL, (work  0x0f) |
 + (data-saa7113_r12_rts1  4));
 + }
 + if (data-saa7113_r13_adlsb !=
 + (SAA7113_R13_DEFAULT  SAA7113_R13_ADLSB_MASK)) {
 + work = saa711x_read(sd, R_13_RT_X_PORT_OUT_CNTL);
 + saa711x_write(sd, R_13_RT_X_PORT_OUT_CNTL,
 + (work  0x7f) | (1  7));
 + }
 + }
 +}
 +

I've made some grave mistakes here.
Will fix and repost.

  /**
   * saa711x_detect_chip - Detects the saa711x (or clone) variant
   * @client:  I2C client structure.
 @@ -1769,6 +1815,12 @@ static int saa711x_probe(struct i2c_client *client,
   }
   if (state-ident  V4L2_IDENT_SAA7111A)
   saa711x_writeregs(sd, saa7115_init_misc);
 +
 + if (client-dev.platform_data) {
 + struct saa7115_platform_data *data = client-dev.platform_data;
 + saa7115_load_platform_data(state, data);
 + }
 +
   saa711x_set_v4lstd(sd, V4L2_STD_NTSC);
   v4l2_ctrl_handler_setup(hdl);
  
 diff --git a/include/media/saa7115.h b/include/media/saa7115.h
 index 4079186..7bb4a11 100644
 --- a/include/media/saa7115.h
 +++ b/include/media/saa7115.h
 @@ -64,5 +64,114 @@
  #define SAA7115_FREQ_FL_APLL (1  2) /* SA 3A[3], APLL, SAA7114/5 
 only */
  #define SAA7115_FREQ_FL_DOUBLE_ASCLK (1  

Re: Keene

2013-05-29 Thread Antti Palosaari

On 05/29/2013 08:58 PM, Antti Palosaari wrote:

On 05/29/2013 05:26 PM, Hans Verkuil wrote:

On Fri April 19 2013 11:11:27 Antti Palosaari wrote:

On 04/19/2013 10:12 AM, Hans Verkuil wrote:

On Wed April 17 2013 21:45:24 Antti Palosaari wrote:

On 04/15/2013 09:55 AM, Hans Verkuil wrote:

On Fri April 12 2013 02:11:41 Antti Palosaari wrote:

Hello Hans,
That device is working very, thank you for it. Anyhow, I noticed
two things.

1) it does not start transmitting just after I plug it - I have to
retune it!
Output says it is tuned to 95.16 MHz by default, but it is not.
After I issue retune, just to same channel it starts working.
$ v4l2-ctl -d /dev/radio0 --set-freq=95.16


Can you try this patch:



It does not resolve the problem. It is quite strange behavior. After I
install modules, and modules are unload, plug stick in first time, it
usually (not every-time) starts TX. But when I replug it without
unloading modules, it will never start TX. Tx is started always when I
set freq using v4l2-ctl.


If you replace 'false' by 'true' in the cmd_main, does that make it
work?
I'm fairly certain that's the problem.


Nope, I replaces all 'false' with 'true' and problem remains. When
modules were unload and device is plugged it starts TX. When I replug it
doesn't start anymore.

I just added msleep(1000); just before keene_cmd_main() in .probe() and
now it seems to work every-time. So it is definitely timing issue. I
will try to find out some smallest suitable value for sleep and and sent
patch.


Have you had time to find a smaller msleep value?


Nope, but I will do it today (if I don't meet any problems when
upgrading to latest master).

regards
Antti



Attached patch gives some idea. Do what you want, I have no idea how it 
should be.


Interesting thing I saw there was some automatic on/off Tx logic, but 
unfortunately it was enabled randomly.


Also keene_cmd_main() play parameter does not have any effect.

regards
Antti


--
http://palosaari.fi/
From 59257e5556a5ac4d19111e35001ced5b4d53b5c2 Mon Sep 17 00:00:00 2001
From: Antti Palosaari cr...@iki.fi
Date: Thu, 30 May 2013 02:45:47 +0300
Subject: [PATCH] Keene: start Tx by default

Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/radio/radio-keene.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/media/radio/radio-keene.c b/drivers/media/radio/radio-keene.c
index 4c9ae76..d710529 100644
--- a/drivers/media/radio/radio-keene.c
+++ b/drivers/media/radio/radio-keene.c
@@ -383,6 +383,20 @@ static int usb_keene_probe(struct usb_interface *intf,
 	video_set_drvdata(radio-vdev, radio);
 	set_bit(V4L2_FL_USE_FH_PRIO, radio-vdev.flags);
 
+	/*
+	 * mdelay(11) needed in order to apply keene_cmd_main() command.
+	 * mdelay(10) is not enough, it works sometimes but usually not.
+	 *
+	 * keene_cmd_main() 3rd parameter (play) does not has any effect.
+	 * It starts Tx regardless of that parameter.
+	 *
+	 * Sometimes it enters mode where it stops Tx automatically after input
+	 * is silent 60 sec and also starts Tx automatically when there is
+	 * noise on input. It is not clear how to enable that...
+	 */
+	mdelay(11);
+	keene_cmd_main(radio, 95.16 * FREQ_MUL, false);
+
 	retval = video_register_device(radio-vdev, VFL_TYPE_RADIO, -1);
 	if (retval  0) {
 		dev_err(intf-dev, could not register video device\n);
-- 
1.7.11.7



Re: [RFC 1/3] saa7115: Set saa7113 init to values from datasheet

2013-05-29 Thread Mauro Carvalho Chehab
Em Wed, 29 May 2013 22:41:16 +0200
Jon Arne Jørgensen jona...@jonarne.no escreveu:

 Change all default values in the initial setup table to match the table
 in the datasheet.

This is not a good idea, as it can produce undesired side effects
on the existing drivers that depend on it, and can't be easily
tested.

Please, don't change the current default. It is, of course, OK
to change them if needed via the information provided inside the
platform data.

Regards,
Mauro
 
 Signed-off-by: Jon Arne Jørgensen jona...@jonarne.no
 ---
  drivers/media/i2c/saa7115.c | 12 ++--
  1 file changed, 6 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
 index d6f589a..4403679 100644
 --- a/drivers/media/i2c/saa7115.c
 +++ b/drivers/media/i2c/saa7115.c
 @@ -223,12 +223,12 @@ static const unsigned char saa7111_init[] = {
  static const unsigned char saa7113_init[] = {
   R_01_INC_DELAY, 0x08,
   R_02_INPUT_CNTL_1, 0xc2,
 - R_03_INPUT_CNTL_2, 0x30,
 + R_03_INPUT_CNTL_2, 0x33,
   R_04_INPUT_CNTL_3, 0x00,
   R_05_INPUT_CNTL_4, 0x00,
 - R_06_H_SYNC_START, 0x89,
 + R_06_H_SYNC_START, 0xe9,
   R_07_H_SYNC_STOP, 0x0d,
 - R_08_SYNC_CNTL, 0x88,
 + R_08_SYNC_CNTL, 0x98,
   R_09_LUMA_CNTL, 0x01,
   R_0A_LUMA_BRIGHT_CNTL, 0x80,
   R_0B_LUMA_CONTRAST_CNTL, 0x47,
 @@ -236,11 +236,11 @@ static const unsigned char saa7113_init[] = {
   R_0D_CHROMA_HUE_CNTL, 0x00,
   R_0E_CHROMA_CNTL_1, 0x01,
   R_0F_CHROMA_GAIN_CNTL, 0x2a,
 - R_10_CHROMA_CNTL_2, 0x08,
 + R_10_CHROMA_CNTL_2, 0x00,
   R_11_MODE_DELAY_CNTL, 0x0c,
 - R_12_RT_SIGNAL_CNTL, 0x07,
 + R_12_RT_SIGNAL_CNTL, 0x01,
   R_13_RT_X_PORT_OUT_CNTL, 0x00,
 - R_14_ANAL_ADC_COMPAT_CNTL, 0x00,
 + R_14_ANAL_ADC_COMPAT_CNTL, 0x00,/* RESERVED */
   R_15_VGATE_START_FID_CHG, 0x00,
   R_16_VGATE_STOP, 0x00,
   R_17_MISC_VGATE_CONF_AND_MSB, 0x00,


-- 

Cheers,
Mauro
--
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: [RFC 3/3] saa7115: Implement i2c_board_info.platform data

2013-05-29 Thread Mauro Carvalho Chehab
Em Wed, 29 May 2013 22:41:18 +0200
Jon Arne Jørgensen jona...@jonarne.no escreveu:

 Implement i2c_board_info.platform_data handling in the driver so we can
 make device specific changes to the chips we support.
 

...

 +struct saa7115_platform_data {
 + /* Horizontal time constant */
 + u8 saa7113_r08_htc;
 +
 + u8 saa7113_r10_vrln;
 + u8 saa7113_r10_ofts;
 +
 + u8 saa7113_r12_rts0;
 + u8 saa7113_r12_rts1;
 +
 + u8 saa7113_r13_adlsb;
 +};

While this works, it makes harder to analyze what's changed there,
as the above nomenclature is too obfuscated.

The better would be if you could, instead, name the bits (or bytes)
that will require different data, like (I just got some random
bits from reg08, on saa7113 datasheet - I didn't actually checked
what bits are you using):

unsigned pll_closed: 1;
unsigned fast_mode: 1;
unsigned fast_locking: 1;


-- 

Cheers,
Mauro
--
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: EM28xx - new device ID - Ion Video Forever USB capture dongle

2013-05-29 Thread P. van Gaans

On 26-05-13 11:23, Philip Pemberton wrote:

Hi folks,

This is my first post here (I think?) and I'm going to make it an
informative one :)


TL/DR:
   Can someone please add this to the device ID list for the em28xx module?
 Ion Video Forever - USB ID EB1A:5124, Card Type 9.
   Confirmed as working with Xawtv and VLC, video source PAL composite
from a FLIR camera; S-video and audio untested as I have no suitable
source to hand.
   Test platform: Ubuntu 13.04 Raring, kernel 3.8.0-21-generic
#32-Ubuntu SMP x86_64


The longer version:

I found this thing in a local Maplins under stock code A27KJ for the
princely sum of £29.99 on special offer. According to the box, it's a
Video Forever VHS-to-Digital Video Converter by ION (www.ionaudio.com).
Strangely they don't list it on their website, so perhaps it's a special
for Maplin?


lsusb says:

Bus 001 Device 084: ID eb1a:5124 eMPIA Technology, Inc.


The CD-ROM in the packet is apparently a driver set for an ezcap
device (Ezcap Video Grabber), the INF file suggests it's an EM2860
series chip. For a laugh, I did this:

sudo modprobe em28xx card=9
echo eb1a 5124 | sudo tee /sys/bus/usb/drivers/em28xx/new_id

Which has the effect of loading the EM28xx driver with cardtype forced
to 9 (which seems to be a generic EM2860-based device ID), then adding
the new device ID (temporarily) to the module.


Dmesg after doing this:


[377328.118295] usb 1-1.4.3.5: new high-speed USB device number 94 using 
ehci-pci
[377328.217158] usb 1-1.4.3.5: New USB device found, idVendor=eb1a, 
idProduct=5124
[377328.217160] usb 1-1.4.3.5: New USB device strings: Mfr=0, Product=1, 
SerialNumber=2
[377328.217162] usb 1-1.4.3.5: Product: USB VIDBOX FW Audio
[377328.217163] usb 1-1.4.3.5: SerialNumber: USB2.0 VIDBOX FW
[377328.217448] em28xx: New device  USB VIDBOX FW Audio @ 480 Mbps (eb1a:5124, 
interface 0, class 0)
[377328.217450] em28xx: Video interface 0 found
[377328.217451] em28xx: DVB interface 0 found
[377328.217506] em28xx #0: chip ID is em2860
[377328.344000] em28xx #0: i2c eeprom 00: 1a eb 67 95 1a eb 24 51 50 00 20 03 
8c 28 6a 22
[377328.344007] em28xx #0: i2c eeprom 10: 00 00 24 57 06 02 00 00 00 00 00 00 
00 00 00 00
[377328.344012] em28xx #0: i2c eeprom 20: 02 00 01 00 f0 10 01 00 00 00 00 00 
5b 00 00 00
[377328.344016] em28xx #0: i2c eeprom 30: 00 00 20 40 20 80 02 20 01 01 00 00 
00 00 00 00
[377328.344020] em28xx #0: i2c eeprom 40: 00 00 00 00 00 00 00 00 00 00 00 00 
00 c4 00 00
[377328.344025] em28xx #0: i2c eeprom 50: 00 a2 00 87 81 00 00 00 00 00 00 00 
00 00 00 00
[377328.344029] em28xx #0: i2c eeprom 60: 00 00 00 00 00 00 00 00 00 00 22 03 
55 00 53 00
[377328.344033] em28xx #0: i2c eeprom 70: 42 00 32 00 2e 00 30 00 20 00 56 00 
49 00 44 00
[377328.344038] em28xx #0: i2c eeprom 80: 42 00 4f 00 58 00 20 00 46 00 57 00 
28 03 55 00
[377328.344042] em28xx #0: i2c eeprom 90: 53 00 42 00 20 00 56 00 49 00 44 00 
42 00 4f 00
[377328.344047] em28xx #0: i2c eeprom a0: 58 00 20 00 46 00 57 00 20 00 41 00 
75 00 64 00
[377328.344051] em28xx #0: i2c eeprom b0: 69 00 6f 00 00 00 00 00 00 00 00 00 
00 00 00 00
[377328.344055] em28xx #0: i2c eeprom c0: 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00
[377328.344060] em28xx #0: i2c eeprom d0: 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00
[377328.344064] em28xx #0: i2c eeprom e0: 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00
[377328.344068] em28xx #0: i2c eeprom f0: 00 00 00 00 00 00 00 00 00 00 00 00 
00 00 00 00
[377328.344074] em28xx #0: EEPROM ID= 0x9567eb1a, EEPROM hash = 0x806f2156
[377328.344075] em28xx #0: EEPROM info:
[377328.344076] em28xx #0:  AC97 audio (5 sample rates)
[377328.344076] em28xx #0:  500mA max power
[377328.344078] em28xx #0:  Table at 0x24, strings=0x288c, 0x226a, 0x
[377328.344080] em28xx #0: Identified as Pinnacle Dazzle DVC 90/100/101/107 / 
Kaiser Baas Video to DVD maker / Kworld DVD Maker 2 / Plextor ConvertX 
PX-AV100U (card=9)
[377328.706041] saa7115 4-0025: saa7113 found (1f7113d0e10) @ 0x4a (em28xx 
#0)
[377329.472675] em28xx #0: Config register raw data: 0x50
[377329.496532] em28xx #0: AC97 vendor ID = 0x83847652
[377329.508515] em28xx #0: AC97 features = 0x6a90
[377329.508517] em28xx #0: Sigmatel audio processor detected(stac 9752)
[377329.967933] em28xx #0: v4l2 driver version 0.1.3
[377330.990725] em28xx #0: V4L2 video device registered as video0
[377330.990727] em28xx #0: V4L2 VBI device registered as vbi0



Fire up Xawtv or VLC, select the device, enjoy.

Thanks,



Hi Philip,

Very interesting post!

I also have an unsupported em28xx device, a MSI Digivox Trio 
(http://linuxtv.org/wiki/index.php/MSI_DigiVox_Trio) which I suspect to 
be similar to a PCTV QuatroStick nano. If I use the device ID from my 
stick and card number from the QuatroStick to forceload the em28xx 
driver, would that be safe? Or would I risk destroying the USB stick? I 
don't know if it's actually the same, all I know is that it shares many 
(maybe all) components.


Best regards,


Re: [GIT PULL] go7007 firmware updates

2013-05-29 Thread Ben Hutchings
On Tue, 2013-05-28 at 08:42 +0200, Hans Verkuil wrote:
 On Mon May 27 2013 23:53:15 Ben Hutchings wrote:
  On Mon, 2013-05-27 at 21:56 +0200, Hans Verkuil wrote:
   On Mon May 27 2013 18:24:32 Ben Hutchings wrote:
On Thu, 2013-05-23 at 10:25 +0200, Hans Verkuil wrote:
 Hi Ben, David,
 
 The go7007 staging driver has been substantially overhauled for 
 kernel 3.10.
 As part of that process the firmware situation has been improved as 
 well.
 
 While Micronas allowed the firmware to be redistributed, it was never 
 made
 part of linux-firmware. Only the firmwares for the Sensoray S2250 
 were added
 in the past, but those need the go7007*.bin firmwares as well to work.
 
 This pull request collects all the firmwares necessary to support all 
 the
 go7007 devices into the go7007 directory. With this change the go7007 
 driver
 will work out-of-the-box starting with kernel 3.10.
[...]

You should not rename files like this.  linux-firmware is not versioned
and needs to be compatible with old and new kernel versions, so far as
possible.
   
   I understand, and I wouldn't have renamed these two firmware files if it
   wasn't for the fact that 1) it concerns a staging driver, so in my view
   backwards compatibility is not a requirement,
  
  This driver (or set of drivers) has been requesting go7007fw.bin,
  go7007tv.bin, s2250.fw and s2250_loader.fw for nearly 5 years.  It's a
  bit late to say those were just temporary filenames.
 
 Why not? It is a staging driver for good reasons. Just because it is in 
 staging
 for a long time (because nobody found the time to actually work on it until
 3.10) doesn't mean it magically becomes non-staging. The Kconfig in staging
 says:
 
   This option allows you to select a number of drivers that are
   not of the normal Linux kernel quality level.  These drivers
   are placed here in order to get a wider audience to make use of
   them.  Please note that these drivers are under heavy
   development, may or may not work, and may contain userspace
   interfaces that most likely will be changed in the near
   future.
 
 In other words, there are no guarantees. That's the whole point of staging.
[...]

But the reality is that many drivers don't get that heavy development,
and so they linger in staging for a long time.  So it shouldn't be
surprising that users start to rely on them, and distributions ship
them, and then it's a bit rough to pull the rug from under them some
years later.

I don't know how true that is of go7007 but I'd like to avoid causing
regressions.  So I've pulled from you, but I've then added back s2250.fw
and s2250_loader.fw as symlinks.

Ben.

-- 
Ben Hutchings
If at first you don't succeed, you're doing about average.


signature.asc
Description: This is a digitally signed message part


Re: [PATCHv1 18/38] media/i2c: remove g_chip_ident op.

2013-05-29 Thread Laurent Pinchart
Hi Hans,

Thanks for the patch.

On Wednesday 29 May 2013 12:59:51 Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com
 
 This is no longer needed since the core now handles this through
 DBG_G_CHIP_INFO.
 
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Prabhakar Lad prabhakar.cse...@gmail.com
 Cc: Andy Walls awa...@md.metrocast.net
 Cc: Sylwester Nawrocki sylvester.nawro...@gmail.com
 ---
  drivers/media/i2c/ad9389b.c  |   21 +-
  drivers/media/i2c/adv7170.c  |   13 
  drivers/media/i2c/adv7175.c  |9 ---
  drivers/media/i2c/adv7180.c  |   10 ---
  drivers/media/i2c/adv7183.c  |   22 ---
  drivers/media/i2c/adv7343.c  |   10 ---
  drivers/media/i2c/adv7393.c  |   10 ---
  drivers/media/i2c/adv7604.c  |   18 -
  drivers/media/i2c/ak881x.c   |   34 +-
  drivers/media/i2c/bt819.c|   14 
  drivers/media/i2c/bt856.c|9 ---
  drivers/media/i2c/bt866.c|   13 
  drivers/media/i2c/cs5345.c   |   17 -
  drivers/media/i2c/cs53l32a.c |   10 ---
  drivers/media/i2c/cx25840/cx25840-core.c |   14 
  drivers/media/i2c/ks0127.c   |   16 -
  drivers/media/i2c/m52790.c   |   15 -
  drivers/media/i2c/msp3400-driver.c   |   10 ---
  drivers/media/i2c/mt9m032.c  |9 +--
  drivers/media/i2c/mt9p031.c  |1 -
  drivers/media/i2c/mt9v011.c  |   24 ---

For the Aptina sensors drivers,

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

  drivers/media/i2c/noon010pc30.c  |1 -
  drivers/media/i2c/ov7640.c   |1 -
  drivers/media/i2c/ov7670.c   |   17 -
  drivers/media/i2c/saa6588.c  |9 ---
  drivers/media/i2c/saa7110.c  |9 ---
  drivers/media/i2c/saa7115.c  |  105 +--
  drivers/media/i2c/saa7127.c  |   47 +
  drivers/media/i2c/saa717x.c  |7 --
  drivers/media/i2c/saa7185.c  |9 ---
  drivers/media/i2c/saa7191.c  |   10 ---
  drivers/media/i2c/tda9840.c  |   13 
  drivers/media/i2c/tea6415c.c |   13 
  drivers/media/i2c/tea6420.c  |   13 
  drivers/media/i2c/ths7303.c  |   25 +--
  drivers/media/i2c/tvaudio.c  |9 ---
  drivers/media/i2c/tvp514x.c  |1 -
  drivers/media/i2c/tvp5150.c  |   24 ---
  drivers/media/i2c/tvp7002.c  |   34 --
  drivers/media/i2c/tw2804.c   |1 -
  drivers/media/i2c/upd64031a.c|   17 -
  drivers/media/i2c/upd64083.c |   17 -
  drivers/media/i2c/vp27smpx.c |9 ---
  drivers/media/i2c/vpx3220.c  |   14 
  drivers/media/i2c/vs6624.c   |   22 ---
  drivers/media/i2c/wm8739.c   |9 ---
  drivers/media/i2c/wm8775.c   |9 ---
  47 files changed, 73 insertions(+), 671 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 09/13] media: Change media device link_notify behaviour

2013-05-29 Thread Laurent Pinchart
Hi Sylwester,

Thank you for the patch, and sorry for the late reply.

On Thursday 09 May 2013 17:36:41 Sylwester Nawrocki wrote:
 Currently the media device link_notify callback is invoked before the
 actual change of state of a link when the link is being enabled, and
 after the actual change of state when the link is being disabled.
 
 This doesn't allow a media device driver to perform any operations
 on a full graph before a link is disabled, as well as performing
 any tasks on a modified graph right after a link's state is changed.
 
 This patch modifies signature of the link_notify callback. This
 callback is now called always before and after a link's state change.
 To distinguish the notifications a 'notification' argument is added
 to the link_notify callback: MEDIA_DEV_NOTIFY_PRE_LINK_CH indicates
 notification before link's state change and
 MEDIA_DEV_NOTIFY_POST_LINK_CH corresponds to a notification after
 link flags change.
 
 Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
  drivers/media/media-entity.c  |   18 +++
  drivers/media/platform/exynos4-is/media-dev.c |   16 +-
  drivers/media/platform/omap3isp/isp.c |   41 +-
  include/media/media-device.h  |9 --
  4 files changed, 46 insertions(+), 38 deletions(-)
 
 diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
 index 7c2b51c..0fcf4c0 100644
 --- a/drivers/media/media-entity.c
 +++ b/drivers/media/media-entity.c
 @@ -547,25 +547,17 @@ int __media_entity_setup_link(struct media_link *link,
 u32 flags)
 
   mdev = source-parent;
 
 - if ((flags  MEDIA_LNK_FL_ENABLED)  mdev-link_notify) {
 - ret = mdev-link_notify(link-source, link-sink,
 - MEDIA_LNK_FL_ENABLED);
 + if (mdev-link_notify) {
 + ret = mdev-link_notify(link, MEDIA_LNK_FL_ENABLED,
 + MEDIA_DEV_NOTIFY_PRE_LINK_CH);

As you correctly pointed out in a self-reply to your patch, you should pass 
the flags here instead of MEDIA_LNK_FL_ENABLED.

   if (ret  0)
   return ret;
   }
 
   ret = __media_entity_setup_link_notify(link, flags);
 - if (ret  0)
 - goto err;
 
 - if (!(flags  MEDIA_LNK_FL_ENABLED)  mdev-link_notify)
 - mdev-link_notify(link-source, link-sink, 0);
 -
 - return 0;
 -
 -err:
 - if ((flags  MEDIA_LNK_FL_ENABLED)  mdev-link_notify)
 - mdev-link_notify(link-source, link-sink, 0);
 + if (mdev-link_notify)
 + mdev-link_notify(link, flags, MEDIA_DEV_NOTIFY_POST_LINK_CH);
 
   return ret;
  }
 diff --git a/drivers/media/platform/exynos4-is/media-dev.c
 b/drivers/media/platform/exynos4-is/media-dev.c index e95a6d5..ca58dfc
 100644
 --- a/drivers/media/platform/exynos4-is/media-dev.c
 +++ b/drivers/media/platform/exynos4-is/media-dev.c
 @@ -1274,34 +1274,36 @@ int fimc_md_set_camclk(struct v4l2_subdev *sd, bool
 on) return __fimc_md_set_camclk(fmd, si, on);
  }
 
 -static int fimc_md_link_notify(struct media_pad *source,
 -struct media_pad *sink, u32 flags)
 +static int fimc_md_link_notify(struct media_link *link, unsigned int flags,
 + unsigned int notification)
  {
 + struct media_entity *sink = link-sink-entity;
   struct exynos_video_entity *ve;
   struct video_device *vdev;
   struct fimc_pipeline *pipeline;
   int i, ret = 0;
 
 - if (media_entity_type(sink-entity) != MEDIA_ENT_T_DEVNODE_V4L)
 + if (media_entity_type(sink) != MEDIA_ENT_T_DEVNODE_V4L ||
 + notification == MEDIA_DEV_NOTIFY_LINK_PRE_CH)

Don't you need to call __fimc_pipeline_open() on post-notify instead of pre-
notified below ?

   return 0;
 
 - vdev = media_entity_to_video_device(sink-entity);
 + vdev = media_entity_to_video_device(sink);
   ve = vdev_to_exynos_video_entity(vdev);
   pipeline = to_fimc_pipeline(ve-pipe);
 
   if (!(flags  MEDIA_LNK_FL_ENABLED)  pipeline-subdevs[IDX_SENSOR]) {
 - if (sink-entity-use_count  0)
 + if (sink-use_count  0)
   ret = __fimc_pipeline_close(ve-pipe);
 
   for (i = 0; i  IDX_MAX; i++)
   pipeline-subdevs[i] = NULL;
 - } else if (sink-entity-use_count  0) {
 + } else if (sink-use_count  0) {
   /*
* Link activation. Enable power of pipeline elements only if
* the pipeline is already in use, i.e. its video node is open.
* Recreate the controls destroyed during the link deactivation.
*/
 - ret = __fimc_pipeline_open(ve-pipe, sink-entity, true);
 + ret = __fimc_pipeline_open(ve-pipe, sink, true);
   }
 
   return ret ? -EPIPE : ret;
 diff --git 

Re: [RFC 1/3] saa7115: Set saa7113 init to values from datasheet

2013-05-29 Thread Andy Walls
Mauro Carvalho Chehab mche...@redhat.com wrote:

Em Wed, 29 May 2013 22:41:16 +0200
Jon Arne Jørgensen jona...@jonarne.no escreveu:

 Change all default values in the initial setup table to match the
table
 in the datasheet.

This is not a good idea, as it can produce undesired side effects
on the existing drivers that depend on it, and can't be easily
tested.

Please, don't change the current default. It is, of course, OK
to change them if needed via the information provided inside the
platform data.

Regards,
Mauro
 
 Signed-off-by: Jon Arne Jørgensen jona...@jonarne.no
 ---
  drivers/media/i2c/saa7115.c | 12 ++--
  1 file changed, 6 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/media/i2c/saa7115.c
b/drivers/media/i2c/saa7115.c
 index d6f589a..4403679 100644
 --- a/drivers/media/i2c/saa7115.c
 +++ b/drivers/media/i2c/saa7115.c
 @@ -223,12 +223,12 @@ static const unsigned char saa7111_init[] = {
  static const unsigned char saa7113_init[] = {
  R_01_INC_DELAY, 0x08,
  R_02_INPUT_CNTL_1, 0xc2,
 -R_03_INPUT_CNTL_2, 0x30,
 +R_03_INPUT_CNTL_2, 0x33,
  R_04_INPUT_CNTL_3, 0x00,
  R_05_INPUT_CNTL_4, 0x00,
 -R_06_H_SYNC_START, 0x89,
 +R_06_H_SYNC_START, 0xe9,
  R_07_H_SYNC_STOP, 0x0d,
 -R_08_SYNC_CNTL, 0x88,
 +R_08_SYNC_CNTL, 0x98,
  R_09_LUMA_CNTL, 0x01,
  R_0A_LUMA_BRIGHT_CNTL, 0x80,
  R_0B_LUMA_CONTRAST_CNTL, 0x47,
 @@ -236,11 +236,11 @@ static const unsigned char saa7113_init[] = {
  R_0D_CHROMA_HUE_CNTL, 0x00,
  R_0E_CHROMA_CNTL_1, 0x01,
  R_0F_CHROMA_GAIN_CNTL, 0x2a,
 -R_10_CHROMA_CNTL_2, 0x08,
 +R_10_CHROMA_CNTL_2, 0x00,
  R_11_MODE_DELAY_CNTL, 0x0c,
 -R_12_RT_SIGNAL_CNTL, 0x07,
 +R_12_RT_SIGNAL_CNTL, 0x01,
  R_13_RT_X_PORT_OUT_CNTL, 0x00,
 -R_14_ANAL_ADC_COMPAT_CNTL, 0x00,
 +R_14_ANAL_ADC_COMPAT_CNTL, 0x00,/* RESERVED */
  R_15_VGATE_START_FID_CHG, 0x00,
  R_16_VGATE_STOP, 0x00,
  R_17_MISC_VGATE_CONF_AND_MSB, 0x00,


-- 

Cheers,
Mauro
--
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

I was going to make a comment along the same line as Mauro.  
Please leave the driver defaults alone.  It is almost impossible to regression 
test all the different devices with a SAA7113 chip, to ensure the change 
doesn't cause someone's device to not work properly.

Regards,
Andy

--
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] media: Rename media_entity_remote_source to media_entity_remote_pad

2013-05-29 Thread Laurent Pinchart
Hi Andrzej,

Thank you for the patch, and sorry for not handling this earlier.

On Tuesday 22 January 2013 09:24:55 Andrzej Hajda wrote:
 Function media_entity_remote_source actually returns the remote pad to
 the given one, regardless if this is the source or the sink pad.
 Name media_entity_remote_pad is more adequate for this function.
 
 Signed-off-by: Andrzej Hajda a.ha...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com

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

However, the patch doesn't apply on top of the latest linuxtv master branch. 
Could you please respin it ?

Mauro, as this patch touches several drivers in addition to the media core, 
would you prefer to apply it yourself, or should I take it in my tree and send 
a pull request ?

 ---
  Documentation/media-framework.txt|2 +-
  drivers/media/media-entity.c |   13 ++---
  drivers/media/platform/omap3isp/isp.c|6 +++---
  drivers/media/platform/omap3isp/ispccdc.c|2 +-
  drivers/media/platform/omap3isp/ispccp2.c|2 +-
  drivers/media/platform/omap3isp/ispcsi2.c|2 +-
  drivers/media/platform/omap3isp/ispvideo.c   |6 +++---
  drivers/media/platform/s3c-camif/camif-capture.c |2 +-
  drivers/media/platform/s5p-fimc/fimc-capture.c   |8 
  drivers/media/platform/s5p-fimc/fimc-lite.c  |4 ++--
  drivers/media/platform/s5p-fimc/fimc-mdevice.c   |2 +-
  drivers/staging/media/davinci_vpfe/vpfe_video.c  |   12 ++--
  include/media/media-entity.h |2 +-
  13 files changed, 31 insertions(+), 32 deletions(-)
 
 diff --git a/Documentation/media-framework.txt
 b/Documentation/media-framework.txt index 8028754..e68744a 100644
 --- a/Documentation/media-framework.txt
 +++ b/Documentation/media-framework.txt
 @@ -265,7 +265,7 @@ connected to another pad through an enabled link
   media_entity_find_link(struct media_pad *source,
  struct media_pad *sink);
 
 - media_entity_remote_source(struct media_pad *pad);
 + media_entity_remote_pad(struct media_pad *pad);
 
  Refer to the kerneldoc documentation for more information.
 
 diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
 index e1cd132..0438209 100644
 --- a/drivers/media/media-entity.c
 +++ b/drivers/media/media-entity.c
 @@ -560,17 +560,16 @@ media_entity_find_link(struct media_pad *source,
 struct media_pad *sink) EXPORT_SYMBOL_GPL(media_entity_find_link);
 
  /**
 - * media_entity_remote_source - Find the source pad at the remote end of a
 link
 - * @pad: Sink pad at the local end of the link
 + * media_entity_remote_pad - Find the pad at the remote end of a link
 + * @pad: Pad at the local end of the link
   *
 - * Search for a remote source pad connected to the given sink pad by
 - * iterating over all links originating or terminating at that pad until an
 - * enabled link is found.
 + * Search for a remote pad connected to the given pad by iterating over all
 + * links originating or terminating at that pad until an enabled link is
 found.
   *
   * Return a pointer to the pad at the remote end of the first found enabled
   * link, or NULL if no enabled link has been found.
   */
 -struct media_pad *media_entity_remote_source(struct media_pad *pad)
 +struct media_pad *media_entity_remote_pad(struct media_pad *pad)
  {
   unsigned int i;
 
 @@ -590,4 +589,4 @@ struct media_pad *media_entity_remote_source(struct
 media_pad *pad) return NULL;
 
  }
 -EXPORT_SYMBOL_GPL(media_entity_remote_source);
 +EXPORT_SYMBOL_GPL(media_entity_remote_pad);
 diff --git a/drivers/media/platform/omap3isp/isp.c
 b/drivers/media/platform/omap3isp/isp.c index a9f6de5..5bb1698 100644
 --- a/drivers/media/platform/omap3isp/isp.c
 +++ b/drivers/media/platform/omap3isp/isp.c
 @@ -757,7 +757,7 @@ static int isp_pipeline_enable(struct isp_pipeline
 *pipe, if (!(pad-flags  MEDIA_PAD_FL_SINK))
   break;
 
 - pad = media_entity_remote_source(pad);
 + pad = media_entity_remote_pad(pad);
   if (pad == NULL ||
   media_entity_type(pad-entity) != MEDIA_ENT_T_V4L2_SUBDEV)
   break;
 @@ -847,7 +847,7 @@ static int isp_pipeline_disable(struct isp_pipeline
 *pipe) if (!(pad-flags  MEDIA_PAD_FL_SINK))
   break;
 
 - pad = media_entity_remote_source(pad);
 + pad = media_entity_remote_pad(pad);
   if (pad == NULL ||
   media_entity_type(pad-entity) != MEDIA_ENT_T_V4L2_SUBDEV)
   break;
 @@ -963,7 +963,7 @@ static int isp_pipeline_is_last(struct media_entity *me)
 pipe = to_isp_pipeline(me);
   if (pipe-stream_state == ISP_PIPELINE_STREAM_STOPPED)
   return 0;
 - pad = media_entity_remote_source(pipe-output-pad);
 + pad = media_entity_remote_pad(pipe-output-pad);
   return 

Re: [PATCH RFC v2] media: OF: add sync-on-green endpoint property

2013-05-29 Thread Laurent Pinchart
Hi Sylwester,

On Saturday 25 May 2013 16:11:52 Sylwester Nawrocki wrote:
 On 05/25/2013 11:17 AM, Prabhakar Lad wrote:
   From looking at Figure 8 TVP7002 Application Example in the TVP7002's
   datasheet ([2], p. 52) and your initial TVP7002 patches it looks like
   what you want is to specify polarity of the SOGOUT signal, so the
   processor that receives this signal can properly interpret it, is it
   correct ?
  
  Yes
  
If so then wouldn't it be more appropriate to define e.g. 'sog-active'
property and media bus flags:
 V4L2_MBUS_SYNC_ON_GREEN_ACTIVE_LOW
 V4L2_MBUS_SYNC_ON_GREEN_ACTIVE_HIGH

?
  
  Agreed I'll add these flags.
  
And for synchronisation method on the analog part we could perhaps
define 'component-sync' or similar property that would enumerate all
possible synchronisation methods. We might as well use separate
boolean properties, but I'm a bit concerned about the increasing
number of properties that need to be parsed for each parallel video
bus endpoint.
  
  I am not clear on it can please elaborate more on this.
 
 I thought about two possible options:
 
 1. single property 'component-sync' or 'video-sync' that would have values:
 
 #define VIDEO_SEPARATE_SYNC   0x01
 #define VIDEO_COMPOSITE_SYNC  0x02
 #define VIDEO_SYNC_ON_COMPOSITE   0x04
 #define VIDEO_SYNC_ON_GREEN   0x08
 #define VIDEO_SYNC_ON_LUMINANCE   0x10
 
 And we could put these definitions into a separate header, e.g.
 dt-bindings/video-interfaces.h
 
 Then in a device tree source file one could have, e.g.
 
 video-sync = VIDEO_SYNC_ON_GREEN;
 
 
 2. Separate boolean property for each video sync type, e.g.
 
   video-composite-sync
   video-sync-on-composite
   video-sync-on-green
   video-sync-on-luminance
 
 Separate sync, with separate VSYNC, HSYNC lines, would be the default, when
 none of the above is specified and 'vsync-active', 'hsync-active' properties
 are present.

I prefer 1. over 2.

 However, I suppose the better would be to deduce the video synchronisation
 method from the sync signal polarity flags. Then, for instance, when an
 endpoint node contains composite-sync-active property the parser would
 determine the composite sync synchronisation type is used.
 
 Thus it might make sense to have only following integer properties (added
 as needed):
 
 composite-sync-active
 sync-on-green-active
 sync-on-comp-active
 sync-on-luma-active
 
 This would allow to specify polarity of each signal and at the same time
 the parsing code could derive synchronisation type. A new field could be
 added to struct v4l2_of_parallel_bus, e.g. sync_type and it would be filled
 within v4l2_of_parse_endpoint().
 
 What do you think ?

My gut feeling is that we should have separate properties for the video sync 
type and the synchronization signals polarities. We could have a chip that 
supports sync-on-green on the analog (input) side and outputs separate hsync 
and vsync signals only on the digital (output) side. There would be no sync-
on-green polarity in that case.

-- 
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.11] uvcvideo patches

2013-05-29 Thread Laurent Pinchart
Hi Mauro,

The following changes since commit 7eac97d7e714429f7ef1ba5d35f94c07f4c34f8e:

  [media] media: pci: remove duplicate checks for EPERM (2013-05-27 09:34:56 
-0300)

are available in the git repository at:

  git://linuxtv.org/pinchartl/uvcvideo.git uvcvideo-next

for you to fetch changes up to f8ba161bd9a9cd474839e25e9729187766633056:

  uvcvideo: Fix open/close race condition (2013-05-30 05:31:59 +0200)


Joseph Salisbury (1):
  uvcvideo: quirk PROBE_DEF for Alienware X51 OmniVision webcam

Kamal Mostafa (1):
  uvcvideo: quirk PROBE_DEF for Dell Studio / OmniVision webcam

Laurent Pinchart (1):
  uvcvideo: Fix open/close race condition

 drivers/media/usb/uvc/uvc_driver.c | 41 +++--
 drivers/media/usb/uvc/uvc_status.c | 21 ++---
 drivers/media/usb/uvc/uvc_v4l2.c   | 14 ++
 drivers/media/usb/uvc/uvcvideo.h   |  7 +++
 4 files changed, 50 insertions(+), 33 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: [RFC 1/3] saa7115: Set saa7113 init to values from datasheet

2013-05-29 Thread Jon Arne Jørgensen
On Wed, May 29, 2013 at 10:19:49PM -0400, Andy Walls wrote:
 Mauro Carvalho Chehab mche...@redhat.com wrote:
 
 Em Wed, 29 May 2013 22:41:16 +0200
 Jon Arne Jørgensen jona...@jonarne.no escreveu:
 
  Change all default values in the initial setup table to match the
 table
  in the datasheet.
 
 This is not a good idea, as it can produce undesired side effects
 on the existing drivers that depend on it, and can't be easily
 tested.
 
 Please, don't change the current default. It is, of course, OK
 to change them if needed via the information provided inside the
 platform data.
 
 Regards,
 Mauro
  
  Signed-off-by: Jon Arne Jørgensen jona...@jonarne.no
  ---
   drivers/media/i2c/saa7115.c | 12 ++--
   1 file changed, 6 insertions(+), 6 deletions(-)
  
  diff --git a/drivers/media/i2c/saa7115.c
 b/drivers/media/i2c/saa7115.c
  index d6f589a..4403679 100644
  --- a/drivers/media/i2c/saa7115.c
  +++ b/drivers/media/i2c/saa7115.c
  @@ -223,12 +223,12 @@ static const unsigned char saa7111_init[] = {
   static const unsigned char saa7113_init[] = {
 R_01_INC_DELAY, 0x08,
 R_02_INPUT_CNTL_1, 0xc2,
  -  R_03_INPUT_CNTL_2, 0x30,
  +  R_03_INPUT_CNTL_2, 0x33,
 R_04_INPUT_CNTL_3, 0x00,
 R_05_INPUT_CNTL_4, 0x00,
  -  R_06_H_SYNC_START, 0x89,
  +  R_06_H_SYNC_START, 0xe9,
 R_07_H_SYNC_STOP, 0x0d,
  -  R_08_SYNC_CNTL, 0x88,
  +  R_08_SYNC_CNTL, 0x98,
 R_09_LUMA_CNTL, 0x01,
 R_0A_LUMA_BRIGHT_CNTL, 0x80,
 R_0B_LUMA_CONTRAST_CNTL, 0x47,
  @@ -236,11 +236,11 @@ static const unsigned char saa7113_init[] = {
 R_0D_CHROMA_HUE_CNTL, 0x00,
 R_0E_CHROMA_CNTL_1, 0x01,
 R_0F_CHROMA_GAIN_CNTL, 0x2a,
  -  R_10_CHROMA_CNTL_2, 0x08,
  +  R_10_CHROMA_CNTL_2, 0x00,
 R_11_MODE_DELAY_CNTL, 0x0c,
  -  R_12_RT_SIGNAL_CNTL, 0x07,
  +  R_12_RT_SIGNAL_CNTL, 0x01,
 R_13_RT_X_PORT_OUT_CNTL, 0x00,
  -  R_14_ANAL_ADC_COMPAT_CNTL, 0x00,
  +  R_14_ANAL_ADC_COMPAT_CNTL, 0x00,/* RESERVED */
 R_15_VGATE_START_FID_CHG, 0x00,
 R_16_VGATE_STOP, 0x00,
 R_17_MISC_VGATE_CONF_AND_MSB, 0x00,
 
 
 -- 
 
 Cheers,
 Mauro
 --
 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
 
 I was going to make a comment along the same line as Mauro.  
 Please leave the driver defaults alone.  It is almost impossible to 
 regression test all the different devices with a SAA7113 chip, to ensure the 
 change doesn't cause someone's device to not work properly.


You guys are totally right.

What if I clone the original saa7113_init table into a new one, and make
the driver use the new one if the calling driver sets platform_data.

Something like this?

switch (state-ident) {
case V4L2_IDENT_SAA7111:
case V4L2_IDENT_SAA7111A:
saa711x_writeregs(sd, saa7111_init);
break;
case V4L2_IDENT_GM7113C:
case V4L2_IDENT_SAA7113:
-   saa711x_writeregs(sd, saa7113_init);
+   if (client-dev.platform_data)
+   saa711x_writeregs(sd, saa7113_new_init);
+   else
+   saa711x_writeregs(sd, saa7113_init);

break;
default:
state-crystal_freq = SAA7115_FREQ_32_11_MHZ;
saa711x_writeregs(sd, saa7115_init_auto_input);
}
if (state-ident  V4L2_IDENT_SAA7111A)
saa711x_writeregs(sd, saa7115_init_misc);

if (client-dev.platform_data) {
struct saa7115_platform_data *data = client-dev.platform_data;
saa7115_load_platform_data(state, data);
}

It's not strictly necessary, but it feels a lot cleaner?
Would you accept this into the kernel, or would it just increase
maintenance?

Best regards
Jon Arne Jørgensen

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


Re: [RFC 1/3] saa7115: Set saa7113 init to values from datasheet

2013-05-29 Thread Timo Teras
On Thu, 30 May 2013 07:21:36 +0200
Jon Arne Jørgensen jona...@jonarne.no wrote:

 On Wed, May 29, 2013 at 10:19:49PM -0400, Andy Walls wrote:
  Mauro Carvalho Chehab mche...@redhat.com wrote:
  
  Em Wed, 29 May 2013 22:41:16 +0200
  Jon Arne Jørgensen jona...@jonarne.no escreveu:
  
   Change all default values in the initial setup table to match the
  table
   in the datasheet.
  
  This is not a good idea, as it can produce undesired side effects
  on the existing drivers that depend on it, and can't be easily
  tested.
  
  Please, don't change the current default. It is, of course, OK
  to change them if needed via the information provided inside the
  platform data.
 
  I was going to make a comment along the same line as Mauro.  
  Please leave the driver defaults alone.  It is almost impossible to
  regression test all the different devices with a SAA7113 chip, to
  ensure the change doesn't cause someone's device to not work
  properly.
 
 
 You guys are totally right.
 
 What if I clone the original saa7113_init table into a new one, and
 make the driver use the new one if the calling driver sets
 platform_data.
 
 Something like this?
 
 switch (state-ident) {
 case V4L2_IDENT_SAA7111:
 case V4L2_IDENT_SAA7111A:
 saa711x_writeregs(sd, saa7111_init);
 break;
 case V4L2_IDENT_GM7113C:
 case V4L2_IDENT_SAA7113:
 - saa711x_writeregs(sd, saa7113_init);
 + if (client-dev.platform_data)
 + saa711x_writeregs(sd, saa7113_new_init);
 + else
 + saa711x_writeregs(sd, saa7113_init);

I would rather have the platform_data provide the new table. Or if you
think bulk of the table will be the same for most users, then perhaps
add there an enum saying which table to use - and name the tables
according to the chip variant it applies to.

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