aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/core.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2012-06-20 02:28:43 -0400
committerChris Ball <cjb@laptop.org>2012-07-21 00:02:08 -0400
commite137788dd115dd9d21759a768dba5fff9685e587 (patch)
tree93c2bcea03d7e8799db1e575530cdfc4b534a932 /drivers/mmc/core/core.c
parent6de707f200f73af7a58b58b3a5b956cff7b6e228 (diff)
mmc: add a function to get regulators, supplying card's power
Add a function to get regulators, supplying card's Vdd and Vccq on a specific host. If a Vdd supplying regulator is found, the function checks, whether a valid OCR mask can be obtained from it. The Vccq regulator is optional. A failure to get it is not fatal. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Reviwed-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/core/core.c')
-rw-r--r--drivers/mmc/core/core.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 28b1ffaf0bd1..8d00aef9523e 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1022,6 +1022,29 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc,
1022} 1022}
1023EXPORT_SYMBOL_GPL(mmc_regulator_set_ocr); 1023EXPORT_SYMBOL_GPL(mmc_regulator_set_ocr);
1024 1024
1025int mmc_regulator_get_supply(struct mmc_host *mmc)
1026{
1027 struct device *dev = mmc_dev(mmc);
1028 struct regulator *supply;
1029 int ret;
1030
1031 supply = devm_regulator_get(dev, "vmmc");
1032 mmc->supply.vmmc = supply;
1033 mmc->supply.vqmmc = devm_regulator_get(dev, "vqmmc");
1034
1035 if (IS_ERR(supply))
1036 return PTR_ERR(supply);
1037
1038 ret = mmc_regulator_get_ocrmask(supply);
1039 if (ret > 0)
1040 mmc->ocr_avail = ret;
1041 else
1042 dev_warn(mmc_dev(mmc), "Failed getting OCR mask: %d\n", ret);
1043
1044 return 0;
1045}
1046EXPORT_SYMBOL_GPL(mmc_regulator_get_supply);
1047
1025#endif /* CONFIG_REGULATOR */ 1048#endif /* CONFIG_REGULATOR */
1026 1049
1027/* 1050/*