aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-07-21 07:45:56 -0400
committerTakashi Iwai <tiwai@suse.de>2011-07-21 07:55:10 -0400
commit020066d1ecc95d74da9be6beb436ac575af01271 (patch)
tree706657b35946c4f4ff7606af44a27aefa35f5057 /sound/pci
parent737c265bb8399b97231e5b10b5b2375914206427 (diff)
ALSA: hda - Fix indep-HP path (de-)activation for VT1708* codecs
This patch fixes non-working indep-HP control on VT1708* codecs. The problems are that via_independent_hp_put() wasn't fixed to follow the recent change of three HP paths, and hp_indep_path didn't contain the amp nids of mixer elements. Together with the fixes, a few code clean-ups are done. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_via.c92
1 files changed, 52 insertions, 40 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 5b0342635eb..761339a0694 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -566,31 +566,44 @@ static void via_auto_init_multi_out(struct hda_codec *codec)
566 } 566 }
567} 567}
568 568
569static void via_auto_init_hp_out(struct hda_codec *codec) 569/* deactivate the inactive headphone-paths */
570static void deactivate_hp_paths(struct hda_codec *codec)
570{ 571{
571 struct via_spec *spec = codec->spec; 572 struct via_spec *spec = codec->spec;
572 int shared = spec->hp_indep_shared; 573 int shared = spec->hp_indep_shared;
573 574
574 if (!spec->hp_path.depth) {
575 via_auto_init_output(codec, &spec->hp_mix_path, PIN_HP, true);
576 return;
577 }
578 if (spec->hp_independent_mode) { 575 if (spec->hp_independent_mode) {
579 activate_output_path(codec, &spec->hp_path, false, false); 576 activate_output_path(codec, &spec->hp_path, false, false);
580 activate_output_path(codec, &spec->hp_mix_path, false, false); 577 activate_output_path(codec, &spec->hp_mix_path, false, false);
581 if (shared) 578 if (shared)
582 activate_output_path(codec, &spec->out_path[shared], 579 activate_output_path(codec, &spec->out_path[shared],
583 false, false); 580 false, false);
584 via_auto_init_output(codec, &spec->hp_indep_path, PIN_HP, true); 581 } else if (spec->aamix_mode || !spec->hp_path.depth) {
585 } else if (spec->aamix_mode) { 582 activate_output_path(codec, &spec->hp_indep_path, false, false);
586 activate_output_path(codec, &spec->hp_path, false, false); 583 activate_output_path(codec, &spec->hp_path, false, false);
587 via_auto_init_output(codec, &spec->hp_mix_path, PIN_HP, true);
588 } else { 584 } else {
585 activate_output_path(codec, &spec->hp_indep_path, false, false);
589 activate_output_path(codec, &spec->hp_mix_path, false, false); 586 activate_output_path(codec, &spec->hp_mix_path, false, false);
590 via_auto_init_output(codec, &spec->hp_path, PIN_HP, true);
591 } 587 }
592} 588}
593 589
590static void via_auto_init_hp_out(struct hda_codec *codec)
591{
592 struct via_spec *spec = codec->spec;
593
594 if (!spec->hp_path.depth) {
595 via_auto_init_output(codec, &spec->hp_mix_path, PIN_HP, true);
596 return;
597 }
598 deactivate_hp_paths(codec);
599 if (spec->hp_independent_mode)
600 via_auto_init_output(codec, &spec->hp_indep_path, PIN_HP, true);
601 else if (spec->aamix_mode)
602 via_auto_init_output(codec, &spec->hp_mix_path, PIN_HP, true);
603 else
604 via_auto_init_output(codec, &spec->hp_path, PIN_HP, true);
605}
606
594static void via_auto_init_speaker_out(struct hda_codec *codec) 607static void via_auto_init_speaker_out(struct hda_codec *codec)
595{ 608{
596 struct via_spec *spec = codec->spec; 609 struct via_spec *spec = codec->spec;
@@ -847,18 +860,19 @@ static int via_independent_hp_put(struct snd_kcontrol *kcontrol,
847 } 860 }
848 spec->hp_independent_mode = cur; 861 spec->hp_independent_mode = cur;
849 shared = spec->hp_indep_shared; 862 shared = spec->hp_indep_shared;
850 if (cur) { 863 deactivate_hp_paths(codec);
851 activate_output_path(codec, &spec->hp_mix_path, false, false); 864 if (cur)
852 if (shared) 865 activate_output_path(codec, &spec->hp_indep_path, true, false);
853 activate_output_path(codec, &spec->out_path[shared], 866 else {
854 false, false);
855 activate_output_path(codec, &spec->hp_path, true, false);
856 } else {
857 activate_output_path(codec, &spec->hp_path, false, false);
858 if (shared) 867 if (shared)
859 activate_output_path(codec, &spec->out_path[shared], 868 activate_output_path(codec, &spec->out_path[shared],
860 true, false); 869 true, false);
861 activate_output_path(codec, &spec->hp_mix_path, true, false); 870 if (spec->aamix_mode || !spec->hp_path.depth)
871 activate_output_path(codec, &spec->hp_mix_path,
872 true, false);
873 else
874 activate_output_path(codec, &spec->hp_path,
875 true, false);
862 } 876 }
863 877
864 switch_indep_hp_dacs(codec); 878 switch_indep_hp_dacs(codec);
@@ -1928,6 +1942,12 @@ static void mangle_smart51(struct hda_codec *codec)
1928 } 1942 }
1929} 1943}
1930 1944
1945static void copy_path_mixer_ctls(struct nid_path *dst, struct nid_path *src)
1946{
1947 dst->vol_ctl = src->vol_ctl;
1948 dst->mute_ctl = src->mute_ctl;
1949}
1950
1931/* add playback controls from the parsed DAC table */ 1951/* add playback controls from the parsed DAC table */
1932static int via_auto_create_multi_out_ctls(struct hda_codec *codec) 1952static int via_auto_create_multi_out_ctls(struct hda_codec *codec)
1933{ 1953{
@@ -1976,14 +1996,10 @@ static int via_auto_create_multi_out_ctls(struct hda_codec *codec)
1976 if (err < 0) 1996 if (err < 0)
1977 return err; 1997 return err;
1978 } 1998 }
1979 if (path != spec->out_path + i) { 1999 if (path != spec->out_path + i)
1980 spec->out_path[i].vol_ctl = path->vol_ctl; 2000 copy_path_mixer_ctls(&spec->out_path[i], path);
1981 spec->out_path[i].mute_ctl = path->mute_ctl; 2001 if (path == spec->out_path && spec->out_mix_path.depth)
1982 } 2002 copy_path_mixer_ctls(&spec->out_mix_path, path);
1983 if (path == spec->out_path && spec->out_mix_path.depth) {
1984 spec->out_mix_path.vol_ctl = path->vol_ctl;
1985 spec->out_mix_path.mute_ctl = path->mute_ctl;
1986 }
1987 } 2003 }
1988 2004
1989 idx = get_connection_index(codec, spec->aa_mix_nid, 2005 idx = get_connection_index(codec, spec->aa_mix_nid,
@@ -2058,13 +2074,12 @@ static int via_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
2058 err = create_ch_ctls(codec, "Headphone", 3, check_dac, path); 2074 err = create_ch_ctls(codec, "Headphone", 3, check_dac, path);
2059 if (err < 0) 2075 if (err < 0)
2060 return err; 2076 return err;
2061 if (check_dac) { 2077 if (check_dac)
2062 spec->hp_mix_path.vol_ctl = path->vol_ctl; 2078 copy_path_mixer_ctls(&spec->hp_mix_path, path);
2063 spec->hp_mix_path.mute_ctl = path->mute_ctl; 2079 else
2064 } else { 2080 copy_path_mixer_ctls(&spec->hp_path, path);
2065 spec->hp_path.vol_ctl = path->vol_ctl; 2081 if (spec->hp_indep_path.depth)
2066 spec->hp_path.mute_ctl = path->mute_ctl; 2082 copy_path_mixer_ctls(&spec->hp_indep_path, path);
2067 }
2068 return 0; 2083 return 0;
2069} 2084}
2070 2085
@@ -2106,13 +2121,10 @@ static int via_auto_create_speaker_ctls(struct hda_codec *codec)
2106 err = create_ch_ctls(codec, "Speaker", 3, check_dac, path); 2121 err = create_ch_ctls(codec, "Speaker", 3, check_dac, path);
2107 if (err < 0) 2122 if (err < 0)
2108 return err; 2123 return err;
2109 if (check_dac) { 2124 if (check_dac)
2110 spec->speaker_mix_path.vol_ctl = path->vol_ctl; 2125 copy_path_mixer_ctls(&spec->speaker_mix_path, path);
2111 spec->speaker_mix_path.mute_ctl = path->mute_ctl; 2126 else
2112 } else { 2127 copy_path_mixer_ctls(&spec->speaker_path, path);
2113 spec->speaker_path.vol_ctl = path->vol_ctl;
2114 spec->speaker_path.mute_ctl = path->mute_ctl;
2115 }
2116 return 0; 2128 return 0;
2117} 2129}
2118 2130