diff options
author | Jonathan Woithe <jwoithe@physics.adelaide.edu.au> | 2006-02-28 05:36:42 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-22 04:32:10 -0500 |
commit | cdcd9268a1b03c6695ea07983ce029b2b4a099d8 (patch) | |
tree | afe683a99ef1db2e092fcd595327f9f27790e195 | |
parent | 17e7aec680a252ec0cea6d886d3983319af43ac4 (diff) |
[ALSA] HDA/ALC260: 2/7 - switch pin buffer enables
Modules: HDA Codec driver
This patch adds functionality which switches the input/output buffer enables
of retasking pins when the user changes their mode with the mode control.
This probably reduces noise *slightly* for recording compared to the case
where both input and output buffers were enabled simultaneously.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index b34d2448d172..600d0a037842 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -306,9 +306,32 @@ static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v | |||
306 | val = alc_pin_mode_min(dir); | 306 | val = alc_pin_mode_min(dir); |
307 | 307 | ||
308 | change = pinctl != alc_pin_mode_values[val]; | 308 | change = pinctl != alc_pin_mode_values[val]; |
309 | if (change) | 309 | if (change) { |
310 | /* Set pin mode to that requested */ | ||
310 | snd_hda_codec_write(codec,nid,0,AC_VERB_SET_PIN_WIDGET_CONTROL, | 311 | snd_hda_codec_write(codec,nid,0,AC_VERB_SET_PIN_WIDGET_CONTROL, |
311 | alc_pin_mode_values[val]); | 312 | alc_pin_mode_values[val]); |
313 | |||
314 | /* Also enable the retasking pin's input/output as required | ||
315 | * for the requested pin mode. Enum values of 2 or less are | ||
316 | * input modes. | ||
317 | * | ||
318 | * Dynamically switching the input/output buffers probably | ||
319 | * reduces noise slightly, particularly on input. However, | ||
320 | * havingboth input and output buffers enabled | ||
321 | * simultaneously doesn't seem to be problematic. | ||
322 | */ | ||
323 | if (val <= 2) { | ||
324 | snd_hda_codec_write(codec,nid,0,AC_VERB_SET_AMP_GAIN_MUTE, | ||
325 | AMP_OUT_MUTE); | ||
326 | snd_hda_codec_write(codec,nid,0,AC_VERB_SET_AMP_GAIN_MUTE, | ||
327 | AMP_IN_UNMUTE(0)); | ||
328 | } else { | ||
329 | snd_hda_codec_write(codec,nid,0,AC_VERB_SET_AMP_GAIN_MUTE, | ||
330 | AMP_IN_MUTE(0)); | ||
331 | snd_hda_codec_write(codec,nid,0,AC_VERB_SET_AMP_GAIN_MUTE, | ||
332 | AMP_OUT_UNMUTE); | ||
333 | } | ||
334 | } | ||
312 | return change; | 335 | return change; |
313 | } | 336 | } |
314 | 337 | ||
@@ -2744,14 +2767,16 @@ static struct hda_verb alc260_fujitsu_init_verbs[] = { | |||
2744 | 2767 | ||
2745 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ | 2768 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
2746 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2769 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2747 | /* Unmute Line1 pin widget amp left and right (no equiv mixer ctrl) */ | 2770 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
2771 | * If the pin mode is changed by the user the pin mode control will | ||
2772 | * take care of enabling the pin's input/output buffers as needed. | ||
2773 | * Therefore there's no need to enable the input buffer at this | ||
2774 | * stage. | ||
2775 | */ | ||
2748 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2776 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2749 | /* Unmute Line1 pin widget input for when this pin is used as input | 2777 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
2750 | * (no equiv mixer ctrl). Having input and output unmuted doesn't | 2778 | * mixer ctrl) |
2751 | * seem to cause a problem. | 2779 | */ |
2752 | */ | ||
2753 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2754 | /* Unmute pin widget used for Line-in (no equiv mixer ctrl) */ | ||
2755 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 2780 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
2756 | 2781 | ||
2757 | /* Mute capture amp left and right */ | 2782 | /* Mute capture amp left and right */ |
@@ -2882,7 +2907,11 @@ static struct hda_verb alc260_test_init_verbs[] = { | |||
2882 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 2907 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
2883 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | 2908 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
2884 | 2909 | ||
2885 | /* Unmute retasking pin widget output amp left/right (no mixer ctrl) */ | 2910 | /* Unmute retasking pin widget output buffers since the default |
2911 | * state appears to be output. As the pin mode is changed by the | ||
2912 | * user the pin mode control will take care of enabling the pin's | ||
2913 | * input/output buffers as needed. | ||
2914 | */ | ||
2886 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2915 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2887 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2916 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2888 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2917 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
@@ -2892,17 +2921,6 @@ static struct hda_verb alc260_test_init_verbs[] = { | |||
2892 | /* Also unmute the mono-out pin widget */ | 2921 | /* Also unmute the mono-out pin widget */ |
2893 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2922 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2894 | 2923 | ||
2895 | /* Also unmute the retasking pin input amps. Having the input and | ||
2896 | * output amps unmuted at the same time doesn't appear to cause any | ||
2897 | * trouble. | ||
2898 | */ | ||
2899 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2900 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2901 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2902 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2903 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2904 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
2905 | |||
2906 | /* Mute capture amp left and right */ | 2924 | /* Mute capture amp left and right */ |
2907 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 2925 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
2908 | /* Set ADC connection select to match default mixer setting - line | 2926 | /* Set ADC connection select to match default mixer setting - line |