Merge "host: sdhci: fix current caps when there is no host->vmmc"

This commit is contained in:
Linux Build Service Account 2016-08-26 22:22:58 -07:00 committed by Gerrit - the friendly Code Review server
commit 844331baa5
2 changed files with 9 additions and 3 deletions
drivers/mmc/host

View file

@ -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;

View file

@ -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