aboutsummaryrefslogtreecommitdiff
path: root/sound/pci/ctxfi/ctmixer.c
diff options
context:
space:
mode:
authorWai Yew CHAY <wychay@ctl.creative.com>2009-06-22 14:52:34 +0200
committerTakashi Iwai <tiwai@suse.de>2009-06-22 14:53:51 +0200
commit29959a09cc1aabd2d5f4f03afc0305de6bd29248 (patch)
treee7e4ed3d33995ab9e83ae378bb9d42fce63f8fde /sound/pci/ctxfi/ctmixer.c
parenta8f4310be59a2e7fc80fba945bcb32b18f4ad54f (diff)
ALSA: ctxfi - Add PM support
Added the suspend/resume support to ctxfi driver. The team tested on the following seems ok: AMD Athlon 64 3500+ / ASUS A8N-E / 512MB DDR ATI / Radeon X1300 20k1 & 20k2 cards Signed-off-by: Wai Yew CHAY <wychay@ctl.creative.com> Singed-off-by: Ryan RICHARDS <ryan_richards@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ctxfi/ctmixer.c')
-rw-r--r--sound/pci/ctxfi/ctmixer.c92
1 files changed, 63 insertions, 29 deletions
diff --git a/sound/pci/ctxfi/ctmixer.c b/sound/pci/ctxfi/ctmixer.c
index 666722d9de4..f26d7cd9db9 100644
--- a/sound/pci/ctxfi/ctmixer.c
+++ b/sound/pci/ctxfi/ctmixer.c
@@ -462,6 +462,43 @@ do_digit_io_switch(struct ct_atc *atc, int state)
return;
}
+static void do_switch(struct ct_atc *atc, enum CTALSA_MIXER_CTL type, int state)
+{
+ struct ct_mixer *mixer = atc->mixer;
+
+ /* Do changes in mixer. */
+ if ((SWH_CAPTURE_START <= type) && (SWH_CAPTURE_END >= type)) {
+ if (state) {
+ ct_mixer_recording_select(mixer,
+ get_amixer_index(type));
+ } else {
+ ct_mixer_recording_unselect(mixer,
+ get_amixer_index(type));
+ }
+ }
+ /* Do changes out of mixer. */
+ if (state && (MIXER_LINEIN_C_S == type || MIXER_MIC_C_S == type))
+ do_line_mic_switch(atc, type);
+ else if (MIXER_WAVEF_P_S == type)
+ atc->line_front_unmute(atc, state);
+ else if (MIXER_WAVES_P_S == type)
+ atc->line_surround_unmute(atc, state);
+ else if (MIXER_WAVEC_P_S == type)
+ atc->line_clfe_unmute(atc, state);
+ else if (MIXER_WAVER_P_S == type)
+ atc->line_rear_unmute(atc, state);
+ else if (MIXER_LINEIN_P_S == type)
+ atc->line_in_unmute(atc, state);
+ else if (MIXER_SPDIFO_P_S == type)
+ atc->spdif_out_unmute(atc, state);
+ else if (MIXER_SPDIFI_P_S == type)
+ atc->spdif_in_unmute(atc, state);
+ else if (MIXER_DIGITAL_IO_S == type)
+ do_digit_io_switch(atc, state);
+
+ return;
+}
+
static int ct_alsa_mix_switch_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
@@ -498,35 +535,7 @@ static int ct_alsa_mix_switch_put(struct snd_kcontrol *kcontrol,
return 0;
set_switch_state(mixer, type, state);
- /* Do changes in mixer. */
- if ((SWH_CAPTURE_START <= type) && (SWH_CAPTURE_END >= type)) {
- if (state) {
- ct_mixer_recording_select(mixer,
- get_amixer_index(type));
- } else {
- ct_mixer_recording_unselect(mixer,
- get_amixer_index(type));
- }
- }
- /* Do changes out of mixer. */
- if (state && (MIXER_LINEIN_C_S == type || MIXER_MIC_C_S == type))
- do_line_mic_switch(atc, type);
- else if (MIXER_WAVEF_P_S == type)
- atc->line_front_unmute(atc, state);
- else if (MIXER_WAVES_P_S == type)
- atc->line_surround_unmute(atc, state);
- else if (MIXER_WAVEC_P_S == type)
- atc->line_clfe_unmute(atc, state);
- else if (MIXER_WAVER_P_S == type)
- atc->line_rear_unmute(atc, state);
- else if (MIXER_LINEIN_P_S == type)
- atc->line_in_unmute(atc, state);
- else if (MIXER_SPDIFO_P_S == type)
- atc->spdif_out_unmute(atc, state);
- else if (MIXER_SPDIFI_P_S == type)
- atc->spdif_in_unmute(atc, state);
- else if (MIXER_DIGITAL_IO_S == type)
- do_digit_io_switch(atc, state);
+ do_switch(atc, type, state);
return 1;
}
@@ -1039,6 +1048,28 @@ mixer_set_input_right(struct ct_mixer *mixer,
return 0;
}
+#ifdef CONFIG_PM
+static int mixer_resume(struct ct_mixer *mixer)
+{
+ int i, state;
+ struct amixer *amixer;
+
+ /* resume topology and volume gain. */
+ for (i = 0; i < NUM_CT_AMIXERS*CHN_NUM; i++) {
+ amixer = mixer->amixers[i];
+ amixer->ops->commit_write(amixer);
+ }
+
+ /* resume switch state. */
+ for (i = SWH_MIXER_START; i <= SWH_MIXER_END; i++) {
+ state = get_switch_state(mixer, i);
+ do_switch(mixer->atc, i, state);
+ }
+
+ return 0;
+}
+#endif
+
int ct_mixer_destroy(struct ct_mixer *mixer)
{
struct sum_mgr *sum_mgr = (struct sum_mgr *)mixer->atc->rsc_mgrs[SUM];
@@ -1087,6 +1118,9 @@ int ct_mixer_create(struct ct_atc *atc, struct ct_mixer **rmixer)
mixer->get_output_ports = mixer_get_output_ports;
mixer->set_input_left = mixer_set_input_left;
mixer->set_input_right = mixer_set_input_right;
+#ifdef CONFIG_PM
+ mixer->resume = mixer_resume;
+#endif
/* Allocate chip resources for mixer obj */
err = ct_mixer_get_resources(mixer);