Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-07-14 11:33:41 +0200
committerJiri Slaby <jslaby@suse.cz>2019-07-14 11:33:51 +0200
commitf33221f48afe47114cb0e4e0403be2bc42c4823d (patch)
tree4fcc729e278897309c92f950ac82a24ca863147f
parent4fbf4ee7f6bd9ac34227ba36fd0754e4222c69b5 (diff)
staging: bcm2835-camera: Restore return behavior of
ctrl_set_bitrate() (bnc#1012628).
-rw-r--r--patches.kernel.org/5.2.1-036-staging-bcm2835-camera-Restore-return-behavior-.patch75
-rw-r--r--series.conf1
2 files changed, 76 insertions, 0 deletions
diff --git a/patches.kernel.org/5.2.1-036-staging-bcm2835-camera-Restore-return-behavior-.patch b/patches.kernel.org/5.2.1-036-staging-bcm2835-camera-Restore-return-behavior-.patch
new file mode 100644
index 0000000000..c0ec2a1716
--- /dev/null
+++ b/patches.kernel.org/5.2.1-036-staging-bcm2835-camera-Restore-return-behavior-.patch
@@ -0,0 +1,75 @@
+From: Stefan Wahren <wahrenst@gmx.net>
+Date: Wed, 26 Jun 2019 17:48:11 +0200
+Subject: [PATCH] staging: bcm2835-camera: Restore return behavior of
+ ctrl_set_bitrate()
+References: bnc#1012628
+Patch-mainline: 5.2.1
+Git-commit: f816db1dc17b99b059325f41ed5a78f85d15368c
+
+commit f816db1dc17b99b059325f41ed5a78f85d15368c upstream.
+
+The commit 52c4dfcead49 ("Staging: vc04_services: Cleanup in
+ctrl_set_bitrate()") changed the return behavior of ctrl_set_bitrate().
+We cannot do this because of a bug in the firmware, which breaks probing
+of bcm2835-camera:
+
+ bcm2835-v4l2: mmal_init: failed to set all camera controls: -3
+ Cleanup: Destroy video encoder
+ Cleanup: Destroy image encoder
+ Cleanup: Destroy video render
+ Cleanup: Destroy camera
+ bcm2835-v4l2: bcm2835_mmal_probe: mmal init failed: -3
+ bcm2835-camera: probe of bcm2835-camera failed with error -3
+
+So restore the old behavior, add an explaining comment and a debug message
+to verify that the bug has been fixed in firmware.
+
+Fixes: 52c4dfcead49 ("Staging: vc04_services: Cleanup in ctrl_set_bitrate()")
+Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
+Cc: stable <stable@vger.kernel.org>
+Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ .../vc04_services/bcm2835-camera/controls.c | 19 ++++++++++++++++---
+ 1 file changed, 16 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/staging/vc04_services/bcm2835-camera/controls.c b/drivers/staging/vc04_services/bcm2835-camera/controls.c
+index dade79738a29..12ac3ef61fe6 100644
+--- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
++++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
+@@ -603,15 +603,28 @@ static int ctrl_set_bitrate(struct bm2835_mmal_dev *dev,
+ struct v4l2_ctrl *ctrl,
+ const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl)
+ {
++ int ret;
+ struct vchiq_mmal_port *encoder_out;
+
+ dev->capture.encode_bitrate = ctrl->val;
+
+ encoder_out = &dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->output[0];
+
+- return vchiq_mmal_port_parameter_set(dev->instance, encoder_out,
+- mmal_ctrl->mmal_id, &ctrl->val,
+- sizeof(ctrl->val));
++ ret = vchiq_mmal_port_parameter_set(dev->instance, encoder_out,
++ mmal_ctrl->mmal_id, &ctrl->val,
++ sizeof(ctrl->val));
++
++ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
++ "%s: After: mmal_ctrl:%p ctrl id:0x%x ctrl val:%d ret %d(%d)\n",
++ __func__, mmal_ctrl, ctrl->id, ctrl->val, ret,
++ (ret == 0 ? 0 : -EINVAL));
++
++ /*
++ * Older firmware versions (pre July 2019) have a bug in handling
++ * MMAL_PARAMETER_VIDEO_BIT_RATE that result in the call
++ * returning -MMAL_MSG_STATUS_EINVAL. So ignore errors from this call.
++ */
++ return 0;
+ }
+
+ static int ctrl_set_bitrate_mode(struct bm2835_mmal_dev *dev,
+--
+2.22.0
+
diff --git a/series.conf b/series.conf
index 4038084942..34d54b69cc 100644
--- a/series.conf
+++ b/series.conf
@@ -62,6 +62,7 @@
patches.kernel.org/5.2.1-033-p54-fix-crash-during-initialization.patch
patches.kernel.org/5.2.1-034-staging-comedi-dt282x-fix-a-null-pointer-deref-.patch
patches.kernel.org/5.2.1-035-staging-wilc1000-fix-error-path-cleanup-in-wilc.patch
+ patches.kernel.org/5.2.1-036-staging-bcm2835-camera-Restore-return-behavior-.patch
########################################################
# Build fixes that apply to the vanilla kernel too.