lkml.org 
[lkml]   [2024]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH v3 7/9] media: subdev: Support privacy led in v4l2_subdev_enable/disable_streams()
    From
    Hi Tomi,

    Thank you for the patch.

    On 10/04/24 6:05 pm, Tomi Valkeinen wrote:
    > We support camera privacy leds with the .s_stream, in call_s_stream, but
    > we don't have that support when the subdevice implements
    > .enable/disable_streams.
    >
    > 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.
    >
    > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

    Reviewed-by: Umang Jain <umang.jain@ideasonboard.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 20b5a00cbeeb..f44aaa4e1fab 100644
    > --- a/drivers/media/v4l2-core/v4l2-subdev.c
    > +++ b/drivers/media/v4l2-core/v4l2-subdev.c
    > @@ -2150,6 +2150,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;
    > @@ -2198,6 +2199,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);
    > @@ -2216,6 +2219,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);
    >
    > @@ -2340,6 +2346,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;
    >


    \
     
     \ /
      Last update: 2024-04-11 06:59    [W:4.032 / U:0.196 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site