From patchwork Sun Jan 23 22:12:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devin Heitmueller X-Patchwork-Id: 5662 Return-path: Envelope-to: mchehab@pedra Delivery-date: Sun, 23 Jan 2011 20:36:49 -0200 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1Ph8YD-0001U9-4w for mchehab@pedra; Sun, 23 Jan 2011 20:36:49 -0200 Received: from casper.infradead.org [85.118.1.10] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Sun, 23 Jan 2011 20:36:49 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1Ph8Ai-0004ON-6I; Sun, 23 Jan 2011 22:12:32 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752478Ab1AWWMa (ORCPT + 1 other); Sun, 23 Jan 2011 17:12:30 -0500 Received: from mail-ew0-f46.google.com ([209.85.215.46]:60180 "EHLO mail-ew0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752248Ab1AWWM3 (ORCPT ); Sun, 23 Jan 2011 17:12:29 -0500 Received: by ewy5 with SMTP id 5so1627374ewy.19 for ; Sun, 23 Jan 2011 14:12:28 -0800 (PST) MIME-Version: 1.0 Received: by 10.213.29.210 with SMTP id r18mr3962035ebc.62.1295820747690; Sun, 23 Jan 2011 14:12:27 -0800 (PST) Received: by 10.213.15.67 with HTTP; Sun, 23 Jan 2011 14:12:27 -0800 (PST) Date: Sun, 23 Jan 2011 17:12:27 -0500 Message-ID: Subject: [PATCH] Fix bug in au0828 VBI streaming From: Devin Heitmueller To: Linux Media Mailing List Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: Attached is a patch for a V4L2 spec violation with regards to the au0828 not working in streaming mode. This was just an oversight on my part when I did the original VBI support for this bridge, as libzvbi was silently falling back to using the read() interface. Devin au0828: fix VBI handling when in V4L2 streaming mode From: Devin Heitmueller It turns up V4L2 streaming mode (a.k.a mmap) was broken for VBI streaming. This was causing libzvbi to fall back to V4L1 capture mode, and is a blatent violation of the V4L2 specification. Make the implementation work properly in this mode. Priority: high Signed-off-by: Devin Heitmueller --- media_build/linux/drivers/media/video/au0828/au0828-video.c 2011-01-10 10:24:45.000000000 -0500 +++ media_build_950qfixes//linux/drivers/media/video/au0828/au0828-video.c 2011-01-23 17:05:08.461107569 -0500 @@ -1758,7 +1758,12 @@ if (rc < 0) return rc; - return videobuf_reqbufs(&fh->vb_vidq, rb); + if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + rc = videobuf_reqbufs(&fh->vb_vidq, rb); + else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) + rc = videobuf_reqbufs(&fh->vb_vbiq, rb); + + return rc; } static int vidioc_querybuf(struct file *file, void *priv, @@ -1772,7 +1777,12 @@ if (rc < 0) return rc; - return videobuf_querybuf(&fh->vb_vidq, b); + if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + rc = videobuf_querybuf(&fh->vb_vidq, b); + else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) + rc = videobuf_querybuf(&fh->vb_vbiq, b); + + return rc; } static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) @@ -1785,7 +1795,12 @@ if (rc < 0) return rc; - return videobuf_qbuf(&fh->vb_vidq, b); + if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + rc = videobuf_qbuf(&fh->vb_vidq, b); + else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) + rc = videobuf_qbuf(&fh->vb_vbiq, b); + + return rc; } static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) @@ -1806,7 +1821,12 @@ dev->greenscreen_detected = 0; } - return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); + if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) + rc = videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); + else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) + rc = videobuf_dqbuf(&fh->vb_vbiq, b, file->f_flags & O_NONBLOCK); + + return rc; } static struct v4l2_file_operations au0828_v4l_fops = {