Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9bea3c85 authored by Marek Szyprowski's avatar Marek Szyprowski Committed by Linus Torvalds
Browse files

sdhci: add regulator support



This patch adds support for regulator API to sdhci core driver.
Regulators can be used to disable power in suspended state to reduce
dissipated energy.

Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 17866e14
Loading
Loading
Loading
Loading
+25 −1
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@
#include <linux/dma-mapping.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/scatterlist.h>
#include <linux/scatterlist.h>
#include <linux/regulator/consumer.h>


#include <linux/leds.h>
#include <linux/leds.h>


@@ -1608,7 +1609,10 @@ int sdhci_suspend_host(struct sdhci_host *host, pm_message_t state)


	free_irq(host->irq, host);
	free_irq(host->irq, host);


	return 0;
	if (host->vmmc)
		ret = regulator_disable(host->vmmc);

	return ret;
}
}


EXPORT_SYMBOL_GPL(sdhci_suspend_host);
EXPORT_SYMBOL_GPL(sdhci_suspend_host);
@@ -1617,6 +1621,13 @@ int sdhci_resume_host(struct sdhci_host *host)
{
{
	int ret;
	int ret;


	if (host->vmmc) {
		int ret = regulator_enable(host->vmmc);
		if (ret)
			return ret;
	}


	if (host->flags & (SDHCI_USE_SDMA | SDHCI_USE_ADMA)) {
	if (host->flags & (SDHCI_USE_SDMA | SDHCI_USE_ADMA)) {
		if (host->ops->enable_dma)
		if (host->ops->enable_dma)
			host->ops->enable_dma(host);
			host->ops->enable_dma(host);
@@ -1889,6 +1900,14 @@ int sdhci_add_host(struct sdhci_host *host)
	if (ret)
	if (ret)
		goto untasklet;
		goto untasklet;


	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);
	}

	sdhci_init(host, 0);
	sdhci_init(host, 0);


#ifdef CONFIG_MMC_DEBUG
#ifdef CONFIG_MMC_DEBUG
@@ -1973,6 +1992,11 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
	tasklet_kill(&host->card_tasklet);
	tasklet_kill(&host->card_tasklet);
	tasklet_kill(&host->finish_tasklet);
	tasklet_kill(&host->finish_tasklet);


	if (host->vmmc) {
		regulator_disable(host->vmmc);
		regulator_put(host->vmmc);
	}

	kfree(host->adma_desc);
	kfree(host->adma_desc);
	kfree(host->align_buffer);
	kfree(host->align_buffer);


+2 −0
Original line number Original line Diff line number Diff line
@@ -249,6 +249,8 @@ struct sdhci_host {


	const struct sdhci_ops	*ops;		/* Low level hw interface */
	const struct sdhci_ops	*ops;		/* Low level hw interface */


	struct regulator	*vmmc;		/* Power regulator */

	/* Internal data */
	/* Internal data */
	struct mmc_host		*mmc;		/* MMC structure */
	struct mmc_host		*mmc;		/* MMC structure */
	u64			dma_mask;	/* custom DMA mask */
	u64			dma_mask;	/* custom DMA mask */