linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Mika Westerberg <mika.westerberg@linux.intel.com>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: Greg Kroah-Hartman <greg@kroah.com>,
	David Cohen <david.a.cohen@linux.intel.com>,
	Felipe Balbi <balbi@ti.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	stable <stable@vger.kernel.org>,
	Mathias Nyman <mathias.nyman@linux.intel.com>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Subject: Re: [PATCH] pinctrl: baytrail: show output gpio state correctly on Intel Baytrail
Date: Sat, 15 Nov 2014 00:19:57 +0100	[thread overview]
Message-ID: <3213116.fzuiWWWLrg@vostro.rjw.lan> (raw)
In-Reply-To: <20141114095340.GZ1454@lahna.fi.intel.com>

On Friday, November 14, 2014 11:53:40 AM Mika Westerberg wrote:
> +Rafael
> 
> On Fri, Nov 14, 2014 at 10:39:07AM +0100, Linus Walleij wrote:
> > On Tue, Nov 4, 2014 at 7:57 PM, Mika Westerberg
> > <mika.westerberg@linux.intel.com> wrote:
> > > On Tue, Nov 04, 2014 at 10:05:26AM -0800, David Cohen wrote:
> > 
> > >> It looks we have an implicit dependency to GPIO driver in Bay Trail, and
> > >> having this window until load the module is not acceptable to fulfill
> > >> this implicit dependency.
> > >
> > > It is not implicit at all.
> > >
> > > The user of the GPIO in ACPI DSDT table says something like:
> > >
> > >         Name (_DEP, Package () { \_SB.GPO2 })
> > >
> > > or similar. That is *explicit* dependency. Here \_SB.GPO2 is one of the
> > > GPIO banks.
> > 
> > That's very nice for ACPI. But what do you expect the Linux kernel to
> > do with that?
> 
> It should prevent the driver from probing until all the devices listed
> in _DEP have drivers probed.

Not only or not precisely that.

By the spec, _DEP is supposed to indicate an "operation region dependency",
which means that device A is providing an operation region handler that will
be invoked when AML executed for device B accesses certain things.

In other words, the operation region handler provided by A should be functional
when said AML is invoked for device B.  There are ACPI objects that are required
to not depend on any operation regions with such dependencies and those can be
safely evaluated at any time, but currently we evaluate more than that during
device enumeration alone.  So this affects more than just driver probing even
with the restricted spec-compliant interpretation.

> However, it turned out that this is not that straightforward after all
> :-( For one, it looks like _DEP is used also for non-operation region
> dependencies. This is not in the ACPI spec but we have seen this in real
> machines out there.

Yeah.  _DEP is apparently used to indicate any functional dependencies as
in "device B depends on device A somehow" which has much more far reaching
consequences.  In particular, it implies that A needs to be functional
whenever B is in use, so for example A may not be suspended when B is
active and so on.

> Other thing I heard, is that handling all these dependencies in driver
> core might be nightmare to maintain.

That if we can come up with a way to represent those dependencies in a
sensible way, which hasn't happened yet so far.

> > Basically that is just like getting an -EPROBE_DEFER from the
> > gpiochip when the gpiod_get() call is issued, and you have to wait
> > because the gpiochip is not probed yet. We can solve that at runtime
> > right?
> 
> Yes we can if the driver core prevents probing the driver.
> 
> > I had a discussion with Greg the other day that we have no way of
> > expressing inside the kernel that a resource such as a GPIO, a pin,
> > a clk or a regulator is used by some module. It's just a synchronous
> > gpiod_get() or whatever call, then there is a warning if you remove
> > a gpiochip with gpios still in use.
> > 
> > What is needed to make use of such a dependency mechanism is
> > a way to graph the dependencies between kernel drivers and
> > the resources (gpios, clocks, regulators...) they provide to other
> > drivers, so this information can be used when probing, removing,
> > powering up/down the cluster.
> > 
> > That problem needs to be solved in the device core, until then there
> > is not way to actually use that ACPI _DEP property for what I can
> > tell.
> 
> I agree.

Yup.

> > (On a side note: whoever came up with the idea that ACPI props
> > be 4 characters wide and start with an underscore and this
> > backslash obfuscation needs to... think differently.)

That happened 20+ years ago and the goal was to squeeze an object name
into sizeof(int) amount of memory (on a 32-bit system).  That way names
could be represented by ints.  Yes, people were thinking differently at
that time. :-)

Rafael


  reply	other threads:[~2014-11-14 22:59 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-03 16:55 [PATCH] pinctrl: baytrail: show output gpio state correctly on Intel Baytrail David Cohen
2014-10-13 18:23 ` David Cohen
2014-10-13 19:14   ` Felipe Balbi
2014-10-13 19:24     ` David Cohen
2014-10-13 19:26       ` Felipe Balbi
2014-10-13 19:36         ` Felipe Balbi
2014-10-13 20:19           ` David Cohen
2014-10-28 10:15           ` Linus Walleij
2014-10-28 14:42             ` Felipe Balbi
2014-10-31  8:12               ` Linus Walleij
2014-10-31 13:20                 ` Felipe Balbi
2014-10-31 16:23                   ` David Cohen
2014-10-31 18:45                     ` David Cohen
2014-11-03  9:24                       ` Mika Westerberg
2014-11-03 15:00                         ` Felipe Balbi
2014-11-03 15:27                           ` Mika Westerberg
2014-11-03 15:35                             ` Felipe Balbi
2014-11-03 15:42                             ` Mika Westerberg
2014-11-03 15:50                               ` Felipe Balbi
2014-11-03 18:42                                 ` Mika Westerberg
2014-11-03 20:40                                   ` Felipe Balbi
2014-11-04  7:51                                     ` Mika Westerberg
2014-11-04 14:44                                       ` Felipe Balbi
2014-11-03 22:19                                   ` David Cohen
2014-11-04  7:59                                     ` Mika Westerberg
2014-11-04 18:05                                       ` David Cohen
2014-11-04 18:57                                         ` Mika Westerberg
2014-11-04 19:11                                           ` David Cohen
2014-11-04 19:34                                             ` Mika Westerberg
2014-11-04 21:51                                               ` David Cohen
2014-11-05  8:40                                                 ` Mika Westerberg
2014-11-14  9:40                                                 ` Linus Walleij
2014-11-14  9:39                                           ` Linus Walleij
2014-11-14  9:53                                             ` Mika Westerberg
2014-11-14 23:19                                               ` Rafael J. Wysocki [this message]
2014-11-14  9:30                                   ` Linus Walleij
2014-11-03 15:33                   ` Linus Walleij
2014-10-13 20:16         ` David Cohen
2014-10-14 17:54   ` [PATCH v2] " David Cohen
2014-10-14 18:19     ` Felipe Balbi
2014-10-28 10:17     ` Linus Walleij

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=3213116.fzuiWWWLrg@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=balbi@ti.com \
    --cc=david.a.cohen@linux.intel.com \
    --cc=greg@kroah.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=stable@vger.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;
as well as URLs for NNTP newsgroup(s).