Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2330011imm; Thu, 27 Sep 2018 11:00:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV60L+PhIdgSvgMdNzwJ15UebHxPi+4cjZoIpYMjXJ5pfktLOslG+EfYdnXaOx0XrI/sYCGbn X-Received: by 2002:aa7:824d:: with SMTP id e13-v6mr12625647pfn.97.1538071202926; Thu, 27 Sep 2018 11:00:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538071202; cv=none; d=google.com; s=arc-20160816; b=wxyZuE2B4BaGFFjUi1iDMLX9i24gfpXWzyEJnQehEUUxDsDVFd7/pXbawjk8HCtqZZ 5s6iSKjE4weynxO3/1yk4q9tgJuLgL2fk2bGpJhDGPlQ9rm3Qt1q1xil7m5ziPTc7+LF SGV4kFFGy0+4EAmuAKyMaKX/FtSkiOQBIqi2ojs+iSIBCgVx/HmZHrWsIWbUinWoYzLp M6yNvvdmNgsO6WEbv8Jk8w7NlN1Z2zXqZ8regxJlumekz/wX4wwdUcK5KpYNPTibAsY8 u7K6ddLotUMh4YbC6ThUrcUFPSJThiSDBhItGElypFVFMOkNWOY50ZDjMVDj+E2/gdoB RYgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=o/DViyCS5+HLAwKbwRK+27QcwxEuET/Wpo/dzZjQRHA=; b=jPOh2eoBcMeqlKrfniH30ozydoAhFv/xRu7v33speGJcpWLIlcmyh2/v1rlAG766rQ VmvD9i76l8F6GtnK8JVjqsqAAU3C4X/hhHs+UgWB5XQCIm3OAxahBOZ4I+b94B8oXnav 6GughRRbnqlnkADhGv1FWiTZNehIPlQWsRI3t0FyLO8ltobOEG0Xu8WN72e1yZDZTOCZ iOASPZIS3Vzx+Vwm5Ef/QSIjDZaG/abdC9RR3QAxpq8xtqRxs5DH55SsaCLHons3Movf Yzr20KdAfovHjYP9jmncYeAhCuzhyhFTcLyZ110rKGGTR9dXhgf7FEVCDwIL/zyhirde 5YLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SsJ5SeMy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s26-v6si2545527pge.339.2018.09.27.10.59.37; Thu, 27 Sep 2018 11:00:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=SsJ5SeMy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728422AbeI1AQn (ORCPT + 99 others); Thu, 27 Sep 2018 20:16:43 -0400 Received: from mail-yw1-f68.google.com ([209.85.161.68]:40010 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728251AbeI1AQm (ORCPT ); Thu, 27 Sep 2018 20:16:42 -0400 Received: by mail-yw1-f68.google.com with SMTP id z143-v6so1455142ywa.7 for ; Thu, 27 Sep 2018 10:57:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=o/DViyCS5+HLAwKbwRK+27QcwxEuET/Wpo/dzZjQRHA=; b=SsJ5SeMy0aGwbWJyO4s2OHDgJ+aznIbnubaFotEs8xg0AAw2BnmNI6+0pYOGz1dDMB pxdhZZ2ys8/OPUM3zBnH4AGkcGdVXhSMuQQhS1aMBh2Cp334pjiOKLXLtki58CfsUNVO w7tdNLFjxTawVmO2XsH1WCCbMr4UMjidgprMeBlihXC5iipHJEolATQzhJs8oXGB5Fir MXo9SkFEhOFcidOyMEqZ96T+rLehnxavjjdd4P9zSmhujvgsIGto6Bk+IArwDRHsQciT Aej8CwRf4vrEtvEaT/dbjqa8Fs5jGIIBXIOMc3zk6QMKy2gNyLkiVzq1Fzz9tTPP0zRy kDVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=o/DViyCS5+HLAwKbwRK+27QcwxEuET/Wpo/dzZjQRHA=; b=ITIMGbpEDlfSYncXM1cGK92xCUNThBfZMSBtjytvy4K3DGZO4GYUP7RnUVzjGnIULk o65iktV3PD0hVMYc30xRQj56Gdm+0UrisqAUVaVA4/tKNELbvGG3R0ez+5giVAYnpY6O Ry2nKuzE0a+HisLvNdiK/Yw2vGdaI7pJmJI2JOFzolmUtmfBvI4IZPTmKJwQVgET4jCt f0b03RkKtehUcDGypxhjGejTV4U4epqyJuYGnqWR8GEVllXsXgFF8B9znmm9cR75AVqq PKkPYPah11Lk4qCtipXcmyyo2NnmL6YS5NNa+mr/9l0td7PIb61WvTchWTG3oSEPEkBN BrZg== X-Gm-Message-State: ABuFfog0U1WfVZqhxRr5oNs6tzt9/76fDlO0mAKPvjau3+sV8b25KpUy A1dwp/uHannUYl1+LfMTMdNQFy2q/RJSwQ2GSHwuFw== X-Received: by 2002:a0d:df8d:: with SMTP id i135-v6mr6279590ywe.349.1538071036696; Thu, 27 Sep 2018 10:57:16 -0700 (PDT) MIME-Version: 1.0 References: <20180926074756.GD2664@lahna.fi.intel.com> In-Reply-To: From: Rajat Jain Date: Thu, 27 Sep 2018 10:56:39 -0700 Message-ID: Subject: Re: sdhci driver card-detect is broken because gpiolib can't fallback to _CRS? To: Andy Shevchenko Cc: Mika Westerberg , Andy Shevchenko , Linus Walleij , Dmitry Torokhov , linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org, Linux Kernel Mailing List , "Hunter, Adrian" , Ulf Hansson , linux-mmc@vger.kernel.org, Rajat Jain Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 27, 2018 at 12:26 AM Andy Shevchenko wrote: > > On Wed, Sep 26, 2018 at 10:26 PM Rajat Jain wrote: > > On Wed, Sep 26, 2018 at 1:42 AM Andy Shevchenko > > wrote: > > > On Wed, Sep 26, 2018 at 10:49 AM Mika Westerberg > > > wrote: > > > > > Or you can use con_id= 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