diff options
author | Laim Girdwood <lg@opensource.wolfsonmicro.com> | 2008-01-10 08:41:02 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-01-31 11:29:51 -0500 |
commit | 9af6d9562414568ecadf96aaef5b88e7e8b19821 (patch) | |
tree | 710e129e7cc8838cf8ac9c5d79473685e8933dd6 /sound | |
parent | 6c59e6c4129cd80834837b58a42216f0432a4f58 (diff) |
[ALSA] soc - Add support for passing kcontrols with events
Signed-off-by: Laim 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')
-rw-r--r-- | sound/soc/soc-dapm.c | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index d033e73103a8..8b61db2f6398 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -523,11 +523,13 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event) | |||
523 | continue; | 523 | continue; |
524 | 524 | ||
525 | if (event == SND_SOC_DAPM_STREAM_START) { | 525 | if (event == SND_SOC_DAPM_STREAM_START) { |
526 | ret = w->event(w, SND_SOC_DAPM_PRE_PMU); | 526 | ret = w->event(w, |
527 | NULL, SND_SOC_DAPM_PRE_PMU); | ||
527 | if (ret < 0) | 528 | if (ret < 0) |
528 | return ret; | 529 | return ret; |
529 | } else if (event == SND_SOC_DAPM_STREAM_STOP) { | 530 | } else if (event == SND_SOC_DAPM_STREAM_STOP) { |
530 | ret = w->event(w, SND_SOC_DAPM_PRE_PMD); | 531 | ret = w->event(w, |
532 | NULL, SND_SOC_DAPM_PRE_PMD); | ||
531 | if (ret < 0) | 533 | if (ret < 0) |
532 | return ret; | 534 | return ret; |
533 | } | 535 | } |
@@ -538,11 +540,13 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event) | |||
538 | continue; | 540 | continue; |
539 | 541 | ||
540 | if (event == SND_SOC_DAPM_STREAM_START) { | 542 | if (event == SND_SOC_DAPM_STREAM_START) { |
541 | ret = w->event(w, SND_SOC_DAPM_POST_PMU); | 543 | ret = w->event(w, |
544 | NULL, SND_SOC_DAPM_POST_PMU); | ||
542 | if (ret < 0) | 545 | if (ret < 0) |
543 | return ret; | 546 | return ret; |
544 | } else if (event == SND_SOC_DAPM_STREAM_STOP) { | 547 | } else if (event == SND_SOC_DAPM_STREAM_STOP) { |
545 | ret = w->event(w, SND_SOC_DAPM_POST_PMD); | 548 | ret = w->event(w, |
549 | NULL, SND_SOC_DAPM_POST_PMD); | ||
546 | if (ret < 0) | 550 | if (ret < 0) |
547 | return ret; | 551 | return ret; |
548 | } | 552 | } |
@@ -566,26 +570,30 @@ static int dapm_power_widgets(struct snd_soc_codec *codec, int event) | |||
566 | if (power) { | 570 | if (power) { |
567 | /* power up event */ | 571 | /* power up event */ |
568 | if (w->event_flags & SND_SOC_DAPM_PRE_PMU) { | 572 | if (w->event_flags & SND_SOC_DAPM_PRE_PMU) { |
569 | ret = w->event(w, SND_SOC_DAPM_PRE_PMU); | 573 | ret = w->event(w, |
574 | NULL, SND_SOC_DAPM_PRE_PMU); | ||
570 | if (ret < 0) | 575 | if (ret < 0) |
571 | return ret; | 576 | return ret; |
572 | } | 577 | } |
573 | dapm_update_bits(w); | 578 | dapm_update_bits(w); |
574 | if (w->event_flags & SND_SOC_DAPM_POST_PMU){ | 579 | if (w->event_flags & SND_SOC_DAPM_POST_PMU){ |
575 | ret = w->event(w, SND_SOC_DAPM_POST_PMU); | 580 | ret = w->event(w, |
581 | NULL, SND_SOC_DAPM_POST_PMU); | ||
576 | if (ret < 0) | 582 | if (ret < 0) |
577 | return ret; | 583 | return ret; |
578 | } | 584 | } |
579 | } else { | 585 | } else { |
580 | /* power down event */ | 586 | /* power down event */ |
581 | if (w->event_flags & SND_SOC_DAPM_PRE_PMD) { | 587 | if (w->event_flags & SND_SOC_DAPM_PRE_PMD) { |
582 | ret = w->event(w, SND_SOC_DAPM_PRE_PMD); | 588 | ret = w->event(w, |
589 | NULL, SND_SOC_DAPM_PRE_PMD); | ||
583 | if (ret < 0) | 590 | if (ret < 0) |
584 | return ret; | 591 | return ret; |
585 | } | 592 | } |
586 | dapm_update_bits(w); | 593 | dapm_update_bits(w); |
587 | if (w->event_flags & SND_SOC_DAPM_POST_PMD) { | 594 | if (w->event_flags & SND_SOC_DAPM_POST_PMD) { |
588 | ret = w->event(w, SND_SOC_DAPM_POST_PMD); | 595 | ret = w->event(w, |
596 | NULL, SND_SOC_DAPM_POST_PMD); | ||
589 | if (ret < 0) | 597 | if (ret < 0) |
590 | return ret; | 598 | return ret; |
591 | } | 599 | } |
@@ -1095,13 +1103,17 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, | |||
1095 | dapm_mixer_update_power(widget, kcontrol, reg, val_mask, val, invert); | 1103 | dapm_mixer_update_power(widget, kcontrol, reg, val_mask, val, invert); |
1096 | if (widget->event) { | 1104 | if (widget->event) { |
1097 | if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { | 1105 | if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { |
1098 | ret = widget->event(widget, SND_SOC_DAPM_PRE_REG); | 1106 | ret = widget->event(widget, kcontrol, |
1099 | if (ret < 0) | 1107 | SND_SOC_DAPM_PRE_REG); |
1108 | if (ret < 0) { | ||
1109 | ret = 1; | ||
1100 | goto out; | 1110 | goto out; |
1111 | } | ||
1101 | } | 1112 | } |
1102 | ret = snd_soc_update_bits(widget->codec, reg, val_mask, val); | 1113 | ret = snd_soc_update_bits(widget->codec, reg, val_mask, val); |
1103 | if (widget->event_flags & SND_SOC_DAPM_POST_REG) | 1114 | if (widget->event_flags & SND_SOC_DAPM_POST_REG) |
1104 | ret = widget->event(widget, SND_SOC_DAPM_POST_REG); | 1115 | ret = widget->event(widget, kcontrol, |
1116 | SND_SOC_DAPM_POST_REG); | ||
1105 | } else | 1117 | } else |
1106 | ret = snd_soc_update_bits(widget->codec, reg, val_mask, val); | 1118 | ret = snd_soc_update_bits(widget->codec, reg, val_mask, val); |
1107 | 1119 | ||
@@ -1176,13 +1188,15 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, | |||
1176 | dapm_mux_update_power(widget, kcontrol, mask, mux, e); | 1188 | dapm_mux_update_power(widget, kcontrol, mask, mux, e); |
1177 | if (widget->event) { | 1189 | if (widget->event) { |
1178 | if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { | 1190 | if (widget->event_flags & SND_SOC_DAPM_PRE_REG) { |
1179 | ret = widget->event(widget, SND_SOC_DAPM_PRE_REG); | 1191 | ret = widget->event(widget, |
1192 | kcontrol, SND_SOC_DAPM_PRE_REG); | ||
1180 | if (ret < 0) | 1193 | if (ret < 0) |
1181 | goto out; | 1194 | goto out; |
1182 | } | 1195 | } |
1183 | ret = snd_soc_update_bits(widget->codec, e->reg, mask, val); | 1196 | ret = snd_soc_update_bits(widget->codec, e->reg, mask, val); |
1184 | if (widget->event_flags & SND_SOC_DAPM_POST_REG) | 1197 | if (widget->event_flags & SND_SOC_DAPM_POST_REG) |
1185 | ret = widget->event(widget, SND_SOC_DAPM_POST_REG); | 1198 | ret = widget->event(widget, |
1199 | kcontrol, SND_SOC_DAPM_POST_REG); | ||
1186 | } else | 1200 | } else |
1187 | ret = snd_soc_update_bits(widget->codec, e->reg, mask, val); | 1201 | ret = snd_soc_update_bits(widget->codec, e->reg, mask, val); |
1188 | 1202 | ||