diff options
author | David Henningsson <david.henningsson@canonical.com> | 2011-08-29 16:43:31 +0200 |
---|---|---|
committer | Leann Ogasawara <leann.ogasawara@canonical.com> | 2011-09-02 09:17:35 -0700 |
commit | fe2d089edfadd33bc9133f471fec39c4f8f7caf7 (patch) | |
tree | b6cf5c84d7517b2b2148cd48721ce3fd91d40c09 | |
parent | 2d41a6653ee2a1c046e5164d9f6bd840fcfc0217 (diff) |
UBUNTU: SAUCE: 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 <david.henningsson@canonical.com>
Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
-rw-r--r-- | 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 bd0ae697f9c..90af8609012 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) |