diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-07-17 08:36:59 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-07-17 08:36:59 -0400 |
commit | 3f3b7c1aed70fa25c6811f830c5fb1a7054681ae (patch) | |
tree | e1bbc60c996f4c1ceeb578791f5a54e2588e482a /sound/pci/hda/patch_realtek.c | |
parent | 82e1b804b03defe46fb69ffd2c8b19e6649bcb0d (diff) |
ALSA: hda - Fix ALC268 parser for mono speaker
- Parse the mono output pin 0x16 correctly even as the primary output
- Create "Speaker" volume control if the primary output is a speaker
- Fix the wrong direction of (optional) "Mono" switch
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 | 62 |
1 files changed, 43 insertions, 19 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 7967f8f1a347..507a7720013e 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -11816,26 +11816,38 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |||
11816 | const char *ctlname, int idx) | 11816 | const char *ctlname, int idx) |
11817 | { | 11817 | { |
11818 | char name[32]; | 11818 | char name[32]; |
11819 | hda_nid_t dac; | ||
11819 | int err; | 11820 | int err; |
11820 | 11821 | ||
11821 | sprintf(name, "%s Playback Volume", ctlname); | 11822 | sprintf(name, "%s Playback Volume", ctlname); |
11822 | if (nid == 0x14) { | 11823 | switch (nid) { |
11823 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | 11824 | case 0x14: |
11824 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, | 11825 | case 0x16: |
11825 | HDA_OUTPUT)); | 11826 | dac = 0x02; |
11826 | if (err < 0) | 11827 | break; |
11827 | return err; | 11828 | case 0x15: |
11828 | } else if (nid == 0x15) { | 11829 | dac = 0x03; |
11830 | break; | ||
11831 | default: | ||
11832 | return 0; | ||
11833 | } | ||
11834 | if (spec->multiout.dac_nids[0] != dac && | ||
11835 | spec->multiout.dac_nids[1] != dac) { | ||
11829 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, | 11836 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
11830 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, | 11837 | HDA_COMPOSE_AMP_VAL(dac, 3, idx, |
11831 | HDA_OUTPUT)); | 11838 | HDA_OUTPUT)); |
11832 | if (err < 0) | 11839 | if (err < 0) |
11833 | return err; | 11840 | return err; |
11834 | } else | 11841 | spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac; |
11835 | return -1; | 11842 | } |
11843 | |||
11836 | sprintf(name, "%s Playback Switch", ctlname); | 11844 | sprintf(name, "%s Playback Switch", ctlname); |
11837 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | 11845 | if (nid != 0x16) |
11846 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | ||
11838 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); | 11847 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
11848 | else /* mono */ | ||
11849 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, | ||
11850 | HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT)); | ||
11839 | if (err < 0) | 11851 | if (err < 0) |
11840 | return err; | 11852 | return err; |
11841 | return 0; | 11853 | return 0; |
@@ -11848,14 +11860,19 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
11848 | hda_nid_t nid; | 11860 | hda_nid_t nid; |
11849 | int err; | 11861 | int err; |
11850 | 11862 | ||
11851 | spec->multiout.num_dacs = 2; /* only use one dac */ | ||
11852 | spec->multiout.dac_nids = spec->private_dac_nids; | 11863 | spec->multiout.dac_nids = spec->private_dac_nids; |
11853 | spec->multiout.dac_nids[0] = 2; | ||
11854 | spec->multiout.dac_nids[1] = 3; | ||
11855 | 11864 | ||
11856 | nid = cfg->line_out_pins[0]; | 11865 | nid = cfg->line_out_pins[0]; |
11857 | if (nid) | 11866 | if (nid) { |
11858 | alc268_new_analog_output(spec, nid, "Front", 0); | 11867 | const char *name; |
11868 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
11869 | name = "Speaker"; | ||
11870 | else | ||
11871 | name = "Front"; | ||
11872 | err = alc268_new_analog_output(spec, nid, name, 0); | ||
11873 | if (err < 0) | ||
11874 | return err; | ||
11875 | } | ||
11859 | 11876 | ||
11860 | nid = cfg->speaker_pins[0]; | 11877 | nid = cfg->speaker_pins[0]; |
11861 | if (nid == 0x1d) { | 11878 | if (nid == 0x1d) { |
@@ -11864,16 +11881,23 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
11864 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | 11881 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
11865 | if (err < 0) | 11882 | if (err < 0) |
11866 | return err; | 11883 | return err; |
11884 | } else { | ||
11885 | err = alc268_new_analog_output(spec, nid, "Speaker", 0); | ||
11886 | if (err < 0) | ||
11887 | return err; | ||
11867 | } | 11888 | } |
11868 | nid = cfg->hp_pins[0]; | 11889 | nid = cfg->hp_pins[0]; |
11869 | if (nid) | 11890 | if (nid) { |
11870 | alc268_new_analog_output(spec, nid, "Headphone", 0); | 11891 | err = alc268_new_analog_output(spec, nid, "Headphone", 0); |
11892 | if (err < 0) | ||
11893 | return err; | ||
11894 | } | ||
11871 | 11895 | ||
11872 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; | 11896 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
11873 | if (nid == 0x16) { | 11897 | if (nid == 0x16) { |
11874 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, | 11898 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
11875 | "Mono Playback Switch", | 11899 | "Mono Playback Switch", |
11876 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); | 11900 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT)); |
11877 | if (err < 0) | 11901 | if (err < 0) |
11878 | return err; | 11902 | return err; |
11879 | } | 11903 | } |