This source file includes following definitions.
- snd_hda_jack_detect
1
2
3
4
5
6
7
8 #ifndef __SOUND_HDA_JACK_H
9 #define __SOUND_HDA_JACK_H
10
11 #include <linux/err.h>
12 #include <sound/jack.h>
13
14 struct auto_pin_cfg;
15 struct hda_jack_tbl;
16 struct hda_jack_callback;
17
18 typedef void (*hda_jack_callback_fn) (struct hda_codec *, struct hda_jack_callback *);
19
20 struct hda_jack_callback {
21 hda_nid_t nid;
22 hda_jack_callback_fn func;
23 unsigned int private_data;
24 unsigned int unsol_res;
25 struct hda_jack_tbl *jack;
26 struct hda_jack_callback *next;
27 };
28
29 struct hda_jack_tbl {
30 hda_nid_t nid;
31 unsigned char tag;
32 struct hda_jack_callback *callback;
33
34 unsigned int pin_sense;
35 unsigned int jack_detect:1;
36 unsigned int jack_dirty:1;
37 unsigned int phantom_jack:1;
38 unsigned int block_report:1;
39 hda_nid_t gating_jack;
40 hda_nid_t gated_jack;
41 int type;
42 int button_state;
43 struct snd_jack *jack;
44 };
45
46 struct hda_jack_keymap {
47 enum snd_jack_types type;
48 int key;
49 };
50
51 struct hda_jack_tbl *
52 snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid);
53 struct hda_jack_tbl *
54 snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec, unsigned char tag);
55
56 void snd_hda_jack_tbl_clear(struct hda_codec *codec);
57
58 void snd_hda_jack_set_dirty_all(struct hda_codec *codec);
59
60 int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid);
61 struct hda_jack_callback *
62 snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid,
63 hda_jack_callback_fn cb);
64
65 int snd_hda_jack_set_gating_jack(struct hda_codec *codec, hda_nid_t gated_nid,
66 hda_nid_t gating_nid);
67
68 u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid);
69
70
71 enum {
72 HDA_JACK_NOT_PRESENT, HDA_JACK_PRESENT, HDA_JACK_PHANTOM,
73 };
74
75 int snd_hda_jack_detect_state(struct hda_codec *codec, hda_nid_t nid);
76
77
78
79
80
81
82 static inline bool snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid)
83 {
84 return snd_hda_jack_detect_state(codec, nid) != HDA_JACK_NOT_PRESENT;
85 }
86
87 bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid);
88
89 int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
90 const char *name, bool phantom_jack,
91 int type, const struct hda_jack_keymap *keymap);
92 int snd_hda_jack_add_kctls(struct hda_codec *codec,
93 const struct auto_pin_cfg *cfg);
94
95 void snd_hda_jack_report_sync(struct hda_codec *codec);
96
97 void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res);
98
99 void snd_hda_jack_poll_all(struct hda_codec *codec);
100
101 #endif