diff options
author | Wai Yew CHAY <wychay@ctl.creative.com> | 2009-06-22 08:52:34 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-06-22 08:53:51 -0400 |
commit | 29959a09cc1aabd2d5f4f03afc0305de6bd29248 (patch) | |
tree | e7e4ed3d33995ab9e83ae378bb9d42fce63f8fde /sound/pci/ctxfi/ctmixer.c | |
parent | a8f4310be59a2e7fc80fba945bcb32b18f4ad54f (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.c | 92 |
1 files changed, 63 insertions, 29 deletions
diff --git a/sound/pci/ctxfi/ctmixer.c b/sound/pci/ctxfi/ctmixer.c index 666722d9de41..f26d7cd9db9f 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) | |||
462 | return; | 462 | return; |
463 | } | 463 | } |
464 | 464 | ||
465 | static void do_switch(struct ct_atc *atc, enum CTALSA_MIXER_CTL type, int state) | ||
466 | { | ||
467 | struct ct_mixer *mixer = atc->mixer; | ||
468 | |||
469 | /* Do changes in mixer. */ | ||
470 | if ((SWH_CAPTURE_START <= type) && (SWH_CAPTURE_END >= type)) { | ||
471 | if (state) { | ||
472 | ct_mixer_recording_select(mixer, | ||
473 | get_amixer_index(type)); | ||
474 | } else { | ||
475 | ct_mixer_recording_unselect(mixer, | ||
476 | get_amixer_index(type)); | ||
477 | } | ||
478 | } | ||
479 | /* Do changes out of mixer. */ | ||
480 | if (state && (MIXER_LINEIN_C_S == type || MIXER_MIC_C_S == type)) | ||
481 | do_line_mic_switch(atc, type); | ||
482 | else if (MIXER_WAVEF_P_S == type) | ||
483 | atc->line_front_unmute(atc, state); | ||
484 | else if (MIXER_WAVES_P_S == type) | ||
485 | atc->line_surround_unmute(atc, state); | ||
486 | else if (MIXER_WAVEC_P_S == type) | ||
487 | atc->line_clfe_unmute(atc, state); | ||
488 | else if (MIXER_WAVER_P_S == type) | ||
489 | atc->line_rear_unmute(atc, state); | ||
490 | else if (MIXER_LINEIN_P_S == type) | ||
491 | atc->line_in_unmute(atc, state); | ||
492 | else if (MIXER_SPDIFO_P_S == type) | ||
493 | atc->spdif_out_unmute(atc, state); | ||
494 | else if (MIXER_SPDIFI_P_S == type) | ||
495 | atc->spdif_in_unmute(atc, state); | ||
496 | else if (MIXER_DIGITAL_IO_S == type) | ||
497 | do_digit_io_switch(atc, state); | ||
498 | |||
499 | return; | ||
500 | } | ||
501 | |||
465 | static int ct_alsa_mix_switch_info(struct snd_kcontrol *kcontrol, | 502 | static int ct_alsa_mix_switch_info(struct snd_kcontrol *kcontrol, |
466 | struct snd_ctl_elem_info *uinfo) | 503 | struct snd_ctl_elem_info *uinfo) |
467 | { | 504 | { |
@@ -498,35 +535,7 @@ static int ct_alsa_mix_switch_put(struct snd_kcontrol *kcontrol, | |||
498 | return 0; | 535 | return 0; |
499 | 536 | ||
500 | set_switch_state(mixer, type, state); | 537 | set_switch_state(mixer, type, state); |
501 | /* Do changes in mixer. */ | 538 | do_switch(atc, type, state); |
502 | if ((SWH_CAPTURE_START <= type) && (SWH_CAPTURE_END >= type)) { | ||
503 | if (state) { | ||
504 | ct_mixer_recording_select(mixer, | ||
505 | get_amixer_index(type)); | ||
506 | } else { | ||
507 | ct_mixer_recording_unselect(mixer, | ||
508 | get_amixer_index(type)); | ||
509 | } | ||
510 | } | ||
511 | /* Do changes out of mixer. */ | ||
512 | if (state && (MIXER_LINEIN_C_S == type || MIXER_MIC_C_S == type)) | ||
513 | do_line_mic_switch(atc, type); | ||
514 | else if (MIXER_WAVEF_P_S == type) | ||
515 | atc->line_front_unmute(atc, state); | ||
516 | else if (MIXER_WAVES_P_S == type) | ||
517 | atc->line_surround_unmute(atc, state); | ||
518 | else if (MIXER_WAVEC_P_S == type) | ||
519 | atc->line_clfe_unmute(atc, state); | ||
520 | else if (MIXER_WAVER_P_S == type) | ||
521 | atc->line_rear_unmute(atc, state); | ||
522 | else if (MIXER_LINEIN_P_S == type) | ||
523 | atc->line_in_unmute(atc, state); | ||
524 | else if (MIXER_SPDIFO_P_S == type) | ||
525 | atc->spdif_out_unmute(atc, state); | ||
526 | else if (MIXER_SPDIFI_P_S == type) | ||
527 | atc->spdif_in_unmute(atc, state); | ||
528 | else if (MIXER_DIGITAL_IO_S == type) | ||
529 | do_digit_io_switch(atc, state); | ||
530 | 539 | ||
531 | return 1; | 540 | return 1; |
532 | } | 541 | } |
@@ -1039,6 +1048,28 @@ mixer_set_input_right(struct ct_mixer *mixer, | |||
1039 | return 0; | 1048 | return 0; |
1040 | } | 1049 | } |
1041 | 1050 | ||
1051 | #ifdef CONFIG_PM | ||
1052 | static int mixer_resume(struct ct_mixer *mixer) | ||
1053 | { | ||
1054 | int i, state; | ||
1055 | struct amixer *amixer; | ||
1056 | |||
1057 | /* resume topology and volume gain. */ | ||
1058 | for (i = 0; i < NUM_CT_AMIXERS*CHN_NUM; i++) { | ||
1059 | amixer = mixer->amixers[i]; | ||
1060 | amixer->ops->commit_write(amixer); | ||
1061 | } | ||
1062 | |||
1063 | /* resume switch state. */ | ||
1064 | for (i = SWH_MIXER_START; i <= SWH_MIXER_END; i++) { | ||
1065 | state = get_switch_state(mixer, i); | ||
1066 | do_switch(mixer->atc, i, state); | ||
1067 | } | ||
1068 | |||
1069 | return 0; | ||
1070 | } | ||
1071 | #endif | ||
1072 | |||
1042 | int ct_mixer_destroy(struct ct_mixer *mixer) | 1073 | int ct_mixer_destroy(struct ct_mixer *mixer) |
1043 | { | 1074 | { |
1044 | struct sum_mgr *sum_mgr = (struct sum_mgr *)mixer->atc->rsc_mgrs[SUM]; | 1075 | 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) | |||
1087 | mixer->get_output_ports = mixer_get_output_ports; | 1118 | mixer->get_output_ports = mixer_get_output_ports; |
1088 | mixer->set_input_left = mixer_set_input_left; | 1119 | mixer->set_input_left = mixer_set_input_left; |
1089 | mixer->set_input_right = mixer_set_input_right; | 1120 | mixer->set_input_right = mixer_set_input_right; |
1121 | #ifdef CONFIG_PM | ||
1122 | mixer->resume = mixer_resume; | ||
1123 | #endif | ||
1090 | 1124 | ||
1091 | /* Allocate chip resources for mixer obj */ | 1125 | /* Allocate chip resources for mixer obj */ |
1092 | err = ct_mixer_get_resources(mixer); | 1126 | err = ct_mixer_get_resources(mixer); |