From 53688837e03b04dc3d0ad172a7bc62224090aaef Mon Sep 17 00:00:00 2001 From: Sahitya Tummala Date: Fri, 19 Sep 2014 15:43:37 +0530 Subject: host: sdhci: fix current caps when there is no host->vmmc When the regulators are not managed by SDHCI host driver (i.e., when host->vmmc and host->vmmcq are absent), get the regulator current capabilities through a new host op get_current_limit(). Change-Id: I097349ad4d2e8ffbafbeb5fe65910894fe909bd6 Signed-off-by: Sahitya Tummala Signed-off-by: Sayali Lokhande --- drivers/mmc/host/sdhci.c | 11 ++++++++--- drivers/mmc/host/sdhci.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 5f7eac922c54..14ed8e775e6a 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -4076,10 +4076,15 @@ int sdhci_add_host(struct sdhci_host *host) * value. */ max_current_caps = sdhci_readl(host, SDHCI_MAX_CURRENT); - if (!max_current_caps && !IS_ERR(mmc->supply.vmmc)) { - int curr = regulator_get_current_limit(mmc->supply.vmmc); - if (curr > 0) { + if (!max_current_caps) { + u32 curr = 0; + + if (!IS_ERR(mmc->supply.vmmc)) + curr = regulator_get_current_limit(mmc->supply.vmmc); + else if (host->ops->get_current_limit) + curr = host->ops->get_current_limit(host); + if (curr > 0) { /* convert to SDHCI_MAX_CURRENT format */ curr = curr/1000; /* convert to mA */ curr = curr/SDHCI_MAX_CURRENT_MULTIPLIER; diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index a1f9c48879fa..6ef2005c8d4c 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -687,6 +687,7 @@ struct sdhci_ops { void (*init)(struct sdhci_host *host); void (*pre_req)(struct sdhci_host *host, struct mmc_request *req); void (*post_req)(struct sdhci_host *host, struct mmc_request *req); + unsigned int (*get_current_limit)(struct sdhci_host *host); }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS -- cgit v1.2.3