Message ID | 20190829135348.23569-6-kai.vehmanen@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | adapt SOF to use snd-hda-codec-hdmi | expand |
Hi Takashi, On Thu, 29 Aug 2019, Takashi Iwai wrote: > On Thu, 29 Aug 2019 15:53:46 +0200, > Kai Vehmanen wrote: > > static int generic_hdmi_build_pcms(struct hda_codec *codec) > > { [...] > > + if (codec->mst_no_extra_pcms) > > + pcm_num = spec->num_nids; > > + else > > + pcm_num = spec->num_nids + spec->dev_num - 1; > > Instead of changing this, we can simply take dev_num=1 like below. [...] > - if (is_haswell_plus(codec)) { > + if (codec->mst_no_extra_pcms) { > + /* for SOF/SST, no backup PCM streams can be assigned */ > + dev_num = 1; > + spec->dev_num = 1; > + } else if (is_haswell_plus(codec)) { hmm, I think we need to keep dev_num as 3, to create the MST per_pin structs for each port. I.e. we still have the virtual pins, although we limit PCM count to 3. Unless we do this, at least jack detection is broken in DP-MST mode. One option would be to set dev_num = 3; spec->dev_num = 1; ... spec->dev_num is not really used elsewhere than generic_hdmi_build_pcms(), so this works. But, but, this seems quite confusing. So ok if I keep in original form and have separate logic in generic_hdmi_build_pcms()? Br, Kai
On Mon, 02 Sep 2019 14:52:44 +0200, Kai Vehmanen wrote: > > Hi Takashi, > > On Thu, 29 Aug 2019, Takashi Iwai wrote: > > > On Thu, 29 Aug 2019 15:53:46 +0200, > > Kai Vehmanen wrote: > > > static int generic_hdmi_build_pcms(struct hda_codec *codec) > > > { > [...] > > > + if (codec->mst_no_extra_pcms) > > > + pcm_num = spec->num_nids; > > > + else > > > + pcm_num = spec->num_nids + spec->dev_num - 1; > > > > Instead of changing this, we can simply take dev_num=1 like below. > [...] > > - if (is_haswell_plus(codec)) { > > + if (codec->mst_no_extra_pcms) { > > + /* for SOF/SST, no backup PCM streams can be assigned */ > > + dev_num = 1; > > + spec->dev_num = 1; > > + } else if (is_haswell_plus(codec)) { > > hmm, I think we need to keep dev_num as 3, to create the MST per_pin > structs for each port. I.e. we still have the virtual pins, although we > limit PCM count to 3. Unless we do this, at least jack detection is broken > in DP-MST mode. > > One option would be to set > dev_num = 3; > spec->dev_num = 1; > > ... spec->dev_num is not really used elsewhere than > generic_hdmi_build_pcms(), so this works. > > But, but, this seems quite confusing. So ok if I keep in original form and > have separate logic in generic_hdmi_build_pcms()? Fair enough, let's keep your version as is. thanks, Takashi
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index f2022f75afb6..4372c87c48f0 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_exxtra_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> --- sound/pci/hda/patch_hdmi.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)