Lines Matching refs:nid
81 for (; seq->nid; seq++) in snd_hda_sequence_write()
82 snd_hda_codec_write(codec, seq->nid, 0, seq->verb, seq->param); in snd_hda_sequence_write()
90 hda_nid_t nid; member
96 lookup_conn_list(struct hda_codec *codec, hda_nid_t nid) in lookup_conn_list() argument
100 if (p->nid == nid) in lookup_conn_list()
106 static int add_conn_list(struct hda_codec *codec, hda_nid_t nid, int len, in add_conn_list() argument
115 p->nid = nid; in add_conn_list()
132 static int read_and_add_raw_conns(struct hda_codec *codec, hda_nid_t nid) in read_and_add_raw_conns() argument
138 len = snd_hda_get_raw_connections(codec, nid, list, ARRAY_SIZE(list)); in read_and_add_raw_conns()
140 len = snd_hda_get_num_raw_conns(codec, nid); in read_and_add_raw_conns()
144 len = snd_hda_get_raw_connections(codec, nid, result, len); in read_and_add_raw_conns()
147 len = snd_hda_override_conn_list(codec, nid, len, result); in read_and_add_raw_conns()
168 int snd_hda_get_conn_list(struct hda_codec *codec, hda_nid_t nid, in snd_hda_get_conn_list() argument
178 p = lookup_conn_list(codec, nid); in snd_hda_get_conn_list()
187 err = read_and_add_raw_conns(codec, nid); in snd_hda_get_conn_list()
207 int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid, in snd_hda_get_connections() argument
211 int len = snd_hda_get_conn_list(codec, nid, &list); in snd_hda_get_connections()
216 len, nid); in snd_hda_get_connections()
238 int snd_hda_override_conn_list(struct hda_codec *codec, hda_nid_t nid, int len, in snd_hda_override_conn_list() argument
243 p = lookup_conn_list(codec, nid); in snd_hda_override_conn_list()
249 return add_conn_list(codec, nid, len, list); in snd_hda_override_conn_list()
265 hda_nid_t nid, int recursive) in snd_hda_get_conn_index() argument
272 if (conn[i] == nid) in snd_hda_get_conn_index()
277 codec_dbg(codec, "too deep connection for 0x%x\n", nid); in snd_hda_get_conn_index()
285 if (snd_hda_get_conn_index(codec, conn[i], nid, recursive) >= 0) in snd_hda_get_conn_index()
300 unsigned int snd_hda_get_num_devices(struct hda_codec *codec, hda_nid_t nid) in snd_hda_get_num_devices() argument
302 unsigned int wcaps = get_wcaps(codec, nid); in snd_hda_get_num_devices()
309 parm = snd_hdac_read_parm_uncached(&codec->core, nid, AC_PAR_DEVLIST_LEN); in snd_hda_get_num_devices()
326 int snd_hda_get_devices(struct hda_codec *codec, hda_nid_t nid, in snd_hda_get_devices() argument
332 parm = snd_hda_get_num_devices(codec, nid); in snd_hda_get_devices()
341 if (snd_hdac_read(&codec->core, nid, in snd_hda_get_devices()
365 int snd_hda_get_dev_select(struct hda_codec *codec, hda_nid_t nid) in snd_hda_get_dev_select() argument
371 return snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_DEVICE_SEL, 0); in snd_hda_get_dev_select()
383 int snd_hda_set_dev_select(struct hda_codec *codec, hda_nid_t nid, int dev_id) in snd_hda_set_dev_select() argument
392 num_devices = snd_hda_get_num_devices(codec, nid) + 1; in snd_hda_set_dev_select()
406 ret = snd_hda_codec_write(codec, nid, 0, in snd_hda_set_dev_select()
419 hda_nid_t nid; in read_widget_caps() local
424 nid = codec->core.start_nid; in read_widget_caps()
425 for (i = 0; i < codec->core.num_nodes; i++, nid++) in read_widget_caps()
427 nid, AC_PAR_AUDIO_WIDGET_CAP); in read_widget_caps()
434 hda_nid_t nid; in read_pin_defaults() local
436 for_each_hda_codec_node(nid, codec) { in read_pin_defaults()
438 unsigned int wcaps = get_wcaps(codec, nid); in read_pin_defaults()
445 pin->nid = nid; in read_pin_defaults()
446 pin->cfg = snd_hda_codec_read(codec, nid, 0, in read_pin_defaults()
452 pin->ctrl = snd_hda_codec_read(codec, nid, 0, in read_pin_defaults()
462 hda_nid_t nid) in look_up_pincfg() argument
468 if (pin->nid == nid) in look_up_pincfg()
478 hda_nid_t nid, unsigned int cfg) in snd_hda_add_pincfg() argument
491 pin = look_up_pincfg(codec, list, nid); in snd_hda_add_pincfg()
496 pin->nid = nid; in snd_hda_add_pincfg()
513 hda_nid_t nid, unsigned int cfg) in snd_hda_codec_set_pincfg() argument
515 return snd_hda_add_pincfg(codec, &codec->driver_pins, nid, cfg); in snd_hda_codec_set_pincfg()
528 unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid) in snd_hda_codec_get_pincfg() argument
536 pin = look_up_pincfg(codec, &codec->user_pins, nid); in snd_hda_codec_get_pincfg()
544 pin = look_up_pincfg(codec, &codec->driver_pins, nid); in snd_hda_codec_get_pincfg()
547 pin = look_up_pincfg(codec, &codec->init_pins, nid); in snd_hda_codec_get_pincfg()
564 int snd_hda_codec_set_pin_target(struct hda_codec *codec, hda_nid_t nid, in snd_hda_codec_set_pin_target() argument
569 pin = look_up_pincfg(codec, &codec->init_pins, nid); in snd_hda_codec_set_pin_target()
582 int snd_hda_codec_get_pin_target(struct hda_codec *codec, hda_nid_t nid) in snd_hda_codec_get_pin_target() argument
586 pin = look_up_pincfg(codec, &codec->init_pins, nid); in snd_hda_codec_get_pin_target()
612 snd_hda_codec_read(codec, pin->nid, 0, in snd_hda_shutup_pins()
631 snd_hda_codec_write(codec, pin->nid, 0, in restore_shutup_pins()
678 hda_nid_t nid; member
688 get_hda_cvt_setup(struct hda_codec *codec, hda_nid_t nid) in get_hda_cvt_setup() argument
694 if (p->nid == nid) in get_hda_cvt_setup()
699 p->nid = nid; in get_hda_cvt_setup()
1090 struct hda_cvt_setup *p, hda_nid_t nid, in update_pcm_stream_id() argument
1096 oldval = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0); in update_pcm_stream_id()
1099 snd_hda_codec_write(codec, nid, 0, in update_pcm_stream_id()
1109 hda_nid_t nid, int format) in update_pcm_format() argument
1114 oldval = snd_hda_codec_read(codec, nid, 0, in update_pcm_format()
1118 snd_hda_codec_write(codec, nid, 0, in update_pcm_format()
1134 void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, in snd_hda_codec_setup_stream() argument
1143 if (!nid) in snd_hda_codec_setup_stream()
1148 nid, stream_tag, channel_id, format); in snd_hda_codec_setup_stream()
1149 p = get_hda_cvt_setup(codec, nid); in snd_hda_codec_setup_stream()
1154 codec->patch_ops.stream_pm(codec, nid, true); in snd_hda_codec_setup_stream()
1156 update_pcm_format(codec, p, nid, format); in snd_hda_codec_setup_stream()
1157 update_pcm_stream_id(codec, p, nid, stream_tag, channel_id); in snd_hda_codec_setup_stream()
1159 update_pcm_format(codec, p, nid, format); in snd_hda_codec_setup_stream()
1165 type = get_wcaps_type(get_wcaps(codec, nid)); in snd_hda_codec_setup_stream()
1169 get_wcaps_type(get_wcaps(c, p->nid)) == type) in snd_hda_codec_setup_stream()
1185 void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid, in __snd_hda_codec_cleanup_stream() argument
1190 if (!nid) in __snd_hda_codec_cleanup_stream()
1196 codec_dbg(codec, "hda_codec_cleanup_stream: NID=0x%x\n", nid); in __snd_hda_codec_cleanup_stream()
1197 p = get_hda_cvt_setup(codec, nid); in __snd_hda_codec_cleanup_stream()
1214 hda_nid_t nid = q->nid; in really_cleanup_stream() local
1216 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, 0); in really_cleanup_stream()
1218 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0 in really_cleanup_stream()
1221 q->nid = nid; in really_cleanup_stream()
1223 codec->patch_ops.stream_pm(codec, nid, false); in really_cleanup_stream()
1271 u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction) in query_amp_caps() argument
1273 if (!(get_wcaps(codec, nid) & AC_WCAP_AMP_OVRD)) in query_amp_caps()
1274 nid = codec->core.afg; in query_amp_caps()
1275 return snd_hda_param_read(codec, nid, in query_amp_caps()
1290 bool snd_hda_check_amp_caps(struct hda_codec *codec, hda_nid_t nid, in snd_hda_check_amp_caps() argument
1293 if (!nid) in snd_hda_check_amp_caps()
1295 if (get_wcaps(codec, nid) & (1 << (dir + 1))) in snd_hda_check_amp_caps()
1296 if (query_amp_caps(codec, nid, dir) & bits) in snd_hda_check_amp_caps()
1315 int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, in snd_hda_override_amp_caps() argument
1320 snd_hda_override_wcaps(codec, nid, in snd_hda_override_amp_caps()
1321 get_wcaps(codec, nid) | AC_WCAP_AMP_OVRD); in snd_hda_override_amp_caps()
1323 return snd_hdac_override_parm(&codec->core, nid, parm, caps); in snd_hda_override_amp_caps()
1327 static unsigned int encode_amp(struct hda_codec *codec, hda_nid_t nid, in encode_amp() argument
1330 unsigned int cmd = snd_hdac_regmap_encode_amp(nid, ch, dir, idx); in encode_amp()
1333 if ((query_amp_caps(codec, nid, dir) & in encode_amp()
1351 int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, in snd_hda_codec_amp_update() argument
1354 unsigned int cmd = encode_amp(codec, nid, ch, dir, idx); in snd_hda_codec_amp_update()
1372 int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid, in snd_hda_codec_amp_stereo() argument
1380 ret |= snd_hda_codec_amp_update(codec, nid, ch, direction, in snd_hda_codec_amp_stereo()
1400 int snd_hda_codec_amp_init(struct hda_codec *codec, hda_nid_t nid, int ch, in snd_hda_codec_amp_init() argument
1403 unsigned int cmd = encode_amp(codec, nid, ch, dir, idx); in snd_hda_codec_amp_init()
1422 int snd_hda_codec_amp_init_stereo(struct hda_codec *codec, hda_nid_t nid, in snd_hda_codec_amp_init_stereo() argument
1430 ret |= snd_hda_codec_amp_init(codec, nid, ch, dir, in snd_hda_codec_amp_init_stereo()
1436 static u32 get_amp_max_value(struct hda_codec *codec, hda_nid_t nid, int dir, in get_amp_max_value() argument
1439 u32 caps = query_amp_caps(codec, nid, dir); in get_amp_max_value()
1459 u16 nid = get_amp_nid(kcontrol); in snd_hda_mixer_amp_volume_info() local
1467 uinfo->value.integer.max = get_amp_max_value(codec, nid, dir, ofs); in snd_hda_mixer_amp_volume_info()
1471 nid, kcontrol->id.name); in snd_hda_mixer_amp_volume_info()
1480 read_amp_value(struct hda_codec *codec, hda_nid_t nid, in read_amp_value() argument
1484 val = snd_hda_codec_amp_read(codec, nid, ch, dir, idx); in read_amp_value()
1494 update_amp_value(struct hda_codec *codec, hda_nid_t nid, in update_amp_value() argument
1503 maxval = get_amp_max_value(codec, nid, dir, 0); in update_amp_value()
1506 return snd_hda_codec_amp_update(codec, nid, ch, dir, idx, in update_amp_value()
1522 hda_nid_t nid = get_amp_nid(kcontrol); in snd_hda_mixer_amp_volume_get() local
1530 *valp++ = read_amp_value(codec, nid, 0, dir, idx, ofs); in snd_hda_mixer_amp_volume_get()
1532 *valp = read_amp_value(codec, nid, 1, dir, idx, ofs); in snd_hda_mixer_amp_volume_get()
1549 hda_nid_t nid = get_amp_nid(kcontrol); in snd_hda_mixer_amp_volume_put() local
1558 change = update_amp_value(codec, nid, 0, dir, idx, ofs, *valp); in snd_hda_mixer_amp_volume_put()
1562 change |= update_amp_value(codec, nid, 1, dir, idx, ofs, *valp); in snd_hda_mixer_amp_volume_put()
1571 hda_nid_t nid = get_amp_nid(kcontrol); in get_ctl_amp_tlv() local
1577 caps = query_amp_caps(codec, nid, dir); in get_ctl_amp_tlv()
1626 void snd_hda_set_vmaster_tlv(struct hda_codec *codec, hda_nid_t nid, int dir, in snd_hda_set_vmaster_tlv() argument
1632 caps = query_amp_caps(codec, nid, dir); in snd_hda_set_vmaster_tlv()
1703 int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid, in snd_hda_ctl_add() argument
1712 if (nid == 0) in snd_hda_ctl_add()
1713 nid = get_amp_nid_(kctl->private_value); in snd_hda_ctl_add()
1715 if ((kctl->id.subdevice & HDA_SUBDEV_NID_FLAG) != 0 && nid == 0) in snd_hda_ctl_add()
1716 nid = kctl->id.subdevice & 0xffff; in snd_hda_ctl_add()
1726 item->nid = nid; in snd_hda_ctl_add()
1744 unsigned int index, hda_nid_t nid) in snd_hda_add_nid() argument
1748 if (nid > 0) { in snd_hda_add_nid()
1754 item->nid = nid; in snd_hda_add_nid()
2122 hda_nid_t nid = get_amp_nid(kcontrol); in snd_hda_mixer_amp_switch_get() local
2129 *valp++ = (snd_hda_codec_amp_read(codec, nid, 0, dir, idx) & in snd_hda_mixer_amp_switch_get()
2132 *valp = (snd_hda_codec_amp_read(codec, nid, 1, dir, idx) & in snd_hda_mixer_amp_switch_get()
2150 hda_nid_t nid = get_amp_nid(kcontrol); in snd_hda_mixer_amp_switch_put() local
2158 change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx, in snd_hda_mixer_amp_switch_put()
2164 change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, in snd_hda_mixer_amp_switch_put()
2167 hda_call_check_power_status(codec, nid); in snd_hda_mixer_amp_switch_put()
2279 static void set_dig_out(struct hda_codec *codec, hda_nid_t nid, in set_dig_out() argument
2284 snd_hdac_regmap_update(&codec->core, nid, AC_VERB_SET_DIGI_CONVERT_1, in set_dig_out()
2294 static inline void set_dig_out_convert(struct hda_codec *codec, hda_nid_t nid, in set_dig_out_convert() argument
2308 set_dig_out(codec, nid, mask, val); in set_dig_out_convert()
2317 hda_nid_t nid; in snd_hda_spdif_default_put() local
2325 nid = spdif->nid; in snd_hda_spdif_default_put()
2334 if (change && nid != (u16)-1) in snd_hda_spdif_default_put()
2335 set_dig_out_convert(codec, nid, val & 0xff, (val >> 8) & 0xff); in snd_hda_spdif_default_put()
2358 static inline void set_spdif_ctls(struct hda_codec *codec, hda_nid_t nid, in set_spdif_ctls() argument
2361 set_dig_out_convert(codec, nid, dig1, dig2); in set_spdif_ctls()
2363 if ((get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) && in set_spdif_ctls()
2365 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, in set_spdif_ctls()
2375 hda_nid_t nid; in snd_hda_spdif_out_switch_put() local
2383 nid = spdif->nid; in snd_hda_spdif_out_switch_put()
2389 if (change && nid != (u16)-1) in snd_hda_spdif_out_switch_put()
2390 set_spdif_ctls(codec, nid, val & 0xff, -1); in snd_hda_spdif_out_switch_put()
2491 spdif->nid = cvt_nid; in snd_hda_create_dig_out_ctls()
2508 hda_nid_t nid) in snd_hda_spdif_out_of_nid() argument
2514 if (spdif->nid == nid) in snd_hda_spdif_out_of_nid()
2536 spdif->nid = (u16)-1; in snd_hda_spdif_ctls_unassign()
2549 void snd_hda_spdif_ctls_assign(struct hda_codec *codec, int idx, hda_nid_t nid) in snd_hda_spdif_ctls_assign() argument
2558 if (spdif->nid != nid) { in snd_hda_spdif_ctls_assign()
2559 spdif->nid = nid; in snd_hda_spdif_ctls_assign()
2561 set_spdif_ctls(codec, nid, val & 0xff, (val >> 8) & 0xff); in snd_hda_spdif_ctls_assign()
2634 hda_nid_t nid = kcontrol->private_value; in snd_hda_spdif_in_switch_put() local
2642 snd_hdac_regmap_write(&codec->core, nid, in snd_hda_spdif_in_switch_put()
2653 hda_nid_t nid = kcontrol->private_value; in snd_hda_spdif_in_status_get() local
2657 snd_hdac_regmap_read(&codec->core, nid, in snd_hda_spdif_in_status_get()
2695 int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid) in snd_hda_create_spdif_in_ctls() argument
2711 kctl->private_value = nid; in snd_hda_create_spdif_in_ctls()
2712 err = snd_hda_ctl_add(codec, nid, kctl); in snd_hda_create_spdif_in_ctls()
2717 snd_hda_codec_read(codec, nid, 0, in snd_hda_create_spdif_in_ctls()
2737 hda_nid_t nid; in snd_hda_codec_set_power_to_all() local
2739 for_each_hda_codec_node(nid, codec) { in snd_hda_codec_set_power_to_all()
2740 unsigned int wcaps = get_wcaps(codec, nid); in snd_hda_codec_set_power_to_all()
2745 state = codec->power_filter(codec, nid, power_state); in snd_hda_codec_set_power_to_all()
2749 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, in snd_hda_codec_set_power_to_all()
2765 hda_nid_t nid, in snd_hda_codec_eapd_power_filter() argument
2768 if (nid == codec->core.afg || nid == codec->core.mfg) in snd_hda_codec_eapd_power_filter()
2771 get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_PIN && in snd_hda_codec_eapd_power_filter()
2772 (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)) { in snd_hda_codec_eapd_power_filter()
2773 int eapd = snd_hda_codec_read(codec, nid, 0, in snd_hda_codec_eapd_power_filter()
2830 hda_nid_t nid; in sync_power_up_states() local
2836 for_each_hda_codec_node(nid, codec) { in sync_power_up_states()
2837 unsigned int wcaps = get_wcaps(codec, nid); in sync_power_up_states()
2841 target = codec->power_filter(codec, nid, AC_PWRST_D0); in sync_power_up_states()
2844 if (!snd_hda_check_power_state(codec, nid, target)) in sync_power_up_states()
2845 snd_hda_codec_write(codec, nid, 0, in sync_power_up_states()
3144 snd_hda_codec_setup_stream(codec, hinfo->nid, stream_tag, 0, format); in hda_pcm_default_prepare()
3152 snd_hda_codec_cleanup_stream(codec, hinfo->nid); in hda_pcm_default_cleanup()
3162 if (info->nid && (!info->rates || !info->formats)) { in set_pcm_default_values()
3163 err = snd_hda_query_supported_pcm(codec, info->nid, in set_pcm_default_values()
3175 if (snd_BUG_ON(!info->nid)) in set_pcm_default_values()
3180 if (snd_BUG_ON(!info->nid)) in set_pcm_default_values()
3484 hda_nid_t nid) in snd_hda_check_amp_list_power() argument
3491 for (p = check->amplist; p->nid; p++) { in snd_hda_check_amp_list_power()
3492 if (p->nid == nid) in snd_hda_check_amp_list_power()
3495 if (!p->nid) in snd_hda_check_amp_list_power()
3498 for (p = check->amplist; p->nid; p++) { in snd_hda_check_amp_list_power()
3500 v = snd_hda_codec_amp_read(codec, p->nid, ch, p->dir, in snd_hda_check_amp_list_power()
3558 hda_nid_t nid, in snd_hda_input_mux_put() argument
3570 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, in snd_hda_input_mux_put()
3610 static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, in setup_dig_out_stream() argument
3617 spdif = snd_hda_spdif_out_of_nid(codec, nid); in setup_dig_out_stream()
3624 curr_fmt = snd_hda_codec_read(codec, nid, 0, in setup_dig_out_stream()
3633 set_dig_out_convert(codec, nid, in setup_dig_out_stream()
3636 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); in setup_dig_out_stream()
3645 set_dig_out_convert(codec, nid, in setup_dig_out_stream()
3649 static void cleanup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid) in cleanup_dig_out_stream() argument
3651 snd_hda_codec_cleanup_stream(codec, nid); in cleanup_dig_out_stream()