Message ID | 20190910182916.29693-2-kai.vehmanen@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | adapt SOF to use snd-hda-codec-hdmi | expand |
On 9/10/19 1:29 PM, Kai Vehmanen wrote: > When mst_no_extra_pcms flag is set, the codec should not > use backup PCMs to handle DP-MST scenarios. Instead a simple > 1:1 mapping is assumed between PCMs and converters. mst_no_extra_pcms is not set, which makes it hard to review and get the picture of what this does. > > Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> > --- > include/sound/hda_codec.h | 1 + > sound/pci/hda/patch_hdmi.c | 19 ++++++++++++++----- > 2 files changed, 15 insertions(+), 5 deletions(-) > > diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h > index 9a0393cf024c..ac18f428eda6 100644 > --- a/include/sound/hda_codec.h > +++ b/include/sound/hda_codec.h > @@ -254,6 +254,7 @@ struct hda_codec { > unsigned int force_pin_prefix:1; /* Add location prefix */ > unsigned int link_down_at_suspend:1; /* link down at runtime suspend */ > unsigned int relaxed_resume:1; /* don't resume forcibly for jack */ > + unsigned int mst_no_extra_pcms:1; /* no backup PCMs for DP-MST */ > > #ifdef CONFIG_PM > unsigned long power_on_acct; > diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c > index bca5de78e9ad..59aaee4a40fd 100644 > --- a/sound/pci/hda/patch_hdmi.c > +++ b/sound/pci/hda/patch_hdmi.c > @@ -2072,15 +2072,24 @@ static bool is_hdmi_pcm_attached(struct hdac_device *hdac, int pcm_idx) > static int generic_hdmi_build_pcms(struct hda_codec *codec) > { > struct hdmi_spec *spec = codec->spec; > - int idx; > + int idx, pcm_num; > > /* > * for non-mst mode, pcm number is the same as before > - * for DP MST mode, pcm number is (nid number + dev_num - 1) > - * dev_num is the device entry number in a pin > - * > + * for DP MST mode without extra PCM, pcm number is same > + * for DP MST mode with extra PCMs, pcm number is > + * (nid number + dev_num - 1) > + * dev_num is the device entry number in a pin > */ > - for (idx = 0; idx < spec->num_nids + spec->dev_num - 1; idx++) { > + > + if (codec->mst_no_extra_pcms) > + pcm_num = spec->num_nids; > + else > + pcm_num = spec->num_nids + spec->dev_num - 1; > + > + codec_dbg(codec, "hdmi: pcm_num set to %d\n", pcm_num); > + > + for (idx = 0; idx < pcm_num; idx++) { > struct hda_pcm *info; > struct hda_pcm_stream *pstr; > >
Hey, On Tue, 10 Sep 2019, Pierre-Louis Bossart wrote: > > > On 9/10/19 1:29 PM, Kai Vehmanen wrote: > > When mst_no_extra_pcms flag is set, the codec should not > > use backup PCMs to handle DP-MST scenarios. Instead a simple > > 1:1 mapping is assumed between PCMs and converters. > > mst_no_extra_pcms is not set, which makes it hard to review and get the > picture of what this does. this flag is used in patch 3 of the series. I didn't want to combine the patches 1&3 as patch 3 is modifying sound/soc/codecs/hdac_hda.c. Let me try to improve the commit message a bit to explain why this is needed. In short, if patch_hdmi.c creates virtual PCMs for routing purposes (current behaviour with snd_hda_intel in non-DSP mode), it will be impossible to match them to PCMs in ASoC topology. Thus to enable users like SOF (could be others), patch_hdmi.c needs to expose a mode where physical converters are mapped to a fixed set of PCMs (-> this is the mst_no_extra_pcms mode). Br, Kai
diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h index 9a0393cf024c..ac18f428eda6 100644 --- a/include/sound/hda_codec.h +++ b/include/sound/hda_codec.h @@ -254,6 +254,7 @@ struct hda_codec { unsigned int force_pin_prefix:1; /* Add location prefix */ unsigned int link_down_at_suspend:1; /* link down at runtime suspend */ unsigned int relaxed_resume:1; /* don't resume forcibly for jack */ + unsigned int mst_no_extra_pcms:1; /* no backup PCMs for DP-MST */ #ifdef CONFIG_PM unsigned long power_on_acct; diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index bca5de78e9ad..59aaee4a40fd 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -2072,15 +2072,24 @@ static bool is_hdmi_pcm_attached(struct hdac_device *hdac, int pcm_idx) static int generic_hdmi_build_pcms(struct hda_codec *codec) { struct hdmi_spec *spec = codec->spec; - int idx; + int idx, pcm_num; /* * for non-mst mode, pcm number is the same as before - * for DP MST mode, pcm number is (nid number + dev_num - 1) - * dev_num is the device entry number in a pin - * + * for DP MST mode without extra PCM, pcm number is same + * for DP MST mode with extra PCMs, pcm number is + * (nid number + dev_num - 1) + * dev_num is the device entry number in a pin */ - for (idx = 0; idx < spec->num_nids + spec->dev_num - 1; idx++) { + + if (codec->mst_no_extra_pcms) + pcm_num = spec->num_nids; + else + pcm_num = spec->num_nids + spec->dev_num - 1; + + codec_dbg(codec, "hdmi: pcm_num set to %d\n", pcm_num); + + for (idx = 0; idx < pcm_num; idx++) { struct hda_pcm *info; struct hda_pcm_stream *pstr;
When mst_no_extra_pcms flag is set, the codec should not use backup PCMs to handle DP-MST scenarios. Instead a simple 1:1 mapping is assumed between PCMs and converters. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> --- include/sound/hda_codec.h | 1 + sound/pci/hda/patch_hdmi.c | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-)