From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Ulf Hansson <ulf.hansson@linaro.org>,
Jaehoon Chung <jh80.chung@samsung.com>,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: [PATCH 1/2] mmc: core: Add helper for mapping IOS voltage to string
Date: Tue, 12 Jul 2016 16:08:21 +0200 [thread overview]
Message-ID: <1468332502-28016-1-git-send-email-k.kozlowski@samsung.com> (raw)
Add a helper for producing a user-friendly string with chosen signaling
voltage.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
drivers/mmc/core/debugfs.c | 15 +--------------
drivers/mmc/core/host.c | 13 +++++++++++++
include/linux/mmc/host.h | 2 ++
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index c8451ce557ae..1b669cafea12 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -157,20 +157,7 @@ static int mmc_ios_show(struct seq_file *s, void *data)
}
seq_printf(s, "timing spec:\t%u (%s)\n", ios->timing, str);
- switch (ios->signal_voltage) {
- case MMC_SIGNAL_VOLTAGE_330:
- str = "3.30 V";
- break;
- case MMC_SIGNAL_VOLTAGE_180:
- str = "1.80 V";
- break;
- case MMC_SIGNAL_VOLTAGE_120:
- str = "1.20 V";
- break;
- default:
- str = "invalid";
- break;
- }
+ str = mmc_voltage_to_str(ios);
seq_printf(s, "signal voltage:\t%u (%s)\n", ios->signal_voltage, str);
switch (ios->drv_type) {
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index d7e86f9b3dab..6708bea84a0d 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -469,3 +469,16 @@ void mmc_free_host(struct mmc_host *host)
}
EXPORT_SYMBOL(mmc_free_host);
+
+const char *mmc_voltage_to_str(struct mmc_ios *ios)
+{
+ static const char * const voltages[] = {
+ [MMC_SIGNAL_VOLTAGE_330] = "3.30 V",
+ [MMC_SIGNAL_VOLTAGE_180] = "1.80 V",
+ [MMC_SIGNAL_VOLTAGE_120] = "1.20 V",
+ };
+
+ if (ios->signal_voltage <= MMC_SIGNAL_VOLTAGE_120)
+ return voltages[ios->signal_voltage];
+ return "invalid";
+}
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index aa4bfbf129e4..e1e87d3432d8 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -544,4 +544,6 @@ static inline void mmc_retune_recheck(struct mmc_host *host)
void mmc_retune_pause(struct mmc_host *host);
void mmc_retune_unpause(struct mmc_host *host);
+const char *mmc_voltage_to_str(struct mmc_ios *ios);
+
#endif /* LINUX_MMC_HOST_H */
--
1.9.1
next reply other threads:[~2016-07-12 14:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-12 14:08 Krzysztof Kozlowski [this message]
2016-07-12 14:08 ` [PATCH 2/2] mmc: dw_mmc: Print proper voltage on error Krzysztof Kozlowski
2016-07-12 20:23 ` kbuild test robot
2016-07-13 1:35 ` Jaehoon Chung
2016-07-13 7:55 ` Krzysztof Kozlowski
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=1468332502-28016-1-git-send-email-k.kozlowski@samsung.com \
--to=k.kozlowski@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=jh80.chung@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.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
all inboxes | Powered by JetHome®