From: Vijay Viswanath <vviswana@codeaurora.org>
To: adrian.hunter@intel.com, ulf.hansson@linaro.org
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
shawn.lin@rock-chips.com, linux-arm-msm@vger.kernel.org,
georgi.djakov@linaro.org, asutoshd@codeaurora.org,
stummala@codeaurora.org, venkatg@codeaurora.org,
jeremymc@redhat.com, vviswana@codeaurora.org,
bjorn.andersson@linaro.org, riteshh@codeaurora.org,
vbadigan@codeaurora.org, dianders@google.com,
sayalil@codeaurora.org
Subject: [PATCH RFC 3/4] host: sdhci: fix current caps when there is no host->vmmc
Date: Tue, 1 May 2018 16:09:12 +0530 [thread overview]
Message-ID: <1525171153-24476-4-git-send-email-vviswana@codeaurora.org> (raw)
In-Reply-To: <1525171153-24476-1-git-send-email-vviswana@codeaurora.org>
From: Sahitya Tummala <stummala@codeaurora.org>
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().
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Sayali Lokhande <sayalil@codeaurora.org>
[vviswana@codeaurora.org: fixed trivial merge conflicts]
Signed-off-by: Vijay Viswanath <vviswana@codeaurora.org>
Change-Id: I3370a2411beec1f03cc5f102bf95cd816c60351e
---
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 0d5fcca..edc2ccd 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -3570,10 +3570,15 @@ int sdhci_setup_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 54bc444..a01af78 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -584,6 +584,7 @@ struct sdhci_ops {
void (*adma_workaround)(struct sdhci_host *host, u32 intmask);
void (*card_event)(struct sdhci_host *host);
void (*voltage_switch)(struct sdhci_host *host);
+ unsigned int (*get_current_limit)(struct sdhci_host *host);
};
#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
next prev parent reply other threads:[~2018-05-01 10:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-01 10:39 [PATCH RFC 0/4] Changes for SDCC5 version Vijay Viswanath
2018-05-01 10:39 ` [PATCH RFC 1/4] mmc: host: Register changes for sdcc V5 Vijay Viswanath
2018-05-02 8:28 ` Ulf Hansson
2018-05-03 9:37 ` Vijay Viswanath
2018-05-01 10:39 ` [PATCH RFC 2/4] mmc: sdhci-msm: Add and use voltage regulator related APIs Vijay Viswanath
2018-05-02 8:49 ` Ulf Hansson
2018-05-03 9:39 ` Vijay Viswanath
2018-05-01 10:39 ` Vijay Viswanath [this message]
2018-05-01 10:39 ` [PATCH RFC 4/4] host: sdhci-msm: implement get_current_limit() host op Vijay Viswanath
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=1525171153-24476-4-git-send-email-vviswana@codeaurora.org \
--to=vviswana@codeaurora.org \
--cc=adrian.hunter@intel.com \
--cc=asutoshd@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=dianders@google.com \
--cc=georgi.djakov@linaro.org \
--cc=jeremymc@redhat.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=riteshh@codeaurora.org \
--cc=sayalil@codeaurora.org \
--cc=shawn.lin@rock-chips.com \
--cc=stummala@codeaurora.org \
--cc=ulf.hansson@linaro.org \
--cc=vbadigan@codeaurora.org \
--cc=venkatg@codeaurora.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).