From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/5] ACPI: Enable driver and firmware hints to control power at probe time
Date: Wed, 28 Aug 2019 12:57:01 +0300 [thread overview]
Message-ID: <20190828095701.GC7657@paasikivi.fi.intel.com> (raw)
In-Reply-To: <CAJZ5v0jmsPO5m2zBV3_j8LgqQ2Uj6euXUCJgT74L93hZP9nP_A@mail.gmail.com>
Hi Rafael,
On Wed, Aug 28, 2019 at 10:55:42AM +0200, Rafael J. Wysocki wrote:
> On Mon, Aug 26, 2019 at 3:34 PM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > On Mon, Aug 26, 2019 at 01:32:00PM +0300, Sakari Ailus wrote:
> > > Hi Greg,
> > >
> > > On Mon, Aug 26, 2019 at 10:43:43AM +0200, Greg Kroah-Hartman wrote:
> > >
> > > ...
> > >
> > > > > diff --git a/include/linux/device.h b/include/linux/device.h
> > > > > index 6717adee33f01..4bc0ea4a3201a 100644
> > > > > --- a/include/linux/device.h
> > > > > +++ b/include/linux/device.h
> > > > > @@ -248,6 +248,12 @@ enum probe_type {
> > > > > * @owner: The module owner.
> > > > > * @mod_name: Used for built-in modules.
> > > > > * @suppress_bind_attrs: Disables bind/unbind via sysfs.
> > > > > + * @probe_low_power: The driver supports its probe function being called while
> > > > > + * the device is in a low power state, independently of the
> > > > > + * expected behaviour on combination of a given bus and
> > > > > + * firmware interface etc. The driver is responsible for
> > > > > + * powering the device on using runtime PM in such case.
> > > > > + * This configuration has no effect if CONFIG_PM is disabled.
> > > > > * @probe_type: Type of the probe (synchronous or asynchronous) to use.
> > > > > * @of_match_table: The open firmware table.
> > > > > * @acpi_match_table: The ACPI match table.
> > > > > @@ -285,6 +291,7 @@ struct device_driver {
> > > > > const char *mod_name; /* used for built-in modules */
> > > > >
> > > > > bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
> > > > > + bool probe_low_power;
> > > >
> > > > Ick, no, this should be a bus-specific thing to handle such messed up
> > > > hardware. Why polute this in the driver core?
> > >
> > > The alternative could be to make it I²C specific indeed; the vast majority
> > > of camera sensors are I²C devices these days.
> >
> > Why is this even needed to be a bus/device attribute at all? You are
> > checking the firmware property in the probe function, just do the logic
> > there as you are, what needs to be saved to the bus's logic?
>
> The situation today is that all devices are put into D0 by the ACPI
> layer before driver probing since drivers generally expect devices to
> be in D0 when their probe routines run. If the driver is prepared to
> cope with devices in low-power states, though, powering them up before
> probing for a driver may not be necessary, but still the core (or
> generally the code invoking the driver probe) needs to know that the
> driver really is prepared for that. Hence the driver flag AFAICS.
>
> Now, in theory there may be some platform requirements regarding the
> power states of devices during driver probe, although admittedly it is
> not entirely clear to me why that would be the case) and hence the
Please see the cover page of the set (also here):
<URL:https://lkml.org/lkml/2019/8/26/175>
> property. I would think that if the driver could cope with devices in
> low-power states during probe, the platform wouldn't need to worry
> about that.
I understand this as driver deciding whether it'd power on the device
during probe.
That way there's no way to judge whether the device is accessible, and
probe would succeed without an error, which then manifests itself on the
first access of the device. Such as on the at24 EEPROM driver, the error
would take place on first read of the contents, not in probe.
Somebody might consider that as a driver bug.
--
Kind regards,
Sakari Ailus
sakari.ailus@linux.intel.com
next prev parent reply other threads:[~2019-08-28 9:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-26 8:31 [PATCH v2 0/5] Support running driver's probe for a device powered off Sakari Ailus
2019-08-26 8:31 ` [PATCH v2 1/5] ACPI: Enable driver and firmware hints to control power at probe time Sakari Ailus
2019-08-26 8:43 ` Greg Kroah-Hartman
2019-08-26 10:32 ` Sakari Ailus
2019-08-26 13:34 ` Greg Kroah-Hartman
2019-08-26 13:51 ` Sakari Ailus
2019-08-28 8:55 ` Rafael J. Wysocki
2019-08-28 9:57 ` Sakari Ailus [this message]
2019-08-28 12:35 ` Rafael J. Wysocki
2019-08-26 8:46 ` Greg Kroah-Hartman
2019-08-26 10:29 ` Sakari Ailus
2019-08-26 8:31 ` [PATCH v2 2/5] ACPI: Add a convenience function to tell a device is suspended in probe Sakari Ailus
2019-08-26 8:31 ` [PATCH v2 3/5] ov5670: Support probe whilst the device is in a low power state Sakari Ailus
2019-08-26 8:31 ` [PATCH v2 4/5] media: i2c: imx319: Support probe while the device is off Sakari Ailus
2019-08-26 8:31 ` [PATCH v2 5/5] at24: Support probing while off Sakari Ailus
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=20190828095701.GC7657@paasikivi.fi.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.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