[alsa-devel] [PATCH] ASoC: SOF: intel: Fix probe error without i915 graphics

Takashi Iwai tiwai at suse.de
Sun Feb 16 21:35:16 CET 2020


When the driver is configured with CONFIG_SND_SOC_SOF_HDA, the SOF
driver tries to bind with i915 audio component.  But there is also a
system without Intel graphics.  On such a system, snd_hdac_i915_init()
returns -ENODEV error and it leads to the whole probe error of SOF
driver.

For avoiding this spurious probe error, this patch changes
snd_hdac_i915_init() to return -ENOENT for non-existing i915 graphics
case.  Then the caller can check the error code and handle as no fatal
error.

In SOF side, a few changes have been added to hda_codec_i915_init()
and hda_codec_i915_exit() for skipping the i915 init and exit calls
on such a system.

BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1163677
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206085
Cc: <stable at vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai at suse.de>
---

This is an attempt to fix the regression for HP OMEN 17, which showed
the probe error as:
  [    6.278811] sof-audio-pci 0000:00:1f.3: error: init i915 and HDMI codec failed
  [    6.278907] sof-audio-pci 0000:00:1f.3: error: failed to probe DSP -19

Although the i915 binding error is gone by the patch, it still fails
to probe:

  [    6.298259] sof-audio-pci 0000:00:1f.3: error: no matching ASoC machine driver found - aborting probe
  [    6.298299] sof-audio-pci 0000:00:1f.3: error: failed to get machine info -19
  [    6.298668] sof-audio-pci 0000:00:1f.3: error: sof_probe_work failed err: -19

I'm submitting this fix as is for now since the i915 error itself
gets fixed, and the rest seems to be another unsolved problem.


Takashi

 sound/hda/hdac_i915.c           | 4 +++-
 sound/soc/sof/intel/hda-codec.c | 5 +++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
index 3c2db3816029..a451df3efc8a 100644
--- a/sound/hda/hdac_i915.c
+++ b/sound/hda/hdac_i915.c
@@ -116,6 +116,8 @@ static const struct drm_audio_component_audio_ops i915_init_ops = {
  * with i915 graphics driver.
  *
  * Returns zero for success or a negative error code.
+ * -ENOENT indicates that i915 graphics doesn't exist.
+ * -ENODEV means the binding with i915 graphics failed.
  */
 int snd_hdac_i915_init(struct hdac_bus *bus)
 {
@@ -123,7 +125,7 @@ int snd_hdac_i915_init(struct hdac_bus *bus)
 	int err;
 
 	if (!i915_gfx_present())
-		return -ENODEV;
+		return -ENOENT;
 
 	init_completion(&bind_complete);
 
diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c
index 9106ab8dac6f..7202355a701e 100644
--- a/sound/soc/sof/intel/hda-codec.c
+++ b/sound/soc/sof/intel/hda-codec.c
@@ -186,6 +186,8 @@ int hda_codec_i915_init(struct snd_sof_dev *sdev)
 
 	/* i915 exposes a HDA codec for HDMI audio */
 	ret = snd_hdac_i915_init(bus);
+	if (ret == -ENOENT)
+		return 0; /* no i915 graphics present on the system */
 	if (ret < 0)
 		return ret;
 
@@ -200,6 +202,9 @@ int hda_codec_i915_exit(struct snd_sof_dev *sdev)
 	struct hdac_bus *bus = sof_to_bus(sdev);
 	int ret;
 
+	if (!bus->audio_component) /* not bound with i915 */
+		return 0;
+
 	hda_codec_i915_display_power(sdev, false);
 
 	ret = snd_hdac_i915_exit(bus);
-- 
2.16.4



More information about the Alsa-devel mailing list