/* create multi_init table, which is used for multichannel initialization */ static int cmi9880_fill_multi_init(struct hda_codec *codec, const struct auto_pin_cfg *cfg) { struct cmi_spec *spec = codec->spec; hda_nid_t nid; int i, j, k; /* clear the table, only one c-media dac assumed here */ memset(spec->multi_init, 0, sizeof(spec->multi_init)); for (j = 0, i = 0; i < cfg->line_outs; i++) { nid = cfg->line_out_pins[i]; /* set as output */ spec->multi_init[j].nid = nid; spec->multi_init[j].verb = AC_VERB_SET_PIN_WIDGET_CONTROL; spec->multi_init[j].param = PIN_OUT; j++; if (nid > 0x0e) { /* set connection */ spec->multi_init[j].nid = nid; spec->multi_init[j].verb = AC_VERB_SET_CONNECT_SEL; spec->multi_init[j].param = 0; /* find the index in connect list */ k = snd_hda_get_conn_index(codec, nid, spec->dac_nids[i], 0); if (k >= 0) spec->multi_init[j].param = k; j++; } } return 0; }
static hda_nid_t get_adc(struct hda_codec *codec, hda_nid_t pin, unsigned int *idxp) { int i, idx; hda_nid_t nid; nid = codec->start_nid; for (i = 0; i < codec->num_nodes; i++, nid++) { unsigned int type; type = get_wcaps_type(get_wcaps(codec, nid)); if (type != AC_WID_AUD_IN) continue; idx = snd_hda_get_conn_index(codec, nid, pin, false); if (idx >= 0) { *idxp = idx; return nid; } } return 0; }