diff mbox series

[SRU,F,1/1] UBUNTU: SAUCE: ASoC: SOF: Intel: hda: move the probe_bus ahead of creation of mach device

Message ID 20210507073953.15588-2-hui.wang@canonical.com
State New
Headers show
Series alsa/sof: make sof driver work in the case of without i915 (focal kernel) | expand

Commit Message

Hui Wang May 7, 2021, 7:39 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1927672

We backported many patches to enable the sof audio driver in the focal
kernel, the driver worked well on cml and cfl machines if they have
both analog codec and HDMI/DP codec.

On some machines they only have analog codec, the current sof driver
can't work on them, we already backported related patches like "allow
operation without i915 gfx" and "drop HDA codec upon probe failure",
but we still miss one important patch:
commit 285880a23d10
("ASoC: SOF: Make creation of machine device from SOF core optional")

The patch is big, it is prone to introduce regression if applying
such a big patch, here I only picked a small part which is helpful
to enable sof driver without HDMI/DP codec.

After the change, The probe_bus() will probe the codec first and set
the codec_mask according to the probing result, then the driver create
mach device according to codec_mask.

Referred-To: commit 285880a23d10
("ASoC: SOF: Make creation of machine device from SOF core optional")
Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 sound/soc/sof/intel/hda.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Tim Gardner May 7, 2021, 11:56 a.m. UTC | #1
Acked-by: Tim Gardner <tim.gardner@canonical.com>

Reordering does not appear to orphan any resources since there is no 
early return from the function after the call to hda_codec_probe_bus(). 
Good test results.

On 5/7/21 1:39 AM, Hui Wang wrote:
> BugLink: https://bugs.launchpad.net/bugs/1927672
> 
> We backported many patches to enable the sof audio driver in the focal
> kernel, the driver worked well on cml and cfl machines if they have
> both analog codec and HDMI/DP codec.
> 
> On some machines they only have analog codec, the current sof driver
> can't work on them, we already backported related patches like "allow
> operation without i915 gfx" and "drop HDA codec upon probe failure",
> but we still miss one important patch:
> commit 285880a23d10
> ("ASoC: SOF: Make creation of machine device from SOF core optional")
> 
> The patch is big, it is prone to introduce regression if applying
> such a big patch, here I only picked a small part which is helpful
> to enable sof driver without HDMI/DP codec.
> 
> After the change, The probe_bus() will probe the codec first and set
> the codec_mask according to the probing result, then the driver create
> mach device according to codec_mask.
> 
> Referred-To: commit 285880a23d10
> ("ASoC: SOF: Make creation of machine device from SOF core optional")
> Signed-off-by: Hui Wang <hui.wang@canonical.com>
> ---
>   sound/soc/sof/intel/hda.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
> index d743e27f063f..ef6a1113b178 100644
> --- a/sound/soc/sof/intel/hda.c
> +++ b/sound/soc/sof/intel/hda.c
> @@ -387,6 +387,9 @@ static int hda_init_caps(struct snd_sof_dev *sdev)
>   	if (bus->mlcap)
>   		snd_hdac_ext_bus_get_ml_capabilities(bus);
>   
> +	/* create codec instances */
> +	hda_codec_probe_bus(sdev, hda_codec_use_common_hdmi);
> +
>   	/* codec detection */
>   	if (!bus->codec_mask) {
>   		dev_info(bus->dev, "no hda codecs found!\n");
> @@ -480,9 +483,6 @@ static int hda_init_caps(struct snd_sof_dev *sdev)
>   		mach_params->dmic_num = dmic_num;
>   	}
>   
> -	/* create codec instances */
> -	hda_codec_probe_bus(sdev, hda_codec_use_common_hdmi);
> -
>   	if (!HDA_IDISP_CODEC(bus->codec_mask))
>   		hda_codec_i915_put(sdev);
>   
>
diff mbox series

Patch

diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index d743e27f063f..ef6a1113b178 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -387,6 +387,9 @@  static int hda_init_caps(struct snd_sof_dev *sdev)
 	if (bus->mlcap)
 		snd_hdac_ext_bus_get_ml_capabilities(bus);
 
+	/* create codec instances */
+	hda_codec_probe_bus(sdev, hda_codec_use_common_hdmi);
+
 	/* codec detection */
 	if (!bus->codec_mask) {
 		dev_info(bus->dev, "no hda codecs found!\n");
@@ -480,9 +483,6 @@  static int hda_init_caps(struct snd_sof_dev *sdev)
 		mach_params->dmic_num = dmic_num;
 	}
 
-	/* create codec instances */
-	hda_codec_probe_bus(sdev, hda_codec_use_common_hdmi);
-
 	if (!HDA_IDISP_CODEC(bus->codec_mask))
 		hda_codec_i915_put(sdev);