summaryrefslogtreecommitdiff
path: root/sound/pci/hda/hda_jack.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-10-28 01:16:55 +0200
committerTakashi Iwai <tiwai@suse.de>2011-11-16 11:14:03 +0100
commit3a93897ea37cbb8277f8a4232c12c0c18168a7db (patch)
tree1c79df3bb270e86c61bdb13fab0bf66cbd3682ac /sound/pci/hda/hda_jack.h
parent01a61e12b4602c82bde9797d0e153f3e53c95b04 (diff)
ALSA: hda - Manage unsol tags in hda_jack.c
Manage the tags assigned for unsolicited events dynamically together with the jack-detection routines. Basically this is almost same as what we've done in patch_sigmatel.c. Assign the new tag number for each new unsol event, associate with the given NID and the action type, etc. With this change, now all pins looked over in snd_hda_jack_add_kctls() are actually enabled for detection now even if the pins aren't used for jack-retasking by the driver. 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.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h
index b5983eaea51e..69a67f8e4f45 100644
--- a/sound/pci/hda/hda_jack.h
+++ b/sound/pci/hda/hda_jack.h
@@ -14,8 +14,12 @@
struct hda_jack_tbl {
hda_nid_t nid;
+ unsigned char action; /* event action (0 = none) */
+ unsigned char tag; /* unsol event tag */
+ unsigned int private_data; /* arbitrary data */
+ /* jack-detection stuff */
unsigned int pin_sense; /* cached pin-sense value */
- unsigned int jack_cachable:1; /* can be updated via unsol events */
+ unsigned int jack_detect:1; /* capable of jack-detection? */
unsigned int jack_dirty:1; /* needs to update? */
unsigned int need_notify:1; /* to be notified? */
struct snd_kcontrol *kctl; /* assigned kctl for jack-detection */
@@ -23,29 +27,34 @@ struct hda_jack_tbl {
struct hda_jack_tbl *
snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid);
+struct hda_jack_tbl *
+snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec, unsigned char tag);
struct hda_jack_tbl *
snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid);
void snd_hda_jack_tbl_clear(struct hda_codec *codec);
/**
- * snd_hda_jack_set_dirty - set the dirty flag for the given jack-entry
+ * snd_hda_jack_get_action - get jack-tbl entry for the tag
*
- * Call this function when a pin-state may change, e.g. when the hardware
- * notifies via an unsolicited event.
+ * Call this from the unsol event handler to get the assigned action for the
+ * event. This will mark the dirty flag for the later reporting, too.
*/
-static inline void snd_hda_jack_set_dirty(struct hda_codec *codec,
- hda_nid_t nid)
+static inline unsigned char
+snd_hda_jack_get_action(struct hda_codec *codec, unsigned int tag)
{
- struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid);
- if (jack)
+ struct hda_jack_tbl *jack = snd_hda_jack_tbl_get_from_tag(codec, tag);
+ if (jack) {
jack->jack_dirty = 1;
+ return jack->action;
+ }
+ return 0;
}
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,
- unsigned int tag);
+ unsigned char action);
u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid);
int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid);
@@ -68,7 +77,6 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
int snd_hda_jack_add_kctls(struct hda_codec *codec,
const struct auto_pin_cfg *cfg);
-void snd_hda_jack_report(struct hda_codec *codec, hda_nid_t nid);
void snd_hda_jack_report_sync(struct hda_codec *codec);