All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mmc: core: Add helper for mapping IOS voltage to string
@ 2016-07-12 14:08 Krzysztof Kozlowski
  2016-07-12 14:08 ` [PATCH 2/2] mmc: dw_mmc: Print proper voltage on error Krzysztof Kozlowski
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2016-07-12 14:08 UTC (permalink / raw)
  To: Ulf Hansson, Jaehoon Chung, linux-mmc, linux-kernel
  Cc: Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] mmc: dw_mmc: Print proper voltage on error
  2016-07-12 14:08 [PATCH 1/2] mmc: core: Add helper for mapping IOS voltage to string Krzysztof Kozlowski
@ 2016-07-12 14:08 ` Krzysztof Kozlowski
  2016-07-12 20:23     ` kbuild test robot
  2016-07-13  1:35   ` Jaehoon Chung
  0 siblings, 2 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2016-07-12 14:08 UTC (permalink / raw)
  To: Ulf Hansson, Jaehoon Chung, linux-mmc, linux-kernel
  Cc: Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

The commit 97f659a2e972 ("mmc: dw_mmc: prevent to set the wrong
value") reordered the code so the 'uhs' variable used in
mmc_regulator_set_vqmmc() error message is always 0 at that time thus
always printing 3.3 voltage.  Instead use value obtained from ios in
printed error message.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
---
 drivers/mmc/host/dw_mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index c2a128628b31..7de561065003 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1416,8 +1416,8 @@ static int dw_mci_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
 	ret = mmc_regulator_set_vqmmc(mmc, ios);
 	if (ret) {
 		dev_err(&mmc->class_dev,
-				 "Regulator set error %d - %s V\n",
-				 ret, uhs & v18 ? "1.8" : "3.3");
+				 "Regulator set error %d - %s\n",
+				 ret, mmc_voltage_to_str(ios));
 		return ret;
 	}
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] mmc: dw_mmc: Print proper voltage on error
  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
  1 sibling, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2016-07-12 20:23 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: kbuild-all, Ulf Hansson, Jaehoon Chung, linux-mmc, linux-kernel,
	Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

Hi,

[auto build test ERROR on next-20160712]
[cannot apply to ulf.hansson-mmc/next v4.7-rc7 v4.7-rc6 v4.7-rc5 v4.7-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Krzysztof-Kozlowski/mmc-core-Add-helper-for-mapping-IOS-voltage-to-string/20160712-221741
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

>> ERROR: "mmc_voltage_to_str" [drivers/mmc/host/dw_mmc.ko] undefined!

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 55730 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] mmc: dw_mmc: Print proper voltage on error
@ 2016-07-12 20:23     ` kbuild test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2016-07-12 20:23 UTC (permalink / raw)
  Cc: kbuild-all, Ulf Hansson, Jaehoon Chung, linux-mmc, linux-kernel,
	Krzysztof Kozlowski, Bartlomiej Zolnierkiewicz

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

Hi,

[auto build test ERROR on next-20160712]
[cannot apply to ulf.hansson-mmc/next v4.7-rc7 v4.7-rc6 v4.7-rc5 v4.7-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Krzysztof-Kozlowski/mmc-core-Add-helper-for-mapping-IOS-voltage-to-string/20160712-221741
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

>> ERROR: "mmc_voltage_to_str" [drivers/mmc/host/dw_mmc.ko] undefined!

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 55730 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] mmc: dw_mmc: Print proper voltage on error
  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
  1 sibling, 1 reply; 6+ messages in thread
From: Jaehoon Chung @ 2016-07-13  1:35 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Ulf Hansson, linux-mmc, linux-kernel
  Cc: Bartlomiej Zolnierkiewicz

Hi Krzysztof,

On 07/12/2016 11:08 PM, Krzysztof Kozlowski wrote:
> The commit 97f659a2e972 ("mmc: dw_mmc: prevent to set the wrong
> value") reordered the code so the 'uhs' variable used in
> mmc_regulator_set_vqmmc() error message is always 0 at that time thus
> always printing 3.3 voltage.  Instead use value obtained from ios in
> printed error message.

The commit 97f659a2e972 was dropped because some board didn't work fine.
Some boards didn't use the vqmmc suppy and not defined into device-tree.

It's short time to fix. I will re-send the patch on next.
At that time, i will check this patch.

Best Regards,
Jaehoon Chung

> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index c2a128628b31..7de561065003 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -1416,8 +1416,8 @@ static int dw_mci_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios)
>  	ret = mmc_regulator_set_vqmmc(mmc, ios);
>  	if (ret) {
>  		dev_err(&mmc->class_dev,
> -				 "Regulator set error %d - %s V\n",
> -				 ret, uhs & v18 ? "1.8" : "3.3");
> +				 "Regulator set error %d - %s\n",
> +				 ret, mmc_voltage_to_str(ios));
>  		return ret;
>  	}
>  
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] mmc: dw_mmc: Print proper voltage on error
  2016-07-13  1:35   ` Jaehoon Chung
@ 2016-07-13  7:55     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2016-07-13  7:55 UTC (permalink / raw)
  To: Jaehoon Chung, Ulf Hansson, linux-mmc, linux-kernel
  Cc: Bartlomiej Zolnierkiewicz

On 07/13/2016 03:35 AM, Jaehoon Chung wrote:
> Hi Krzysztof,
> 
> On 07/12/2016 11:08 PM, Krzysztof Kozlowski wrote:
>> The commit 97f659a2e972 ("mmc: dw_mmc: prevent to set the wrong
>> value") reordered the code so the 'uhs' variable used in
>> mmc_regulator_set_vqmmc() error message is always 0 at that time thus
>> always printing 3.3 voltage.  Instead use value obtained from ios in
>> printed error message.
> 
> The commit 97f659a2e972 was dropped because some board didn't work fine.
> Some boards didn't use the vqmmc suppy and not defined into device-tree.
> 
> It's short time to fix. I will re-send the patch on next.
> At that time, i will check this patch.

Ah, okay. If 97f659a2e972 is dropped, there is no need for this patchset.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-07-13  7:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-12 14:08 [PATCH 1/2] mmc: core: Add helper for mapping IOS voltage to string Krzysztof Kozlowski
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-12 20:23     ` kbuild test robot
2016-07-13  1:35   ` Jaehoon Chung
2016-07-13  7:55     ` Krzysztof Kozlowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.