Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1683840imm; Thu, 27 Sep 2018 00:27:17 -0700 (PDT) X-Google-Smtp-Source: ACcGV61GxdeyG6RbbqKAvkbQTNky8KFbNODasIU6rIBuDGsB/2uJu73OFKEKdC4or6BZPwhFG95h X-Received: by 2002:a17:902:bc8b:: with SMTP id bb11-v6mr9417970plb.112.1538033237056; Thu, 27 Sep 2018 00:27:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538033237; cv=none; d=google.com; s=arc-20160816; b=xCKuhPYQd4wvYR2JDc+yP2Ztwh6Djug1aNlXy7XylNpwn1VVtfMl/r3R+s7Aey+AJ3 zDMlabgGTRR7pxrHINkCRFoTTAgA8kwHnI+87aGyBl1uGk0FUjU3kyq/oJ1nT9PC+AJS uEs+1VvRyLs/c5lhiyLLJa7+DPGx1E7cJtXCCQDeOnWOHYCFnA0lyQSN5BMtA0ueytoN eKCrNhE+vgjcSWAW9oUZt7vShrocxv4n64AWRJdcL85FEvvH/zZaMlamikMf7bPmifBO k7LRD1hk9pF5X16vcd+KdVCPQvzh59pU2YyRajKkgEbGg2cKTM9jyBwAuWXTtH4vfDwf eo4w== 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=QIjr7lA69Q6T8Q3M0NSjP0c34DQtTrjB+YLR9/BpnLo=; b=iRpvR7nI4P5sou+HVI30PPrwLmg+f0KkvH3tJEvrtwih2ty1Dbi/yYb1B5WLUcZlO9 aFpLiyLyNe9fUhDtIFmJZC3ynW0kTM67gLwjtnGE4i0O2oVf0Do/Kkpf7oBZUOKIZm8I E1VnIu0ttwr2/kL/zh5v26iNK2KI/f+Bj8JDcQWMHBRD0eoDAAat+uC48XA4XXRJJ2vj 2+40zDI1DBTBxY462RXyqs+NMtxR+SeGl4EVT06eQjiAgwz5pD6CNZS3u+HYAOHwYrVH RjKqbFEkHESsE1SSxhnK+Fhu+8pHPEbDpZc376qCsNPSFJZ8CpD595AEEncPgMZbnz5u 3SIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nZw3VcjU; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2-v6si1297283plk.325.2018.09.27.00.27.01; Thu, 27 Sep 2018 00:27:17 -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=@gmail.com header.s=20161025 header.b=nZw3VcjU; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727090AbeI0Nnp (ORCPT + 99 others); Thu, 27 Sep 2018 09:43:45 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:34804 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726952AbeI0Nnp (ORCPT ); Thu, 27 Sep 2018 09:43:45 -0400 Received: by mail-qk1-f194.google.com with SMTP id 80-v6so999401qkj.1; Thu, 27 Sep 2018 00:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QIjr7lA69Q6T8Q3M0NSjP0c34DQtTrjB+YLR9/BpnLo=; b=nZw3VcjUVRX49lo3HpsIAjUG2uOgAxI3V2SvTt1nO7ah1p9eFkVhG9UzFqEP4PsnQm 0QJ5vtjehvcvKwXf47mhwiJlYHccKzV0x5Gz4QP+upPC+a07X77xr8woHB9h1mS42RUV xOWDlSa/M93TnD8pkGFtjsX06OHrBZCZfJLzgCA3t2/jYD9IQqiXhe9ceOD3/SB+Xpft E1KfN34ZWzpmfdg04FE93KrEsjl37T3y8BDgkkfg0ySfIiitIc+CnUwNS2JnrKWojf4Q 8hgbjd10fPe5rD0j4dAgrIddrUQYvsk1//cESHYiCoFLNI6Qkxyh1EHmWDRLnlvflMKs 6w3Q== 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=QIjr7lA69Q6T8Q3M0NSjP0c34DQtTrjB+YLR9/BpnLo=; b=I132AihTUAB7WsiEv0RWWibCSkTtBKrHk7zHxNuWHzuAslGxSLWuAzO1YDT/F5lVhI 2Zw/tkYh/h13x5RSZzjHscBWh7bQ2FP6VQUviXPEGj1cGqlqLW+Blrh9Ch2Py2eXaBoe 8mrjpQPEKlqKTSFA1qjB8LxNz9DZ6Zwo18MUCxnMA8ky4BSvBxAmRoidp8LYbnOUpmmV NR5F5sUXPYz+rqK585DRlYJDjZzV+VdQ70eX19fInRWqFRK6Oq810vagD++OJD2lIbCD IZf+aZJS8znGBUtp171te6Bv5izmr18fVROPaPY2s2CDJwzz1gtRfRHRkiueczukUaTK /P9Q== X-Gm-Message-State: ABuFfogkBrXD5WPDJ+uB3uSIDVKoXN+lauz9063+ToDmksXozzBasjSi MzEzeNZTYHA3U2bPsqYqkrUyDfwICuLzYIemTBc= X-Received: by 2002:a37:4712:: with SMTP id u18-v6mr7016515qka.301.1538033213589; Thu, 27 Sep 2018 00:26:53 -0700 (PDT) MIME-Version: 1.0 References: <20180926074756.GD2664@lahna.fi.intel.com> In-Reply-To: From: Andy Shevchenko Date: Thu, 27 Sep 2018 10:26:42 +0300 Message-ID: Subject: Re: sdhci driver card-detect is broken because gpiolib can't fallback to _CRS? To: Rajat Jain Cc: Mika Westerberg , Andy Shevchenko , Linus Walleij , Dmitry Torokhov , "open list:GPIO SUBSYSTEM" , ACPI Devel Maling List , Linux Kernel Mailing List , Adrian Hunter , Ulf Hansson , linux-mmc , 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 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. > > 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? -- With Best Regards, Andy Shevchenko