diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2011-12-02 15:20:06 +0530 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@linaro.org> | 2012-03-19 09:01:03 +0100 |
commit | 77b1580782cb85e4e76e367fe69f38c07880917e (patch) | |
tree | 328d225bf29ab2cb001d6d442c38d659ac1f32b7 | |
parent | 0bdf1dfa6beaa9676826cdb0f369053e3a0aa2c3 (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>
-rw-r--r-- | sound/soc/codecs/ab5500.c | 20 |
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) |