Lines Matching refs:codec

51 				    struct hda_codec *codec,
54 struct ca0110_spec *spec = codec->spec;
55 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
60 struct hda_codec *codec,
65 struct ca0110_spec *spec = codec->spec;
66 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
71 struct hda_codec *codec,
74 struct ca0110_spec *spec = codec->spec;
75 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
82 struct hda_codec *codec,
85 struct ca0110_spec *spec = codec->spec;
86 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
90 struct hda_codec *codec,
93 struct ca0110_spec *spec = codec->spec;
94 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
98 struct hda_codec *codec,
103 struct ca0110_spec *spec = codec->spec;
104 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, stream_tag,
112 struct hda_codec *codec,
117 struct ca0110_spec *spec = codec->spec;
119 snd_hda_codec_setup_stream(codec, spec->adcs[substream->number],
125 struct hda_codec *codec,
128 struct ca0110_spec *spec = codec->spec;
130 snd_hda_codec_cleanup_stream(codec, spec->adcs[substream->number]);
139 static int _add_switch(struct hda_codec *codec, hda_nid_t nid, const char *pfx,
147 return snd_hda_ctl_add(codec, nid, snd_ctl_new1(&knew, codec));
150 static int _add_volume(struct hda_codec *codec, hda_nid_t nid, const char *pfx,
158 return snd_hda_ctl_add(codec, nid, snd_ctl_new1(&knew, codec));
161 #define add_out_switch(codec, nid, pfx) _add_switch(codec, nid, pfx, 3, 0)
162 #define add_out_volume(codec, nid, pfx) _add_volume(codec, nid, pfx, 3, 0)
163 #define add_in_switch(codec, nid, pfx) _add_switch(codec, nid, pfx, 3, 1)
164 #define add_in_volume(codec, nid, pfx) _add_volume(codec, nid, pfx, 3, 1)
165 #define add_mono_switch(codec, nid, pfx, chan) \
166 _add_switch(codec, nid, pfx, chan, 0)
167 #define add_mono_volume(codec, nid, pfx, chan) \
168 _add_volume(codec, nid, pfx, chan, 0)
170 static int ca0110_build_controls(struct hda_codec *codec)
172 struct ca0110_spec *spec = codec->spec;
181 if (get_wcaps(codec, spec->out_pins[i]) & AC_WCAP_OUT_AMP)
186 err = add_mono_switch(codec, mutenid,
190 err = add_mono_switch(codec, mutenid,
194 err = add_mono_volume(codec, spec->multiout.dac_nids[i],
198 err = add_mono_volume(codec, spec->multiout.dac_nids[i],
203 err = add_out_switch(codec, mutenid,
207 err = add_out_volume(codec, spec->multiout.dac_nids[i],
214 if (get_wcaps(codec, cfg->hp_pins[0]) & AC_WCAP_OUT_AMP)
219 err = add_out_switch(codec, mutenid, "Headphone");
223 err = add_out_volume(codec, spec->hp_dac, "Headphone");
230 if (get_wcaps(codec, spec->input_pins[i]) & AC_WCAP_IN_AMP)
234 err = add_in_switch(codec, mutenid, label);
237 err = add_in_volume(codec, spec->adcs[i], label);
243 err = snd_hda_create_spdif_out_ctls(codec, spec->dig_out);
246 err = snd_hda_create_spdif_share_sw(codec, &spec->multiout);
252 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in);
255 err = add_in_volume(codec, spec->dig_in, "IEC958");
300 static int ca0110_build_pcms(struct hda_codec *codec)
302 struct ca0110_spec *spec = codec->spec;
305 codec->pcm_info = info;
306 codec->num_pcms = 0;
316 codec->num_pcms++;
334 codec->num_pcms++;
339 static void init_output(struct hda_codec *codec, hda_nid_t pin, hda_nid_t dac)
342 snd_hda_codec_write(codec, pin, 0,
344 if (get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)
345 snd_hda_codec_write(codec, pin, 0,
350 snd_hda_codec_write(codec, dac, 0,
354 static void init_input(struct hda_codec *codec, hda_nid_t pin, hda_nid_t adc)
357 snd_hda_codec_write(codec, pin, 0,
359 if (get_wcaps(codec, pin) & AC_WCAP_IN_AMP)
360 snd_hda_codec_write(codec, pin, 0,
365 snd_hda_codec_write(codec, adc, 0, AC_VERB_SET_AMP_GAIN_MUTE,
369 static int ca0110_init(struct hda_codec *codec)
371 struct ca0110_spec *spec = codec->spec;
376 init_output(codec, spec->out_pins[i],
378 init_output(codec, cfg->hp_pins[0], spec->hp_dac);
379 init_output(codec, cfg->dig_out_pins[0], spec->dig_out);
382 init_input(codec, spec->input_pins[i], spec->adcs[i]);
383 init_input(codec, cfg->dig_in_pin, spec->dig_in);
387 static void ca0110_free(struct hda_codec *codec)
389 kfree(codec->spec);
400 static void parse_line_outs(struct hda_codec *codec)
402 struct ca0110_spec *spec = codec->spec;
411 def_conf = snd_hda_codec_get_pincfg(codec, nid);
414 if (snd_hda_get_connections(codec, nid, &spec->dacs[i], 1) != 1)
423 static void parse_hp_out(struct hda_codec *codec)
425 struct ca0110_spec *spec = codec->spec;
434 def_conf = snd_hda_codec_get_pincfg(codec, nid);
439 if (snd_hda_get_connections(codec, nid, &dac, 1) != 1)
451 static void parse_input(struct hda_codec *codec)
453 struct ca0110_spec *spec = codec->spec;
459 nid = codec->start_nid;
460 for (i = 0; i < codec->num_nodes; i++, nid++) {
461 unsigned int wcaps = get_wcaps(codec, nid);
465 if (snd_hda_get_connections(codec, nid, &pin, 1) != 1)
477 spec->input_labels[n] = hda_get_input_pin_label(codec, pin, 1);
484 static void parse_digital(struct hda_codec *codec)
486 struct ca0110_spec *spec = codec->spec;
490 snd_hda_get_connections(codec, cfg->dig_out_pins[0],
495 static int ca0110_parse_auto_config(struct hda_codec *codec)
497 struct ca0110_spec *spec = codec->spec;
500 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL);
504 parse_line_outs(codec);
505 parse_hp_out(codec);
506 parse_digital(codec);
507 parse_input(codec);
512 static int patch_ca0110(struct hda_codec *codec)
520 codec->spec = spec;
522 codec->bus->needs_damn_long_delay = 1;
524 err = ca0110_parse_auto_config(codec);
528 codec->patch_ops = ca0110_patch_ops;
533 kfree(codec->spec);
534 codec->spec = NULL;
549 MODULE_ALIAS("snd-hda-codec-id:1102000a");
550 MODULE_ALIAS("snd-hda-codec-id:1102000b");
551 MODULE_ALIAS("snd-hda-codec-id:1102000d");
554 MODULE_DESCRIPTION("Creative CA0110-IBG HD-audio codec");