diff options
author | Jarkko Nikula <jarkko.nikula@nokia.com> | 2008-06-25 14:42:07 +0300 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-06-26 09:02:10 +0200 |
commit | e2be2ccf9416bb4e0eb5f851967e79261f41d7e5 (patch) | |
tree | 12a0d4b9d2a920f9f679d817f837b01e73af97e3 /include | |
parent | a5c95e90c1baa9c1114875264bbd283526eb8377 (diff) | |
download | linux-3.10-e2be2ccf9416bb4e0eb5f851967e79261f41d7e5.tar.gz linux-3.10-e2be2ccf9416bb4e0eb5f851967e79261f41d7e5.tar.bz2 linux-3.10-e2be2ccf9416bb4e0eb5f851967e79261f41d7e5.zip |
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')
-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 f8223fae580..b2849538cbf 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -130,6 +130,13 @@ { .id = snd_soc_dapm_adc, .name = wname, .sname = stname, .reg = wreg, \ .shift = wshift, .invert = winvert} +/* generic register modifier widget */ +#define SND_SOC_DAPM_REG(wid, wname, wreg, wshift, wmask, won_val, woff_val) \ +{ .id = wid, .name = wname, .kcontrols = NULL, .num_kcontrols = 0, \ + .reg = -((wreg) + 1), .shift = wshift, .mask = wmask, \ + .on_val = won_val, .off_val = woff_val, .event = dapm_reg_event, \ + .event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD} + /* dapm kcontrol types */ #define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ @@ -227,6 +234,10 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev, /* dapm sys fs - used by the core */ int snd_soc_dapm_sys_add(struct device *dev); +/* event handler for register modifier widget - used by the soc-dapm */ +int dapm_reg_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event); + /* dapm audio endpoint control */ int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec, char *pin, int status); @@ -298,6 +309,9 @@ struct snd_soc_dapm_widget { unsigned char shift; /* bits to shift */ unsigned int saved_value; /* widget saved value */ unsigned int value; /* widget current value */ + unsigned int mask; /* non-shifted mask */ + unsigned int on_val; /* on state value */ + unsigned int off_val; /* off state value */ unsigned char power:1; /* block power status */ unsigned char invert:1; /* invert the power bit */ unsigned char active:1; /* active stream on DAC, ADC's */ |