From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC82274BEC; Fri, 19 Apr 2024 10:23:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713522210; cv=none; b=U4k716kqWN+yspTkOM5x1mCe0wXNZH9yioI9RHYnujVAFEYdE1FW6y5pWxP/NESX25HFWvUJd9vtZPV5cC7zwhBlYtWJNXz4tNcUe0cWghbAU1KVFUgKPlI7KUbTzffyzhVmNuzuJ6UzE5RcN6zpaK/l445zdSXj+TG7HmhNMsA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713522210; c=relaxed/simple; bh=5T6/pdA9ZApunyjib21mMpB2vBOnp8LFdesL1yGXMCI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PNU5LBhWgNRmpOtR45gORGQ4X952m0p3ImvRM0qTI8scH5kzHLgNU4NpzSfpm9ZlsjcVuHeG/DXghy2K8oLJzpeebCWstGmP00FKhWREfOQa/WJrljLoxN50cdikPCPvHS/r3C6aNCtThn1I0NGTMn4TbPNGtYAIsEK9kV3ZfTw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=gnj7YRWZ; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="gnj7YRWZ" Received: from pendragon.ideasonboard.com (117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3A93263B; Fri, 19 Apr 2024 12:22:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1713522159; bh=5T6/pdA9ZApunyjib21mMpB2vBOnp8LFdesL1yGXMCI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gnj7YRWZJ/Ti0qr9P15pQfi53U5u560urZeBEppDUzqegYSGLhohQ47cn5vC4ChJl YYe9ZkE/4uiY0c58zd8tfEOoJNdykaCKmrbO7Y8xIl7vuUgpYFdmuB4IEPuvtwiYR8 AB6JkyvBP0Rp2yxbYjEN/6gVIZpKz8VeAm9q4pK4= Date: Fri, 19 Apr 2024 13:23:19 +0300 From: Laurent Pinchart To: Tomi Valkeinen Cc: Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Umang Jain , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 07/10] media: subdev: Support privacy led in v4l2_subdev_enable/disable_streams() Message-ID: <20240419102319.GD12651@pendragon.ideasonboard.com> References: <20240416-enable-streams-impro-v5-0-bd5fcea49388@ideasonboard.com> <20240416-enable-streams-impro-v5-7-bd5fcea49388@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240416-enable-streams-impro-v5-7-bd5fcea49388@ideasonboard.com> Hi Tomi, Thank you for the patch. On Tue, Apr 16, 2024 at 04:55:10PM +0300, Tomi Valkeinen wrote: > 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 > Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart > --- > 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 06f87b15dadb..38388b223564 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; > -- Regards, Laurent Pinchart