From 0619ba8c17b121ef0273be181198659b17d84247 Mon Sep 17 00:00:00 2001 From: Dylan Reid Date: Mon, 19 Nov 2012 19:48:07 +0100 Subject: ALSA: hda - Allow jack state to depend on another jack Introduce the concept of a "gated" jack. The gated jack's pin sense is only valid when the "gating" jack is plugged. This requires checking the gating jack when the gated jack changes and re-checking the gated jack when the gating jack is plugged/unplugged. This allows handling of devices where the mic jack detect floats when the headphone jack is unplugged. [Rewritten for fixing the possible snd_array reallocation, covering the missing callback calls and jack sync operations, as well as some code cleanups -- tiwai] Signed-off-by: Dylan Reid Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_jack.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sound/pci/hda/hda_jack.h') diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h index 4487785adf34..ec12abd45263 100644 --- a/sound/pci/hda/hda_jack.h +++ b/sound/pci/hda/hda_jack.h @@ -28,6 +28,8 @@ struct hda_jack_tbl { unsigned int jack_detect:1; /* capable of jack-detection? */ unsigned int jack_dirty:1; /* needs to update? */ unsigned int phantom_jack:1; /* a fixed, always present port? */ + hda_nid_t gating_jack; /* valid when gating jack plugged */ + hda_nid_t gated_jack; /* gated is dependent on this jack */ struct snd_kcontrol *kctl; /* assigned kctl for jack-detection */ #ifdef CONFIG_SND_HDA_INPUT_JACK int type; @@ -69,6 +71,8 @@ int snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid, unsigned char action, hda_jack_callback cb); +int snd_hda_jack_set_gating_jack(struct hda_codec *codec, hda_nid_t gated_nid, + hda_nid_t gating_nid); 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); -- cgit v1.2.3-59-g8ed1b