summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorRabin Vincent <rabin.vincent@stericsson.com>2011-12-02 15:20:06 +0530
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:05:02 +0200
commitc2d774ce02cc58a1052bab54d859eb8d8f73ccf3 (patch)
treec7c44c2f62ce0a1aecc716c9a1b46aac19c0fee9 /sound
parent51e606c92788ed9c1fdbd752159dcd29634eadee (diff)
ASoC: Ux500:use framework to support mic regulator
This patch enables digital mic regulator for AB5500 using regultor framework. ST-Ericsson Linux next: NA ST-Ericsson ID: WP363424 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I0cfe0196350976c28b77e65a5cebae0a1252f78a Signed-off-by: Kumar KM <kumar.km@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/40777 Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/ab5500.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sound/soc/codecs/ab5500.c b/sound/soc/codecs/ab5500.c
index d1ed4895321..e188bcd19ae 100644
--- a/sound/soc/codecs/ab5500.c
+++ b/sound/soc/codecs/ab5500.c
@@ -18,6 +18,7 @@
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h>
#include <sound/core.h>
#include <sound/pcm.h>
@@ -46,6 +47,7 @@ struct ab5500_codec_dai_data {
};
static struct device *ab5500_dev;
+static struct regulator *ab5500_vdigmic_reg;
static u8 virtual_regs[] = {
0, 0, 0, 0, 0
@@ -1118,6 +1120,8 @@ static void power_for_playback(enum enum_power onoff, int ifsel)
static void power_for_capture(enum enum_power onoff, int ifsel)
{
+ int err;
+
dev_info(ab5500_dev, "%s: interface %d power %s", __func__,
ifsel, onoff == POWER_ON ? "on" : "off");
if (mutex_lock_interruptible(&ab5500_pm_mutex)) {
@@ -1131,6 +1135,14 @@ static void power_for_capture(enum enum_power onoff, int ifsel)
power_widget_unlocked(onoff, ifsel == 0 ?
widget_if0_uld_r : widget_if1_uld_r);
mutex_unlock(&ab5500_pm_mutex);
+
+ if (onoff)
+ err = regulator_enable(ab5500_vdigmic_reg);
+ else
+ err = regulator_disable(ab5500_vdigmic_reg);
+ if (err)
+ dev_err(ab5500_dev, "unabled to %s VDIGMIC %d\n",
+ onoff ? "enable" : "disable", err);
}
static int ab5500_add_controls(struct snd_soc_codec *codec)
@@ -1573,6 +1585,14 @@ static int __devinit ab5500_platform_probe(struct platform_device *pdev)
pr_info("%s invoked with pdev = %p.\n", __func__, pdev);
ab5500_dev = &pdev->dev;
+
+ ab5500_vdigmic_reg = regulator_get(&pdev->dev, "vdigmic");
+ if (IS_ERR(ab5500_vdigmic_reg)) {
+ dev_err(&pdev->dev, "could not get vdigmic regulator %ld\n",
+ PTR_ERR(ab5500_vdigmic_reg));
+ return PTR_ERR(ab5500_vdigmic_reg);
+ }
+
codec_drvdata = kzalloc(sizeof(struct ab5500_codec_dai_data),
GFP_KERNEL);
if (codec_drvdata == NULL)