aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorJonathan Woithe <jwoithe@physics.adelaide.edu.au>2006-02-28 11:36:42 +0100
committerJaroslav Kysela <perex@suse.cz>2006-03-22 10:32:10 +0100
commitcdcd9268a1b03c6695ea07983ce029b2b4a099d8 (patch)
treeafe683a99ef1db2e092fcd595327f9f27790e195 /sound/pci/hda
parent[ALSA] HDA/ALC260: 1/7 - Fix test model input mux label (diff)
downloadlinux-dev-cdcd9268a1b03c6695ea07983ce029b2b4a099d8.tar.xz
linux-dev-cdcd9268a1b03c6695ea07983ce029b2b4a099d8.zip
[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>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/patch_realtek.c58
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
val = alc_pin_mode_min(dir);
change = pinctl != alc_pin_mode_values[val];
- if (change)
+ if (change) {
+ /* Set pin mode to that requested */
snd_hda_codec_write(codec,nid,0,AC_VERB_SET_PIN_WIDGET_CONTROL,
alc_pin_mode_values[val]);
+
+ /* Also enable the retasking pin's input/output as required
+ * for the requested pin mode. Enum values of 2 or less are
+ * input modes.
+ *
+ * Dynamically switching the input/output buffers probably
+ * reduces noise slightly, particularly on input. However,
+ * havingboth input and output buffers enabled
+ * simultaneously doesn't seem to be problematic.
+ */
+ if (val <= 2) {
+ snd_hda_codec_write(codec,nid,0,AC_VERB_SET_AMP_GAIN_MUTE,
+ AMP_OUT_MUTE);
+ snd_hda_codec_write(codec,nid,0,AC_VERB_SET_AMP_GAIN_MUTE,
+ AMP_IN_UNMUTE(0));
+ } else {
+ snd_hda_codec_write(codec,nid,0,AC_VERB_SET_AMP_GAIN_MUTE,
+ AMP_IN_MUTE(0));
+ snd_hda_codec_write(codec,nid,0,AC_VERB_SET_AMP_GAIN_MUTE,
+ AMP_OUT_UNMUTE);
+ }
+ }
return change;
}
@@ -2744,14 +2767,16 @@ static struct hda_verb alc260_fujitsu_init_verbs[] = {
/* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
- /* Unmute Line1 pin widget amp left and right (no equiv mixer ctrl) */
+ /* Unmute Line1 pin widget output buffer since it starts as an output.
+ * If the pin mode is changed by the user the pin mode control will
+ * take care of enabling the pin's input/output buffers as needed.
+ * Therefore there's no need to enable the input buffer at this
+ * stage.
+ */
{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
- /* Unmute Line1 pin widget input for when this pin is used as input
- * (no equiv mixer ctrl). Having input and output unmuted doesn't
- * seem to cause a problem.
- */
- {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
- /* Unmute pin widget used for Line-in (no equiv mixer ctrl) */
+ /* Unmute input buffer of pin widget used for Line-in (no equiv
+ * mixer ctrl)
+ */
{0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
/* Mute capture amp left and right */
@@ -2882,7 +2907,11 @@ static struct hda_verb alc260_test_init_verbs[] = {
{0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
{0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
- /* Unmute retasking pin widget output amp left/right (no mixer ctrl) */
+ /* Unmute retasking pin widget output buffers since the default
+ * state appears to be output. As the pin mode is changed by the
+ * user the pin mode control will take care of enabling the pin's
+ * input/output buffers as needed.
+ */
{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
@@ -2892,17 +2921,6 @@ static struct hda_verb alc260_test_init_verbs[] = {
/* Also unmute the mono-out pin widget */
{0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
- /* Also unmute the retasking pin input amps. Having the input and
- * output amps unmuted at the same time doesn't appear to cause any
- * trouble.
- */
- {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
- {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
- {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
- {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
- {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
- {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
-
/* Mute capture amp left and right */
{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
/* Set ADC connection select to match default mixer setting - line