diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-06-27 09:00:48 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-06-27 09:07:28 -0400 |
commit | 6d86b4fb407995081c85106188e2d2404529d71c (patch) | |
tree | f6290f413ecc835e7368aed076f5e2777fd847ea /sound/pci/hda/patch_realtek.c | |
parent | 00c6850dde513bac2b901d4e9714d8a580291143 (diff) |
ALSA: hda - Fix auto-init of output volumes of Realtek codecs
Fix the regression introduced by the commit
1f0f4b8036b1fe1347cb4f1f199601b87de9be46
ALSA: hda - Reduce static init verbs for Realtek auto-parsers
The input amps of mixer widgets should be unmuted as default (as
usually they have no assigned mixer switches).
More fixes in this commit are, however, for ALC260: ALC260 codec can
have multiple output mixers connnected to a single DAC althouh the
driver didn't pick up them properly.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 5e4efb75879..b2dcb84dcbb 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -5629,9 +5629,9 @@ static void alc880_auto_init_dac(struct hda_codec *codec, hda_nid_t nid) | |||
5629 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 5629 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
5630 | AMP_OUT_ZERO); | 5630 | AMP_OUT_ZERO); |
5631 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 5631 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
5632 | AMP_IN_MUTE(0)); | 5632 | AMP_IN_UNMUTE(0)); |
5633 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 5633 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
5634 | AMP_IN_MUTE(1)); | 5634 | AMP_IN_UNMUTE(1)); |
5635 | } | 5635 | } |
5636 | 5636 | ||
5637 | static void alc880_auto_init_multi_out(struct hda_codec *codec) | 5637 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
@@ -7186,27 +7186,33 @@ static const struct hda_verb alc260_test_init_verbs[] = { | |||
7186 | * for BIOS auto-configuration | 7186 | * for BIOS auto-configuration |
7187 | */ | 7187 | */ |
7188 | 7188 | ||
7189 | /* convert from pin to volume-mixer widget */ | ||
7190 | static hda_nid_t alc260_pin_to_vol_mix(hda_nid_t nid) | ||
7191 | { | ||
7192 | if (nid >= 0x0f && nid <= 0x11) | ||
7193 | return nid - 0x7; | ||
7194 | else if (nid >= 0x12 && nid <= 0x15) | ||
7195 | return 0x08; | ||
7196 | else | ||
7197 | return 0; | ||
7198 | } | ||
7199 | |||
7189 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, | 7200 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
7190 | const char *pfx, int *vol_bits) | 7201 | const char *pfx, int *vol_bits) |
7191 | { | 7202 | { |
7192 | hda_nid_t nid_vol; | 7203 | hda_nid_t nid_vol; |
7193 | unsigned long vol_val, sw_val; | 7204 | unsigned long vol_val, sw_val; |
7194 | int err; | 7205 | int chs, err; |
7195 | 7206 | ||
7196 | if (nid >= 0x0f && nid < 0x11) { | 7207 | nid_vol = alc260_pin_to_vol_mix(nid); |
7197 | nid_vol = nid - 0x7; | 7208 | if (!nid_vol) |
7198 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | ||
7199 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | ||
7200 | } else if (nid == 0x11) { | ||
7201 | nid_vol = nid - 0x7; | ||
7202 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); | ||
7203 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | ||
7204 | } else if (nid >= 0x12 && nid <= 0x15) { | ||
7205 | nid_vol = 0x08; | ||
7206 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); | ||
7207 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | ||
7208 | } else | ||
7209 | return 0; /* N/A */ | 7209 | return 0; /* N/A */ |
7210 | if (nid == 0x11) | ||
7211 | chs = 2; | ||
7212 | else | ||
7213 | chs = 3; | ||
7214 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, chs, 0, HDA_OUTPUT); | ||
7215 | sw_val = HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT); | ||
7210 | 7216 | ||
7211 | if (!(*vol_bits & (1 << nid_vol))) { | 7217 | if (!(*vol_bits & (1 << nid_vol))) { |
7212 | /* first control for the volume widget */ | 7218 | /* first control for the volume widget */ |
@@ -7271,6 +7277,8 @@ static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | |||
7271 | hda_nid_t nid, int pin_type, | 7277 | hda_nid_t nid, int pin_type, |
7272 | int sel_idx) | 7278 | int sel_idx) |
7273 | { | 7279 | { |
7280 | hda_nid_t mix; | ||
7281 | |||
7274 | alc_set_pin_output(codec, nid, pin_type); | 7282 | alc_set_pin_output(codec, nid, pin_type); |
7275 | /* need the manual connection? */ | 7283 | /* need the manual connection? */ |
7276 | if (nid >= 0x12) { | 7284 | if (nid >= 0x12) { |
@@ -7278,26 +7286,22 @@ static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, | |||
7278 | snd_hda_codec_write(codec, idx + 0x0b, 0, | 7286 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
7279 | AC_VERB_SET_CONNECT_SEL, sel_idx); | 7287 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
7280 | } | 7288 | } |
7281 | } | ||
7282 | 7289 | ||
7283 | static void alc260_auto_init_dac(struct hda_codec *codec, hda_nid_t nid) | 7290 | mix = alc260_pin_to_vol_mix(nid); |
7284 | { | 7291 | if (!mix) |
7285 | if (!nid) | ||
7286 | return; | 7292 | return; |
7287 | nid += 0x06; /* DAC -> MIX */ | 7293 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
7288 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
7289 | AMP_OUT_ZERO); | 7294 | AMP_OUT_ZERO); |
7290 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 7295 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
7291 | AMP_IN_MUTE(0)); | 7296 | AMP_IN_UNMUTE(0)); |
7292 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 7297 | snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
7293 | AMP_IN_MUTE(1)); | 7298 | AMP_IN_UNMUTE(1)); |
7294 | } | 7299 | } |
7295 | 7300 | ||
7296 | static void alc260_auto_init_multi_out(struct hda_codec *codec) | 7301 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
7297 | { | 7302 | { |
7298 | struct alc_spec *spec = codec->spec; | 7303 | struct alc_spec *spec = codec->spec; |
7299 | hda_nid_t nid; | 7304 | hda_nid_t nid; |
7300 | int i; | ||
7301 | 7305 | ||
7302 | nid = spec->autocfg.line_out_pins[0]; | 7306 | nid = spec->autocfg.line_out_pins[0]; |
7303 | if (nid) { | 7307 | if (nid) { |
@@ -7312,12 +7316,6 @@ static void alc260_auto_init_multi_out(struct hda_codec *codec) | |||
7312 | nid = spec->autocfg.hp_pins[0]; | 7316 | nid = spec->autocfg.hp_pins[0]; |
7313 | if (nid) | 7317 | if (nid) |
7314 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); | 7318 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
7315 | |||
7316 | /* mute DACs */ | ||
7317 | for (i = 0; i < spec->multiout.num_dacs; i++) | ||
7318 | alc260_auto_init_dac(codec, spec->multiout.dac_nids[i]); | ||
7319 | alc260_auto_init_dac(codec, spec->multiout.extra_out_nid[0]); | ||
7320 | alc260_auto_init_dac(codec, spec->multiout.hp_nid); | ||
7321 | } | 7319 | } |
7322 | 7320 | ||
7323 | #define alc260_auto_init_analog_input alc880_auto_init_analog_input | 7321 | #define alc260_auto_init_analog_input alc880_auto_init_analog_input |