aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_jack.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2018-11-28 14:25:37 +0100
committerTakashi Iwai <tiwai@suse.de>2018-12-07 11:42:36 +0100
commit911761c2304327a39ec9372be812a9648bd35c09 (patch)
tree5d34e83238f7a829c787ce84921c5739cb69f04e /sound/pci/hda/hda_jack.h
parentALSA: hda - Add jack pointer and unsolicited event bits to callback (diff)
downloadlinux-dev-911761c2304327a39ec9372be812a9648bd35c09.tar.xz
linux-dev-911761c2304327a39ec9372be812a9648bd35c09.zip
ALSA: hda - Add jack button support
Extend some structs to add the support for jack button changes. Now snd_hda_jack_add_kctl() receives two more arguments: the jack type and the jack keymaps. Both are optional, and when zero are passed, the function behaves just like before. For reporting button state changes, you'd need to update jack->button_state bits accordingly, typically in the jack callback. Then the value OR'ed with button_state and the jack plug state is passed to snd_jack_report(). Note that currently the code assumes only the one-shot button events, i.e. it tries to send the button release soon after sending the button event. If a driver really supports the button release handling by itself, we may need to introduce some flag to control this behavior in future. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_jack.h')
-rw-r--r--sound/pci/hda/hda_jack.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h
index 695a652cc6b3..1d713201c160 100644
--- a/sound/pci/hda/hda_jack.h
+++ b/sound/pci/hda/hda_jack.h
@@ -13,6 +13,7 @@
#define __SOUND_HDA_JACK_H
#include <linux/err.h>
+#include <sound/jack.h>
struct auto_pin_cfg;
struct hda_jack_tbl;
@@ -42,9 +43,15 @@ struct hda_jack_tbl {
hda_nid_t gating_jack; /* valid when gating jack plugged */
hda_nid_t gated_jack; /* gated is dependent on this jack */
int type;
+ int button_state;
struct snd_jack *jack;
};
+struct hda_jack_keymap {
+ enum snd_jack_types type;
+ int key;
+};
+
struct hda_jack_tbl *
snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid);
struct hda_jack_tbl *
@@ -84,7 +91,8 @@ static inline bool snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid)
bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid);
int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
- const char *name, bool phantom_jack);
+ const char *name, bool phantom_jack,
+ int type, const struct hda_jack_keymap *keymap);
int snd_hda_jack_add_kctls(struct hda_codec *codec,
const struct auto_pin_cfg *cfg);