aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_jack.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-09-11 15:22:46 +0200
committerTakashi Iwai <tiwai@suse.de>2014-09-16 17:23:44 +0200
commit1a4f69d5aaecb39a980fc20b14ec800fd5b53061 (patch)
treef0fad4d91cbee4fa3436b53c16a5e436cc381550 /sound/pci/hda/hda_jack.h
parentALSA: hda - Make snd_hda_jack_detect_enable_callback() returning the jack object (diff)
downloadlinux-dev-1a4f69d5aaecb39a980fc20b14ec800fd5b53061.tar.xz
linux-dev-1a4f69d5aaecb39a980fc20b14ec800fd5b53061.zip
ALSA: hda - Allow multiple callbacks for jack
So far, hda_jack infrastructure allows only one callback per jack, and this makes things slightly complicated when a driver wants to assign multiple tasks to a jack, e.g. the standard auto-mute with a power up/down sequence. This can be simplified if the hda_jack accepts multiple callbacks. This patch is such an extension: the callback-specific part (the function and private_data) is split to another struct from hda_jack_tbl, and multiple such objects can be assigned to a single hda_jack_tbl entry. The new struct hda_jack_callback is passed to each callback function now, thus the patch became bigger than expected. But these changes are mostly trivial. 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.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h
index 668669ce3e52..b41e0a3ea1fb 100644
--- a/sound/pci/hda/hda_jack.h
+++ b/sound/pci/hda/hda_jack.h
@@ -14,14 +14,21 @@
struct auto_pin_cfg;
struct hda_jack_tbl;
+struct hda_jack_callback;
-typedef void (*hda_jack_callback) (struct hda_codec *, struct hda_jack_tbl *);
+typedef void (*hda_jack_callback_fn) (struct hda_codec *, struct hda_jack_callback *);
+
+struct hda_jack_callback {
+ struct hda_jack_tbl *tbl;
+ hda_jack_callback_fn func;
+ unsigned int private_data; /* arbitrary data */
+ struct hda_jack_callback *next;
+};
struct hda_jack_tbl {
hda_nid_t nid;
unsigned char tag; /* unsol event tag */
- unsigned int private_data; /* arbitrary data */
- hda_jack_callback callback;
+ struct hda_jack_callback *callback;
/* jack-detection stuff */
unsigned int pin_sense; /* cached pin-sense value */
unsigned int jack_detect:1; /* capable of jack-detection? */
@@ -47,9 +54,9 @@ void snd_hda_jack_tbl_clear(struct hda_codec *codec);
void snd_hda_jack_set_dirty_all(struct hda_codec *codec);
int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid);
-struct hda_jack_tbl *
+struct hda_jack_callback *
snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid,
- hda_jack_callback cb);
+ hda_jack_callback_fn cb);
int snd_hda_jack_set_gating_jack(struct hda_codec *codec, hda_nid_t gated_nid,
hda_nid_t gating_nid);