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,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	liam.r.girdwood@linux.intel.com, vkoul@kernel.org,
	broonie@kernel.org, Rakesh Ughreja <rakesh.a.ughreja@intel.com>
Subject: [PATCH v5 4/8] ASoC: Intel: Skylake: use HDAudio if ACPI enumeration fails
Date: Fri, 27 Jul 2018 18:05:50 -0500	[thread overview]
Message-ID: <20180727230554.31027-5-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20180727230554.31027-1-pierre-louis.bossart@linux.intel.com>

From: Rakesh Ughreja <rakesh.a.ughreja@intel.com>

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>
---
 sound/soc/intel/skylake/skl.c | 38 +++++++++++++++++++++++++++++++++-----
 1 file changed, 33 insertions(+), 5 deletions(-)

diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index dce649485649..c83194de4aed 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -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;
 
-- 
2.14.1

  parent reply	other threads:[~2018-07-27 23:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27 23:05 [PATCH v5 0/8] Enable HDA Codec support on Intel Platforms Pierre-Louis Bossart
2018-07-27 23:05 ` [PATCH v5 1/8] ASoC: Intel: Skylake: extend widget handling Pierre-Louis Bossart
2018-08-01  9:47   ` Mark Brown
2018-07-27 23:05 ` [PATCH v5 2/8] ASoC: Intel: common: add table for HDA-based platforms Pierre-Louis Bossart
2018-07-27 23:05 ` [PATCH v5 3/8] ASoC: Intel: Boards: Machine driver for SKL+ w/ HDAudio codecs Pierre-Louis Bossart
2018-08-01 10:04   ` Mark Brown
2018-07-27 23:05 ` Pierre-Louis Bossart [this message]
2018-07-27 23:05 ` [PATCH v5 5/8] ASoC: Intel: Skylake: add HDA BE DAIs Pierre-Louis Bossart
2018-07-27 23:05 ` [PATCH v5 6/8] ASoC: Intel: Skylake: use hda_bus instead of hdac_bus Pierre-Louis Bossart
2018-07-27 23:05 ` [PATCH v5 7/8] ASoC: hdac_hda: add asoc extension for legacy HDA codec drivers Pierre-Louis Bossart
2018-07-27 23:05 ` [PATCH v5 8/8] ASoC: Intel: Skylake: add option to control HDAudio + DSP usage Pierre-Louis Bossart
2018-07-31 10:48   ` Takashi Iwai
2018-07-31 16:06     ` Pierre-Louis Bossart
2018-07-31 16:20       ` Mark Brown
2018-08-01 14:50         ` Pierre-Louis Bossart

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=20180727230554.31027-5-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=rakesh.a.ughreja@intel.com \
    --cc=tiwai@suse.de \
    --cc=vkoul@kernel.org \
    /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.