public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] dw_mmc: support mmc power control with regulator
@ 2011-02-25  2:08 Jaehoon Chung
  2011-02-25 17:57 ` Will Newton
  2011-03-17 18:13 ` Chris Ball
  0 siblings, 2 replies; 5+ messages in thread
From: Jaehoon Chung @ 2011-02-25  2:08 UTC (permalink / raw)
  To: linux-mmc@vger.kernel.org; +Cc: will.newton, Chris Ball, Kyungmin Park

This patch is applied the power control with regulator.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/mmc/host/dw_mmc.c  |   25 +++++++++++++++++++++++++
 include/linux/mmc/dw_mmc.h |    2 ++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 46e5a89..338fedc 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -32,6 +32,7 @@
 #include <linux/mmc/mmc.h>
 #include <linux/mmc/dw_mmc.h>
 #include <linux/bitops.h>
+#include <linux/regulator/consumer.h>
 
 #include "dw_mmc.h"
 
@@ -1438,6 +1439,13 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id)
 	}
 #endif /* CONFIG_MMC_DW_IDMAC */
 
+	host->vmmc = regulator_get(mmc_dev(mmc), "vmmc");
+	if (IS_ERR(host->vmmc)) {
+		printk(KERN_INFO "%s: no vmmc regulator found\n", mmc_hostname(mmc));
+		host->vmmc = NULL;
+	} else
+		regulator_enable(host->vmmc);
+
 	if (dw_mci_get_cd(mmc))
 		set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
 	else
@@ -1701,6 +1709,12 @@ err_dmaunmap:
 			  host->sg_cpu, host->sg_dma);
 	iounmap(host->regs);
 
+	if (host->vmmc) {
+		regulator_disable(host->vmmc);
+		regulator_put(host->vmmc);
+	}
+
+
 err_freehost:
 	kfree(host);
 	return ret;
@@ -1732,6 +1746,11 @@ static int __exit dw_mci_remove(struct platform_device *pdev)
 	if (host->use_dma && host->dma_ops->exit)
 		host->dma_ops->exit(host);
 
+	if (host->vmmc) {
+		regulator_disable(host->vmmc);
+		regulator_put(host->vmmc);
+	}
+
 	iounmap(host->regs);
 
 	kfree(host);
@@ -1762,6 +1781,9 @@ static int dw_mci_suspend(struct platform_device *pdev, pm_message_t mesg)
 		}
 	}
 
+	if (host->vmmc)
+		regulator_disable(host->vmmc);
+
 	return 0;
 }
 
@@ -1770,6 +1792,9 @@ static int dw_mci_resume(struct platform_device *pdev)
 	int i, ret;
 	struct dw_mci *host = platform_get_drvdata(pdev);
 
+	if (host->vmmc)
+		regulator_enable(host->vmmc);
+
 	for (i = 0; i < host->num_slots; i++) {
 		struct dw_mci_slot *slot = host->slot[i];
 		if (!slot)
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 3f22c20..a39c497 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -151,6 +151,8 @@ struct dw_mci {
 
 	/* Workaround flags */
 	u32			quirks;
+
+	struct regulator	*vmmc;	/* Power regulator */
 };
 
 /* DMA ops for Internal/External DMAC interface */

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

* Re: [PATCH 2/3] dw_mmc: support mmc power control with regulator
  2011-02-25  2:08 [PATCH 2/3] dw_mmc: support mmc power control with regulator Jaehoon Chung
@ 2011-02-25 17:57 ` Will Newton
  2011-03-17 10:23   ` Jaehoon Chung
  2011-03-17 18:13 ` Chris Ball
  1 sibling, 1 reply; 5+ messages in thread
From: Will Newton @ 2011-02-25 17:57 UTC (permalink / raw)
  To: Jaehoon Chung
  Cc: linux-mmc@vger.kernel.org, will.newton, Chris Ball, Kyungmin Park

On Fri, Feb 25, 2011 at 2:08 AM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> This patch is applied the power control with regulator.
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> Signed-off-by: kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc.c  |   25 +++++++++++++++++++++++++
>  include/linux/mmc/dw_mmc.h |    2 ++
>  2 files changed, 27 insertions(+), 0 deletions(-)

This looks ok from an mmc point of view. I'm not that familiar with
the regulator API however, so it would be good to get a review from
someone who is.

Acked-by: Will Newton <will.newton@imgtec.com>

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

* Re: [PATCH 2/3] dw_mmc: support mmc power control with regulator
  2011-02-25 17:57 ` Will Newton
@ 2011-03-17 10:23   ` Jaehoon Chung
  0 siblings, 0 replies; 5+ messages in thread
From: Jaehoon Chung @ 2011-03-17 10:23 UTC (permalink / raw)
  To: Will Newton
  Cc: Jaehoon Chung, linux-mmc@vger.kernel.org, will.newton, Chris Ball,
	Kyungmin Park

Hi Chris..

I want to know this patch..

Regard,
Jaehoon Chung

Will Newton wrote:
> On Fri, Feb 25, 2011 at 2:08 AM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> This patch is applied the power control with regulator.
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> Signed-off-by: kyungmin Park <kyungmin.park@samsung.com>
>> ---
>>  drivers/mmc/host/dw_mmc.c  |   25 +++++++++++++++++++++++++
>>  include/linux/mmc/dw_mmc.h |    2 ++
>>  2 files changed, 27 insertions(+), 0 deletions(-)
> 
> This looks ok from an mmc point of view. I'm not that familiar with
> the regulator API however, so it would be good to get a review from
> someone who is.
> 
> Acked-by: Will Newton <will.newton@imgtec.com>
> --
> 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
> 


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

* Re: [PATCH 2/3] dw_mmc: support mmc power control with regulator
  2011-02-25  2:08 [PATCH 2/3] dw_mmc: support mmc power control with regulator Jaehoon Chung
  2011-02-25 17:57 ` Will Newton
@ 2011-03-17 18:13 ` Chris Ball
  2011-03-17 19:01   ` Chris Ball
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Ball @ 2011-03-17 18:13 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc@vger.kernel.org, will.newton, Kyungmin Park

Hi Jaehoon,

On Thu, Feb 24 2011, Jaehoon Chung wrote:
> This patch is applied the power control with regulator.
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> Signed-off-by: kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc.c  |   25 +++++++++++++++++++++++++
>  include/linux/mmc/dw_mmc.h |    2 ++
>  2 files changed, 27 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 46e5a89..338fedc 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -32,6 +32,7 @@
>  #include <linux/mmc/mmc.h>
>  #include <linux/mmc/dw_mmc.h>
>  #include <linux/bitops.h>
> +#include <linux/regulator/consumer.h>
>  
>  #include "dw_mmc.h"
>  
> @@ -1438,6 +1439,13 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id)
>  	}
>  #endif /* CONFIG_MMC_DW_IDMAC */
>  
> +	host->vmmc = regulator_get(mmc_dev(mmc), "vmmc");
> +	if (IS_ERR(host->vmmc)) {
> +		printk(KERN_INFO "%s: no vmmc regulator found\n", mmc_hostname(mmc));
> +		host->vmmc = NULL;
> +	} else
> +		regulator_enable(host->vmmc);
> +
>  	if (dw_mci_get_cd(mmc))
>  		set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
>  	else

I think you want an "#ifdef CONFIG_REGULATOR" around this hunk.
Please try building the driver with CONFIG_REGULATOR=n.

The other hunks in the patch shouldn't need it, because they test
"host->vcc" before making any regulator calls.

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

* Re: [PATCH 2/3] dw_mmc: support mmc power control with regulator
  2011-03-17 18:13 ` Chris Ball
@ 2011-03-17 19:01   ` Chris Ball
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Ball @ 2011-03-17 19:01 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc@vger.kernel.org, will.newton, Kyungmin Park

Hi,

On Thu, Mar 17 2011, Chris Ball wrote:
>> @@ -1438,6 +1439,13 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id)
>>  	}
>>  #endif /* CONFIG_MMC_DW_IDMAC */
>>  
>> +	host->vmmc = regulator_get(mmc_dev(mmc), "vmmc");
>> +	if (IS_ERR(host->vmmc)) {
>> +		printk(KERN_INFO "%s: no vmmc regulator found\n", mmc_hostname(mmc));
>> +		host->vmmc = NULL;
>> +	} else
>> +		regulator_enable(host->vmmc);
>> +
>>  	if (dw_mci_get_cd(mmc))
>>  		set_bit(DW_MMC_CARD_PRESENT, &slot->flags);
>>  	else
>
> I think you want an "#ifdef CONFIG_REGULATOR" around this hunk.
> Please try building the driver with CONFIG_REGULATOR=n.
>
> The other hunks in the patch shouldn't need it, because they test
> "host->vcc" before making any regulator calls.

Actually, <linux/regulator/consumer.h> provides no-op versions of all
these functions if CONFIG_REGULATOR is unset, so I guess this doesn't
matter; the driver builds without CONFIG_REGULATOR as-is.

Will merge for .39 with Will's ACK, thanks.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

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

end of thread, other threads:[~2011-03-17 19:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-25  2:08 [PATCH 2/3] dw_mmc: support mmc power control with regulator Jaehoon Chung
2011-02-25 17:57 ` Will Newton
2011-03-17 10:23   ` Jaehoon Chung
2011-03-17 18:13 ` Chris Ball
2011-03-17 19:01   ` Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox