[SRU][Focal][PATCH 2/3] ASoC: SOF: Intel: drop HDA codec upon probe failure
Hui Wang
hui.wang at canonical.com
Tue Jul 14 07:34:19 UTC 2020
From: Kai Vehmanen <kai.vehmanen at linux.intel.com>
BugLink: https://bugs.launchpad.net/bugs/1886341
In case a HDA codec probe fails, do not raise error immediately,
but instead remove the codec from bus->codec_mask and continue
probe for other codecs.
This allows for more robust behaviour in cases where one codec
in the system is faulty. SOF driver load can still proceed with
the codecs that can be probed successfully. Probe may still
fail if suitable machine driver is not found, but in many
cases the generic HDA machine driver can operate with a subset
of codecs.
Reviewed-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen at linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
Link: https://lore.kernel.org/r/20191218002616.7652-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie at kernel.org>
(cherry picked from commit 91dce767cd0b08be9f1c87bb2de8e63391a72692)
Signed-off-by: Hui Wang <hui.wang at canonical.com>
---
sound/soc/sof/intel/hda-codec.c | 12 +++++-------
sound/soc/sof/intel/hda.h | 4 ++--
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c
index a25b72e75642..7bd56360acd1 100644
--- a/sound/soc/sof/intel/hda-codec.c
+++ b/sound/soc/sof/intel/hda-codec.c
@@ -151,8 +151,8 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address,
}
/* Codec initialization */
-int hda_codec_probe_bus(struct snd_sof_dev *sdev,
- bool hda_codec_use_common_hdmi)
+void hda_codec_probe_bus(struct snd_sof_dev *sdev,
+ bool hda_codec_use_common_hdmi)
{
struct hdac_bus *bus = sof_to_bus(sdev);
int i, ret;
@@ -165,13 +165,11 @@ int hda_codec_probe_bus(struct snd_sof_dev *sdev,
ret = hda_codec_probe(sdev, i, hda_codec_use_common_hdmi);
if (ret < 0) {
- dev_err(bus->dev, "error: codec #%d probe error, ret: %d\n",
- i, ret);
- return ret;
+ dev_warn(bus->dev, "codec #%d probe error, ret: %d\n",
+ i, ret);
+ bus->codec_mask &= ~BIT(i);
}
}
-
- return 0;
}
EXPORT_SYMBOL(hda_codec_probe_bus);
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index 3b82fce87264..6cf12f114387 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -559,8 +559,8 @@ void sof_hda_bus_init(struct hdac_bus *bus, struct device *dev);
/*
* HDA Codec operations.
*/
-int hda_codec_probe_bus(struct snd_sof_dev *sdev,
- bool hda_codec_use_common_hdmi);
+void hda_codec_probe_bus(struct snd_sof_dev *sdev,
+ bool hda_codec_use_common_hdmi);
void hda_codec_jack_wake_enable(struct snd_sof_dev *sdev);
void hda_codec_jack_check(struct snd_sof_dev *sdev);
--
2.17.1
More information about the kernel-team
mailing list