1 From 9260e7f5cec8c337062c399861eb85e26ebf616e Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Jakub=20Van=C4=9Bk?= <linuxtardis@gmail.com>
3 Date: Wed, 7 Jul 2021 22:48:20 +0200
4 Subject: [PATCH 0295/1085] media: bcm2835-unicam: Forward input status from
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
10 The vidioc_enum_input() v4l2 ioctl is capable of returning
11 sensor/input status as well. This is used in current
12 GStreamer HEAD for signal detection [1].
14 bcm2835-unicam does handle this syscall, but it didn't ask
15 the subdevice driver about the input status. The input then
16 appeared as always present.
18 This commit adds the necessary query. There is a precedent for
19 this - the R-Car VIN V4L2 driver does a similar call [2].
21 [1]: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/blob/ce0be27caf69aa9d96b73bc2b50737451b6f6936/sys/v4l2/gstv4l2src.c#L553
22 [2]: https://github.com/raspberrypi/linux/blob/7fb9d006d3ff3baf2e205e0c85c4e4fd0a64fcd0/drivers/media/platform/rcar-vin/rcar-v4l2.c#L548
24 Signed-off-by: Jakub Vaněk <linuxtardis@gmail.com>
26 drivers/media/platform/bcm2835/bcm2835-unicam.c | 9 +++++++++
27 1 file changed, 9 insertions(+)
29 --- a/drivers/media/platform/bcm2835/bcm2835-unicam.c
30 +++ b/drivers/media/platform/bcm2835/bcm2835-unicam.c
31 @@ -1809,6 +1809,7 @@ static int unicam_enum_input(struct file
33 struct unicam_node *node = video_drvdata(file);
34 struct unicam_device *dev = node->dev;
39 @@ -1825,6 +1826,14 @@ static int unicam_enum_input(struct file
40 inp->capabilities = 0;
44 + if (v4l2_subdev_has_op(dev->sensor, video, g_input_status)) {
45 + ret = v4l2_subdev_call(dev->sensor, video, g_input_status,
51 snprintf(inp->name, sizeof(inp->name), "Camera 0");