diff mbox

[v3,02/11] mmc: sdhci: set regulator min/max voltage according to spec

Message ID 1348569546-13242-3-git-send-email-keyuan.liu@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Kevin Liu Sept. 25, 2012, 10:38 a.m. UTC
From: Kevin Liu <kliu5@marvell.com>

Use voltage range as below rather than a specific value
3.3v: (3.2v, 3.4v)
3.0v: (2.9v, 3.1v)
1.8v: (1.65v, 1.95v)

Signed-off-by: Jialing Fu <jlfu@marvell.com>
Signed-off-by: Kevin Liu <kliu5@marvell.com>
---
 drivers/mmc/host/sdhci.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

Comments

Girish K S Sept. 25, 2012, 2:55 p.m. UTC | #1
On 25 September 2012 19:38, Kevin Liu <keyuan.liu@gmail.com> wrote:
> From: Kevin Liu <kliu5@marvell.com>
>
> Use voltage range as below rather than a specific value
> 3.3v: (3.2v, 3.4v)
> 3.0v: (2.9v, 3.1v)
> 1.8v: (1.65v, 1.95v)
Any specific reason to give range and not specific value?
>
> Signed-off-by: Jialing Fu <jlfu@marvell.com>
> Signed-off-by: Kevin Liu <kliu5@marvell.com>
> ---
>  drivers/mmc/host/sdhci.c |   18 +++++++++---------
>  1 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 2f844e5..f50efa6 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1628,7 +1628,7 @@ static int sdhci_do_3_3v_signal_voltage_switch(struct sdhci_host *host,
>         sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2);
>
>         if (host->vqmmc) {
> -               ret = regulator_set_voltage(host->vqmmc, 3300000, 3300000);
> +               ret = regulator_set_voltage(host->vqmmc, 3200000, 3400000);
>                 if (ret) {
>                         pr_warning("%s: Switching to 3.3V signalling voltage "
>                                    " failed\n", mmc_hostname(host->mmc));
> @@ -1672,7 +1672,7 @@ static int sdhci_do_1_8v_signal_voltage_switch(struct sdhci_host *host,
>                  */
>                 if (host->vqmmc)
>                         ret = regulator_set_voltage(host->vqmmc,
> -                               1800000, 1800000);
> +                               1650000, 1950000);
>                 else
>                         ret = 0;
>
> @@ -2856,7 +2856,7 @@ int sdhci_add_host(struct sdhci_host *host)
>                 pr_info("%s: no vqmmc regulator found\n", mmc_hostname(mmc));
>                 host->vqmmc = NULL;
>         }
> -       else if (regulator_is_supported_voltage(host->vqmmc, 1800000, 1800000))
> +       else if (regulator_is_supported_voltage(host->vqmmc, 1650000, 1950000))
>                 regulator_enable(host->vqmmc);
>         else
>                 caps[1] &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |
> @@ -2927,16 +2927,16 @@ int sdhci_add_host(struct sdhci_host *host)
>
>  #ifdef CONFIG_REGULATOR
>         if (host->vmmc) {
> -               ret = regulator_is_supported_voltage(host->vmmc, 3300000,
> -                       3300000);
> +               ret = regulator_is_supported_voltage(host->vmmc, 3200000,
> +                       3400000);
>                 if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_330)))
>                         caps[0] &= ~SDHCI_CAN_VDD_330;
> -               ret = regulator_is_supported_voltage(host->vmmc, 3000000,
> -                       3000000);
> +               ret = regulator_is_supported_voltage(host->vmmc, 2900000,
> +                       3100000);
>                 if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_300)))
>                         caps[0] &= ~SDHCI_CAN_VDD_300;
> -               ret = regulator_is_supported_voltage(host->vmmc, 1800000,
> -                       1800000);
> +               ret = regulator_is_supported_voltage(host->vmmc, 1650000,
> +                       1950000);
>                 if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_180)))
>                         caps[0] &= ~SDHCI_CAN_VDD_180;
>         }
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kevin Liu Sept. 25, 2012, 3:46 p.m. UTC | #2
2012/9/25 Girish K S <girish.shivananjappa@linaro.org>:
> On 25 September 2012 19:38, Kevin Liu <keyuan.liu@gmail.com> wrote:
>> From: Kevin Liu <kliu5@marvell.com>
>>
>> Use voltage range as below rather than a specific value
>> 3.3v: (3.2v, 3.4v)
>> 3.0v: (2.9v, 3.1v)
>> 1.8v: (1.65v, 1.95v)
> Any specific reason to give range and not specific value?

Regulator voltage setting with specific value may fail if the
regulator didn't support the specific voltage. But the range should be
acceptable according to the spec.

Thanks
Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 2f844e5..f50efa6 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1628,7 +1628,7 @@  static int sdhci_do_3_3v_signal_voltage_switch(struct sdhci_host *host,
 	sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2);
 
 	if (host->vqmmc) {
-		ret = regulator_set_voltage(host->vqmmc, 3300000, 3300000);
+		ret = regulator_set_voltage(host->vqmmc, 3200000, 3400000);
 		if (ret) {
 			pr_warning("%s: Switching to 3.3V signalling voltage "
 				   " failed\n", mmc_hostname(host->mmc));
@@ -1672,7 +1672,7 @@  static int sdhci_do_1_8v_signal_voltage_switch(struct sdhci_host *host,
 		 */
 		if (host->vqmmc)
 			ret = regulator_set_voltage(host->vqmmc,
-				1800000, 1800000);
+				1650000, 1950000);
 		else
 			ret = 0;
 
@@ -2856,7 +2856,7 @@  int sdhci_add_host(struct sdhci_host *host)
 		pr_info("%s: no vqmmc regulator found\n", mmc_hostname(mmc));
 		host->vqmmc = NULL;
 	}
-	else if (regulator_is_supported_voltage(host->vqmmc, 1800000, 1800000))
+	else if (regulator_is_supported_voltage(host->vqmmc, 1650000, 1950000))
 		regulator_enable(host->vqmmc);
 	else
 		caps[1] &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |
@@ -2927,16 +2927,16 @@  int sdhci_add_host(struct sdhci_host *host)
 
 #ifdef CONFIG_REGULATOR
 	if (host->vmmc) {
-		ret = regulator_is_supported_voltage(host->vmmc, 3300000,
-			3300000);
+		ret = regulator_is_supported_voltage(host->vmmc, 3200000,
+			3400000);
 		if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_330)))
 			caps[0] &= ~SDHCI_CAN_VDD_330;
-		ret = regulator_is_supported_voltage(host->vmmc, 3000000,
-			3000000);
+		ret = regulator_is_supported_voltage(host->vmmc, 2900000,
+			3100000);
 		if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_300)))
 			caps[0] &= ~SDHCI_CAN_VDD_300;
-		ret = regulator_is_supported_voltage(host->vmmc, 1800000,
-			1800000);
+		ret = regulator_is_supported_voltage(host->vmmc, 1650000,
+			1950000);
 		if ((ret <= 0) || (!(caps[0] & SDHCI_CAN_VDD_180)))
 			caps[0] &= ~SDHCI_CAN_VDD_180;
 	}