aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-08-16 09:15:40 -0400
committerTakashi Iwai <tiwai@suse.de>2011-08-16 09:15:40 -0400
commit6ebb80530b0ed6b2e93f2e6497890b4437807055 (patch)
tree5960a9e0524944cfb1d800d9b69ad89a33b96f79 /sound/pci
parent24519911673eb5ef3eafcee5d247a52f36347f79 (diff)
ALSA: hda - Remove ALC268 model quirks
Get rid of the rest of ALC268 model quirks. They are all confirmed to work with the auto-parser, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/alc268_quirks.c314
-rw-r--r--sound/pci/hda/patch_realtek.c44
2 files changed, 6 insertions, 352 deletions
diff --git a/sound/pci/hda/alc268_quirks.c b/sound/pci/hda/alc268_quirks.c
deleted file mode 100644
index e9533a29dd81..000000000000
--- a/sound/pci/hda/alc268_quirks.c
+++ /dev/null
@@ -1,314 +0,0 @@
1/*
2 * ALC267/ALC268 quirk models
3 * included by patch_realtek.c
4 */
5
6/* ALC268 models */
7enum {
8 ALC268_AUTO,
9 ALC267_QUANTA_IL1,
10 ALC268_3ST,
11#ifdef CONFIG_SND_DEBUG
12 ALC268_TEST,
13#endif
14 ALC268_MODEL_LAST /* last tag */
15};
16
17/*
18 * ALC268 channel source setting (2 channel)
19 */
20#define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
21#define alc268_modes alc260_modes
22
23static const hda_nid_t alc268_dac_nids[2] = {
24 /* front, hp */
25 0x02, 0x03
26};
27
28static const hda_nid_t alc268_adc_nids[2] = {
29 /* ADC0-1 */
30 0x08, 0x07
31};
32
33static const hda_nid_t alc268_adc_nids_alt[1] = {
34 /* ADC0 */
35 0x08
36};
37
38static const hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
39
40static const struct snd_kcontrol_new alc268_base_mixer[] = {
41 /* output mixer control */
42 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
43 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
44 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
45 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
46 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
47 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
48 HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
49 { }
50};
51
52static const struct hda_verb alc268_eapd_verbs[] = {
53 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
54 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
55 { }
56};
57
58static const struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
59 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
60 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
61 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
62 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
63 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
64 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
65 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
66 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
67 { }
68};
69
70static const struct hda_verb alc267_quanta_il1_verbs[] = {
71 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
72 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN},
73 { }
74};
75
76static void alc267_quanta_il1_setup(struct hda_codec *codec)
77{
78 struct alc_spec *spec = codec->spec;
79 spec->autocfg.hp_pins[0] = 0x15;
80 spec->autocfg.speaker_pins[0] = 0x14;
81 spec->ext_mic_pin = 0x18;
82 spec->int_mic_pin = 0x19;
83 spec->auto_mic = 1;
84 spec->automute = 1;
85 spec->automute_mode = ALC_AUTOMUTE_PIN;
86}
87
88/*
89 * generic initialization of ADC, input mixers and output mixers
90 */
91static const struct hda_verb alc268_base_init_verbs[] = {
92 /* Unmute DAC0-1 and set vol = 0 */
93 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
94 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
95
96 /*
97 * Set up output mixers (0x0c - 0x0e)
98 */
99 /* set vol=0 to output mixers */
100 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
101 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
102
103 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
104 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
105
106 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
107 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
108 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
109 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
110 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
111 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
112 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
113 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
114
115 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
116 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
117 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
118 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
119 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
120
121 /* set PCBEEP vol = 0, mute connections */
122 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
123 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
124 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
125
126 /* Unmute Selector 23h,24h and set the default input to mic-in */
127
128 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
129 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
130 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
131 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
132
133 { }
134};
135
136/* only for model=test */
137#ifdef CONFIG_SND_DEBUG
138/*
139 * generic initialization of ADC, input mixers and output mixers
140 */
141static const struct hda_verb alc268_volume_init_verbs[] = {
142 /* set output DAC */
143 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
144 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
145
146 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
147 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
148 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
149 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
150 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
151
152 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
153 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
154 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
155
156 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
157 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
158 { }
159};
160#endif /* CONFIG_SND_DEBUG */
161
162static const struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
163 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
164 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
165 { } /* end */
166};
167
168static const struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
169 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
170 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
171 _DEFINE_CAPSRC(1),
172 { } /* end */
173};
174
175static const struct snd_kcontrol_new alc268_capture_mixer[] = {
176 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
177 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
178 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
179 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
180 _DEFINE_CAPSRC(2),
181 { } /* end */
182};
183
184static const struct hda_input_mux alc268_capture_source = {
185 .num_items = 4,
186 .items = {
187 { "Mic", 0x0 },
188 { "Front Mic", 0x1 },
189 { "Line", 0x2 },
190 { "CD", 0x3 },
191 },
192};
193
194#ifdef CONFIG_SND_DEBUG
195static const struct snd_kcontrol_new alc268_test_mixer[] = {
196 /* Volume widgets */
197 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
198 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
199 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
200 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
201 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
202 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
203 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
204 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
205 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
206 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
207 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
208 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
209 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
210 /* The below appears problematic on some hardwares */
211 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
212 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
213 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
214 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
215 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
216
217 /* Modes for retasking pin widgets */
218 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
219 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
220 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
221 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
222
223 /* Controls for GPIO pins, assuming they are configured as outputs */
224 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
225 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
226 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
227 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
228
229 /* Switches to allow the digital SPDIF output pin to be enabled.
230 * The ALC268 does not have an SPDIF input.
231 */
232 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
233
234 /* A switch allowing EAPD to be enabled. Some laptops seem to use
235 * this output to turn on an external amplifier.
236 */
237 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
238 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
239
240 { } /* end */
241};
242#endif
243
244/*
245 * configuration and preset
246 */
247static const char * const alc268_models[ALC268_MODEL_LAST] = {
248 [ALC267_QUANTA_IL1] = "quanta-il1",
249 [ALC268_3ST] = "3stack",
250#ifdef CONFIG_SND_DEBUG
251 [ALC268_TEST] = "test",
252#endif
253 [ALC268_AUTO] = "auto",
254};
255
256static const struct snd_pci_quirk alc268_cfg_tbl[] = {
257 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
258 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
259 {}
260};
261
262static const struct alc_config_preset alc268_presets[] = {
263 [ALC267_QUANTA_IL1] = {
264 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
265 .cap_mixer = alc268_capture_nosrc_mixer,
266 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
267 alc267_quanta_il1_verbs },
268 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
269 .dac_nids = alc268_dac_nids,
270 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
271 .adc_nids = alc268_adc_nids_alt,
272 .hp_nid = 0x03,
273 .num_channel_mode = ARRAY_SIZE(alc268_modes),
274 .channel_mode = alc268_modes,
275 .unsol_event = alc_sku_unsol_event,
276 .setup = alc267_quanta_il1_setup,
277 .init_hook = alc_inithook,
278 },
279 [ALC268_3ST] = {
280 .mixers = { alc268_base_mixer, alc268_beep_mixer },
281 .cap_mixer = alc268_capture_alt_mixer,
282 .init_verbs = { alc268_base_init_verbs },
283 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
284 .dac_nids = alc268_dac_nids,
285 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
286 .adc_nids = alc268_adc_nids_alt,
287 .capsrc_nids = alc268_capsrc_nids,
288 .hp_nid = 0x03,
289 .dig_out_nid = ALC268_DIGOUT_NID,
290 .num_channel_mode = ARRAY_SIZE(alc268_modes),
291 .channel_mode = alc268_modes,
292 .input_mux = &alc268_capture_source,
293 },
294#ifdef CONFIG_SND_DEBUG
295 [ALC268_TEST] = {
296 .mixers = { alc268_test_mixer },
297 .cap_mixer = alc268_capture_mixer,
298 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
299 alc268_volume_init_verbs,
300 alc268_beep_init_verbs },
301 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
302 .dac_nids = alc268_dac_nids,
303 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
304 .adc_nids = alc268_adc_nids_alt,
305 .capsrc_nids = alc268_capsrc_nids,
306 .hp_nid = 0x03,
307 .dig_out_nid = ALC268_DIGOUT_NID,
308 .num_channel_mode = ARRAY_SIZE(alc268_modes),
309 .channel_mode = alc268_modes,
310 .input_mux = &alc268_capture_source,
311 },
312#endif
313};
314
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index e2fbe3664ab4..58717ab324fa 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4232,14 +4232,9 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
4232 4232
4233/* 4233/*
4234 */ 4234 */
4235#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
4236#include "alc268_quirks.c"
4237#endif
4238
4239static int patch_alc268(struct hda_codec *codec) 4235static int patch_alc268(struct hda_codec *codec)
4240{ 4236{
4241 struct alc_spec *spec; 4237 struct alc_spec *spec;
4242 int board_config;
4243 int i, has_beep, err; 4238 int i, has_beep, err;
4244 4239
4245 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 4240 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
@@ -4250,39 +4245,13 @@ static int patch_alc268(struct hda_codec *codec)
4250 4245
4251 /* ALC268 has no aa-loopback mixer */ 4246 /* ALC268 has no aa-loopback mixer */
4252 4247
4253 board_config = alc_board_config(codec, ALC268_MODEL_LAST, 4248 /* automatic parse from the BIOS config */
4254 alc268_models, alc268_cfg_tbl); 4249 err = alc268_parse_auto_config(codec);
4255 4250 if (err < 0) {
4256 if (board_config < 0) 4251 alc_free(codec);
4257 board_config = alc_board_codec_sid_config(codec, 4252 return err;
4258 ALC268_MODEL_LAST, alc268_models, NULL);
4259
4260 if (board_config < 0) {
4261 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4262 codec->chip_name);
4263 board_config = ALC_MODEL_AUTO;
4264 }
4265
4266 if (board_config == ALC_MODEL_AUTO) {
4267 /* automatic parse from the BIOS config */
4268 err = alc268_parse_auto_config(codec);
4269 if (err < 0) {
4270 alc_free(codec);
4271 return err;
4272 }
4273#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
4274 else if (!err) {
4275 printk(KERN_INFO
4276 "hda_codec: Cannot set up configuration "
4277 "from BIOS. Using base mode...\n");
4278 board_config = ALC268_3ST;
4279 }
4280#endif
4281 } 4253 }
4282 4254
4283 if (board_config != ALC_MODEL_AUTO)
4284 setup_preset(codec, &alc268_presets[board_config]);
4285
4286 has_beep = 0; 4255 has_beep = 0;
4287 for (i = 0; i < spec->num_mixers; i++) { 4256 for (i = 0; i < spec->num_mixers; i++) {
4288 if (spec->mixers[i] == alc268_beep_mixer) { 4257 if (spec->mixers[i] == alc268_beep_mixer) {
@@ -4318,8 +4287,7 @@ static int patch_alc268(struct hda_codec *codec)
4318 spec->vmaster_nid = 0x02; 4287 spec->vmaster_nid = 0x02;
4319 4288
4320 codec->patch_ops = alc_patch_ops; 4289 codec->patch_ops = alc_patch_ops;
4321 if (board_config == ALC_MODEL_AUTO) 4290 spec->init_hook = alc_auto_init_std;
4322 spec->init_hook = alc_auto_init_std;
4323 spec->shutup = alc_eapd_shutup; 4291 spec->shutup = alc_eapd_shutup;
4324 4292
4325 alc_init_jacks(codec); 4293 alc_init_jacks(codec);