[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240424-enable-streams-impro-v6-7-5fb14c20147d@ideasonboard.com>
Date: Wed, 24 Apr 2024 18:39:10 +0300
From: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
To: Mauro Carvalho Chehab <mchehab@...nel.org>,
Hans Verkuil <hverkuil@...all.nl>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Umang Jain <umang.jain@...asonboard.com>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
Subject: [PATCH v6 07/11] media: subdev: Support privacy led in
v4l2_subdev_enable/disable_streams()
We support camera privacy leds with the .s_stream() operation, in
call_s_stream(), but we don't have that support when the subdevice
implements .enable/disable_streams() operations.
Add the support by enabling the led when the first stream for a
subdevice is enabled, and disabling the led then the last stream is
disabled.
Reviewed-by: Umang Jain <umang.jain@...asonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
Tested-by: Umang Jain <umang.jain@...asonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
---
drivers/media/v4l2-core/v4l2-subdev.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index c877646047d1..7d0343e8480b 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -2185,6 +2185,7 @@ int v4l2_subdev_enable_streams(struct v4l2_subdev *sd, u32 pad,
{
struct device *dev = sd->entity.graph_obj.mdev->dev;
struct v4l2_subdev_state *state;
+ bool already_streaming;
u64 found_streams = 0;
unsigned int i;
int ret;
@@ -2233,6 +2234,8 @@ int v4l2_subdev_enable_streams(struct v4l2_subdev *sd, u32 pad,
dev_dbg(dev, "enable streams %u:%#llx\n", pad, streams_mask);
+ already_streaming = v4l2_subdev_is_streaming(sd);
+
/* Call the .enable_streams() operation. */
ret = v4l2_subdev_call(sd, pad, enable_streams, state, pad,
streams_mask);
@@ -2251,6 +2254,9 @@ int v4l2_subdev_enable_streams(struct v4l2_subdev *sd, u32 pad,
cfg->enabled = true;
}
+ if (!already_streaming)
+ v4l2_subdev_enable_privacy_led(sd);
+
done:
v4l2_subdev_unlock_state(state);
@@ -2375,6 +2381,9 @@ int v4l2_subdev_disable_streams(struct v4l2_subdev *sd, u32 pad,
}
done:
+ if (!v4l2_subdev_is_streaming(sd))
+ v4l2_subdev_disable_privacy_led(sd);
+
v4l2_subdev_unlock_state(state);
return ret;
--
2.34.1
Powered by blists - more mailing lists