All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: hdmi: Hint matching between input devices and pcm devices
@ 2011-09-21  7:18 David Henningsson
  2011-09-21  8:31 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: David Henningsson @ 2011-09-21  7:18 UTC (permalink / raw)
  To: Takashi Iwai, ALSA Development Mailing List

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

Hi Takashi,

You went on vacation when this patch was posted and discussed, but would 
you mind reviewing/committing this patch now that you're back?

It was reviewed by Stephen Warren who thought the patch was okay, but 
had some thoughts on doing other changes to the format of that string at 
the same time [1].

I had to distro patch a 3.0 adapted version of this patch into Ubuntu in 
order to meet the Ubuntu 11.10 kernel deadline, so for that reason I'd 
say that the ",pcm=x" format would be preferrable for me, and while I 
don't mind further improvements to the string format in the future, this 
would be a step in the right direction and IMO this patch should not 
block on such future improvements.

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

[1] 
http://mailman.alsa-project.org/pipermail/alsa-devel/2011-August/043258.html

[-- Attachment #2: 0001-ALSA-hda-hdmi-Hint-matching-between-input-devices-an.patch --]
[-- Type: text/x-patch, Size: 2419 bytes --]

>From ab5ef7898ca0a6e86401428a3ca77f05db9eb7c9 Mon Sep 17 00:00:00 2001
From: David Henningsson <david.henningsson@canonical.com>
Date: Tue, 23 Aug 2011 16:56:03 +0200
Subject: [PATCH] ALSA: hda: hdmi: Hint matching between input devices and pcm devices

Since modern HDMI cards often have more than one output pin and thus
input device, we need to know which one has actually been plugged in.

This patch adds a name hint that indicates which PCM device is connected 
to which pin.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
---
 sound/pci/hda/patch_hdmi.c |   31 ++++++++++++++++++++++++-------
 1 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 19cb72d..8c83ec4 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -967,19 +967,12 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
 
 	per_pin->pin_nid = pin_nid;
 
-	err = snd_hda_input_jack_add(codec, pin_nid,
-				     SND_JACK_VIDEOOUT, NULL);
-	if (err < 0)
-		return err;
-
 	err = hdmi_read_pin_conn(codec, pin_idx);
 	if (err < 0)
 		return err;
 
 	spec->num_pins++;
 
-	hdmi_present_sense(codec, pin_nid, eld);
-
 	return 0;
 }
 
@@ -1162,6 +1155,25 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec)
 	return 0;
 }
 
+static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx)
+{
+	int err;
+	char hdmi_str[32];
+	struct hdmi_spec *spec = codec->spec;
+	struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx];
+	int pcmdev = spec->pcm_rec[pin_idx].device;
+
+	snprintf(hdmi_str, sizeof(hdmi_str), "HDMI/DP,pcm=%d", pcmdev);
+
+	err = snd_hda_input_jack_add(codec, per_pin->pin_nid,
+			     SND_JACK_VIDEOOUT, pcmdev > 0 ? hdmi_str : NULL);
+	if (err < 0)
+		return err;
+
+	hdmi_present_sense(codec, per_pin->pin_nid, &per_pin->sink_eld);
+	return 0;
+}
+
 static int generic_hdmi_build_controls(struct hda_codec *codec)
 {
 	struct hdmi_spec *spec = codec->spec;
@@ -1170,6 +1182,11 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)
 
 	for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
 		struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx];
+
+		err = generic_hdmi_build_jack(codec, pin_idx);
+		if (err < 0)
+			return err;
+
 		err = snd_hda_create_spdif_out_ctls(codec,
 						    per_pin->pin_nid,
 						    per_pin->mux_nids[0]);
-- 
1.7.4.1


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



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

* Re: [PATCH] ALSA: hda: hdmi: Hint matching between input devices and pcm devices
  2011-09-21  7:18 [PATCH] ALSA: hda: hdmi: Hint matching between input devices and pcm devices David Henningsson
@ 2011-09-21  8:31 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2011-09-21  8:31 UTC (permalink / raw)
  To: David Henningsson; +Cc: ALSA Development Mailing List

At Wed, 21 Sep 2011 09:18:08 +0200,
David Henningsson wrote:
> 
> Hi Takashi,
> 
> You went on vacation when this patch was posted and discussed, but would 
> you mind reviewing/committing this patch now that you're back?
> 
> It was reviewed by Stephen Warren who thought the patch was okay, but 
> had some thoughts on doing other changes to the format of that string at 
> the same time [1].
> 
> I had to distro patch a 3.0 adapted version of this patch into Ubuntu in 
> order to meet the Ubuntu 11.10 kernel deadline, so for that reason I'd 
> say that the ",pcm=x" format would be preferrable for me, and while I 
> don't mind further improvements to the string format in the future, this 
> would be a step in the right direction and IMO this patch should not 
> block on such future improvements.

Applied now.  Sorry for overlooking.


thanks,

Takashi

> 
> -- 
> David Henningsson, Canonical Ltd.
> http://launchpad.net/~diwic
> 
> [1] 
> http://mailman.alsa-project.org/pipermail/alsa-devel/2011-August/043258.html
> [2 0001-ALSA-hda-hdmi-Hint-matching-between-input-devices-an.patch <text/x-patch (7bit)>]
> >From ab5ef7898ca0a6e86401428a3ca77f05db9eb7c9 Mon Sep 17 00:00:00 2001
> From: David Henningsson <david.henningsson@canonical.com>
> Date: Tue, 23 Aug 2011 16:56:03 +0200
> Subject: [PATCH] ALSA: hda: hdmi: Hint matching between input devices and pcm devices
> 
> Since modern HDMI cards often have more than one output pin and thus
> input device, we need to know which one has actually been plugged in.
> 
> This patch adds a name hint that indicates which PCM device is connected 
> to which pin.
> 
> Signed-off-by: David Henningsson <david.henningsson@canonical.com>
> ---
>  sound/pci/hda/patch_hdmi.c |   31 ++++++++++++++++++++++++-------
>  1 files changed, 24 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
> index 19cb72d..8c83ec4 100644
> --- a/sound/pci/hda/patch_hdmi.c
> +++ b/sound/pci/hda/patch_hdmi.c
> @@ -967,19 +967,12 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
>  
>  	per_pin->pin_nid = pin_nid;
>  
> -	err = snd_hda_input_jack_add(codec, pin_nid,
> -				     SND_JACK_VIDEOOUT, NULL);
> -	if (err < 0)
> -		return err;
> -
>  	err = hdmi_read_pin_conn(codec, pin_idx);
>  	if (err < 0)
>  		return err;
>  
>  	spec->num_pins++;
>  
> -	hdmi_present_sense(codec, pin_nid, eld);
> -
>  	return 0;
>  }
>  
> @@ -1162,6 +1155,25 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec)
>  	return 0;
>  }
>  
> +static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx)
> +{
> +	int err;
> +	char hdmi_str[32];
> +	struct hdmi_spec *spec = codec->spec;
> +	struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx];
> +	int pcmdev = spec->pcm_rec[pin_idx].device;
> +
> +	snprintf(hdmi_str, sizeof(hdmi_str), "HDMI/DP,pcm=%d", pcmdev);
> +
> +	err = snd_hda_input_jack_add(codec, per_pin->pin_nid,
> +			     SND_JACK_VIDEOOUT, pcmdev > 0 ? hdmi_str : NULL);
> +	if (err < 0)
> +		return err;
> +
> +	hdmi_present_sense(codec, per_pin->pin_nid, &per_pin->sink_eld);
> +	return 0;
> +}
> +
>  static int generic_hdmi_build_controls(struct hda_codec *codec)
>  {
>  	struct hdmi_spec *spec = codec->spec;
> @@ -1170,6 +1182,11 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)
>  
>  	for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
>  		struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx];
> +
> +		err = generic_hdmi_build_jack(codec, pin_idx);
> +		if (err < 0)
> +			return err;
> +
>  		err = snd_hda_create_spdif_out_ctls(codec,
>  						    per_pin->pin_nid,
>  						    per_pin->mux_nids[0]);
> -- 
> 1.7.4.1
> 

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

end of thread, other threads:[~2011-09-21  8:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-21  7:18 [PATCH] ALSA: hda: hdmi: Hint matching between input devices and pcm devices David Henningsson
2011-09-21  8:31 ` Takashi Iwai

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.