linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Tomasz Figa <tfiga@chromium.org>
Cc: Bingbu Cao <bingbu.cao@linux.intel.com>,
	linux-i2c <linux-i2c@vger.kernel.org>,
	Wolfram Sang <wsa@the-dreams.de>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-acpi@vger.kernel.org, Bingbu Cao <bingbu.cao@intel.com>,
	Linux Media Mailing List <linux-media@vger.kernel.org>,
	Chiranjeevi Rapolu <chiranjeevi.rapolu@intel.com>,
	Hyungwoo Yang <hyungwoo.yang@intel.com>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Mani, Rajmohan" <rajmohan.mani@intel.com>,
	"Qiu, Tian Shu" <tian.shu.qiu@intel.com>
Subject: Re: [PATCH v5 0/6] Support running driver's probe for a device powered off
Date: Tue, 18 Aug 2020 14:04:59 +0300	[thread overview]
Message-ID: <20200818110459.GR24582@paasikivi.fi.intel.com> (raw)
In-Reply-To: <CAAFQd5DbMMsxkJAkLm4kQ+cQ0ePG4ME492MxM3vwXws3H_bsTQ@mail.gmail.com>

Hi Tomasz, Bingbu,

On Fri, Aug 14, 2020 at 03:17:58PM +0200, Tomasz Figa wrote:
> On Fri, Aug 14, 2020 at 6:12 AM Bingbu Cao <bingbu.cao@linux.intel.com> wrote:
> >
> >
> >
> > On 8/10/20 10:27 PM, Sakari Ailus wrote:
> > > Hi all,
> > >
> > ...snip...
> > >
> > > The use case is such that there is a privacy LED next to an integrated
> > > user-facing laptop camera, and this LED is there to signal the user that
> > > the camera is recording a video or capturing images. That LED also happens
> > > to be wired to one of the power supplies of the camera, so whenever you
> > > power on the camera, the LED will be lit, whether images are captured from
> > > the camera --- or not. There's no way to implement this differently
> > > without additional software control (allowing of which is itself a
> > > hardware design decision) on most CSI-2-connected camera sensors as they
> > > simply have no pin to signal the camera streaming state.
> > >
> > > This is also what happens during driver probe: the camera will be powered
> > > on by the I²C subsystem calling dev_pm_domain_attach() and the device is
> > > already powered on when the driver's own probe function is called. To the
> > > user this visible during the boot process as a blink of the privacy LED,
> > > suggesting that the camera is recording without the user having used an
> > > application to do that. From the end user's point of view the behaviour is
> > > not expected and for someone unfamiliar with internal workings of a
> > > computer surely seems quite suspicious --- even if images are not being
> > > actually captured.
> > >
> > > I've tested these on linux-next master. They also apply to Wolfram's
> > > i2c/for-next branch, there's a patch that affects the I²C core changes
> > > here (see below). The patches apart from that apply to Bartosz's
> > > at24/for-next as well as Mauro's linux-media master branch.
> >
> > Sakari, we meet one issue - once the vcm sub-device registered, the user space
> > will try to open the VCM (I have not figure out who did that), it will also
> > trigger the acpi pm resume/suspend, as the VCM always shares same power rail
> > with camera sensor, so the privacy LED still has a blink.
> 
> It's not always the case, as on some designs there are multiple power
> rails to the sensor and one drives the LED, while the other drives the
> VCM. That said, it would be still good to solve it in either case.
> 
> Perhaps we need some more general discussion on the side effects of
> simply opening and querying a device. Most of V4L2 drivers these days
> are designed to avoid powering up the hardware until it's absolutely
> needed to do so. However, for non-streaming subdevs that are directly
> controlled by the userspace, like VCM, it's a common practice to power
> up on open and down on release. This is because they don't have a
> "streaming" state, so the driver has no way to determine when the
> power is needed. I wonder if there is a way to improve this.

Good question.

I think in this particular case the device could be powered on only when
there's an open file handle and current is applied on the coil (i.e. the
control's value is non-zero).

But in general case more IOCTLs would be needed. PM QoS framework could be
used for the purpose based on wakeup latency. I guess no-one has needed it
badly enough to implement the support? This would be actually a better
approach. In any case in the case of the lens it requires that the current
behaviour of powering on the device based on just open file handles would
have to change.

-- 
Kind regards,

Sakari Ailus

      reply	other threads:[~2020-08-18 11:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-10 14:27 [PATCH v5 0/6] Support running driver's probe for a device powered off Sakari Ailus
2020-08-10 14:27 ` [PATCH v5 1/6] i2c: Allow driver to manage the device's power state during probe Sakari Ailus
2020-08-10 14:41   ` Sudeep Holla
2020-08-11  8:57     ` Sakari Ailus
2020-08-10 14:27 ` [PATCH v5 2/6] ACPI: Add a convenience function to tell a device is in low power state Sakari Ailus
2020-08-10 14:27 ` [PATCH v5 3/6] ov5670: Support probe whilst the device is in a " Sakari Ailus
2020-08-12  9:12   ` Bingbu Cao
2020-08-12  9:22     ` Sakari Ailus
2020-08-14  4:49     ` Bingbu Cao
2020-08-10 14:27 ` [PATCH v5 4/6] media: i2c: imx319: Support probe while the device is off Sakari Ailus
2020-08-10 14:27 ` [PATCH v5 5/6] at24: Support probing while off Sakari Ailus
2020-08-10 14:27 ` [PATCH v5 6/6] Documentation: ACPI: Document allow-low-power-probe _DSD property Sakari Ailus
2020-08-14  4:11 ` [PATCH v5 0/6] Support running driver's probe for a device powered off Bingbu Cao
2020-08-14  6:18   ` Bingbu Cao
2020-08-14 13:17   ` Tomasz Figa
2020-08-18 11:04     ` Sakari Ailus [this message]

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=20200818110459.GR24582@paasikivi.fi.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=bgolaszewski@baylibre.com \
    --cc=bingbu.cao@intel.com \
    --cc=bingbu.cao@linux.intel.com \
    --cc=chiranjeevi.rapolu@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hyungwoo.yang@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rajmohan.mani@intel.com \
    --cc=tfiga@chromium.org \
    --cc=tian.shu.qiu@intel.com \
    --cc=wsa@the-dreams.de \
    /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;
as well as URLs for NNTP newsgroup(s).