All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, broonie@kernel.org,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Subject: [alsa-devel] [PATCH 5/8] ASoC: SOF: Intel: drop HDA codec upon probe failure
Date: Tue, 17 Dec 2019 18:26:13 -0600	[thread overview]
Message-ID: <20191218002616.7652-6-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20191218002616.7652-1-pierre-louis.bossart@linux.intel.com>

From: Kai Vehmanen <kai.vehmanen@linux.intel.com>

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@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.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 65761e095184..d7855b1f8e2e 100644
--- a/sound/soc/sof/intel/hda-codec.c
+++ b/sound/soc/sof/intel/hda-codec.c
@@ -140,8 +140,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;
@@ -154,13 +154,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 01529c7058f3..47408ec0de40 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -575,8 +575,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.20.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2019-12-18  0:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18  0:26 [alsa-devel] [PATCH 0/8] ASoC: SOF: last patches for 2019 Pierre-Louis Bossart
2019-12-18  0:26 ` [alsa-devel] [PATCH 1/8] ASoC: SOF: Introduce state machine for FW boot Pierre-Louis Bossart
2019-12-18 20:06   ` [alsa-devel] Applied "ASoC: SOF: Introduce state machine for FW boot" to the asoc tree Mark Brown
2019-12-18  0:26 ` [alsa-devel] [PATCH 2/8] ASoC: SOF: define struct with compiler name and version Pierre-Louis Bossart
2019-12-18 20:06   ` [alsa-devel] Applied "ASoC: SOF: define struct with compiler name and version" to the asoc tree Mark Brown
2019-12-18  0:26 ` [alsa-devel] [PATCH 3/8] ASoC: SOF: log compiler name and version information Pierre-Louis Bossart
2019-12-18 20:06   ` [alsa-devel] Applied "ASoC: SOF: log compiler name and version information" to the asoc tree Mark Brown
2019-12-18  0:26 ` [alsa-devel] [PATCH 4/8] ASoC: Intel: Add machine driver for da7219_max98373 Pierre-Louis Bossart
2019-12-18 20:05   ` [alsa-devel] Applied "ASoC: Intel: Add machine driver for da7219_max98373" to the asoc tree Mark Brown
2019-12-18  0:26 ` Pierre-Louis Bossart [this message]
2019-12-18 20:05   ` [alsa-devel] Applied "ASoC: SOF: Intel: drop HDA codec upon probe failure" " Mark Brown
2019-12-18  0:26 ` [alsa-devel] [PATCH 6/8] ASoC: Intel: boards: fix incorrect HDMI Kconfig dependency Pierre-Louis Bossart
2019-12-18 20:05   ` [alsa-devel] Applied "ASoC: Intel: boards: fix incorrect HDMI Kconfig dependency" to the asoc tree Mark Brown
2019-12-18  0:26 ` [alsa-devel] [PATCH 7/8] ASoC: SOF: imx: Describe SAI parameters to be sent to DSP Pierre-Louis Bossart
2019-12-18 20:05   ` [alsa-devel] Applied "ASoC: SOF: imx: Describe SAI parameters to be sent to DSP" to the asoc tree Mark Brown
2019-12-18  0:26 ` [alsa-devel] [PATCH 8/8] ASoC: SOF: imx: Read SAI parameters and send them to DSP Pierre-Louis Bossart
2019-12-18 20:05   ` [alsa-devel] Applied "ASoC: SOF: imx: Read SAI parameters and send them to DSP" to the asoc tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191218002616.7652-6-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.