diff options
author | Jarkko Nikula <jarkko.nikula@nokia.com> | 2008-06-25 07:42:07 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-06-26 03:02:10 -0400 |
commit | e2be2ccf9416bb4e0eb5f851967e79261f41d7e5 (patch) | |
tree | 12a0d4b9d2a920f9f679d817f837b01e73af97e3 /include/sound/soc-dapm.h | |
parent | a5c95e90c1baa9c1114875264bbd283526eb8377 (diff) |
ALSA: ASoC: Add support for generic DAPM register modifier widget
This generic register modifier widget is for updating multiple codec
register bits at once when the widget changes its power state.
Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'include/sound/soc-dapm.h')
-rw-r--r-- | include/sound/soc-dapm.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index f8223fae5804..b2849538cbfe 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -130,6 +130,13 @@ | |||
130 | { .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \ | 130 | { .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \ |
131 | .shift = wshift, .invert = winvert} | 131 | .shift = wshift, .invert = winvert} |
132 | 132 | ||
133 | /* generic register modifier widget */ | ||
134 | #define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \ | ||
135 | { .id = wid, .name = wname, .kcontrols = NULL, .num_kcontrols = 0, \ | ||
136 | .reg = -((wreg) + 1), .shift = wshift, .mask = wmask, \ | ||
137 | .on_val = won_val, .off_val = woff_val, .event = dapm_reg_event, \ | ||
138 | .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD} | ||
139 | |||
133 | /* dapm kcontrol types */ | 140 | /* dapm kcontrol types */ |
134 | #define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \ | 141 | #define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \ |
135 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 142 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
@@ -227,6 +234,10 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev, | |||
227 | /* dapm sys fs - used by the core */ | 234 | /* dapm sys fs - used by the core */ |
228 | int snd_soc_dapm_sys_add(struct device *dev); | 235 | int snd_soc_dapm_sys_add(struct device *dev); |
229 | 236 | ||
237 | /* event handler for register modifier widget - used by the soc-dapm */ | ||
238 | int dapm_reg_event(struct snd_soc_dapm_widget *w, | ||
239 | struct snd_kcontrol *kcontrol, int event); | ||
240 | |||
230 | /* dapm audio endpoint control */ | 241 | /* dapm audio endpoint control */ |
231 | int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec, | 242 | int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec, |
232 | char *pin, int status); | 243 | char *pin, int status); |
@@ -298,6 +309,9 @@ struct snd_soc_dapm_widget { | |||
298 | unsigned char shift; /* bits to shift */ | 309 | unsigned char shift; /* bits to shift */ |
299 | unsigned int saved_value; /* widget saved value */ | 310 | unsigned int saved_value; /* widget saved value */ |
300 | unsigned int value; /* widget current value */ | 311 | unsigned int value; /* widget current value */ |
312 | unsigned int mask; /* non-shifted mask */ | ||
313 | unsigned int on_val; /* on state value */ | ||
314 | unsigned int off_val; /* off state value */ | ||
301 | unsigned char power:1; /* block power status */ | 315 | unsigned char power:1; /* block power status */ |
302 | unsigned char invert:1; /* invert the power bit */ | 316 | unsigned char invert:1; /* invert the power bit */ |
303 | unsigned char active:1; /* active stream on DAC, ADC's */ | 317 | unsigned char active:1; /* active stream on DAC, ADC's */ |