aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorJarkko Nikula <jarkko.nikula@nokia.com>2008-06-25 07:42:07 -0400
committerJaroslav Kysela <perex@perex.cz>2008-06-26 03:02:10 -0400
commite2be2ccf9416bb4e0eb5f851967e79261f41d7e5 (patch)
tree12a0d4b9d2a920f9f679d817f837b01e73af97e3 /sound/soc/soc-dapm.c
parenta5c95e90c1baa9c1114875264bbd283526eb8377 (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 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 728f3ac2f304..25363829e605 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -443,6 +443,25 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget)
443} 443}
444 444
445/* 445/*
446 * Handler for generic register modifier widget.
447 */
448int dapm_reg_event(struct snd_soc_dapm_widget *w,
449 struct snd_kcontrol *kcontrol, int event)
450{
451 unsigned int val;
452
453 if (SND_SOC_DAPM_EVENT_ON(event))
454 val = w->on_val;
455 else
456 val = w->off_val;
457
458 snd_soc_update_bits(w->codec, -(w->reg + 1),
459 w->mask << w->shift, val << w->shift);
460
461 return 0;
462}
463
464/*
446 * Scan each dapm widget for complete audio path. 465 * Scan each dapm widget for complete audio path.
447 * A complete path is a route that has valid endpoints i.e.:- 466 * A complete path is a route that has valid endpoints i.e.:-
448 * 467 *