1
0
Fork 0

ASoC: Intel: Skylake: use HDAudio if ACPI enumeration fails

When no I2S based codec entries are found in the BIOS, check if there are
any HDA codecs detected on the bus. Based on the number of codecs found
take appropriate action in machine driver. If there are two HDA codecs
i.e. iDisp + HDA found on the bus, register DAIs and DAI links for both.
If only one codec i.e. iDisp is found then load only iDisp machine driver.

Signed-off-by: Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
hifive-unleashed-5.1
Rakesh Ughreja 2018-08-22 15:25:00 -05:00 committed by Mark Brown
parent 7c33b5f169
commit 9cdae4352c
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 33 additions and 5 deletions

View File

@ -472,6 +472,25 @@ static struct skl_ssp_clk skl_ssp_clks[] = {
{.name = "ssp5_sclkfs"},
};
static struct snd_soc_acpi_mach *skl_find_hda_machine(struct skl *skl,
struct snd_soc_acpi_mach *machines)
{
struct hdac_bus *bus = skl_to_bus(skl);
struct snd_soc_acpi_mach *mach;
/* check if we have any codecs detected on bus */
if (bus->codec_mask == 0)
return NULL;
/* point to common table */
mach = snd_soc_acpi_intel_hda_machines;
/* all entries in the machine table use the same firmware */
mach->fw_filename = machines->fw_filename;
return mach;
}
static int skl_find_machine(struct skl *skl, void *driver_data)
{
struct hdac_bus *bus = skl_to_bus(skl);
@ -479,9 +498,13 @@ static int skl_find_machine(struct skl *skl, void *driver_data)
struct skl_machine_pdata *pdata;
mach = snd_soc_acpi_find_machine(mach);
if (mach == NULL) {
dev_err(bus->dev, "No matching machine driver found\n");
return -ENODEV;
if (!mach) {
dev_dbg(bus->dev, "No matching I2S machine driver found\n");
mach = skl_find_hda_machine(skl, driver_data);
if (!mach) {
dev_err(bus->dev, "No matching machine driver found\n");
return -ENODEV;
}
}
skl->mach = mach;
@ -498,8 +521,9 @@ static int skl_find_machine(struct skl *skl, void *driver_data)
static int skl_machine_device_register(struct skl *skl)
{
struct hdac_bus *bus = skl_to_bus(skl);
struct snd_soc_acpi_mach *mach = skl->mach;
struct hdac_bus *bus = skl_to_bus(skl);
struct skl_machine_pdata *pdata;
struct platform_device *pdev;
int ret;
@ -516,8 +540,12 @@ static int skl_machine_device_register(struct skl *skl)
return -EIO;
}
if (mach->pdata)
if (mach->pdata) {
pdata = (struct skl_machine_pdata *)mach->pdata;
pdata->platform = dev_name(bus->dev);
pdata->codec_mask = bus->codec_mask;
dev_set_drvdata(&pdev->dev, mach->pdata);
}
skl->i2s_dev = pdev;