Skip to contentSkip to conversation

ASoC: Intel: kabylake: Adds rt5663+max98927 machine driver

PATCH Superseded Naveen M 4 participants 12 messages May 8, 2017 – May 24, 2017

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Naveen M

author
#0 lore raw

cover ASoC: Intel: kabylake: Adds rt5663+max98927 machine driver

Add support for multiple codecs in acpi matching of sst library using machine quirk for robust mach driver selection.
Add kabylake machine driver & corresponding driver entry in machine table for following codecs:
1. rt5663 for headset configured to ssp1.
2. max98927 for speakers configured to ssp0.

Naveen M (6):
ASoC: Intel: Create a helper to search for matching machine
ASoC: Move quirk to identify correct machine driver
ASoC: Add quirk data to support multiple codecs
ASoC: Improve machine driver selection based on quirk data
ASoC: Intel: Add Kabylake Realtek Maxim machine driver
ASoC: Intel: Add Kabylake RT5663+MAX98927 machine driver entry

 sound/soc/intel/Kconfig                      |  15 +
 sound/soc/intel/atom/sst/sst_acpi.c          |  48 +-
 sound/soc/intel/boards/Makefile              |   2 +
 sound/soc/intel/boards/kbl_rt5663_max98927.c | 687 +++++++++++++++++++++++++++
 sound/soc/intel/common/sst-acpi.h            |  23 +
 sound/soc/intel/common/sst-match-acpi.c      |  47 +-
 sound/soc/intel/skylake/skl.c                |  41 +-
 7 files changed, 821 insertions(+), 42 deletions(-)
 create mode 100644 sound/soc/intel/boards/kbl_rt5663_max98927.c
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/6 ASoC: Intel: Create a helper to search for matching machine

Create a helper function to search for a matching machine based on HID. No functional change

---
 sound/soc/intel/common/sst-acpi.h       |  3 +++
 sound/soc/intel/common/sst-match-acpi.c | 19 +++++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)
sound/soc/intel/common/sst-acpi.h +3 -0
index 214e000..3649d3b 100644
@@ -43,6 +43,9 @@ static inline bool sst_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
 /* acpi match */
 struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines);
 
+/* acpi check hid */
+bool sst_acpi_check_hid(const u8 hid[ACPI_ID_LEN]);
+
 /* Descriptor for SST ASoC machine driver */
 struct sst_acpi_mach {
 	/* ACPI ID for the matching machine driver. Audio codec for instance */
sound/soc/intel/common/sst-match-acpi.c +15 -4
index 1070f3a..f4af3d1 100644
@@ -63,15 +63,26 @@ static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
 	return AE_OK;
 }
 
+bool sst_acpi_check_hid(const u8 hid[ACPI_ID_LEN])
+{
+	acpi_status status;
+	bool found = false;
+
+	status = acpi_get_devices(hid, sst_acpi_mach_match, &found, NULL);
+
+	if (ACPI_FAILURE(status))
+		return false;
+
+	return found;
+}
+EXPORT_SYMBOL_GPL(sst_acpi_check_hid);
+
 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_SUCCESS(acpi_get_devices(mach->id,
-						  sst_acpi_mach_match,
-						  &found, NULL)) && found)
+		if (sst_acpi_check_hid(mach->id) == true)
 			return mach;
 	return NULL;
 }
Signature · 1 line
1.9.1
maintainer
#2 lore raw

Applied "ASoC: Intel: Create a helper to search for matching machine" to the asoc tree

The patch

ASoC: Intel: Create a helper to search for matching machine

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 915ae2b9f0fe0357a8f9cc53a7eb18ded03d11a4 Mon Sep 17 00:00:00 2001

From: Naveen M <[email protected]>
Date: Mon, 15 May 2017 13:42:13 +0530
Subject: [PATCH] ASoC: Intel: Create a helper to search for matching machine

Create a helper function to search for a matching machine based on HID. No functional change

---
 sound/soc/intel/common/sst-acpi.h       |  3 +++
 sound/soc/intel/common/sst-match-acpi.c | 19 +++++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)
sound/soc/intel/common/sst-acpi.h +3 -0
index 214e000667ae..3649d3b08c9e 100644
@@ -43,6 +43,9 @@ static inline bool sst_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
 /* acpi match */
 struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines);
 
+/* acpi check hid */
+bool sst_acpi_check_hid(const u8 hid[ACPI_ID_LEN]);
+
 /* Descriptor for SST ASoC machine driver */
 struct sst_acpi_mach {
 	/* ACPI ID for the matching machine driver. Audio codec for instance */
sound/soc/intel/common/sst-match-acpi.c +15 -4
index 1070f3ad23e5..f4af3d144b82 100644
@@ -63,15 +63,26 @@ static acpi_status sst_acpi_mach_match(acpi_handle handle, u32 level,
 	return AE_OK;
 }
 
+bool sst_acpi_check_hid(const u8 hid[ACPI_ID_LEN])
+{
+	acpi_status status;
+	bool found = false;
+
+	status = acpi_get_devices(hid, sst_acpi_mach_match, &found, NULL);
+
+	if (ACPI_FAILURE(status))
+		return false;
+
+	return found;
+}
+EXPORT_SYMBOL_GPL(sst_acpi_check_hid);
+
 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_SUCCESS(acpi_get_devices(mach->id,
-						  sst_acpi_mach_match,
-						  &found, NULL)) && found)
+		if (sst_acpi_check_hid(mach->id) == true)
 			return mach;
 	return NULL;
 }
Signature · 1 line
2.11.0
author
#3 lore raw

PATCH 2/6 ASoC: Move quirk to identify correct machine driver

In reply to Naveen M

sst_acpi_mach has a quirk field to handle board specific quirks. Patch moves quirk call to sst_acpi_find_machine() instead of calling it in respective driver

---
 sound/soc/intel/atom/sst/sst_acpi.c     |  2 --
 sound/soc/intel/common/sst-match-acpi.c | 12 +++++++++---
 2 files changed, 9 insertions(+), 5 deletions(-)
sound/soc/intel/atom/sst/sst_acpi.c +0 -2
index dd250b8..3e6650e 100644
@@ -303,8 +303,6 @@ 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;
 
sound/soc/intel/common/sst-match-acpi.c +9 -3
index f4af3d1..88e4977 100644
@@ -81,9 +81,15 @@ struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
 {
 	struct sst_acpi_mach *mach;
 
-	for (mach = machines; mach->id[0]; mach++)
-		if (sst_acpi_check_hid(mach->id) == true)
-			return mach;
+	for (mach = machines; mach->id[0]; mach++) {
+		if (sst_acpi_check_hid(mach->id) == true) {
+			if (mach->machine_quirk == NULL)
+				return mach;
+
+			if (mach->machine_quirk(mach) != NULL)
+				return mach;
+		}
+	}
 	return NULL;
 }
 EXPORT_SYMBOL_GPL(sst_acpi_find_machine);
Signature · 1 line
1.9.1
maintainer
#4 lore raw

Applied "ASoC: Move quirk to identify correct machine driver" to the asoc tree

The patch

ASoC: Move quirk to identify correct machine driver

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 7827d66946ad3af734ed46d1d68c23fa6974595c Mon Sep 17 00:00:00 2001

From: Naveen M <[email protected]>
Date: Mon, 15 May 2017 13:42:14 +0530
Subject: [PATCH] ASoC: Move quirk to identify correct machine driver

sst_acpi_mach has a quirk field to handle board specific quirks. Patch moves quirk call to sst_acpi_find_machine() instead of calling it in respective driver

---
 sound/soc/intel/atom/sst/sst_acpi.c     |  2 --
 sound/soc/intel/common/sst-match-acpi.c | 12 +++++++++---
 2 files changed, 9 insertions(+), 5 deletions(-)
sound/soc/intel/atom/sst/sst_acpi.c +0 -2
index 193c4d7b35f5..592f6afaf2a5 100644
@@ -303,8 +303,6 @@ 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;
 
sound/soc/intel/common/sst-match-acpi.c +9 -3
index f4af3d144b82..88e4977578b5 100644
@@ -81,9 +81,15 @@ struct sst_acpi_mach *sst_acpi_find_machine(struct sst_acpi_mach *machines)
 {
 	struct sst_acpi_mach *mach;
 
-	for (mach = machines; mach->id[0]; mach++)
-		if (sst_acpi_check_hid(mach->id) == true)
-			return mach;
+	for (mach = machines; mach->id[0]; mach++) {
+		if (sst_acpi_check_hid(mach->id) == true) {
+			if (mach->machine_quirk == NULL)
+				return mach;
+
+			if (mach->machine_quirk(mach) != NULL)
+				return mach;
+		}
+	}
 	return NULL;
 }
 EXPORT_SYMBOL_GPL(sst_acpi_find_machine);
Signature · 1 line
2.11.0
author
#5 lore raw

PATCH 3/6 ASoC: Add quirk data to support multiple codecs

In reply to Naveen M

Add quirk data in sst_acpi_mach() which will hold number of codecs and codec names to search for a best possible matching machine. Set NULL for existing drivers not using this.

---
 sound/soc/intel/atom/sst/sst_acpi.c | 46 ++++++++++++++++++-------------------
 sound/soc/intel/common/sst-acpi.h   |  1 +
 sound/soc/intel/skylake/skl.c       | 25 ++++++++++++--------
 3 files changed, 40 insertions(+), 32 deletions(-)
sound/soc/intel/atom/sst/sst_acpi.c +23 -23
index 3e6650e..aab85ad 100644
@@ -452,11 +452,11 @@ static int byt_thinkpad10_quirk_cb(const struct dmi_system_id *id)
 
 static struct sst_acpi_mach cht_surface_mach = {
 	"10EC5640", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
-								&chv_platform_data };
+						NULL, &chv_platform_data };
 
 static struct sst_acpi_mach byt_thinkpad_10 = {
 	"10EC5640", "cht-bsw-rt5672", "intel/fw_sst_0f28.bin", "cht-bsw", NULL,
-	                                                        &byt_rvp_platform_data };
+						NULL, &byt_rvp_platform_data };
 
 static struct sst_acpi_mach *cht_quirk(void *arg)
 {
@@ -485,29 +485,29 @@ static struct sst_acpi_mach *byt_quirk(void *arg)
 
 static struct sst_acpi_mach sst_acpi_bytcr[] = {
 	{"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", byt_quirk,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 	{"10EC5642", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 	{"INTCCFFD", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 	{"10EC5651", "bytcr_rt5651", "intel/fw_sst_0f28.bin", "bytcr_rt5651", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 	{"DLGS7212", "bytcht_da7213", "intel/fw_sst_0f28.bin", "bytcht_da7213", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 	{"DLGS7213", "bytcht_da7213", "intel/fw_sst_0f28.bin", "bytcht_da7213", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 	/* some Baytrail platforms rely on RT5645, use CHT machine driver */
 	{"10EC5645", "cht-bsw-rt5645", "intel/fw_sst_0f28.bin", "cht-bsw", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 	{"10EC5648", "cht-bsw-rt5645", "intel/fw_sst_0f28.bin", "cht-bsw", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
 	/*
 	 * This is always last in the table so that it is selected only when
 	 * enabled explicitly and there is no codec-related information in SSDT
 	 */
 	{"80860F28", "bytcht_nocodec", "intel/fw_sst_0f28.bin", "bytcht_nocodec", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 #endif
 	{},
 };
@@ -515,37 +515,37 @@ static struct sst_acpi_mach *byt_quirk(void *arg)
 /* Cherryview-based platforms: CherryTrail and Braswell */
 static struct sst_acpi_mach sst_acpi_chv[] = {
 	{"10EC5670", "cht-bsw-rt5672", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	{"10EC5672", "cht-bsw-rt5672", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	{"10EC5645", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	{"10EC5650", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	{"10EC3270", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 
 	{"193C9890", "cht-bsw-max98090", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	{"DLGS7212", "bytcht_da7213", "intel/fw_sst_22a8.bin", "bytcht_da7213", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	{"DLGS7213", "bytcht_da7213", "intel/fw_sst_22a8.bin", "bytcht_da7213", NULL,
-						&chv_platform_data },
+						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", cht_quirk,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	{"10EC3276", "bytcr_rt5640", "intel/fw_sst_22a8.bin", "bytcr_rt5640", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	/* some CHT-T platforms rely on RT5651, use Baytrail machine driver */
 	{"10EC5651", "bytcr_rt5651", "intel/fw_sst_22a8.bin", "bytcr_rt5651", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
 	/*
 	 * This is always last in the table so that it is selected only when
 	 * enabled explicitly and there is no codec-related information in SSDT
 	 */
 	{"808622A8", "bytcht_nocodec", "intel/fw_sst_22a8.bin", "bytcht_nocodec", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 #endif
 	{},
 };
sound/soc/intel/common/sst-acpi.h +1 -0
index 3649d3b..fbf010e 100644
@@ -58,5 +58,6 @@ struct sst_acpi_mach {
 	/* board name */
 	const char *board;
 	struct sst_acpi_mach * (*machine_quirk)(void *arg);
+	const void *quirk_data;
 	void *pdata;
 };
sound/soc/intel/skylake/skl.c +16 -9
index 6df3b31..1df4040 100644
@@ -863,28 +863,35 @@ static void skl_remove(struct pci_dev *pci)
 }
 
 static struct sst_acpi_mach sst_skl_devdata[] = {
-	{ "INT343A", "skl_alc286s_i2s", "intel/dsp_fw_release.bin", NULL, NULL, NULL },
-	{ "INT343B", "skl_n88l25_s4567", "intel/dsp_fw_release.bin",
+	{ "INT343A", "skl_alc286s_i2s", "intel/dsp_fw_release.bin", NULL,
+				NULL, NULL, NULL },
+	{ "INT343B", "skl_n88l25_s4567", "intel/dsp_fw_release.bin", NULL,
 				NULL, NULL, &skl_dmic_data },
-	{ "MX98357A", "skl_n88l25_m98357a", "intel/dsp_fw_release.bin",
+	{ "MX98357A", "skl_n88l25_m98357a", "intel/dsp_fw_release.bin", NULL,
 				NULL, NULL, &skl_dmic_data },
 	{}
 };
 
 static struct sst_acpi_mach sst_bxtp_devdata[] = {
-	{ "INT343A", "bxt_alc298s_i2s", "intel/dsp_fw_bxtn.bin", NULL, NULL, NULL },
-	{ "DLGS7219", "bxt_da7219_max98357a_i2s", "intel/dsp_fw_bxtn.bin", NULL, NULL, NULL },
+	{ "INT343A", "bxt_alc298s_i2s", "intel/dsp_fw_bxtn.bin", NULL, NULL,
+				NULL, NULL },
+	{ "DLGS7219", "bxt_da7219_max98357a_i2s", "intel/dsp_fw_bxtn.bin", NULL,
+				NULL, NULL, NULL },
 };
 
 static struct sst_acpi_mach sst_kbl_devdata[] = {
-	{ "INT343A", "kbl_alc286s_i2s", "intel/dsp_fw_kbl.bin", NULL, NULL, NULL },
-	{ "INT343B", "kbl_n88l25_s4567", "intel/dsp_fw_kbl.bin", NULL, NULL, &skl_dmic_data },
-	{ "MX98357A", "kbl_n88l25_m98357a", "intel/dsp_fw_kbl.bin", NULL, NULL, &skl_dmic_data },
+	{ "INT343A", "kbl_alc286s_i2s", "intel/dsp_fw_kbl.bin", NULL, NULL,
+				NULL, NULL },
+	{ "INT343B", "kbl_n88l25_s4567", "intel/dsp_fw_kbl.bin", NULL, NULL,
+				NULL, &skl_dmic_data },
+	{ "MX98357A", "kbl_n88l25_m98357a", "intel/dsp_fw_kbl.bin", NULL, NULL,
+				NULL, &skl_dmic_data },
 	{}
 };
 
 static struct sst_acpi_mach sst_glk_devdata[] = {
-	{ "INT343A", "glk_alc298s_i2s", "intel/dsp_fw_glk.bin", NULL, NULL, NULL },
+	{ "INT343A", "glk_alc298s_i2s", "intel/dsp_fw_glk.bin", NULL, NULL,
+				NULL, NULL },
 };
 
 /* PCI IDs */
Signature · 1 line
1.9.1
#6 lore raw

Re: [PATCH 3/6] ASoC: Add quirk data to support multiple codecs

Quoted 4 lines · Naveen M

Add quirk data in sst_acpi_mach() which will hold number of codecs and codec names to search for a best possible matching machine. Set NULL for existing drivers not using this.

It's better to rewrite the existing code with C99 style initialization before introducing such a new field. For the atom driver, it's more better with some macros to simplify. Then you don't have to touch the code as long as the default value is zero.

Takashi

Quoted 183 lines
---
 sound/soc/intel/atom/sst/sst_acpi.c | 46 ++++++++++++++++++-------------------
 sound/soc/intel/common/sst-acpi.h   |  1 +
 sound/soc/intel/skylake/skl.c       | 25 ++++++++++++--------
 3 files changed, 40 insertions(+), 32 deletions(-)
sound/soc/intel/atom/sst/sst_acpi.c +23 -23
index 3e6650e..aab85ad 100644
@@ -452,11 +452,11 @@ static int byt_thinkpad10_quirk_cb(const struct dmi_system_id *id)
 
 static struct sst_acpi_mach cht_surface_mach = {
 	"10EC5640", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
-								&chv_platform_data };
+						NULL, &chv_platform_data };
 
 static struct sst_acpi_mach byt_thinkpad_10 = {
 	"10EC5640", "cht-bsw-rt5672", "intel/fw_sst_0f28.bin", "cht-bsw", NULL,
-	                                                        &byt_rvp_platform_data };
+						NULL, &byt_rvp_platform_data };
 
 static struct sst_acpi_mach *cht_quirk(void *arg)
 {
@@ -485,29 +485,29 @@ static struct sst_acpi_mach *byt_quirk(void *arg)
 
 static struct sst_acpi_mach sst_acpi_bytcr[] = {
 	{"10EC5640", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", byt_quirk,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 	{"10EC5642", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 	{"INTCCFFD", "bytcr_rt5640", "intel/fw_sst_0f28.bin", "bytcr_rt5640", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 	{"10EC5651", "bytcr_rt5651", "intel/fw_sst_0f28.bin", "bytcr_rt5651", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 	{"DLGS7212", "bytcht_da7213", "intel/fw_sst_0f28.bin", "bytcht_da7213", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 	{"DLGS7213", "bytcht_da7213", "intel/fw_sst_0f28.bin", "bytcht_da7213", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 	/* some Baytrail platforms rely on RT5645, use CHT machine driver */
 	{"10EC5645", "cht-bsw-rt5645", "intel/fw_sst_0f28.bin", "cht-bsw", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 	{"10EC5648", "cht-bsw-rt5645", "intel/fw_sst_0f28.bin", "cht-bsw", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
 	/*
 	 * This is always last in the table so that it is selected only when
 	 * enabled explicitly and there is no codec-related information in SSDT
 	 */
 	{"80860F28", "bytcht_nocodec", "intel/fw_sst_0f28.bin", "bytcht_nocodec", NULL,
-						&byt_rvp_platform_data },
+						NULL, &byt_rvp_platform_data },
 #endif
 	{},
 };
@@ -515,37 +515,37 @@ static struct sst_acpi_mach *byt_quirk(void *arg)
 /* Cherryview-based platforms: CherryTrail and Braswell */
 static struct sst_acpi_mach sst_acpi_chv[] = {
 	{"10EC5670", "cht-bsw-rt5672", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	{"10EC5672", "cht-bsw-rt5672", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	{"10EC5645", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	{"10EC5650", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	{"10EC3270", "cht-bsw-rt5645", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 
 	{"193C9890", "cht-bsw-max98090", "intel/fw_sst_22a8.bin", "cht-bsw", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	{"DLGS7212", "bytcht_da7213", "intel/fw_sst_22a8.bin", "bytcht_da7213", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	{"DLGS7213", "bytcht_da7213", "intel/fw_sst_22a8.bin", "bytcht_da7213", NULL,
-						&chv_platform_data },
+						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", cht_quirk,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	{"10EC3276", "bytcr_rt5640", "intel/fw_sst_22a8.bin", "bytcr_rt5640", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 	/* some CHT-T platforms rely on RT5651, use Baytrail machine driver */
 	{"10EC5651", "bytcr_rt5651", "intel/fw_sst_22a8.bin", "bytcr_rt5651", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH)
 	/*
 	 * This is always last in the table so that it is selected only when
 	 * enabled explicitly and there is no codec-related information in SSDT
 	 */
 	{"808622A8", "bytcht_nocodec", "intel/fw_sst_22a8.bin", "bytcht_nocodec", NULL,
-						&chv_platform_data },
+						NULL, &chv_platform_data },
 #endif
 	{},
 };
sound/soc/intel/common/sst-acpi.h +1 -0
index 3649d3b..fbf010e 100644
@@ -58,5 +58,6 @@ struct sst_acpi_mach {
 	/* board name */
 	const char *board;
 	struct sst_acpi_mach * (*machine_quirk)(void *arg);
+	const void *quirk_data;
 	void *pdata;
 };
sound/soc/intel/skylake/skl.c +16 -9
index 6df3b31..1df4040 100644
@@ -863,28 +863,35 @@ static void skl_remove(struct pci_dev *pci)
 }
 
 static struct sst_acpi_mach sst_skl_devdata[] = {
-	{ "INT343A", "skl_alc286s_i2s", "intel/dsp_fw_release.bin", NULL, NULL, NULL },
-	{ "INT343B", "skl_n88l25_s4567", "intel/dsp_fw_release.bin",
+	{ "INT343A", "skl_alc286s_i2s", "intel/dsp_fw_release.bin", NULL,
+				NULL, NULL, NULL },
+	{ "INT343B", "skl_n88l25_s4567", "intel/dsp_fw_release.bin", NULL,
 				NULL, NULL, &skl_dmic_data },
-	{ "MX98357A", "skl_n88l25_m98357a", "intel/dsp_fw_release.bin",
+	{ "MX98357A", "skl_n88l25_m98357a", "intel/dsp_fw_release.bin", NULL,
 				NULL, NULL, &skl_dmic_data },
 	{}
 };
 
 static struct sst_acpi_mach sst_bxtp_devdata[] = {
-	{ "INT343A", "bxt_alc298s_i2s", "intel/dsp_fw_bxtn.bin", NULL, NULL, NULL },
-	{ "DLGS7219", "bxt_da7219_max98357a_i2s", "intel/dsp_fw_bxtn.bin", NULL, NULL, NULL },
+	{ "INT343A", "bxt_alc298s_i2s", "intel/dsp_fw_bxtn.bin", NULL, NULL,
+				NULL, NULL },
+	{ "DLGS7219", "bxt_da7219_max98357a_i2s", "intel/dsp_fw_bxtn.bin", NULL,
+				NULL, NULL, NULL },
 };
 
 static struct sst_acpi_mach sst_kbl_devdata[] = {
-	{ "INT343A", "kbl_alc286s_i2s", "intel/dsp_fw_kbl.bin", NULL, NULL, NULL },
-	{ "INT343B", "kbl_n88l25_s4567", "intel/dsp_fw_kbl.bin", NULL, NULL, &skl_dmic_data },
-	{ "MX98357A", "kbl_n88l25_m98357a", "intel/dsp_fw_kbl.bin", NULL, NULL, &skl_dmic_data },
+	{ "INT343A", "kbl_alc286s_i2s", "intel/dsp_fw_kbl.bin", NULL, NULL,
+				NULL, NULL },
+	{ "INT343B", "kbl_n88l25_s4567", "intel/dsp_fw_kbl.bin", NULL, NULL,
+				NULL, &skl_dmic_data },
+	{ "MX98357A", "kbl_n88l25_m98357a", "intel/dsp_fw_kbl.bin", NULL, NULL,
+				NULL, &skl_dmic_data },
 	{}
 };
 
 static struct sst_acpi_mach sst_glk_devdata[] = {
-	{ "INT343A", "glk_alc298s_i2s", "intel/dsp_fw_glk.bin", NULL, NULL, NULL },
+	{ "INT343A", "glk_alc298s_i2s", "intel/dsp_fw_glk.bin", NULL, NULL,
+				NULL, NULL },
 };
 
 /* PCI IDs */
Signature · 6 lines
1.9.1

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#7 lore raw

Re: [PATCH 3/6] ASoC: Add quirk data to support multiple codecs

Quoted 7 lines · Takashi Iwai
Quoted 4 lines · Naveen M

Add quirk data in sst_acpi_mach() which will hold number of codecs and codec names to search for a best possible matching machine. Set NULL for existing drivers not using this.

Quoted 5 lines

It's better to rewrite the existing code with C99 style initialization before introducing such a new field. For the atom driver, it's more better with some macros to simplify. Then you don't have to touch the code as long as the default value is zero.

Agreed and it is more readable as well, we will change this :)

Signature · 1 line
~Vinod
author
#8 lore raw

PATCH 4/6 ASoC: Improve machine driver selection based on quirk data

In reply to Naveen M

Use quirk function to select the correct machine driver by checking all codecs instead of only one based on quirk data.

---
 sound/soc/intel/common/sst-acpi.h       | 19 +++++++++++++++++++
 sound/soc/intel/common/sst-match-acpi.c | 18 ++++++++++++++++++
 sound/soc/intel/skylake/skl.c           | 22 +++++++++++++++-------
 3 files changed, 52 insertions(+), 7 deletions(-)
sound/soc/intel/common/sst-acpi.h +19 -0
index fbf010e..afe9b87 100644
@@ -61,3 +61,22 @@ struct sst_acpi_mach {
 	const void *quirk_data;
 	void *pdata;
 };
+
+#define SST_ACPI_MAX_CODECS 3
+
+/**
+ * struct sst_codecs: Structure to hold secondary codec information apart from
+ * the matched one, this data will be passed to the quirk function to match
+ * with the ACPI detected devices
+ *
+ * @num_codecs: number of secondary codecs used in the platform
+ * @codecs: holds the codec IDs
+ *
+ */
+struct sst_codecs {
+	int num_codecs;
+	u8 codecs[SST_ACPI_MAX_CODECS][ACPI_ID_LEN];
+};
+
+/* check all codecs */
+struct sst_acpi_mach *sst_acpi_codec_list(void *arg);
sound/soc/intel/common/sst-match-acpi.c +18 -0
index 88e4977..56d26f3 100644
@@ -151,5 +151,23 @@ bool sst_acpi_find_package_from_hid(const u8 hid[ACPI_ID_LEN],
 }
 EXPORT_SYMBOL_GPL(sst_acpi_find_package_from_hid);
 
+struct sst_acpi_mach *sst_acpi_codec_list(void *arg)
+{
+	struct sst_acpi_mach *mach = arg;
+	struct sst_codecs *codec_list = (struct sst_codecs *) mach->quirk_data;
+	int i;
+
+	if (mach->quirk_data == NULL)
+		return mach;
+
+	for (i = 0; i < codec_list->num_codecs; i++) {
+		if (sst_acpi_check_hid(codec_list->codecs[i]) != true)
+			return NULL;
+	}
+
+	return mach;
+}
+EXPORT_SYMBOL_GPL(sst_acpi_codec_list);
+
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("Intel Common ACPI Match module");
sound/soc/intel/skylake/skl.c +15 -7
index 1df4040..b9faa20 100644
@@ -862,13 +862,19 @@ static void skl_remove(struct pci_dev *pci)
 	dev_set_drvdata(&pci->dev, NULL);
 }
 
+static struct sst_codecs skl_codecs = { 1, {"NAU88L25"} };
+static struct sst_codecs kbl_codecs = { 1, {"NAU88L25"} };
+static struct sst_codecs bxt_codecs = { 1, {"MX98357A"} };
+
 static struct sst_acpi_mach sst_skl_devdata[] = {
 	{ "INT343A", "skl_alc286s_i2s", "intel/dsp_fw_release.bin", NULL,
 				NULL, NULL, NULL },
 	{ "INT343B", "skl_n88l25_s4567", "intel/dsp_fw_release.bin", NULL,
-				NULL, NULL, &skl_dmic_data },
+				sst_acpi_codec_list, &skl_codecs,
+				&skl_dmic_data },
 	{ "MX98357A", "skl_n88l25_m98357a", "intel/dsp_fw_release.bin", NULL,
-				NULL, NULL, &skl_dmic_data },
+				sst_acpi_codec_list, &skl_codecs,
+				&skl_dmic_data },
 	{}
 };
 
@@ -876,16 +882,18 @@ static void skl_remove(struct pci_dev *pci)
 	{ "INT343A", "bxt_alc298s_i2s", "intel/dsp_fw_bxtn.bin", NULL, NULL,
 				NULL, NULL },
 	{ "DLGS7219", "bxt_da7219_max98357a_i2s", "intel/dsp_fw_bxtn.bin", NULL,
-				NULL, NULL, NULL },
+				sst_acpi_codec_list, &bxt_codecs, NULL },
 };
 
 static struct sst_acpi_mach sst_kbl_devdata[] = {
 	{ "INT343A", "kbl_alc286s_i2s", "intel/dsp_fw_kbl.bin", NULL, NULL,
 				NULL, NULL },
-	{ "INT343B", "kbl_n88l25_s4567", "intel/dsp_fw_kbl.bin", NULL, NULL,
-				NULL, &skl_dmic_data },
-	{ "MX98357A", "kbl_n88l25_m98357a", "intel/dsp_fw_kbl.bin", NULL, NULL,
-				NULL, &skl_dmic_data },
+	{ "INT343B", "kbl_n88l25_s4567", "intel/dsp_fw_kbl.bin", NULL,
+				sst_acpi_codec_list, &kbl_codecs,
+				&skl_dmic_data },
+	{ "MX98357A", "kbl_n88l25_m98357a", "intel/dsp_fw_kbl.bin", NULL,
+				sst_acpi_codec_list, &kbl_codecs,
+				&skl_dmic_data },
 	{}
 };
 
Signature · 1 line
1.9.1
author
#9 lore raw

PATCH 5/6 ASoC: Intel: Add Kabylake Realtek Maxim machine driver

In reply to Naveen M

This patch adds Kabylake I2S machine driver which uses codecs MAX98927 as speakers and RT5663 as headset, configured to ssp0 & ssp1 respectively.

---
 sound/soc/intel/Kconfig                      |  15 +
 sound/soc/intel/boards/Makefile              |   2 +
 sound/soc/intel/boards/kbl_rt5663_max98927.c | 687 +++++++++++++++++++++++++++
 3 files changed, 704 insertions(+)
 create mode 100644 sound/soc/intel/boards/kbl_rt5663_max98927.c
sound/soc/intel/Kconfig +15 -0
index 67968ef..a9c50d0 100644
@@ -226,6 +226,21 @@ config SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH
 	  connector
 	  If unsure select "N".
 
+config SND_SOC_INTEL_KBL_RT5663_MAX98927_MACH
+	tristate "ASoC Audio driver for KBL with RT5663 and MAX98927 in I2S Mode"
+	depends on X86_INTEL_LPSS && I2C
+	select SND_SOC_INTEL_SST
+	select SND_SOC_INTEL_SKYLAKE
+	select SND_SOC_RT5663
+	select SND_SOC_MAX98927
+	select SND_SOC_DMIC
+	select SND_SOC_HDAC_HDMI
+	help
+	  This adds support for ASoC Onboard Codec I2S machine driver. This will
+	  create an alsa sound card for RT5663 + MAX98927.
+	  Say Y if you have such a device.
+	  If unsure select "N".
+
 config SND_SOC_INTEL_SKYLAKE
 	tristate
 	select SND_HDA_EXT_CORE
sound/soc/intel/boards/Makefile +2 -0
index 56896e0..c92ebca 100644
@@ -12,6 +12,7 @@ snd-soc-sst-cht-bsw-rt5645-objs := cht_bsw_rt5645.o
 snd-soc-sst-cht-bsw-max98090_ti-objs := cht_bsw_max98090_ti.o
 snd-soc-sst-byt-cht-da7213-objs := bytcht_da7213.o
 snd-soc-sst-byt-cht-nocodec-objs := bytcht_nocodec.o
+snd-soc-kbl_rt5663_max98927-objs := kbl_rt5663_max98927.o
 snd-soc-skl_rt286-objs := skl_rt286.o
 snd-skl_nau88l25_max98357a-objs := skl_nau88l25_max98357a.o
 snd-soc-skl_nau88l25_ssm4567-objs := skl_nau88l25_ssm4567.o
@@ -30,6 +31,7 @@ obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH) += snd-soc-sst-cht-bsw-rt5645.o
 obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH) += snd-soc-sst-cht-bsw-max98090_ti.o
 obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_DA7213_MACH) += snd-soc-sst-byt-cht-da7213.o
 obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH) += snd-soc-sst-byt-cht-nocodec.o
+obj-$(CONFIG_SND_SOC_INTEL_KBL_RT5663_MAX98927_MACH) += snd-soc-kbl_rt5663_max98927.o
 obj-$(CONFIG_SND_SOC_INTEL_SKL_RT286_MACH) += snd-soc-skl_rt286.o
 obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH) += snd-skl_nau88l25_max98357a.o
 obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH) += snd-soc-skl_nau88l25_ssm4567.o
sound/soc/intel/boards/kbl_rt5663_max98927.c new file +687 -0

687 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer
#10 lore raw

Applied "ASoC: Intel: Add Kabylake Realtek Maxim machine driver" to the asoc tree

The patch

ASoC: Intel: Add Kabylake Realtek Maxim machine driver

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 ec040dd5ef6478222fc4ed5b0ffced7bc95d2f27 Mon Sep 17 00:00:00 2001

From: Naveen M <[email protected]>
Date: Mon, 15 May 2017 13:42:16 +0530
Subject: [PATCH] ASoC: Intel: Add Kabylake Realtek Maxim machine driver

This patch adds Kabylake I2S machine driver which uses codecs MAX98927 as speakers and RT5663 as headset, configured to ssp0 & ssp1 respectively.

---
 sound/soc/intel/Kconfig                      |  15 +
 sound/soc/intel/boards/Makefile              |   2 +
 sound/soc/intel/boards/kbl_rt5663_max98927.c | 687 +++++++++++++++++++++++++++
 3 files changed, 704 insertions(+)
 create mode 100644 sound/soc/intel/boards/kbl_rt5663_max98927.c
sound/soc/intel/Kconfig +15 -0
index 67968ef3bbda..a9c50d022e73 100644
@@ -226,6 +226,21 @@ config SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH
 	  connector
 	  If unsure select "N".
 
+config SND_SOC_INTEL_KBL_RT5663_MAX98927_MACH
+	tristate "ASoC Audio driver for KBL with RT5663 and MAX98927 in I2S Mode"
+	depends on X86_INTEL_LPSS && I2C
+	select SND_SOC_INTEL_SST
+	select SND_SOC_INTEL_SKYLAKE
+	select SND_SOC_RT5663
+	select SND_SOC_MAX98927
+	select SND_SOC_DMIC
+	select SND_SOC_HDAC_HDMI
+	help
+	  This adds support for ASoC Onboard Codec I2S machine driver. This will
+	  create an alsa sound card for RT5663 + MAX98927.
+	  Say Y if you have such a device.
+	  If unsure select "N".
+
 config SND_SOC_INTEL_SKYLAKE
 	tristate
 	select SND_HDA_EXT_CORE
sound/soc/intel/boards/Makefile +2 -0
index 56896e09445d..c92ebcac0222 100644
@@ -12,6 +12,7 @@ snd-soc-sst-cht-bsw-rt5645-objs := cht_bsw_rt5645.o
 snd-soc-sst-cht-bsw-max98090_ti-objs := cht_bsw_max98090_ti.o
 snd-soc-sst-byt-cht-da7213-objs := bytcht_da7213.o
 snd-soc-sst-byt-cht-nocodec-objs := bytcht_nocodec.o
+snd-soc-kbl_rt5663_max98927-objs := kbl_rt5663_max98927.o
 snd-soc-skl_rt286-objs := skl_rt286.o
 snd-skl_nau88l25_max98357a-objs := skl_nau88l25_max98357a.o
 snd-soc-skl_nau88l25_ssm4567-objs := skl_nau88l25_ssm4567.o
@@ -30,6 +31,7 @@ obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_RT5645_MACH) += snd-soc-sst-cht-bsw-rt5645.o
 obj-$(CONFIG_SND_SOC_INTEL_CHT_BSW_MAX98090_TI_MACH) += snd-soc-sst-cht-bsw-max98090_ti.o
 obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_DA7213_MACH) += snd-soc-sst-byt-cht-da7213.o
 obj-$(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH) += snd-soc-sst-byt-cht-nocodec.o
+obj-$(CONFIG_SND_SOC_INTEL_KBL_RT5663_MAX98927_MACH) += snd-soc-kbl_rt5663_max98927.o
 obj-$(CONFIG_SND_SOC_INTEL_SKL_RT286_MACH) += snd-soc-skl_rt286.o
 obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH) += snd-skl_nau88l25_max98357a.o
 obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH) += snd-soc-skl_nau88l25_ssm4567.o
sound/soc/intel/boards/kbl_rt5663_max98927.c new file +687 -0

687 lines not on this page · raw message

Signature · 1 line
2.11.0
author
#11 lore raw

PATCH 6/6 ASoC: Intel: Add Kabylake RT5663+MAX98927 machine driver entry

In reply to Naveen M

Adds kbl_rt5663_max98927_i2s machine driver entry into machine table

---
 sound/soc/intel/skylake/skl.c | 4 ++++
 1 file changed, 4 insertions(+)
sound/soc/intel/skylake/skl.c +4 -0
index b9faa20..6040352 100644
@@ -865,6 +865,7 @@ static void skl_remove(struct pci_dev *pci)
 static struct sst_codecs skl_codecs = { 1, {"NAU88L25"} };
 static struct sst_codecs kbl_codecs = { 1, {"NAU88L25"} };
 static struct sst_codecs bxt_codecs = { 1, {"MX98357A"} };
+static struct sst_codecs kbl_poppy_codecs = { 1, {"10EC5663"} };
 
 static struct sst_acpi_mach sst_skl_devdata[] = {
 	{ "INT343A", "skl_alc286s_i2s", "intel/dsp_fw_release.bin", NULL,
@@ -894,6 +895,9 @@ static void skl_remove(struct pci_dev *pci)
 	{ "MX98357A", "kbl_n88l25_m98357a", "intel/dsp_fw_kbl.bin", NULL,
 				sst_acpi_codec_list, &kbl_codecs,
 				&skl_dmic_data },
+	{ "MX98927", "kbl_rt5663_m98927", "intel/dsp_fw_kbl.bin", NULL,
+				sst_acpi_codec_list, &kbl_poppy_codecs,
+				&skl_dmic_data },
 	{}
 };
 
Signature · 1 line
1.9.1