On 9/12/19 7:06 AM, Kai Vehmanen wrote:
Hey,
On Tue, 10 Sep 2019, Pierre-Louis Bossart wrote:
--- a/sound/soc/sof/intel/hda-codec.c +++ b/sound/soc/sof/intel/hda-codec.c @@ -84,6 +84,8 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int
[...]
- /*
* if common HDMI codec driver is not used, codec load
* is skipped here and hdac_hdmi is used instead
*/
- if ((mach_params && mach_params->common_hdmi_codec_drv) ||
(resp & 0xFFFF0000) != IDISP_VID_INTEL) { hdev->type = HDA_DEV_LEGACY; hda_codec_load_module(&hda_priv->codec);
This part is might be problematic. For SoundWire stuff, I had to move all the machine detection part out of hda_init_caps() and at the end of hda_dsp_probe. It's not final since I am still trying to figure out what the earliest time I can power-up the SoundWire IP is, but it would help if you don't make strong assumptions on when mach_params is set. The fact that all this code is currently in hda_init_caps() is not really by design, more because of incremental code changes.
hmm. Currently the settings part of 'common_hdmi_codec_drv' is in in init_caps, just before call to hda_codec_probe_bus() (which uses the flag). There are also other fields set there (like mach_params->codec_mask), so issues should apply to codec_mask passing as well. I.e. if functionality is moved out from init_caps, the call to bus probe should be moved as well.
Other options to pass the flag do not seem good. We don't want to add hw specific stuff like this to snd_sof_dev or hdac_bus (latter used to pass "codec_mask"). If this becomes an issue, maybe we just need an explicit parameter to hda_codec_probe_bus(), and/or move the module parameter directly to intel/hda-codec.c. Both are a bit ugly, but at least contained in the "sof/intel/" subfolder.
never mind, with the SoundWire plumbing rework we can do all the machine driver checks in hda_init_caps. I split the ACPI scan, driver probe and startup in 3 steps so we have more freedom. Before this rework I was constrained to detect the ACPI stuff only when the hardware was powered, which was after init_caps. In short don't worry about me/SoundWire.