Lines Matching refs:nid
175 unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, in snd_hda_codec_read() argument
179 unsigned int cmd = snd_hdac_make_cmd(&codec->core, nid, verb, parm); in snd_hda_codec_read()
199 int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int flags, in snd_hda_codec_write() argument
202 unsigned int cmd = snd_hdac_make_cmd(&codec->core, nid, verb, parm); in snd_hda_codec_write()
217 for (; seq->nid; seq++) in snd_hda_sequence_write()
218 snd_hda_codec_write(codec, seq->nid, 0, seq->verb, seq->param); in snd_hda_sequence_write()
226 hda_nid_t nid; member
232 lookup_conn_list(struct hda_codec *codec, hda_nid_t nid) in lookup_conn_list() argument
236 if (p->nid == nid) in lookup_conn_list()
242 static int add_conn_list(struct hda_codec *codec, hda_nid_t nid, int len, in add_conn_list() argument
251 p->nid = nid; in add_conn_list()
268 static int read_and_add_raw_conns(struct hda_codec *codec, hda_nid_t nid) in read_and_add_raw_conns() argument
274 len = snd_hda_get_raw_connections(codec, nid, list, ARRAY_SIZE(list)); in read_and_add_raw_conns()
276 len = snd_hda_get_num_raw_conns(codec, nid); in read_and_add_raw_conns()
280 len = snd_hda_get_raw_connections(codec, nid, result, len); in read_and_add_raw_conns()
283 len = snd_hda_override_conn_list(codec, nid, len, result); in read_and_add_raw_conns()
304 int snd_hda_get_conn_list(struct hda_codec *codec, hda_nid_t nid, in snd_hda_get_conn_list() argument
314 p = lookup_conn_list(codec, nid); in snd_hda_get_conn_list()
323 err = read_and_add_raw_conns(codec, nid); in snd_hda_get_conn_list()
343 int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid, in snd_hda_get_connections() argument
347 int len = snd_hda_get_conn_list(codec, nid, &list); in snd_hda_get_connections()
352 len, nid); in snd_hda_get_connections()
374 int snd_hda_override_conn_list(struct hda_codec *codec, hda_nid_t nid, int len, in snd_hda_override_conn_list() argument
379 p = lookup_conn_list(codec, nid); in snd_hda_override_conn_list()
385 return add_conn_list(codec, nid, len, list); in snd_hda_override_conn_list()
401 hda_nid_t nid, int recursive) in snd_hda_get_conn_index() argument
408 if (conn[i] == nid) in snd_hda_get_conn_index()
413 codec_dbg(codec, "too deep connection for 0x%x\n", nid); in snd_hda_get_conn_index()
421 if (snd_hda_get_conn_index(codec, conn[i], nid, recursive) >= 0) in snd_hda_get_conn_index()
430 static unsigned int get_num_devices(struct hda_codec *codec, hda_nid_t nid) in get_num_devices() argument
432 unsigned int wcaps = get_wcaps(codec, nid); in get_num_devices()
439 parm = snd_hdac_read_parm_uncached(&codec->core, nid, AC_PAR_DEVLIST_LEN); in get_num_devices()
455 int snd_hda_get_devices(struct hda_codec *codec, hda_nid_t nid, in snd_hda_get_devices() argument
461 parm = get_num_devices(codec, nid); in snd_hda_get_devices()
470 parm = snd_hda_codec_read(codec, nid, 0, in snd_hda_get_devices()
582 hda_nid_t nid; in read_widget_caps() local
587 nid = codec->core.start_nid; in read_widget_caps()
588 for (i = 0; i < codec->core.num_nodes; i++, nid++) in read_widget_caps()
590 nid, AC_PAR_AUDIO_WIDGET_CAP); in read_widget_caps()
597 hda_nid_t nid; in read_pin_defaults() local
599 for_each_hda_codec_node(nid, codec) { in read_pin_defaults()
601 unsigned int wcaps = get_wcaps(codec, nid); in read_pin_defaults()
608 pin->nid = nid; in read_pin_defaults()
609 pin->cfg = snd_hda_codec_read(codec, nid, 0, in read_pin_defaults()
611 pin->ctrl = snd_hda_codec_read(codec, nid, 0, in read_pin_defaults()
621 hda_nid_t nid) in look_up_pincfg() argument
626 if (pin->nid == nid) in look_up_pincfg()
636 hda_nid_t nid, unsigned int cfg) in snd_hda_add_pincfg() argument
649 pin = look_up_pincfg(codec, list, nid); in snd_hda_add_pincfg()
654 pin->nid = nid; in snd_hda_add_pincfg()
671 hda_nid_t nid, unsigned int cfg) in snd_hda_codec_set_pincfg() argument
673 return snd_hda_add_pincfg(codec, &codec->driver_pins, nid, cfg); in snd_hda_codec_set_pincfg()
686 unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid) in snd_hda_codec_get_pincfg() argument
694 pin = look_up_pincfg(codec, &codec->user_pins, nid); in snd_hda_codec_get_pincfg()
702 pin = look_up_pincfg(codec, &codec->driver_pins, nid); in snd_hda_codec_get_pincfg()
705 pin = look_up_pincfg(codec, &codec->init_pins, nid); in snd_hda_codec_get_pincfg()
722 int snd_hda_codec_set_pin_target(struct hda_codec *codec, hda_nid_t nid, in snd_hda_codec_set_pin_target() argument
727 pin = look_up_pincfg(codec, &codec->init_pins, nid); in snd_hda_codec_set_pin_target()
740 int snd_hda_codec_get_pin_target(struct hda_codec *codec, hda_nid_t nid) in snd_hda_codec_get_pin_target() argument
744 pin = look_up_pincfg(codec, &codec->init_pins, nid); in snd_hda_codec_get_pin_target()
769 snd_hda_codec_read(codec, pin->nid, 0, in snd_hda_shutup_pins()
787 snd_hda_codec_write(codec, pin->nid, 0, in restore_shutup_pins()
824 hda_nid_t nid; member
834 get_hda_cvt_setup(struct hda_codec *codec, hda_nid_t nid) in get_hda_cvt_setup() argument
841 if (p->nid == nid) in get_hda_cvt_setup()
846 p->nid = nid; in get_hda_cvt_setup()
1139 struct hda_cvt_setup *p, hda_nid_t nid, in update_pcm_stream_id() argument
1145 oldval = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0); in update_pcm_stream_id()
1148 snd_hda_codec_write(codec, nid, 0, in update_pcm_stream_id()
1158 hda_nid_t nid, int format) in update_pcm_format() argument
1163 oldval = snd_hda_codec_read(codec, nid, 0, in update_pcm_format()
1167 snd_hda_codec_write(codec, nid, 0, in update_pcm_format()
1183 void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, in snd_hda_codec_setup_stream() argument
1192 if (!nid) in snd_hda_codec_setup_stream()
1197 nid, stream_tag, channel_id, format); in snd_hda_codec_setup_stream()
1198 p = get_hda_cvt_setup(codec, nid); in snd_hda_codec_setup_stream()
1203 codec->patch_ops.stream_pm(codec, nid, true); in snd_hda_codec_setup_stream()
1205 update_pcm_format(codec, p, nid, format); in snd_hda_codec_setup_stream()
1206 update_pcm_stream_id(codec, p, nid, stream_tag, channel_id); in snd_hda_codec_setup_stream()
1208 update_pcm_format(codec, p, nid, format); in snd_hda_codec_setup_stream()
1214 type = get_wcaps_type(get_wcaps(codec, nid)); in snd_hda_codec_setup_stream()
1219 get_wcaps_type(get_wcaps(c, p->nid)) == type) in snd_hda_codec_setup_stream()
1235 void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid, in __snd_hda_codec_cleanup_stream() argument
1240 if (!nid) in __snd_hda_codec_cleanup_stream()
1246 codec_dbg(codec, "hda_codec_cleanup_stream: NID=0x%x\n", nid); in __snd_hda_codec_cleanup_stream()
1247 p = get_hda_cvt_setup(codec, nid); in __snd_hda_codec_cleanup_stream()
1264 hda_nid_t nid = q->nid; in really_cleanup_stream() local
1266 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, 0); in really_cleanup_stream()
1268 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0 in really_cleanup_stream()
1271 q->nid = nid; in really_cleanup_stream()
1273 codec->patch_ops.stream_pm(codec, nid, false); in really_cleanup_stream()
1322 u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction) in query_amp_caps() argument
1324 if (!(get_wcaps(codec, nid) & AC_WCAP_AMP_OVRD)) in query_amp_caps()
1325 nid = codec->core.afg; in query_amp_caps()
1326 return snd_hda_param_read(codec, nid, in query_amp_caps()
1341 bool snd_hda_check_amp_caps(struct hda_codec *codec, hda_nid_t nid, in snd_hda_check_amp_caps() argument
1344 if (!nid) in snd_hda_check_amp_caps()
1346 if (get_wcaps(codec, nid) & (1 << (dir + 1))) in snd_hda_check_amp_caps()
1347 if (query_amp_caps(codec, nid, dir) & bits) in snd_hda_check_amp_caps()
1366 int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, in snd_hda_override_amp_caps() argument
1371 snd_hda_override_wcaps(codec, nid, in snd_hda_override_amp_caps()
1372 get_wcaps(codec, nid) | AC_WCAP_AMP_OVRD); in snd_hda_override_amp_caps()
1374 return snd_hdac_override_parm(&codec->core, nid, parm, caps); in snd_hda_override_amp_caps()
1390 int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, in snd_hda_codec_amp_update() argument
1393 unsigned int cmd = snd_hdac_regmap_encode_amp(nid, ch, dir, idx); in snd_hda_codec_amp_update()
1396 if ((query_amp_caps(codec, nid, dir) & in snd_hda_codec_amp_update()
1415 int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid, in snd_hda_codec_amp_stereo() argument
1423 ret |= snd_hda_codec_amp_update(codec, nid, ch, direction, in snd_hda_codec_amp_stereo()
1443 int snd_hda_codec_amp_init(struct hda_codec *codec, hda_nid_t nid, int ch, in snd_hda_codec_amp_init() argument
1451 orig = snd_hda_codec_amp_read(codec, nid, ch, dir, idx); in snd_hda_codec_amp_init()
1455 return snd_hda_codec_amp_update(codec, nid, ch, dir, idx, mask, val); in snd_hda_codec_amp_init()
1470 int snd_hda_codec_amp_init_stereo(struct hda_codec *codec, hda_nid_t nid, in snd_hda_codec_amp_init_stereo() argument
1478 ret |= snd_hda_codec_amp_init(codec, nid, ch, dir, in snd_hda_codec_amp_init_stereo()
1484 static u32 get_amp_max_value(struct hda_codec *codec, hda_nid_t nid, int dir, in get_amp_max_value() argument
1487 u32 caps = query_amp_caps(codec, nid, dir); in get_amp_max_value()
1507 u16 nid = get_amp_nid(kcontrol); in snd_hda_mixer_amp_volume_info() local
1515 uinfo->value.integer.max = get_amp_max_value(codec, nid, dir, ofs); in snd_hda_mixer_amp_volume_info()
1519 nid, kcontrol->id.name); in snd_hda_mixer_amp_volume_info()
1528 read_amp_value(struct hda_codec *codec, hda_nid_t nid, in read_amp_value() argument
1532 val = snd_hda_codec_amp_read(codec, nid, ch, dir, idx); in read_amp_value()
1542 update_amp_value(struct hda_codec *codec, hda_nid_t nid, in update_amp_value() argument
1551 maxval = get_amp_max_value(codec, nid, dir, 0); in update_amp_value()
1554 return snd_hda_codec_amp_update(codec, nid, ch, dir, idx, in update_amp_value()
1570 hda_nid_t nid = get_amp_nid(kcontrol); in snd_hda_mixer_amp_volume_get() local
1578 *valp++ = read_amp_value(codec, nid, 0, dir, idx, ofs); in snd_hda_mixer_amp_volume_get()
1580 *valp = read_amp_value(codec, nid, 1, dir, idx, ofs); in snd_hda_mixer_amp_volume_get()
1597 hda_nid_t nid = get_amp_nid(kcontrol); in snd_hda_mixer_amp_volume_put() local
1606 change = update_amp_value(codec, nid, 0, dir, idx, ofs, *valp); in snd_hda_mixer_amp_volume_put()
1610 change |= update_amp_value(codec, nid, 1, dir, idx, ofs, *valp); in snd_hda_mixer_amp_volume_put()
1629 hda_nid_t nid = get_amp_nid(kcontrol); in snd_hda_mixer_amp_tlv() local
1637 caps = query_amp_caps(codec, nid, dir); in snd_hda_mixer_amp_tlv()
1668 void snd_hda_set_vmaster_tlv(struct hda_codec *codec, hda_nid_t nid, int dir, in snd_hda_set_vmaster_tlv() argument
1674 caps = query_amp_caps(codec, nid, dir); in snd_hda_set_vmaster_tlv()
1745 int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid, in snd_hda_ctl_add() argument
1754 if (nid == 0) in snd_hda_ctl_add()
1755 nid = get_amp_nid_(kctl->private_value); in snd_hda_ctl_add()
1757 if ((kctl->id.subdevice & HDA_SUBDEV_NID_FLAG) != 0 && nid == 0) in snd_hda_ctl_add()
1758 nid = kctl->id.subdevice & 0xffff; in snd_hda_ctl_add()
1768 item->nid = nid; in snd_hda_ctl_add()
1786 unsigned int index, hda_nid_t nid) in snd_hda_add_nid() argument
1790 if (nid > 0) { in snd_hda_add_nid()
1796 item->nid = nid; in snd_hda_add_nid()
2205 hda_nid_t nid = get_amp_nid(kcontrol); in snd_hda_mixer_amp_switch_get() local
2212 *valp++ = (snd_hda_codec_amp_read(codec, nid, 0, dir, idx) & in snd_hda_mixer_amp_switch_get()
2215 *valp = (snd_hda_codec_amp_read(codec, nid, 1, dir, idx) & in snd_hda_mixer_amp_switch_get()
2233 hda_nid_t nid = get_amp_nid(kcontrol); in snd_hda_mixer_amp_switch_put() local
2241 change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx, in snd_hda_mixer_amp_switch_put()
2247 change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, in snd_hda_mixer_amp_switch_put()
2250 hda_call_check_power_status(codec, nid); in snd_hda_mixer_amp_switch_put()
2550 static void set_dig_out(struct hda_codec *codec, hda_nid_t nid, in set_dig_out() argument
2555 snd_hdac_regmap_update(&codec->core, nid, AC_VERB_SET_DIGI_CONVERT_1, in set_dig_out()
2565 static inline void set_dig_out_convert(struct hda_codec *codec, hda_nid_t nid, in set_dig_out_convert() argument
2579 set_dig_out(codec, nid, mask, val); in set_dig_out_convert()
2588 hda_nid_t nid; in snd_hda_spdif_default_put() local
2594 nid = spdif->nid; in snd_hda_spdif_default_put()
2603 if (change && nid != (u16)-1) in snd_hda_spdif_default_put()
2604 set_dig_out_convert(codec, nid, val & 0xff, (val >> 8) & 0xff); in snd_hda_spdif_default_put()
2625 static inline void set_spdif_ctls(struct hda_codec *codec, hda_nid_t nid, in set_spdif_ctls() argument
2628 set_dig_out_convert(codec, nid, dig1, dig2); in set_spdif_ctls()
2630 if ((get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) && in set_spdif_ctls()
2632 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, in set_spdif_ctls()
2642 hda_nid_t nid; in snd_hda_spdif_out_switch_put() local
2648 nid = spdif->nid; in snd_hda_spdif_out_switch_put()
2654 if (change && nid != (u16)-1) in snd_hda_spdif_out_switch_put()
2655 set_spdif_ctls(codec, nid, val & 0xff, -1); in snd_hda_spdif_out_switch_put()
2752 spdif->nid = cvt_nid; in snd_hda_create_dig_out_ctls()
2769 hda_nid_t nid) in snd_hda_spdif_out_of_nid() argument
2775 if (spdif->nid == nid) in snd_hda_spdif_out_of_nid()
2795 spdif->nid = (u16)-1; in snd_hda_spdif_ctls_unassign()
2808 void snd_hda_spdif_ctls_assign(struct hda_codec *codec, int idx, hda_nid_t nid) in snd_hda_spdif_ctls_assign() argument
2815 if (spdif->nid != nid) { in snd_hda_spdif_ctls_assign()
2816 spdif->nid = nid; in snd_hda_spdif_ctls_assign()
2818 set_spdif_ctls(codec, nid, val & 0xff, (val >> 8) & 0xff); in snd_hda_spdif_ctls_assign()
2891 hda_nid_t nid = kcontrol->private_value; in snd_hda_spdif_in_switch_put() local
2899 snd_hdac_regmap_write(&codec->core, nid, in snd_hda_spdif_in_switch_put()
2910 hda_nid_t nid = kcontrol->private_value; in snd_hda_spdif_in_status_get() local
2914 snd_hdac_regmap_read(&codec->core, nid, in snd_hda_spdif_in_status_get()
2952 int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid) in snd_hda_create_spdif_in_ctls() argument
2968 kctl->private_value = nid; in snd_hda_create_spdif_in_ctls()
2969 err = snd_hda_ctl_add(codec, nid, kctl); in snd_hda_create_spdif_in_ctls()
2974 snd_hda_codec_read(codec, nid, 0, in snd_hda_create_spdif_in_ctls()
2994 hda_nid_t nid; in snd_hda_codec_set_power_to_all() local
2996 for_each_hda_codec_node(nid, codec) { in snd_hda_codec_set_power_to_all()
2997 unsigned int wcaps = get_wcaps(codec, nid); in snd_hda_codec_set_power_to_all()
3002 state = codec->power_filter(codec, nid, power_state); in snd_hda_codec_set_power_to_all()
3006 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, in snd_hda_codec_set_power_to_all()
3048 hda_nid_t nid, in snd_hda_codec_eapd_power_filter() argument
3051 if (nid == codec->core.afg || nid == codec->core.mfg) in snd_hda_codec_eapd_power_filter()
3054 get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_PIN && in snd_hda_codec_eapd_power_filter()
3055 (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)) { in snd_hda_codec_eapd_power_filter()
3056 int eapd = snd_hda_codec_read(codec, nid, 0, in snd_hda_codec_eapd_power_filter()
3113 hda_nid_t nid; in sync_power_up_states() local
3119 for_each_hda_codec_node(nid, codec) { in sync_power_up_states()
3120 unsigned int wcaps = get_wcaps(codec, nid); in sync_power_up_states()
3124 target = codec->power_filter(codec, nid, AC_PWRST_D0); in sync_power_up_states()
3127 if (!snd_hda_check_power_state(codec, nid, target)) in sync_power_up_states()
3128 snd_hda_codec_write(codec, nid, 0, in sync_power_up_states()
3422 static unsigned int query_pcm_param(struct hda_codec *codec, hda_nid_t nid) in query_pcm_param() argument
3425 if (nid != codec->core.afg && in query_pcm_param()
3426 (get_wcaps(codec, nid) & AC_WCAP_FORMAT_OVRD)) in query_pcm_param()
3427 val = snd_hda_param_read(codec, nid, AC_PAR_PCM); in query_pcm_param()
3435 static unsigned int query_stream_param(struct hda_codec *codec, hda_nid_t nid) in query_stream_param() argument
3437 unsigned int streams = snd_hda_param_read(codec, nid, AC_PAR_STREAM); in query_stream_param()
3458 int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid, in snd_hda_query_supported_pcm() argument
3463 wcaps = get_wcaps(codec, nid); in snd_hda_query_supported_pcm()
3464 val = query_pcm_param(codec, nid); in snd_hda_query_supported_pcm()
3475 nid, val, in snd_hda_query_supported_pcm()
3486 streams = query_stream_param(codec, nid); in snd_hda_query_supported_pcm()
3538 nid, val, in snd_hda_query_supported_pcm()
3563 int snd_hda_is_supported_format(struct hda_codec *codec, hda_nid_t nid, in snd_hda_is_supported_format() argument
3569 val = query_pcm_param(codec, nid); in snd_hda_is_supported_format()
3583 stream = query_stream_param(codec, nid); in snd_hda_is_supported_format()
3636 snd_hda_codec_setup_stream(codec, hinfo->nid, stream_tag, 0, format); in hda_pcm_default_prepare()
3644 snd_hda_codec_cleanup_stream(codec, hinfo->nid); in hda_pcm_default_cleanup()
3654 if (info->nid && (!info->rates || !info->formats)) { in set_pcm_default_values()
3655 err = snd_hda_query_supported_pcm(codec, info->nid, in set_pcm_default_values()
3667 if (snd_BUG_ON(!info->nid)) in set_pcm_default_values()
3672 if (snd_BUG_ON(!info->nid)) in set_pcm_default_values()
3960 hda_nid_t nid) in snd_hda_check_amp_list_power() argument
3967 for (p = check->amplist; p->nid; p++) { in snd_hda_check_amp_list_power()
3968 if (p->nid == nid) in snd_hda_check_amp_list_power()
3971 if (!p->nid) in snd_hda_check_amp_list_power()
3974 for (p = check->amplist; p->nid; p++) { in snd_hda_check_amp_list_power()
3976 v = snd_hda_codec_amp_read(codec, p->nid, ch, p->dir, in snd_hda_check_amp_list_power()
4034 hda_nid_t nid, in snd_hda_input_mux_put() argument
4046 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, in snd_hda_input_mux_put()
4086 static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, in setup_dig_out_stream() argument
4093 spdif = snd_hda_spdif_out_of_nid(codec, nid); in setup_dig_out_stream()
4094 curr_fmt = snd_hda_codec_read(codec, nid, 0, in setup_dig_out_stream()
4103 set_dig_out_convert(codec, nid, in setup_dig_out_stream()
4106 snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); in setup_dig_out_stream()
4115 set_dig_out_convert(codec, nid, in setup_dig_out_stream()
4119 static void cleanup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid) in cleanup_dig_out_stream() argument
4121 snd_hda_codec_cleanup_stream(codec, nid); in cleanup_dig_out_stream()