From: Philip Elcan <pelcan@codeaurora.org>
To: Ulf Hansson <ulf.hansson@linaro.org>,
Adrian Hunter <adrian.hunter@intel.com>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: linux-arm-msm@vger.kernel.org, Timur Tabi <timur@codeaurora.org>,
Jon Masters <jcm@redhat.org>,
Mark Langsdorf <mlangsdo@redhat.com>,
Philip Elcan <pelcan@codeaurora.org>
Subject: [PATCH] mmc: sdhci-acpi: set non-removable in ACPI table
Date: Thu, 3 Dec 2015 08:48:00 -0500 [thread overview]
Message-ID: <1449150480-1173-1-git-send-email-pelcan@codeaurora.org> (raw)
This allows setting an SDHC controller as non-removable
by using the _RMV method in the ACPI table. It doesn't
mark it as non-removable if GPIO card detection is
already setup.
Signed-off-by: Philip Elcan <pelcan@codeaurora.org>
---
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;
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
next reply other threads:[~2015-12-03 13:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-03 13:48 Philip Elcan [this message]
2015-12-03 14:14 ` [PATCH] mmc: sdhci-acpi: set non-removable in ACPI table Adrian Hunter
2015-12-04 15:40 ` Philip Elcan
2015-12-07 8:30 ` Adrian Hunter
2015-12-10 20:57 ` Philip Elcan
2015-12-11 8:17 ` Adrian Hunter
2015-12-11 22:53 ` Rafael J. Wysocki
[not found] ` <567087F3.7030308@codeaurora.org>
2015-12-16 1:17 ` Rafael J. Wysocki
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=1449150480-1173-1-git-send-email-pelcan@codeaurora.org \
--to=pelcan@codeaurora.org \
--cc=adrian.hunter@intel.com \
--cc=jcm@redhat.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=mlangsdo@redhat.com \
--cc=timur@codeaurora.org \
--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).