summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLibin Yang <libin.yang@linux.intel.com>2016-01-29 13:53:27 +0800
committerTakashi Iwai <tiwai@suse.de>2016-01-29 07:34:56 +0100
commitb09887f89159a6883a4e1837bbe1698167def91e (patch)
tree326b8572c8a28059fe25c7987052b34b331b0021 /sound
parent25e4abb33df3aafa7d1efba8f82f9178268efab1 (diff)
downloadop-kernel-dev-b09887f89159a6883a4e1837bbe1698167def91e.zip
op-kernel-dev-b09887f89159a6883a4e1837bbe1698167def91e.tar.gz
ALSA: hda - hdmi create spdif ctl based on pcm
SPDIF ctl should be based on pcm. Each spdif ctl controls one pcm state. This patch creates spdif based on pcm and no longer based on pin. Signed-off-by: Libin Yang <libin.yang@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_hdmi.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index c8b11da..275b68a 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2257,6 +2257,7 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo,
hinfo->nid = 0;
mutex_lock(&spec->pcm_lock);
+ snd_hda_spdif_ctls_unassign(codec, pcm_idx);
clear_bit(pcm_idx, &spec->pcm_in_use);
pin_idx = hinfo_to_pin_index(codec, hinfo);
if (spec->dyn_pcm_assign && pin_idx < 0) {
@@ -2278,8 +2279,6 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo,
pinctl & ~PIN_OUT);
}
- snd_hda_spdif_ctls_unassign(codec, pcm_idx);
-
mutex_lock(&per_pin->lock);
per_pin->chmap_set = false;
memset(per_pin->chmap, 0, sizeof(per_pin->chmap));
@@ -2562,19 +2561,29 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)
err = generic_hdmi_build_jack(codec, pcm_idx);
if (err < 0)
return err;
- }
- for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
- struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
-
- err = snd_hda_create_dig_out_ctls(codec,
+ /* create the spdif for each pcm
+ * pin will be bound when monitor is connected
+ */
+ if (spec->dyn_pcm_assign)
+ err = snd_hda_create_dig_out_ctls(codec,
+ 0, spec->cvt_nids[0],
+ HDA_PCM_TYPE_HDMI);
+ else {
+ struct hdmi_spec_per_pin *per_pin =
+ get_pin(spec, pcm_idx);
+ err = snd_hda_create_dig_out_ctls(codec,
per_pin->pin_nid,
per_pin->mux_nids[0],
HDA_PCM_TYPE_HDMI);
+ }
if (err < 0)
return err;
- /* pin number is the same with pcm number so far */
- snd_hda_spdif_ctls_unassign(codec, pin_idx);
+ snd_hda_spdif_ctls_unassign(codec, pcm_idx);
+ }
+
+ for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
+ struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
/* add control for ELD Bytes */
err = hdmi_create_eld_ctl(codec, pin_idx,
OpenPOWER on IntegriCloud