All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: HDA: Add jack detection for HDMI
@ 2011-05-17 13:46 David Henningsson
  2011-05-17 15:46 ` Takashi Iwai
                   ` (3 more replies)
  0 siblings, 4 replies; 34+ messages in thread
From: David Henningsson @ 2011-05-17 13:46 UTC (permalink / raw)
  To: ALSA Development Mailing List, Takashi Iwai

[-- Attachment #1: Type: text/plain, Size: 472 bytes --]

Just as for headphones and microphone jacks, this patch adds reporting
of HDMI jack status through the input layer.

I considered making additional SND_JACK_* constants for HDMI and 
Displayport instead of going with SND_JACK_VIDEOOUT, but it didn't seem 
worth the additions, and breakage of compiling with old kernels, etc. 
Let me know if you think otherwise and I'll prepare a second patch for 
that.

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

[-- Attachment #2: 0001-ALSA-HDA-Add-jack-detection-for-HDMI.patch --]
[-- Type: text/x-patch, Size: 2297 bytes --]

>From d47239ae3d352b898649d0c15869dedd032ccbd7 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Tue, 17 May 2011 15:39:19 +0200
Subject: [PATCH] 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>
---
 sound/pci/hda/hda_codec.c  |    2 ++
 sound/pci/hda/patch_hdmi.c |   15 +++++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index c63f376..8edd998 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,
 		return "Line-out";
 	case SND_JACK_HEADSET:
 		return "Headset";
+	case SND_JACK_VIDEOOUT:
+		return "HDMI/DP";
 	default:
 		return "Misc";
 	}
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 6eb209d..16c1505 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -33,6 +33,7 @@
 #include <linux/slab.h>
 #include <linux/moduleparam.h>
 #include <sound/core.h>
+#include <sound/jack.h>
 #include "hda_codec.h"
 #include "hda_local.h"
 
@@ -720,6 +721,8 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
 				  &spec->sink_eld[index]);
 		/* TODO: do real things about ELD */
 	}
+
+	snd_hda_input_jack_report(codec, tag);
 }
 
 static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res)
@@ -919,6 +922,17 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
 		return -E2BIG;
 	}
 
+#ifdef CONFIG_SND_HDA_INPUT_JACK
+	{
+		int err;
+		err = snd_hda_input_jack_add(codec, pin_nid,
+					     SND_JACK_VIDEOOUT, NULL);
+		if (err < 0)
+			return err;
+		snd_hda_input_jack_report(codec, pin_nid);
+	}
+#endif
+
 	hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]);
 
 	spec->pin[spec->num_pins] = pin_nid;
@@ -1120,6 +1134,7 @@ static void generic_hdmi_free(struct hda_codec *codec)
 
 	for (i = 0; i < spec->num_pins; i++)
 		snd_hda_eld_proc_free(codec, &spec->sink_eld[i]);
+	snd_hda_input_jack_free(codec);
 
 	kfree(spec);
 }
-- 
1.7.4.1


[-- Attachment #3: 0001-hda-emu-update-jack.h-to-match-latest-kernel-version.patch --]
[-- Type: text/x-patch, Size: 887 bytes --]

>From cdc4030a2028efdd1c36f2dc37402ea6971e1b12 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Tue, 17 May 2011 15:43:01 +0200
Subject: [PATCH] hda-emu: update jack.h to match latest kernel version

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 include/sound/jack.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/include/sound/jack.h b/include/sound/jack.h
index 77247d0..a6a4f21 100644
--- a/include/sound/jack.h
+++ b/include/sound/jack.h
@@ -12,6 +12,9 @@ enum snd_jack_types {
 	SND_JACK_MICROPHONE	= 0x0002,
 	SND_JACK_HEADSET	= SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
 	SND_JACK_LINEOUT	= 0x0004,
+	SND_JACK_MECHANICAL	= 0x0008, /* If detected separately */
+	SND_JACK_VIDEOOUT	= 0x0010,
+	SND_JACK_AVOUT		= SND_JACK_LINEOUT | SND_JACK_VIDEOOUT,
 };
 
 struct snd_jack {
-- 
1.7.4.1


[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2011-06-09 20:59 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-17 13:46 [PATCH] ALSA: HDA: Add jack detection for HDMI David Henningsson
2011-05-17 15:46 ` Takashi Iwai
2011-05-19  9:55   ` David Henningsson
2011-05-19 10:06     ` Takashi Iwai
2011-05-19 10:24       ` Setting invalid samplerate Torsten Schenk
2011-05-19 10:32         ` Torsten Schenk
2011-05-19 10:55         ` Clemens Ladisch
2011-05-19 11:28           ` Torsten Schenk
2011-05-19 11:36             ` Daniel Mack
2011-05-23 21:49       ` [PATCH] ALSA: HDA: Add jack detection for HDMI Stephen Warren
2011-05-24  5:39         ` Takashi Iwai
2011-05-24 17:27           ` Stephen Warren
2011-05-24 18:09             ` Takashi Iwai
2011-05-24 19:18               ` Stephen Warren
2011-05-24 21:00           ` Stephen Warren
2011-05-19 16:57     ` Stephen Warren
2011-05-19 22:45       ` David Henningsson
2011-05-19 22:51         ` Stephen Warren
2011-06-09 20:59           ` Stephen Warren
2011-05-17 16:00 ` Stephen Warren
2011-05-17 16:08   ` Takashi Iwai
2011-05-17 17:09     ` pl bossart
2011-05-17 17:31       ` Takashi Iwai
2011-05-17 20:51         ` pl bossart
2011-05-17 21:42           ` Stephen Warren
2011-05-17 22:11             ` pl bossart
2011-05-17 23:14               ` Stephen Warren
2011-05-18 15:43         ` pl bossart
2011-05-18 15:49           ` Takashi Iwai
2011-05-18 10:02 ` Takashi Iwai
2011-05-20 21:59 ` Stephen Warren
2011-05-21  6:25   ` David Henningsson
2011-05-21  7:37     ` Takashi Iwai
2011-05-23 15:29     ` Stephen Warren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.