Skip to contentSkip to conversation

Support for CherryTrail devices

PATCH In review Pierre-Louis Bossart 3 participants 19 messages Mar 4, 2016 – Mar 10, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Support for CherryTrail devices

Fix dependency on DW_DMAC_CORE
Fix BIOS issues with better ACPI filtering for active devices Change codec name based on filtered HID
Re-use bytcr-rt5640 driver

Tested on Tronsmart Ara x5 (CHT, headset only) and Asus T100TA (BYT) to make sure nothing was broken

Thanks to Mika Westerberg for his support on ACPI

Pierre-Louis Bossart (6):
ASoC: Intel: allow for DW_DMAC_CORE as module
ASoC: Intel: common: filter ACPI devices with _STA return value
ASoC: Intel: common: add translation from HID to codec-name
ASoC: Intel: bytcr_rt5640: change quirk position
ASoC: Intel: bytcr_rt5640: use HID translation util
ASoC: Intel: Atom: add support for CHT w/ RT5640

 sound/soc/intel/Kconfig                 |  4 +--
 sound/soc/intel/atom/sst/sst_acpi.c     |  4 +++
 sound/soc/intel/boards/bytcr_rt5640.c   | 50 +++++++++++++++++++++----------
 sound/soc/intel/common/sst-acpi.h       |  3 ++
 sound/soc/intel/common/sst-match-acpi.c | 53 +++++++++++++++++++++++++++++++--
 5 files changed, 94 insertions(+), 20 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/6 ASoC: Intel: allow for DW_DMAC_CORE as module

DW_DMAC_CORE can be built as a module, change Kconfig rules to keep Baytrail legacy drivers selectable

---
 sound/soc/intel/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/intel/Kconfig +2 -2
index b3e6c23..9c01a18 100644
@@ -61,7 +61,7 @@ config SND_SOC_INTEL_HASWELL_MACH
 config SND_SOC_INTEL_BYT_RT5640_MACH
 	tristate "ASoC Audio driver for Intel Baytrail with RT5640 codec"
 	depends on X86_INTEL_LPSS && I2C
-	depends on DW_DMAC_CORE=y && (SND_SST_IPC_ACPI = n)
+	depends on (DW_DMAC_CORE != n) && (SND_SST_IPC_ACPI = n)
 	select SND_SOC_INTEL_SST
 	select SND_SOC_INTEL_BAYTRAIL
 	select SND_SOC_RT5640
@@ -73,7 +73,7 @@ config SND_SOC_INTEL_BYT_RT5640_MACH
 config SND_SOC_INTEL_BYT_MAX98090_MACH
 	tristate "ASoC Audio driver for Intel Baytrail with MAX98090 codec"
 	depends on X86_INTEL_LPSS && I2C
-	depends on DW_DMAC_CORE=y && (SND_SST_IPC_ACPI = n)
+	depends on (DW_DMAC_CORE != n) && (SND_SST_IPC_ACPI = n)
 	select SND_SOC_INTEL_SST
 	select SND_SOC_INTEL_BAYTRAIL
 	select SND_SOC_MAX98090
Signature · 1 line
1.9.1
maintainer
#2 lore raw

Re: [PATCH 1/6] ASoC: Intel: allow for DW_DMAC_CORE as module

Review

Quoted 2 lines · Pierre-Louis Bossart
(quoted diff) +1 -1
-	depends on DW_DMAC_CORE=y && (SND_SST_IPC_ACPI = n)
+	depends on (DW_DMAC_CORE != n) && (SND_SST_IPC_ACPI = n)

What is the expected difference between a dependency on DW_DMAC_CORE and one on DW_DMAC_CORE != n?

#3 lore raw

Re: [PATCH 1/6] ASoC: Intel: allow for DW_DMAC_CORE as module

Quoted 7 lines · Mark Brown

Review

Quoted 2 lines · Pierre-Louis Bossart
(quoted diff) +1 -1
-	depends on DW_DMAC_CORE=y && (SND_SST_IPC_ACPI = n)
+	depends on (DW_DMAC_CORE != n) && (SND_SST_IPC_ACPI = n)

What is the expected difference between a dependency on DW_DMAC_CORE and one on DW_DMAC_CORE != n?

No functional difference, it's more to make the menuconfig options more obvious.
Without this patch, menuconfig will not show the legacy byt-max98090 and byt-rt5640 options if the DW_DMAC_CORE is built as a module. While we want to encourage folks to use the newer DPCM drivers, we also want to leave these options accessible.

maintainer
#4 lore raw

Re: [PATCH 1/6] ASoC: Intel: allow for DW_DMAC_CORE as module

Quoted 9 lines · Pierre-Louis Bossart
Quoted 7 lines · Mark Brown

Review

Quoted 2 lines · Pierre-Louis Bossart
(quoted diff) +1 -1
-	depends on DW_DMAC_CORE=y && (SND_SST_IPC_ACPI = n)
+	depends on (DW_DMAC_CORE != n) && (SND_SST_IPC_ACPI = n)

What is the expected difference between a dependency on DW_DMAC_CORE and one on DW_DMAC_CORE != n?

Quoted 6 lines

No functional difference, it's more to make the menuconfig options more obvious.
Without this patch, menuconfig will not show the legacy byt-max98090 and byt-rt5640 options if the DW_DMAC_CORE is built as a module. While we want to encourage folks to use the newer DPCM drivers, we also want to leave these options accessible.

My point is that you've written the above in a very confusing manner - I have to think about what it means while just a dependency would be clear and obvious.

#5 lore raw

Re: [PATCH 1/6] ASoC: Intel: allow for DW_DMAC_CORE as module

Quoted 17 lines · Mark Brown
Quoted 9 lines · Pierre-Louis Bossart
Quoted 7 lines · Mark Brown

Review

Quoted 2 lines · Pierre-Louis Bossart
(quoted diff) +1 -1
-	depends on DW_DMAC_CORE=y && (SND_SST_IPC_ACPI = n)
+	depends on (DW_DMAC_CORE != n) && (SND_SST_IPC_ACPI = n)

What is the expected difference between a dependency on DW_DMAC_CORE and one on DW_DMAC_CORE != n?

Quoted 6 lines

No functional difference, it's more to make the menuconfig options more obvious.
Without this patch, menuconfig will not show the legacy byt-max98090 and byt-rt5640 options if the DW_DMAC_CORE is built as a module. While we want to encourage folks to use the newer DPCM drivers, we also want to leave these options accessible.

Quoted 3 lines

My point is that you've written the above in a very confusing manner - I have to think about what it means while just a dependency would be clear and obvious.

Are you asking about the intent/functionality or just a simplification to do this (un-tested):
depends on DW_DMAC_CORE && (SND_SST_IPC_ACPI = n)

#6 lore raw

Re: [PATCH 1/6] ASoC: Intel: allow for DW_DMAC_CORE as module

Quoted 19 lines · Pierre-Louis Bossart
Quoted 17 lines · Mark Brown
Quoted 15 lines · Pierre-Louis Bossart
Quoted 7 lines · Mark Brown

Review

Quoted 2 lines · Pierre-Louis Bossart
(quoted diff) +1 -1
-	depends on DW_DMAC_CORE=y && (SND_SST_IPC_ACPI = n)
+	depends on (DW_DMAC_CORE != n) && (SND_SST_IPC_ACPI = n)

What is the expected difference between a dependency on DW_DMAC_CORE and one on DW_DMAC_CORE != n?

No functional difference, it's more to make the menuconfig options more obvious.
Without this patch, menuconfig will not show the legacy byt-max98090 and byt-rt5640 options if the DW_DMAC_CORE is built as a module. While we want to encourage folks to use the newer DPCM drivers, we also want to leave these options accessible.

Quoted 7 lines
Quoted 3 lines

My point is that you've written the above in a very confusing manner - I have to think about what it means while just a dependency would be clear and obvious.

Are you asking about the intent/functionality or just a simplification to do this (un-tested):
depends on DW_DMAC_CORE && (SND_SST_IPC_ACPI = n)

A=n is usually written like !A, too. So a simpler form would be

  depends on DW_DMAC_CORE && !SND_SST_IPC_ACPI

Takashi

maintainer
#7 lore raw

Re: [PATCH 1/6] ASoC: Intel: allow for DW_DMAC_CORE as module

Quoted 6 lines · Takashi Iwai
Quoted 3 lines · Pierre-Louis Bossart
Quoted 3 lines

My point is that you've written the above in a very confusing manner - I have to think about what it means while just a dependency would be clear and obvious.

Quoted 7 lines
Quoted 3 lines

Are you asking about the intent/functionality or just a simplification to do this (un-tested):
depends on DW_DMAC_CORE && (SND_SST_IPC_ACPI = n)

A=n is usually written like !A, too. So a simpler form would be

  depends on DW_DMAC_CORE && !SND_SST_IPC_ACPI

Right, that was what I was looking for - the way the patch was written was really obscure.

#8 lore raw

PATCH 2/6 ASoC: Intel: common: filter ACPI devices with _STA return value

In reply to Pierre-Louis Bossart

BIOS vendors typically list multiple audio codecs in the DSDT table and enable the relevant one by changing the return value of the _STA method.

With the current code, all devices are reported by acpi_dev_present(), regardless of the _STA return values. This causes errors on probe with the wrong machine driver being loaded.

This patch essentially reverts 'commit 6f08cbdaac5a ("ASoC: Intel: Use acpi_dev_present()")' and adds code to force the evaluation of the _STA method.

A better solution might be to make sure the ACPI subsystem only reports devices with a _STA value of 0xf but apparently it's problematic so dealing with this in the audio subsystem directly.

---
 sound/soc/intel/common/sst-match-acpi.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
sound/soc/intel/common/sst-match-acpi.c +18 -2
index 0b8ee04..7452360 100644
@@ -16,14 +16,30 @@
 
 #include "sst-acpi.h"
 
+static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
+				       void *context, void **ret)
+{
+	unsigned long long sta;
+	acpi_status status;
+
+	*(bool *)context = true;
+	status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
+	if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
+		*(bool *)context = false;
+
+	return AE_OK;
+}
+
 struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
 {
 	struct sst_acpi_mach *mach;
+	bool found = false;
 
 	for (mach = machines; mach->id[0]; mach++)
-		if (acpi_dev_present(mach->id))
+		if (ACPI_SUCCESS(acpi_get_devices(mach->id,
+						  sst_acpi_mach_match,
+						  &found, NULL)) && found)
 			return mach;
-
 	return NULL;
 }
 EXPORT_SYMBOL_GPL(sst_acpi_find_machine);
Signature · 1 line
1.9.1
maintainer
#9 lore raw

Applied "ASoC: Intel: common: filter ACPI devices with _STA return value" to the asoc tree

The patch

ASoC: Intel: common: filter ACPI devices with _STA return value

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From cab473850226c3e41823453b5b80eb294dae6e0c Mon Sep 17 00:00:00 2001

From: Pierre-Louis Bossart <[email protected]>
Date: Thu, 3 Mar 2016 21:36:34 -0600
Subject: [PATCH] ASoC: Intel: common: filter ACPI devices with _STA return
value

BIOS vendors typically list multiple audio codecs in the DSDT table and enable the relevant one by changing the return value of the _STA method.

With the current code, all devices are reported by acpi_dev_present(), regardless of the _STA return values. This causes errors on probe with the wrong machine driver being loaded.

This patch essentially reverts 'commit 6f08cbdaac5a ("ASoC: Intel: Use acpi_dev_present()")' and adds code to force the evaluation of the _STA method.

A better solution might be to make sure the ACPI subsystem only reports devices with a _STA value of 0xf but apparently it's problematic so dealing with this in the audio subsystem directly.

---
 sound/soc/intel/common/sst-match-acpi.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
sound/soc/intel/common/sst-match-acpi.c +18 -2
index c429e2226d40..cf2c27cd8651 100644
@@ -16,14 +16,30 @@
 
 #include "sst-acpi.h"
 
+static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
+				       void *context, void **ret)
+{
+	unsigned long long sta;
+	acpi_status status;
+
+	*(bool *)context = true;
+	status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
+	if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
+		*(bool *)context = false;
+
+	return AE_OK;
+}
+
 struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
 {
 	struct sst_acpi_mach *mach;
+	bool found = false;
 
 	for (mach = machines; mach->id[0]; mach++)
-		if (acpi_dev_present(mach->id))
+		if (ACPI_SUCCESS(acpi_get_devices(mach->id,
+						  sst_acpi_mach_match,
+						  &found, NULL)) && found)
 			return mach;
-
 	return NULL;
 }
 EXPORT_SYMBOL_GPL(sst_acpi_find_machine);
Signature · 1 line
2.7.0
#10 lore raw

PATCH 2/6 ASoC: Intel: filter ACPI devices based on _STA return value

In reply to Pierre-Louis Bossart

BIOS vendors typically list multiple audio codecs in the DSDT table and enable the relevant one by changing the return value of the _STA method.

With the current code, all devices are reported by acpi_dev_present(), regardless of the _STA return values. This causes errors on probe with the wrong machine driver being loaded.

This patch essentially reverts 'commit 6f08cbdaac5a ("ASoC: Intel: Use acpi_dev_present()")' and adds code to force the evaluation of the _STA method.

A better solution might be to make sure the ACPI subsystem only reports devices with a _STA value of 0xf but apparently it's problematic so dealing with this in the audio subsystem directly.

---
 sound/soc/intel/common/sst-match-acpi.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
sound/soc/intel/common/sst-match-acpi.c +18 -2
index 0b8ee04..7452360 100644
@@ -16,14 +16,30 @@
 
 #include "sst-acpi.h"
 
+static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
+				       void *context, void **ret)
+{
+	unsigned long long sta;
+	acpi_status status;
+
+	*(bool *)context = true;
+	status = acpi_evaluate_integer(handle, "_STA", NULL, &sta);
+	if (ACPI_FAILURE(status) || !(sta & ACPI_STA_DEVICE_PRESENT))
+		*(bool *)context = false;
+
+	return AE_OK;
+}
+
 struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
 {
 	struct sst_acpi_mach *mach;
+	bool found = false;
 
 	for (mach = machines; mach->id[0]; mach++)
-		if (acpi_dev_present(mach->id))
+		if (ACPI_SUCCESS(acpi_get_devices(mach->id,
+						  sst_acpi_mach_match,
+						  &found, NULL)) && found)
 			return mach;
-
 	return NULL;
 }
 EXPORT_SYMBOL_GPL(sst_acpi_find_machine);
Signature · 1 line
1.9.1
#11 lore raw

PATCH 3/6 ASoC: Intel: common: add translation from HID to codec-name

In reply to Pierre-Louis Bossart

BIOS vendors sometimes declare multiple devices in the DSDT table that all refer to the same HID. This is not very smart but not illegal as long as only one device reports present with the _STA method. The ACPI subsystem tracks each device with an extension, e.g. 10EC5640:00 and 10EC5640:01

In the ASoC machine driver, the DAI codec name needs to refer to the ACPI device that reported present, e.g. "i2c-10EC5640:01". The extension will vary depending on how the BIOS is written and which ACPI device is activated.

This patch adds a translation function that provides the codec name from the ACPI HID to avoid any hard-coded values in the machine driver.

---
 sound/soc/intel/common/sst-acpi.h       |  3 +++
 sound/soc/intel/common/sst-match-acpi.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
sound/soc/intel/common/sst-acpi.h +3 -0
index 3ee3b7a..4dcfb7e 100644
@@ -14,6 +14,9 @@
 
 #include <linux/acpi.h>
 
+/* translation fron HID to I2C name, needed for DAI codec_name */
+const char *sst_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN]);
+
 /* acpi match */
 struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines);
 
sound/soc/intel/common/sst-match-acpi.c +33 -0
index 7452360..7898433 100644
@@ -16,6 +16,39 @@
 
 #include "sst-acpi.h"
 
+static acpi_status sst_acpi_find_name(acpi_handle handle, u32 level,
+				      void *context, void **ret)
+{
+	struct acpi_device *adev;
+	const char *name = NULL;
+
+	if (acpi_bus_get_device(handle, &adev))
+		return AE_OK;
+
+	if (adev->status.present && adev->status.functional) {
+		name = acpi_dev_name(adev);
+		*(const char **)ret = name;
+		return AE_CTRL_TERMINATE;
+	}
+
+	return AE_OK;
+}
+
+const char *sst_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN])
+{
+	const char *name = NULL;
+	acpi_status status;
+
+	status = acpi_get_devices(hid, sst_acpi_find_name, NULL,
+				  (void **)&name);
+
+	if (ACPI_FAILURE(status) || name[0] == '\0')
+		return NULL;
+
+	return name;
+}
+EXPORT_SYMBOL_GPL(sst_acpi_find_name_from_hid);
+
 static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
 				       void *context, void **ret)
 {
Signature · 1 line
1.9.1
maintainer
#12 lore raw

Applied "ASoC: Intel: common: add translation from HID to codec-name" to the asoc tree

The patch

ASoC: Intel: common: add translation from HID to codec-name

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 1fdb7c14a24689e9c7ec51aa16a3970a7ec0fdde Mon Sep 17 00:00:00 2001

From: Pierre-Louis Bossart <[email protected]>
Date: Thu, 3 Mar 2016 21:36:36 -0600
Subject: [PATCH] ASoC: Intel: common: add translation from HID to codec-name

BIOS vendors sometimes declare multiple devices in the DSDT table that all refer to the same HID. This is not very smart but not illegal as long as only one device reports present with the _STA method. The ACPI subsystem tracks each device with an extension, e.g. 10EC5640:00 and 10EC5640:01

In the ASoC machine driver, the DAI codec name needs to refer to the ACPI device that reported present, e.g. "i2c-10EC5640:01". The extension will vary depending on how the BIOS is written and which ACPI device is activated.

This patch adds a translation function that provides the codec name from the ACPI HID to avoid any hard-coded values in the machine driver.

---
 sound/soc/intel/common/sst-acpi.h       |  3 +++
 sound/soc/intel/common/sst-match-acpi.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
sound/soc/intel/common/sst-acpi.h +3 -0
index 3ee3b7ab5d03..4dcfb7e5ed70 100644
@@ -14,6 +14,9 @@
 
 #include <linux/acpi.h>
 
+/* translation fron HID to I2C name, needed for DAI codec_name */
+const char *sst_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN]);
+
 /* acpi match */
 struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines);
 
sound/soc/intel/common/sst-match-acpi.c +33 -0
index cf2c27cd8651..2c0e7fca97db 100644
@@ -16,6 +16,39 @@
 
 #include "sst-acpi.h"
 
+static acpi_status sst_acpi_find_name(acpi_handle handle, u32 level,
+				      void *context, void **ret)
+{
+	struct acpi_device *adev;
+	const char *name = NULL;
+
+	if (acpi_bus_get_device(handle, &adev))
+		return AE_OK;
+
+	if (adev->status.present && adev->status.functional) {
+		name = acpi_dev_name(adev);
+		*(const char **)ret = name;
+		return AE_CTRL_TERMINATE;
+	}
+
+	return AE_OK;
+}
+
+const char *sst_acpi_find_name_from_hid(const u8 hid[ACPI_ID_LEN])
+{
+	const char *name = NULL;
+	acpi_status status;
+
+	status = acpi_get_devices(hid, sst_acpi_find_name, NULL,
+				  (void **)&name);
+
+	if (ACPI_FAILURE(status) || name[0] == '\0')
+		return NULL;
+
+	return name;
+}
+EXPORT_SYMBOL_GPL(sst_acpi_find_name_from_hid);
+
 static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
 				       void *context, void **ret)
 {
Signature · 1 line
2.7.0
#13 lore raw

PATCH 4/6 ASoC: Intel: bytcr_rt5640: change quirk position

In reply to Pierre-Louis Bossart

No added functionality

---
 sound/soc/intel/boards/bytcr_rt5640.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)
sound/soc/intel/boards/bytcr_rt5640.c +15 -13
index 9a1752d..a06cd1f 100644
@@ -32,6 +32,18 @@
 #include "../atom/sst-atom-controls.h"
 #include "../common/sst-acpi.h"
 
+enum {
+	BYT_RT5640_DMIC1_MAP,
+	BYT_RT5640_DMIC2_MAP,
+	BYT_RT5640_IN1_MAP,
+};
+
+#define BYT_RT5640_MAP(quirk)	((quirk) & 0xff)
+#define BYT_RT5640_DMIC_EN	BIT(16)
+
+static unsigned long byt_rt5640_quirk = BYT_RT5640_DMIC1_MAP |
+					BYT_RT5640_DMIC_EN;
+
 static const struct snd_soc_dapm_widget byt_rt5640_widgets[] = {
 	SND_SOC_DAPM_HP("Headphone", NULL),
 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
@@ -70,18 +82,6 @@ static const struct snd_soc_dapm_route byt_rt5640_intmic_in1_map[] = {
 	{"IN1P", NULL, "Internal Mic"},
 };
 
-enum {
-	BYT_RT5640_DMIC1_MAP,
-	BYT_RT5640_DMIC2_MAP,
-	BYT_RT5640_IN1_MAP,
-};
-
-#define BYT_RT5640_MAP(quirk)	((quirk) & 0xff)
-#define BYT_RT5640_DMIC_EN	BIT(16)
-
-static unsigned long byt_rt5640_quirk = BYT_RT5640_DMIC1_MAP |
-					BYT_RT5640_DMIC_EN;
-
 static const struct snd_kcontrol_new byt_rt5640_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
@@ -174,7 +174,6 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
 		return ret;
 	}
 
-	dmi_check_system(byt_rt5640_quirk_table);
 	switch (BYT_RT5640_MAP(byt_rt5640_quirk)) {
 	case BYT_RT5640_IN1_MAP:
 		custom_map = byt_rt5640_intmic_in1_map;
@@ -351,6 +350,9 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 		 "%s%s%s", "i2c-", mach->id, ":00");
 	byt_rt5640_dais[MERR_DPCM_COMPR+1].codec_name = byt_rt5640_codec_name;
 
+	/* check quirks before creating card */
+	dmi_check_system(byt_rt5640_quirk_table);
+
 	ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5640_card);
 
 	if (ret_val) {
Signature · 1 line
1.9.1
maintainer
#14 lore raw

Applied "ASoC: Intel: bytcr_rt5640: change quirk position" to the asoc tree

The patch

ASoC: Intel: bytcr_rt5640: change quirk position

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From ab738e4e3040b0985ab45780a688705f334e609b Mon Sep 17 00:00:00 2001

From: Pierre-Louis Bossart <[email protected]>
Date: Thu, 3 Mar 2016 21:36:37 -0600
Subject: [PATCH] ASoC: Intel: bytcr_rt5640: change quirk position

No added functionality

---
 sound/soc/intel/boards/bytcr_rt5640.c | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)
sound/soc/intel/boards/bytcr_rt5640.c +15 -13
index 9a1752df45a9..a06cd1f99190 100644
@@ -32,6 +32,18 @@
 #include "../atom/sst-atom-controls.h"
 #include "../common/sst-acpi.h"
 
+enum {
+	BYT_RT5640_DMIC1_MAP,
+	BYT_RT5640_DMIC2_MAP,
+	BYT_RT5640_IN1_MAP,
+};
+
+#define BYT_RT5640_MAP(quirk)	((quirk) & 0xff)
+#define BYT_RT5640_DMIC_EN	BIT(16)
+
+static unsigned long byt_rt5640_quirk = BYT_RT5640_DMIC1_MAP |
+					BYT_RT5640_DMIC_EN;
+
 static const struct snd_soc_dapm_widget byt_rt5640_widgets[] = {
 	SND_SOC_DAPM_HP("Headphone", NULL),
 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
@@ -70,18 +82,6 @@ static const struct snd_soc_dapm_route byt_rt5640_intmic_in1_map[] = {
 	{"IN1P", NULL, "Internal Mic"},
 };
 
-enum {
-	BYT_RT5640_DMIC1_MAP,
-	BYT_RT5640_DMIC2_MAP,
-	BYT_RT5640_IN1_MAP,
-};
-
-#define BYT_RT5640_MAP(quirk)	((quirk) & 0xff)
-#define BYT_RT5640_DMIC_EN	BIT(16)
-
-static unsigned long byt_rt5640_quirk = BYT_RT5640_DMIC1_MAP |
-					BYT_RT5640_DMIC_EN;
-
 static const struct snd_kcontrol_new byt_rt5640_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
@@ -174,7 +174,6 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
 		return ret;
 	}
 
-	dmi_check_system(byt_rt5640_quirk_table);
 	switch (BYT_RT5640_MAP(byt_rt5640_quirk)) {
 	case BYT_RT5640_IN1_MAP:
 		custom_map = byt_rt5640_intmic_in1_map;
@@ -351,6 +350,9 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 		 "%s%s%s", "i2c-", mach->id, ":00");
 	byt_rt5640_dais[MERR_DPCM_COMPR+1].codec_name = byt_rt5640_codec_name;
 
+	/* check quirks before creating card */
+	dmi_check_system(byt_rt5640_quirk_table);
+
 	ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5640_card);
 
 	if (ret_val) {
Signature · 1 line
2.7.0
#15 lore raw

PATCH 5/6 ASoC: Intel: bytcr_rt5640: use HID translation util

In reply to Pierre-Louis Bossart

Remove hard-coded generation of codec name, use translation routine to avoid issues with codec name not matching what the ACPI subsystem registered

---
 sound/soc/intel/boards/bytcr_rt5640.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
sound/soc/intel/boards/bytcr_rt5640.c +19 -3
index a06cd1f..032a2e7 100644
@@ -340,15 +340,31 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 {
 	int ret_val = 0;
 	struct sst_acpi_mach *mach;
+	const char *i2c_name = NULL;
+	int i;
+	int dai_index;
 
 	/* register the soc card */
 	byt_rt5640_card.dev = &pdev->dev;
 	mach = byt_rt5640_card.dev->platform_data;
 
+	/* fix index of codec dai */
+	dai_index = MERR_DPCM_COMPR + 1;
+	for (i = 0; i < ARRAY_SIZE(byt_rt5640_dais); i++) {
+		if (!strcmp(byt_rt5640_dais[i].codec_name, "i2c-10EC5640:00")) {
+			dai_index = i;
+			break;
+		}
+	}
+
 	/* fixup codec name based on HID */
-	snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
-		 "%s%s%s", "i2c-", mach->id, ":00");
-	byt_rt5640_dais[MERR_DPCM_COMPR+1].codec_name = byt_rt5640_codec_name;
+	i2c_name = sst_acpi_find_name_from_hid(mach->id);
+	if (i2c_name != NULL) {
+		snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
+			"%s%s", "i2c-", i2c_name);
+
+		byt_rt5640_dais[dai_index].codec_name = byt_rt5640_codec_name;
+	}
 
 	/* check quirks before creating card */
 	dmi_check_system(byt_rt5640_quirk_table);
Signature · 1 line
1.9.1
maintainer
#16 lore raw

Applied "ASoC: Intel: bytcr_rt5640: use HID translation util" to the asoc tree

The patch

ASoC: Intel: bytcr_rt5640: use HID translation util

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From a232b96dcece4761793d39b8fb2c9d050df30357 Mon Sep 17 00:00:00 2001

From: Pierre-Louis Bossart <[email protected]>
Date: Thu, 3 Mar 2016 21:36:38 -0600
Subject: [PATCH] ASoC: Intel: bytcr_rt5640: use HID translation util

Remove hard-coded generation of codec name, use translation routine to avoid issues with codec name not matching what the ACPI subsystem registered

---
 sound/soc/intel/boards/bytcr_rt5640.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)
sound/soc/intel/boards/bytcr_rt5640.c +19 -3
index a06cd1f99190..032a2e753f0b 100644
@@ -340,15 +340,31 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 {
 	int ret_val = 0;
 	struct sst_acpi_mach *mach;
+	const char *i2c_name = NULL;
+	int i;
+	int dai_index;
 
 	/* register the soc card */
 	byt_rt5640_card.dev = &pdev->dev;
 	mach = byt_rt5640_card.dev->platform_data;
 
+	/* fix index of codec dai */
+	dai_index = MERR_DPCM_COMPR + 1;
+	for (i = 0; i < ARRAY_SIZE(byt_rt5640_dais); i++) {
+		if (!strcmp(byt_rt5640_dais[i].codec_name, "i2c-10EC5640:00")) {
+			dai_index = i;
+			break;
+		}
+	}
+
 	/* fixup codec name based on HID */
-	snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
-		 "%s%s%s", "i2c-", mach->id, ":00");
-	byt_rt5640_dais[MERR_DPCM_COMPR+1].codec_name = byt_rt5640_codec_name;
+	i2c_name = sst_acpi_find_name_from_hid(mach->id);
+	if (i2c_name != NULL) {
+		snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
+			"%s%s", "i2c-", i2c_name);
+
+		byt_rt5640_dais[dai_index].codec_name = byt_rt5640_codec_name;
+	}
 
 	/* check quirks before creating card */
 	dmi_check_system(byt_rt5640_quirk_table);
Signature · 1 line
2.7.0
#17 lore raw

PATCH 6/6 ASoC: Intel: Atom: add support for CHT w/ RT5640

In reply to Pierre-Louis Bossart

Some CHT-T platforms make use of the Realtek RT5640 codec. Make use of the machine driver developed for Baytrail.

Tested on Tronsmart Ara X5.

---
 sound/soc/intel/atom/sst/sst_acpi.c | 4 ++++
 1 file changed, 4 insertions(+)
sound/soc/intel/atom/sst/sst_acpi.c +4 -0
index 4fce03f..3bc4b63 100644
@@ -342,6 +342,10 @@ static struct sst_acpi_mach sst_acpi_chv[] = {
 						&chv_platform_data },
 	{"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,
+						&chv_platform_data },
+
 	{},
 };
 
Signature · 1 line
1.9.1
maintainer
#18 lore raw

Applied "ASoC: Intel: Atom: add support for CHT w/ RT5640" to the asoc tree

The patch

ASoC: Intel: Atom: add support for CHT w/ RT5640

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From fdf841937e4fa08e767dbe83f1c65696cfec67c9 Mon Sep 17 00:00:00 2001

From: Pierre-Louis Bossart <[email protected]>
Date: Thu, 3 Mar 2016 21:36:39 -0600
Subject: [PATCH] ASoC: Intel: Atom: add support for CHT w/ RT5640

Some CHT-T platforms make use of the Realtek RT5640 codec. Make use of the machine driver developed for Baytrail.

Tested on Tronsmart Ara X5.

---
 sound/soc/intel/atom/sst/sst_acpi.c | 4 ++++
 1 file changed, 4 insertions(+)
sound/soc/intel/atom/sst/sst_acpi.c +4 -0
index 4fce03fc1870..3bc4b63b2f9d 100644
@@ -342,6 +342,10 @@ static struct sst_acpi_mach sst_acpi_chv[] = {
 						&chv_platform_data },
 	{"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,
+						&chv_platform_data },
+
 	{},
 };
 
Signature · 1 line
2.7.0