From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
To: lgirdwood@gmail.com, broonie@kernel.org
Cc: alsa-devel@alsa-project.org,
pierre-louis.bossart@linux.intel.com,
ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com,
rander.wang@intel.com
Subject: [PATCH 04/12] ASoC: SOF: Intel: hda: Skip interfaces not supported on a platform
Date: Tue, 4 Apr 2023 12:21:07 +0300 [thread overview]
Message-ID: <20230404092115.27949-5-peter.ujfalusi@linux.intel.com> (raw)
In-Reply-To: <20230404092115.27949-1-peter.ujfalusi@linux.intel.com>
Not all interfaces (SSP/DMIC/HDA/SDW) are available on all platforms.
If the interface is not even supported then there is no point in executing
a probe or query for that interface.
Introduce a simple function (hda_get_interface_mask) to query the
interfaces supported on the platform.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
---
sound/soc/sof/intel/hda.c | 50 ++++++++++++++++++++++++++++++++++-----
1 file changed, 44 insertions(+), 6 deletions(-)
diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index 65389c7278e2..19aad4141a78 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -44,6 +44,37 @@
#define EXCEPT_MAX_HDR_SIZE 0x400
#define HDA_EXT_ROM_STATUS_SIZE 8
+static u32 hda_get_interface_mask(struct snd_sof_dev *sdev)
+{
+ const struct sof_intel_dsp_desc *chip;
+ u32 interface_mask = 0;
+
+ chip = get_chip_info(sdev->pdata);
+ switch (chip->hw_ip_version) {
+ case SOF_INTEL_TANGIER:
+ case SOF_INTEL_BAYTRAIL:
+ case SOF_INTEL_BROADWELL:
+ interface_mask = BIT(SOF_DAI_INTEL_SSP);
+ break;
+ case SOF_INTEL_CAVS_1_5:
+ case SOF_INTEL_CAVS_1_5_PLUS:
+ interface_mask = BIT(SOF_DAI_INTEL_SSP) | BIT(SOF_DAI_INTEL_DMIC) |
+ BIT(SOF_DAI_INTEL_HDA);
+ break;
+ case SOF_INTEL_CAVS_1_8:
+ case SOF_INTEL_CAVS_2_0:
+ case SOF_INTEL_CAVS_2_5:
+ case SOF_INTEL_ACE_1_0:
+ interface_mask = BIT(SOF_DAI_INTEL_SSP) | BIT(SOF_DAI_INTEL_DMIC) |
+ BIT(SOF_DAI_INTEL_HDA) | BIT(SOF_DAI_INTEL_ALH);
+ break;
+ default:
+ break;
+ }
+
+ return interface_mask;
+}
+
#if IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE)
/*
@@ -845,6 +876,7 @@ static int dmic_detect_topology_fixup(struct snd_sof_dev *sdev,
static int hda_init_caps(struct snd_sof_dev *sdev)
{
+ u32 interface_mask = hda_get_interface_mask(sdev);
struct hdac_bus *bus = sof_to_bus(sdev);
struct snd_sof_pdata *pdata = sdev->pdata;
struct sof_intel_hda_dev *hdev = pdata->hw_pdata;
@@ -865,6 +897,10 @@ static int hda_init_caps(struct snd_sof_dev *sdev)
hda_bus_ml_get_capabilities(bus);
+ /* Skip SoundWire if it is not supported */
+ if (!(interface_mask & BIT(SOF_DAI_INTEL_ALH)))
+ goto skip_soundwire;
+
/* scan SoundWire capabilities exposed by DSDT */
ret = hda_sdw_acpi_scan(sdev);
if (ret < 0) {
@@ -1486,12 +1522,16 @@ void hda_set_mach_params(struct snd_soc_acpi_mach *mach,
struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev)
{
+ u32 interface_mask = hda_get_interface_mask(sdev);
struct snd_sof_pdata *sof_pdata = sdev->pdata;
const struct sof_dev_desc *desc = sof_pdata->desc;
- struct snd_soc_acpi_mach *mach;
+ struct snd_soc_acpi_mach *mach = NULL;
const char *tplg_filename;
- mach = snd_soc_acpi_find_machine(desc->machines);
+ /* Try I2S or DMIC if it is supported */
+ if (interface_mask & (BIT(SOF_DAI_INTEL_SSP) | BIT(SOF_DAI_INTEL_DMIC)))
+ mach = snd_soc_acpi_find_machine(desc->machines);
+
if (mach) {
bool add_extension = false;
bool tplg_fixup = false;
@@ -1598,10 +1638,8 @@ struct snd_soc_acpi_mach *hda_machine_select(struct snd_sof_dev *sdev)
}
}
- /*
- * If I2S fails, try SoundWire
- */
- if (!mach)
+ /* If I2S fails, try SoundWire if it is supported */
+ if (!mach && (interface_mask & BIT(SOF_DAI_INTEL_ALH)))
mach = hda_sdw_machine_select(sdev);
/*
--
2.40.0
next prev parent reply other threads:[~2023-04-04 9:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 9:21 [PATCH 00/12] ASoC: SOF: core/Intel: Introduce DSPless mode Peter Ujfalusi
2023-04-04 9:21 ` [PATCH 01/12] ASoC: SOF: Intel: hda-stream: Do not dereference hstream until it is safe Peter Ujfalusi
2023-04-04 9:21 ` [PATCH 02/12] ASoC: SOF: Add flag and state which will be used for DSP-less mode Peter Ujfalusi
2023-04-04 9:21 ` [PATCH 03/12] ASoC: SOF: Add support for DSPless mode Peter Ujfalusi
2023-04-04 9:21 ` Peter Ujfalusi [this message]
2023-04-04 9:21 ` [PATCH 05/12] ASoC: SOF: Intel: hda: " Peter Ujfalusi
2023-04-04 9:21 ` [PATCH 06/12] ASoC: SOF: Intel: hda: make DSPless mode work with DSP disabled in BIOS Peter Ujfalusi
2023-04-04 9:21 ` [PATCH 07/12] ASoC: SOF: Intel: pci-apl: Allow DSPless mode Peter Ujfalusi
2023-04-04 9:21 ` [PATCH 08/12] ASoC: SOF: Intel: pci-cnl: " Peter Ujfalusi
2023-04-04 9:21 ` [PATCH 09/12] ASoC: SOF: Intel: pci-icl: " Peter Ujfalusi
2023-04-04 9:21 ` [PATCH 10/12] ASoC: SOF: Intel: pci-mtl: " Peter Ujfalusi
2023-04-04 9:21 ` [PATCH 11/12] ASoC: SOF: Intel: pci-skl: " Peter Ujfalusi
2023-04-04 9:21 ` [PATCH 12/12] ASoC: SOF: Intel: pci-tgl: " Peter Ujfalusi
2023-04-04 18:05 ` [PATCH 00/12] ASoC: SOF: core/Intel: Introduce " 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=20230404092115.27949-5-peter.ujfalusi@linux.intel.com \
--to=peter.ujfalusi@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=rander.wang@intel.com \
--cc=ranjani.sridharan@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox