All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Henningsson <david.henningsson@canonical.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: ALSA Development Mailing List <alsa-devel@alsa-project.org>
Subject: Re: [PATCH] ALSA: HDA: Add jack detection for HDMI
Date: Thu, 19 May 2011 11:55:21 +0200	[thread overview]
Message-ID: <4DD4E909.80108@canonical.com> (raw)
In-Reply-To: <s5hfwod5nz0.wl%tiwai@suse.de>

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

On 2011-05-17 17:46, Takashi Iwai wrote:
> At Tue, 17 May 2011 15:46:43 +0200,
> David Henningsson wrote:
>>
>> 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.
>
> Did you test it with the actual machine, right?
> If it's working, I'm fine to add it.

To be honest; it's partially working, or rather it's working in the 
sense that it follows the eld proc file. It's also working in hda-emu.

I've tried it on one Nvidia (with binary drivers), and one Intel 
Graphics and well, and both seem to have the same problem essentially: 
There is no hotplug event coming in (through hdmi_unsol_event) when a 
monitor is removed. But with this patch in perhaps the graphics driver 
writers will feel more motivated to fix it? :-)

Note that the hotplug event is not coming in when you actually plug the 
cable but when you detect displays and/or apply the monitor 
configuration change.

I'm attaching a new version of the patch according to your preference, 
in hopes that it will be in 2.6.40.

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

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

>From 0be95828e59250af983c86b3ec49d1ea81d8ec82 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Thu, 19 May 2011 11:46:03 +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 |   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 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..7348296 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)
@@ -912,6 +915,7 @@ static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid,
 static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
 {
 	struct hdmi_spec *spec = codec->spec;
+	int err;
 
 	if (spec->num_pins >= MAX_HDMI_PINS) {
 		snd_printk(KERN_WARNING
@@ -919,6 +923,12 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
 		return -E2BIG;
 	}
 
+	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);
+
 	hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]);
 
 	spec->pin[spec->num_pins] = pin_nid;
@@ -1120,6 +1130,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: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2011-05-19  9:55 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DD4E909.80108@canonical.com \
    --to=david.henningsson@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.