diff options
-rw-r--r-- | sound/pci/hda/Kconfig | 1 | ||||
-rw-r--r-- | sound/pci/hda/patch_ca0110.c | 488 |
2 files changed, 16 insertions, 473 deletions
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig index 8136c4c5b0ce..9aff5cfafe2b 100644 --- a/sound/pci/hda/Kconfig +++ b/sound/pci/hda/Kconfig | |||
@@ -173,6 +173,7 @@ config SND_HDA_CODEC_CONEXANT | |||
173 | config SND_HDA_CODEC_CA0110 | 173 | config SND_HDA_CODEC_CA0110 |
174 | bool "Build Creative CA0110-IBG codec support" | 174 | bool "Build Creative CA0110-IBG codec support" |
175 | default y | 175 | default y |
176 | select SND_HDA_GENERIC | ||
176 | help | 177 | help |
177 | Say Y here to include Creative CA0110-IBG codec support in | 178 | Say Y here to include Creative CA0110-IBG codec support in |
178 | snd-hda-intel driver, found on some Creative X-Fi cards. | 179 | snd-hda-intel driver, found on some Creative X-Fi cards. |
diff --git a/sound/pci/hda/patch_ca0110.c b/sound/pci/hda/patch_ca0110.c index 19ae14f739cb..8d093254c204 100644 --- a/sound/pci/hda/patch_ca0110.c +++ b/sound/pci/hda/patch_ca0110.c | |||
@@ -27,502 +27,45 @@ | |||
27 | #include "hda_codec.h" | 27 | #include "hda_codec.h" |
28 | #include "hda_local.h" | 28 | #include "hda_local.h" |
29 | #include "hda_auto_parser.h" | 29 | #include "hda_auto_parser.h" |
30 | #include "hda_jack.h" | ||
31 | #include "hda_generic.h" | ||
30 | 32 | ||
31 | /* | ||
32 | */ | ||
33 | |||
34 | struct ca0110_spec { | ||
35 | struct auto_pin_cfg autocfg; | ||
36 | struct hda_multi_out multiout; | ||
37 | hda_nid_t out_pins[AUTO_CFG_MAX_OUTS]; | ||
38 | hda_nid_t dacs[AUTO_CFG_MAX_OUTS]; | ||
39 | hda_nid_t hp_dac; | ||
40 | hda_nid_t input_pins[AUTO_PIN_LAST]; | ||
41 | hda_nid_t adcs[AUTO_PIN_LAST]; | ||
42 | hda_nid_t dig_out; | ||
43 | hda_nid_t dig_in; | ||
44 | unsigned int num_inputs; | ||
45 | char input_labels[AUTO_PIN_LAST][32]; | ||
46 | struct hda_pcm pcm_rec[2]; /* PCM information */ | ||
47 | }; | ||
48 | |||
49 | /* | ||
50 | * PCM callbacks | ||
51 | */ | ||
52 | static int ca0110_playback_pcm_open(struct hda_pcm_stream *hinfo, | ||
53 | struct hda_codec *codec, | ||
54 | struct snd_pcm_substream *substream) | ||
55 | { | ||
56 | struct ca0110_spec *spec = codec->spec; | ||
57 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, | ||
58 | hinfo); | ||
59 | } | ||
60 | |||
61 | static int ca0110_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | ||
62 | struct hda_codec *codec, | ||
63 | unsigned int stream_tag, | ||
64 | unsigned int format, | ||
65 | struct snd_pcm_substream *substream) | ||
66 | { | ||
67 | struct ca0110_spec *spec = codec->spec; | ||
68 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, | ||
69 | stream_tag, format, substream); | ||
70 | } | ||
71 | |||
72 | static int ca0110_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
73 | struct hda_codec *codec, | ||
74 | struct snd_pcm_substream *substream) | ||
75 | { | ||
76 | struct ca0110_spec *spec = codec->spec; | ||
77 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | ||
78 | } | ||
79 | |||
80 | /* | ||
81 | * Digital out | ||
82 | */ | ||
83 | static int ca0110_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, | ||
84 | struct hda_codec *codec, | ||
85 | struct snd_pcm_substream *substream) | ||
86 | { | ||
87 | struct ca0110_spec *spec = codec->spec; | ||
88 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); | ||
89 | } | ||
90 | |||
91 | static int ca0110_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, | ||
92 | struct hda_codec *codec, | ||
93 | struct snd_pcm_substream *substream) | ||
94 | { | ||
95 | struct ca0110_spec *spec = codec->spec; | ||
96 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); | ||
97 | } | ||
98 | |||
99 | static int ca0110_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | ||
100 | struct hda_codec *codec, | ||
101 | unsigned int stream_tag, | ||
102 | unsigned int format, | ||
103 | struct snd_pcm_substream *substream) | ||
104 | { | ||
105 | struct ca0110_spec *spec = codec->spec; | ||
106 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag, | ||
107 | format, substream); | ||
108 | } | ||
109 | |||
110 | /* | ||
111 | * Analog capture | ||
112 | */ | ||
113 | static int ca0110_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | ||
114 | struct hda_codec *codec, | ||
115 | unsigned int stream_tag, | ||
116 | unsigned int format, | ||
117 | struct snd_pcm_substream *substream) | ||
118 | { | ||
119 | struct ca0110_spec *spec = codec->spec; | ||
120 | |||
121 | snd_hda_codec_setup_stream(codec, spec->adcs[substream->number], | ||
122 | stream_tag, 0, format); | ||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | static int ca0110_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
127 | struct hda_codec *codec, | ||
128 | struct snd_pcm_substream *substream) | ||
129 | { | ||
130 | struct ca0110_spec *spec = codec->spec; | ||
131 | |||
132 | snd_hda_codec_cleanup_stream(codec, spec->adcs[substream->number]); | ||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | /* | ||
137 | */ | ||
138 | |||
139 | static const char * const dirstr[2] = { "Playback", "Capture" }; | ||
140 | |||
141 | static int _add_switch(struct hda_codec *codec, hda_nid_t nid, const char *pfx, | ||
142 | int chan, int dir) | ||
143 | { | ||
144 | char namestr[44]; | ||
145 | int type = dir ? HDA_INPUT : HDA_OUTPUT; | ||
146 | struct snd_kcontrol_new knew = | ||
147 | HDA_CODEC_MUTE_MONO(namestr, nid, chan, 0, type); | ||
148 | sprintf(namestr, "%s %s Switch", pfx, dirstr[dir]); | ||
149 | return snd_hda_ctl_add(codec, nid, snd_ctl_new1(&knew, codec)); | ||
150 | } | ||
151 | |||
152 | static int _add_volume(struct hda_codec *codec, hda_nid_t nid, const char *pfx, | ||
153 | int chan, int dir) | ||
154 | { | ||
155 | char namestr[44]; | ||
156 | int type = dir ? HDA_INPUT : HDA_OUTPUT; | ||
157 | struct snd_kcontrol_new knew = | ||
158 | HDA_CODEC_VOLUME_MONO(namestr, nid, chan, 0, type); | ||
159 | sprintf(namestr, "%s %s Volume", pfx, dirstr[dir]); | ||
160 | return snd_hda_ctl_add(codec, nid, snd_ctl_new1(&knew, codec)); | ||
161 | } | ||
162 | |||
163 | #define add_out_switch(codec, nid, pfx) _add_switch(codec, nid, pfx, 3, 0) | ||
164 | #define add_out_volume(codec, nid, pfx) _add_volume(codec, nid, pfx, 3, 0) | ||
165 | #define add_in_switch(codec, nid, pfx) _add_switch(codec, nid, pfx, 3, 1) | ||
166 | #define add_in_volume(codec, nid, pfx) _add_volume(codec, nid, pfx, 3, 1) | ||
167 | #define add_mono_switch(codec, nid, pfx, chan) \ | ||
168 | _add_switch(codec, nid, pfx, chan, 0) | ||
169 | #define add_mono_volume(codec, nid, pfx, chan) \ | ||
170 | _add_volume(codec, nid, pfx, chan, 0) | ||
171 | |||
172 | static int ca0110_build_controls(struct hda_codec *codec) | ||
173 | { | ||
174 | struct ca0110_spec *spec = codec->spec; | ||
175 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
176 | static const char * const prefix[AUTO_CFG_MAX_OUTS] = { | ||
177 | "Front", "Surround", NULL, "Side", "Multi" | ||
178 | }; | ||
179 | hda_nid_t mutenid; | ||
180 | int i, err; | ||
181 | |||
182 | for (i = 0; i < spec->multiout.num_dacs; i++) { | ||
183 | if (get_wcaps(codec, spec->out_pins[i]) & AC_WCAP_OUT_AMP) | ||
184 | mutenid = spec->out_pins[i]; | ||
185 | else | ||
186 | mutenid = spec->multiout.dac_nids[i]; | ||
187 | if (!prefix[i]) { | ||
188 | err = add_mono_switch(codec, mutenid, | ||
189 | "Center", 1); | ||
190 | if (err < 0) | ||
191 | return err; | ||
192 | err = add_mono_switch(codec, mutenid, | ||
193 | "LFE", 1); | ||
194 | if (err < 0) | ||
195 | return err; | ||
196 | err = add_mono_volume(codec, spec->multiout.dac_nids[i], | ||
197 | "Center", 1); | ||
198 | if (err < 0) | ||
199 | return err; | ||
200 | err = add_mono_volume(codec, spec->multiout.dac_nids[i], | ||
201 | "LFE", 1); | ||
202 | if (err < 0) | ||
203 | return err; | ||
204 | } else { | ||
205 | err = add_out_switch(codec, mutenid, | ||
206 | prefix[i]); | ||
207 | if (err < 0) | ||
208 | return err; | ||
209 | err = add_out_volume(codec, spec->multiout.dac_nids[i], | ||
210 | prefix[i]); | ||
211 | if (err < 0) | ||
212 | return err; | ||
213 | } | ||
214 | } | ||
215 | if (cfg->hp_outs) { | ||
216 | if (get_wcaps(codec, cfg->hp_pins[0]) & AC_WCAP_OUT_AMP) | ||
217 | mutenid = cfg->hp_pins[0]; | ||
218 | else | ||
219 | mutenid = spec->multiout.dac_nids[i]; | ||
220 | |||
221 | err = add_out_switch(codec, mutenid, "Headphone"); | ||
222 | if (err < 0) | ||
223 | return err; | ||
224 | if (spec->hp_dac) { | ||
225 | err = add_out_volume(codec, spec->hp_dac, "Headphone"); | ||
226 | if (err < 0) | ||
227 | return err; | ||
228 | } | ||
229 | } | ||
230 | for (i = 0; i < spec->num_inputs; i++) { | ||
231 | const char *label = spec->input_labels[i]; | ||
232 | if (get_wcaps(codec, spec->input_pins[i]) & AC_WCAP_IN_AMP) | ||
233 | mutenid = spec->input_pins[i]; | ||
234 | else | ||
235 | mutenid = spec->adcs[i]; | ||
236 | err = add_in_switch(codec, mutenid, label); | ||
237 | if (err < 0) | ||
238 | return err; | ||
239 | err = add_in_volume(codec, spec->adcs[i], label); | ||
240 | if (err < 0) | ||
241 | return err; | ||
242 | } | ||
243 | |||
244 | if (spec->dig_out) { | ||
245 | err = snd_hda_create_spdif_out_ctls(codec, spec->dig_out, | ||
246 | spec->dig_out); | ||
247 | if (err < 0) | ||
248 | return err; | ||
249 | err = snd_hda_create_spdif_share_sw(codec, &spec->multiout); | ||
250 | if (err < 0) | ||
251 | return err; | ||
252 | spec->multiout.share_spdif = 1; | ||
253 | } | ||
254 | if (spec->dig_in) { | ||
255 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in); | ||
256 | if (err < 0) | ||
257 | return err; | ||
258 | err = add_in_volume(codec, spec->dig_in, "IEC958"); | ||
259 | } | ||
260 | return 0; | ||
261 | } | ||
262 | |||
263 | /* | ||
264 | */ | ||
265 | static const struct hda_pcm_stream ca0110_pcm_analog_playback = { | ||
266 | .substreams = 1, | ||
267 | .channels_min = 2, | ||
268 | .channels_max = 8, | ||
269 | .ops = { | ||
270 | .open = ca0110_playback_pcm_open, | ||
271 | .prepare = ca0110_playback_pcm_prepare, | ||
272 | .cleanup = ca0110_playback_pcm_cleanup | ||
273 | }, | ||
274 | }; | ||
275 | |||
276 | static const struct hda_pcm_stream ca0110_pcm_analog_capture = { | ||
277 | .substreams = 1, | ||
278 | .channels_min = 2, | ||
279 | .channels_max = 2, | ||
280 | .ops = { | ||
281 | .prepare = ca0110_capture_pcm_prepare, | ||
282 | .cleanup = ca0110_capture_pcm_cleanup | ||
283 | }, | ||
284 | }; | ||
285 | |||
286 | static const struct hda_pcm_stream ca0110_pcm_digital_playback = { | ||
287 | .substreams = 1, | ||
288 | .channels_min = 2, | ||
289 | .channels_max = 2, | ||
290 | .ops = { | ||
291 | .open = ca0110_dig_playback_pcm_open, | ||
292 | .close = ca0110_dig_playback_pcm_close, | ||
293 | .prepare = ca0110_dig_playback_pcm_prepare | ||
294 | }, | ||
295 | }; | ||
296 | |||
297 | static const struct hda_pcm_stream ca0110_pcm_digital_capture = { | ||
298 | .substreams = 1, | ||
299 | .channels_min = 2, | ||
300 | .channels_max = 2, | ||
301 | }; | ||
302 | |||
303 | static int ca0110_build_pcms(struct hda_codec *codec) | ||
304 | { | ||
305 | struct ca0110_spec *spec = codec->spec; | ||
306 | struct hda_pcm *info = spec->pcm_rec; | ||
307 | |||
308 | codec->pcm_info = info; | ||
309 | codec->num_pcms = 0; | ||
310 | |||
311 | info->name = "CA0110 Analog"; | ||
312 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = ca0110_pcm_analog_playback; | ||
313 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dacs[0]; | ||
314 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = | ||
315 | spec->multiout.max_channels; | ||
316 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = ca0110_pcm_analog_capture; | ||
317 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_inputs; | ||
318 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[0]; | ||
319 | codec->num_pcms++; | ||
320 | |||
321 | if (!spec->dig_out && !spec->dig_in) | ||
322 | return 0; | ||
323 | |||
324 | info++; | ||
325 | info->name = "CA0110 Digital"; | ||
326 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | ||
327 | if (spec->dig_out) { | ||
328 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = | ||
329 | ca0110_pcm_digital_playback; | ||
330 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dig_out; | ||
331 | } | ||
332 | if (spec->dig_in) { | ||
333 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = | ||
334 | ca0110_pcm_digital_capture; | ||
335 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in; | ||
336 | } | ||
337 | codec->num_pcms++; | ||
338 | |||
339 | return 0; | ||
340 | } | ||
341 | |||
342 | static void init_output(struct hda_codec *codec, hda_nid_t pin, hda_nid_t dac) | ||
343 | { | ||
344 | if (pin) { | ||
345 | snd_hda_set_pin_ctl(codec, pin, PIN_HP); | ||
346 | if (get_wcaps(codec, pin) & AC_WCAP_OUT_AMP) | ||
347 | snd_hda_codec_write(codec, pin, 0, | ||
348 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
349 | AMP_OUT_UNMUTE); | ||
350 | } | ||
351 | if (dac) | ||
352 | snd_hda_codec_write(codec, dac, 0, | ||
353 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO); | ||
354 | } | ||
355 | |||
356 | static void init_input(struct hda_codec *codec, hda_nid_t pin, hda_nid_t adc) | ||
357 | { | ||
358 | if (pin) { | ||
359 | snd_hda_set_pin_ctl(codec, pin, PIN_IN | | ||
360 | snd_hda_get_default_vref(codec, pin)); | ||
361 | if (get_wcaps(codec, pin) & AC_WCAP_IN_AMP) | ||
362 | snd_hda_codec_write(codec, pin, 0, | ||
363 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
364 | AMP_IN_UNMUTE(0)); | ||
365 | } | ||
366 | if (adc) | ||
367 | snd_hda_codec_write(codec, adc, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
368 | AMP_IN_UNMUTE(0)); | ||
369 | } | ||
370 | |||
371 | static int ca0110_init(struct hda_codec *codec) | ||
372 | { | ||
373 | struct ca0110_spec *spec = codec->spec; | ||
374 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
375 | int i; | ||
376 | |||
377 | for (i = 0; i < spec->multiout.num_dacs; i++) | ||
378 | init_output(codec, spec->out_pins[i], | ||
379 | spec->multiout.dac_nids[i]); | ||
380 | init_output(codec, cfg->hp_pins[0], spec->hp_dac); | ||
381 | init_output(codec, cfg->dig_out_pins[0], spec->dig_out); | ||
382 | |||
383 | for (i = 0; i < spec->num_inputs; i++) | ||
384 | init_input(codec, spec->input_pins[i], spec->adcs[i]); | ||
385 | init_input(codec, cfg->dig_in_pin, spec->dig_in); | ||
386 | return 0; | ||
387 | } | ||
388 | |||
389 | static void ca0110_free(struct hda_codec *codec) | ||
390 | { | ||
391 | kfree(codec->spec); | ||
392 | } | ||
393 | 33 | ||
394 | static const struct hda_codec_ops ca0110_patch_ops = { | 34 | static const struct hda_codec_ops ca0110_patch_ops = { |
395 | .build_controls = ca0110_build_controls, | 35 | .build_controls = snd_hda_gen_build_controls, |
396 | .build_pcms = ca0110_build_pcms, | 36 | .build_pcms = snd_hda_gen_build_pcms, |
397 | .init = ca0110_init, | 37 | .init = snd_hda_gen_init, |
398 | .free = ca0110_free, | 38 | .free = snd_hda_gen_free, |
399 | }; | 39 | }; |
400 | 40 | ||
401 | |||
402 | static void parse_line_outs(struct hda_codec *codec) | ||
403 | { | ||
404 | struct ca0110_spec *spec = codec->spec; | ||
405 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
406 | int i, n; | ||
407 | unsigned int def_conf; | ||
408 | hda_nid_t nid; | ||
409 | |||
410 | n = 0; | ||
411 | for (i = 0; i < cfg->line_outs; i++) { | ||
412 | nid = cfg->line_out_pins[i]; | ||
413 | def_conf = snd_hda_codec_get_pincfg(codec, nid); | ||
414 | if (!def_conf) | ||
415 | continue; /* invalid pin */ | ||
416 | if (snd_hda_get_connections(codec, nid, &spec->dacs[i], 1) != 1) | ||
417 | continue; | ||
418 | spec->out_pins[n++] = nid; | ||
419 | } | ||
420 | spec->multiout.dac_nids = spec->dacs; | ||
421 | spec->multiout.num_dacs = n; | ||
422 | spec->multiout.max_channels = n * 2; | ||
423 | } | ||
424 | |||
425 | static void parse_hp_out(struct hda_codec *codec) | ||
426 | { | ||
427 | struct ca0110_spec *spec = codec->spec; | ||
428 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
429 | int i; | ||
430 | unsigned int def_conf; | ||
431 | hda_nid_t nid, dac; | ||
432 | |||
433 | if (!cfg->hp_outs) | ||
434 | return; | ||
435 | nid = cfg->hp_pins[0]; | ||
436 | def_conf = snd_hda_codec_get_pincfg(codec, nid); | ||
437 | if (!def_conf) { | ||
438 | cfg->hp_outs = 0; | ||
439 | return; | ||
440 | } | ||
441 | if (snd_hda_get_connections(codec, nid, &dac, 1) != 1) | ||
442 | return; | ||
443 | |||
444 | for (i = 0; i < cfg->line_outs; i++) | ||
445 | if (dac == spec->dacs[i]) | ||
446 | break; | ||
447 | if (i >= cfg->line_outs) { | ||
448 | spec->hp_dac = dac; | ||
449 | spec->multiout.hp_nid = dac; | ||
450 | } | ||
451 | } | ||
452 | |||
453 | static void parse_input(struct hda_codec *codec) | ||
454 | { | ||
455 | struct ca0110_spec *spec = codec->spec; | ||
456 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
457 | hda_nid_t nid, pin; | ||
458 | int n, i, j; | ||
459 | |||
460 | n = 0; | ||
461 | nid = codec->start_nid; | ||
462 | for (i = 0; i < codec->num_nodes; i++, nid++) { | ||
463 | unsigned int wcaps = get_wcaps(codec, nid); | ||
464 | unsigned int type = get_wcaps_type(wcaps); | ||
465 | if (type != AC_WID_AUD_IN) | ||
466 | continue; | ||
467 | if (snd_hda_get_connections(codec, nid, &pin, 1) != 1) | ||
468 | continue; | ||
469 | if (pin == cfg->dig_in_pin) { | ||
470 | spec->dig_in = nid; | ||
471 | continue; | ||
472 | } | ||
473 | for (j = 0; j < cfg->num_inputs; j++) | ||
474 | if (cfg->inputs[j].pin == pin) | ||
475 | break; | ||
476 | if (j >= cfg->num_inputs) | ||
477 | continue; | ||
478 | spec->input_pins[n] = pin; | ||
479 | snd_hda_get_pin_label(codec, pin, cfg, | ||
480 | spec->input_labels[n], | ||
481 | sizeof(spec->input_labels[n]), NULL); | ||
482 | spec->adcs[n] = nid; | ||
483 | n++; | ||
484 | } | ||
485 | spec->num_inputs = n; | ||
486 | } | ||
487 | |||
488 | static void parse_digital(struct hda_codec *codec) | ||
489 | { | ||
490 | struct ca0110_spec *spec = codec->spec; | ||
491 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
492 | |||
493 | if (cfg->dig_outs && | ||
494 | snd_hda_get_connections(codec, cfg->dig_out_pins[0], | ||
495 | &spec->dig_out, 1) == 1) | ||
496 | spec->multiout.dig_out_nid = spec->dig_out; | ||
497 | } | ||
498 | |||
499 | static int ca0110_parse_auto_config(struct hda_codec *codec) | 41 | static int ca0110_parse_auto_config(struct hda_codec *codec) |
500 | { | 42 | { |
501 | struct ca0110_spec *spec = codec->spec; | 43 | struct hda_gen_spec *spec = codec->spec; |
502 | int err; | 44 | int err; |
503 | 45 | ||
504 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL); | 46 | err = snd_hda_parse_pin_defcfg(codec, &spec->autocfg, NULL, 0); |
47 | if (err < 0) | ||
48 | return err; | ||
49 | err = snd_hda_gen_parse_auto_config(codec, &spec->autocfg); | ||
505 | if (err < 0) | 50 | if (err < 0) |
506 | return err; | 51 | return err; |
507 | 52 | ||
508 | parse_line_outs(codec); | ||
509 | parse_hp_out(codec); | ||
510 | parse_digital(codec); | ||
511 | parse_input(codec); | ||
512 | return 0; | 53 | return 0; |
513 | } | 54 | } |
514 | 55 | ||
515 | 56 | ||
516 | static int patch_ca0110(struct hda_codec *codec) | 57 | static int patch_ca0110(struct hda_codec *codec) |
517 | { | 58 | { |
518 | struct ca0110_spec *spec; | 59 | struct hda_gen_spec *spec; |
519 | int err; | 60 | int err; |
520 | 61 | ||
521 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 62 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
522 | if (!spec) | 63 | if (!spec) |
523 | return -ENOMEM; | 64 | return -ENOMEM; |
65 | snd_hda_gen_spec_init(spec); | ||
524 | codec->spec = spec; | 66 | codec->spec = spec; |
525 | 67 | ||
68 | spec->multi_cap_vol = 1; | ||
526 | codec->bus->needs_damn_long_delay = 1; | 69 | codec->bus->needs_damn_long_delay = 1; |
527 | 70 | ||
528 | err = ca0110_parse_auto_config(codec); | 71 | err = ca0110_parse_auto_config(codec); |
@@ -534,8 +77,7 @@ static int patch_ca0110(struct hda_codec *codec) | |||
534 | return 0; | 77 | return 0; |
535 | 78 | ||
536 | error: | 79 | error: |
537 | kfree(codec->spec); | 80 | snd_hda_gen_free(codec); |
538 | codec->spec = NULL; | ||
539 | return err; | 81 | return err; |
540 | } | 82 | } |
541 | 83 | ||