linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/6] Support running driver's probe for a device powered off
@ 2020-01-21 13:41 Sakari Ailus
  2020-01-21 13:41 ` [PATCH v4 1/6] i2c: Allow driver to manage the device's power state during probe Sakari Ailus
                   ` (5 more replies)
  0 siblings, 6 replies; 25+ messages in thread
From: Sakari Ailus @ 2020-01-21 13:41 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Rafael J. Wysocki, linux-acpi, Bingbu Cao,
	linux-media, Chiranjeevi Rapolu, Hyungwoo Yang,
	Bartosz Golaszewski, Arnd Bergmann, linux-kernel,
	Greg Kroah-Hartman, rajmohan.mani, Tomasz Figa

Hi all,

These patches enable calling (and finishing) a driver's probe function
without powering on the respective device on busses where the practice is
to power on the device for probe. While it generally is a driver's job to
check the that the device is there, there are cases where it might be
undesirable. (In this case it stems from a combination of hardware design
and user expectations; see below.) The downside with this change is that
if there is something wrong with the device, it will only be found at the
time the device is used. In this case (the camera sensors + EEPROM in a
sensor) I don't see any tangible harm from that though.

An indication both from the driver and the firmware is required to allow
the device's power state to remain off during probe (see the first patch).


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, Bartosz's at24/for-next, Wolfram's
i2c/for-next as well as Linux media master today; the patches apply to all
without trouble.


since v3 <URL:https://lore.kernel.org/linux-acpi/20200109154529.19484-1-sakari.ailus@linux.intel.com/T/#t>:

- Rework the 2nd patch based on Rafael's comments

	- Rework description of the ACPI low power state helper function,
	  according to Rafael's text.

	- Rename and rework the same function as
	  acpi_dev_state_low_power().

	- Reflect the changes in commit message as well.

- Added a patch to document the probe-low-power _DSD property.

since v2 <URL:https://patchwork.kernel.org/cover/11114255/>:

- Remove extra CONFIG_PM ifdefs; these are not needed.

- Move the checks for power state hints from drivers/base/dd.c to
  drivers/i2c/i2c-base-core.c; these are I²C devices anyway.

- Move the probe_low_power field from struct device_driver to struct
  i2c_driver.

since v1:

- Rename probe_powered_off struct device field as probe_low_power and
  reflect the similar naming to the patches overall.

- Work with CONFIG_PM disabled, too.

Rajmohan Mani (1):
  media: i2c: imx319: Support probe while the device is off

Sakari Ailus (5):
  i2c: Allow driver to manage the device's power state during probe
  ACPI: Add a convenience function to tell a device is in low power
    state
  ov5670: Support probe whilst the device is in a low power state
  at24: Support probing while off
  Documentation: ACPI: Document probe-low-power _DSD property

 .../acpi/dsd/probe-low-power.rst              | 28 +++++++++++++++++
 Documentation/firmware-guide/acpi/index.rst   |  1 +
 drivers/acpi/device_pm.c                      | 31 +++++++++++++++++++
 drivers/i2c/i2c-core-base.c                   | 15 +++++++--
 drivers/media/i2c/imx319.c                    | 23 ++++++++------
 drivers/media/i2c/ov5670.c                    | 23 ++++++++------
 drivers/misc/eeprom/at24.c                    | 31 +++++++++++++------
 include/linux/acpi.h                          |  5 +++
 include/linux/i2c.h                           |  3 ++
 9 files changed, 129 insertions(+), 31 deletions(-)
 create mode 100644 Documentation/firmware-guide/acpi/dsd/probe-low-power.rst

-- 
2.20.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2020-08-12 19:34 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-21 13:41 [PATCH v4 0/6] Support running driver's probe for a device powered off Sakari Ailus
2020-01-21 13:41 ` [PATCH v4 1/6] i2c: Allow driver to manage the device's power state during probe Sakari Ailus
2020-01-29 13:54   ` Bartosz Golaszewski
2020-03-23 21:36     ` Sakari Ailus
2020-01-21 13:41 ` [PATCH v4 2/6] ACPI: Add a convenience function to tell a device is in low power state Sakari Ailus
2020-01-21 16:07   ` Rafael J. Wysocki
2020-01-21 13:41 ` [PATCH v4 3/6] ov5670: Support probe whilst the device is in a " Sakari Ailus
2020-01-21 13:41 ` [PATCH v4 4/6] media: i2c: imx319: Support probe while the device is off Sakari Ailus
2020-01-21 13:41 ` [PATCH v4 5/6] at24: Support probing while off Sakari Ailus
2020-01-29 13:36   ` Bartosz Golaszewski
2020-03-11  8:55     ` Sakari Ailus
2020-03-12 13:10       ` Bartosz Golaszewski
2020-03-23 21:31         ` Sakari Ailus
2020-03-25 13:48           ` Bartosz Golaszewski
2020-08-10  8:25             ` Sakari Ailus
2020-08-10 18:12               ` Bartosz Golaszewski
2020-08-11  8:00                 ` Sakari Ailus
2020-08-12 18:07                   ` Bartosz Golaszewski
2020-08-12 19:25                     ` Wolfram Sang
2020-08-12 19:33                       ` Bartosz Golaszewski
2020-01-21 13:41 ` [PATCH v4 6/6] Documentation: ACPI: Document probe-low-power _DSD property Sakari Ailus
2020-01-21 16:09   ` Rafael J. Wysocki
2020-01-21 16:18     ` Sakari Ailus
2020-01-21 16:56       ` Rafael J. Wysocki
2020-01-21 16:58         ` Sakari Ailus

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).