13 #include <linux/slab.h>
14 #include <linux/export.h>
64 for (i = 0; i < codec->
jacktbl.used; i++, jack++)
82 for (i = 0; i < codec->
jacktbl.used; i++, jack++)
98 snd_array_init(&codec->
jacktbl,
sizeof(*jack), 16);
111 #ifdef CONFIG_SND_HDA_INPUT_JACK
113 if (!codec->
bus->shutdown && codec->
jacktbl.list) {
116 for (i = 0; i < codec->
jacktbl.used; i++, jack++) {
126 static void jack_detect_update(
struct hda_codec *codec,
151 for (i = 0; i < codec->
jacktbl.used; i++, jack++)
169 jack_detect_update(codec, jack);
172 return read_pin_sense(codec, nid);
176 #define get_jack_plug_state(sense) !!(sense & AC_PINSENSE_PRESENCE)
230 for (i = 0; i < codec->
jacktbl.used; i++, jack++)
232 jack_detect_update(codec, jack);
237 #ifdef CONFIG_SND_HDA_INPUT_JACK
240 state ? jack->type : 0);
246 #ifdef CONFIG_SND_HDA_INPUT_JACK
267 static void hda_free_jack_priv(
struct snd_jack *jack)
304 #ifdef CONFIG_SND_HDA_INPUT_JACK
306 jack->type = get_input_jack_type(codec, nid);
312 jack->jack->private_free = hda_free_jack_priv;
320 const char *name,
int idx)
322 return __snd_hda_jack_add_kctl(codec, nid, name, idx,
false);
327 static int get_unique_index(
struct hda_codec *codec,
const char *name,
int idx)
333 for (i = 0; i < codec->
jacktbl.used; i++, jack++) {
337 !
strcmp(
" Jack", jack->
kctl->id.name + len) &&
338 jack->
kctl->id.index == idx) {
349 unsigned int def_conf, conn;
367 idx = get_unique_index(codec, name, idx);
368 err = __snd_hda_jack_add_kctl(codec, nid, name, idx, phantom_jack);
386 for (i = 0, p = cfg->
line_out_pins; i < cfg->line_outs; i++, p++) {
387 err = add_jack_kctl(codec, *p, cfg);
391 for (i = 0, p = cfg->
hp_pins; i < cfg->hp_outs; i++, p++) {
394 err = add_jack_kctl(codec, *p, cfg);
398 for (i = 0, p = cfg->
speaker_pins; i < cfg->speaker_outs; i++, p++) {
401 err = add_jack_kctl(codec, *p, cfg);
406 err = add_jack_kctl(codec, cfg->
inputs[i].pin, cfg);
410 for (i = 0, p = cfg->
dig_out_pins; i < cfg->dig_outs; i++, p++) {
411 err = add_jack_kctl(codec, *p, cfg);
415 err = add_jack_kctl(codec, cfg->
dig_in_pin, cfg);
433 event->jack_dirty = 1;
436 event->callback(codec, event);