Add sound support

This commit is contained in:
Bastien Nocera 2016-07-19 14:07:19 +02:00
parent 4fb17af00d
commit 301ce22ee9
4 changed files with 425 additions and 0 deletions

View File

@ -0,0 +1,33 @@
From 5d554ea4f287665b839975ecb11bd29d49a5c9b5 Mon Sep 17 00:00:00 2001
From: Vinod Koul <vinod.koul@intel.com>
Date: Fri, 8 Jul 2016 18:30:17 +0530
Subject: ASoC: Intel: cht: fix uninit variable warning
Kbuild bot reports that we might use dai_index uninitialized.
sound/soc/intel/boards/cht_bsw_rt5645.c:391:37: warning: 'dai_index' may be used uninitialized in this function [-Wmaybe-uninitialized]
Since it is theoretically possible, set it while initializing.
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/intel/boards/cht_bsw_rt5645.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index f26c7b8..56056ed 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -357,7 +357,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
char codec_name[16];
struct sst_acpi_mach *mach;
const char *i2c_name = NULL;
- int dai_index;
+ int dai_index = 0;
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_ATOMIC);
if (!drv)
--
cgit v0.12

View File

@ -0,0 +1,32 @@
From 24dad509ed5528bbbe31ff17f9fb39c0473ec8f4 Mon Sep 17 00:00:00 2001
From: Vinod Koul <vinod.koul@intel.com>
Date: Fri, 8 Jul 2016 18:30:18 +0530
Subject: ASoC: Intel: atom: statify cht_quirk
Sparse rightly warns:
sound/soc/intel/atom/sst/sst_acpi.c:353:22: warning: symbol 'cht_quirk' was not declared. Should it be static?
So statify this
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/intel/atom/sst/sst_acpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c
index 82a374d..4d31849 100644
--- a/sound/soc/intel/atom/sst/sst_acpi.c
+++ b/sound/soc/intel/atom/sst/sst_acpi.c
@@ -350,7 +350,7 @@ static struct sst_acpi_mach cht_surface_mach = {
"10EC5640", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
&chv_platform_data };
-struct sst_acpi_mach *cht_quirk(void *arg)
+static struct sst_acpi_mach *cht_quirk(void *arg)
{
struct sst_acpi_mach *mach = arg;
--
cgit v0.12

View File

@ -0,0 +1,356 @@
From vinod.koul@intel.com Fri Jul 8 12:03:22 2016
Return-Path: <vinod.koul@intel.com>
Delivered-To: hadess@hadess.net
Received: from spool.mail.gandi.net (mspool1-d.mgt.gandi.net [10.0.21.131])
by nmboxes111.sd2.0x35.net (Postfix) with ESMTP id 79E3B21C96
for <hadess@hadess.net>; Fri, 8 Jul 2016 12:03:22 +0200 (CEST)
Received: from mfilter40-d.gandi.net (mfilter40-d.gandi.net
[217.70.178.171]) by spool.mail.gandi.net (Postfix) with ESMTP id
700992260FC for <hadess@hadess.net>; Fri, 8 Jul 2016 12:03:22 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at mfilter40-d.gandi.net
Received: from spool.mail.gandi.net ([IPv6:::ffff:10.0.21.131]) by
mfilter40-d.gandi.net (mfilter40-d.gandi.net [::ffff:10.0.15.180])
(amavisd-new, port 10024) with ESMTP id qK5K-waPj4Ol for
<hadess@hadess.net>; Fri, 8 Jul 2016 12:03:20 +0200 (CEST)
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
by spool.mail.gandi.net (Postfix) with ESMTP id D6DE42260D7
for <bugzilla@hadess.net>; Fri, 8 Jul 2016 12:03:09 +0200 (CEST)
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
by fmsmga103.fm.intel.com with ESMTP; 08 Jul 2016 03:02:59 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.28,329,1464678000";
d="scan'208";a="731352416"
Received: from vkoul-udesk7.iind.intel.com ([10.223.84.143])
by FMSMGA003.fm.intel.com with ESMTP; 08 Jul 2016 03:02:55 -0700
From: Vinod Koul <vinod.koul@intel.com>
To: alsa-devel@alsa-project.org
Cc: broonie@kernel.org,
liam.r.girdwood@linux.intel.com,
patches.audio@intel.com,
Stephen Just <stephenjust@gmail.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
apterix@gmail.com,
bugzilla@hadess.net,
Vinod Koul <vinod.koul@intel.com>,
Sachin Mokashi <sachinx.mokashi@intel.com>
Subject: [PATCH 1/3] ASoC: Intel: Atom: Add quirk for Surface 3
Date: Fri, 8 Jul 2016 15:39:49 +0530
Message-Id: <1467972591-29175-2-git-send-email-vinod.koul@intel.com>
X-Mailer: git-send-email 1.9.1
In-Reply-To: <1467972591-29175-1-git-send-email-vinod.koul@intel.com>
References: <1467972591-29175-1-git-send-email-vinod.koul@intel.com>
X-Evolution-Source: 1353784233.13280.3@sirocco.hadess.net
Content-Transfer-Encoding: 8bit
Mime-Version: 1.0
Surface 3 is CHT based device which shows up with RT5645 codec. But the
BIOS reports ACPI ID as 5640!
To solve this, add a DMI overide for cht-5640 machine.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98001
Signed-off-by: Sachin Mokashi <sachinx.mokashi@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/atom/sst/sst_acpi.c | 44 ++++++++++++++++++++++++++++++++++++-
sound/soc/intel/common/sst-acpi.h | 2 +-
2 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/sound/soc/intel/atom/sst/sst_acpi.c b/sound/soc/intel/atom/sst/sst_acpi.c
index 3bc4b63b2f9d..82a374d885a7 100644
--- a/sound/soc/intel/atom/sst/sst_acpi.c
+++ b/sound/soc/intel/atom/sst/sst_acpi.c
@@ -28,6 +28,7 @@
#include <linux/firmware.h>
#include <linux/pm_runtime.h>
#include <linux/pm_qos.h>
+#include <linux/dmi.h>
#include <linux/acpi.h>
#include <asm/platform_sst_audio.h>
#include <sound/core.h>
@@ -237,6 +238,9 @@ static int sst_acpi_probe(struct platform_device *pdev)
dev_err(dev, "No matching machine driver found\n");
return -ENODEV;
}
+ if (mach->machine_quirk)
+ mach = mach->machine_quirk(mach);
+
pdata = mach->pdata;
ret = kstrtouint(id->id, 16, &dev_id);
@@ -320,6 +324,44 @@ static int sst_acpi_remove(struct platform_device *pdev)
return 0;
}
+static unsigned long cht_machine_id;
+
+#define CHT_SURFACE_MACH 1
+
+static int cht_surface_quirk_cb(const struct dmi_system_id *id)
+{
+ cht_machine_id = CHT_SURFACE_MACH;
+ return 1;
+}
+
+
+static const struct dmi_system_id cht_table[] = {
+ {
+ .callback = cht_surface_quirk_cb,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
+ },
+ },
+};
+
+
+static struct sst_acpi_mach cht_surface_mach = {
+ "10EC5640", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
+ &chv_platform_data };
+
+struct sst_acpi_mach *cht_quirk(void *arg)
+{
+ struct sst_acpi_mach *mach = arg;
+
+ dmi_check_system(cht_table);
+
+ if (cht_machine_id == CHT_SURFACE_MACH)
+ return &cht_surface_mach;
+ else
+ return mach;
+}
+
static struct sst_acpi_mach sst_acpi_bytcr[] = {
{"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
&byt_rvp_platform_data },
@@ -343,7 +385,7 @@ static struct sst_acpi_mach sst_acpi_chv[] = {
{"193C9890", "cht-bsw-max98090", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
&chv_platform_data },
/* some CHT-T platforms rely on RT5640, use Baytrail machine driver */
- {"10EC5640", "bytcr_rt5640", "intel/fw_sst_22a8.bin", "bytcr_rt5640", NULL,
+ {"10EC5640", "bytcr_rt5640", "intel/fw_sst_22a8.bin", "bytcr_rt5640", cht_quirk,
&chv_platform_data },
{},
diff --git a/sound/soc/intel/common/sst-acpi.h b/sound/soc/intel/common/sst-acpi.h
index 8398cb227ba9..504b0e4fedd4 100644
--- a/sound/soc/intel/common/sst-acpi.h
+++ b/sound/soc/intel/common/sst-acpi.h
@@ -40,6 +40,6 @@ struct sst_acpi_mach {
/* board name */
const char *board;
- void (*machine_quirk)(void);
+ struct sst_acpi_mach * (*machine_quirk)(void *arg);
void *pdata;
};
--
1.9.1
From vinod.koul@intel.com Fri Jul 8 12:03:22 2016
Return-Path: <vinod.koul@intel.com>
Delivered-To: hadess@hadess.net
Received: from spool.mail.gandi.net (mspool1-d.mgt.gandi.net [10.0.21.131])
by nmboxes111.sd2.0x35.net (Postfix) with ESMTP id 94C7121C96
for <hadess@hadess.net>; Fri, 8 Jul 2016 12:03:22 +0200 (CEST)
Received: from mfilter49-d.gandi.net (mfilter49-d.gandi.net
[217.70.178.180]) by spool.mail.gandi.net (Postfix) with ESMTP id
9155C226069 for <hadess@hadess.net>; Fri, 8 Jul 2016 12:03:22 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at mfilter49-d.gandi.net
Received: from spool.mail.gandi.net ([IPv6:::ffff:10.0.21.131]) by
mfilter49-d.gandi.net (mfilter49-d.gandi.net [::ffff:10.0.15.180])
(amavisd-new, port 10024) with ESMTP id DHVDC0Ilq6FQ for
<hadess@hadess.net>; Fri, 8 Jul 2016 12:03:20 +0200 (CEST)
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
by spool.mail.gandi.net (Postfix) with ESMTP id 709442260E5
for <bugzilla@hadess.net>; Fri, 8 Jul 2016 12:03:10 +0200 (CEST)
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
by fmsmga103.fm.intel.com with ESMTP; 08 Jul 2016 03:03:02 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.28,329,1464678000";
d="scan'208";a="731352436"
Received: from vkoul-udesk7.iind.intel.com ([10.223.84.143])
by FMSMGA003.fm.intel.com with ESMTP; 08 Jul 2016 03:02:58 -0700
From: Vinod Koul <vinod.koul@intel.com>
To: alsa-devel@alsa-project.org
Cc: broonie@kernel.org,
liam.r.girdwood@linux.intel.com,
patches.audio@intel.com,
Stephen Just <stephenjust@gmail.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
apterix@gmail.com,
bugzilla@hadess.net,
Vinod Koul <vinod.koul@intel.com>,
Sachin Mokashi <sachinx.mokashi@intel.com>
Subject: [PATCH 2/3] ASoC: rt5645: Add ACPI ID 10EC5640
Date: Fri, 8 Jul 2016 15:39:50 +0530
Message-Id: <1467972591-29175-3-git-send-email-vinod.koul@intel.com>
X-Mailer: git-send-email 1.9.1
In-Reply-To: <1467972591-29175-1-git-send-email-vinod.koul@intel.com>
References: <1467972591-29175-1-git-send-email-vinod.koul@intel.com>
X-Evolution-Source: 1353784233.13280.3@sirocco.hadess.net
Content-Transfer-Encoding: 8bit
Mime-Version: 1.0
Some CHT platforms use RT5645 codec which has entry 10EC5640 so add it.
Also add DMI quirk for jack detection.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98001
Signed-off-by: Sachin Mokashi <sachinx.mokashi@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
[Jack detection]
Suggested-by: Stephen Just <stephenjust@gmail.com>
---
sound/soc/codecs/rt5645.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 3c6594da6c9c..761ca88c4cdd 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3531,6 +3531,7 @@ MODULE_DEVICE_TABLE(i2c, rt5645_i2c_id);
static const struct acpi_device_id rt5645_acpi_match[] = {
{ "10EC5645", 0 },
{ "10EC5650", 0 },
+ { "10EC5640", 0 },
{},
};
MODULE_DEVICE_TABLE(acpi, rt5645_acpi_match);
@@ -3561,6 +3562,12 @@ static const struct dmi_system_id dmi_platform_intel_braswell[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"),
},
},
+ {
+ .ident = "Microsoft Surface 3",
+ .matches = {
+ DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
+ },
+ },
{ }
};
--
1.9.1
From vinod.koul@intel.com Fri Jul 8 12:03:25 2016
Return-Path: <vinod.koul@intel.com>
Delivered-To: hadess@hadess.net
Received: from spool.mail.gandi.net (mspool7-d.mgt.gandi.net [10.0.21.138])
by nmboxes111.sd2.0x35.net (Postfix) with ESMTP id E535621C96
for <hadess@hadess.net>; Fri, 8 Jul 2016 12:03:25 +0200 (CEST)
Received: from mfilter17-d.gandi.net (mfilter17-d.gandi.net
[217.70.178.145]) by spool.mail.gandi.net (Postfix) with ESMTP id
E2A5419F3BC for <hadess@hadess.net>; Fri, 8 Jul 2016 12:03:25 +0200 (CEST)
X-Virus-Scanned: Debian amavisd-new at mfilter17-d.gandi.net
Received: from spool.mail.gandi.net ([IPv6:::ffff:10.0.21.138]) by
mfilter17-d.gandi.net (mfilter17-d.gandi.net [::ffff:10.0.15.180])
(amavisd-new, port 10024) with ESMTP id iqTV1YWaYo1Y for
<hadess@hadess.net>; Fri, 8 Jul 2016 12:03:24 +0200 (CEST)
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115])
by spool.mail.gandi.net (Postfix) with ESMTP id E5E3A19F3E5
for <bugzilla@hadess.net>; Fri, 8 Jul 2016 12:03:10 +0200 (CEST)
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
by fmsmga103.fm.intel.com with ESMTP; 08 Jul 2016 03:03:05 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.28,329,1464678000";
d="scan'208";a="731352499"
Received: from vkoul-udesk7.iind.intel.com ([10.223.84.143])
by FMSMGA003.fm.intel.com with ESMTP; 08 Jul 2016 03:03:02 -0700
From: Vinod Koul <vinod.koul@intel.com>
To: alsa-devel@alsa-project.org
Cc: broonie@kernel.org,
liam.r.girdwood@linux.intel.com,
patches.audio@intel.com,
Stephen Just <stephenjust@gmail.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
apterix@gmail.com,
bugzilla@hadess.net,
Vinod Koul <vinod.koul@intel.com>,
Sachin Mokashi <sachinx.mokashi@intel.com>
Subject: [PATCH 3/3] ASoC: Intel: Add surface3 entry in CHT-RT5645 machine
Date: Fri, 8 Jul 2016 15:39:51 +0530
Message-Id: <1467972591-29175-4-git-send-email-vinod.koul@intel.com>
X-Mailer: git-send-email 1.9.1
In-Reply-To: <1467972591-29175-1-git-send-email-vinod.koul@intel.com>
References: <1467972591-29175-1-git-send-email-vinod.koul@intel.com>
X-Evolution-Source: 1353784233.13280.3@sirocco.hadess.net
Content-Transfer-Encoding: 8bit
Mime-Version: 1.0
Surface3 device is a CHT machine, so add entry for it.
Also update the HID from BIOS.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=98001
Signed-off-by: Sachin Mokashi <sachinx.mokashi@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
sound/soc/intel/boards/cht_bsw_rt5645.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index d7ef292c402d..f26c7b8545ae 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -30,6 +30,7 @@
#include <sound/jack.h>
#include "../../codecs/rt5645.h"
#include "../atom/sst-atom-controls.h"
+#include "../common/sst-acpi.h"
#define CHT_PLAT_CLK_3_HZ 19200000
#define CHT_CODEC_DAI "rt5645-aif1"
@@ -340,10 +341,13 @@ 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},
};
+static char cht_rt5640_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */
+
static int snd_cht_mc_probe(struct platform_device *pdev)
{
int ret_val = 0;
@@ -351,6 +355,9 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
struct cht_mc_private *drv;
struct snd_soc_card *card = snd_soc_cards[0].soc_card;
char codec_name[16];
+ struct sst_acpi_mach *mach;
+ const char *i2c_name = NULL;
+ int dai_index;
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_ATOMIC);
if (!drv)
@@ -366,12 +373,23 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
}
}
card->dev = &pdev->dev;
+ mach = card->dev->platform_data;
sprintf(codec_name, "i2c-%s:00", drv->acpi_card->codec_id);
/* set correct codec name */
for (i = 0; i < ARRAY_SIZE(cht_dailink); i++)
- if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00"))
+ if (!strcmp(card->dai_link[i].codec_name, "i2c-10EC5645:00")) {
card->dai_link[i].codec_name = kstrdup(codec_name, GFP_KERNEL);
+ dai_index = i;
+ }
+
+ /* fixup codec name based on HID */
+ i2c_name = sst_acpi_find_name_from_hid(mach->id);
+ if (i2c_name != NULL) {
+ snprintf(cht_rt5640_codec_name, sizeof(cht_rt5640_codec_name),
+ "%s%s", "i2c-", i2c_name);
+ cht_dailink[dai_index].codec_name = cht_rt5640_codec_name;
+ }
snd_soc_card_set_drvdata(card, drv);
ret_val = devm_snd_soc_register_card(&pdev->dev, card);
--
1.9.1

View File

@ -655,6 +655,10 @@ Patch915: 0001-WIP-acpi-button-remove-pointer-to-old-lid_sysfs-on-u.patch
Patch916: 0001-WIP-i2c-hid-enabled-S0-S3.patch
Patch917: 0002-WIP-add-custom-surface3-platform-device-for-controll.patch
Patch918: ASoC_Intel_Add_support_for_surface3_tablet.patch
Patch919: 07d5c17b80f67d1b2cc2c8243590e2abed4bd7ae..5d554ea4f287665b839975ecb11bd29d49a5c9b5.patch
Patch920: 5d554ea4f287665b839975ecb11bd29d49a5c9b5..24dad509ed5528bbbe31ff17f9fb39c0473ec8f4.patch
# END OF PATCH DEFINITIONS
%endif