aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/hda/hda_codec.c4
-rw-r--r--sound/pci/hda/hda_local.h15
-rw-r--r--sound/pci/hda/patch_cmedia.c13
-rw-r--r--sound/pci/hda/patch_realtek.c47
4 files changed, 40 insertions, 39 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index cfd50b56187b..2e9f5877386e 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1889,7 +1889,6 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, struct auto_pin_cfg *c
1889 loc = get_defcfg_location(def_conf); 1889 loc = get_defcfg_location(def_conf);
1890 switch (get_defcfg_device(def_conf)) { 1890 switch (get_defcfg_device(def_conf)) {
1891 case AC_JACK_LINE_OUT: 1891 case AC_JACK_LINE_OUT:
1892 case AC_JACK_SPEAKER:
1893 seq = get_defcfg_sequence(def_conf); 1892 seq = get_defcfg_sequence(def_conf);
1894 assoc = get_defcfg_association(def_conf); 1893 assoc = get_defcfg_association(def_conf);
1895 if (! assoc) 1894 if (! assoc)
@@ -1904,6 +1903,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, struct auto_pin_cfg *c
1904 sequences[cfg->line_outs] = seq; 1903 sequences[cfg->line_outs] = seq;
1905 cfg->line_outs++; 1904 cfg->line_outs++;
1906 break; 1905 break;
1906 case AC_JACK_SPEAKER:
1907 cfg->speaker_pin = nid;
1908 break;
1907 case AC_JACK_HP_OUT: 1909 case AC_JACK_HP_OUT:
1908 cfg->hp_pin = nid; 1910 cfg->hp_pin = nid;
1909 break; 1911 break;
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 05a88fb1d652..31d3c7ef5842 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -214,6 +214,7 @@ enum {
214struct auto_pin_cfg { 214struct auto_pin_cfg {
215 int line_outs; 215 int line_outs;
216 hda_nid_t line_out_pins[4]; /* sorted in the order of Front/Surr/CLFE/Side */ 216 hda_nid_t line_out_pins[4]; /* sorted in the order of Front/Surr/CLFE/Side */
217 hda_nid_t speaker_pin;
217 hda_nid_t hp_pin; 218 hda_nid_t hp_pin;
218 hda_nid_t input_pins[AUTO_PIN_LAST]; 219 hda_nid_t input_pins[AUTO_PIN_LAST];
219 hda_nid_t dig_out_pin; 220 hda_nid_t dig_out_pin;
@@ -228,4 +229,18 @@ struct auto_pin_cfg {
228 229
229int snd_hda_parse_pin_def_config(struct hda_codec *codec, struct auto_pin_cfg *cfg); 230int snd_hda_parse_pin_def_config(struct hda_codec *codec, struct auto_pin_cfg *cfg);
230 231
232/* amp values */
233#define AMP_IN_MUTE(idx) (0x7080 | ((idx)<<8))
234#define AMP_IN_UNMUTE(idx) (0x7000 | ((idx)<<8))
235#define AMP_OUT_MUTE 0xb080
236#define AMP_OUT_UNMUTE 0xb000
237#define AMP_OUT_ZERO 0xb000
238/* pinctl values */
239#define PIN_IN 0x20
240#define PIN_VREF80 0x24
241#define PIN_VREF50 0x21
242#define PIN_OUT 0x40
243#define PIN_HP 0xc0
244#define PIN_HP_AMP 0x80
245
231#endif /* __SOUND_HDA_LOCAL_H */ 246#endif /* __SOUND_HDA_LOCAL_H */
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index 6e0fd92a2be3..37ee1246b2dd 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -76,19 +76,6 @@ struct cmi_spec {
76 struct hda_verb multi_init[9]; /* 2 verbs for each pin + terminator */ 76 struct hda_verb multi_init[9]; /* 2 verbs for each pin + terminator */
77}; 77};
78 78
79/* amp values */
80#define AMP_IN_MUTE(idx) (0x7080 | ((idx)<<8))
81#define AMP_IN_UNMUTE(idx) (0x7000 | ((idx)<<8))
82#define AMP_OUT_MUTE 0xb080
83#define AMP_OUT_UNMUTE 0xb000
84#define AMP_OUT_ZERO 0xb000
85/* pinctl values */
86#define PIN_IN 0x20
87#define PIN_VREF80 0x24
88#define PIN_VREF50 0x21
89#define PIN_OUT 0x40
90#define PIN_HP 0xc0
91
92/* 79/*
93 * input MUX 80 * input MUX
94 */ 81 */
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index a213c19ab06c..3ff72c49cd26 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -61,20 +61,6 @@ enum {
61 ALC260_MODEL_LAST /* last tag */ 61 ALC260_MODEL_LAST /* last tag */
62}; 62};
63 63
64/* amp values */
65#define AMP_IN_MUTE(idx) (0x7080 | ((idx)<<8))
66#define AMP_IN_UNMUTE(idx) (0x7000 | ((idx)<<8))
67#define AMP_OUT_MUTE 0xb080
68#define AMP_OUT_UNMUTE 0xb000
69#define AMP_OUT_ZERO 0xb000
70/* pinctl values */
71#define PIN_IN 0x20
72#define PIN_VREF80 0x24
73#define PIN_VREF50 0x21
74#define PIN_OUT 0x40
75#define PIN_HP 0xc0
76#define PIN_HP_AMP 0x80
77
78struct alc_spec { 64struct alc_spec {
79 /* codec parameterization */ 65 /* codec parameterization */
80 snd_kcontrol_new_t *mixers[3]; /* mixer arrays */ 66 snd_kcontrol_new_t *mixers[3]; /* mixer arrays */
@@ -1833,15 +1819,16 @@ static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, const struct
1833 return err; 1819 return err;
1834 } 1820 }
1835 } 1821 }
1836
1837 return 0; 1822 return 0;
1838} 1823}
1839 1824
1840/* add playback controls for HP output */ 1825/* add playback controls for speaker and HP outputs */
1841static int alc880_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) 1826static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
1827 const char *pfx)
1842{ 1828{
1843 hda_nid_t nid; 1829 hda_nid_t nid;
1844 int err; 1830 int err;
1831 char name[32];
1845 1832
1846 if (! pin) 1833 if (! pin)
1847 return 0; 1834 return 0;
@@ -1854,14 +1841,16 @@ static int alc880_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
1854 if (! spec->multiout.num_dacs) 1841 if (! spec->multiout.num_dacs)
1855 spec->multiout.num_dacs = 1; 1842 spec->multiout.num_dacs = 1;
1856 } else 1843 } else
1857 /* specify the DAC as the extra HP output */ 1844 /* specify the DAC as the extra output */
1858 spec->multiout.hp_nid = nid; 1845 spec->multiout.hp_nid = nid;
1859 /* control HP volume/switch on the output mixer amp */ 1846 /* control HP volume/switch on the output mixer amp */
1860 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); 1847 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
1861 if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Headphone Playback Volume", 1848 sprintf(name, "%s Playback Volume", pfx);
1849 if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
1862 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 1850 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0)
1863 return err; 1851 return err;
1864 if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "Headphone Playback Switch", 1852 sprintf(name, "%s Playback Switch", pfx);
1853 if ((err = add_control(spec, ALC_CTL_BIND_MUTE, name,
1865 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT))) < 0) 1854 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT))) < 0)
1866 return err; 1855 return err;
1867 } else if (alc880_is_multi_pin(pin)) { 1856 } else if (alc880_is_multi_pin(pin)) {
@@ -1873,7 +1862,8 @@ static int alc880_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
1873 spec->multiout.num_dacs = 1; 1862 spec->multiout.num_dacs = 1;
1874 } 1863 }
1875 /* we have only a switch on HP-out PIN */ 1864 /* we have only a switch on HP-out PIN */
1876 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", 1865 sprintf(name, "%s Playback Switch", pfx);
1866 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
1877 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT))) < 0) 1867 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT))) < 0)
1878 return err; 1868 return err;
1879 } 1869 }
@@ -1947,11 +1937,14 @@ static void alc880_auto_init_multi_out(struct hda_codec *codec)
1947 } 1937 }
1948} 1938}
1949 1939
1950static void alc880_auto_init_hp_out(struct hda_codec *codec) 1940static void alc880_auto_init_extra_out(struct hda_codec *codec)
1951{ 1941{
1952 struct alc_spec *spec = codec->spec; 1942 struct alc_spec *spec = codec->spec;
1953 hda_nid_t pin; 1943 hda_nid_t pin;
1954 1944
1945 pin = spec->autocfg.speaker_pin;
1946 if (pin) /* connect to front */
1947 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
1955 pin = spec->autocfg.hp_pin; 1948 pin = spec->autocfg.hp_pin;
1956 if (pin) /* connect to front */ 1949 if (pin) /* connect to front */
1957 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 1950 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
@@ -1985,10 +1978,14 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
1985 return err; 1978 return err;
1986 if ((err = alc880_auto_fill_dac_nids(spec, &spec->autocfg)) < 0) 1979 if ((err = alc880_auto_fill_dac_nids(spec, &spec->autocfg)) < 0)
1987 return err; 1980 return err;
1988 if (! spec->autocfg.line_outs && ! spec->autocfg.hp_pin) 1981 if (! spec->autocfg.line_outs && ! spec->autocfg.speaker_pin &&
1982 ! spec->autocfg.hp_pin)
1989 return 0; /* can't find valid BIOS pin config */ 1983 return 0; /* can't find valid BIOS pin config */
1990 if ((err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || 1984 if ((err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 ||
1991 (err = alc880_auto_create_hp_ctls(spec, spec->autocfg.hp_pin)) < 0 || 1985 (err = alc880_auto_create_extra_out(spec, spec->autocfg.speaker_pin,
1986 "Speaker")) < 0 ||
1987 (err = alc880_auto_create_extra_out(spec, spec->autocfg.speaker_pin,
1988 "Headphone")) < 0 ||
1992 (err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) 1989 (err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0)
1993 return err; 1990 return err;
1994 1991
@@ -2014,7 +2011,7 @@ static int alc880_auto_init(struct hda_codec *codec)
2014{ 2011{
2015 alc_init(codec); 2012 alc_init(codec);
2016 alc880_auto_init_multi_out(codec); 2013 alc880_auto_init_multi_out(codec);
2017 alc880_auto_init_hp_out(codec); 2014 alc880_auto_init_extra_out(codec);
2018 alc880_auto_init_analog_input(codec); 2015 alc880_auto_init_analog_input(codec);
2019 return 0; 2016 return 0;
2020} 2017}