summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_jack.c
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2012-10-09 15:04:21 +0200
committerTakashi Iwai <tiwai@suse.de>2012-10-15 09:58:28 +0200
commit26a6cb6cca225f652acf4bfac3028019be73dadd (patch)
tree883cf924a81b442d5dd9b9a375d6aa12968c1fa6 /sound/pci/hda/hda_jack.c
parent239fb862e8e26287212bdefabb021ef8c5ef1b53 (diff)
downloadtalos-op-linux-26a6cb6cca225f652acf4bfac3028019be73dadd.tar.gz
talos-op-linux-26a6cb6cca225f652acf4bfac3028019be73dadd.zip
ALSA: hda - Implement a poll loop for jacks as a module parameter
Now that we have a generic unsol mechanism, we can implement a generic poll loop, which can be used for debugging, or if a codec's unsol mechanism is broken. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_jack.c')
-rw-r--r--sound/pci/hda/hda_jack.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c
index 5c690cb873d4..07d5288ce8cf 100644
--- a/sound/pci/hda/hda_jack.c
+++ b/sound/pci/hda/hda_jack.c
@@ -439,3 +439,25 @@ void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res)
}
EXPORT_SYMBOL_HDA(snd_hda_jack_unsol_event);
+void snd_hda_jack_poll_all(struct hda_codec *codec)
+{
+ struct hda_jack_tbl *jack = codec->jacktbl.list;
+ int i, changes = 0;
+
+ for (i = 0; i < codec->jacktbl.used; i++, jack++) {
+ unsigned int old_sense;
+ if (!jack->nid || !jack->jack_dirty || jack->phantom_jack)
+ continue;
+ old_sense = get_jack_plug_state(jack->pin_sense);
+ jack_detect_update(codec, jack);
+ if (old_sense == get_jack_plug_state(jack->pin_sense))
+ continue;
+ changes = 1;
+ if (jack->callback)
+ jack->callback(codec, jack);
+ }
+ if (changes)
+ snd_hda_jack_report_sync(codec);
+}
+EXPORT_SYMBOL_HDA(snd_hda_jack_poll_all);
+
OpenPOWER on IntegriCloud