Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp909653ima; Wed, 24 Oct 2018 11:05:30 -0700 (PDT) X-Google-Smtp-Source: AJdET5d1aiD6pOLQknezfBVp1gU7tVLmS+tabpNQbR19J1CZG67KRDKsjGAjiSI7P1LEKayonFh+ X-Received: by 2002:a63:36c8:: with SMTP id d191-v6mr3410656pga.404.1540404330189; Wed, 24 Oct 2018 11:05:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540404330; cv=none; d=google.com; s=arc-20160816; b=sUOJd1pfLnMis0k7H97P37wcZ3M38fyq+ecJym3BY1yGM3W1ejUevrrt7iF0fKS1xJ 8cw9GFk4vqhgQbI0K81jFgNMRyfkbb/f/OgHAdtVebBoQ8qclmJkQrcDZxkn0iXt/o0H DgaN5CEFETvllbAe47PPpRveVHR0ndTRuieF50EWLPDvLWlIiXAMnEvIeXoUPt+YInCm It2T3pTS0PXFp8stuUBjp2lzMKMskBVecAn9WakA0+BJodrtf3WDKMkOjDMTkawLLLqr ndrk2v7wLjon8Z1krznnsyxGBtkBzwM5toRFm4kJZSh4JigApImQxxb5KEdlo+IfePtU cWgQ== 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=yyeDmCSlXt4k5qqsuNoj/4ImCIWV/mNaDeLP7Ex/lzI=; b=vhc5fbBpTGEjYU7PrDUaOWqkkt+DHCoJRWshlj3KqpUkbaovhj8/OROmG5q9qHWIQd Yego0SSvqB9rDSPtJFvfpiuISbG9xW96QcCZueF0unsLWcHH+Shv/BKnJ+eOYlLzt+eV XPoNfuEELkUX6BEhkGZzvCou4Nupp8q8NBKVNFyHSe4r88ydST7qUrLHngWwKbnPTxfC 4gdg76xdYq9xPLx/3+Lt0DMB72sJ0NXzedUuXsM2gE/KYbdlJALQ7CxLllxjMFen+U/b TiXYFMrnAlaQJ+EPtjYNjiXt2TzTZjVgesdLCF1auA3GpeOBWhUDHpb6ZbXhzD2xeMU4 ZC1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=KQXVQpIM; 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 w22-v6si5372716plk.377.2018.10.24.11.05.13; Wed, 24 Oct 2018 11:05:30 -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=KQXVQpIM; 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 S1727033AbeJYCc1 (ORCPT + 99 others); Wed, 24 Oct 2018 22:32:27 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:34363 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726912AbeJYCc1 (ORCPT ); Wed, 24 Oct 2018 22:32:27 -0400 Received: by mail-lf1-f66.google.com with SMTP id n26-v6so4710402lfl.1 for ; Wed, 24 Oct 2018 11:03:23 -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=yyeDmCSlXt4k5qqsuNoj/4ImCIWV/mNaDeLP7Ex/lzI=; b=KQXVQpIMqwEiliZLpAuDEMXlck745+uLVVQYJ0AMQkYRq3BgFOhxq/q7z6uuF4tkVR 95wEWZR8zvxg4NUIdAzFeyfBKLhvSMeUfCqYTi4MZQEeS0M/1zaCqK93+Gyb9KObr0g5 owpaoHZ59OrxlRxRF5iG6v9z8cj1eVPOW7NasYL7Za78EjPJ50g7FGsDAezdo+BWTBHq h6vTxIzpdn5fh7LoG6bAYe++c+DjMbrC5/Rhnd1HHV9B6XyFRNMK5mp5mddjqNI46Ipy E0hW7NlRaF7lLE5ZL4EPso7/0JwBrup7LHONQ1yp8ZdDYMSuBBh3ZxRi84f1/YDAHRZd 34Dg== 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=yyeDmCSlXt4k5qqsuNoj/4ImCIWV/mNaDeLP7Ex/lzI=; b=m+NHD3QmacwPySGqsxAVIU5/moRakhULItxmHCYEfKz5g4HklMoDJC1TBzCkTVDxw1 R0a4d8kC2tK7qqZLd0dxjUm0Dq4KxfCUYIboxO7UaNwAfhduw1YsJQxE0Z/U5k6dVC8o VaHUmxPWRL/H8tqMIuhGA+naCFZgz46NAYGHCI1iHqZ1W+GwfmUEv3k+T+CMg2aI4g1k 9AXS2sU1ckRPhENkVXtagwNfAY+5lSo6K21bcsCU2w7Jgvh4dTZPxbD83FKMeK7FRKl6 5aSQ+wg9Wgdey/wdsEKomkZg2jttDWhyUXFwuMlSyT2CjBN1wT/Xz+4x+2R8kglt6xIM VbMw== X-Gm-Message-State: AGRZ1gLERYV6AgLoWCs+ak0VoRfZZyPeJxcjpqyvkGWXdqxhktFACRlA kvJ6LyubA7wg9PL9tXfrWnQrHz9UOw1NDkHhIyR/OQ== X-Received: by 2002:a19:3809:: with SMTP id f9mr2424330lfa.148.1540404202573; Wed, 24 Oct 2018 11:03:22 -0700 (PDT) MIME-Version: 1.0 References: <20181018215101.169847-1-rajatja@google.com> <20181024100230.GQ10650@smile.fi.intel.com> In-Reply-To: <20181024100230.GQ10650@smile.fi.intel.com> From: Dmitry Torokhov Date: Wed, 24 Oct 2018 11:03:11 -0700 Message-ID: Subject: Re: [PATCH] mmc: sdhci-pci: Try "cd" for card-detect lookup before using NULL To: andy.shevchenko@gmail.com Cc: Rajat Jain , adrian.hunter@intel.com, Ulf Hansson , linux-mmc@vger.kernel.org, Linus Walleij , rajatxjain@gmail.com, lkml , Mika Westerberg , linux-gpio@vger.kernel.org, ACPI Devel Maling List 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 Hi Andy, On Wed, Oct 24, 2018 at 3:02 AM Andy Shevchenko wrote: > > On Mon, Oct 22, 2018 at 04:34:55PM -0700, Rajat Jain wrote: > > On Fri, Oct 19, 2018 at 2:13 AM Andy Shevchenko > > wrote: > > > On Fri, Oct 19, 2018 at 12:53 AM Rajat Jain wrote: > > > > > across other users of this API (other MMC host controller drivers). > > > > > > > if (slot->cd_idx >= 0) { > > > > - ret = mmc_gpiod_request_cd(host->mmc, NULL, slot->cd_idx, > > > > + ret = mmc_gpiod_request_cd(host->mmc, "cd", slot->cd_idx, > > > > slot->cd_override_level, 0, NULL); > > > > > > Yes. > > > > > > > + if (ret && ret != -EPROBE_DEFER) > > > > + ret = mmc_gpiod_request_cd(host->mmc, NULL, > > > > + slot->cd_idx, > > > > + slot->cd_override_level, > > > > + 0, NULL); > > > > > > And no. Instead of this part you need to provide an ACPI GPIO mapping table. > > > > Sure, I am willing to do so, and I tried earlier too. However, certain > > doubts arose in my mind when I tried that and I posted my questions > > earlier (https://lkml.org/lkml/2018/9/28/507) but couldn't elicit any > > response. Unfortunately I still do not have answers. My primary > > questions are: > > > > 1) - It seems that 1 SDHCI device may support multiple slots (looking > > at the code). It is not clear to me if they could share card detect > > interrupts, or should have separate ones? > > This is more likely question to HW engineers of your platform with a caveat > that there should be a way to distinguish exact slot in which card is being > inserted. > > > Also, the driver may not > > really know? > > I think in such case the bug in HW design and / or driver. Why? You can have a shared or dedicated interrupt and the driver does not really need to know if it can poll the status. > > > So should I add 1 or two pins using the > > devm_acpi_dev_add_driver_gpios(). > > This depends on the above, e.g. HW design, ACPI tables. Yes, it depends on the HW design and that is exactly why the approach with devm_acpi_dev_add_driver_gpios() does not work well here: this is a generic driver used on many platforms and you are trying to put the platform knowledge into the driver. Here we are lucky I guess as I do not believe anyone is using more than one slot, so we can have a tavle with a single entry, but actually doing the fallback the way Rajat was proposing is more correct. Or you have a table with N entries, where N is hopefully sufficiently large. > > > > Is some one familiar with SDHC > > driver can answer these questions, it shall be great. > > Actually above questions better to ask in linux-mmc mailing list, which by the > fact is in Cc list already. So, wait for someone to clarify. > > > > 2) I'm not really sure what should I set "active_low" to? Isn't this > > something that should be specified by platform / ACPI too, and driver > > should just be able to say say choose whatever the ACPI says? > > > > struct acpi_gpio_params { > > unsigned int crs_entry_index; > > unsigned int line_index; > > bool active_low; > > }; > > > ACPI specification misses this property, that's why we have it in the > structure. In your case it should be provided by _DSD and thus be consistent > with the hardcoded values. Again, you think as if the driver was platform specific; it is not. I have 1000s of systems with different ACPI tables. Let's say half of them use one polarity, and half another. Which polarity do you propose to use? Thanks. -- Dmitry