diff options
author | David Henningsson <david.henningsson@canonical.com> | 2011-08-29 16:43:31 +0200 |
---|---|---|
committer | John Rigby <john.rigby@linaro.org> | 2011-09-23 08:59:22 -0600 |
commit | 6f491f9c11104c851d484f201eb5f8ea8cfd4896 (patch) | |
tree | ae641c7d221b394e7665818fe8d31132eaec71ef | |
parent | 8a5d420a60585aaa0a1ac996de4f6737739d6c96 (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) |