alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Just <stephenjust@gmail.com>
To: patch@alsa-project.org
Cc: Vinod Koul <vinod.koul@intel.com>,
	alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Stephen Just <stephenjust@gmail.com>
Subject: [PATCH 2/3] ASoC: Intel: Atom: add quirk for CHT w/ RT5645
Date: Sun,  3 Jul 2016 23:06:06 -0600	[thread overview]
Message-ID: <20160704050607.32213-3-stephenjust@gmail.com> (raw)
In-Reply-To: <20160704045655.31198-1-stephenjust@gmail.com>

The Surface 3 uses an RT5645 audio codec, but the ACPI
identifier used is that for the RT5640. Use a DMI match
to override the driver_data provided by ACPI to workaround
ID conflict.

Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Stephen Just <stephenjust@gmail.com>
---
 sound/soc/intel/atom/sst/sst_acpi.c     | 29 ++++++++++++++++++++++++++++-
 sound/soc/intel/boards/cht_bsw_rt5645.c |  1 +
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c
index 3bc4b63..ef40608 100644
--- a/sound/soc/intel/atom/sst/sst_acpi.c
+++ b/sound/soc/intel/atom/sst/sst_acpi.c
@@ -19,6 +19,7 @@
  */
 
 #include <linux/module.h>
+#include <linux/dmi.h>
 #include <linux/fs.h>
 #include <linux/interrupt.h>
 #include <linux/slab.h>
@@ -131,6 +132,8 @@ static struct sst_platform_info chv_platform_data = {
 	.platform = "sst-mfld-platform",
 };
 
+static const struct dmi_system_id dmi_platform_quirk_table[];
+
 static int sst_platform_get_resources(struct intel_sst_drv *ctx)
 {
 	struct resource *rsrc;
@@ -224,6 +227,7 @@ static int sst_acpi_probe(struct platform_device *pdev)
 	struct platform_device *mdev;
 	struct platform_device *plat_dev;
 	struct sst_platform_info *pdata;
+	const struct dmi_system_id *dmi_match;
 	unsigned int dev_id;
 
 	id = acpi_match_device(dev->driver->acpi_match_table, dev);
@@ -231,7 +235,13 @@ static int sst_acpi_probe(struct platform_device *pdev)
 		return -ENODEV;
 	dev_dbg(dev, "for %s", id->id);
 
-	mach = (struct sst_acpi_mach *)id->driver_data;
+	/* check for quirk when getting driver_data */
+	dmi_match = dmi_first_match(dmi_platform_quirk_table);
+	if (dmi_match)
+		mach = (struct sst_acpi_mach *)dmi_match->driver_data;
+	else
+		mach = (struct sst_acpi_mach *)id->driver_data;
+
 	mach = sst_acpi_find_machine(mach);
 	if (mach == NULL) {
 		dev_err(dev, "No matching machine driver found\n");
@@ -345,7 +355,24 @@ static struct sst_acpi_mach sst_acpi_chv[] = {
 	/* some CHT-T platforms rely on RT5640, use Baytrail machine driver */
 	{"10EC5640", "bytcr_rt5640", "intel/fw_sst_22a8.bin", "bytcr_rt5640", NULL,
 						&chv_platform_data },
+	{},
+};
 
+static struct sst_acpi_mach sst_acpi_chv_quirk[] = {
+	/* some CHT-T platforms rely on RT5645 but use the ID from RT5640 */
+	{"10EC5640", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
+						&chv_platform_data },
+	{},
+};
+
+static const struct dmi_system_id dmi_platform_quirk_table[] = {
+	{
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
+		},
+		.driver_data = (unsigned long *) &sst_acpi_chv_quirk,
+	},
 	{},
 };
 
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index d7ef292..bf99efb 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -340,6 +340,7 @@ static struct snd_soc_card snd_soc_card_chtrt5650 = {
 };
 
 static struct cht_acpi_card snd_soc_cards[] = {
+	{"10EC5640", CODEC_TYPE_RT5645, &snd_soc_card_chtrt5645},
 	{"10EC5645", CODEC_TYPE_RT5645, &snd_soc_card_chtrt5645},
 	{"10EC5650", CODEC_TYPE_RT5650, &snd_soc_card_chtrt5650},
 };
-- 
2.7.4

  parent reply	other threads:[~2016-07-04  5:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-04  4:56 [PATCH 0/3] Add audio support for Microsoft Surface 3 tablet Stephen Just
2016-07-04  5:06 ` [PATCH 1/3] ASoC: rt5645: Add support for " Stephen Just
2016-07-08 12:31   ` Applied "ASoC: rt5645: Add ACPI ID 10EC5640" to the asoc tree Mark Brown
2016-07-04  5:06 ` Stephen Just [this message]
     [not found] ` <20160704050607.32213-4-stephenjust@gmail.com>
2016-07-04  8:58   ` [PATCH 3/3] [alsa-lib] conf/ucm: chtrt5645: Add UCM config for chtrt5645 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=20160704050607.32213-3-stephenjust@gmail.com \
    --to=stephenjust@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=patch@alsa-project.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=vinod.koul@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;
as well as URLs for NNTP newsgroup(s).