linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rajat Jain <rajatja@google.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Dmitry Torokhov <dtor@google.com>,
	linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Hunter, Adrian" <adrian.hunter@intel.com>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	linux-mmc@vger.kernel.org, Rajat Jain <rajatxjain@gmail.com>
Subject: Re: sdhci driver card-detect is broken because gpiolib can't fallback to _CRS?
Date: Thu, 27 Sep 2018 10:56:39 -0700	[thread overview]
Message-ID: <CACK8Z6HjFy_5sv_ZRRyfRgCYMYPpuoFqmKekyi7fSLk14YpN6w@mail.gmail.com> (raw)
In-Reply-To: <CAHp75VcQ0SviZ6vsn_5inn5oZxxj-5ZQq5bC+bXPxuF8KOa_Rg@mail.gmail.com>

On Thu, Sep 27, 2018 at 12:26 AM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Wed, Sep 26, 2018 at 10:26 PM Rajat Jain <rajatja@google.com> wrote:
> > On Wed, Sep 26, 2018 at 1:42 AM Andy Shevchenko
> > <andy.shevchenko@gmail.com> wrote:
> > > On Wed, Sep 26, 2018 at 10:49 AM Mika Westerberg
> > > <mika.westerberg@linux.intel.com> wrote:
>
> > > > Or you can use con_id=<actual string> everywhere and supply
> > > > acpi_dev_add_driver_gpios() where needed to cover cases where BIOS does
> > > > not provide _DSD.
> >
> > This sounds like a good idea and I'd like to do this. I have some
> > questions though:
> >
> > 1) If the BIOS does provide a _DSD entry for "cd-gpio", and
> > additionally driver also uses devm_acpi_dev_add_driver_gpios() to add
> > one more entry for the same string "cd-gpio", which one will (should?)
> > actually be returned by the gpiolib? The one in BIOS or the one that
> > was added by the driver?
>
> Of course the one that BIOS provides. This hardcoded mapping tables is
> a fallback for *old* BIOSes which do not have _DSD.
>
> > 2) Related, I'm trying to understand how can a driver use
> > devm_acpi_dev_add_driver_gpios(), for *only* the case where the BIOS
> > does not have a _DSD (Or should it really care)? Does the driver need
> > to check for _DSD using some other ACPI call?
>
> The magic happens internally in ACPI core.
> Whenever one calls gpiod_get() with a name on ACPI-enabled platform,
> _DSD would be checked first.

Got it, thanks.

>
> > > See also Documentation/acpi/gpio-properties.txt for
> > > > more information.
>
> > > > In case of SDHCI I think the correct way is to stick using _CRS lookup
> > > > only because there typically is just one GpioInt() and I have not seen a
> > > > single BIOS yet where they implement _DSD for this besides yours. If
> > > > there is not way to change the BIOS implementation then I guess we just
> > > > need to amend the driver to call acpi_dev_add_driver_gpios().
> >
> > Since we shouldn't discourage a BIOS that is trying to do the right
> > thing by exposing the details in _DST, I think it would be preferable
> > if we can solve this in the kernel.
>
> Patches are welcome, I think.
>
> Btw, is there any existing hardware on the market with such BIOS?

Yes, all the chrome books available in the market (at least the ones
released in last 3 years) have same ACPI layout (provide _DSD for
card-detect). They are all working fine today because they use an
older kernel, but if we update them to the latest kernel, this part
will be broken.

Thanks,

Rajat Jain

>
> --
> With Best Regards,
> Andy Shevchenko

  reply	other threads:[~2018-09-27 17:57 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 20:54 sdhci driver card-detect is broken because gpiolib can't fallback to _CRS? Rajat Jain
2018-09-26  7:47 ` Mika Westerberg
2018-09-26  8:42   ` Andy Shevchenko
2018-09-26 19:25     ` Rajat Jain
2018-09-27  7:26       ` Andy Shevchenko
2018-09-27 17:56         ` Rajat Jain [this message]
2018-09-28  8:42           ` Linus Walleij
2018-09-28 12:34             ` Rajat Jain
2018-09-28 13:13               ` Linus Walleij
2018-10-18 21:51                 ` [PATCH] mmc: sdhci-pci: Try "cd" for card-detect lookup before using NULL Rajat Jain
2018-10-19  9:13                   ` Andy Shevchenko
2018-10-22 23:34                     ` Rajat Jain
2018-10-24 10:02                       ` Andy Shevchenko
2018-10-24 18:03                         ` Dmitry Torokhov
2018-10-29 15:23                           ` Andy Shevchenko
2018-10-29 17:22                             ` Rajat Jain
2018-10-29 17:43                               ` Andy Shevchenko
2018-10-29 19:43                                 ` Rajat Jain
2018-10-29 22:17                                   ` [PATCH v2] " Rajat Jain
2018-10-30  7:53                                     ` Adrian Hunter
2018-11-12 11:05                                     ` Ulf Hansson
2018-11-12 11:25                                       ` Andy Shevchenko
2018-11-13  1:26                                         ` Rajat Jain

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=CACK8Z6HjFy_5sv_ZRRyfRgCYMYPpuoFqmKekyi7fSLk14YpN6w@mail.gmail.com \
    --to=rajatja@google.com \
    --cc=adrian.hunter@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=dtor@google.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rajatxjain@gmail.com \
    --cc=ulf.hansson@linaro.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).