mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-21 14:37:57 +00:00
20ea6adbf1
Build system: x86_64 Build-tested: bcm2708, bcm2709, bcm2710, bcm2711 Run-tested: bcm2708/RPiB+, bcm2709/RPi3B, bcm2710/RPi3B, bcm2711/RPi4B Signed-off-by: Marty Jones <mj8263788@gmail.com> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
54 lines
1.8 KiB
Diff
54 lines
1.8 KiB
Diff
From 4380b6913ec718c6b0503015e027098da0bccb6e Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Jakub=20Van=C4=9Bk?= <linuxtardis@gmail.com>
|
|
Date: Wed, 7 Jul 2021 22:48:20 +0200
|
|
Subject: [PATCH] media: bcm2835-unicam: Forward input status from
|
|
subdevice
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
The vidioc_enum_input() v4l2 ioctl is capable of returning
|
|
sensor/input status as well. This is used in current
|
|
GStreamer HEAD for signal detection [1].
|
|
|
|
bcm2835-unicam does handle this syscall, but it didn't ask
|
|
the subdevice driver about the input status. The input then
|
|
appeared as always present.
|
|
|
|
This commit adds the necessary query. There is a precedent for
|
|
this - the R-Car VIN V4L2 driver does a similar call [2].
|
|
|
|
[1]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/blob/ce0be27caf69aa9d96b73bc2b50737451b6f6936/sys/v4l2/gstv4l2src.c#L553
|
|
[2]: https://github.com/raspberrypi/linux/blob/7fb9d006d3ff3baf2e205e0c85c4e4fd0a64fcd0/drivers/media/platform/rcar-vin/rcar-v4l2.c#L548
|
|
|
|
Signed-off-by: Jakub Vaněk <linuxtardis@gmail.com>
|
|
---
|
|
drivers/media/platform/bcm2835/bcm2835-unicam.c | 9 +++++++++
|
|
1 file changed, 9 insertions(+)
|
|
|
|
--- a/drivers/media/platform/bcm2835/bcm2835-unicam.c
|
|
+++ b/drivers/media/platform/bcm2835/bcm2835-unicam.c
|
|
@@ -1810,6 +1810,7 @@ static int unicam_enum_input(struct file
|
|
{
|
|
struct unicam_node *node = video_drvdata(file);
|
|
struct unicam_device *dev = node->dev;
|
|
+ int ret;
|
|
|
|
if (inp->index != 0)
|
|
return -EINVAL;
|
|
@@ -1826,6 +1827,14 @@ static int unicam_enum_input(struct file
|
|
inp->capabilities = 0;
|
|
inp->std = 0;
|
|
}
|
|
+
|
|
+ if (v4l2_subdev_has_op(dev->sensor, video, g_input_status)) {
|
|
+ ret = v4l2_subdev_call(dev->sensor, video, g_input_status,
|
|
+ &inp->status);
|
|
+ if (ret < 0)
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
snprintf(inp->name, sizeof(inp->name), "Camera 0");
|
|
return 0;
|
|
}
|