26 #include <linux/slab.h>
27 #include <linux/pci.h>
28 #include <linux/module.h>
94 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
96 ucontrol->
value.enumerated.item[0] = spec->
cur_mux[adc_idx];
104 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
115 static const struct hda_verb cmi9880_ch2_init[] = {
126 static const struct hda_verb cmi9880_ch6_init[] = {
137 static const struct hda_verb cmi9880_ch8_init[] = {
148 { 2, cmi9880_ch2_init },
149 { 6, cmi9880_ch6_init },
150 { 8, cmi9880_ch8_init },
192 .name =
"Input Source",
194 .info = cmi_mux_enum_info,
195 .get = cmi_mux_enum_get,
196 .put = cmi_mux_enum_put,
213 .name =
"Channel Mode",
214 .info = cmi_ch_mode_info,
215 .get = cmi_ch_mode_get,
216 .put = cmi_ch_mode_put,
227 {
"Front Mic", 0x5 },
237 {
"Front Mic", 0x5 },
244 static const hda_nid_t cmi9880_dac_nids[4] = {
245 0x03, 0x04, 0x05, 0x06
248 static const hda_nid_t cmi9880_adc_nids[2] = {
252 #define CMI_DIG_OUT_NID 0x07
253 #define CMI_DIG_IN_NID 0x0a
257 static const struct hda_verb cmi9880_basic_init[] = {
286 static const struct hda_verb cmi9880_allout_init[] = {
351 for (i = 0; kctl && i < kctl->
count; i++) {
370 memset(assigned, 0,
sizeof(assigned));
375 if (nid >= 0x0b && nid <= 0x0e) {
377 assigned[nid - 0x0b] = 1;
407 for (j = 0, i = 0; i < cfg->
line_outs; i++) {
430 static int cmi9880_init(
struct hda_codec *codec)
445 static int cmi9880_playback_pcm_open(
struct hda_pcm_stream *hinfo,
454 static int cmi9880_playback_pcm_prepare(
struct hda_pcm_stream *hinfo,
456 unsigned int stream_tag,
465 static int cmi9880_playback_pcm_cleanup(
struct hda_pcm_stream *hinfo,
476 static int cmi9880_dig_playback_pcm_open(
struct hda_pcm_stream *hinfo,
484 static int cmi9880_dig_playback_pcm_close(
struct hda_pcm_stream *hinfo,
492 static int cmi9880_dig_playback_pcm_prepare(
struct hda_pcm_stream *hinfo,
494 unsigned int stream_tag,
506 static int cmi9880_capture_pcm_prepare(
struct hda_pcm_stream *hinfo,
508 unsigned int stream_tag,
515 stream_tag, 0, format);
519 static int cmi9880_capture_pcm_cleanup(
struct hda_pcm_stream *hinfo,
532 static const struct hda_pcm_stream cmi9880_pcm_analog_playback = {
538 .open = cmi9880_playback_pcm_open,
539 .prepare = cmi9880_playback_pcm_prepare,
540 .cleanup = cmi9880_playback_pcm_cleanup
550 .prepare = cmi9880_capture_pcm_prepare,
551 .cleanup = cmi9880_capture_pcm_cleanup
555 static const struct hda_pcm_stream cmi9880_pcm_digital_playback = {
561 .open = cmi9880_dig_playback_pcm_open,
562 .close = cmi9880_dig_playback_pcm_close,
563 .prepare = cmi9880_dig_playback_pcm_prepare
567 static const struct hda_pcm_stream cmi9880_pcm_digital_capture = {
574 static int cmi9880_build_pcms(
struct hda_codec *codec)
582 info->
name =
"CMI9880";
589 info->
name =
"CMI9880 Digital";
604 static void cmi9880_free(
struct hda_codec *codec)
612 static const char *
const cmi9880_models[
CMI_MODELS] = {
621 static const struct snd_pci_quirk cmi9880_cfg_tbl[] = {
622 SND_PCI_QUIRK(0x1043, 0x813d,
"ASUS P5AD2",
CMI_FULL_DIG),
623 SND_PCI_QUIRK(0x1854, 0x002b,
"LG LS75",
CMI_MINIMAL),
629 .build_controls = cmi9880_build_controls,
630 .build_pcms = cmi9880_build_pcms,
631 .init = cmi9880_init,
632 .free = cmi9880_free,
635 static int patch_cmi9880(
struct hda_codec *codec)
689 unsigned int port_e, port_f, port_g, port_h;
690 unsigned int port_spdifi, port_spdifo;
728 cmi9880_fill_multi_dac_nids(codec, &cfg);
729 cmi9880_fill_multi_init(codec, &cfg);
731 snd_printd(
"patch_cmedia: cannot detect association in defcfg\n");
750 { .id = 0x13f69880, .name =
"CMI9880", .patch = patch_cmi9880 },
751 { .id = 0x434d4980, .name =
"CMI9880", .patch = patch_cmi9880 },
762 .preset = snd_hda_preset_cmedia,
766 static int __init patch_cmedia_init(
void)
771 static void __exit patch_cmedia_exit(
void)