diff options
author | Philippe Langlais <philippe.langlais@linaro.org> | 2011-06-14 14:39:00 +0200 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@stericsson.com> | 2011-09-19 15:15:35 +0200 |
commit | f9a15f2a58e70fe536a58ef4e2bd33ac0f07ffab (patch) | |
tree | e0b88842b22698e5c5982a2b3f6c7c245c61196f /sound/soc/codecs/ab8500_audio.c | |
parent | f717040820c64467d8f7d2c8e860237d8a20a022 (diff) |
Ux500 ASoC: Enhanced regulator management
The mic-regulators are now only taken when needed. This involves
querying the codec-driver to see if the the associated DAPM-path
is enabled or not.
ST-Ericsson Linux next: NA
ST-Ericsson ID: 337512
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: I5dec05a8a4b0cdb567bd3a3301d3c50a48fab23b
Signed-off-by: Ola Lilja <ola.o.lilja@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/24373
Reviewed-by: QATEST
Reviewed-by: Roger NILSSON1 <roger.xr.nilsson@stericsson.com>
Reviewed-by: Linus WALLEIJ <linus.walleij@stericsson.com>
Conflicts:
sound/soc/ux500/ux500_ab8500.c
Diffstat (limited to 'sound/soc/codecs/ab8500_audio.c')
-rw-r--r-- | sound/soc/codecs/ab8500_audio.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/sound/soc/codecs/ab8500_audio.c b/sound/soc/codecs/ab8500_audio.c index 49b4bf32417..ec323e1ea8d 100644 --- a/sound/soc/codecs/ab8500_audio.c +++ b/sound/soc/codecs/ab8500_audio.c @@ -278,8 +278,6 @@ static inline int ab8500_codec_update_reg_audio(struct snd_soc_codec *codec, return ab8500_codec_write_reg_audio(codec, reg, new); } -/*--------------------------------------------------------------*/ - /* Whether widget's register definitions should be inverted or not */ enum control_inversion { NORMAL = 0, @@ -1852,6 +1850,36 @@ int ab8500_audio_setup_if1(struct snd_soc_codec *codec, return 0; } +bool ab8500_audio_dapm_path_active(enum ab8500_audio_dapm_path dapm_path) +{ + int reg, reg_mask; + + switch (dapm_path) { + case AB8500_AUDIO_DAPM_PATH_DMIC: + reg = ab8500_codec_read_reg_audio(ab8500_codec, REG_DIGMICCONF); + reg_mask = BMASK(REG_DIGMICCONF_ENDMIC1) | + BMASK(REG_DIGMICCONF_ENDMIC2) | + BMASK(REG_DIGMICCONF_ENDMIC3) | + BMASK(REG_DIGMICCONF_ENDMIC4) | + BMASK(REG_DIGMICCONF_ENDMIC5) | + BMASK(REG_DIGMICCONF_ENDMIC6); + return reg & reg_mask; + + case AB8500_AUDIO_DAPM_PATH_AMIC1: + reg = ab8500_codec_read_reg_audio(ab8500_codec, REG_ANACONF2); + reg_mask = BMASK(REG_ANACONF2_MUTMIC1); + return !(reg & reg_mask); + + case AB8500_AUDIO_DAPM_PATH_AMIC2: + reg = ab8500_codec_read_reg_audio(ab8500_codec, REG_ANACONF2); + reg_mask = BMASK(REG_ANACONF2_MUTMIC2); + return !(reg & reg_mask); + + default: + return false; + } +} + static int ab8500_codec_add_widgets(struct snd_soc_codec *codec) { int ret; |