提交 cdcd9268 编写于 作者: J Jonathan Woithe 提交者: Jaroslav Kysela

[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: NTakashi Iwai <tiwai@suse.de>
上级 17e7aec6
...@@ -306,9 +306,32 @@ static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v ...@@ -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); val = alc_pin_mode_min(dir);
change = pinctl != alc_pin_mode_values[val]; 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, snd_hda_codec_write(codec,nid,0,AC_VERB_SET_PIN_WIDGET_CONTROL,
alc_pin_mode_values[val]); 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; return change;
} }
...@@ -2744,14 +2767,16 @@ static struct hda_verb alc260_fujitsu_init_verbs[] = { ...@@ -2744,14 +2767,16 @@ static struct hda_verb alc260_fujitsu_init_verbs[] = {
/* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, {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}, {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
/* Unmute Line1 pin widget input for when this pin is used as input /* Unmute input buffer of pin widget used for Line-in (no equiv
* (no equiv mixer ctrl). Having input and output unmuted doesn't * mixer ctrl)
* 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) */
{0x12, 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 */ /* Mute capture amp left and right */
...@@ -2882,7 +2907,11 @@ static struct hda_verb alc260_test_init_verbs[] = { ...@@ -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_IN_MUTE(1)},
{0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, {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}, {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
{0x0f, 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}, {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
...@@ -2892,17 +2921,6 @@ static struct hda_verb alc260_test_init_verbs[] = { ...@@ -2892,17 +2921,6 @@ static struct hda_verb alc260_test_init_verbs[] = {
/* Also unmute the mono-out pin widget */ /* Also unmute the mono-out pin widget */
{0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, {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 */ /* Mute capture amp left and right */
{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
/* Set ADC connection select to match default mixer setting - line /* Set ADC connection select to match default mixer setting - line
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册