Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760223AbbLCOSE (ORCPT ); Thu, 3 Dec 2015 09:18:04 -0500 Received: from mga09.intel.com ([134.134.136.24]:9269 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752053AbbLCOSB (ORCPT ); Thu, 3 Dec 2015 09:18:01 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,378,1444719600"; d="scan'208";a="865863987" Subject: Re: [PATCH] mmc: sdhci-acpi: set non-removable in ACPI table To: Philip Elcan , Ulf Hansson , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org References: <1449150480-1173-1-git-send-email-pelcan@codeaurora.org> Cc: linux-arm-msm@vger.kernel.org, Timur Tabi , Jon Masters , Mark Langsdorf From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <56604E57.9000201@intel.com> Date: Thu, 3 Dec 2015 16:14:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1449150480-1173-1-git-send-email-pelcan@codeaurora.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2208 Lines: 70 On 03/12/15 15:48, Philip Elcan wrote: > This allows setting an SDHC controller as non-removable > by using the _RMV method in the ACPI table. It doesn't Is that _RMV on the host controller? Shouldn't it be on the card i.e. child device node? > mark it as non-removable if GPIO card detection is > already setup. > > Signed-off-by: Philip Elcan > --- > drivers/mmc/host/sdhci-acpi.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c > index f6047fc..8c06ba6 100644 > --- a/drivers/mmc/host/sdhci-acpi.c > +++ b/drivers/mmc/host/sdhci-acpi.c > @@ -288,6 +288,20 @@ static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(const char *hid, > return NULL; > } > > +static bool sdhci_acpi_is_removable(acpi_handle handle) > +{ > + acpi_status status; > + unsigned long long removable = 1; /* default to removable */ > + > + if (acpi_has_method(handle, "_EJ0")) > + return true; > + status = acpi_evaluate_integer(handle, "_RMV", NULL, &removable); > + if (ACPI_SUCCESS(status) && !removable) > + return false; > + > + return true; > +} > + > static int sdhci_acpi_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > @@ -300,6 +314,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev) > const char *hid; > const char *uid; > int err; > + bool gpio_cd = false; > > if (acpi_bus_get_device(handle, &device)) > return -ENODEV; > @@ -373,9 +388,14 @@ static int sdhci_acpi_probe(struct platform_device *pdev) > if (mmc_gpiod_request_cd(host->mmc, NULL, 0, v, 0, NULL)) { > dev_warn(dev, "failed to setup card detect gpio\n"); > c->use_runtime_pm = false; > + } else { > + gpio_cd = true; > } > } > > + if (!gpio_cd && !sdhci_acpi_is_removable(handle)) > + host->mmc->caps |= MMC_CAP_NONREMOVABLE; > + > err = sdhci_add_host(host); > if (err) > goto err_free; > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/