aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-12-14 12:26:02 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-12 02:30:18 -0500
commit829f69ea590613c7a8b4b053266265947541b3f9 (patch)
tree1d6fefdf84d3cd0fe45d342ba8d2f1012052143b /sound/pci
parent8dd48678584c4cf2588335f9ee816a5747980cf6 (diff)
ALSA: hda/realtek - Initialize loopback paths properly
Now we have a complete list of loopback paths, thus we can initialize the paths more completely based on it, instead of assuming a direct connection from pin to mixer. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_realtek.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9026b60bdc35..d5181b017375 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2639,6 +2639,7 @@ static int new_analog_input(struct hda_codec *codec, hda_nid_t pin,
2639{ 2639{
2640 struct alc_spec *spec = codec->spec; 2640 struct alc_spec *spec = codec->spec;
2641 struct nid_path *path; 2641 struct nid_path *path;
2642 unsigned int val;
2642 int err, idx; 2643 int err, idx;
2643 2644
2644 if (!nid_has_volume(codec, mix_nid, HDA_INPUT) && 2645 if (!nid_has_volume(codec, mix_nid, HDA_INPUT) &&
@@ -2654,19 +2655,22 @@ static int new_analog_input(struct hda_codec *codec, hda_nid_t pin,
2654 2655
2655 idx = path->idx[path->depth - 1]; 2656 idx = path->idx[path->depth - 1];
2656 if (nid_has_volume(codec, mix_nid, HDA_INPUT)) { 2657 if (nid_has_volume(codec, mix_nid, HDA_INPUT)) {
2657 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, 2658 val = HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT);
2658 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); 2659 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, val);
2659 if (err < 0) 2660 if (err < 0)
2660 return err; 2661 return err;
2662 path->ctls[NID_PATH_VOL_CTL] = val;
2661 } 2663 }
2662 2664
2663 if (nid_has_mute(codec, mix_nid, HDA_INPUT)) { 2665 if (nid_has_mute(codec, mix_nid, HDA_INPUT)) {
2664 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, 2666 val = HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT);
2665 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); 2667 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, val);
2666 if (err < 0) 2668 if (err < 0)
2667 return err; 2669 return err;
2670 path->ctls[NID_PATH_MUTE_CTL] = val;
2668 } 2671 }
2669 2672
2673 path->active = true;
2670 add_loopback_list(spec, mix_nid, idx); 2674 add_loopback_list(spec, mix_nid, idx);
2671 return 0; 2675 return 0;
2672} 2676}
@@ -2848,6 +2852,11 @@ static int alc_auto_create_shared_input(struct hda_codec *codec)
2848 return 0; 2852 return 0;
2849} 2853}
2850 2854
2855static struct nid_path *
2856get_nid_path(struct hda_codec *codec, hda_nid_t from_nid, hda_nid_t to_nid);
2857static void activate_path(struct hda_codec *codec, struct nid_path *path,
2858 bool enable);
2859
2851static int get_pin_type(int line_out_type) 2860static int get_pin_type(int line_out_type)
2852{ 2861{
2853 if (line_out_type == AUTO_PIN_HP_OUT) 2862 if (line_out_type == AUTO_PIN_HP_OUT)
@@ -2871,15 +2880,14 @@ static void alc_auto_init_analog_input(struct hda_codec *codec)
2871 AC_VERB_SET_AMP_GAIN_MUTE, 2880 AC_VERB_SET_AMP_GAIN_MUTE,
2872 AMP_OUT_MUTE); 2881 AMP_OUT_MUTE);
2873 } 2882 }
2874 }
2875 2883
2876 /* mute all loopback inputs */ 2884 /* mute loopback inputs */
2877 if (spec->mixer_nid) { 2885 if (spec->mixer_nid) {
2878 int nums = snd_hda_get_num_conns(codec, spec->mixer_nid); 2886 struct nid_path *path;
2879 for (i = 0; i < nums; i++) 2887 path = get_nid_path(codec, nid, spec->mixer_nid);
2880 snd_hda_codec_write(codec, spec->mixer_nid, 0, 2888 if (path)
2881 AC_VERB_SET_AMP_GAIN_MUTE, 2889 activate_path(codec, path, path->active);
2882 AMP_IN_MUTE(i)); 2890 }
2883 } 2891 }
2884} 2892}
2885 2893