diff mbox

[v2,1/5] mmc: host: sdhci-s3c: Add broken-voltage DT property for broken voltage quirk

Message ID m3627aguhl.fsf@pullcord.laptop.org (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Ball Sept. 19, 2012, 10:47 a.m. UTC
Hi,

On Wed, Sep 19 2012, Tomasz Figa wrote:
> We could just check if the regulator provides the capability to change the 
> voltage.
>
> I don't see any direct way of querying the regulator for provided 
> capabilities (correct me if I'm just blind), but calling 
> regulator_count_voltages() on the regulator and checking if the returned 
> value is 1 should be enough to assume that the regulator is fixed.

Sounds good, I agree.  Are you able to test that the obvious patch below
works on your fixed-regulator board?

Jaehoon and Adrian, can you think of any reason why we shouldn't replace
MMC_CAP2_BROKEN_VOLTAGE with the regulator_count_voltages() call below?
Thanks.

Comments

Tomasz Figa Sept. 19, 2012, 10:49 a.m. UTC | #1
hi,

On Wednesday 19 of September 2012 06:47:02 Chris Ball wrote:
> Hi,
> 
> On Wed, Sep 19 2012, Tomasz Figa wrote:
> > We could just check if the regulator provides the capability to change
> > the voltage.
> > 
> > I don't see any direct way of querying the regulator for provided
> > capabilities (correct me if I'm just blind), but calling
> > regulator_count_voltages() on the regulator and checking if the
> > returned
> > value is 1 should be enough to assume that the regulator is fixed.
> 
> Sounds good, I agree.  Are you able to test that the obvious patch below
> works on your fixed-regulator board?

Yes. I will report the result as soon as I test it.

Best regards,
Jaehoon Chung Sept. 19, 2012, 11:02 a.m. UTC | #2
Hi,

On 09/19/2012 07:47 PM, Chris Ball wrote:
> Hi,
> 
> On Wed, Sep 19 2012, Tomasz Figa wrote:
>> We could just check if the regulator provides the capability to change the 
>> voltage.
>>
>> I don't see any direct way of querying the regulator for provided 
>> capabilities (correct me if I'm just blind), but calling 
>> regulator_count_voltages() on the regulator and checking if the returned 
>> value is 1 should be enough to assume that the regulator is fixed.
> 
> Sounds good, I agree.  Are you able to test that the obvious patch below
> works on your fixed-regulator board?
> 
> Jaehoon and Adrian, can you think of any reason why we shouldn't replace
> MMC_CAP2_BROKEN_VOLTAGE with the regulator_count_voltages() call below?
> Thanks.
I think this is better than using MMC_CAP2_BROKEN_VOLTAGE.
I tested with this..and working fine.

Best Regards,
Jaehoon Chung
> 
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 044cd01..a3cc740 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -1132,7 +1132,7 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
>  		 */
>  		voltage = regulator_get_voltage(supply);
>  
> -		if (mmc->caps2 & MMC_CAP2_BROKEN_VOLTAGE)
> +		if (regulator_count_voltages(supply) == 1)
>  			min_uV = max_uV = voltage;
>  
>  		if (voltage < 0)
>
diff mbox

Patch

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 044cd01..a3cc740 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1132,7 +1132,7 @@  int mmc_regulator_set_ocr(struct mmc_host *mmc,
 		 */
 		voltage = regulator_get_voltage(supply);
 
-		if (mmc->caps2 & MMC_CAP2_BROKEN_VOLTAGE)
+		if (regulator_count_voltages(supply) == 1)
 			min_uV = max_uV = voltage;
 
 		if (voltage < 0)