brcm2708: update to latest patches from RPi Foundation
[openwrt/staging/chunkeey.git] / target / linux / brcm2708 / patches-4.19 / 950-0746-staging-bcm2835-codec-Set-default-and-error-check-ti.patch
diff --git a/target/linux/brcm2708/patches-4.19/950-0746-staging-bcm2835-codec-Set-default-and-error-check-ti.patch b/target/linux/brcm2708/patches-4.19/950-0746-staging-bcm2835-codec-Set-default-and-error-check-ti.patch
new file mode 100644 (file)
index 0000000..896149f
--- /dev/null
@@ -0,0 +1,37 @@
+From 4d6c40ebfe10dd2fdc64bd7607e51275d5524e47 Mon Sep 17 00:00:00 2001
+From: Dave Stevenson <dave.stevenson@raspberrypi.org>
+Date: Fri, 13 Sep 2019 17:23:26 +0100
+Subject: [PATCH] staging: bcm2835-codec: Set default and error check
+ timeperframe
+
+G_PARM default was invalid as 0/0, and the driver didn't check
+the value set in S_PARM wasn't 0/0.
+
+Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
+---
+ .../vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c       | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
++++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
+@@ -1423,6 +1423,10 @@ static int vidioc_s_parm(struct file *fi
+       if (parm->type != V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
+               return -EINVAL;
++      if (!parm->parm.output.timeperframe.denominator ||
++          !parm->parm.output.timeperframe.numerator)
++              return -EINVAL;
++
+       ctx->framerate_num =
+                       parm->parm.output.timeperframe.denominator;
+       ctx->framerate_denom =
+@@ -2390,6 +2394,9 @@ static int bcm2835_codec_open(struct fil
+       ctx->colorspace = V4L2_COLORSPACE_REC709;
+       ctx->bitrate = 10 * 1000 * 1000;
++      ctx->framerate_num = 30;
++      ctx->framerate_denom = 1;
++
+       /* Initialise V4L2 contexts */
+       v4l2_fh_init(&ctx->fh, video_devdata(file));
+       file->private_data = &ctx->fh;