diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-09-08 09:47:09 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-09-08 09:50:07 -0400 |
commit | 033688a5a80f9d56b2e7d56c4cb8188ae1448919 (patch) | |
tree | 7a796948c5c74389bf67ab45e23643fcc58fcaeb /sound/pci/hda/patch_realtek.c | |
parent | bb35febd16fe5ac8c30f9116a25210c4f63a5267 (diff) |
ALSA: hda - Add multiple headphone support to ALC262 codec
This patch changes the alc262 auto-parser to allow multiple pins
assigned for a single purpose (line-out, headphone or speaker).
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 | 71 |
1 files changed, 42 insertions, 29 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ee59df7a41f8..26069e397fc9 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -11824,7 +11824,7 @@ static int alc262_check_volbit(hda_nid_t nid) | |||
11824 | } | 11824 | } |
11825 | 11825 | ||
11826 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, | 11826 | static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, |
11827 | const char *pfx, int *vbits) | 11827 | const char *pfx, int *vbits, int idx) |
11828 | { | 11828 | { |
11829 | unsigned long val; | 11829 | unsigned long val; |
11830 | int vbit; | 11830 | int vbit; |
@@ -11839,11 +11839,11 @@ static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, | |||
11839 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); | 11839 | val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); |
11840 | else | 11840 | else |
11841 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); | 11841 | val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); |
11842 | return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); | 11842 | return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val); |
11843 | } | 11843 | } |
11844 | 11844 | ||
11845 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, | 11845 | static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, |
11846 | const char *pfx) | 11846 | const char *pfx, int idx) |
11847 | { | 11847 | { |
11848 | unsigned long val; | 11848 | unsigned long val; |
11849 | 11849 | ||
@@ -11853,7 +11853,7 @@ static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, | |||
11853 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); | 11853 | val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
11854 | else | 11854 | else |
11855 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); | 11855 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
11856 | return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); | 11856 | return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val); |
11857 | } | 11857 | } |
11858 | 11858 | ||
11859 | /* add playback controls from the parsed DAC table */ | 11859 | /* add playback controls from the parsed DAC table */ |
@@ -11862,7 +11862,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
11862 | { | 11862 | { |
11863 | const char *pfx; | 11863 | const char *pfx; |
11864 | int vbits; | 11864 | int vbits; |
11865 | int err; | 11865 | int i, err; |
11866 | 11866 | ||
11867 | spec->multiout.num_dacs = 1; /* only use one dac */ | 11867 | spec->multiout.num_dacs = 1; /* only use one dac */ |
11868 | spec->multiout.dac_nids = spec->private_dac_nids; | 11868 | spec->multiout.dac_nids = spec->private_dac_nids; |
@@ -11872,39 +11872,52 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
11872 | pfx = "Master"; | 11872 | pfx = "Master"; |
11873 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | 11873 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) |
11874 | pfx = "Speaker"; | 11874 | pfx = "Speaker"; |
11875 | else if (cfg->line_out_type == AUTO_PIN_HP_OUT) | ||
11876 | pfx = "Headphone"; | ||
11875 | else | 11877 | else |
11876 | pfx = "Front"; | 11878 | pfx = "Front"; |
11877 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); | 11879 | for (i = 0; i < 2; i++) { |
11878 | if (err < 0) | 11880 | err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i); |
11879 | return err; | 11881 | if (err < 0) |
11880 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); | 11882 | return err; |
11881 | if (err < 0) | 11883 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
11882 | return err; | 11884 | err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i], |
11883 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); | 11885 | "Speaker", i); |
11884 | if (err < 0) | 11886 | if (err < 0) |
11885 | return err; | 11887 | return err; |
11888 | } | ||
11889 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { | ||
11890 | err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i], | ||
11891 | "Headphone", i); | ||
11892 | if (err < 0) | ||
11893 | return err; | ||
11894 | } | ||
11895 | } | ||
11886 | 11896 | ||
11887 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | | 11897 | vbits = alc262_check_volbit(cfg->line_out_pins[0]) | |
11888 | alc262_check_volbit(cfg->speaker_pins[0]) | | 11898 | alc262_check_volbit(cfg->speaker_pins[0]) | |
11889 | alc262_check_volbit(cfg->hp_pins[0]); | 11899 | alc262_check_volbit(cfg->hp_pins[0]); |
11890 | if (vbits == 1 || vbits == 2) | 11900 | if (vbits == 1 || vbits == 2) |
11891 | pfx = "Master"; /* only one mixer is used */ | 11901 | pfx = "Master"; /* only one mixer is used */ |
11892 | else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) | ||
11893 | pfx = "Speaker"; | ||
11894 | else | ||
11895 | pfx = "Front"; | ||
11896 | vbits = 0; | 11902 | vbits = 0; |
11897 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); | 11903 | for (i = 0; i < 2; i++) { |
11898 | if (err < 0) | 11904 | err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx, |
11899 | return err; | 11905 | &vbits, i); |
11900 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", | 11906 | if (err < 0) |
11901 | &vbits); | 11907 | return err; |
11902 | if (err < 0) | 11908 | if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { |
11903 | return err; | 11909 | err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i], |
11904 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", | 11910 | "Speaker", &vbits, i); |
11905 | &vbits); | 11911 | if (err < 0) |
11906 | if (err < 0) | 11912 | return err; |
11907 | return err; | 11913 | } |
11914 | if (cfg->line_out_type != AUTO_PIN_HP_OUT) { | ||
11915 | err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i], | ||
11916 | "Headphone", &vbits, i); | ||
11917 | if (err < 0) | ||
11918 | return err; | ||
11919 | } | ||
11920 | } | ||
11908 | return 0; | 11921 | return 0; |
11909 | } | 11922 | } |
11910 | 11923 | ||