dw_mmc: support mmc power control with regulator
Subsystems (2)
Jaehoon Chung
maintainerPATCH 2/3 dw_mmc: support mmc power control with regulator
This patch is applied the power control with regulator.
--- drivers/mmc/host/dw_mmc.c | 25 +++++++++++++++++++++++++ include/linux/mmc/dw_mmc.h | 2 ++ 2 files changed, 27 insertions(+), 0 deletions(-)
drivers/mmc/host/dw_mmc.c +25 -0
@@ -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)
include/linux/mmc/dw_mmc.h +2 -0
@@ -151,6 +151,8 @@ struct dw_mci {/* Workaround flags */ u32 quirks; + +struct regulator *vmmc;/* Power regulator */ };/* DMA ops for Internal/External DMAC interface */
Quoted 8 lines · Jaehoon Chung
This patch is applied the power control with regulator.
Signed-off-by Jaehoon Chung <[email protected]>Signed-off-by kyungmin Park <[email protected]>---
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.
Jaehoon Chung
maintainerHi Chris..
I want to know this patch..
Regard,
Jaehoon Chung
Quoted 20 lines · Will Newton
Quoted 8 lines · Jaehoon Chung
This patch is applied the power control with regulator.
Signed-off-by Jaehoon Chung <[email protected]>Signed-off-by kyungmin Park <[email protected]>--- 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 <[email protected]>--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Jaehoon,
Quoted 25 lines · Jaehoon Chung
This patch is applied the power control with regulator.
Signed-off-by Jaehoon Chung <[email protected]>Signed-off-by kyungmin Park <[email protected]>--- drivers/mmc/host/dw_mmc.c | 25 +++++++++++++++++++++++++ include/linux/mmc/dw_mmc.h | 2 ++ 2 files changed, 27 insertions(+), 0 deletions(-)drivers/mmc/host/dw_mmc.c +1
-0@@ -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 */
drivers/mmc/host/dw_mmc.c static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id) · line 1451
Quoted 10 lines
drivers/mmc/host/dw_mmc.c +7
-0+ 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.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
Hi,
Quoted 18 lines · Chris Ball
Quoted 4 lines
drivers/mmc/host/dw_mmc.c +0
-0@@ -1438,6 +1439,13 @@ static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id) }#endif /* CONFIG_MMC_DW_IDMAC */ drivers/mmc/host/dw_mmc.c static int __init dw_mci_init_slot(struct dw_mci *host, unsigned int id) · line 1451
Quoted 10 lines
drivers/mmc/host/dw_mmc.c +7
-0+ 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 withCONFIG_REGULATOR=n.
Quoted 2 lines
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.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child