diff options
-rw-r--r-- | Documentation/sound/alsa/HD-Audio-Models.txt | 14 | ||||
-rw-r--r-- | sound/pci/hda/alc262_quirks.c | 177 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 36 |
3 files changed, 8 insertions, 219 deletions
diff --git a/Documentation/sound/alsa/HD-Audio-Models.txt b/Documentation/sound/alsa/HD-Audio-Models.txt index 4f3443230d89..c8d499fc126b 100644 --- a/Documentation/sound/alsa/HD-Audio-Models.txt +++ b/Documentation/sound/alsa/HD-Audio-Models.txt | |||
@@ -42,19 +42,7 @@ ALC260 | |||
42 | 42 | ||
43 | ALC262 | 43 | ALC262 |
44 | ====== | 44 | ====== |
45 | fujitsu Fujitsu Laptop | 45 | N/A |
46 | benq Benq ED8 | ||
47 | benq-t31 Benq T31 | ||
48 | hippo Hippo (ATI) with jack detection, Sony UX-90s | ||
49 | hippo_1 Hippo (Benq) with jack detection | ||
50 | toshiba-s06 Toshiba S06 | ||
51 | toshiba-rx1 Toshiba RX1 | ||
52 | tyan Tyan Thunder n6650W (S2915-E) | ||
53 | ultra Samsung Q1 Ultra Vista model | ||
54 | lenovo-3000 Lenovo 3000 y410 | ||
55 | nec NEC Versa S9100 | ||
56 | basic fixed pin assignment w/o SPDIF | ||
57 | auto auto-config reading BIOS (default) | ||
58 | 46 | ||
59 | ALC267/268 | 47 | ALC267/268 |
60 | ========== | 48 | ========== |
diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c deleted file mode 100644 index 813855a94754..000000000000 --- a/sound/pci/hda/alc262_quirks.c +++ /dev/null | |||
@@ -1,177 +0,0 @@ | |||
1 | /* | ||
2 | * ALC262 quirk models | ||
3 | * included by patch_realtek.c | ||
4 | */ | ||
5 | |||
6 | /* ALC262 models */ | ||
7 | enum { | ||
8 | ALC262_AUTO, | ||
9 | ALC262_ULTRA, | ||
10 | ALC262_MODEL_LAST /* last tag */ | ||
11 | }; | ||
12 | |||
13 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID | ||
14 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID | ||
15 | |||
16 | #define alc262_dac_nids alc260_dac_nids | ||
17 | #define alc262_adc_nids alc882_adc_nids | ||
18 | #define alc262_adc_nids_alt alc882_adc_nids_alt | ||
19 | #define alc262_capsrc_nids alc882_capsrc_nids | ||
20 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt | ||
21 | |||
22 | #define alc262_modes alc260_modes | ||
23 | #define alc262_capture_source alc882_capture_source | ||
24 | |||
25 | #define alc262_capture_mixer alc882_capture_mixer | ||
26 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer | ||
27 | |||
28 | /* Samsung Q1 Ultra Vista model setup */ | ||
29 | static const struct snd_kcontrol_new alc262_ultra_mixer[] = { | ||
30 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
31 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | ||
32 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
33 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
34 | HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT), | ||
35 | HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT), | ||
36 | { } /* end */ | ||
37 | }; | ||
38 | |||
39 | static const struct hda_verb alc262_ultra_verbs[] = { | ||
40 | /* output mixer */ | ||
41 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
42 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
43 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
44 | /* speaker */ | ||
45 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
46 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
47 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
48 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
49 | /* HP */ | ||
50 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
51 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
52 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
53 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
54 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, | ||
55 | /* internal mic */ | ||
56 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
57 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
58 | /* ADC, choose mic */ | ||
59 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
60 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
61 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
62 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
63 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
64 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
65 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | ||
66 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | ||
67 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, | ||
68 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, | ||
69 | {} | ||
70 | }; | ||
71 | |||
72 | /* mute/unmute internal speaker according to the hp jack and mute state */ | ||
73 | static void alc262_ultra_automute(struct hda_codec *codec) | ||
74 | { | ||
75 | struct alc_spec *spec = codec->spec; | ||
76 | unsigned int mute; | ||
77 | |||
78 | mute = 0; | ||
79 | /* auto-mute only when HP is used as HP */ | ||
80 | if (!spec->cur_mux[0]) { | ||
81 | spec->hp_jack_present = snd_hda_jack_detect(codec, 0x15); | ||
82 | if (spec->hp_jack_present) | ||
83 | mute = HDA_AMP_MUTE; | ||
84 | } | ||
85 | /* mute/unmute internal speaker */ | ||
86 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
87 | HDA_AMP_MUTE, mute); | ||
88 | /* mute/unmute HP */ | ||
89 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
90 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); | ||
91 | } | ||
92 | |||
93 | /* unsolicited event for HP jack sensing */ | ||
94 | static void alc262_ultra_unsol_event(struct hda_codec *codec, | ||
95 | unsigned int res) | ||
96 | { | ||
97 | if ((res >> 26) != ALC_HP_EVENT) | ||
98 | return; | ||
99 | alc262_ultra_automute(codec); | ||
100 | } | ||
101 | |||
102 | static const struct hda_input_mux alc262_ultra_capture_source = { | ||
103 | .num_items = 2, | ||
104 | .items = { | ||
105 | { "Mic", 0x1 }, | ||
106 | { "Headphone", 0x7 }, | ||
107 | }, | ||
108 | }; | ||
109 | |||
110 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, | ||
111 | struct snd_ctl_elem_value *ucontrol) | ||
112 | { | ||
113 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
114 | struct alc_spec *spec = codec->spec; | ||
115 | int ret; | ||
116 | |||
117 | ret = alc_mux_enum_put(kcontrol, ucontrol); | ||
118 | if (!ret) | ||
119 | return 0; | ||
120 | /* reprogram the HP pin as mic or HP according to the input source */ | ||
121 | snd_hda_codec_write_cache(codec, 0x15, 0, | ||
122 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
123 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); | ||
124 | alc262_ultra_automute(codec); /* mute/unmute HP */ | ||
125 | return ret; | ||
126 | } | ||
127 | |||
128 | static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { | ||
129 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), | ||
130 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), | ||
131 | { | ||
132 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
133 | .name = "Capture Source", | ||
134 | .info = alc_mux_enum_info, | ||
135 | .get = alc_mux_enum_get, | ||
136 | .put = alc262_ultra_mux_enum_put, | ||
137 | }, | ||
138 | { | ||
139 | .iface = NID_MAPPING, | ||
140 | .name = "Capture Source", | ||
141 | .private_value = 0x15, | ||
142 | }, | ||
143 | { } /* end */ | ||
144 | }; | ||
145 | |||
146 | /* | ||
147 | * configuration and preset | ||
148 | */ | ||
149 | static const char * const alc262_models[ALC262_MODEL_LAST] = { | ||
150 | [ALC262_ULTRA] = "ultra", | ||
151 | [ALC262_AUTO] = "auto", | ||
152 | }; | ||
153 | |||
154 | static const struct snd_pci_quirk alc262_cfg_tbl[] = { | ||
155 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", | ||
156 | ALC262_ULTRA), | ||
157 | {} | ||
158 | }; | ||
159 | |||
160 | static const struct alc_config_preset alc262_presets[] = { | ||
161 | [ALC262_ULTRA] = { | ||
162 | .mixers = { alc262_ultra_mixer }, | ||
163 | .cap_mixer = alc262_ultra_capture_mixer, | ||
164 | .init_verbs = { alc262_ultra_verbs }, | ||
165 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
166 | .dac_nids = alc262_dac_nids, | ||
167 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
168 | .channel_mode = alc262_modes, | ||
169 | .input_mux = &alc262_ultra_capture_source, | ||
170 | .adc_nids = alc262_adc_nids, /* ADC0 */ | ||
171 | .capsrc_nids = alc262_capsrc_nids, | ||
172 | .num_adc_nids = 1, /* single ADC */ | ||
173 | .unsol_event = alc262_ultra_unsol_event, | ||
174 | .init_hook = alc262_ultra_automute, | ||
175 | }, | ||
176 | }; | ||
177 | |||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ef040ec6580d..afdecd86e9a9 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4493,14 +4493,9 @@ static const struct snd_pci_quirk alc262_fixup_tbl[] = { | |||
4493 | 4493 | ||
4494 | /* | 4494 | /* |
4495 | */ | 4495 | */ |
4496 | #ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS | ||
4497 | #include "alc262_quirks.c" | ||
4498 | #endif | ||
4499 | |||
4500 | static int patch_alc262(struct hda_codec *codec) | 4496 | static int patch_alc262(struct hda_codec *codec) |
4501 | { | 4497 | { |
4502 | struct alc_spec *spec; | 4498 | struct alc_spec *spec; |
4503 | int board_config; | ||
4504 | int err; | 4499 | int err; |
4505 | 4500 | ||
4506 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 4501 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
@@ -4527,29 +4522,13 @@ static int patch_alc262(struct hda_codec *codec) | |||
4527 | 4522 | ||
4528 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | 4523 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
4529 | 4524 | ||
4530 | board_config = alc_board_config(codec, ALC262_MODEL_LAST, | 4525 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); |
4531 | alc262_models, alc262_cfg_tbl); | 4526 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); |
4532 | |||
4533 | if (board_config < 0) { | ||
4534 | printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", | ||
4535 | codec->chip_name); | ||
4536 | board_config = ALC_MODEL_AUTO; | ||
4537 | } | ||
4538 | |||
4539 | if (board_config == ALC_MODEL_AUTO) { | ||
4540 | alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups); | ||
4541 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE); | ||
4542 | } | ||
4543 | |||
4544 | if (board_config == ALC_MODEL_AUTO) { | ||
4545 | /* automatic parse from the BIOS config */ | ||
4546 | err = alc262_parse_auto_config(codec); | ||
4547 | if (err < 0) | ||
4548 | goto error; | ||
4549 | } | ||
4550 | 4527 | ||
4551 | if (board_config != ALC_MODEL_AUTO) | 4528 | /* automatic parse from the BIOS config */ |
4552 | setup_preset(codec, &alc262_presets[board_config]); | 4529 | err = alc262_parse_auto_config(codec); |
4530 | if (err < 0) | ||
4531 | goto error; | ||
4553 | 4532 | ||
4554 | if (!spec->no_analog && !spec->adc_nids) { | 4533 | if (!spec->no_analog && !spec->adc_nids) { |
4555 | alc_auto_fill_adc_caps(codec); | 4534 | alc_auto_fill_adc_caps(codec); |
@@ -4572,8 +4551,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
4572 | spec->vmaster_nid = 0x0c; | 4551 | spec->vmaster_nid = 0x0c; |
4573 | 4552 | ||
4574 | codec->patch_ops = alc_patch_ops; | 4553 | codec->patch_ops = alc_patch_ops; |
4575 | if (board_config == ALC_MODEL_AUTO) | 4554 | spec->init_hook = alc_auto_init_std; |
4576 | spec->init_hook = alc_auto_init_std; | ||
4577 | spec->shutup = alc_eapd_shutup; | 4555 | spec->shutup = alc_eapd_shutup; |
4578 | 4556 | ||
4579 | alc_init_jacks(codec); | 4557 | alc_init_jacks(codec); |