diff options
author | David Henningsson <david.henningsson@canonical.com> | 2011-05-19 05:46:03 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-05-19 06:00:50 -0400 |
commit | 07acecc11139efbc8d0401576e81dc8c188cb092 (patch) | |
tree | 42c715f830606ef6698da60cea42733cc013e2ee /sound | |
parent | b896b4ebf0c136b51b184ea9f39247701e332005 (diff) |
ALSA: HDA: Add jack detection for HDMI
Just as for headphones and microphone jacks, this patch adds reporting
of HDMI jack status through the input layer.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_hdmi.c | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index c63f376ba9ab..8edd998509f7 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -5055,6 +5055,8 @@ static const char *get_jack_default_name(struct hda_codec *codec, hda_nid_t nid, | |||
5055 | return "Line-out"; | 5055 | return "Line-out"; |
5056 | case SND_JACK_HEADSET: | 5056 | case SND_JACK_HEADSET: |
5057 | return "Headset"; | 5057 | return "Headset"; |
5058 | case SND_JACK_VIDEOOUT: | ||
5059 | return "HDMI/DP"; | ||
5058 | default: | 5060 | default: |
5059 | return "Misc"; | 5061 | return "Misc"; |
5060 | } | 5062 | } |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 6eb209d4b5b9..7348296985fc 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/moduleparam.h> | 34 | #include <linux/moduleparam.h> |
35 | #include <sound/core.h> | 35 | #include <sound/core.h> |
36 | #include <sound/jack.h> | ||
36 | #include "hda_codec.h" | 37 | #include "hda_codec.h" |
37 | #include "hda_local.h" | 38 | #include "hda_local.h" |
38 | 39 | ||
@@ -720,6 +721,8 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) | |||
720 | &spec->sink_eld[index]); | 721 | &spec->sink_eld[index]); |
721 | /* TODO: do real things about ELD */ | 722 | /* TODO: do real things about ELD */ |
722 | } | 723 | } |
724 | |||
725 | snd_hda_input_jack_report(codec, tag); | ||
723 | } | 726 | } |
724 | 727 | ||
725 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) | 728 | static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) |
@@ -912,6 +915,7 @@ static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid, | |||
912 | static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | 915 | static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) |
913 | { | 916 | { |
914 | struct hdmi_spec *spec = codec->spec; | 917 | struct hdmi_spec *spec = codec->spec; |
918 | int err; | ||
915 | 919 | ||
916 | if (spec->num_pins >= MAX_HDMI_PINS) { | 920 | if (spec->num_pins >= MAX_HDMI_PINS) { |
917 | snd_printk(KERN_WARNING | 921 | snd_printk(KERN_WARNING |
@@ -919,6 +923,12 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) | |||
919 | return -E2BIG; | 923 | return -E2BIG; |
920 | } | 924 | } |
921 | 925 | ||
926 | err = snd_hda_input_jack_add(codec, pin_nid, | ||
927 | SND_JACK_VIDEOOUT, NULL); | ||
928 | if (err < 0) | ||
929 | return err; | ||
930 | snd_hda_input_jack_report(codec, pin_nid); | ||
931 | |||
922 | hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]); | 932 | hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]); |
923 | 933 | ||
924 | spec->pin[spec->num_pins] = pin_nid; | 934 | spec->pin[spec->num_pins] = pin_nid; |
@@ -1120,6 +1130,7 @@ static void generic_hdmi_free(struct hda_codec *codec) | |||
1120 | 1130 | ||
1121 | for (i = 0; i < spec->num_pins; i++) | 1131 | for (i = 0; i < spec->num_pins; i++) |
1122 | snd_hda_eld_proc_free(codec, &spec->sink_eld[i]); | 1132 | snd_hda_eld_proc_free(codec, &spec->sink_eld[i]); |
1133 | snd_hda_input_jack_free(codec); | ||
1123 | 1134 | ||
1124 | kfree(spec); | 1135 | kfree(spec); |
1125 | } | 1136 | } |