public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Ricardo Ribalda <ribalda@chromium.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	Yunke Cao <yunkec@chromium.org>,
	Hans Verkuil <hverkuil@xs4all.nl>
Subject: Re: [PATCH v2 0/6] media: uvcvideo: Implement the Privacy GPIO as a subdevice
Date: Tue, 26 Nov 2024 19:22:05 +0200	[thread overview]
Message-ID: <20241126172205.GK5461@pendragon.ideasonboard.com> (raw)
In-Reply-To: <d240ed2e-9675-425c-acef-92ad7f5127ef@redhat.com>

On Mon, Nov 25, 2024 at 02:29:51PM +0100, Hans de Goede wrote:
> On 25-Nov-24 1:49 PM, Laurent Pinchart wrote:
> > On Mon, Nov 25, 2024 at 01:25:41PM +0100, Hans de Goede wrote:
> 
> <snip>
> 
> >> I see 2 ways of doing that:
> >>
> >> 1. Use pm_runtime_set_autosuspend_delay() with a delay of say 1 second
> >> and then on set_ctrl do a pm_runtime_get_sync() +
> >> pm_runtime_put_autosuspend() giving the camera 1 second to finish
> >> applying the async ctrl (which might not be enough for e.g homing) +
> >> also avoid doing suspend + resume all the time if multiple ctrls are send
> >>
> >> 2. Instead of immediately powering on the camera on /dev/video# open
> >> track per fh if the camera has been powered on and then on the first
> >> set-ctrl, or the first other IOCTL like try/set-fmt which requires
> >> the camera to be powered on power it up and then keep it on until
> >> the fh is closed, since apps hitting these paths are likely to do
> >> more stuff which requires the camera to be powered on.
> > 
> > A mode of operation where a userspace action causes a state change and
> > the only way to change back to the previous state is to close the device
> > often leads to problems. I'd rather not do this unless we have to
> > completely rule out all other options.
> 
> But we already have that today. We already do the usb_autopm_get_interface()
> as soon as /dev/video# gets opened and the only way to undo it is to close
> /dev/video#.

Yes, but close() is the counterpart of open(). Breaking the symmetry is
what bothers me, it's not nice from an application point of view. It
wouldn't force instance have solved the issue of keeping the device
powered when used through libcamera (or anything else that keeps the
device node open after using the camera, or just after querying some of
its capabilities through TRY_FMT).

> What I'm suggesting is to no longer do the usb_autopm_get_interface()
> on all opens, but only on some.
> 
> Where "some" are the ones where we come to the conclusion that we actually
> need to power-up the USB-bus / interface because we want to talk to
> the device.
> 
> IOW delay the usb_autopm_get_interface() until the first action which
> actually requires it.
> 
> This should be a very minimal change from the pov of USB interactions
> with the actual device, so a small change of regressions while at
> least not powering on the device during udev discovery.
> 
> I guess one could argue that the cases where this is a win are so
> small that this is not worth it.

Is there a significant enough gain through this approach, and are the
other approaches impractical ? If so we can consider this.

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2024-11-26 17:22 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08 20:25 [PATCH v2 0/6] media: uvcvideo: Implement the Privacy GPIO as a subdevice Ricardo Ribalda
2024-11-08 20:25 ` [PATCH v2 1/6] media: uvcvideo: Factor out gpio functions to its own file Ricardo Ribalda
2024-11-08 20:25 ` [PATCH v2 2/6] media: uvcvideo: Re-implement privacy GPIO as a separate subdevice Ricardo Ribalda
2024-11-08 20:25 ` [PATCH v2 3/6] Revert "media: uvcvideo: Allow entity-defined get_info and get_cur" Ricardo Ribalda
2024-11-08 20:25 ` [PATCH v2 4/6] media: uvcvideo: Create ancillary link for GPIO subdevice Ricardo Ribalda
2024-11-10 10:05   ` Sakari Ailus
2024-11-08 20:25 ` [PATCH v2 5/6] media: v4l2-core: Add new MEDIA_ENT_F_GPIO Ricardo Ribalda
2024-11-08 20:25 ` [PATCH v2 6/6] media: uvcvideo: Use MEDIA_ENT_F_GPIO for the GPIO entity Ricardo Ribalda
2024-11-09 14:04 ` [PATCH v2 0/6] media: uvcvideo: Implement the Privacy GPIO as a subdevice Mauro Carvalho Chehab
2024-11-09 14:57   ` Ricardo Ribalda
2024-11-09 15:37 ` Hans de Goede
2024-11-09 16:29   ` Ricardo Ribalda
2024-11-10 10:02     ` Mauro Carvalho Chehab
2024-11-10 10:29       ` Hans Verkuil
2024-11-10 10:37         ` Ricardo Ribalda
2024-11-10 10:47           ` Hans Verkuil
2024-11-10 12:48           ` Mauro Carvalho Chehab
2024-11-10 10:32       ` Ricardo Ribalda
2024-11-10 10:59         ` Ricardo Ribalda
2024-11-10 12:46         ` Mauro Carvalho Chehab
2024-11-10 16:01           ` Ricardo Ribalda
2024-11-10 15:14     ` Laurent Pinchart
2024-11-10 16:04       ` Ricardo Ribalda
2024-11-25 12:31         ` Hans de Goede
2024-11-25 12:56           ` Laurent Pinchart
2024-11-25 13:35             ` Hans de Goede
2024-11-10 16:07       ` Ricardo Ribalda
2024-11-25 12:39         ` Hans de Goede
2024-11-25 12:58           ` Laurent Pinchart
2024-11-25 13:44             ` Hans de Goede
2024-11-25 13:50               ` Ricardo Ribalda
2024-11-11 12:03     ` Hans de Goede
2024-11-25 12:25     ` Hans de Goede
2024-11-25 12:49       ` Laurent Pinchart
2024-11-25 13:29         ` Hans de Goede
2024-11-26 17:22           ` Laurent Pinchart [this message]
2024-11-25 13:39       ` Ricardo Ribalda
2024-11-25 14:02         ` Hans de Goede
2024-11-26 16:22           ` Ricardo Ribalda
2024-11-26 17:18             ` Laurent Pinchart
2024-11-26 17:29               ` Ricardo Ribalda
2024-11-10 15:08   ` Laurent Pinchart
2024-11-11 12:59 ` Hans de Goede
2024-11-11 14:35   ` Hans de Goede
2024-11-12 17:31   ` Ricardo Ribalda
2024-11-13 15:19     ` Hans de Goede

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241126172205.GK5461@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hdegoede@redhat.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=yunkec@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox