From: David Henningsson <david.henningsson@canonical.com>
To: ALSA Development Mailing List <alsa-devel@alsa-project.org>,
Takashi Iwai <tiwai@suse.de>, Stephen Warren <swarren@nvidia.com>
Subject: ALSA: hda: hdmi: Hint matching between input devices and pcm devices
Date: Tue, 23 Aug 2011 17:11:42 +0200 [thread overview]
Message-ID: <4E53C32E.9020801@canonical.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 498 bytes --]
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.
To do that, the jack creation has been deferred to build_controls, i e,
after the PCM devices have been created.
Would be great to have Stephen look through this patch quickly before
it's committed.
--
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
[-- Attachment #2: 0001-ALSA-hda-hdmi-Hint-matching-between-input-devices-an.patch --]
[-- Type: text/x-patch, Size: 2421 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 --]
next reply other threads:[~2011-08-23 15:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-23 15:11 David Henningsson [this message]
2011-08-23 15:51 ` ALSA: hda: hdmi: Hint matching between input devices and pcm devices Stephen Warren
2011-08-24 4:53 ` David Henningsson
2011-08-24 21:21 ` Stephen Warren
2011-08-25 7:13 ` David Henningsson
2011-08-25 17:41 ` Stephen Warren
2011-08-25 21:37 ` David Henningsson
2011-08-29 22:14 ` Pierre-Louis Bossart
2011-08-30 7:06 ` David Henningsson
2011-08-30 7:40 ` Clemens Ladisch
2011-08-30 13:01 ` Pierre-Louis Bossart
[not found] ` <000601cc6714$fc5caa80$f515ff80$@bossart@linux.intel.com>
2011-09-12 7:10 ` Takashi Iwai
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=4E53C32E.9020801@canonical.com \
--to=david.henningsson@canonical.com \
--cc=alsa-devel@alsa-project.org \
--cc=swarren@nvidia.com \
--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.