diff options
author | Viraj Karandikar <vkarandikar@nvidia.com> | 2011-05-31 17:39:31 +0530 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2011-06-10 05:43:46 -0700 |
commit | a901777ebfae8c737814fbd66348276ca2b1c021 (patch) | |
tree | ab14928a440743378e7be80f82c4e065f14eeada /sound | |
parent | f69d9be1947af12d634bf6a8da4fd44bdf58193d (diff) |
ASOC: tegra: Enable/disable regulator vmic when recording with d-mic
Support recording with d-mic in audio only use case
Reviewed-on: http://git-master/r/34551
(cherry picked from commit 58ff88e8ef9b805381a1bef40be276224a43e175)
Change-Id: Iea9b509b805542f5089fb3399d7796d23d9270e5
Reviewed-on: http://git-master/r/35376
Tested-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: Scott Peterson <speterson@nvidia.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/tegra/tegra_soc_wm8903.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/sound/soc/tegra/tegra_soc_wm8903.c b/sound/soc/tegra/tegra_soc_wm8903.c index 1c3ed544ddd5..ac7f9bbc441c 100644 --- a/sound/soc/tegra/tegra_soc_wm8903.c +++ b/sound/soc/tegra/tegra_soc_wm8903.c @@ -24,6 +24,7 @@ static struct platform_device *tegra_snd_device; +static struct regulator *reg_vmic = NULL; extern int en_dmic; extern struct snd_soc_dai tegra_i2s_dai[]; @@ -294,12 +295,26 @@ int tegra_codec_startup(struct snd_pcm_substream *substream) { tegra_das_power_mode(true); + if ((SNDRV_PCM_STREAM_CAPTURE == substream->stream) && en_dmic) { + /* enable d-mic */ + if (reg_vmic) { + regulator_enable(reg_vmic); + } + } + return 0; } void tegra_codec_shutdown(struct snd_pcm_substream *substream) { tegra_das_power_mode(false); + + if ((SNDRV_PCM_STREAM_CAPTURE == substream->stream) && en_dmic) { + /* disable d-mic */ + if (reg_vmic) { + regulator_disable(reg_vmic); + } + } } int tegra_soc_suspend_pre(struct platform_device *pdev, pm_message_t state) @@ -619,7 +634,13 @@ static int __init tegra_init(void) dev_err(&tegra_snd_device->dev, "%s: could not create sysfs entry %s: %d\n", __func__, dev_attr_enable_digital_mic.attr.name, ret); - return ret; + goto fail; + } + + reg_vmic = regulator_get(&tegra_snd_device->dev, "vmic"); + if (IS_ERR_OR_NULL(reg_vmic)) { + pr_err("Couldn't get vmic regulator\n"); + reg_vmic = NULL; } return 0; @@ -636,6 +657,10 @@ fail: static void __exit tegra_exit(void) { tegra_jack_exit(); + if (reg_vmic) { + regulator_put(reg_vmic); + reg_vmic = NULL; + } platform_device_unregister(tegra_snd_device); } |