Commit 9cdae435 authored by Rakesh Ughreja's avatar Rakesh Ughreja Committed by Mark Brown

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: default avatarRakesh Ughreja <rakesh.a.ughreja@intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7c33b5f1
...@@ -472,6 +472,25 @@ static struct skl_ssp_clk skl_ssp_clks[] = { ...@@ -472,6 +472,25 @@ static struct skl_ssp_clk skl_ssp_clks[] = {
{.name = "ssp5_sclkfs"}, {.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) static int skl_find_machine(struct skl *skl, void *driver_data)
{ {
struct hdac_bus *bus = skl_to_bus(skl); struct hdac_bus *bus = skl_to_bus(skl);
...@@ -479,10 +498,14 @@ static int skl_find_machine(struct skl *skl, void *driver_data) ...@@ -479,10 +498,14 @@ static int skl_find_machine(struct skl *skl, void *driver_data)
struct skl_machine_pdata *pdata; struct skl_machine_pdata *pdata;
mach = snd_soc_acpi_find_machine(mach); mach = snd_soc_acpi_find_machine(mach);
if (mach == NULL) { 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"); dev_err(bus->dev, "No matching machine driver found\n");
return -ENODEV; return -ENODEV;
} }
}
skl->mach = mach; skl->mach = mach;
skl->fw_name = mach->fw_filename; skl->fw_name = mach->fw_filename;
...@@ -498,8 +521,9 @@ static int skl_find_machine(struct skl *skl, void *driver_data) ...@@ -498,8 +521,9 @@ static int skl_find_machine(struct skl *skl, void *driver_data)
static int skl_machine_device_register(struct skl *skl) 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 snd_soc_acpi_mach *mach = skl->mach;
struct hdac_bus *bus = skl_to_bus(skl);
struct skl_machine_pdata *pdata;
struct platform_device *pdev; struct platform_device *pdev;
int ret; int ret;
...@@ -516,8 +540,12 @@ static int skl_machine_device_register(struct skl *skl) ...@@ -516,8 +540,12 @@ static int skl_machine_device_register(struct skl *skl)
return -EIO; 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); dev_set_drvdata(&pdev->dev, mach->pdata);
}
skl->i2s_dev = pdev; skl->i2s_dev = pdev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment