Lines Matching refs:nid
23 bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) in is_jack_detectable() argument
27 if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT)) in is_jack_detectable()
29 if (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) & in is_jack_detectable()
32 if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) && in is_jack_detectable()
40 static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid) in read_pin_sense() argument
46 pincap = snd_hda_query_pin_caps(codec, nid); in read_pin_sense()
48 snd_hda_codec_read(codec, nid, 0, in read_pin_sense()
51 val = snd_hda_codec_read(codec, nid, 0, in read_pin_sense()
62 snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid) in snd_hda_jack_tbl_get() argument
67 if (!nid || !jack) in snd_hda_jack_tbl_get()
70 if (jack->nid == nid) in snd_hda_jack_tbl_get()
98 snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid) in snd_hda_jack_tbl_new() argument
100 struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); in snd_hda_jack_tbl_new()
106 jack->nid = nid; in snd_hda_jack_tbl_new()
144 jack->pin_sense = read_pin_sense(codec, jack->nid); in jack_detect_update()
175 if (jack->nid) in snd_hda_jack_set_dirty_all()
188 u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) in snd_hda_pin_sense() argument
190 struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); in snd_hda_pin_sense()
195 return read_pin_sense(codec, nid); in snd_hda_pin_sense()
207 int snd_hda_jack_detect_state(struct hda_codec *codec, hda_nid_t nid) in snd_hda_jack_detect_state() argument
209 struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); in snd_hda_jack_detect_state()
212 else if (snd_hda_pin_sense(codec, nid) & AC_PINSENSE_PRESENCE) in snd_hda_jack_detect_state()
227 snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid, in snd_hda_jack_detect_enable_callback() argument
234 jack = snd_hda_jack_tbl_new(codec, nid); in snd_hda_jack_detect_enable_callback()
252 err = snd_hda_codec_write_cache(codec, nid, 0, in snd_hda_jack_detect_enable_callback()
261 int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid) in snd_hda_jack_detect_enable() argument
263 return PTR_ERR_OR_ZERO(snd_hda_jack_detect_enable_callback(codec, nid, NULL)); in snd_hda_jack_detect_enable()
299 if (jack->nid) in snd_hda_jack_report_sync()
307 if (jack->nid) { in snd_hda_jack_report_sync()
323 static int get_input_jack_type(struct hda_codec *codec, hda_nid_t nid) in get_input_jack_type() argument
325 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); in get_input_jack_type()
345 jacks->nid = 0; in hda_free_jack_priv()
356 static int __snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, in __snd_hda_jack_add_kctl() argument
363 jack = snd_hda_jack_tbl_new(codec, nid); in __snd_hda_jack_add_kctl()
371 err = snd_hda_ctl_add(codec, nid, kctl); in __snd_hda_jack_add_kctl()
377 state = snd_hda_jack_detect(codec, nid); in __snd_hda_jack_add_kctl()
381 jack->type = get_input_jack_type(codec, nid); in __snd_hda_jack_add_kctl()
394 int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid, in snd_hda_jack_add_kctl() argument
397 return __snd_hda_jack_add_kctl(codec, nid, name, idx, false); in snd_hda_jack_add_kctl()
421 static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid, in add_jack_kctl() argument
430 if (!nid) in add_jack_kctl()
432 def_conf = snd_hda_codec_get_pincfg(codec, nid); in add_jack_kctl()
437 !is_jack_detectable(codec, nid); in add_jack_kctl()
443 snd_hda_get_pin_label(codec, nid, cfg, name, sizeof(name), &idx); in add_jack_kctl()
448 err = __snd_hda_jack_add_kctl(codec, nid, name, idx, phantom_jack); in add_jack_kctl()
453 return snd_hda_jack_detect_enable(codec, nid); in add_jack_kctl()
556 if (!jack->nid || !jack->jack_dirty || jack->phantom_jack) in snd_hda_jack_poll_all()