]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
ASoC: Support DAPM events for DACs and ADCs
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 13 Apr 2009 10:27:03 +0000 (11:27 +0100)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 13 Apr 2009 10:59:01 +0000 (11:59 +0100)
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
include/sound/soc-dapm.h
sound/soc/soc-dapm.c

index a7def6a9a030e00671cb40ea6da2498ffca9caa2..fcc929da0339d4bd0dfb6041d4ddbf06a61941d0 100644 (file)
 #define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \
 {      .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \
        .shift = wshift, .invert = winvert}
+#define SND_SOC_DAPM_DAC_E(wname, stname, wreg, wshift, winvert, \
+                          wevent, wflags)                              \
+{      .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \
+       .shift = wshift, .invert = winvert, \
+       .event = wevent, .event_flags = wflags}
 #define SND_SOC_DAPM_ADC(wname, stname, wreg, wshift, winvert) \
 {      .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \
        .shift = wshift, .invert = winvert}
+#define SND_SOC_DAPM_ADC_E(wname, stname, wreg, wshift, winvert, \
+                          wevent, wflags)                              \
+{      .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \
+       .shift = wshift, .invert = winvert, \
+       .event = wevent, .event_flags = wflags}
 
 /* generic register modifier widget */
 #define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \
index 713d12586705da16427318cb20da0427f42da67d..a6d73379ab32fc78da80bf20f99a227f74388056 100644 (file)
@@ -598,18 +598,22 @@ static int dapm_power_widget(struct snd_soc_codec *codec, int event,
        if (w->id == snd_soc_dapm_adc && w->active) {
                in = is_connected_input_ep(w);
                dapm_clear_walk(w->codec);
-               w->power = (in != 0) ? 1 : 0;
-               dapm_update_bits(w);
-               return 0;
+               power = (in != 0) ? 1 : 0;
+               if (power == w->power)
+                       return 0;
+               w->power = power;
+               return dapm_generic_apply_power(w);
        }
 
        /* active DAC */
        if (w->id == snd_soc_dapm_dac && w->active) {
                out = is_connected_output_ep(w);
                dapm_clear_walk(w->codec);
-               w->power = (out != 0) ? 1 : 0;
-               dapm_update_bits(w);
-               return 0;
+               power = (out != 0) ? 1 : 0;
+               if (power == w->power)
+                       return 0;
+               w->power = power;
+               return dapm_generic_apply_power(w);
        }
 
        /* pre and post event widgets */