]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: au0828: Fix green screen in analog
authorBradford Love <brad@nextdimension.cc>
Tue, 17 Mar 2026 21:07:20 +0000 (16:07 -0500)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Wed, 25 Mar 2026 17:27:25 +0000 (18:27 +0100)
When the driver was converted to VB2 the original function to fix
green frame detection was removed and a default vb2 dqbuf function
was used instead. This vb2 dqbuf function leads to green frames not
being detected and correupting stream captures.

The vidioc_dqbuf function checks the greenscreen flag, and, if set
resets the stream to discard the green frame and decode a real frame.

Signed-off-by: Bradford Love <brad@nextdimension.cc>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/usb/au0828/au0828-video.c

index fbaa542c8259ac007ed441280d06a2770e4134f4..3c53105f3d2b312c89630319852a4d6b5893fbce 100644 (file)
@@ -1671,6 +1671,27 @@ static int vidioc_log_status(struct file *file, void *fh)
        return 0;
 }
 
+static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
+{
+       struct au0828_dev *dev = video_drvdata(file);
+       int rc;
+
+       rc = check_dev(dev);
+       if (rc < 0)
+               return rc;
+
+       /* Workaround for a bug in the au0828 hardware design that
+        * sometimes results in the colorspace being inverted
+        */
+       if (dev->greenscreen_detected == 1) {
+               dprintk(1, "Detected green frame.  Resetting stream...\n");
+               au0828_analog_stream_reset(dev);
+               dev->greenscreen_detected = 0;
+       }
+
+       return vb2_ioctl_dqbuf(file, priv, b);
+}
+
 void au0828_v4l2_suspend(struct au0828_dev *dev)
 {
        struct urb *urb;
@@ -1764,8 +1785,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
        .vidioc_prepare_buf         = vb2_ioctl_prepare_buf,
        .vidioc_querybuf            = vb2_ioctl_querybuf,
        .vidioc_qbuf                = vb2_ioctl_qbuf,
-       .vidioc_dqbuf               = vb2_ioctl_dqbuf,
-       .vidioc_expbuf               = vb2_ioctl_expbuf,
+       .vidioc_dqbuf               = vidioc_dqbuf,
+       .vidioc_expbuf              = vb2_ioctl_expbuf,
 
        .vidioc_s_std               = vidioc_s_std,
        .vidioc_g_std               = vidioc_g_std,