Skip to contentSkip to conversation

ASoC: Intel: Update broxton machine driver

PATCH Superseded Yong Zhi 2 participants 6 messages Jan 23, 2019 – Feb 12, 2019 1 message not in the archive

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Yong Zhi

author
#0 lore raw

v3 cover ASoC: Intel: Update broxton machine driver

Hello,

This patchset is an update to the following v2 posted by Naveen last year:

https://patchwork.kernel.org/patch/10335295/
https://patchwork.kernel.org/patch/10335293/
https://patchwork.kernel.org/patch/10335297/

1/5 and 5/5 of original series were merged. The changes have been tested for both bxt_da7219_max98357a and glk_da7219_max98357a.

Yong Zhi (3):
ASoC: Intel: Headset button support in broxton machine driver
ASoC: Intel: Add Geminilake Dialog Maxim machine driver
ASoC: Intel: glk: Add DAI links for Multi-Playback

 sound/soc/intel/boards/bxt_da7219_max98357a.c | 101 +++++++++++++++++++++++---
 1 file changed, 89 insertions(+), 12 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v3 1/3 ASoC: Intel: Headset button support in broxton machine driver

Map the 4 headset buttons to KEY_PAUSE, KEY_VOLUMEUP, KEY_VOLUMEDOWN and KEY_VOICECOMMAND.

---
 sound/soc/intel/boards/bxt_da7219_max98357a.c | 7 +++++++
 1 file changed, 7 insertions(+)
sound/soc/intel/boards/bxt_da7219_max98357a.c +7 -0
index 6f052fc..0aaaefa 100644
@@ -16,6 +16,7 @@
  * GNU General Public License for more details.
  */
 
+#include <linux/input.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <sound/core.h>
@@ -192,6 +193,12 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
 		return ret;
 	}
 
+	snd_jack_set_key(broxton_headset.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
+	snd_jack_set_key(broxton_headset.jack, SND_JACK_BTN_1, KEY_VOLUMEUP);
+	snd_jack_set_key(broxton_headset.jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN);
+	snd_jack_set_key(broxton_headset.jack, SND_JACK_BTN_3,
+			 KEY_VOICECOMMAND);
+
 	da7219_aad_jack_det(component, &broxton_headset);
 
 	snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC");
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH v3 2/3 ASoC: Intel: Add Geminilake Dialog Maxim machine driver

In reply to Yong Zhi

This patch enables support for GeminiLake with the DA7219 codec and MAX98357A amplifier. To avoid duplicating code, the existing machine driver for ApolloLake is reused with only changes in hardware connectivity (SSP2 for DA7219 and SSP1 for MAX98357A).

The dailinks are directly modified in this patch. Using a helper would be nicer, but it'll be done in a follow-up step with validation done across multiple machine drivers.

---
 sound/soc/intel/boards/bxt_da7219_max98357a.c | 79 +++++++++++++++++++++++----
 1 file changed, 67 insertions(+), 12 deletions(-)
sound/soc/intel/boards/bxt_da7219_max98357a.c +67 -12
index 0aaaefa..3f92665 100644
@@ -16,6 +16,7 @@
  * GNU General Public License for more details.
  */
 
+#include <asm/cpu_device_id.h>
 #include <linux/input.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
@@ -103,7 +104,7 @@ static const struct snd_soc_dapm_widget broxton_widgets[] = {
 			platform_clock_control,	SND_SOC_DAPM_POST_PMD|SND_SOC_DAPM_PRE_PMU),
 };
 
-static const struct snd_soc_dapm_route broxton_map[] = {
+static const struct snd_soc_dapm_route audio_map[] = {
 	/* HP jack connectors - unknown if we have jack detection */
 	{"Headphone Jack", NULL, "HPL"},
 	{"Headphone Jack", NULL, "HPR"},
@@ -118,15 +119,6 @@ static const struct snd_soc_dapm_route broxton_map[] = {
 	{"DMic", NULL, "SoC DMIC"},
 
 	/* CODEC BE connections */
-	{"HiFi Playback", NULL, "ssp5 Tx"},
-	{"ssp5 Tx", NULL, "codec0_out"},
-
-	{"Playback", NULL, "ssp1 Tx"},
-	{"ssp1 Tx", NULL, "codec1_out"},
-
-	{"codec0_in", NULL, "ssp1 Rx"},
-	{"ssp1 Rx", NULL, "Capture"},
-
 	{"HDMI1", NULL, "hif5-0 Output"},
 	{"HDMI2", NULL, "hif6-0 Output"},
 	{"HDMI2", NULL, "hif7-0 Output"},
@@ -146,6 +138,28 @@ static const struct snd_soc_dapm_route broxton_map[] = {
 	{ "Headset Mic", NULL, "Platform Clock" },
 };
 
+static const struct snd_soc_dapm_route broxton_map[] = {
+	{"HiFi Playback", NULL, "ssp5 Tx"},
+	{"ssp5 Tx", NULL, "codec0_out"},
+
+	{"Playback", NULL, "ssp1 Tx"},
+	{"ssp1 Tx", NULL, "codec1_out"},
+
+	{"codec0_in", NULL, "ssp1 Rx"},
+	{"ssp1 Rx", NULL, "Capture"},
+};
+
+static const struct snd_soc_dapm_route gemini_map[] = {
+	{"HiFi Playback", NULL, "ssp1 Tx"},
+	{"ssp1 Tx", NULL, "codec0_out"},
+
+	{"Playback", NULL, "ssp2 Tx"},
+	{"ssp2 Tx", NULL, "codec1_out"},
+
+	{"codec0_in", NULL, "ssp2 Rx"},
+	{"ssp2 Rx", NULL, "Capture"},
+};
+
 static int broxton_ssp_fixup(struct snd_soc_pcm_runtime *rtd,
 			struct snd_pcm_hw_params *params)
 {
@@ -538,6 +552,11 @@ static struct snd_soc_dai_link broxton_dais[] = {
 	},
 };
 
+static const struct x86_cpu_id glk_ids[] = {
+	{ X86_VENDOR_INTEL, 6, 0x7A }, /* Geminilake CPU_ID */
+	{}
+};
+
 #define NAME_SIZE	32
 static int bxt_card_late_probe(struct snd_soc_card *card)
 {
@@ -547,6 +566,13 @@ static int bxt_card_late_probe(struct snd_soc_card *card)
 	int err, i = 0;
 	char jack_name[NAME_SIZE];
 
+	if (x86_match_cpu(glk_ids))
+		snd_soc_dapm_add_routes(&card->dapm, gemini_map,
+					ARRAY_SIZE(gemini_map));
+	else
+		snd_soc_dapm_add_routes(&card->dapm, broxton_map,
+					ARRAY_SIZE(broxton_map));
+
 	list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
 		component = pcm->codec_dai->component;
 		snprintf(jack_name, sizeof(jack_name),
@@ -582,8 +608,8 @@ static struct snd_soc_card broxton_audio_card = {
 	.num_controls = ARRAY_SIZE(broxton_controls),
 	.dapm_widgets = broxton_widgets,
 	.num_dapm_widgets = ARRAY_SIZE(broxton_widgets),
-	.dapm_routes = broxton_map,
-	.num_dapm_routes = ARRAY_SIZE(broxton_map),
+	.dapm_routes = audio_map,
+	.num_dapm_routes = ARRAY_SIZE(audio_map),
 	.fully_routed = true,
 	.late_probe = bxt_card_late_probe,
 };
@@ -600,16 +626,43 @@ static int broxton_audio_probe(struct platform_device *pdev)
 
 	broxton_audio_card.dev = &pdev->dev;
 	snd_soc_card_set_drvdata(&broxton_audio_card, ctx);
+	if (x86_match_cpu(glk_ids)) {
+		unsigned int i;
+
+		broxton_audio_card.name = "glkda7219max";
+		/* Fixup the SSP entries for geminilake */
+		for (i = 0; i < ARRAY_SIZE(broxton_dais); i++) {
+			/* MAXIM_CODEC is connected to SSP1. */
+			if (!strcmp(broxton_dais[i].codec_dai_name,
+				    BXT_MAXIM_CODEC_DAI)) {
+				broxton_dais[i].name = "SSP1-Codec";
+				broxton_dais[i].cpu_dai_name = "SSP1 Pin";
+			}
+			/* DIALOG_CODE is connected to SSP2 */
+			else if (!strcmp(broxton_dais[i].codec_dai_name,
+					 BXT_DIALOG_CODEC_DAI)) {
+				broxton_dais[i].name = "SSP2-Codec";
+				broxton_dais[i].cpu_dai_name = "SSP2 Pin";
+			}
+		}
+	}
 
 	return devm_snd_soc_register_card(&pdev->dev, &broxton_audio_card);
 }
 
+static const struct platform_device_id bxt_board_ids[] = {
+	{ .name = "bxt_da7219_max98357a" },
+	{ .name = "glk_da7219_max98357a" },
+	{ }
+};
+
 static struct platform_driver broxton_audio = {
 	.probe = broxton_audio_probe,
 	.driver = {
 		.name = "bxt_da7219_max98357a",
 		.pm = &snd_soc_pm_ops,
 	},
+	.id_table = bxt_board_ids,
 };
 module_platform_driver(broxton_audio)
 
@@ -619,5 +672,7 @@ MODULE_AUTHOR("Sathyanarayana Nujella <[email protected]>");
 MODULE_AUTHOR("Rohit Ainapure <[email protected]>");
 MODULE_AUTHOR("Harsha Priya <[email protected]>");
 MODULE_AUTHOR("Conrad Cooke <[email protected]>");
+MODULE_AUTHOR("Naveen Manohar <[email protected]>");
 MODULE_LICENSE("GPL v2");
 MODULE_ALIAS("platform:bxt_da7219_max98357a");
+MODULE_ALIAS("platform:glk_da7219_max98357a");
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH v3 3/3 ASoC: Intel: glk: Add DAI links for Multi-Playback

In reply to Yong Zhi

Add FE DAI link to support parallel playback on 2 ports simultaneously.

---
 sound/soc/intel/boards/bxt_da7219_max98357a.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
sound/soc/intel/boards/bxt_da7219_max98357a.c +15 -0
index 3f92665..6d31808 100644
@@ -50,6 +50,7 @@ struct bxt_card_private {
 enum {
 	BXT_DPCM_AUDIO_PB = 0,
 	BXT_DPCM_AUDIO_CP,
+	BXT_DPCM_AUDIO_HS_PB,
 	BXT_DPCM_AUDIO_REF_CP,
 	BXT_DPCM_AUDIO_DMIC_CP,
 	BXT_DPCM_AUDIO_HDMI1_PB,
@@ -404,6 +405,20 @@ static struct snd_soc_dai_link broxton_dais[] = {
 		.dpcm_capture = 1,
 		.ops = &broxton_da7219_fe_ops,
 	},
+	[BXT_DPCM_AUDIO_HS_PB] = {
+		.name = "Bxt Audio Headset Playback",
+		.stream_name = "Headset Playback",
+		.cpu_dai_name = "System Pin2",
+		.platform_name = "0000:00:0e.0",
+		.dynamic = 1,
+		.codec_name = "snd-soc-dummy",
+		.codec_dai_name = "snd-soc-dummy-dai",
+		.nonatomic = 1,
+		.trigger = {
+			SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
+		.dpcm_playback = 1,
+		.ops = &broxton_da7219_fe_ops,
+	},
 	[BXT_DPCM_AUDIO_REF_CP] =
 	{
 		.name = "Bxt Audio Reference cap",
Signature · 1 line
2.7.4

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 19 lines · Pierre-Louis Bossart
Quoted 16 lines · Yong Zhi

Hello,

This patchset is an update to the following v2 posted by Naveen last year:

https://patchwork.kernel.org/patch/10335295/
https://patchwork.kernel.org/patch/10335293/
https://patchwork.kernel.org/patch/10335297/

1/5 and 5/5 of original series were merged. The changes have been tested for both bxt_da7219_max98357a and glk_da7219_max98357a.

Yong Zhi (3):
ASoC: Intel: Headset button support in broxton machine driver
ASoC: Intel: Add Geminilake Dialog Maxim machine driver
ASoC: Intel: glk: Add DAI links for Multi-Playback

Quoted 7 lines
Quoted 2 lines
  sound/soc/intel/boards/bxt_da7219_max98357a.c | 101 +++++++++++++++++++++++---
  1 file changed, 89 insertions(+), 12 deletions(-)

All 3 patches

Yong Zhi, looks like this ack never made it outside of my draft folder on Jan 23 and now unfortunately the patches don't apply cleanly any longer. Would you mind sending a v4? Sorry for the delayed response and generating extra work :-(

Thanks!

-Pierre

author
#6 lore raw

Hi, Pierre,

Thanks for the review.

Quoted 34 lines

-----Original Message-----
From: Pierre-Louis Bossart [mailto:[email protected]]
Sent: Tuesday, February 12, 2019 3:18 PM
To: Zhi, Yong <[email protected]>; [email protected]; alsa-devel@alsa- project.org
Cc: [email protected]; N, Harshapriya <[email protected]>; M, Naveen <[email protected]>
Subject: Re: [PATCH v3 0/3] ASoC: Intel: Update broxton machine driver

Quoted 14 lines · Pierre-Louis Bossart
Quoted 11 lines · Yong Zhi

Hello,

This patchset is an update to the following v2 posted by Naveen last year:

https://patchwork.kernel.org/patch/10335295/
https://patchwork.kernel.org/patch/10335293/
https://patchwork.kernel.org/patch/10335297/

1/5 and 5/5 of original series were merged. The changes have been tested for both bxt_da7219_max98357a and glk_da7219_max98357a.

Quoted 6 lines
Quoted 6 lines

Yong Zhi (3):
ASoC: Intel: Headset button support in broxton machine driver
ASoC: Intel: Add Geminilake Dialog Maxim machine driver
ASoC: Intel: glk: Add DAI links for Multi-Playback

  sound/soc/intel/boards/bxt_da7219_max98357a.c | 101

+++++++++++++++++++++++---

Quoted 2 lines
Quoted 1 line
  1 file changed, 89 insertions(+), 12 deletions(-)
Quoted 9 lines
Quoted 4 lines

All 3 patches

Yong Zhi, looks like this ack never made it outside of my draft folder on Jan 23 and now unfortunately the patches don't apply cleanly any longer. Would you mind sending a v4? Sorry for the delayed response and generating extra work :-(

Sure, will send v4 with the Acked-by tag.

Quoted 4 lines

Thanks!

-Pierre