diff options
author | Philippe Langlais <philippe.langlais@linaro.org> | 2011-06-14 14:39:00 +0200 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@linaro.org> | 2012-03-19 09:00:55 +0100 |
commit | f7aa28fde7dfc19847e585605bf7644538a3c220 (patch) | |
tree | 8dc546adfc18a9b9ad42ba91e317931f841a1072 /sound/soc/codecs | |
parent | c2f84836b67b08a7e40a1dcd53c146609d193609 (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')
-rw-r--r-- | sound/soc/codecs/ab8500_audio.c | 32 | ||||
-rw-r--r-- | sound/soc/codecs/ab8500_audio.h | 8 |
2 files changed, 38 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; diff --git a/sound/soc/codecs/ab8500_audio.h b/sound/soc/codecs/ab8500_audio.h index 1ff7dafa3e7..7cfdd1cc13a 100644 --- a/sound/soc/codecs/ab8500_audio.h +++ b/sound/soc/codecs/ab8500_audio.h @@ -23,6 +23,7 @@ extern struct snd_soc_dai_driver ab8500_codec_dai[]; extern struct snd_soc_codec_driver soc_codec_dev_ab8500; /* Extended interface for codec-driver */ + void ab8500_audio_power_control(bool power_on); int ab8500_audio_set_word_length(struct snd_soc_dai *dai, unsigned int wl); int ab8500_audio_set_bit_delay(struct snd_soc_dai *dai, unsigned int delay); @@ -31,6 +32,13 @@ int ab8500_audio_setup_if1(struct snd_soc_codec *codec, unsigned int wl, unsigned int delay); +enum ab8500_audio_dapm_path { + AB8500_AUDIO_DAPM_PATH_DMIC, + AB8500_AUDIO_DAPM_PATH_AMIC1, + AB8500_AUDIO_DAPM_PATH_AMIC2 +}; +bool ab8500_audio_dapm_path_active(enum ab8500_audio_dapm_path dapm_path); + /* AB8500 audio bank (0x0d) register definitions */ #define REG_POWERUP 0x00 |