ALSA: hda - hdmi create spdif ctl based on pcm
PATCH 1/1 ALSA: hda - hdmi create spdif ctl based on pcm
From: Libin Yang <[email protected]>
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.
--- sound/pci/hda/patch_hdmi.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)
sound/pci/hda/patch_hdmi.c +18 -9
@@ -2255,6 +2255,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 ) {
@@ -2276,8 +2277,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));
@@ -2560,19 +2559,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,
Signature · 1 line
1.9.1
Hi Takashi,
This patch is for DP MST audio, and for hda-mst branch.
Regards,
Libin
Quoted 86 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Friday, January 29, 2016 1:53 PM
To: [email protected]; [email protected]
Cc: Lin, Mengdong; Yang, Libin; Libin Yang
Subject: [PATCH] ALSA: hda - hdmi create spdif ctl based on pcmFrom: Libin Yang <[email protected]>
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 <[email protected]>--- sound/pci/hda/patch_hdmi.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)sound/pci/hda/patch_hdmi.c +1
-0@@ -2255,6 +2255,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);sound/pci/hda/patch_hdmi.c +0
-2if (spec->dyn_pcm_assign && pin_idx <0 ) {@@ -2276,8 +2277,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;sound/pci/hda/patch_hdmi.c +17
-7memset (per_pin->chmap,0 ,sizeof (per_pin->chmap));@@ -2560,19 +2559,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);sound/pci/hda/patch_hdmi.c +0
-1/* add control for ELD Bytes */ err = hdmi_create_eld_ctl(codec, pin_idx, --1.9.1
Quoted 4 lines · Libin
Hi Takashi,
This patch is for DP MST audio, and for hda-mst branch.
OK, applied now. Also, I rebased topic/hda-mst branch on top of 4.5-rc1 (so that it's now building cleanly).
thanks,
Takashi
Quoted 92 lines
Regards,
LibinQuoted 86 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Friday, January 29, 2016 1:53 PM
To: [email protected]; [email protected]
Cc: Lin, Mengdong; Yang, Libin; Libin Yang
Subject: [PATCH] ALSA: hda - hdmi create spdif ctl based on pcmFrom: Libin Yang <[email protected]>
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 <[email protected]>--- sound/pci/hda/patch_hdmi.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)sound/pci/hda/patch_hdmi.c +1
-0@@ -2255,6 +2255,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);sound/pci/hda/patch_hdmi.c +0
-2if (spec->dyn_pcm_assign && pin_idx <0 ) {@@ -2276,8 +2277,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;sound/pci/hda/patch_hdmi.c +17
-7memset (per_pin->chmap,0 ,sizeof (per_pin->chmap));@@ -2560,19 +2559,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);sound/pci/hda/patch_hdmi.c +0
-1/* add control for ELD Bytes */ err = hdmi_create_eld_ctl(codec, pin_idx, --1.9.1