mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 23:58:05 +00:00
ASoC: SOF: Intel: hda: Skip interfaces not supported on a platform
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> Link: https://lore.kernel.org/r/20230404092115.27949-5-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
28d40e7adf
commit
4a3b1433a8
1 changed files with 44 additions and 6 deletions
|
@ -44,6 +44,37 @@
|
||||||
#define EXCEPT_MAX_HDR_SIZE 0x400
|
#define EXCEPT_MAX_HDR_SIZE 0x400
|
||||||
#define HDA_EXT_ROM_STATUS_SIZE 8
|
#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)
|
#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)
|
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 hdac_bus *bus = sof_to_bus(sdev);
|
||||||
struct snd_sof_pdata *pdata = sdev->pdata;
|
struct snd_sof_pdata *pdata = sdev->pdata;
|
||||||
struct sof_intel_hda_dev *hdev = pdata->hw_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);
|
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 */
|
/* scan SoundWire capabilities exposed by DSDT */
|
||||||
ret = hda_sdw_acpi_scan(sdev);
|
ret = hda_sdw_acpi_scan(sdev);
|
||||||
if (ret < 0) {
|
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)
|
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;
|
struct snd_sof_pdata *sof_pdata = sdev->pdata;
|
||||||
const struct sof_dev_desc *desc = sof_pdata->desc;
|
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;
|
const char *tplg_filename;
|
||||||
|
|
||||||
|
/* 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);
|
mach = snd_soc_acpi_find_machine(desc->machines);
|
||||||
|
|
||||||
if (mach) {
|
if (mach) {
|
||||||
bool add_extension = false;
|
bool add_extension = false;
|
||||||
bool tplg_fixup = 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 it is supported */
|
||||||
* If I2S fails, try SoundWire
|
if (!mach && (interface_mask & BIT(SOF_DAI_INTEL_ALH)))
|
||||||
*/
|
|
||||||
if (!mach)
|
|
||||||
mach = hda_sdw_machine_select(sdev);
|
mach = hda_sdw_machine_select(sdev);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue