From patchwork Mon Aug 29 14:52:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Henningsson X-Patchwork-Id: 112077 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 20558B6F8E for ; Tue, 30 Aug 2011 00:53:07 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Qy3Cj-0004t1-OL; Mon, 29 Aug 2011 14:52:49 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Qy3Ch-0004rP-1V for kernel-team@lists.ubuntu.com; Mon, 29 Aug 2011 14:52:47 +0000 Received: from hd9483857.selulk5.dyn.perspektivbredband.net ([217.72.56.87] helo=[192.168.8.102]) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Qy3Cg-00055G-UZ for kernel-team@lists.ubuntu.com; Mon, 29 Aug 2011 14:52:47 +0000 Message-ID: <4E5BA7BD.6000403@canonical.com> Date: Mon, 29 Aug 2011 16:52:45 +0200 From: David Henningsson User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.20) Gecko/20110805 Thunderbird/3.1.12 MIME-Version: 1.0 To: Ubuntu Kernel Team Subject: Oneiric: [PATCH] (UBUNTU: Sauce) Match jack input devices and pcm devices for HDMI X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com Upstream status for this patch is that Takashi went on vacation before he commented on the patch, and might not return before kernel freeze. Anyway, it's needed for jack detection for HDMI to work. So I'd be happy if we could apply this for Oneiric (the jack detection patches are distro patches anyway), and then I'll have plenty of time to sort out with Takashi what to do for P. From 658c18c6c7f232fe5ed18d93aeaa7fd7329a31c0 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Mon, 29 Aug 2011 16:43:31 +0200 Subject: [PATCH] ALSA: HDA: hdmi: Emit pcm device index for jack input devices Needed for userspace to be able to match pcm devices and jack input devices. Backport for kernel v3.0. Signed-off-by: David Henningsson --- sound/pci/hda/patch_hdmi.c | 37 ++++++++++++++++++++++++++++++------- 1 files changed, 30 insertions(+), 7 deletions(-) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index bd0ae69..1687183 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -917,13 +917,6 @@ 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; - - hdmi_present_sense(codec, pin_nid, &spec->sink_eld[spec->num_pins]); - spec->pin[spec->num_pins] = pin_nid; spec->num_pins++; @@ -1088,12 +1081,42 @@ 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; + int pin_nid = spec->pin[pin_idx]; + int cvt_nid = spec->pin_cvt[pin_idx]; + int cvt_idx, pcmdev; + + cvt_idx = hda_node_index(spec->cvt, cvt_nid); + if (cvt_idx < 0) + return cvt_idx; + pcmdev = spec->pcm_rec[cvt_idx].device; + snprintf(hdmi_str, sizeof(hdmi_str), "HDMI/DP,pcm=%d", pcmdev); + + err = snd_hda_input_jack_add(codec, pin_nid, + SND_JACK_VIDEOOUT, pcmdev > 0 ? hdmi_str : NULL); + if (err < 0) + return err; + + hdmi_present_sense(codec, pin_nid, &spec->sink_eld[pin_idx]); + return 0; +} + static int generic_hdmi_build_controls(struct hda_codec *codec) { struct hdmi_spec *spec = codec->spec; int err; int i; + for (i = 0; i < spec->num_pins; i++) { + err = generic_hdmi_build_jack(codec, i); + if (err < 0) + return err; + } + for (i = 0; i < codec->num_pcms; i++) { err = snd_hda_create_spdif_out_ctls(codec, spec->cvt[i]); if (err < 0) -- 1.7.4.1