Re: [RFC v3] [RFC] v4l2: Support for multiple selections

2013-12-10 Thread Ricardo Ribalda Delgado
Hello Tomasz

Now is my time to say sorry for the delay, but i have been in holidays
and then I had a pile of work waiting on my desk :).



On Tue, Nov 12, 2013 at 3:54 PM, Tomasz Stanislawski
t.stanisl...@samsung.com wrote:
 Hi Ricardo,
 Sorry for a late reply. I've been 'offline' for the last two weeks.
 Please refer to the comments below.

 On 10/28/2013 11:46 PM, Ricardo Ribalda Delgado wrote:
 Hello Tomasz

 Sorry for the late reply, but I have been offline the last week due to
 the conference.


 On Thu, Oct 24, 2013 at 12:31 PM, Tomasz Stanislawski
 t.stanisl...@samsung.com wrote:
 Hi Ricardo,
 I am the designer of selection API. I hope I can help you a little.
 I think that there are two issues mixed in 'Mulitple selections' topic.

 Firstly, you described that you program a piece of hardware that is
 capable of selecting 8 areas for scanning. Now you
 are looking for userspace API to support such a feature.
 The feature of posting multiple rectangle was proposed in this RFC.

 Secondly, You introduced struct v4l2_ext_rect which is a future-proof
 version of v4l2_rect.


 I think that both issues should be solved in two separate patchsets.

 Ad 1.
 The selection of multiple scanning areas is a very driver-specific
 feature, isn't it? I think that you do not need to introduce any abstract
 interface. What would be other applications of the proposed interface?

 It is not driver specific. There are many sensors out there that
 supports multiple window of interest, but today we are ignoring them
 just because we dont have an api.

 The main application would be industrial imaging, where less data to
 read means more fps and therefore the system can run faster.

 From my field I can tell you that it is a hard requirement for
 computer vision. And it is a feature that we cannot model through v4l2
 controls.



 OK. So there is no need to implement this feature as a driver-specific API.
 It can go automatically to generic API.

 Do you know other drivers that may need it? Sakari mentioned introduction
 of private targets for selections. I like this idea. Just define:

 #define V4L2_SEL_TGT_PRIVATE 0x8000

 All targets that are = V4L2_SEL_TGT_PRIVATE are driver-specific.
 Generic applications must not use them. Non-generic application
 must check out the driver of video node before using selections
 from private set. If some target becomes more useful and accepted
 by more then one driver then it can be moved to generic API.
 The good thing about private target is that enums from different
 drivers can collide so the target space is not going to be trashed.


 If you read the previous RFCs you will see that the approach you are
 mentioning has been rejected.

 The main issue is that you cannot set atomically all the rectangles.
 Lets say that the configuration formed by rectangle A, B and C is
 legal, but the configuration A and B is not allowed by the sensor. How
 could you set the rectangles one by one?


 As I said. Changes of rectangle n may trigger changes in rectangle n+1 and so 
 on.
 So activation of rectangle B (setting height to non-zero value) will enable
 rectangle C with some default size. Moreover disabling rectangle B (setting 
 height to 0)
 may disable rectangle C automatically. I do not follow what is the problem 
 here?


Lets say you want a configuration composed by 3 rectangles ABC and
there are no pair of rectangles with a legal configuration. You cannot
do step by step configuration.

Also lets say that your sensor requires that the total size of the
image is 700 lines on 3 rectanges and 500 on 4. You cannot do this
configuration step by step.


 Hmm. I think that the real problem is much different.
 Not how to set up rectangles atomically but rather
 how do anything non-trivial atomically in V4L2.

 It would be very nice to have crop/compose and format configured at the same 
 time.
 However, current version of V4L2 API does not support that.

 Setting multiple crop rectangles may help a bit for only this little case.
 But how would like to set multicrop rectangles and multicompose rectangle 
 atomically.
 How to define which crop rectangle refers to which to which compose rectangle.

The number of retangles in crop are the same number of rectables in the compose.

Crop[0] corresponds to compose[0], crop[1]to compose[1] and so on


 What to do if one would like to change only 3rd crop rectangle?

You send the whole configuration. The same as today when the user only
wants to change the pixel format. He still have to send the size.


 Introduce rectangle id into v4l2_ext_rect?
 Call VIDIOC_G_SELECTION to get all rectangles, change one and apply 
 VIDIOC_S_SELECTION?
 Is it really scalable?

 Why it is not scalable?It is much more scalable than 8 ioctls to set
8 rectangles.



 Multirectangle targets may seam to be a solution but I think it is not.

 I think that atomic transactions are what is really needed in V4L2.
 Other ideas like try-context from subdev API may 

Re: [RFC v3] [RFC] v4l2: Support for multiple selections

2013-12-10 Thread Ricardo Ribalda Delgado
Hello Tomasz and Hans

On Thu, Nov 14, 2013 at 4:40 PM, Tomasz Stanislawski
t.stanisl...@samsung.com wrote:
 Hi Hans,

 On 11/14/2013 11:18 AM, Hans Verkuil wrote:
 Hi Tomasz,

 On 11/12/13 15:54, Tomasz Stanislawski wrote:
 Hi Ricardo,
 Sorry for a late reply. I've been 'offline' for the last two weeks.
 Please refer to the comments below.


 [snip]


 As I said. Changes of rectangle n may trigger changes in rectangle n+1 and 
 so on.
 So activation of rectangle B (setting height to non-zero value) will enable
 rectangle C with some default size. Moreover disabling rectangle B (setting 
 height to 0)
 may disable rectangle C automatically. I do not follow what is the problem 
 here?

 The problem would be in a situation like this:

 ..
 .AA.B.
 ..   --   AAB
 .C.DD. CDD
 ..

 A-D are the rectangles you want to select. They are cropped as shown on the
 left and composed as shown on the right.

From what Ricardo told me the resulting composed image typically must be
 a proper rectangle without padding anywhere.

 Trying to add rectangles one at a time breaks down when adding C because
 the composition result is no longer a 'proper' rectangle. I don't see how
 you can set something like that up one rectangle at a time.

 I see the issue but I think that it is not a big problem.
 Activating C forms a non-proper rectangle with A and B.
 Therefore, driver must force enabling D to form a proper rectangle again.

 I mean that instead of enlarging C to sum of width of A and B,
 the driver can implicitly activate D to ensure that A,B,C,D form a proper 
 rectangle.

I think this will lead to X different drivers with X different behaviours.


 The special target called V4L2_SEL_TGT_COMPOSE_PADDED was introduced
 to inform application which part of a buffers if going to be modified
 with some undefined value.

 I see nothing against setting a padded rectangle for C to a rectangle that
 covers C and D or even the whole ABCD rectangle.
 I think it could be a great application for PADDED target.
 The application could easily detect which part of a buffer are affected.

 Even applications prepared to work with single crop devices
 would still work after enabling multi crop mode.

 The setup of rectangles my look like this.

 

 S_SELECTION(CROP0 = A)

 crop   compose
 --
 ..
 .AA...
 ..   --   AA..
 .. 
 .. 

 G_SELECTION(COMPOSE0)
   AA..
   
   


 G_SELECTION(COMPOSE0_PADDED)
   AA..
   
   

 

 S_SELECTION(CROP1 = B)
 ..
 .AA.B.
 ..   --   AAB.
 .. 
 .. 

 G_SELECTION(COMPOSE0)
   AA..
   
   

 G_SELECTION(COMPOSE0_PADDED)
   AAA.
   
   

 G_SELECTION(COMPOSE1)
   ..B.
   
   

 G_SELECTION(COMPOSE1_PADDED)
   BBB.
   
   


 

 S_SELECTION(CROP2 = C) - D is activated implicitly
 ..
 .AA.B.
 .C.DD.   --   AAB.
 .. CDD.
 .. 

 G_SELECTION(COMPOSE0_PADDED)

   AAA.
   AAA.
   

 G_SELECTION(COMPOSE2)
   
   C...
   


 G_SELECTION(COMPOSE2_PADDED)
   CCC.
   CCC.
   

 G_SELECTION(COMPOSE3)
   
   .DD.
   


 G_SELECTION(COMPOSE3_PADDED)
   DDD.
   DDD.
   

 One may argue that all this logic is unnecessary after adding support
 for multirect selections.
 So, I kindly ask what should happen if someone call S_SELECTION
 (in multirect mode) passing THREE rectangles A, B, and C (not D) ?

 The driver must adjust rectangles to some valid value. So it can
 increase width of C or implicitly activate D or disable C.
 I think that the best solution is activating D because
 it allows to set size of C to the value closest to requested one.
 Therefore logic for implicit activation of D should be implemented anyway.

You are assuming that the user will send you the rectangles in an
order that makes sense, but it is not always the case. On the other
hand if you have all the rectangles, you can ALWAYS make the better
decisition.



 It makes much more sense to set everything up at once.

 I agree that it is better to set everything at once.
 But I strongly believe that transactions are the proper way to achieve that.

 Not multirectangle selections.


As I said before the transaction is something easier said than made.
What happens if multiple users starts a transaction? What happen if in
a transaction of 10 itmes, item 7 needs a readjusment by the driver?

The selection API cannot cover a type of selection, therefore it
should be fixed. Especially when it is something as easy as the
propossed RFC.


 It obfuscates API. It only pretends to fix a problem with applying
 a part of configuration atomically.


 BTW, what probably wasn't clear from Ricardo's explanation is that for every
 crop rectangle you must have a corresponding compose rectangle so that you
 

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

2013-12-10 Thread Prabhakar Lad
Hi Hans,

On Tue, Dec 10, 2013 at 1:21 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 As Guennadi mentioned in his review, ENODATA will be replaced by ENOBUFS, 
 which is
 more appropriate.

 Prabhakar, Kamil, Tomasz, are you OK with this patch provided 
 s/ENODATA/ENOBUFS/ ?

+1 for ENOBUFS.

Regards,
--Prabhakar Lad

 Regards,

 Hans

 On 12/09/2013 02:43 PM, Hans Verkuil wrote:
 From: Hans Verkuil hans.verk...@cisco.com

 This works together with the retry_start_streaming mechanism to allow 
 userspace
 to start streaming even if not all required buffers have been queued.

 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 Cc: Lad, Prabhakar prabhakar.cse...@gmail.com
 Cc: Tomasz Stanislawski t.stanisl...@samsung.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Kamil Debski k.deb...@samsung.com
 Cc: Guennadi Liakhovetski g.liakhovet...@gmx.de
 ---
  drivers/media/platform/davinci/vpbe_display.c   | 2 +-
  drivers/media/platform/davinci/vpif_capture.c   | 2 +-
  drivers/media/platform/davinci/vpif_display.c   | 2 +-
  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c| 2 +-
  drivers/media/platform/s5p-tv/mixer_video.c | 2 +-
  drivers/media/platform/soc_camera/mx2_camera.c  | 2 +-
  drivers/staging/media/davinci_vpfe/vpfe_video.c | 2 ++
  7 files changed, 8 insertions(+), 6 deletions(-)

 diff --git a/drivers/media/platform/davinci/vpbe_display.c 
 b/drivers/media/platform/davinci/vpbe_display.c
 index eac472b..53be7fc 100644
 --- a/drivers/media/platform/davinci/vpbe_display.c
 +++ b/drivers/media/platform/davinci/vpbe_display.c
 @@ -347,7 +347,7 @@ static int vpbe_start_streaming(struct vb2_queue *vq, 
 unsigned int count)
   /* If buffer queue is empty, return error */
   if (list_empty(layer-dma_queue)) {
   v4l2_err(vpbe_dev-v4l2_dev, buffer queue is empty\n);
 - return -EINVAL;
 + return -ENODATA;
   }
   /* Get the next frame from the buffer queue */
   layer-next_frm = layer-cur_frm = list_entry(layer-dma_queue.next,
 diff --git a/drivers/media/platform/davinci/vpif_capture.c 
 b/drivers/media/platform/davinci/vpif_capture.c
 index 52ac5e6..4b04a27 100644
 --- a/drivers/media/platform/davinci/vpif_capture.c
 +++ b/drivers/media/platform/davinci/vpif_capture.c
 @@ -277,7 +277,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, 
 unsigned int count)
   if (list_empty(common-dma_queue)) {
   spin_unlock_irqrestore(common-irqlock, flags);
   vpif_dbg(1, debug, buffer queue is empty\n);
 - return -EIO;
 + return -ENODATA;
   }

   /* Get the next frame from the buffer queue */
 diff --git a/drivers/media/platform/davinci/vpif_display.c 
 b/drivers/media/platform/davinci/vpif_display.c
 index c31bcf1..c5070dc 100644
 --- a/drivers/media/platform/davinci/vpif_display.c
 +++ b/drivers/media/platform/davinci/vpif_display.c
 @@ -239,7 +239,7 @@ static int vpif_start_streaming(struct vb2_queue *vq, 
 unsigned int count)
   if (list_empty(common-dma_queue)) {
   spin_unlock_irqrestore(common-irqlock, flags);
   vpif_err(buffer queue is empty\n);
 - return -EIO;
 + return -ENODATA;
   }

   /* Get the next frame from the buffer queue */
 diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c 
 b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 index 4ff3b6c..3bdfe85 100644
 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
 @@ -1863,7 +1863,7 @@ static int s5p_mfc_start_streaming(struct vb2_queue 
 *q, unsigned int count)
   if (ctx-src_bufs_cnt  ctx-pb_count) {
   mfc_err(Need minimum %d OUTPUT buffers\n,
   ctx-pb_count);
 - return -EINVAL;
 + return -ENODATA;
   }
   }

 diff --git a/drivers/media/platform/s5p-tv/mixer_video.c 
 b/drivers/media/platform/s5p-tv/mixer_video.c
 index 81b97db..220ec31 100644
 --- a/drivers/media/platform/s5p-tv/mixer_video.c
 +++ b/drivers/media/platform/s5p-tv/mixer_video.c
 @@ -948,7 +948,7 @@ static int start_streaming(struct vb2_queue *vq, 
 unsigned int count)

   if (count == 0) {
   mxr_dbg(mdev, no output buffers queued\n);
 - return -EINVAL;
 + return -ENODATA;
   }

   /* block any changes in output configuration */
 diff --git a/drivers/media/platform/soc_camera/mx2_camera.c 
 b/drivers/media/platform/soc_camera/mx2_camera.c
 index 45a0276..587e3d1 100644
 --- a/drivers/media/platform/soc_camera/mx2_camera.c
 +++ b/drivers/media/platform/soc_camera/mx2_camera.c
 @@ -659,7 +659,7 @@ static int mx2_start_streaming(struct vb2_queue *q, 
 unsigned int count)
   unsigned long flags;

   if (count  2)
 - return -EINVAL;
 + return -ENODATA;

   spin_lock_irqsave(pcdev-lock, flags);

 diff --git 

use other formats from ov3640 camera sensor through the isp pipeline

2013-12-10 Thread Tom
Hello,

I am using the ov3640 camera sensor along with the isp pipeline and
configured it like: sensor-ccdc-memory

My sensor supports more formats like rgb565 and so. Does anyone have an idea
how I could manage to set these formats out of the users application? If I
understand it right, the isp pipeline will not allow a format the ccdc sink
pad does not know.

Regards, Tom

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


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

2013-12-10 Thread Robert Baldyga
Hello,

This patchset fixes UVC gadget test application, created by Laurent Pinchart
(git tree available here: git://git.ideasonboard.org/uvc-gadget.git), with
applied patches created by Bhupesh Sharma (which can be found here:
http://www.spinics.net/lists/linux-usb/msg84376.html).

It improves video-capture device handling, and adds few other fixes.
More details can be found in commit messages.

Best regards
Robert Baldyga
Samsung RD Institute Poland

Robert Baldyga (4):
  closing uvc file when init fails
  remove set_format from uvc_events_process_data
  fix v4l2 stream handling
  remove flooding debugs

 uvc-gadget.c |   68 +-
 1 file changed, 10 insertions(+), 58 deletions(-)

-- 
1.7.9.5

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


[PATCH 1/4] closing uvc file when init fails

2013-12-10 Thread Robert Baldyga
This patch adds uvc device file closing when inits in uvc_open() function fails.

Signed-off-by: Robert Baldyga r.bald...@samsung.com
---
 uvc-gadget.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/uvc-gadget.c b/uvc-gadget.c
index 0764838..5512e2c 100644
--- a/uvc-gadget.c
+++ b/uvc-gadget.c
@@ -880,6 +880,7 @@ uvc_open(struct uvc_device **uvc, char *devname)
return 0;
 
 err:
+   close(fd);
return ret;
 }
 
-- 
1.7.9.5

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


[PATCH 2/4] remove set_format from uvc_events_process_data

2013-12-10 Thread Robert Baldyga
Format is based on application parameters, and it stay unchanged, so we
don't need to do uvc_video_set_format() and v4l2_set_format()  in
uvc_events_process_data() function. In addition it allow us to do
VIDIOC_REQBUFS ioctl once at the beginning, and skip it in STREAMON and
STREAMOFF events.

Signed-off-by: Robert Baldyga r.bald...@samsung.com
---
 uvc-gadget.c |   38 --
 1 file changed, 38 deletions(-)

diff --git a/uvc-gadget.c b/uvc-gadget.c
index 5512e2c..c964f37 100644
--- a/uvc-gadget.c
+++ b/uvc-gadget.c
@@ -1949,44 +1949,6 @@ uvc_events_process_data(struct uvc_device *dev, struct 
uvc_request_data *data)
dev-width = frame-width;
dev-height = frame-height;
 
-   /*
-* Try to set the default format at the V4L2 video capture
-* device as requested by the user.
-*/
-   CLEAR(fmt);
-
-   fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-   fmt.fmt.pix.field = V4L2_FIELD_ANY;
-   fmt.fmt.pix.width = frame-width;
-   fmt.fmt.pix.height = frame-height;
-   fmt.fmt.pix.pixelformat = format-fcc;
-
-   switch (format-fcc) {
-   case V4L2_PIX_FMT_YUYV:
-   fmt.fmt.pix.sizeimage =
-   (fmt.fmt.pix.width * fmt.fmt.pix.height * 2);
-   break;
-   case V4L2_PIX_FMT_MJPEG:
-   fmt.fmt.pix.sizeimage = dev-imgsize;
-   break;
-   }
-
-   /*
-* As per the new commit command received from the UVC host
-* change the current format selection at both UVC and V4L2
-* sides.
-*/
-   ret = uvc_video_set_format(dev);
-   if (ret  0)
-   goto err;
-
-   if (!dev-run_standalone) {
-   /* UVC - V4L2 integrated path. */
-   ret = v4l2_set_format(dev-vdev, fmt);
-   if (ret  0)
-   goto err;
-   }
-
if (dev-bulk) {
ret = uvc_handle_streamon_event(dev);
if (ret  0)
-- 
1.7.9.5

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


[PATCH 4/4] remove flooding debugs

2013-12-10 Thread Robert Baldyga
Those debugs are printed very often killing the efficiency, so they should
be removed from final code.

Signed-off-by: Robert Baldyga r.bald...@samsung.com
---
 uvc-gadget.c |   15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/uvc-gadget.c b/uvc-gadget.c
index 8f06a1f..4ff0d80 100644
--- a/uvc-gadget.c
+++ b/uvc-gadget.c
@@ -451,11 +451,8 @@ v4l2_process_data(struct v4l2_device *dev)
}
 
ret = ioctl(dev-v4l2_fd, VIDIOC_DQBUF, vbuf);
-   if (ret  0) {
-   printf(V4L2: Unable to dequeue buffer: %s (%d).\n,
-   strerror(errno), errno);
+   if (ret  0)
return ret;
-   }
 
dev-dqbuf_count++;
 
@@ -953,11 +950,8 @@ uvc_video_process(struct uvc_device *dev)
if (dev-run_standalone) {
/* UVC stanalone setup. */
ret = ioctl(dev-uvc_fd, VIDIOC_DQBUF, ubuf);
-   if (ret  0) {
-   printf(UVC: Unable to dequeue buffer: %s (%d).\n,
-   strerror(errno), errno);
+   if (ret  0)
return ret;
-   }
 
dev-dqbuf_count++;
 
@@ -999,11 +993,8 @@ uvc_video_process(struct uvc_device *dev)
 
/* Dequeue the spent buffer from UVC domain */
ret = ioctl(dev-uvc_fd, VIDIOC_DQBUF, ubuf);
-   if (ret  0) {
-   printf(UVC: Unable to dequeue buffer: %s (%d).\n,
-   strerror(errno), errno);
+   if (ret  0)
return ret;
-   }
 
if (dev-io == IO_METHOD_USERPTR)
for (i = 0; i  dev-nbufs; ++i)
-- 
1.7.9.5

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


[PATCH 3/4] fix v4l2 stream handling

2013-12-10 Thread Robert Baldyga
This patch fixes v4l2 stream handling. It improves few things:

- Fix dqbuf_count check in v4l2_process_data() function.

- Removes freeing v4l2 device buffers in STREAMOFF event. It's because
  this buffers are requested once at the beginning, and it's not needed
  to free them on STREAMOFF and request again on STREAMON every time.

- Removes v4l2_qbuf() function from main(). It should be rather called from
  uvc_handle_streamon_event().

- Clears first_buffer_queued field of uvc device in STREAMOFF event handler.

Signed-off-by: Robert Baldyga r.bald...@samsung.com
---
 uvc-gadget.c |   14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/uvc-gadget.c b/uvc-gadget.c
index c964f37..8f06a1f 100644
--- a/uvc-gadget.c
+++ b/uvc-gadget.c
@@ -432,7 +432,7 @@ v4l2_process_data(struct v4l2_device *dev)
return 0;
 
if (dev-udev-first_buffer_queued)
-   if ((dev-dqbuf_count + 1) = dev-qbuf_count)
+   if (dev-dqbuf_count = dev-qbuf_count)
return 0;
 
/* Dequeue spent buffer rom V4L2 domain. */
@@ -1351,11 +1351,11 @@ uvc_handle_streamon_event(struct uvc_device *dev)
ret = v4l2_reqbufs(dev-vdev, dev-vdev-nbufs);
if (ret  0)
goto err;
-
-   ret = v4l2_qbuf(dev-vdev);
-   if (ret  0)
-   goto err;
}
+   ret = v4l2_qbuf(dev-vdev);
+   if (ret  0)
+   goto err;
+   
 
/* Start V4L2 capturing now. */
ret = v4l2_start_capturing(dev-vdev);
@@ -2011,8 +2011,6 @@ uvc_events_process(struct uvc_device *dev)
if (!dev-run_standalone  dev-vdev-is_streaming) {
/* UVC - V4L2 integrated path. */
v4l2_stop_capturing(dev-vdev);
-   v4l2_uninit_device(dev-vdev);
-   v4l2_reqbufs(dev-vdev, 0);
dev-vdev-is_streaming = 0;
}
 
@@ -2022,6 +2020,7 @@ uvc_events_process(struct uvc_device *dev)
uvc_uninit_device(dev);
uvc_video_reqbufs(dev, 0);
dev-is_streaming = 0;
+   dev-first_buffer_queued = 0;
}
 
return;
@@ -2365,7 +2364,6 @@ main(int argc, char *argv[])
 * buffers queued.
 */
v4l2_reqbufs(vdev, vdev-nbufs);
-   v4l2_qbuf(vdev);
}
 
if (mjpeg_image)
-- 
1.7.9.5

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


[RFC PATCH 3/6] ad9389b: remove rx-sense irq dependency

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Removed dependency on rx-sense interrupt, it's a leftover from obsolete
code. Removing this simplifies the code.

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/ad9389b.c | 138 +++-
 1 file changed, 58 insertions(+), 80 deletions(-)

diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c
index fa95203..cca7758 100644
--- a/drivers/media/i2c/ad9389b.c
+++ b/drivers/media/i2c/ad9389b.c
@@ -66,11 +66,6 @@ MODULE_LICENSE(GPL);
 **
 */
 
-struct i2c_reg_value {
-   u8 reg;
-   u8 value;
-};
-
 struct ad9389b_state_edid {
/* total number of blocks */
u32 blocks;
@@ -143,7 +138,7 @@ static int ad9389b_wr(struct v4l2_subdev *sd, u8 reg, u8 
val)
if (ret == 0)
return 0;
}
-   v4l2_err(sd, I2C Write Problem\n);
+   v4l2_err(sd, %s: failed reg 0x%x, val 0x%x\n, __func__, reg, val);
return ret;
 }
 
@@ -392,13 +387,11 @@ static int ad9389b_log_status(struct v4l2_subdev *sd)
  (ad9389b_rd(sd, 0x42)  MASK_AD9389B_MSEN_DETECT) ?
  detected : no,
  edid-segments ? found : no, edid-blocks);
-   if (state-have_monitor) {
-   v4l2_info(sd, %s output %s\n,
- (ad9389b_rd(sd, 0xaf)  0x02) ?
- HDMI : DVI-D,
- (ad9389b_rd(sd, 0xa1)  0x3c) ?
- disabled : enabled);
-   }
+   v4l2_info(sd, %s output %s\n,
+ (ad9389b_rd(sd, 0xaf)  0x02) ?
+ HDMI : DVI-D,
+ (ad9389b_rd(sd, 0xa1)  0x3c) ?
+ disabled : enabled);
v4l2_info(sd, ad9389b: %s\n, (ad9389b_rd(sd, 0xb8)  0x40) ?
  encrypted : no encryption);
v4l2_info(sd, state: %s, error: %s, detect count: %u, msk/irq: 
%02x/%02x\n,
@@ -413,35 +406,33 @@ static int ad9389b_log_status(struct v4l2_subdev *sd)
  manual_gear ? manual : automatic,
  manual_gear ? ((ad9389b_rd(sd, 0x98)  0x70)  4) :
  ((ad9389b_rd(sd, 0x9e)  0x0e)  1));
-   if (state-have_monitor) {
-   if (ad9389b_rd(sd, 0xaf)  0x02) {
-   /* HDMI only */
-   u8 manual_cts = ad9389b_rd(sd, 0x0a)  0x80;
-   u32 N = (ad9389b_rd(sd, 0x01)  0xf)  16 |
-   ad9389b_rd(sd, 0x02)  8 |
-   ad9389b_rd(sd, 0x03);
-   u8 vic_detect = ad9389b_rd(sd, 0x3e)  2;
-   u8 vic_sent = ad9389b_rd(sd, 0x3d)  0x3f;
-   u32 CTS;
-
-   if (manual_cts)
-   CTS = (ad9389b_rd(sd, 0x07)  0xf)  16 |
- ad9389b_rd(sd, 0x08)  8 |
- ad9389b_rd(sd, 0x09);
-   else
-   CTS = (ad9389b_rd(sd, 0x04)  0xf)  16 |
- ad9389b_rd(sd, 0x05)  8 |
- ad9389b_rd(sd, 0x06);
-   N = (ad9389b_rd(sd, 0x01)  0xf)  16 |
-   ad9389b_rd(sd, 0x02)  8 |
-   ad9389b_rd(sd, 0x03);
-
-   v4l2_info(sd, ad9389b: CTS %s mode: N %d, CTS %d\n,
- manual_cts ? manual : automatic, N, CTS);
-
-   v4l2_info(sd, ad9389b: VIC: detected %d, sent %d\n,
- vic_detect, vic_sent);
-   }
+   if (ad9389b_rd(sd, 0xaf)  0x02) {
+   /* HDMI only */
+   u8 manual_cts = ad9389b_rd(sd, 0x0a)  0x80;
+   u32 N = (ad9389b_rd(sd, 0x01)  0xf)  16 |
+   ad9389b_rd(sd, 0x02)  8 |
+   ad9389b_rd(sd, 0x03);
+   u8 vic_detect = ad9389b_rd(sd, 0x3e)  2;
+   u8 vic_sent = ad9389b_rd(sd, 0x3d)  0x3f;
+   u32 CTS;
+
+   if (manual_cts)
+   CTS = (ad9389b_rd(sd, 0x07)  0xf)  16 |
+ ad9389b_rd(sd, 0x08)  8 |
+ ad9389b_rd(sd, 0x09);
+   else
+   CTS = (ad9389b_rd(sd, 0x04)  0xf)  16 |
+ ad9389b_rd(sd, 0x05)  8 |
+ ad9389b_rd(sd, 0x06);
+   N = (ad9389b_rd(sd, 0x01)  0xf)  16 |
+   ad9389b_rd(sd, 0x02)  8 |
+   ad9389b_rd(sd, 0x03);
+
+   v4l2_info(sd, ad9389b: CTS %s mode: N %d, CTS %d\n,
+ manual_cts ? manual : automatic, N, CTS);
+
+   v4l2_info(sd, ad9389b: VIC: detected %d, sent %d\n,
+ vic_detect, 

[RFC PATCH 1/6] ad9389b: verify EDID header

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

Ignore EDIDs where the header is wrong.

Signed-off-by: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/ad9389b.c | 26 +++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c
index b06a7e5..e7f7171 100644
--- a/drivers/media/i2c/ad9389b.c
+++ b/drivers/media/i2c/ad9389b.c
@@ -978,7 +978,7 @@ static bool edid_block_verify_crc(u8 *edid_block)
return sum == 0;
 }
 
-static bool edid_segment_verify_crc(struct v4l2_subdev *sd, u32 segment)
+static bool edid_verify_crc(struct v4l2_subdev *sd, u32 segment)
 {
struct ad9389b_state *state = get_ad9389b_state(sd);
u32 blocks = state-edid.blocks;
@@ -992,6 +992,25 @@ static bool edid_segment_verify_crc(struct v4l2_subdev 
*sd, u32 segment)
return false;
 }
 
+static bool edid_verify_header(struct v4l2_subdev *sd, u32 segment)
+{
+   static const u8 hdmi_header[] = {
+   0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
+   };
+   struct ad9389b_state *state = get_ad9389b_state(sd);
+   u8 *data = state-edid.data;
+   int i;
+
+   if (segment)
+   return true;
+
+   for (i = 0; i  ARRAY_SIZE(hdmi_header); i++)
+   if (data[i] != hdmi_header[i])
+   return false;
+
+   return true;
+}
+
 static bool ad9389b_check_edid_status(struct v4l2_subdev *sd)
 {
struct ad9389b_state *state = get_ad9389b_state(sd);
@@ -1019,9 +1038,10 @@ static bool ad9389b_check_edid_status(struct v4l2_subdev 
*sd)
v4l2_dbg(1, debug, sd, %s: %d blocks in total\n,
__func__, state-edid.blocks);
}
-   if (!edid_segment_verify_crc(sd, segment)) {
+   if (!edid_verify_crc(sd, segment) ||
+   !edid_verify_header(sd, segment)) {
/* edid crc error, force reread of edid segment */
-   v4l2_err(sd, %s: edid crc error\n, __func__);
+   v4l2_err(sd, %s: edid crc or header error\n, __func__);
state-have_monitor = false;
ad9389b_s_power(sd, false);
ad9389b_s_power(sd, true);
-- 
1.8.4.rc3

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


[RFC PATCH 2/6] ad9389b: whitespace changes to improve readability

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/ad9389b.c | 116 ++--
 1 file changed, 58 insertions(+), 58 deletions(-)

diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c
index e7f7171..fa95203 100644
--- a/drivers/media/i2c/ad9389b.c
+++ b/drivers/media/i2c/ad9389b.c
@@ -150,7 +150,7 @@ static int ad9389b_wr(struct v4l2_subdev *sd, u8 reg, u8 
val)
 /* To set specific bits in the register, a clear-mask is given (to be AND-ed),
and then the value-mask (to be OR-ed). */
 static inline void ad9389b_wr_and_or(struct v4l2_subdev *sd, u8 reg,
-   u8 clr_mask, u8 val_mask)
+u8 clr_mask, u8 val_mask)
 {
ad9389b_wr(sd, reg, (ad9389b_rd(sd, reg)  clr_mask) | val_mask);
 }
@@ -321,12 +321,12 @@ static int ad9389b_s_ctrl(struct v4l2_ctrl *ctrl)
struct ad9389b_state *state = get_ad9389b_state(sd);
 
v4l2_dbg(1, debug, sd,
-   %s: ctrl id: %d, ctrl-val %d\n, __func__, ctrl-id, 
ctrl-val);
+%s: ctrl id: %d, ctrl-val %d\n, __func__, ctrl-id, 
ctrl-val);
 
if (state-hdmi_mode_ctrl == ctrl) {
/* Set HDMI or DVI-D */
ad9389b_wr_and_or(sd, 0xaf, 0xfd,
-   ctrl-val == V4L2_DV_TX_MODE_HDMI ? 0x02 : 
0x00);
+ ctrl-val == V4L2_DV_TX_MODE_HDMI ? 0x02 : 
0x00);
return 0;
}
if (state-rgb_quantization_range_ctrl == ctrl)
@@ -387,60 +387,60 @@ static int ad9389b_log_status(struct v4l2_subdev *sd)
v4l2_info(sd, chip revision %d\n, state-chip_revision);
v4l2_info(sd, power %s\n, state-power_on ? on : off);
v4l2_info(sd, %s hotplug, %s Rx Sense, %s EDID (%d block(s))\n,
-   (ad9389b_rd(sd, 0x42)  MASK_AD9389B_HPD_DETECT) ?
-   detected : no,
-   (ad9389b_rd(sd, 0x42)  MASK_AD9389B_MSEN_DETECT) ?
-   detected : no,
-   edid-segments ? found : no, edid-blocks);
+ (ad9389b_rd(sd, 0x42)  MASK_AD9389B_HPD_DETECT) ?
+ detected : no,
+ (ad9389b_rd(sd, 0x42)  MASK_AD9389B_MSEN_DETECT) ?
+ detected : no,
+ edid-segments ? found : no, edid-blocks);
if (state-have_monitor) {
v4l2_info(sd, %s output %s\n,
- (ad9389b_rd(sd, 0xaf)  0x02) ?
- HDMI : DVI-D,
- (ad9389b_rd(sd, 0xa1)  0x3c) ?
- disabled : enabled);
+ (ad9389b_rd(sd, 0xaf)  0x02) ?
+ HDMI : DVI-D,
+ (ad9389b_rd(sd, 0xa1)  0x3c) ?
+ disabled : enabled);
}
v4l2_info(sd, ad9389b: %s\n, (ad9389b_rd(sd, 0xb8)  0x40) ?
-   encrypted : no encryption);
+ encrypted : no encryption);
v4l2_info(sd, state: %s, error: %s, detect count: %u, msk/irq: 
%02x/%02x\n,
-   states[ad9389b_rd(sd, 0xc8)  0xf],
-   errors[ad9389b_rd(sd, 0xc8)  4],
-   state-edid_detect_counter,
-   ad9389b_rd(sd, 0x94), ad9389b_rd(sd, 0x96));
+ states[ad9389b_rd(sd, 0xc8)  0xf],
+ errors[ad9389b_rd(sd, 0xc8)  4],
+ state-edid_detect_counter,
+ ad9389b_rd(sd, 0x94), ad9389b_rd(sd, 0x96));
manual_gear = ad9389b_rd(sd, 0x98)  0x80;
v4l2_info(sd, ad9389b: RGB quantization: %s range\n,
-   ad9389b_rd(sd, 0x3b)  0x01 ? limited : full);
+ ad9389b_rd(sd, 0x3b)  0x01 ? limited : full);
v4l2_info(sd, ad9389b: %s gear %d\n,
  manual_gear ? manual : automatic,
  manual_gear ? ((ad9389b_rd(sd, 0x98)  0x70)  4) :
-   ((ad9389b_rd(sd, 0x9e)  0x0e)  1));
+ ((ad9389b_rd(sd, 0x9e)  0x0e)  1));
if (state-have_monitor) {
if (ad9389b_rd(sd, 0xaf)  0x02) {
/* HDMI only */
u8 manual_cts = ad9389b_rd(sd, 0x0a)  0x80;
u32 N = (ad9389b_rd(sd, 0x01)  0xf)  16 |
-ad9389b_rd(sd, 0x02)  8 |
-ad9389b_rd(sd, 0x03);
+   ad9389b_rd(sd, 0x02)  8 |
+   ad9389b_rd(sd, 0x03);
u8 vic_detect = ad9389b_rd(sd, 0x3e)  2;
u8 vic_sent = ad9389b_rd(sd, 0x3d)  0x3f;
u32 CTS;
 
if 

[RFC PATCH 5/6] adv7511: disable register reset by HPD

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Whenever the hotplug pin is pulled low the chip resets a whole bunch
of registers. It turns out that this can be turned off on the adv7511.
Do so, as this 'feature' introduces race conditions in setting up
registers, particular when the hotplug pin bounces a lot.

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7511.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c
index 7c8d971..89ea266 100644
--- a/drivers/media/i2c/adv7511.c
+++ b/drivers/media/i2c/adv7511.c
@@ -1038,6 +1038,12 @@ static void adv7511_init_setup(struct v4l2_subdev *sd)
 
/* clear all interrupts */
adv7511_wr(sd, 0x96, 0xff);
+   /*
+* Stop HPD from resetting a lot of registers.
+* It might leave the chip in a partly un-initialized state,
+* in particular with regards to hotplug bounces.
+*/
+   adv7511_wr_and_or(sd, 0xd6, 0x3f, 0xc0);
memset(edid, 0, sizeof(struct adv7511_state_edid));
state-have_monitor = false;
adv7511_set_isr(sd, false);
-- 
1.8.4.rc3

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


[RFC PATCH 4/6] ad9389b: retry setup if the state is inconsistent

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Retry setup if the device is powered off when it should be powered on. This
state can be caused by rapid hotplug toggles.

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/ad9389b.c | 27 ++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ad9389b.c b/drivers/media/i2c/ad9389b.c
index cca7758..83225d6 100644
--- a/drivers/media/i2c/ad9389b.c
+++ b/drivers/media/i2c/ad9389b.c
@@ -904,7 +904,7 @@ static void ad9389b_notify_monitor_detect(struct 
v4l2_subdev *sd)
v4l2_subdev_notify(sd, AD9389B_MONITOR_DETECT, (void *)mdt);
 }
 
-static void ad9389b_check_monitor_present_status(struct v4l2_subdev *sd)
+static void ad9389b_update_monitor_present_status(struct v4l2_subdev *sd)
 {
struct ad9389b_state *state = get_ad9389b_state(sd);
/* read hotplug and rx-sense state */
@@ -947,6 +947,31 @@ static void ad9389b_check_monitor_present_status(struct 
v4l2_subdev *sd)
ad9389b_s_ctrl(state-hdmi_mode_ctrl);
 }
 
+static void ad9389b_check_monitor_present_status(struct v4l2_subdev *sd)
+{
+   struct ad9389b_state *state = get_ad9389b_state(sd);
+   int retry = 0;
+
+   ad9389b_update_monitor_present_status(sd);
+
+   /*
+* Rapid toggling of the hotplug may leave the chip powered off,
+* even if we think it is on. In that case reset and power up again.
+*/
+   while (state-power_on  (ad9389b_rd(sd, 0x41)  0x40)) {
+   if (++retry  5) {
+   v4l2_err(sd, retried %d times, give up\n, retry);
+   return;
+   }
+   v4l2_dbg(1, debug, sd, %s: reset and re-check status (%d)\n, 
__func__, retry);
+   ad9389b_notify_monitor_detect(sd);
+   cancel_delayed_work_sync(state-edid_handler);
+   memset(state-edid, 0, sizeof(struct ad9389b_state_edid));
+   ad9389b_s_power(sd, false);
+   ad9389b_update_monitor_present_status(sd);
+   }
+}
+
 static bool edid_block_verify_crc(u8 *edid_block)
 {
u8 sum = 0;
-- 
1.8.4.rc3

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


[RFC PATCH 6/6] adv7511: add VIC and audio CTS/N values to log_status

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Improve status logging.

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7511.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c
index 89ea266..f20450c 100644
--- a/drivers/media/i2c/adv7511.c
+++ b/drivers/media/i2c/adv7511.c
@@ -452,6 +452,29 @@ static int adv7511_log_status(struct v4l2_subdev *sd)
  errors[adv7511_rd(sd, 0xc8)  4], 
state-edid_detect_counter,
  adv7511_rd(sd, 0x94), adv7511_rd(sd, 0x96));
v4l2_info(sd, RGB quantization: %s range\n, adv7511_rd(sd, 0x18)  
0x80 ? limited : full);
+   if (adv7511_rd(sd, 0xaf)  0x02) {
+   /* HDMI only */
+   u8 manual_cts = adv7511_rd(sd, 0x0a)  0x80;
+   u32 N = (adv7511_rd(sd, 0x01)  0xf)  16 |
+   adv7511_rd(sd, 0x02)  8 |
+   adv7511_rd(sd, 0x03);
+   u8 vic_detect = adv7511_rd(sd, 0x3e)  2;
+   u8 vic_sent = adv7511_rd(sd, 0x3d)  0x3f;
+   u32 CTS;
+
+   if (manual_cts)
+   CTS = (adv7511_rd(sd, 0x07)  0xf)  16 |
+ adv7511_rd(sd, 0x08)  8 |
+ adv7511_rd(sd, 0x09);
+   else
+   CTS = (adv7511_rd(sd, 0x04)  0xf)  16 |
+ adv7511_rd(sd, 0x05)  8 |
+ adv7511_rd(sd, 0x06);
+   v4l2_info(sd, CTS %s mode: N %d, CTS %d\n,
+ manual_cts ? manual : automatic, N, CTS);
+   v4l2_info(sd, VIC: detected %d, sent %d\n,
+ vic_detect, vic_sent);
+   }
if (state-dv_timings.type == V4L2_DV_BT_656_1120)
v4l2_print_dv_timings(sd-name, timings: ,
state-dv_timings, false);
-- 
1.8.4.rc3

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


[RFC PATCH 0/6] ad9389b/adv7511 fixes

2013-12-10 Thread Hans Verkuil
This small patch series updates the ad9389b and adv7511 drivers with the
latest fixes from our internal tree.

Regards,

Hans

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


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

2013-12-10 Thread Prabhakar Lad
On Tue, Dec 10, 2013 at 3:26 PM, Prabhakar Lad
prabhakar.cse...@gmail.com wrote:
 Hi Hans,

 On Tue, Dec 10, 2013 at 1:21 PM, Hans Verkuil hverk...@xs4all.nl wrote:
 As Guennadi mentioned in his review, ENODATA will be replaced by ENOBUFS, 
 which is
 more appropriate.

 Prabhakar, Kamil, Tomasz, are you OK with this patch provided 
 s/ENODATA/ENOBUFS/ ?

 +1 for ENOBUFS.

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

Regrads,
--Prabhakar Lad
--
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/15] adv7604: set restart_stdi_once flag when signal is lost.

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

If the restart_stdi_once trick fails to find a valid
format the flag was never reset.

Signed-off-by: Martin Bugge marbu...@cisco.com
Cc: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7604.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index cbeda0f..0e69b24 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1216,6 +1216,7 @@ static int adv7604_query_dv_timings(struct v4l2_subdev 
*sd,
memset(timings, 0, sizeof(struct v4l2_dv_timings));
 
if (no_signal(sd)) {
+   state-restart_stdi_once = true;
v4l2_dbg(1, debug, sd, %s: no valid signal\n, __func__);
return -ENOLINK;
}
-- 
1.8.4.rc3

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


[RFC PATCH 11/15] adv7604: remove debouncing of ADV7604_FMT_CHANGE events

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

ADV7604_FMT_CHANGE events was debounced in adv7604_isr() to avoid
that a receiver with a unstable input signal would block the event
handling for other inputs. This solution was prone to errors.

A better protection agains interrupt blocking is to delay the call
of the interrupt service routine in the adv7604 driver if too many
interrupts are received within a given time.

Signed-off-by: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7604.c | 15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index fa98229..50f0279 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -78,7 +78,6 @@ struct adv7604_state {
struct workqueue_struct *work_queues;
struct delayed_work delayed_work_enable_hotplug;
bool restart_stdi_once;
-   u32 prev_input_status;
 
/* i2c clients */
struct i2c_client *i2c_avlink;
@@ -1524,9 +1523,7 @@ static int adv7604_g_mbus_fmt(struct v4l2_subdev *sd,
 
 static int adv7604_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
 {
-   struct adv7604_state *state = to_state(sd);
u8 fmt_change, fmt_change_digital, tx_5v;
-   u32 input_status;
 
v4l2_dbg(2, debug, sd, %s: , __func__);
 
@@ -1534,22 +1531,17 @@ static int adv7604_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
fmt_change = io_read(sd, 0x43)  0x98;
if (fmt_change)
io_write(sd, 0x44, fmt_change);
+
fmt_change_digital = is_digital_input(sd) ? (io_read(sd, 0x6b)  0xc0) 
: 0;
if (fmt_change_digital)
io_write(sd, 0x6c, fmt_change_digital);
+
if (fmt_change || fmt_change_digital) {
v4l2_dbg(1, debug, sd,
%s: fmt_change = 0x%x, fmt_change_digital = 0x%x\n,
__func__, fmt_change, fmt_change_digital);
 
-   adv7604_g_input_status(sd, input_status);
-   if (input_status != state-prev_input_status) {
-   v4l2_dbg(1, debug, sd,
-   %s: input_status = 0x%x, prev_input_status = 
0x%x\n,
-   __func__, input_status, 
state-prev_input_status);
-   state-prev_input_status = input_status;
-   v4l2_subdev_notify(sd, ADV7604_FMT_CHANGE, NULL);
-   }
+   v4l2_subdev_notify(sd, ADV7604_FMT_CHANGE, NULL);
 
if (handled)
*handled = true;
@@ -2129,7 +2121,6 @@ static int adv7604_probe(struct i2c_client *client,
 
/* initialize variables */
state-restart_stdi_once = true;
-   state-prev_input_status = ~0;
state-selected_input = ~0;
 
/* platform data */
-- 
1.8.4.rc3

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


[RFC PATCH 04/15] adv7604: adv7604_s_register clean up.

2013-12-10 Thread Hans Verkuil
From: Hans Verkuil hans.verk...@cisco.com

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

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 417468c..37f3994 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -718,45 +718,47 @@ static int adv7604_g_register(struct v4l2_subdev *sd,
 static int adv7604_s_register(struct v4l2_subdev *sd,
const struct v4l2_dbg_register *reg)
 {
+   u8 val = reg-val  0xff;
+
switch (reg-reg  8) {
case 0:
-   io_write(sd, reg-reg  0xff, reg-val  0xff);
+   io_write(sd, reg-reg  0xff, val);
break;
case 1:
-   avlink_write(sd, reg-reg  0xff, reg-val  0xff);
+   avlink_write(sd, reg-reg  0xff, val);
break;
case 2:
-   cec_write(sd, reg-reg  0xff, reg-val  0xff);
+   cec_write(sd, reg-reg  0xff, val);
break;
case 3:
-   infoframe_write(sd, reg-reg  0xff, reg-val  0xff);
+   infoframe_write(sd, reg-reg  0xff, val);
break;
case 4:
-   esdp_write(sd, reg-reg  0xff, reg-val  0xff);
+   esdp_write(sd, reg-reg  0xff, val);
break;
case 5:
-   dpp_write(sd, reg-reg  0xff, reg-val  0xff);
+   dpp_write(sd, reg-reg  0xff, val);
break;
case 6:
-   afe_write(sd, reg-reg  0xff, reg-val  0xff);
+   afe_write(sd, reg-reg  0xff, val);
break;
case 7:
-   rep_write(sd, reg-reg  0xff, reg-val  0xff);
+   rep_write(sd, reg-reg  0xff, val);
break;
case 8:
-   edid_write(sd, reg-reg  0xff, reg-val  0xff);
+   edid_write(sd, reg-reg  0xff, val);
break;
case 9:
-   hdmi_write(sd, reg-reg  0xff, reg-val  0xff);
+   hdmi_write(sd, reg-reg  0xff, val);
break;
case 0xa:
-   test_write(sd, reg-reg  0xff, reg-val  0xff);
+   test_write(sd, reg-reg  0xff, val);
break;
case 0xb:
-   cp_write(sd, reg-reg  0xff, reg-val  0xff);
+   cp_write(sd, reg-reg  0xff, val);
break;
case 0xc:
-   vdp_write(sd, reg-reg  0xff, reg-val  0xff);
+   vdp_write(sd, reg-reg  0xff, val);
break;
default:
v4l2_info(sd, Register %03llx not supported\n, reg-reg);
-- 
1.8.4.rc3

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


[RFC PATCH 05/15] adv7604: Receive CEA formats as RGB on VGA (RGB) input

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

If the input is ADV7604_INPUT_VGA_RGB and RGB quantization range is
set to V4L2_DV_RGB_RANGE_AUTO, video with CEA timings will be
received as RGB. For ADV7604_INPUT_VGA_COMP, automatic CSC mode
will be selected.

See table 44 on page 205 in ADV7604 Hardware Manual, Rev. F, August 2010
for details.

Signed-off-by: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7604.c | 50 ++---
 1 file changed, 33 insertions(+), 17 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 37f3994..7187378 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -911,25 +911,41 @@ static void set_rgb_quantization_range(struct v4l2_subdev 
*sd)
 {
struct adv7604_state *state = to_state(sd);
 
+   v4l2_dbg(2, debug, sd, %s: rgb_quantization_range = %d\n,
+  __func__, state-rgb_quantization_range);
+
switch (state-rgb_quantization_range) {
case V4L2_DV_RGB_RANGE_AUTO:
-   /* automatic */
-   if (is_digital_input(sd)  !(hdmi_read(sd, 0x05)  0x80)) {
-   /* receiving DVI-D signal */
-
-   /* ADV7604 selects RGB limited range regardless of
-  input format (CE/IT) in automatic mode */
-   if (state-timings.bt.standards  
V4L2_DV_BT_STD_CEA861) {
-   /* RGB limited range (16-235) */
-   io_write_and_or(sd, 0x02, 0x0f, 0x00);
-
-   } else {
-   /* RGB full range (0-255) */
-   io_write_and_or(sd, 0x02, 0x0f, 0x10);
-   }
-   } else {
-   /* receiving HDMI or analog signal, set automode */
+   if (state-selected_input == ADV7604_INPUT_VGA_RGB) {
+   /* Receiving analog RGB signal
+* Set RGB full range (0-255) */
+   io_write_and_or(sd, 0x02, 0x0f, 0x10);
+   break;
+   }
+
+   if (state-selected_input == ADV7604_INPUT_VGA_COMP) {
+   /* Receiving analog YPbPr signal
+* Set automode */
+   io_write_and_or(sd, 0x02, 0x0f, 0xf0);
+   break;
+   }
+
+   if (hdmi_read(sd, 0x05)  0x80) {
+   /* Receiving HDMI signal
+* Set automode */
io_write_and_or(sd, 0x02, 0x0f, 0xf0);
+   break;
+   }
+
+   /* Receiving DVI-D signal
+* ADV7604 selects RGB limited range regardless of
+* input format (CE/IT) in automatic mode */
+   if (state-timings.bt.standards  V4L2_DV_BT_STD_CEA861) {
+   /* RGB limited range (16-235) */
+   io_write_and_or(sd, 0x02, 0x0f, 0x00);
+   } else {
+   /* RGB full range (0-255) */
+   io_write_and_or(sd, 0x02, 0x0f, 0x10);
}
break;
case V4L2_DV_RGB_RANGE_LIMITED:
@@ -1709,7 +1725,7 @@ static int adv7604_log_status(struct v4l2_subdev *sd)
char *input_color_space_txt[16] = {
RGB limited range (16-235), RGB full range (0-255),
YCbCr Bt.601 (16-235), YCbCr Bt.709 (16-235),
-   XvYCC Bt.601, XvYCC Bt.709,
+   xvYCC Bt.601, xvYCC Bt.709,
YCbCr Bt.601 (0-255), YCbCr Bt.709 (0-255),
invalid, invalid, invalid, invalid, invalid,
invalid, invalid, automatic
-- 
1.8.4.rc3

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


[RFC PATCH 12/15] adv7604: improve HDMI audio handling

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

- Mute audio before switching inputs to avoid noise/pops
- Mute audio if audio FIFO over-/underflows (AD Recommended setting)
- Reset FIFO if it over-/underflows (AD Recommended setting)

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

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 50f0279..cbeda0f 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1387,14 +1387,12 @@ static void enable_input(struct v4l2_subdev *sd)
struct adv7604_state *state = to_state(sd);
 
if (is_analog_input(sd)) {
-   /* enable */
io_write(sd, 0x15, 0xb0);   /* Disable Tristate of Pins (no 
audio) */
} else if (is_digital_input(sd)) {
-   /* enable */
hdmi_write_and_or(sd, 0x00, 0xfc, state-selected_input);
-   hdmi_write(sd, 0x1a, 0x0a); /* Unmute audio */
hdmi_write(sd, 0x01, 0x00); /* Enable HDMI clock terminators */
io_write(sd, 0x15, 0xa0);   /* Disable Tristate of Pins */
+   hdmi_write_and_or(sd, 0x1a, 0xef, 0x00); /* Unmute audio */
} else {
v4l2_dbg(2, debug, sd, %s: Unknown port %d selected\n,
__func__, state-selected_input);
@@ -1403,9 +1401,9 @@ static void enable_input(struct v4l2_subdev *sd)
 
 static void disable_input(struct v4l2_subdev *sd)
 {
-   /* disable */
+   hdmi_write_and_or(sd, 0x1a, 0xef, 0x10); /* Mute audio */
+   msleep(16); /* 512 samples with = 32 kHz sample rate [REF_03, c. 
7.16.10] */
io_write(sd, 0x15, 0xbe);   /* Tristate all outputs from video core */
-   hdmi_write(sd, 0x1a, 0x1a); /* Mute audio */
hdmi_write(sd, 0x01, 0x78); /* Disable HDMI clock terminators */
 }
 
@@ -2044,6 +2042,11 @@ static int adv7604_core_init(struct v4l2_subdev *sd)
cp_write(sd, 0xc9, 0x2d); /* use prim_mode and vid_std as free run 
resolution
 for digital formats */
 
+   /* HDMI audio */
+   hdmi_write_and_or(sd, 0x15, 0xfc, 0x03); /* Mute on FIFO 
over-/underflow [REF_01, c. 1.2.18] */
+   hdmi_write_and_or(sd, 0x1a, 0xf1, 0x08); /* Wait 1 s before unmute */
+   hdmi_write_and_or(sd, 0x68, 0xf9, 0x06); /* FIFO reset on 
over-/underflow [REF_01, c. 1.2.19] */
+
/* TODO from platform data */
afe_write(sd, 0xb5, 0x01);  /* Setting MCLK to 256Fs */
 
-- 
1.8.4.rc3

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


[RFC PATCH 00/15] adv7604: fixes

2013-12-10 Thread Hans Verkuil
This patch series updates the adv7604 driver with the latest fixes
from our internal tree.

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 06/15] adv7604: select YPbPr if RGB_RANGE_FULL/LIMITED is set for VGA_COMP inputs

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

Signed-off-by: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7604.c | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 7187378..b53373b 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -949,17 +949,26 @@ static void set_rgb_quantization_range(struct v4l2_subdev 
*sd)
}
break;
case V4L2_DV_RGB_RANGE_LIMITED:
-   /* RGB limited range (16-235) */
-   io_write_and_or(sd, 0x02, 0x0f, 0x00);
+   if (state-selected_input == ADV7604_INPUT_VGA_COMP) {
+   /* YCrCb limited range (16-235) */
+   io_write_and_or(sd, 0x02, 0x0f, 0x20);
+   } else {
+   /* RGB limited range (16-235) */
+   io_write_and_or(sd, 0x02, 0x0f, 0x00);
+   }
break;
case V4L2_DV_RGB_RANGE_FULL:
-   /* RGB full range (0-255) */
-   io_write_and_or(sd, 0x02, 0x0f, 0x10);
+   if (state-selected_input == ADV7604_INPUT_VGA_COMP) {
+   /* YCrCb full range (0-255) */
+   io_write_and_or(sd, 0x02, 0x0f, 0x60);
+   } else {
+   /* RGB full range (0-255) */
+   io_write_and_or(sd, 0x02, 0x0f, 0x10);
+   }
break;
}
 }
 
-
 static int adv7604_s_ctrl(struct v4l2_ctrl *ctrl)
 {
struct v4l2_subdev *sd = to_sd(ctrl);
-- 
1.8.4.rc3

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


[RFC PATCH 07/15] adv7604: set CEC address (SPA) in EDID

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

Signed-off-by: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7604.c | 83 ++---
 1 file changed, 70 insertions(+), 13 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index b53373b..5e40a60 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -72,6 +72,7 @@ struct adv7604_state {
u32 present;
unsigned blocks;
} edid;
+   u16 spa_port_a;
struct v4l2_fract aspect_ratio;
u32 rgb_quantization_range;
struct workqueue_struct *work_queues;
@@ -531,9 +532,6 @@ static inline int edid_write_block(struct v4l2_subdev *sd,
 
v4l2_dbg(2, debug, sd, %s: write EDID block (%d byte)\n, __func__, 
len);
 
-   /* Disables I2C access to internal EDID ram from DDC port */
-   rep_write_and_or(sd, 0x77, 0xf0, 0x0);
-
for (i = 0; !err  i  len; i += I2C_SMBUS_BLOCK_MAX)
err = adv_smbus_write_i2c_block_data(state-i2c_edid, i,
I2C_SMBUS_BLOCK_MAX, val + i);
@@ -1623,9 +1621,39 @@ static int adv7604_get_edid(struct v4l2_subdev *sd, 
struct v4l2_subdev_edid *edi
return 0;
 }
 
+static int get_edid_spa_location(struct v4l2_subdev *sd, const u8 *edid)
+{
+   u8 d;
+
+   if ((edid[0x7e] != 1) ||
+   (edid[0x80] != 0x02) ||
+   (edid[0x81] != 0x03)) {
+   return -1;
+   }
+
+   /* search Vendor Specific Data Block (tag 3) */
+   d = edid[0x82]  0x7f;
+   if (d  4) {
+   int i = 0x84;
+   int end = 0x80 + d;
+
+   do {
+   u8 tag = edid[i]  5;
+   u8 len = edid[i]  0x1f;
+
+   if ((tag == 3)  (len = 5))
+   return i + 4;
+   i += len + 1;
+   } while (i  end);
+   }
+   return -1;
+}
+
 static int adv7604_set_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid 
*edid)
 {
struct adv7604_state *state = to_state(sd);
+   int spa_loc = get_edid_spa_location(sd, edid-edid);
+   int tmp = 0;
int err;
 
if (edid-pad  ADV7604_EDID_PORT_D)
@@ -1633,16 +1661,20 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, 
struct v4l2_subdev_edid *edi
if (edid-start_block != 0)
return -EINVAL;
if (edid-blocks == 0) {
-   /* Pull down the hotplug pin */
+   /* Disable hotplug and I2C access to EDID RAM from DDC port */
state-edid.present = ~(1  edid-pad);
v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void 
*)state-edid.present);
-   /* Disables I2C access to internal EDID ram from DDC port */
-   rep_write_and_or(sd, 0x77, 0xf0, 0x0);
-   state-edid.blocks = 0;
+   rep_write_and_or(sd, 0x77, 0xf0, state-edid.present);
+
/* Fall back to a 16:9 aspect ratio */
state-aspect_ratio.numerator = 16;
state-aspect_ratio.denominator = 9;
-   v4l2_dbg(2, debug, sd, %s: clear edid\n, __func__);
+
+   if (!state-edid.present)
+   state-edid.blocks = 0;
+
+   v4l2_dbg(2, debug, sd, %s: clear EDID pad %d, edid.present = 
0x%x\n,
+   __func__, edid-pad, state-edid.present);
return 0;
}
if (edid-blocks  2) {
@@ -1652,19 +1684,45 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, 
struct v4l2_subdev_edid *edi
if (!edid-edid)
return -EINVAL;
 
+   /* Disable hotplug and I2C access to EDID RAM from DDC port */
cancel_delayed_work_sync(state-delayed_work_enable_hotplug);
-   state-edid.present = ~(1  edid-pad);
-   v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)state-edid.present);
+   v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)tmp);
+   rep_write_and_or(sd, 0x77, 0xf0, 0x00);
+
+   v4l2_dbg(2, debug, sd, %s: write EDID pad %d, edid.present = 0x%x\n,
+   __func__, edid-pad, state-edid.present);
+   switch (edid-pad) {
+   case ADV7604_EDID_PORT_A:
+   state-spa_port_a = edid-edid[spa_loc];
+   break;
+   case ADV7604_EDID_PORT_B:
+   rep_write(sd, 0x70, (spa_loc  0) ? 0 : edid-edid[spa_loc]);
+   rep_write(sd, 0x71, (spa_loc  0) ? 0 : edid-edid[spa_loc + 
1]);
+   break;
+   case ADV7604_EDID_PORT_C:
+   rep_write(sd, 0x72, (spa_loc  0) ? 0 : edid-edid[spa_loc]);
+   rep_write(sd, 0x73, (spa_loc  0) ? 0 : edid-edid[spa_loc + 
1]);
+   break;
+   case ADV7604_EDID_PORT_D:
+   rep_write(sd, 0x74, (spa_loc  0) ? 0 : edid-edid[spa_loc]);
+   rep_write(sd, 0x75, (spa_loc  0) ? 0 

[RFC PATCH 02/15] adv7604: add hdmi driver strength adjustment

2013-12-10 Thread Hans Verkuil
From: Mikhail Khelik mkhe...@cisco.com

The driver strength is board dependent, so set it from the platform_data.

Signed-off-by: Mikhail Khelik mkhe...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7604.c | 7 ++-
 include/media/adv7604.h | 5 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 6372d31..99734b2 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1942,7 +1942,12 @@ static int adv7604_core_init(struct v4l2_subdev *sd)
/* TODO from platform data */
cp_write(sd, 0x69, 0x30);   /* Enable CP CSC */
io_write(sd, 0x06, 0xa6);   /* positive VS and HS */
-   io_write(sd, 0x14, 0x7f);   /* Drive strength adjusted to max */
+
+   /* Adjust drive strength */
+   io_write(sd, 0x14, 0x40 | pdata-dr_str  4 |
+   pdata-dr_str_clk  2 |
+   pdata-dr_str_sync);
+
cp_write(sd, 0xba, (pdata-hdmi_free_run_mode  1) | 0x01); /* HDMI 
free run */
cp_write(sd, 0xf3, 0xdc); /* Low threshold to enter/exit free run mode 
*/
cp_write(sd, 0xf9, 0x23); /*  STDI ch. 1 - LCVS change threshold -
diff --git a/include/media/adv7604.h b/include/media/adv7604.h
index 0c96e16..0e13d1b 100644
--- a/include/media/adv7604.h
+++ b/include/media/adv7604.h
@@ -110,6 +110,11 @@ struct adv7604_platform_data {
unsigned replicate_av_codes:1;
unsigned invert_cbcr:1;
 
+   /* IO register 0x14 */
+   unsigned dr_str:2;
+   unsigned dr_str_clk:2;
+   unsigned dr_str_sync:2;
+
/* IO register 0x30 */
unsigned output_bus_lsb_to_msb:1;
 
-- 
1.8.4.rc3

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


[RFC PATCH 10/15] adv7604: return immediately if the new input is equal to what is configured

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

Signed-off-by: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7604.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 7d95a28..fa98229 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1479,7 +1479,11 @@ static int adv7604_s_routing(struct v4l2_subdev *sd,
 {
struct adv7604_state *state = to_state(sd);
 
-   v4l2_dbg(2, debug, sd, %s: input %d, __func__, input);
+   v4l2_dbg(2, debug, sd, %s: input %d, selected input %d,
+   __func__, input, state-selected_input);
+
+   if (input == state-selected_input)
+   return 0;
 
state-selected_input = input;
 
@@ -1524,6 +1528,8 @@ static int adv7604_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
u8 fmt_change, fmt_change_digital, tx_5v;
u32 input_status;
 
+   v4l2_dbg(2, debug, sd, %s: , __func__);
+
/* format change */
fmt_change = io_read(sd, 0x43)  0x98;
if (fmt_change)
@@ -2124,6 +2130,7 @@ static int adv7604_probe(struct i2c_client *client,
/* initialize variables */
state-restart_stdi_once = true;
state-prev_input_status = ~0;
+   state-selected_input = ~0;
 
/* platform data */
if (!pdata) {
-- 
1.8.4.rc3

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


[RFC PATCH 09/15] adv7604: remove connector type. Never used for anything useful.

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

May also be wrong if the receiver is connected to more than one connector.

Signed-off-by: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7604.c | 4 
 include/media/adv7604.h | 3 ---
 2 files changed, 7 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 4ce3815..7d95a28 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -77,7 +77,6 @@ struct adv7604_state {
u32 rgb_quantization_range;
struct workqueue_struct *work_queues;
struct delayed_work delayed_work_enable_hotplug;
-   bool connector_hdmi;
bool restart_stdi_once;
u32 prev_input_status;
 
@@ -1817,8 +1816,6 @@ static int adv7604_log_status(struct v4l2_subdev *sd)
 
v4l2_info(sd, -Chip status-\n);
v4l2_info(sd, Chip power: %s\n, no_power(sd) ? off : on);
-   v4l2_info(sd, Connector type: %s\n, state-connector_hdmi ?
-   HDMI : (is_digital_input(sd) ? DVI-D : DVI-A));
v4l2_info(sd, EDID enabled port A: %s, B: %s, C: %s, D: %s\n,
((rep_read(sd, 0x7d)  0x01) ? Yes : No),
((rep_read(sd, 0x7d)  0x02) ? Yes : No),
@@ -2138,7 +2135,6 @@ static int adv7604_probe(struct i2c_client *client,
sd = state-sd;
v4l2_i2c_subdev_init(sd, client, adv7604_ops);
sd-flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-   state-connector_hdmi = pdata-connector_hdmi;
 
/* i2c access to adv7604? */
if (adv_smbus_read_byte_data_check(client, 0xfb, false) != 0x68) {
diff --git a/include/media/adv7604.h b/include/media/adv7604.h
index 0e13d1b..0162c31 100644
--- a/include/media/adv7604.h
+++ b/include/media/adv7604.h
@@ -80,9 +80,6 @@ enum adv7604_op_format_sel {
 
 /* Platform dependent definition */
 struct adv7604_platform_data {
-   /* connector - HDMI or DVI? */
-   unsigned connector_hdmi:1;
-
/* DIS_PWRDNB: 1 if the PWRDNB pin is unused and unconnected */
unsigned disable_pwrdnb:1;
 
-- 
1.8.4.rc3

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


[RFC PATCH 15/15] adv7604: Enable HDMI_MODE interrupt

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

Some sources are initially detected as DVI, and change to HDMI later.
This must be detected to set the right RGB quantization range.

Signed-off-by: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7604.c | 34 +-
 1 file changed, 25 insertions(+), 9 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index c195a92..cfeaaaf 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1602,18 +1602,25 @@ static int adv7604_g_mbus_fmt(struct v4l2_subdev *sd,
 
 static int adv7604_isr(struct v4l2_subdev *sd, u32 status, bool *handled)
 {
-   u8 fmt_change, fmt_change_digital, tx_5v;
+   const u8 irq_reg_0x43 = io_read(sd, 0x43);
+   const u8 irq_reg_0x6b = io_read(sd, 0x6b);
+   const u8 irq_reg_0x70 = io_read(sd, 0x70);
+   u8 fmt_change_digital;
+   u8 fmt_change;
+   u8 tx_5v;
+
+   if (irq_reg_0x43)
+   io_write(sd, 0x44, irq_reg_0x43);
+   if (irq_reg_0x70)
+   io_write(sd, 0x71, irq_reg_0x70);
+   if (irq_reg_0x6b)
+   io_write(sd, 0x6c, irq_reg_0x6b);
 
v4l2_dbg(2, debug, sd, %s: , __func__);
 
/* format change */
-   fmt_change = io_read(sd, 0x43)  0x98;
-   if (fmt_change)
-   io_write(sd, 0x44, fmt_change);
-
-   fmt_change_digital = is_digital_input(sd) ? (io_read(sd, 0x6b)  0xc0) 
: 0;
-   if (fmt_change_digital)
-   io_write(sd, 0x6c, fmt_change_digital);
+   fmt_change = irq_reg_0x43  0x98;
+   fmt_change_digital = is_digital_input(sd) ? (irq_reg_0x6b  0xc0) : 0;
 
if (fmt_change || fmt_change_digital) {
v4l2_dbg(1, debug, sd,
@@ -1625,6 +1632,15 @@ static int adv7604_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
if (handled)
*handled = true;
}
+   /* HDMI/DVI mode */
+   if (irq_reg_0x6b  0x01) {
+   v4l2_dbg(1, debug, sd, %s: irq %s mode\n, __func__,
+   (io_read(sd, 0x6a)  0x01) ? HDMI : DVI);
+   set_rgb_quantization_range(sd);
+   if (handled)
+   *handled = true;
+   }
+
/* tx 5v detect */
tx_5v = io_read(sd, 0x70)  0x1e;
if (tx_5v) {
@@ -2138,7 +2154,7 @@ static int adv7604_core_init(struct v4l2_subdev *sd)
io_write(sd, 0x40, 0xc2); /* Configure INT1 */
io_write(sd, 0x41, 0xd7); /* STDI irq for any change, disable INT2 */
io_write(sd, 0x46, 0x98); /* Enable SSPD, STDI and CP unlocked 
interrupts */
-   io_write(sd, 0x6e, 0xc0); /* Enable V_LOCKED and DE_REGEN_LCK 
interrupts */
+   io_write(sd, 0x6e, 0xc1); /* Enable V_LOCKED, DE_REGEN_LCK, HDMI_MODE 
interrupts */
io_write(sd, 0x73, 0x1e); /* Enable CABLE_DET_A_ST (+5v) interrupts */
 
return v4l2_ctrl_handler_setup(sd-ctrl_handler);
-- 
1.8.4.rc3

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


[RFC PATCH 08/15] adv7604: improve EDID handling

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

- split edid_write_block()
- do not use edid-edid before the validity check
- Return -EINVAL if edid-pad is invalid
- Save both registers for SPA port A
- Set SPA location to default value if it is not found

Signed-off-by: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7604.c | 94 -
 1 file changed, 50 insertions(+), 44 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 5e40a60..4ce3815 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -72,7 +72,7 @@ struct adv7604_state {
u32 present;
unsigned blocks;
} edid;
-   u16 spa_port_a;
+   u16 spa_port_a[2];
struct v4l2_fract aspect_ratio;
u32 rgb_quantization_range;
struct workqueue_struct *work_queues;
@@ -510,22 +510,9 @@ static inline int edid_read_block(struct v4l2_subdev *sd, 
unsigned len, u8 *val)
return 0;
 }
 
-static void adv7604_delayed_work_enable_hotplug(struct work_struct *work)
-{
-   struct delayed_work *dwork = to_delayed_work(work);
-   struct adv7604_state *state = container_of(dwork, struct adv7604_state,
-   delayed_work_enable_hotplug);
-   struct v4l2_subdev *sd = state-sd;
-
-   v4l2_dbg(2, debug, sd, %s: enable hotplug\n, __func__);
-
-   v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)state-edid.present);
-}
-
 static inline int edid_write_block(struct v4l2_subdev *sd,
unsigned len, const u8 *val)
 {
-   struct i2c_client *client = v4l2_get_subdevdata(sd);
struct adv7604_state *state = to_state(sd);
int err = 0;
int i;
@@ -535,24 +522,19 @@ static inline int edid_write_block(struct v4l2_subdev *sd,
for (i = 0; !err  i  len; i += I2C_SMBUS_BLOCK_MAX)
err = adv_smbus_write_i2c_block_data(state-i2c_edid, i,
I2C_SMBUS_BLOCK_MAX, val + i);
-   if (err)
-   return err;
+   return err;
+}
 
-   /* adv7604 calculates the checksums and enables I2C access to internal
-  EDID RAM from DDC port. */
-   rep_write_and_or(sd, 0x77, 0xf0, state-edid.present);
+static void adv7604_delayed_work_enable_hotplug(struct work_struct *work)
+{
+   struct delayed_work *dwork = to_delayed_work(work);
+   struct adv7604_state *state = container_of(dwork, struct adv7604_state,
+   delayed_work_enable_hotplug);
+   struct v4l2_subdev *sd = state-sd;
 
-   for (i = 0; i  1000; i++) {
-   if (rep_read(sd, 0x7d)  state-edid.present)
-   break;
-   mdelay(1);
-   }
-   if (i == 1000) {
-   v4l_err(client, error enabling edid (0x%x)\n, 
state-edid.present);
-   return -EIO;
-   }
+   v4l2_dbg(2, debug, sd, %s: enable hotplug\n, __func__);
 
-   return 0;
+   v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)state-edid.present);
 }
 
 static inline int hdmi_read(struct v4l2_subdev *sd, u8 reg)
@@ -1621,7 +1603,7 @@ static int adv7604_get_edid(struct v4l2_subdev *sd, 
struct v4l2_subdev_edid *edi
return 0;
 }
 
-static int get_edid_spa_location(struct v4l2_subdev *sd, const u8 *edid)
+static int get_edid_spa_location(const u8 *edid)
 {
u8 d;
 
@@ -1652,9 +1634,10 @@ static int get_edid_spa_location(struct v4l2_subdev *sd, 
const u8 *edid)
 static int adv7604_set_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid 
*edid)
 {
struct adv7604_state *state = to_state(sd);
-   int spa_loc = get_edid_spa_location(sd, edid-edid);
+   int spa_loc;
int tmp = 0;
int err;
+   int i;
 
if (edid-pad  ADV7604_EDID_PORT_D)
return -EINVAL;
@@ -1684,35 +1667,43 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, 
struct v4l2_subdev_edid *edi
if (!edid-edid)
return -EINVAL;
 
+   v4l2_dbg(2, debug, sd, %s: write EDID pad %d, edid.present = 0x%x\n,
+   __func__, edid-pad, state-edid.present);
+
/* Disable hotplug and I2C access to EDID RAM from DDC port */
cancel_delayed_work_sync(state-delayed_work_enable_hotplug);
v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)tmp);
rep_write_and_or(sd, 0x77, 0xf0, 0x00);
 
-   v4l2_dbg(2, debug, sd, %s: write EDID pad %d, edid.present = 0x%x\n,
-   __func__, edid-pad, state-edid.present);
+   spa_loc = get_edid_spa_location(edid-edid);
+   if (spa_loc  0)
+   spa_loc = 0xc0; /* Default value [REF_02, p. 116] */
+
switch (edid-pad) {
case ADV7604_EDID_PORT_A:
-   state-spa_port_a = edid-edid[spa_loc];
+   state-spa_port_a[0] = edid-edid[spa_loc];
+

[RFC PATCH 03/15] adv7604: support 1366x768 DMT Reduced Blanking

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7604.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 99734b2..417468c 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -161,6 +161,7 @@ static const struct v4l2_dv_timings adv7604_timings[] = {
V4L2_DV_BT_DMT_1792X1344P60,
V4L2_DV_BT_DMT_1856X1392P60,
V4L2_DV_BT_DMT_1920X1200P60_RB,
+   V4L2_DV_BT_DMT_1366X768P60_RB,
V4L2_DV_BT_DMT_1366X768P60,
V4L2_DV_BT_DMT_1920X1080P60,
{ },
-- 
1.8.4.rc3

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


[RFC PATCH 01/15] adv7604: add support for all the digital input ports

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

The adv7604 supports four digital input ports. This patch adds support
for all of them, instead of just port A.

Signed-off-by: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7604.c | 266 ++--
 include/media/adv7604.h |  20 ++--
 2 files changed, 168 insertions(+), 118 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index a324106b..6372d31 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -53,8 +53,6 @@ MODULE_LICENSE(GPL);
 /* ADV7604 system clock frequency */
 #define ADV7604_fsc (28636360)
 
-#define DIGITAL_INPUT (state-mode == ADV7604_MODE_HDMI)
-
 /*
  **
  *
@@ -67,10 +65,13 @@ struct adv7604_state {
struct v4l2_subdev sd;
struct media_pad pad;
struct v4l2_ctrl_handler hdl;
-   enum adv7604_mode mode;
+   enum adv7604_input_port selected_input;
struct v4l2_dv_timings timings;
-   u8 edid[256];
-   unsigned edid_blocks;
+   struct {
+   u8 edid[256];
+   u32 present;
+   unsigned blocks;
+   } edid;
struct v4l2_fract aspect_ratio;
u32 rgb_quantization_range;
struct workqueue_struct *work_queues;
@@ -516,7 +517,7 @@ static void adv7604_delayed_work_enable_hotplug(struct 
work_struct *work)
 
v4l2_dbg(2, debug, sd, %s: enable hotplug\n, __func__);
 
-   v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)1);
+   v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)state-edid.present);
 }
 
 static inline int edid_write_block(struct v4l2_subdev *sd,
@@ -529,8 +530,6 @@ static inline int edid_write_block(struct v4l2_subdev *sd,
 
v4l2_dbg(2, debug, sd, %s: write EDID block (%d byte)\n, __func__, 
len);
 
-   v4l2_subdev_notify(sd, ADV7604_HOTPLUG, (void *)0);
-
/* Disables I2C access to internal EDID ram from DDC port */
rep_write_and_or(sd, 0x77, 0xf0, 0x0);
 
@@ -541,22 +540,19 @@ static inline int edid_write_block(struct v4l2_subdev *sd,
return err;
 
/* adv7604 calculates the checksums and enables I2C access to internal
-  EDID ram from DDC port. */
-   rep_write_and_or(sd, 0x77, 0xf0, 0x1);
+  EDID RAM from DDC port. */
+   rep_write_and_or(sd, 0x77, 0xf0, state-edid.present);
 
for (i = 0; i  1000; i++) {
-   if (rep_read(sd, 0x7d)  1)
+   if (rep_read(sd, 0x7d)  state-edid.present)
break;
mdelay(1);
}
if (i == 1000) {
-   v4l_err(client, error enabling edid\n);
+   v4l_err(client, error enabling edid (0x%x)\n, 
state-edid.present);
return -EIO;
}
 
-   /* enable hotplug after 100 ms */
-   queue_delayed_work(state-work_queues,
-   state-delayed_work_enable_hotplug, HZ / 10);
return 0;
 }
 
@@ -574,6 +570,11 @@ static inline int hdmi_write(struct v4l2_subdev *sd, u8 
reg, u8 val)
return adv_smbus_write_byte_data(state-i2c_hdmi, reg, val);
 }
 
+static inline int hdmi_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, 
u8 val)
+{
+   return hdmi_write(sd, reg, (hdmi_read(sd, reg)  mask) | val);
+}
+
 static inline int test_read(struct v4l2_subdev *sd, u8 reg)
 {
struct adv7604_state *state = to_state(sd);
@@ -623,6 +624,26 @@ static inline int vdp_write(struct v4l2_subdev *sd, u8 
reg, u8 val)
 
 /* --- */
 
+static inline bool is_analog_input(struct v4l2_subdev *sd)
+{
+   struct adv7604_state *state = to_state(sd);
+
+   return state-selected_input == ADV7604_INPUT_VGA_RGB ||
+  state-selected_input == ADV7604_INPUT_VGA_COMP;
+}
+
+static inline bool is_digital_input(struct v4l2_subdev *sd)
+{
+   struct adv7604_state *state = to_state(sd);
+
+   return state-selected_input == ADV7604_INPUT_HDMI_PORT_A ||
+  state-selected_input == ADV7604_INPUT_HDMI_PORT_B ||
+  state-selected_input == ADV7604_INPUT_HDMI_PORT_C ||
+  state-selected_input == ADV7604_INPUT_HDMI_PORT_D;
+}
+
+/* --- */
+
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 static void adv7604_inv_register(struct v4l2_subdev *sd)
 {
@@ -748,10 +769,13 @@ static int adv7604_s_register(struct v4l2_subdev *sd,
 static int adv7604_s_detect_tx_5v_ctrl(struct v4l2_subdev *sd)
 {
struct adv7604_state *state = to_state(sd);
+   u8 reg_io_6f = io_read(sd, 0x6f);
 
-   /* port A only */
return v4l2_ctrl_s_ctrl(state-detect_tx_5v_ctrl,
-   ((io_read(sd, 0x6f)  0x10)  4));
+   ((reg_io_6f  0x10)  4) |
+   

[RFC PATCH 14/15] adv7604: adjust gain and offset for DVI-D signals

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

If the input signal is DVI-D and quantization range is RGB full range,
gain and offset must be adjusted to get the right range on the output.

Signed-off-by: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7604.c | 98 -
 1 file changed, 89 insertions(+), 9 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 0e69b24..c195a92 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -885,12 +885,72 @@ static void configure_custom_video_timings(struct 
v4l2_subdev *sd,
cp_write(sd, 0xac, (height  0x0f)  4);
 }
 
+static void adv7604_set_offset(struct v4l2_subdev *sd, bool auto_offset, u16 
offset_a, u16 offset_b, u16 offset_c)
+{
+   struct adv7604_state *state = to_state(sd);
+   u8 offset_buf[4];
+
+   if (auto_offset) {
+   offset_a = 0x3ff;
+   offset_b = 0x3ff;
+   offset_c = 0x3ff;
+   }
+
+   v4l2_dbg(2, debug, sd, %s: %s offset: a = 0x%x, b = 0x%x, c = 0x%x\n,
+   __func__, auto_offset ? Auto : Manual,
+   offset_a, offset_b, offset_c);
+
+   offset_buf[0] = (cp_read(sd, 0x77)  0xc0) | ((offset_a  0x3f0)  4);
+   offset_buf[1] = ((offset_a  0x00f)  4) | ((offset_b  0x3c0)  6);
+   offset_buf[2] = ((offset_b  0x03f)  2) | ((offset_c  0x300)  8);
+   offset_buf[3] = offset_c  0x0ff;
+
+   /* Registers must be written in this order with no i2c access in 
between */
+   if (adv_smbus_write_i2c_block_data(state-i2c_cp, 0x77, 4, offset_buf))
+   v4l2_err(sd, %s: i2c error writing to CP reg 0x77, 0x78, 0x79, 
0x7a\n, __func__);
+}
+
+static void adv7604_set_gain(struct v4l2_subdev *sd, bool auto_gain, u16 
gain_a, u16 gain_b, u16 gain_c)
+{
+   struct adv7604_state *state = to_state(sd);
+   u8 gain_buf[4];
+   u8 gain_man = 1;
+   u8 agc_mode_man = 1;
+
+   if (auto_gain) {
+   gain_man = 0;
+   agc_mode_man = 0;
+   gain_a = 0x100;
+   gain_b = 0x100;
+   gain_c = 0x100;
+   }
+
+   v4l2_dbg(2, debug, sd, %s: %s gain: a = 0x%x, b = 0x%x, c = 0x%x\n,
+   __func__, auto_gain ? Auto : Manual,
+   gain_a, gain_b, gain_c);
+
+   gain_buf[0] = ((gain_man  7) | (agc_mode_man  6) | ((gain_a  
0x3f0)  4));
+   gain_buf[1] = (((gain_a  0x00f)  4) | ((gain_b  0x3c0)  6));
+   gain_buf[2] = (((gain_b  0x03f)  2) | ((gain_c  0x300)  8));
+   gain_buf[3] = ((gain_c  0x0ff));
+
+   /* Registers must be written in this order with no i2c access in 
between */
+   if (adv_smbus_write_i2c_block_data(state-i2c_cp, 0x73, 4, gain_buf))
+   v4l2_err(sd, %s: i2c error writing to CP reg 0x73, 0x74, 0x75, 
0x76\n, __func__);
+}
+
 static void set_rgb_quantization_range(struct v4l2_subdev *sd)
 {
struct adv7604_state *state = to_state(sd);
+   bool rgb_output = io_read(sd, 0x02)  0x02;
+   bool hdmi_signal = hdmi_read(sd, 0x05)  0x80;
+
+   v4l2_dbg(2, debug, sd, %s: RGB quantization range: %d, RGB out: %d, 
HDMI: %d\n,
+   __func__, state-rgb_quantization_range,
+   rgb_output, hdmi_signal);
 
-   v4l2_dbg(2, debug, sd, %s: rgb_quantization_range = %d\n,
-  __func__, state-rgb_quantization_range);
+   adv7604_set_gain(sd, true, 0x0, 0x0, 0x0);
+   adv7604_set_offset(sd, true, 0x0, 0x0, 0x0);
 
switch (state-rgb_quantization_range) {
case V4L2_DV_RGB_RANGE_AUTO:
@@ -908,7 +968,7 @@ static void set_rgb_quantization_range(struct v4l2_subdev 
*sd)
break;
}
 
-   if (hdmi_read(sd, 0x05)  0x80) {
+   if (hdmi_signal) {
/* Receiving HDMI signal
 * Set automode */
io_write_and_or(sd, 0x02, 0x0f, 0xf0);
@@ -924,24 +984,45 @@ static void set_rgb_quantization_range(struct v4l2_subdev 
*sd)
} else {
/* RGB full range (0-255) */
io_write_and_or(sd, 0x02, 0x0f, 0x10);
+
+   if (is_digital_input(sd)  rgb_output) {
+   adv7604_set_offset(sd, false, 0x40, 0x40, 0x40);
+   } else {
+   adv7604_set_gain(sd, false, 0xe0, 0xe0, 0xe0);
+   adv7604_set_offset(sd, false, 0x70, 0x70, 0x70);
+   }
}
break;
case V4L2_DV_RGB_RANGE_LIMITED:
if (state-selected_input == ADV7604_INPUT_VGA_COMP) {
/* YCrCb limited range (16-235) */
io_write_and_or(sd, 0x02, 0x0f, 0x20);
-   } else {
-  

[GIT PULL FOR v3.14] OMAP4 ISS fixes

2013-12-10 Thread Laurent Pinchart
Hi Mauro,

The following changes since commit 431cb350187c6bf1ed083622d633418a298a7216:

  [media] az6007: support Technisat Cablestar Combo HDCI (minus remote) 
(2013-12-10 07:15:54 -0200)

are available in the git repository at:

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

for you to fetch changes up to 049b02eb38f96cc38ade4a3424451d1db4960b28:

  v4l: omap4iss: resizer: Fix comment regarding bypass mode (2013-12-10 
14:26:28 +0100)


Laurent Pinchart (25):
  v4l: omap4iss: Replace printk by dev_err
  v4l: omap4iss: Don't split log strings on multiple lines
  v4l: omap4iss: Restrict line lengths to 80 characters where possible
  v4l: omap4iss: Remove double semicolon at end of line
  v4l: omap4iss: Define more ISS and ISP IRQ register bits
  v4l: omap4iss: isif: Define more VDINT registers
  v4l: omap4iss: Enhance IRQ debugging
  v4l: omap4iss: Don't make IRQ debugging functions inline
  v4l: omap4iss: Fix operators precedence in ternary operators
  v4l: omap4iss: isif: Ignore VD0 interrupts when no buffer is available
  v4l: omap4iss: ipipeif: Shift input data according to the input format
  v4l: omap4iss: csi2: Enable automatic ULP mode transition
  v4l: omap4iss: Create and use register access functions
  v4l: omap4iss: csi: Create and use register access functions
  v4l: omap4iss: resizer: Stop the whole resizer to avoid FIFO overflows
  v4l: omap4iss: Convert hexadecimal constants to lower case
  v4l: omap4iss: Add description field to iss_format_info structure
  v4l: omap4iss: Make __iss_video_get_format() return a v4l2_mbus_framefmt
  v4l: omap4iss: Add enum_fmt_vid_cap ioctl support
  v4l: omap4iss: Propagate stop timeouts from submodules to the driver 
core
  v4l: omap4iss: Enable/disabling the ISP interrupts globally
  v4l: omap4iss: Reset the ISS when the pipeline can't be stopped
  v4l: omap4iss: csi2: Replace manual if statement with a subclk field
  v4l: omap4iss: Cancel streaming when a fatal error occurs
  v4l: omap4iss: resizer: Fix comment regarding bypass mode

 drivers/staging/media/omap4iss/iss.c | 337 +++
 drivers/staging/media/omap4iss/iss.h |  89 ++-
 drivers/staging/media/omap4iss/iss_csi2.c| 184 ++---
 drivers/staging/media/omap4iss/iss_csi2.h|   8 +-
 drivers/staging/media/omap4iss/iss_csiphy.c  |  39 +--
 drivers/staging/media/omap4iss/iss_csiphy.h  |   6 +-
 drivers/staging/media/omap4iss/iss_ipipe.c   |  59 ++--
 drivers/staging/media/omap4iss/iss_ipipeif.c | 180 ++---
 drivers/staging/media/omap4iss/iss_regs.h| 502 +-
 drivers/staging/media/omap4iss/iss_resizer.c | 242 -
 drivers/staging/media/omap4iss/iss_video.c   | 174 +---
 drivers/staging/media/omap4iss/iss_video.h   |   8 +-
 12 files changed, 1046 insertions(+), 782 deletions(-)

-- 
Regards,

Laurent Pinchart

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


[GIT PULL FOR v3.14] MT9V032 sensor driver fixes and features

2013-12-10 Thread Laurent Pinchart
Hi Mauro,

The following changes since commit 431cb350187c6bf1ed083622d633418a298a7216:

  [media] az6007: support Technisat Cablestar Combo HDCI (minus remote) 
(2013-12-10 07:15:54 -0200)

are available in the git repository at:

  git://linuxtv.org/pinchartl/media.git sensors/mt9v034

for you to fetch changes up to eea7b9b80c2495491791ca3a0577e64d25ca5f1a:

  mt9v032: Add support for the MT9V034 (2013-12-10 14:40:10 +0100)


Laurent Pinchart (6):
  mt9v032: Remove unused macro
  mt9v032: Fix pixel array size
  mt9v032: Fix binning configuration
  mt9v032: Add support for monochrome models
  mt9v032: Add support for model-specific parameters
  mt9v032: Add support for the MT9V034

 drivers/media/i2c/mt9v032.c | 232 ++-
 1 file changed, 187 insertions(+), 45 deletions(-)

-- 
Regards,

Laurent Pinchart

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


[GIT PULL FOR v3.14] Miscellaneous VSP1 patches

2013-12-10 Thread Laurent Pinchart
Hi Mauro,

The following changes since commit 431cb350187c6bf1ed083622d633418a298a7216:

  [media] az6007: support Technisat Cablestar Combo HDCI (minus remote) 
(2013-12-10 07:15:54 -0200)

are available in the git repository at:

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

for you to fetch changes up to 08057ef1daf4bba618c8145b95b249a7dcc523fd:

  v4l: vsp1: Add LUT support (2013-12-10 14:44:43 +0100)


Laurent Pinchart (6):
  v4l: vsp1: Supply frames to the DU continuously
  v4l: vsp1: Add cropping support
  v4l: Add media format codes for AHSV on 32-bit busses
  v4l: vsp1: Add HST and HSI support
  v4l: vsp1: Add SRU support
  v4l: vsp1: Add LUT support

 Documentation/DocBook/media/v4l/subdev-formats.xml | 157 +
 drivers/media/platform/vsp1/Makefile   |   3 +-
 drivers/media/platform/vsp1/vsp1.h |   7 +
 drivers/media/platform/vsp1/vsp1_drv.c |  39 
 drivers/media/platform/vsp1/vsp1_entity.c  |   7 +
 drivers/media/platform/vsp1/vsp1_entity.h  |   4 +
 drivers/media/platform/vsp1/vsp1_hsit.c| 222 ++
 drivers/media/platform/vsp1/vsp1_hsit.h|  38 +++
 drivers/media/platform/vsp1/vsp1_lut.c | 252 
 drivers/media/platform/vsp1/vsp1_lut.h |  38 +++
 drivers/media/platform/vsp1/vsp1_regs.h|  16 ++
 drivers/media/platform/vsp1/vsp1_rpf.c |  34 ++-
 drivers/media/platform/vsp1/vsp1_rwpf.c|  96 
 drivers/media/platform/vsp1/vsp1_rwpf.h|  10 +
 drivers/media/platform/vsp1/vsp1_sru.c | 356 
 drivers/media/platform/vsp1/vsp1_sru.h |  41 
 drivers/media/platform/vsp1/vsp1_video.c   |  13 ++
 drivers/media/platform/vsp1/vsp1_wpf.c |  17 +-
 include/linux/platform_data/vsp1.h |   2 +
 include/uapi/linux/v4l2-mediabus.h |   3 +
 include/uapi/linux/vsp1.h  |  34 +++
 21 files changed, 1372 insertions(+), 17 deletions(-)
 create mode 100644 drivers/media/platform/vsp1/vsp1_hsit.c
 create mode 100644 drivers/media/platform/vsp1/vsp1_hsit.h
 create mode 100644 drivers/media/platform/vsp1/vsp1_lut.c
 create mode 100644 drivers/media/platform/vsp1/vsp1_lut.h
 create mode 100644 drivers/media/platform/vsp1/vsp1_sru.c
 create mode 100644 drivers/media/platform/vsp1/vsp1_sru.h
 create mode 100644 include/uapi/linux/vsp1.h

-- 
Regards,

Laurent Pinchart

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


Re: use other formats from ov3640 camera sensor through the isp pipeline

2013-12-10 Thread Laurent Pinchart
Hi Tom,

On Tuesday 10 December 2013 10:42:22 Tom wrote:
 Hello,
 
 I am using the ov3640 camera sensor along with the isp pipeline and
 configured it like: sensor-ccdc-memory
 
 My sensor supports more formats like rgb565 and so. Does anyone have an idea
 how I could manage to set these formats out of the users application? If I
 understand it right, the isp pipeline will not allow a format the ccdc sink
 pad does not know.

That's correct. The right way to fix this is to extend the OMAP3 ISP driver to 
support the formats you need on the CCDC pads.

-- 
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 2/2] staging: media: davinci_vpfe: Remove spaces before semicolons

2013-12-10 Thread Laurent Pinchart
Hi Prabhakar,

On Wednesday 30 October 2013 13:20:25 Prabhakar Lad wrote:
 On Tue, Oct 29, 2013 at 2:53 AM, Lisa Nguyen l...@xenapiadmin.com wrote:
  Remove unnecessary spaces before semicolons to meet kernel
  coding style.
  
  Signed-off-by: Lisa Nguyen l...@xenapiadmin.com
 
 Acked-by: Lad, Prabhakar prabhakar.cse...@gmail.com

Do you plan to send a pull request for these two patches ?

-- 
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 2/2] staging: media: davinci_vpfe: Remove spaces before semicolons

2013-12-10 Thread Prabhakar Lad
Hi Laurent,

On Tue, Dec 10, 2013 at 7:34 PM, Laurent Pinchart
laurent.pinch...@ideasonboard.com wrote:
 Hi Prabhakar,

 On Wednesday 30 October 2013 13:20:25 Prabhakar Lad wrote:
 On Tue, Oct 29, 2013 at 2:53 AM, Lisa Nguyen l...@xenapiadmin.com wrote:
  Remove unnecessary spaces before semicolons to meet kernel
  coding style.
 
  Signed-off-by: Lisa Nguyen l...@xenapiadmin.com

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

 Do you plan to send a pull request for these two patches ?

I had asked for a change in the first patch but Lisa never turned back :(
anyway I'll fix it and issue a pull request today to Mauro.

Thanks,
--Prabhakar Lad
--
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 2/2] staging: media: davinci_vpfe: Remove spaces before semicolons

2013-12-10 Thread Lisa Nguyen
Hi everyone,

On Tue, Dec 10, 2013 at 6:34 AM, Prabhakar Lad
prabhakar.cse...@gmail.com wrote:
 Hi Laurent,

 On Tue, Dec 10, 2013 at 7:34 PM, Laurent Pinchart
 laurent.pinch...@ideasonboard.com wrote:
 Hi Prabhakar,

 On Wednesday 30 October 2013 13:20:25 Prabhakar Lad wrote:
 On Tue, Oct 29, 2013 at 2:53 AM, Lisa Nguyen l...@xenapiadmin.com wrote:
  Remove unnecessary spaces before semicolons to meet kernel
  coding style.
 
  Signed-off-by: Lisa Nguyen l...@xenapiadmin.com

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

 Do you plan to send a pull request for these two patches ?

 I had asked for a change in the first patch but Lisa never turned back :(
 anyway I'll fix it and issue a pull request today to Mauro.

My apologies. What happened was that I originally had sent these two
patches to the staging mailing list. Greg KH advised me to send these
to Mauro and the linux-media mailing list instead. As a result, there
was a debate about the way the return statement was written in my
first patch between Greg and a fellow developer, so I wasn't sure who
to listen to. I was in the midst of changing jobs, so this didn't take
top priority.

Again, sorry, but I thank you for considering my patches.

Lisa
--
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 2/2] staging: media: davinci_vpfe: Remove spaces before semicolons

2013-12-10 Thread Prabhakar Lad
Hi Lisa,

On Tue, Dec 10, 2013 at 8:27 PM, Lisa Nguyen l...@xenapiadmin.com wrote:
 Hi everyone,

 On Tue, Dec 10, 2013 at 6:34 AM, Prabhakar Lad
 prabhakar.cse...@gmail.com wrote:
 Hi Laurent,

 On Tue, Dec 10, 2013 at 7:34 PM, Laurent Pinchart
 laurent.pinch...@ideasonboard.com wrote:
 Hi Prabhakar,

 On Wednesday 30 October 2013 13:20:25 Prabhakar Lad wrote:
 On Tue, Oct 29, 2013 at 2:53 AM, Lisa Nguyen l...@xenapiadmin.com wrote:
  Remove unnecessary spaces before semicolons to meet kernel
  coding style.
 
  Signed-off-by: Lisa Nguyen l...@xenapiadmin.com

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

 Do you plan to send a pull request for these two patches ?

 I had asked for a change in the first patch but Lisa never turned back :(
 anyway I'll fix it and issue a pull request today to Mauro.

 My apologies. What happened was that I originally had sent these two
 patches to the staging mailing list. Greg KH advised me to send these
 to Mauro and the linux-media mailing list instead. As a result, there
 was a debate about the way the return statement was written in my
 first patch between Greg and a fellow developer, so I wasn't sure who
 to listen to. I was in the midst of changing jobs, so this didn't take
 top priority.

Ok, do you plan to post it now ?

Regards,
--Prabhakar Lad
--
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 20/22] adv7842: composite sd-ram test, clear timings before setting.

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Must clear timings before setting after test to recover.

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 9f45928..8b4e369 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -2694,6 +2694,7 @@ static int adv7842_command_ram_test(struct v4l2_subdev 
*sd)
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct adv7842_state *state = to_state(sd);
struct adv7842_platform_data *pdata = client-dev.platform_data;
+   struct v4l2_dv_timings timings;
int ret = 0;
 
if (!pdata)
@@ -2724,12 +2725,16 @@ static int adv7842_command_ram_test(struct v4l2_subdev 
*sd)
 
enable_input(sd);
 
-   adv7842_s_dv_timings(sd, state-timings);
-
edid_write_vga_segment(sd);
edid_write_hdmi_segment(sd, ADV7842_EDID_PORT_A);
edid_write_hdmi_segment(sd, ADV7842_EDID_PORT_B);
 
+   timings = state-timings;
+
+   memset(state-timings, 0, sizeof(struct v4l2_dv_timings));
+
+   adv7842_s_dv_timings(sd, timings);
+
return ret;
 }
 
-- 
1.8.4.rc3

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


[RFC PATCH 00/22] adv7842: fixes

2013-12-10 Thread Hans Verkuil
This patch series updates the adv7842 driver with the latest fixes
from our internal tree.

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 02/22] adv7842: corrected setting of cp-register 0x91 and 0x8f.

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Bit 6 of register 0x8f was cleared incorrectly (must be 1), and bit 4
of register 0x91 was set incorrectly (must be 0).

These bits are undocumented, so we shouldn't modify them to values different
from what the datasheet specifies.

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

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 22fa4ca..6434a93 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -927,7 +927,7 @@ static int configure_predefined_video_timings(struct 
v4l2_subdev *sd,
cp_write(sd, 0x27, 0x00);
cp_write(sd, 0x28, 0x00);
cp_write(sd, 0x29, 0x00);
-   cp_write(sd, 0x8f, 0x00);
+   cp_write(sd, 0x8f, 0x40);
cp_write(sd, 0x90, 0x00);
cp_write(sd, 0xa5, 0x00);
cp_write(sd, 0xa6, 0x00);
@@ -1408,7 +1408,7 @@ static int adv7842_s_dv_timings(struct v4l2_subdev *sd,
 
state-timings = *timings;
 
-   cp_write(sd, 0x91, bt-interlaced ? 0x50 : 0x10);
+   cp_write(sd, 0x91, bt-interlaced ? 0x40 : 0x00);
 
/* Use prim_mode and vid_std when available */
err = configure_predefined_video_timings(sd, timings);
-- 
1.8.4.rc3

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


[RFC PATCH 21/22] adv7842: obtain free-run mode from the platform_data.

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

The free-run mode can be board-specific.

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 7 ---
 include/media/adv7842.h | 7 +--
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 8b4e369..fac5c4f 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -1622,8 +1622,6 @@ static void select_input(struct v4l2_subdev *sd,
/* deinterlacer enabled and 3D comb */
sdp_write_and_or(sd, 0x12, 0xf6, 0x09);
 
-   sdp_write(sd, 0xdd, 0x08); /* free run auto */
-
break;
 
case ADV7842_MODE_COMP:
@@ -2536,7 +2534,10 @@ static int adv7842_core_init(struct v4l2_subdev *sd)
pdata-drive_strength.sync);
 
/* HDMI free run */
-   cp_write(sd, 0xba, (pdata-hdmi_free_run_mode  1) | 0x01);
+   cp_write_and_or(sd, 0xba, 0xfc, pdata-hdmi_free_run  0x03);
+
+   /* SPD free run */
+   sdp_write_and_or(sd, 0xdd, 0xf0, pdata-sdp_free_run  0x0f);
 
/* TODO from platform data */
cp_write(sd, 0x69, 0x14);   /* Enable CP CSC */
diff --git a/include/media/adv7842.h b/include/media/adv7842.h
index a4851bf..4e36496 100644
--- a/include/media/adv7842.h
+++ b/include/media/adv7842.h
@@ -192,8 +192,11 @@ struct adv7842_platform_data {
unsigned sd_ram_size; /* ram size in MB */
unsigned sd_ram_ddr:1; /* ddr or sdr sdram */
 
-   /* Free run */
-   unsigned hdmi_free_run_mode;
+   /* HDMI free run, CP-reg 0xBA */
+   unsigned hdmi_free_run;
+
+   /* SDP free run, CP-reg 0xDD */
+   unsigned sdp_free_run;
 
struct adv7842_sdp_csc_coeff sdp_csc_coeff;
 
-- 
1.8.4.rc3

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


[RFC PATCH 03/22] adv7842: properly enable/disable the irqs.

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

The method of disabling the irq-output pin caused many empty
interrupts. Instead, actually disable/enable the interrupts by
changing the interrupt masks.

Also enable STORE_MASKED_IRQ in INT1 configuration.

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 6434a93..cbbfa77 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -1786,10 +1786,8 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
struct adv7842_state *state = to_state(sd);
u8 fmt_change_cp, fmt_change_digital, fmt_change_sdp;
u8 irq_status[5];
-   u8 irq_cfg = io_read(sd, 0x40);
 
-   /* disable irq-pin output */
-   io_write(sd, 0x40, irq_cfg | 0x3);
+   adv7842_irq_enable(sd, false);
 
/* read status */
irq_status[0] = io_read(sd, 0x43);
@@ -1810,6 +1808,8 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
if (irq_status[4])
io_write(sd, 0x9e, irq_status[4]);
 
+   adv7842_irq_enable(sd, true);
+
v4l2_dbg(1, debug, sd, %s: irq %x, %x, %x, %x, %x\n, __func__,
 irq_status[0], irq_status[1], irq_status[2],
 irq_status[3], irq_status[4]);
@@ -1845,9 +1845,6 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
if (handled)
*handled = true;
 
-   /* re-enable irq-pin output */
-   io_write(sd, 0x40, irq_cfg);
-
return 0;
 }
 
@@ -2446,7 +2443,7 @@ static int adv7842_core_init(struct v4l2_subdev *sd,
io_write(sd, 0x33, 0x40);
 
/* interrupts */
-   io_write(sd, 0x40, 0xe2); /* Configure INT1 */
+   io_write(sd, 0x40, 0xf2); /* Configure INT1 */
 
adv7842_irq_enable(sd, true);
 
-- 
1.8.4.rc3

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


[RFC PATCH 13/22] adv7842: Use defines to select EDID port

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

Signed-off-by: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 77 -
 include/media/adv7842.h |  4 +++
 2 files changed, 38 insertions(+), 43 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 8e75c3b..77b1696 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -22,8 +22,8 @@
  * References (c = chapter, p = page):
  * REF_01 - Analog devices, ADV7842, Register Settings Recommendations,
  * Revision 2.5, June 2010
- * REF_02 - Analog devices, Register map documentation, Documentation of
- * the register maps, Software manual, Rev. F, June 2010
+ * REF_02 - Analog devices, Software User Guide, UG-206,
+ * ADV7842 I2C Register Maps, Rev. 0, November 2010
  */
 
 
@@ -587,10 +587,10 @@ static void adv7842_delayed_work_enable_hotplug(struct 
work_struct *work)
v4l2_dbg(2, debug, sd, %s: enable hotplug on ports: 0x%x\n,
__func__, present);
 
-   if (present  0x1)
-   mask |= 0x20; /* port A */
-   if (present  0x2)
-   mask |= 0x10; /* port B */
+   if (present  (0x04  ADV7842_EDID_PORT_A))
+   mask |= 0x20;
+   if (present  (0x04  ADV7842_EDID_PORT_B))
+   mask |= 0x10;
io_write_and_or(sd, 0x20, 0xcf, mask);
 }
 
@@ -679,14 +679,12 @@ static int edid_write_hdmi_segment(struct v4l2_subdev 
*sd, u8 port)
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct adv7842_state *state = to_state(sd);
const u8 *val = state-hdmi_edid.edid;
-   u8 cur_mask = rep_read(sd, 0x77)  0x0c;
-   u8 mask = port == 0 ? 0x4 : 0x8;
int spa_loc = edid_spa_location(val);
int err = 0;
int i;
 
-   v4l2_dbg(2, debug, sd, %s: write EDID on port %d (spa at 0x%x)\n,
-   __func__, port, spa_loc);
+   v4l2_dbg(2, debug, sd, %s: write EDID on port %c (spa at 0x%x)\n,
+   __func__, (port == ADV7842_EDID_PORT_A) ? 'A' : 'B', 
spa_loc);
 
/* HPA disable on port A and B */
io_write_and_or(sd, 0x20, 0xcf, 0x00);
@@ -703,44 +701,32 @@ static int edid_write_hdmi_segment(struct v4l2_subdev 
*sd, u8 port)
if (err)
return err;
 
-   if (spa_loc  0) {
-   if (port == 0) {
-   /* port A SPA */
-   rep_write(sd, 0x72, val[spa_loc]);
-   rep_write(sd, 0x73, val[spa_loc + 1]);
-   } else {
-   /* port B SPA */
-   rep_write(sd, 0x74, val[spa_loc]);
-   rep_write(sd, 0x75, val[spa_loc + 1]);
-   }
-   rep_write(sd, 0x76, spa_loc);
+   if (spa_loc  0)
+   spa_loc = 0xc0; /* Default value [REF_02, p. 199] */
+
+   if (port == ADV7842_EDID_PORT_A) {
+   rep_write(sd, 0x72, val[spa_loc]);
+   rep_write(sd, 0x73, val[spa_loc + 1]);
} else {
-   /* Edid values for SPA location */
-   if (port == 0) {
-   /* port A */
-   rep_write(sd, 0x72, val[0xc0]);
-   rep_write(sd, 0x73, val[0xc1]);
-   } else {
-   /* port B */
-   rep_write(sd, 0x74, val[0xc0]);
-   rep_write(sd, 0x75, val[0xc1]);
-   }
-   rep_write(sd, 0x76, 0xc0);
+   rep_write(sd, 0x74, val[spa_loc]);
+   rep_write(sd, 0x75, val[spa_loc + 1]);
}
-   rep_write_and_or(sd, 0x77, 0xbf, 0x00);
+   rep_write(sd, 0x76, spa_loc  0xff);
+   rep_write_and_or(sd, 0x77, 0xbf, (spa_loc  2)  0x40);
 
/* Calculates the checksums and enables I2C access to internal
 * EDID ram from HDMI DDC ports
 */
-   rep_write_and_or(sd, 0x77, 0xf3, mask | cur_mask);
+   rep_write_and_or(sd, 0x77, 0xf3, state-hdmi_edid.present);
 
for (i = 0; i  1000; i++) {
-   if (rep_read(sd, 0x7d)  mask)
+   if (rep_read(sd, 0x7d)  state-hdmi_edid.present)
break;
mdelay(1);
}
if (i == 1000) {
-   v4l_err(client, error enabling edid on port %d\n, port);
+   v4l_err(client, error enabling edid on port %c\n,
+   (port == ADV7842_EDID_PORT_A) ? 'A' : 'B');
return -EIO;
}
 
@@ -1886,7 +1872,7 @@ static int adv7842_set_edid(struct v4l2_subdev *sd, 
struct v4l2_subdev_edid *e)
struct adv7842_state *state = to_state(sd);
int err = 0;
 
-   if (e-pad  2)
+   if (e-pad  ADV7842_EDID_PORT_VGA)
return -EINVAL;
if (e-start_block != 0)
return -EINVAL;
@@ 

[RFC PATCH 14/22] adv7842: mute audio before switching inputs to avoid noise/pops

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

Signed-off-by: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 23 ---
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 77b1696..943e578 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -20,10 +20,13 @@
 
 /*
  * References (c = chapter, p = page):
- * REF_01 - Analog devices, ADV7842, Register Settings Recommendations,
- * Revision 2.5, June 2010
+ * REF_01 - Analog devices, ADV7842,
+ * Register Settings Recommendations, Rev. 1.9, April 2011
  * REF_02 - Analog devices, Software User Guide, UG-206,
  * ADV7842 I2C Register Maps, Rev. 0, November 2010
+ * REF_03 - Analog devices, Hardware User Guide, UG-214,
+ * ADV7842 Fast Switching 2:1 HDMI 1.4 Receiver with 3D-Comb
+ * Decoder and Digitizer , Rev. 0, January 2011
  */
 
 
@@ -491,6 +494,11 @@ static inline int hdmi_write(struct v4l2_subdev *sd, u8 
reg, u8 val)
return adv_smbus_write_byte_data(state-i2c_hdmi, reg, val);
 }
 
+static inline int hdmi_write_and_or(struct v4l2_subdev *sd, u8 reg, u8 mask, 
u8 val)
+{
+   return hdmi_write(sd, reg, (hdmi_read(sd, reg)  mask) | val);
+}
+
 static inline int cp_read(struct v4l2_subdev *sd, u8 reg)
 {
struct adv7842_state *state = to_state(sd);
@@ -1457,14 +1465,12 @@ static void enable_input(struct v4l2_subdev *sd)
case ADV7842_MODE_SDP:
case ADV7842_MODE_COMP:
case ADV7842_MODE_RGB:
-   /* enable */
io_write(sd, 0x15, 0xb0);   /* Disable Tristate of Pins (no 
audio) */
break;
case ADV7842_MODE_HDMI:
-   /* enable */
-   hdmi_write(sd, 0x1a, 0x0a); /* Unmute audio */
hdmi_write(sd, 0x01, 0x00); /* Enable HDMI clock terminators */
io_write(sd, 0x15, 0xa0);   /* Disable Tristate of Pins */
+   hdmi_write_and_or(sd, 0x1a, 0xef, 0x00); /* Unmute audio */
break;
default:
v4l2_dbg(2, debug, sd, %s: Unknown mode %d\n,
@@ -1475,9 +1481,9 @@ static void enable_input(struct v4l2_subdev *sd)
 
 static void disable_input(struct v4l2_subdev *sd)
 {
-   /* disable */
+   hdmi_write_and_or(sd, 0x1a, 0xef, 0x10); /* Mute audio [REF_01, c. 
2.2.2] */
+   msleep(16); /* 512 samples with = 32 kHz sample rate [REF_03, c. 8.29] 
*/
io_write(sd, 0x15, 0xbe);   /* Tristate all outputs from video core */
-   hdmi_write(sd, 0x1a, 0x1a); /* Mute audio */
hdmi_write(sd, 0x01, 0x78); /* Disable HDMI clock terminators */
 }
 
@@ -2430,6 +2436,9 @@ static int adv7842_core_init(struct v4l2_subdev *sd)
pdata-replicate_av_codes  1 |
pdata-invert_cbcr  0);
 
+   /* HDMI audio */
+   hdmi_write_and_or(sd, 0x1a, 0xf1, 0x08); /* Wait 1 s before unmute */
+
/* Drive strength */
io_write_and_or(sd, 0x14, 0xc0, pdata-drive_strength.data4 |
pdata-drive_strength.clock2 |
-- 
1.8.4.rc3

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


[RFC PATCH 11/22] adv7842: increase wait time.

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Wait 5ms after main reset. The data-sheet doesn't specify the wait
after i2c-controlled reset, so using same value as after pin-controlled
reset.

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 4fa2e23..60f2320 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -533,7 +533,7 @@ static void main_reset(struct v4l2_subdev *sd)
 
adv_smbus_write_byte_no_check(client, 0xff, 0x80);
 
-   mdelay(2);
+   mdelay(5);
 }
 
 /* --- */
-- 
1.8.4.rc3

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


[RFC PATCH 01/22] adv7842: Re-worked query_dv_timings()

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

This simplified the code quite a bit.

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 112 ++--
 1 file changed, 35 insertions(+), 77 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index b154f36..22fa4ca 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -1314,6 +1314,8 @@ static int adv7842_query_dv_timings(struct v4l2_subdev 
*sd,
struct v4l2_bt_timings *bt = timings-bt;
struct stdi_readback stdi = { 0 };
 
+   v4l2_dbg(1, debug, sd, %s:\n, __func__);
+
/* SDP block */
if (state-mode == ADV7842_MODE_SDP)
return -ENODATA;
@@ -1325,92 +1327,46 @@ static int adv7842_query_dv_timings(struct v4l2_subdev 
*sd,
}
bt-interlaced = stdi.interlaced ?
V4L2_DV_INTERLACED : V4L2_DV_PROGRESSIVE;
-   bt-polarities = ((hdmi_read(sd, 0x05)  0x10) ? V4L2_DV_VSYNC_POS_POL 
: 0) |
-   ((hdmi_read(sd, 0x05)  0x20) ? V4L2_DV_HSYNC_POS_POL : 0);
-   bt-vsync = stdi.lcvs;
 
if (is_digital_input(sd)) {
-   bool lock = hdmi_read(sd, 0x04)  0x02;
-   bool interlaced = hdmi_read(sd, 0x0b)  0x20;
-   unsigned w = (hdmi_read(sd, 0x07)  0x1f) * 256 + hdmi_read(sd, 
0x08);
-   unsigned h = (hdmi_read(sd, 0x09)  0x1f) * 256 + hdmi_read(sd, 
0x0a);
-   unsigned w_total = (hdmi_read(sd, 0x1e)  0x3f) * 256 +
-   hdmi_read(sd, 0x1f);
-   unsigned h_total = ((hdmi_read(sd, 0x26)  0x3f) * 256 +
-   hdmi_read(sd, 0x27)) / 2;
-   unsigned freq = (((hdmi_read(sd, 0x51)  1) +
-   (hdmi_read(sd, 0x52)  7)) * 100) +
-   ((hdmi_read(sd, 0x52)  0x7f) * 100) / 128;
-   int i;
+   uint32_t freq;
+
+   timings-type = V4L2_DV_BT_656_1120;
+   bt-width = (hdmi_read(sd, 0x07)  0x0f) * 256 + hdmi_read(sd, 
0x08);
+   bt-height = (hdmi_read(sd, 0x09)  0x0f) * 256 + hdmi_read(sd, 
0x0a);
+   freq = (hdmi_read(sd, 0x06) * 100) +
+  ((hdmi_read(sd, 0x3b)  0x30)  4) * 25;
 
if (is_hdmi(sd)) {
/* adjust for deep color mode */
-   freq = freq * 8 / (((hdmi_read(sd, 0x0b)  0xc0)6) * 
2 + 8);
-   }
-
-   /* No lock? */
-   if (!lock) {
-   v4l2_dbg(1, debug, sd, %s: no lock on TMDS signal\n, 
__func__);
-   return -ENOLCK;
+   freq = freq * 8 / (((hdmi_read(sd, 0x0b)  0xc0)  5) 
+ 8);
}
-   /* Interlaced? */
-   if (interlaced) {
-   v4l2_dbg(1, debug, sd, %s: interlaced video not 
supported\n, __func__);
-   return -ERANGE;
-   }
-
-   for (i = 0; v4l2_dv_timings_presets[i].bt.width; i++) {
-   const struct v4l2_bt_timings *bt = 
v4l2_dv_timings_presets[i].bt;
-
-   if (!v4l2_valid_dv_timings(v4l2_dv_timings_presets[i],
-  
adv7842_get_dv_timings_cap(sd),
-  adv7842_check_dv_timings, 
NULL))
-   continue;
-   if (w_total != htotal(bt) || h_total != vtotal(bt))
-   continue;
-
-   if (w != bt-width || h != bt-height)
-   continue;
-
-   if (abs(freq - bt-pixelclock)  100)
-   continue;
-   *timings = v4l2_dv_timings_presets[i];
-   return 0;
-   }
-
-   timings-type = V4L2_DV_BT_656_1120;
-
-   bt-width = w;
-   bt-height = h;
-   bt-interlaced = (hdmi_read(sd, 0x0b)  0x20) ?
-   V4L2_DV_INTERLACED : V4L2_DV_PROGRESSIVE;
-   bt-polarities = ((hdmi_read(sd, 0x05)  0x10) ?
-   V4L2_DV_VSYNC_POS_POL : 0) | ((hdmi_read(sd, 0x05)  
0x20) ?
-   V4L2_DV_HSYNC_POS_POL : 0);
-   bt-pixelclock = (((hdmi_read(sd, 0x51)  1) +
-  (hdmi_read(sd, 0x52)  7)) * 100) +
-((hdmi_read(sd, 0x52)  0x7f) * 100) / 128;
-   bt-hfrontporch = (hdmi_read(sd, 0x20)  0x1f) * 256 +
+   bt-pixelclock = freq;
+   bt-hfrontporch = (hdmi_read(sd, 0x20)  0x03) * 256 +
hdmi_read(sd, 0x21);
-   bt-hsync = (hdmi_read(sd, 0x22)  0x1f) * 256 +
+   bt-hsync = (hdmi_read(sd, 0x22)  

[RFC PATCH 09/22] adv7842: 625/525 line standard jitter fix.

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Both the PAL and NTSC standards are interlaced where a
frame consist of two fields. Total number of lines in a frame in both systems
are an odd number so the two fields will have different length.

In the 625 line standard (PAL) the odd field of the frame is transmitted 
first,
while in the 525 standard (NTSC) the even field is transmitted first.

This adds the possibility to change output config between the fields and 
standards.

This setting will reduce the format-jitter on the signal sent by the pixelport
moving the difference between the fields to vertical front/back-porch only.

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 56 -
 include/media/adv7842.h |  3 ++-
 2 files changed, 42 insertions(+), 17 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 6335d9f..3e8d7cc 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -2343,15 +2343,55 @@ static int adv7842_querystd(struct v4l2_subdev *sd, 
v4l2_std_id *std)
return 0;
 }
 
+static void adv7842_s_sdp_io(struct v4l2_subdev *sd, struct 
adv7842_sdp_io_sync_adjustment *s)
+{
+   if (s  s-adjust) {
+   sdp_io_write(sd, 0x94, (s-hs_beg  8)  0xf);
+   sdp_io_write(sd, 0x95, s-hs_beg  0xff);
+   sdp_io_write(sd, 0x96, (s-hs_width  8)  0xf);
+   sdp_io_write(sd, 0x97, s-hs_width  0xff);
+   sdp_io_write(sd, 0x98, (s-de_beg  8)  0xf);
+   sdp_io_write(sd, 0x99, s-de_beg  0xff);
+   sdp_io_write(sd, 0x9a, (s-de_end  8)  0xf);
+   sdp_io_write(sd, 0x9b, s-de_end  0xff);
+   sdp_io_write(sd, 0xac, s-de_v_beg_o);
+   sdp_io_write(sd, 0xad, s-de_v_beg_e);
+   sdp_io_write(sd, 0xae, s-de_v_end_o);
+   sdp_io_write(sd, 0xaf, s-de_v_end_e);
+   } else {
+   /* set to default */
+   sdp_io_write(sd, 0x94, 0x00);
+   sdp_io_write(sd, 0x95, 0x00);
+   sdp_io_write(sd, 0x96, 0x00);
+   sdp_io_write(sd, 0x97, 0x20);
+   sdp_io_write(sd, 0x98, 0x00);
+   sdp_io_write(sd, 0x99, 0x00);
+   sdp_io_write(sd, 0x9a, 0x00);
+   sdp_io_write(sd, 0x9b, 0x00);
+   sdp_io_write(sd, 0xac, 0x04);
+   sdp_io_write(sd, 0xad, 0x04);
+   sdp_io_write(sd, 0xae, 0x04);
+   sdp_io_write(sd, 0xaf, 0x04);
+   }
+}
+
 static int adv7842_s_std(struct v4l2_subdev *sd, v4l2_std_id norm)
 {
struct adv7842_state *state = to_state(sd);
+   struct adv7842_platform_data *pdata = state-pdata;
 
v4l2_dbg(1, debug, sd, %s:\n, __func__);
 
if (state-mode != ADV7842_MODE_SDP)
return -ENODATA;
 
+   if (norm  V4L2_STD_625_50)
+   adv7842_s_sdp_io(sd, pdata-sdp_io_sync_625);
+   else if (norm  V4L2_STD_525_60)
+   adv7842_s_sdp_io(sd, pdata-sdp_io_sync_525);
+   else
+   adv7842_s_sdp_io(sd, NULL);
+
if (norm  V4L2_STD_ALL) {
state-norm = norm;
return 0;
@@ -2421,22 +2461,6 @@ static int adv7842_core_init(struct v4l2_subdev *sd)
 
sdp_csc_coeff(sd, pdata-sdp_csc_coeff);
 
-   if (pdata-sdp_io_sync.adjust) {
-   const struct adv7842_sdp_io_sync_adjustment *s = 
pdata-sdp_io_sync;
-   sdp_io_write(sd, 0x94, (s-hs_beg8)  0xf);
-   sdp_io_write(sd, 0x95, s-hs_beg  0xff);
-   sdp_io_write(sd, 0x96, (s-hs_width8)  0xf);
-   sdp_io_write(sd, 0x97, s-hs_width  0xff);
-   sdp_io_write(sd, 0x98, (s-de_beg8)  0xf);
-   sdp_io_write(sd, 0x99, s-de_beg  0xff);
-   sdp_io_write(sd, 0x9a, (s-de_end8)  0xf);
-   sdp_io_write(sd, 0x9b, s-de_end  0xff);
-   sdp_io_write(sd, 0xac, s-de_v_beg_o);
-   sdp_io_write(sd, 0xad, s-de_v_beg_e);
-   sdp_io_write(sd, 0xae, s-de_v_end_o);
-   sdp_io_write(sd, 0xaf, s-de_v_end_e);
-   }
-
/* todo, improve settings for sdram */
if (pdata-sd_ram_size = 128) {
sdp_write(sd, 0x12, 0x0d); /* Frame TBC,3D comb enabled */
diff --git a/include/media/adv7842.h b/include/media/adv7842.h
index f4e9d0d..5327ba3 100644
--- a/include/media/adv7842.h
+++ b/include/media/adv7842.h
@@ -197,7 +197,8 @@ struct adv7842_platform_data {
 
struct adv7842_sdp_csc_coeff sdp_csc_coeff;
 
-   struct adv7842_sdp_io_sync_adjustment sdp_io_sync;
+   struct adv7842_sdp_io_sync_adjustment sdp_io_sync_625;
+   struct adv7842_sdp_io_sync_adjustment sdp_io_sync_525;
 
/* i2c addresses */
u8 i2c_sdp_io;
-- 
1.8.4.rc3

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a 

[RFC PATCH 10/22] adv7842: set default input in platform-data

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 2 +-
 include/media/adv7842.h | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 3e8d7cc..4fa2e23 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -2802,7 +2802,7 @@ static int adv7842_probe(struct i2c_client *client,
state-connector_hdmi = pdata-connector_hdmi;
state-mode = pdata-mode;
 
-   state-hdmi_port_a = true;
+   state-hdmi_port_a = pdata-input == ADV7842_SELECT_HDMI_PORT_A;
 
/* i2c access to adv7842? */
rev = adv_smbus_read_byte_data_check(client, 0xea, false)  8 |
diff --git a/include/media/adv7842.h b/include/media/adv7842.h
index 5327ba3..c12de2d 100644
--- a/include/media/adv7842.h
+++ b/include/media/adv7842.h
@@ -160,6 +160,9 @@ struct adv7842_platform_data {
/* Default mode */
enum adv7842_mode mode;
 
+   /* Default input */
+   unsigned input;
+
/* Video standard */
enum adv7842_vid_std_select vid_std_select;
 
-- 
1.8.4.rc3

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


[RFC PATCH 16/22] adv7842: restart STDI once if format is not found.

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

The STDI block may measure wrong values, especially for lcvs and lcf.
If the driver can not find any valid timing, the STDI block is restarted
to measure the video timings again. The function will return an error,
but the restart of STDI will generate a new STDI interrupt and the format
detection process will restart.

Copied from adv7604.

Signed-off-by: Martin Bugge marbu...@cisco.com
Cc: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 49 +
 1 file changed, 41 insertions(+), 8 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index bff8314..8390b93 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -85,6 +85,7 @@ struct adv7842_state {
bool is_cea_format;
struct workqueue_struct *work_queues;
struct delayed_work delayed_work_enable_hotplug;
+   bool restart_stdi_once;
bool hdmi_port_a;
 
/* i2c clients */
@@ -1345,6 +1346,7 @@ static int adv7842_query_dv_timings(struct v4l2_subdev 
*sd,
 
/* read STDI */
if (read_stdi(sd, stdi)) {
+   state-restart_stdi_once = true;
v4l2_dbg(1, debug, sd, %s: no valid signal\n, __func__);
return -ENOLINK;
}
@@ -1355,6 +1357,7 @@ static int adv7842_query_dv_timings(struct v4l2_subdev 
*sd,
uint32_t freq;
 
timings-type = V4L2_DV_BT_656_1120;
+
bt-width = (hdmi_read(sd, 0x07)  0x0f) * 256 + hdmi_read(sd, 
0x08);
bt-height = (hdmi_read(sd, 0x09)  0x0f) * 256 + hdmi_read(sd, 
0x0a);
freq = (hdmi_read(sd, 0x06) * 100) +
@@ -1391,21 +1394,50 @@ static int adv7842_query_dv_timings(struct v4l2_subdev 
*sd,
}
adv7842_fill_optional_dv_timings_fields(sd, timings);
} else {
-   /* Interlaced? */
-   if (stdi.interlaced) {
-   v4l2_dbg(1, debug, sd, %s: interlaced video not 
supported\n, __func__);
-   return -ERANGE;
-   }
-
+   /* find format
+* Since LCVS values are inaccurate [REF_03, p. 339-340],
+* stdi2dv_timings() is called with lcvs +-1 if the first 
attempt fails.
+*/
+   if (!stdi2dv_timings(sd, stdi, timings))
+   goto found;
+   stdi.lcvs += 1;
+   v4l2_dbg(1, debug, sd, %s: lcvs + 1 = %d\n, __func__, 
stdi.lcvs);
+   if (!stdi2dv_timings(sd, stdi, timings))
+   goto found;
+   stdi.lcvs -= 2;
+   v4l2_dbg(1, debug, sd, %s: lcvs - 1 = %d\n, __func__, 
stdi.lcvs);
if (stdi2dv_timings(sd, stdi, timings)) {
+   /*
+* The STDI block may measure wrong values, especially
+* for lcvs and lcf. If the driver can not find any
+* valid timing, the STDI block is restarted to measure
+* the video timings again. The function will return an
+* error, but the restart of STDI will generate a new
+* STDI interrupt and the format detection process will
+* restart.
+*/
+   if (state-restart_stdi_once) {
+   v4l2_dbg(1, debug, sd, %s: restart STDI\n, 
__func__);
+   /* TODO restart STDI for Sync Channel 2 */
+   /* enter one-shot mode */
+   cp_write_and_or(sd, 0x86, 0xf9, 0x00);
+   /* trigger STDI restart */
+   cp_write_and_or(sd, 0x86, 0xf9, 0x04);
+   /* reset to continuous mode */
+   cp_write_and_or(sd, 0x86, 0xf9, 0x02);
+   state-restart_stdi_once = false;
+   return -ENOLINK;
+   }
v4l2_dbg(1, debug, sd, %s: format not supported\n, 
__func__);
return -ERANGE;
}
+   state-restart_stdi_once = true;
}
+found:
 
if (debug  1)
-   v4l2_print_dv_timings(sd-name, adv7842_query_dv_timings: ,
- timings, true);
+   v4l2_print_dv_timings(sd-name, adv7842_query_dv_timings:,
+   timings, true);
return 0;
 }
 
@@ -2802,6 +2834,7 @@ static int adv7842_probe(struct i2c_client *client,
state-mode = pdata-mode;
 
state-hdmi_port_a = pdata-input == ADV7842_SELECT_HDMI_PORT_A;
+   state-restart_stdi_once = true;
 
/* i2c access to adv7842? */
rev = 

[RFC PATCH 22/22] adv7842: Composite sync adjustment

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 8 
 include/media/adv7842.h | 4 
 2 files changed, 12 insertions(+)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index fac5c4f..bafe3b5 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -2437,6 +2437,10 @@ static void adv7842_s_sdp_io(struct v4l2_subdev *sd, 
struct adv7842_sdp_io_sync_
sdp_io_write(sd, 0x99, s-de_beg  0xff);
sdp_io_write(sd, 0x9a, (s-de_end  8)  0xf);
sdp_io_write(sd, 0x9b, s-de_end  0xff);
+   sdp_io_write(sd, 0xa8, s-vs_beg_o);
+   sdp_io_write(sd, 0xa9, s-vs_beg_e);
+   sdp_io_write(sd, 0xaa, s-vs_end_o);
+   sdp_io_write(sd, 0xab, s-vs_end_e);
sdp_io_write(sd, 0xac, s-de_v_beg_o);
sdp_io_write(sd, 0xad, s-de_v_beg_e);
sdp_io_write(sd, 0xae, s-de_v_end_o);
@@ -2451,6 +2455,10 @@ static void adv7842_s_sdp_io(struct v4l2_subdev *sd, 
struct adv7842_sdp_io_sync_
sdp_io_write(sd, 0x99, 0x00);
sdp_io_write(sd, 0x9a, 0x00);
sdp_io_write(sd, 0x9b, 0x00);
+   sdp_io_write(sd, 0xa8, 0x04);
+   sdp_io_write(sd, 0xa9, 0x04);
+   sdp_io_write(sd, 0xaa, 0x04);
+   sdp_io_write(sd, 0xab, 0x04);
sdp_io_write(sd, 0xac, 0x04);
sdp_io_write(sd, 0xad, 0x04);
sdp_io_write(sd, 0xae, 0x04);
diff --git a/include/media/adv7842.h b/include/media/adv7842.h
index 4e36496..8b336ab 100644
--- a/include/media/adv7842.h
+++ b/include/media/adv7842.h
@@ -131,6 +131,10 @@ struct adv7842_sdp_io_sync_adjustment {
uint16_t hs_width;
uint16_t de_beg;
uint16_t de_end;
+   uint8_t vs_beg_o;
+   uint8_t vs_beg_e;
+   uint8_t vs_end_o;
+   uint8_t vs_end_e;
uint8_t de_v_beg_o;
uint8_t de_v_beg_e;
uint8_t de_v_end_o;
-- 
1.8.4.rc3

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


[RFC PATCH 17/22] adv7842: support g_edid ioctl

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 41 +
 1 file changed, 41 insertions(+)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 8390b93..c3ac4e9 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -1908,6 +1908,46 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
return 0;
 }
 
+static int adv7842_get_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid 
*edid)
+{
+   struct adv7842_state *state = to_state(sd);
+   u8 *data = NULL;
+
+   if (edid-pad  ADV7842_EDID_PORT_VGA)
+   return -EINVAL;
+   if (edid-blocks == 0)
+   return -EINVAL;
+   if (edid-blocks  2)
+   return -EINVAL;
+   if (edid-start_block  1)
+   return -EINVAL;
+   if (edid-start_block == 1)
+   edid-blocks = 1;
+   if (!edid-edid)
+   return -EINVAL;
+
+   switch (edid-pad) {
+   case ADV7842_EDID_PORT_A:
+   case ADV7842_EDID_PORT_B:
+   if (state-hdmi_edid.present  (0x04  edid-pad))
+   data = state-hdmi_edid.edid;
+   break;
+   case ADV7842_EDID_PORT_VGA:
+   if (state-vga_edid.present)
+   data = state-vga_edid.edid;
+   break;
+   default:
+   return -EINVAL;
+   }
+   if (!data)
+   return -ENODATA;
+
+   memcpy(edid-edid,
+  data + edid-start_block * 128,
+  edid-blocks * 128);
+   return 0;
+}
+
 static int adv7842_set_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid *e)
 {
struct adv7842_state *state = to_state(sd);
@@ -2720,6 +2760,7 @@ static const struct v4l2_subdev_video_ops 
adv7842_video_ops = {
 };
 
 static const struct v4l2_subdev_pad_ops adv7842_pad_ops = {
+   .get_edid = adv7842_get_edid,
.set_edid = adv7842_set_edid,
 };
 
-- 
1.8.4.rc3

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


[RFC PATCH 15/22] adv7842: clear edid, if no edid just disable Edid-DDC access

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Signed-off-by: Martin Bugge marbu...@cisco.com
Cc: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 943e578..bff8314 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -700,6 +700,9 @@ static int edid_write_hdmi_segment(struct v4l2_subdev *sd, 
u8 port)
/* Disable I2C access to internal EDID ram from HDMI DDC ports */
rep_write_and_or(sd, 0x77, 0xf3, 0x00);
 
+   if (!state-hdmi_edid.present)
+   return 0;
+
/* edid segment pointer '0' for HDMI ports */
rep_write_and_or(sd, 0x77, 0xef, 0x00);
 
@@ -2636,8 +2639,8 @@ static int adv7842_command_ram_test(struct v4l2_subdev 
*sd)
adv7842_s_dv_timings(sd, state-timings);
 
edid_write_vga_segment(sd);
-   edid_write_hdmi_segment(sd, 0);
-   edid_write_hdmi_segment(sd, 1);
+   edid_write_hdmi_segment(sd, ADV7842_EDID_PORT_A);
+   edid_write_hdmi_segment(sd, ADV7842_EDID_PORT_B);
 
return ret;
 }
-- 
1.8.4.rc3

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


[RFC PATCH 08/22] adv7842: set defaults spa-location.

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

For edid with no Source Physical Address (spa), set
spa-location to default and use correct values from edid.

Signed-off-by: Martin Bugge marbu...@cisco.com
Cc: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 59e7ef5..6335d9f 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -716,15 +716,15 @@ static int edid_write_hdmi_segment(struct v4l2_subdev 
*sd, u8 port)
}
rep_write(sd, 0x76, spa_loc);
} else {
-   /* default register values for SPA */
+   /* Edid values for SPA location */
if (port == 0) {
-   /* port A SPA */
-   rep_write(sd, 0x72, 0);
-   rep_write(sd, 0x73, 0);
+   /* port A */
+   rep_write(sd, 0x72, val[0xc0]);
+   rep_write(sd, 0x73, val[0xc1]);
} else {
-   /* port B SPA */
-   rep_write(sd, 0x74, 0);
-   rep_write(sd, 0x75, 0);
+   /* port B */
+   rep_write(sd, 0x74, val[0xc0]);
+   rep_write(sd, 0x75, val[0xc1]);
}
rep_write(sd, 0x76, 0xc0);
}
-- 
1.8.4.rc3

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


[RFC PATCH 07/22] adv7842: Receive CEA formats as RGB on VGA (RGB) input

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

If input is ADV7842_MODE_RGB and RGB quantization range is set to
V4L2_DV_RGB_RANGE_AUTO, then video with CEA timings will be received
as RGB. For ADV7842_MODE_COMP, automatic CSC mode will be selected.

See table 48 on page 281 in ADV7842 Hardware Manual, Rev. 0, January 2011
for details.

Signed-off-by: Mats Randgaard matra...@cisco.com
Reviewed-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 52 +
 1 file changed, 34 insertions(+), 18 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 828fd23..59e7ef5 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -1034,25 +1034,41 @@ static void set_rgb_quantization_range(struct 
v4l2_subdev *sd)
 {
struct adv7842_state *state = to_state(sd);
 
+   v4l2_dbg(2, debug, sd, %s: rgb_quantization_range = %d\n,
+  __func__, state-rgb_quantization_range);
+
switch (state-rgb_quantization_range) {
case V4L2_DV_RGB_RANGE_AUTO:
-   /* automatic */
-   if (is_digital_input(sd)  !(hdmi_read(sd, 0x05)  0x80)) {
-   /* receiving DVI-D signal */
-
-   /* ADV7842 selects RGB limited range regardless of
-  input format (CE/IT) in automatic mode */
-   if (state-timings.bt.standards  
V4L2_DV_BT_STD_CEA861) {
-   /* RGB limited range (16-235) */
-   io_write_and_or(sd, 0x02, 0x0f, 0x00);
-
-   } else {
-   /* RGB full range (0-255) */
-   io_write_and_or(sd, 0x02, 0x0f, 0x10);
-   }
-   } else {
-   /* receiving HDMI or analog signal, set automode */
+   if (state-mode == ADV7842_MODE_RGB) {
+   /* Receiving analog RGB signal
+* Set RGB full range (0-255) */
+   io_write_and_or(sd, 0x02, 0x0f, 0x10);
+   break;
+   }
+
+   if (state-mode == ADV7842_MODE_COMP) {
+   /* Receiving analog YPbPr signal
+* Set automode */
io_write_and_or(sd, 0x02, 0x0f, 0xf0);
+   break;
+   }
+
+   if (hdmi_read(sd, 0x05)  0x80) {
+   /* Receiving HDMI signal
+* Set automode */
+   io_write_and_or(sd, 0x02, 0x0f, 0xf0);
+   break;
+   }
+
+   /* Receiving DVI-D signal
+* ADV7842 selects RGB limited range regardless of
+* input format (CE/IT) in automatic mode */
+   if (state-timings.bt.standards  V4L2_DV_BT_STD_CEA861) {
+   /* RGB limited range (16-235) */
+   io_write_and_or(sd, 0x02, 0x0f, 0x00);
+   } else {
+   /* RGB full range (0-255) */
+   io_write_and_or(sd, 0x02, 0x0f, 0x10);
}
break;
case V4L2_DV_RGB_RANGE_LIMITED:
@@ -1309,7 +1325,7 @@ static int adv7842_dv_timings_cap(struct v4l2_subdev *sd,
 }
 
 /* Fill the optional fields .standards and .flags in struct v4l2_dv_timings
-   if the format is listed in adv7604_timings[] */
+   if the format is listed in adv7842_timings[] */
 static void adv7842_fill_optional_dv_timings_fields(struct v4l2_subdev *sd,
struct v4l2_dv_timings *timings)
 {
@@ -2129,7 +2145,7 @@ static int adv7842_cp_log_status(struct v4l2_subdev *sd)
static const char * const input_color_space_txt[16] = {
RGB limited range (16-235), RGB full range (0-255),
YCbCr Bt.601 (16-235), YCbCr Bt.709 (16-235),
-   XvYCC Bt.601, XvYCC Bt.709,
+   xvYCC Bt.601, xvYCC Bt.709,
YCbCr Bt.601 (0-255), YCbCr Bt.709 (0-255),
invalid, invalid, invalid, invalid, invalid,
invalid, invalid, automatic
-- 
1.8.4.rc3

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


[RFC PATCH 06/22] adv7842: added DE vertical position in SDP-io-sync

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 4 
 include/media/adv7842.h | 4 
 2 files changed, 8 insertions(+)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index d350c86..828fd23 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -2415,6 +2415,10 @@ static int adv7842_core_init(struct v4l2_subdev *sd)
sdp_io_write(sd, 0x99, s-de_beg  0xff);
sdp_io_write(sd, 0x9a, (s-de_end8)  0xf);
sdp_io_write(sd, 0x9b, s-de_end  0xff);
+   sdp_io_write(sd, 0xac, s-de_v_beg_o);
+   sdp_io_write(sd, 0xad, s-de_v_beg_e);
+   sdp_io_write(sd, 0xae, s-de_v_end_o);
+   sdp_io_write(sd, 0xaf, s-de_v_end_e);
}
 
/* todo, improve settings for sdram */
diff --git a/include/media/adv7842.h b/include/media/adv7842.h
index b0cfc5f..f4e9d0d 100644
--- a/include/media/adv7842.h
+++ b/include/media/adv7842.h
@@ -131,6 +131,10 @@ struct adv7842_sdp_io_sync_adjustment {
uint16_t hs_width;
uint16_t de_beg;
uint16_t de_end;
+   uint8_t de_v_beg_o;
+   uint8_t de_v_beg_e;
+   uint8_t de_v_end_o;
+   uint8_t de_v_end_e;
 };
 
 /* Platform dependent definition */
-- 
1.8.4.rc3

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


[RFC PATCH 04/22] adv7842: save platform data in state struct

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

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

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index cbbfa77..4f93526 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -61,6 +61,7 @@ MODULE_LICENSE(GPL);
 */
 
 struct adv7842_state {
+   struct adv7842_platform_data pdata;
struct v4l2_subdev sd;
struct media_pad pad;
struct v4l2_ctrl_handler hdl;
@@ -2730,6 +2731,9 @@ static int adv7842_probe(struct i2c_client *client,
return -ENOMEM;
}
 
+   /* platform data */
+   state-pdata = *pdata;
+
sd = state-sd;
v4l2_i2c_subdev_init(sd, client, adv7842_ops);
sd-flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
@@ -2834,7 +2838,7 @@ static int adv7842_probe(struct i2c_client *client,
if (err)
goto err_work_queues;
 
-   err = adv7842_core_init(sd, pdata);
+   err = adv7842_core_init(sd);
if (err)
goto err_entity;
 
-- 
1.8.4.rc3

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


[RFC PATCH 12/22] adv7842: remove connector type. Never used for anything useful

2013-12-10 Thread Hans Verkuil
From: Mats Randgaard matra...@cisco.com

May also be wrong if the receiver is connected to more than one connector.

Signed-off-by: Mats Randgaard matra...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 4 
 include/media/adv7842.h | 3 ---
 2 files changed, 7 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 60f2320..8e75c3b 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -82,7 +82,6 @@ struct adv7842_state {
bool is_cea_format;
struct workqueue_struct *work_queues;
struct delayed_work delayed_work_enable_hotplug;
-   bool connector_hdmi;
bool hdmi_port_a;
 
/* i2c clients */
@@ -2164,8 +2163,6 @@ static int adv7842_cp_log_status(struct v4l2_subdev *sd)
 
v4l2_info(sd, -Chip status-\n);
v4l2_info(sd, Chip power: %s\n, no_power(sd) ? off : on);
-   v4l2_info(sd, Connector type: %s\n, state-connector_hdmi ?
-   HDMI : (is_digital_input(sd) ? DVI-D : DVI-A));
v4l2_info(sd, HDMI/DVI-D port selected: %s\n,
state-hdmi_port_a ? A : B);
v4l2_info(sd, EDID A %s, B %s\n,
@@ -2799,7 +2796,6 @@ static int adv7842_probe(struct i2c_client *client,
sd = state-sd;
v4l2_i2c_subdev_init(sd, client, adv7842_ops);
sd-flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
-   state-connector_hdmi = pdata-connector_hdmi;
state-mode = pdata-mode;
 
state-hdmi_port_a = pdata-input == ADV7842_SELECT_HDMI_PORT_A;
diff --git a/include/media/adv7842.h b/include/media/adv7842.h
index c12de2d..24fed11 100644
--- a/include/media/adv7842.h
+++ b/include/media/adv7842.h
@@ -139,9 +139,6 @@ struct adv7842_sdp_io_sync_adjustment {
 
 /* Platform dependent definition */
 struct adv7842_platform_data {
-   /* connector - HDMI or DVI? */
-   unsigned connector_hdmi:1;
-
/* chip reset during probe */
unsigned chip_reset:1;
 
-- 
1.8.4.rc3

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


Re: [PATCH 2/2] staging: media: davinci_vpfe: Remove spaces before semicolons

2013-12-10 Thread Lisa Nguyen
Hi Prabhakar,

On Tue, Dec 10, 2013 at 7:04 AM, Prabhakar Lad
prabhakar.cse...@gmail.com wrote:
 Hi Lisa,

 On Tue, Dec 10, 2013 at 8:27 PM, Lisa Nguyen l...@xenapiadmin.com wrote:
 Hi everyone,

 On Tue, Dec 10, 2013 at 6:34 AM, Prabhakar Lad
 prabhakar.cse...@gmail.com wrote:
 Hi Laurent,

 On Tue, Dec 10, 2013 at 7:34 PM, Laurent Pinchart
 laurent.pinch...@ideasonboard.com wrote:
 Hi Prabhakar,

 On Wednesday 30 October 2013 13:20:25 Prabhakar Lad wrote:
 On Tue, Oct 29, 2013 at 2:53 AM, Lisa Nguyen l...@xenapiadmin.com wrote:
  Remove unnecessary spaces before semicolons to meet kernel
  coding style.
 
  Signed-off-by: Lisa Nguyen l...@xenapiadmin.com

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

 Do you plan to send a pull request for these two patches ?

 I had asked for a change in the first patch but Lisa never turned back :(
 anyway I'll fix it and issue a pull request today to Mauro.

 My apologies. What happened was that I originally had sent these two
 patches to the staging mailing list. Greg KH advised me to send these
 to Mauro and the linux-media mailing list instead. As a result, there
 was a debate about the way the return statement was written in my
 first patch between Greg and a fellow developer, so I wasn't sure who
 to listen to. I was in the midst of changing jobs, so this didn't take
 top priority.

 Ok, do you plan to post it now ?

To be clear, I'd only have to update the first patch, correct?
--
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 2/2] staging: media: davinci_vpfe: Remove spaces before semicolons

2013-12-10 Thread Prabhakar Lad
Hi Lisa,

On Tue, Dec 10, 2013 at 8:38 PM, Lisa Nguyen l...@xenapiadmin.com wrote:
 Hi Prabhakar,

 On Tue, Dec 10, 2013 at 7:04 AM, Prabhakar Lad
 prabhakar.cse...@gmail.com wrote:
 Hi Lisa,

 On Tue, Dec 10, 2013 at 8:27 PM, Lisa Nguyen l...@xenapiadmin.com wrote:
 Hi everyone,

 On Tue, Dec 10, 2013 at 6:34 AM, Prabhakar Lad
 prabhakar.cse...@gmail.com wrote:
 Hi Laurent,

 On Tue, Dec 10, 2013 at 7:34 PM, Laurent Pinchart
 laurent.pinch...@ideasonboard.com wrote:
 Hi Prabhakar,

 On Wednesday 30 October 2013 13:20:25 Prabhakar Lad wrote:
 On Tue, Oct 29, 2013 at 2:53 AM, Lisa Nguyen l...@xenapiadmin.com 
 wrote:
  Remove unnecessary spaces before semicolons to meet kernel
  coding style.
 
  Signed-off-by: Lisa Nguyen l...@xenapiadmin.com

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

 Do you plan to send a pull request for these two patches ?

 I had asked for a change in the first patch but Lisa never turned back :(
 anyway I'll fix it and issue a pull request today to Mauro.

 My apologies. What happened was that I originally had sent these two
 patches to the staging mailing list. Greg KH advised me to send these
 to Mauro and the linux-media mailing list instead. As a result, there
 was a debate about the way the return statement was written in my
 first patch between Greg and a fellow developer, so I wasn't sure who
 to listen to. I was in the midst of changing jobs, so this didn't take
 top priority.

 Ok, do you plan to post it now ?

 To be clear, I'd only have to update the first patch, correct?

Yes!

Regards,
--Prabhakar Lad
--
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 18/22] adv7842: i2c dummy clients registration.

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Clear i2c_clients ptr when unregistered.
Warn if configured i2c-addr is zero.

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 83 ++---
 1 file changed, 63 insertions(+), 20 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index c3ac4e9..64f0611 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -2803,8 +2803,9 @@ static const struct v4l2_ctrl_config 
adv7842_ctrl_free_run_color = {
 };
 
 
-static void adv7842_unregister_clients(struct adv7842_state *state)
+static void adv7842_unregister_clients(struct v4l2_subdev *sd)
 {
+   struct adv7842_state *state = to_state(sd);
if (state-i2c_avlink)
i2c_unregister_device(state-i2c_avlink);
if (state-i2c_cec)
@@ -2827,15 +2828,71 @@ static void adv7842_unregister_clients(struct 
adv7842_state *state)
i2c_unregister_device(state-i2c_cp);
if (state-i2c_vdp)
i2c_unregister_device(state-i2c_vdp);
+
+   state-i2c_avlink = NULL;
+   state-i2c_cec = NULL;
+   state-i2c_infoframe = NULL;
+   state-i2c_sdp_io = NULL;
+   state-i2c_sdp = NULL;
+   state-i2c_afe = NULL;
+   state-i2c_repeater = NULL;
+   state-i2c_edid = NULL;
+   state-i2c_hdmi = NULL;
+   state-i2c_cp = NULL;
+   state-i2c_vdp = NULL;
 }
 
-static struct i2c_client *adv7842_dummy_client(struct v4l2_subdev *sd,
+static struct i2c_client *adv7842_dummy_client(struct v4l2_subdev *sd, const 
char *desc,
   u8 addr, u8 io_reg)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
+   struct i2c_client *cp;
 
io_write(sd, io_reg, addr  1);
-   return i2c_new_dummy(client-adapter, io_read(sd, io_reg)  1);
+
+   if (addr == 0) {
+   v4l2_err(sd, no %s i2c addr configured\n, desc);
+   return NULL;
+   }
+
+   cp = i2c_new_dummy(client-adapter, io_read(sd, io_reg)  1);
+   if (!cp)
+   v4l2_err(sd, register %s on i2c addr 0x%x failed\n, desc, 
addr);
+
+   return cp;
+}
+
+static int adv7842_register_clients(struct v4l2_subdev *sd)
+{
+   struct adv7842_state *state = to_state(sd);
+   struct adv7842_platform_data *pdata = state-pdata;
+
+   state-i2c_avlink = adv7842_dummy_client(sd, avlink, 
pdata-i2c_avlink, 0xf3);
+   state-i2c_cec = adv7842_dummy_client(sd, cec, pdata-i2c_cec, 0xf4);
+   state-i2c_infoframe = adv7842_dummy_client(sd, infoframe, 
pdata-i2c_infoframe, 0xf5);
+   state-i2c_sdp_io = adv7842_dummy_client(sd, sdp_io, 
pdata-i2c_sdp_io, 0xf2);
+   state-i2c_sdp = adv7842_dummy_client(sd, sdp, pdata-i2c_sdp, 0xf1);
+   state-i2c_afe = adv7842_dummy_client(sd, afe, pdata-i2c_afe, 0xf8);
+   state-i2c_repeater = adv7842_dummy_client(sd, repeater, 
pdata-i2c_repeater, 0xf9);
+   state-i2c_edid = adv7842_dummy_client(sd, edid, pdata-i2c_edid, 
0xfa);
+   state-i2c_hdmi = adv7842_dummy_client(sd, hdmi, pdata-i2c_hdmi, 
0xfb);
+   state-i2c_cp = adv7842_dummy_client(sd, cp, pdata-i2c_cp, 0xfd);
+   state-i2c_vdp = adv7842_dummy_client(sd, vdp, pdata-i2c_vdp, 0xfe);
+
+   if (!state-i2c_avlink ||
+   !state-i2c_cec ||
+   !state-i2c_infoframe ||
+   !state-i2c_sdp_io ||
+   !state-i2c_sdp ||
+   !state-i2c_afe ||
+   !state-i2c_repeater ||
+   !state-i2c_edid ||
+   !state-i2c_hdmi ||
+   !state-i2c_cp ||
+   !state-i2c_vdp)
+   return -1;
+
+   return 0;
 }
 
 static int adv7842_probe(struct i2c_client *client,
@@ -2937,21 +2994,7 @@ static int adv7842_probe(struct i2c_client *client,
goto err_hdl;
}
 
-   state-i2c_avlink = adv7842_dummy_client(sd, pdata-i2c_avlink, 0xf3);
-   state-i2c_cec = adv7842_dummy_client(sd, pdata-i2c_cec, 0xf4);
-   state-i2c_infoframe = adv7842_dummy_client(sd, pdata-i2c_infoframe, 
0xf5);
-   state-i2c_sdp_io = adv7842_dummy_client(sd, pdata-i2c_sdp_io, 0xf2);
-   state-i2c_sdp = adv7842_dummy_client(sd, pdata-i2c_sdp, 0xf1);
-   state-i2c_afe = adv7842_dummy_client(sd, pdata-i2c_afe, 0xf8);
-   state-i2c_repeater = adv7842_dummy_client(sd, pdata-i2c_repeater, 
0xf9);
-   state-i2c_edid = adv7842_dummy_client(sd, pdata-i2c_edid, 0xfa);
-   state-i2c_hdmi = adv7842_dummy_client(sd, pdata-i2c_hdmi, 0xfb);
-   state-i2c_cp = adv7842_dummy_client(sd, pdata-i2c_cp, 0xfd);
-   state-i2c_vdp = adv7842_dummy_client(sd, pdata-i2c_vdp, 0xfe);
-   if (!state-i2c_avlink || !state-i2c_cec || !state-i2c_infoframe ||
-   !state-i2c_sdp_io || !state-i2c_sdp || !state-i2c_afe ||
-   !state-i2c_repeater || !state-i2c_edid || !state-i2c_hdmi ||
-   !state-i2c_cp || !state-i2c_vdp) {
+ 

[RFC PATCH 19/22] adv7842: enable HDMI/DVI mode irq

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 36 ++--
 1 file changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 64f0611..9f45928 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -1832,12 +1832,15 @@ static void adv7842_irq_enable(struct v4l2_subdev *sd, 
bool enable)
io_write(sd, 0x78, 0x03);
/* Enable SDP Standard Detection Change and SDP Video Detected 
*/
io_write(sd, 0xa0, 0x09);
+   /* Enable HDMI_MODE interrupt */
+   io_write(sd, 0x69, 0x08);
} else {
io_write(sd, 0x46, 0x0);
io_write(sd, 0x5a, 0x0);
io_write(sd, 0x73, 0x0);
io_write(sd, 0x78, 0x0);
io_write(sd, 0xa0, 0x0);
+   io_write(sd, 0x69, 0x0);
}
 }
 
@@ -1845,7 +1848,7 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
 {
struct adv7842_state *state = to_state(sd);
u8 fmt_change_cp, fmt_change_digital, fmt_change_sdp;
-   u8 irq_status[5];
+   u8 irq_status[6];
 
adv7842_irq_enable(sd, false);
 
@@ -1855,6 +1858,7 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
irq_status[2] = io_read(sd, 0x70);
irq_status[3] = io_read(sd, 0x75);
irq_status[4] = io_read(sd, 0x9d);
+   irq_status[5] = io_read(sd, 0x66);
 
/* and clear */
if (irq_status[0])
@@ -1867,12 +1871,14 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
io_write(sd, 0x76, irq_status[3]);
if (irq_status[4])
io_write(sd, 0x9e, irq_status[4]);
+   if (irq_status[5])
+   io_write(sd, 0x67, irq_status[5]);
 
adv7842_irq_enable(sd, true);
 
-   v4l2_dbg(1, debug, sd, %s: irq %x, %x, %x, %x, %x\n, __func__,
+   v4l2_dbg(1, debug, sd, %s: irq %x, %x, %x, %x, %x, %x\n, __func__,
 irq_status[0], irq_status[1], irq_status[2],
-irq_status[3], irq_status[4]);
+irq_status[3], irq_status[4], irq_status[5]);
 
/* format change CP */
fmt_change_cp = irq_status[0]  0x9c;
@@ -1889,22 +1895,32 @@ static int adv7842_isr(struct v4l2_subdev *sd, u32 
status, bool *handled)
else
fmt_change_digital = 0;
 
-   /* notify */
+   /* format change */
if (fmt_change_cp || fmt_change_digital || fmt_change_sdp) {
v4l2_dbg(1, debug, sd,
 %s: fmt_change_cp = 0x%x, fmt_change_digital = 0x%x, 
fmt_change_sdp = 0x%x\n,
 __func__, fmt_change_cp, fmt_change_digital,
 fmt_change_sdp);
v4l2_subdev_notify(sd, ADV7842_FMT_CHANGE, NULL);
+   if (handled)
+   *handled = true;
}
 
-   /* 5v cable detect */
-   if (irq_status[2])
-   adv7842_s_detect_tx_5v_ctrl(sd);
-
-   if (handled)
-   *handled = true;
+   /* HDMI/DVI mode */
+   if (irq_status[5]  0x08) {
+   v4l2_dbg(1, debug, sd, %s: irq %s mode\n, __func__,
+(io_read(sd, 0x65)  0x08) ? HDMI : DVI);
+   if (handled)
+   *handled = true;
+   }
 
+   /* tx 5v detect */
+   if (irq_status[2]  0x3) {
+   v4l2_dbg(1, debug, sd, %s: irq tx_5v\n, __func__);
+   adv7842_s_detect_tx_5v_ctrl(sd);
+   if (handled)
+   *handled = true;
+   }
return 0;
 }
 
-- 
1.8.4.rc3

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


[RFC PATCH 05/22] adv7842: support YCrCb analog input.

2013-12-10 Thread Hans Verkuil
From: Martin Bugge marbu...@cisco.com

Signed-off-by: Martin Bugge marbu...@cisco.com
Signed-off-by: Hans Verkuil hans.verk...@cisco.com
---
 drivers/media/i2c/adv7842.c | 40 +---
 include/media/adv7842.h |  3 ---
 2 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/drivers/media/i2c/adv7842.c b/drivers/media/i2c/adv7842.c
index 4f93526..d350c86 100644
--- a/drivers/media/i2c/adv7842.c
+++ b/drivers/media/i2c/adv7842.c
@@ -1056,12 +1056,22 @@ static void set_rgb_quantization_range(struct 
v4l2_subdev *sd)
}
break;
case V4L2_DV_RGB_RANGE_LIMITED:
-   /* RGB limited range (16-235) */
-   io_write_and_or(sd, 0x02, 0x0f, 0x00);
+   if (state-mode == ADV7842_MODE_COMP) {
+   /* YCrCb limited range (16-235) */
+   io_write_and_or(sd, 0x02, 0x0f, 0x20);
+   } else {
+   /* RGB limited range (16-235) */
+   io_write_and_or(sd, 0x02, 0x0f, 0x00);
+   }
break;
case V4L2_DV_RGB_RANGE_FULL:
-   /* RGB full range (0-255) */
-   io_write_and_or(sd, 0x02, 0x0f, 0x10);
+   if (state-mode == ADV7842_MODE_COMP) {
+   /* YCrCb full range (0-255) */
+   io_write_and_or(sd, 0x02, 0x0f, 0x60);
+   } else {
+   /* RGB full range (0-255) */
+   io_write_and_or(sd, 0x02, 0x0f, 0x10);
+   }
break;
}
 }
@@ -1586,6 +1596,13 @@ static void select_input(struct v4l2_subdev *sd,
 
afe_write(sd, 0x00, 0x00); /* power up ADC */
afe_write(sd, 0xc8, 0x00); /* phase control */
+   if (state-mode == ADV7842_MODE_COMP) {
+   /* force to YCrCb */
+   io_write_and_or(sd, 0x02, 0x0f, 0x60);
+   } else {
+   /* force to RGB */
+   io_write_and_or(sd, 0x02, 0x0f, 0x10);
+   }
 
/* set ADI recommended settings for digitizer */
/* ADV7842 Register Settings Recommendations
@@ -1681,19 +1698,19 @@ static int adv7842_s_routing(struct v4l2_subdev *sd,
 
switch (input) {
case ADV7842_SELECT_HDMI_PORT_A:
-   /* TODO select HDMI_COMP or HDMI_GR */
state-mode = ADV7842_MODE_HDMI;
state-vid_std_select = ADV7842_HDMI_COMP_VID_STD_HD_1250P;
state-hdmi_port_a = true;
break;
case ADV7842_SELECT_HDMI_PORT_B:
-   /* TODO select HDMI_COMP or HDMI_GR */
state-mode = ADV7842_MODE_HDMI;
state-vid_std_select = ADV7842_HDMI_COMP_VID_STD_HD_1250P;
state-hdmi_port_a = false;
break;
case ADV7842_SELECT_VGA_COMP:
-   v4l2_info(sd, %s: VGA component: todo\n, __func__);
+   state-mode = ADV7842_MODE_COMP;
+   state-vid_std_select = ADV7842_RGB_VID_STD_AUTO_GRAPH_MODE;
+   break;
case ADV7842_SELECT_VGA_RGB:
state-mode = ADV7842_MODE_RGB;
state-vid_std_select = ADV7842_RGB_VID_STD_AUTO_GRAPH_MODE;
@@ -2341,9 +2358,10 @@ static int adv7842_g_std(struct v4l2_subdev *sd, 
v4l2_std_id *norm)
 
 /* --- */
 
-static int adv7842_core_init(struct v4l2_subdev *sd,
-   const struct adv7842_platform_data *pdata)
+static int adv7842_core_init(struct v4l2_subdev *sd)
 {
+   struct adv7842_state *state = to_state(sd);
+   struct adv7842_platform_data *pdata = state-pdata;
hdmi_write(sd, 0x48,
   (pdata-disable_pwrdnb ? 0x80 : 0) |
   (pdata-disable_cable_det_rst ? 0x40 : 0));
@@ -2356,7 +2374,7 @@ static int adv7842_core_init(struct v4l2_subdev *sd,
 
/* video format */
io_write(sd, 0x02,
-pdata-inp_color_space  4 |
+0xf0 |
 pdata-alt_gamma  3 |
 pdata-op_656_range  2 |
 pdata-rgb_out  1 |
@@ -2566,7 +2584,7 @@ static int adv7842_command_ram_test(struct v4l2_subdev 
*sd)
adv7842_rewrite_i2c_addresses(sd, pdata);
 
/* and re-init chip and state */
-   adv7842_core_init(sd, pdata);
+   adv7842_core_init(sd);
 
disable_input(sd);
 
diff --git a/include/media/adv7842.h b/include/media/adv7842.h
index c02201d..b0cfc5f 100644
--- a/include/media/adv7842.h
+++ b/include/media/adv7842.h
@@ -159,9 +159,6 @@ struct adv7842_platform_data {
/* Video standard */
enum adv7842_vid_std_select vid_std_select;
 
-   /* Input Color Space */
-   enum adv7842_inp_color_space inp_color_space;
-
/* Select output format */
enum adv7842_op_format_sel op_format_sel;
 
-- 

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

2013-12-10 Thread Lisa Nguyen
Rewrite the return statement in vpfe_video.c to eliminate the
use of a ternary operator. This will prevent the checkpatch.pl
script from generating a warning saying to remove () from
this particular return statement.

Signed-off-by: Lisa Nguyen l...@xenapiadmin.com
---
Changes since v2:
- Aligned -ETIMEDOUT return statement with if condition

 drivers/staging/media/davinci_vpfe/vpfe_video.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c 
b/drivers/staging/media/davinci_vpfe/vpfe_video.c
index 24d98a6..22e31d2 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
@@ -346,7 +346,10 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline 
*pipe)
}
mutex_unlock(mdev-graph_mutex);
 
-   return (ret == 0) ? ret : -ETIMEDOUT ;
+   if (ret == 0)
+   return ret;
+
+   return -ETIMEDOUT;
 }
 
 /*
-- 
1.7.9.5

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


Re: Patch mceusb: fix invalid urb interval

2013-12-10 Thread Mauro Carvalho Chehab
Em Sun, 10 Nov 2013 10:50:45 + (UTC)
Martin Kittel li...@martin-kittel.de escreveu:

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

You forgot to send your signed-off-by:
 
 Martin.
 
 
 diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
 index 3c76101..c5313cb 100644
 --- a/drivers/media/rc/mceusb.c
 +++ b/drivers/media/rc/mceusb.c
 @@ -1030,7 +1030,7 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir
  static void mceusb_dev_recv(struct urb *urb)
  {
 struct mceusb_dev *ir;
 -   int buf_len;
 +   int buf_len, res;
  

Please use tabs and not spaces. Note: This could be something wrong with your
emailer that could be mangling whitespaces.


 if (!urb)
 return;
 @@ -1067,7 +1067,11 @@ static void mceusb_dev_recv(struct urb *urb)
 break;
 }
  
 -   usb_submit_urb(urb, GFP_ATOMIC);
 +   urb-interval = ir-usb_ep_out-bInterval; /* reset urb interval */
 +   res = usb_submit_urb(urb, GFP_ATOMIC);
 +   if (res) {
 +   mce_dbg(ir-dev, restart request FAILED! (res=%d)\n, res);
 +   }

No need for braces here. Just do:
+   if (res)
+   mce_dbg(ir-dev, restart request FAILED! (res=%d)\n, res);

  }

  
  static void mceusb_get_emulator_version(struct mceusb_dev *ir)
 
 
 --
 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


-- 

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: [PATCH v2] staging: media: davinci_vpfe: Rewrite return statement in vpfe_video.c

2013-12-10 Thread Laurent Pinchart
Hi Lisa,

Thank you for the patch.

On Tuesday 10 December 2013 08:05:42 Lisa Nguyen wrote:
 Rewrite the return statement in vpfe_video.c to eliminate the
 use of a ternary operator. This will prevent the checkpatch.pl
 script from generating a warning saying to remove () from
 this particular return statement.
 
 Signed-off-by: Lisa Nguyen l...@xenapiadmin.com
 ---
 Changes since v2:
 - Aligned -ETIMEDOUT return statement with if condition
 
  drivers/staging/media/davinci_vpfe/vpfe_video.c |5 -
  1 file changed, 4 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c
 b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 24d98a6..22e31d2
 100644
 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c
 +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c
 @@ -346,7 +346,10 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline
 *pipe) }
   mutex_unlock(mdev-graph_mutex);
 
 - return (ret == 0) ? ret : -ETIMEDOUT ;
 + if (ret == 0)
 + return ret;
 +
 + return -ETIMEDOUT;

I don't want to point the obvious, but what about just

return ret ? -ETIMEDOUT : 0;

or, if this is just about fixing the checkpatch.pl warning,

return ret == 0 ? ret : -ETIMEDOUT;

(I'd prefer the first)

  }
 
  /*

-- 
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 v2] staging: media: davinci_vpfe: Rewrite return statement in vpfe_video.c

2013-12-10 Thread Lisa Nguyen
Hi Laurent,

On Tue, Dec 10, 2013 at 8:50 AM, Laurent Pinchart
laurent.pinch...@ideasonboard.com wrote:
 Hi Lisa,

 Thank you for the patch.

 On Tuesday 10 December 2013 08:05:42 Lisa Nguyen wrote:
 Rewrite the return statement in vpfe_video.c to eliminate the
 use of a ternary operator. This will prevent the checkpatch.pl
 script from generating a warning saying to remove () from
 this particular return statement.

 Signed-off-by: Lisa Nguyen l...@xenapiadmin.com
 ---
 Changes since v2:
 - Aligned -ETIMEDOUT return statement with if condition

  drivers/staging/media/davinci_vpfe/vpfe_video.c |5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

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

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

 I don't want to point the obvious, but what about just

 return ret ? -ETIMEDOUT : 0;

 or, if this is just about fixing the checkpatch.pl warning,

 return ret == 0 ? ret : -ETIMEDOUT;

 (I'd prefer the first)

I understand your point :) I was making changes based on Prabhakar's
feedback he gave me a while back[1].

Should I wait until he says?

Lisa

[1] http://www.mail-archive.com/linux-media@vger.kernel.org/msg67833.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: Fwd: dib8000 scanning not working on 3.10.3

2013-12-10 Thread Ezequiel Garcia
Hi Luis,

On Wed, Jul 31, 2013 at 03:47:10PM -0300, Luis Polasek wrote:
 Hi, I just upgraded my kernel to 3.10.3, and dib8000 scanning does not
 work anymore.
 

I'm just wondering, is this issue still present in mainline kernel?
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] omap3isp: Fix buffer flags handling when querying buffer

2013-12-10 Thread Sakari Ailus
On Tue, Dec 10, 2013 at 02:53:39AM +0100, Laurent Pinchart wrote:
 A missing break resulted in all done buffers being flagged with
 V4L2_BUF_FLAG_QUEUED. Fix it.
 
 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 ---
  drivers/media/platform/omap3isp/ispqueue.c | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/drivers/media/platform/omap3isp/ispqueue.c 
 b/drivers/media/platform/omap3isp/ispqueue.c
 index e15f013..5f0f8fa 100644
 --- a/drivers/media/platform/omap3isp/ispqueue.c
 +++ b/drivers/media/platform/omap3isp/ispqueue.c
 @@ -553,8 +553,10 @@ static void isp_video_buffer_query(struct 
 isp_video_buffer *buf,
   switch (buf-state) {
   case ISP_BUF_STATE_ERROR:
   vbuf-flags |= V4L2_BUF_FLAG_ERROR;
 + /* Fallthrough */
   case ISP_BUF_STATE_DONE:
   vbuf-flags |= V4L2_BUF_FLAG_DONE;
 + break;
   case ISP_BUF_STATE_QUEUED:
   case ISP_BUF_STATE_ACTIVE:
   vbuf-flags |= V4L2_BUF_FLAG_QUEUED;

Oh, how is it possible this bug has passed through the review? :-) Nice fix!

Acked-by: Sakari Ailus sakari.ai...@iki.fi

-- 
Cheers,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2013-12-10 Thread Mauro Carvalho Chehab
Em Sat, 23 Nov 2013 17:54:48 +0100
Hans Verkuil hverk...@xs4all.nl escreveu:

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

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

Regards,
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: [PATCH 4/7] em28xx: reduce the polling interval for buttons

2013-12-10 Thread Mauro Carvalho Chehab
Em Sun,  1 Dec 2013 22:06:54 +0100
Frank Schäfer fschaefer@googlemail.com escreveu:

 For GPI-connected buttons without (hardware) debouncing, the polling interval 
 needs to be reduced to detect button presses properly.
 
 Signed-off-by: Frank Schäfer fschaefer@googlemail.com
 ---
  drivers/media/usb/em28xx/em28xx-input.c |2 +-
  1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)
 
 diff --git a/drivers/media/usb/em28xx/em28xx-input.c 
 b/drivers/media/usb/em28xx/em28xx-input.c
 index ebc5387..c8f7ecb 100644
 --- a/drivers/media/usb/em28xx/em28xx-input.c
 +++ b/drivers/media/usb/em28xx/em28xx-input.c
 @@ -31,7 +31,7 @@
  #include em28xx.h
  
  #define EM28XX_SNAPSHOT_KEY KEY_CAMERA
 -#define EM28XX_BUTTONS_QUERY_INTERVAL 500
 +#define EM28XX_BUTTONS_QUERY_INTERVAL 100
  
  static unsigned int ir_debug;
  module_param(ir_debug, int, 0644);

I don't like this patch. If the reduced timeout is needed for the GPI
connected buttons, you should not change it for the other buttons, as
polling has a high cost, in terms of CPU sleep state (so, a more frequent
polling time drains more power - meaning a lower time when battery is in
usage).

-- 

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: [PATCH v2] staging: media: davinci_vpfe: Rewrite return statement in vpfe_video.c

2013-12-10 Thread Prabhakar Lad
Hi Lisa,

On Tue, Dec 10, 2013 at 11:27 PM, Lisa Nguyen l...@xenapiadmin.com wrote:
 Hi Laurent,

 On Tue, Dec 10, 2013 at 8:50 AM, Laurent Pinchart
 laurent.pinch...@ideasonboard.com wrote:
 Hi Lisa,

 Thank you for the patch.

 On Tuesday 10 December 2013 08:05:42 Lisa Nguyen wrote:
 Rewrite the return statement in vpfe_video.c to eliminate the
 use of a ternary operator. This will prevent the checkpatch.pl
 script from generating a warning saying to remove () from
 this particular return statement.

 Signed-off-by: Lisa Nguyen l...@xenapiadmin.com
 ---
 Changes since v2:
 - Aligned -ETIMEDOUT return statement with if condition

  drivers/staging/media/davinci_vpfe/vpfe_video.c |5 -
  1 file changed, 4 insertions(+), 1 deletion(-)

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

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

 I don't want to point the obvious, but what about just

 return ret ? -ETIMEDOUT : 0;

 or, if this is just about fixing the checkpatch.pl warning,

 return ret == 0 ? ret : -ETIMEDOUT;

 (I'd prefer the first)

 I understand your point :) I was making changes based on Prabhakar's
 feedback he gave me a while back[1].

Please go ahead as per Laurent's suggestion.

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


cron job: media_tree daily build: ERRORS

2013-12-10 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 Dec 11 04:00:23 CET 2013
git branch: test
git hash:   8a38db133358f9370e6bb453371e630495c59070
gcc version:i686-linux-gcc (GCC) 4.8.1
sparse version: 0.4.5-rc1
host hardware:  x86_64
host os:3.12-0.slh.2-amd64

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

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/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 v3] staging: media: davinci_vpfe: Rewrite return statement in vpfe_video.c

2013-12-10 Thread Lisa Nguyen
Rewrite the return statement in vpfe_video.c. This will prevent
the checkpatch.pl script from generating a warning saying
to remove () from this particular return statement.

Signed-off-by: Lisa Nguyen l...@xenapiadmin.com
---
Changes since v3:
- Removed () from return statement per Laurent Pinchart's suggestion

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

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

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


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

2013-12-10 Thread Hans Verkuil
On 12/10/2013 09:53 PM, Mauro Carvalho Chehab wrote:
 Em Sat, 23 Nov 2013 17:54:48 +0100
 Hans Verkuil hverk...@xs4all.nl escreveu:
 
 On 11/23/2013 05:30 PM, Sylwester Nawrocki wrote:
 Hi,

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

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

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

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

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

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

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

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

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

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

 I don't mind switching to tracepoints as long as this functionality is
 kept one way or another.
 
 I agree with Sylwester: we should move to tracepoints, and this is a good
 start.

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

To make it official:

Nacked-by: Hans Verkuil hans.verk...@cisco.com

If we do tracepoints, then we do it right and for all ioctls, not in this
half-baked manner.

Please revert.

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