diff options
author | Matthew Ranostay <mranostay@embeddedalley.com> | 2008-10-15 14:45:38 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-10-16 02:43:24 -0400 |
commit | 45a6ac16c2136e4b902b09bf0b6192b940e8d732 (patch) | |
tree | 935d09d62508c81b9f80e1e5de42839e1cbfa314 /sound/pci/hda/patch_sigmatel.c | |
parent | ec4e86ba0662ed85f3b3a38fb220dc51d951da84 (diff) |
ALSA: hda: add support for jack detection on IDT/Sigmatel
Added support for jack detection reporting to userspace for
IDT/Sigmatel codecs.
Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index a2ac7205d45d..ec88ba881482 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/pci.h> | 30 | #include <linux/pci.h> |
31 | #include <sound/core.h> | 31 | #include <sound/core.h> |
32 | #include <sound/asoundef.h> | 32 | #include <sound/asoundef.h> |
33 | #include <sound/jack.h> | ||
33 | #include "hda_codec.h" | 34 | #include "hda_codec.h" |
34 | #include "hda_local.h" | 35 | #include "hda_local.h" |
35 | #include "hda_patch.h" | 36 | #include "hda_patch.h" |
@@ -216,6 +217,9 @@ struct sigmatel_spec { | |||
216 | 217 | ||
217 | struct hda_pcm pcm_rec[2]; /* PCM information */ | 218 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
218 | 219 | ||
220 | /* jack detection */ | ||
221 | struct snd_jack *jack; | ||
222 | |||
219 | /* dynamic controls and input_mux */ | 223 | /* dynamic controls and input_mux */ |
220 | struct auto_pin_cfg autocfg; | 224 | struct auto_pin_cfg autocfg; |
221 | unsigned int num_kctl_alloc, num_kctl_used; | 225 | unsigned int num_kctl_alloc, num_kctl_used; |
@@ -3617,7 +3621,7 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3617 | { | 3621 | { |
3618 | struct sigmatel_spec *spec = codec->spec; | 3622 | struct sigmatel_spec *spec = codec->spec; |
3619 | struct auto_pin_cfg *cfg = &spec->autocfg; | 3623 | struct auto_pin_cfg *cfg = &spec->autocfg; |
3620 | int i; | 3624 | int i, err; |
3621 | 3625 | ||
3622 | snd_hda_sequence_write(codec, spec->init); | 3626 | snd_hda_sequence_write(codec, spec->init); |
3623 | 3627 | ||
@@ -3639,6 +3643,12 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3639 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], | 3643 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], |
3640 | AC_PINCTL_OUT_EN); | 3644 | AC_PINCTL_OUT_EN); |
3641 | stac92xx_auto_init_hp_out(codec); | 3645 | stac92xx_auto_init_hp_out(codec); |
3646 | /* jack detection */ | ||
3647 | err = snd_jack_new(codec->bus->card, | ||
3648 | "Headphone Jack", | ||
3649 | SND_JACK_HEADPHONE, &spec->jack); | ||
3650 | if (err < 0) | ||
3651 | return err; | ||
3642 | /* fake event to set up pins */ | 3652 | /* fake event to set up pins */ |
3643 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); | 3653 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); |
3644 | } else { | 3654 | } else { |
@@ -3796,6 +3806,8 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) | |||
3796 | break; | 3806 | break; |
3797 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); | 3807 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); |
3798 | } | 3808 | } |
3809 | snd_jack_report(spec->jack, | ||
3810 | presence ? SND_JACK_HEADPHONE : 0); | ||
3799 | 3811 | ||
3800 | if (presence) { | 3812 | if (presence) { |
3801 | /* disable lineouts, enable hp */ | 3813 | /* disable lineouts, enable hp */ |