From: Bradford Love Date: Tue, 17 Mar 2026 21:07:20 +0000 (-0500) Subject: media: au0828: Fix green screen in analog X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58119a0cffa8a597ce5d39587beb0f5a763434a0;p=thirdparty%2Fkernel%2Fstable.git media: au0828: Fix green screen in analog 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 Signed-off-by: Hans Verkuil --- diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c index fbaa542c8259..3c53105f3d2b 100644 --- a/drivers/media/usb/au0828/au0828-video.c +++ b/drivers/media/usb/au0828/au0828-video.c @@ -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,