aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-17 05:09:23 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:17:26 -0500
commit8d88bc3d361bdd81a214eb9c5d06b291d06c603a (patch)
treedc3bfd15ff731e55bc8c2e29f54d050325a9ee1a /sound/pci/hda/patch_realtek.c
parenta2a20939b1cc82222eb67a4631009338791f1acd (diff)
[ALSA] hda-codec - Fix assignment of speaker pin
Modules: HDA Codec driver,HDA generic driver Fix the auto-assignment of speaker pin. Handle it independently from line-out pins. 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.c47
1 files changed, 22 insertions, 25 deletions
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}