All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add rt1015 support to CML boards
@ 2020-10-30  6:36 ` Brent Lu
  0 siblings, 0 replies; 14+ messages in thread
From: Brent Lu @ 2020-10-30  6:36 UTC (permalink / raw)
  To: alsa-devel
  Cc: Cezary Rojewski, Pierre-Louis Bossart, Liam Girdwood, Jie Yang,
	Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Sathyanarayana Nujella, Guennadi Liakhovetski, Kai Vehmanen,
	Yong Zhi, Kuninori Morimoto, Brent Lu, Fred Oh, Rander Wang,
	Bard Liao, Jason Yan, linux-kernel

First patch adds tdm 4-slot 100fs DAI setting to avoid jitter of using
64fs on CML boards. Second patch is a DMI quirk for HP Dooly.


Brent Lu (2):
  ASoC: intel: sof_rt5682: Add support for cml_rt1015_rt5682
  ASoC: intel: sof_rt5682: Add quirk for Dooly

 sound/soc/intel/boards/sof_rt5682.c           | 61 +++++++++++++++++--
 .../intel/common/soc-acpi-intel-cml-match.c   | 13 ++++
 2 files changed, 69 insertions(+), 5 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 0/2] Add rt1015 support to CML boards
@ 2020-10-30  6:36 ` Brent Lu
  0 siblings, 0 replies; 14+ messages in thread
From: Brent Lu @ 2020-10-30  6:36 UTC (permalink / raw)
  To: alsa-devel
  Cc: Guennadi Liakhovetski, Cezary Rojewski, Kuninori Morimoto,
	Kai Vehmanen, Jason Yan, linux-kernel, Takashi Iwai, Jie Yang,
	Pierre-Louis Bossart, Liam Girdwood, Mark Brown,
	Sathyanarayana Nujella, Fred Oh, Rander Wang, Bard Liao,
	Brent Lu, Yong Zhi

First patch adds tdm 4-slot 100fs DAI setting to avoid jitter of using
64fs on CML boards. Second patch is a DMI quirk for HP Dooly.


Brent Lu (2):
  ASoC: intel: sof_rt5682: Add support for cml_rt1015_rt5682
  ASoC: intel: sof_rt5682: Add quirk for Dooly

 sound/soc/intel/boards/sof_rt5682.c           | 61 +++++++++++++++++--
 .../intel/common/soc-acpi-intel-cml-match.c   | 13 ++++
 2 files changed, 69 insertions(+), 5 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/2] ASoC: intel: sof_rt5682: Add support for cml_rt1015_rt5682
  2020-10-30  6:36 ` Brent Lu
@ 2020-10-30  6:36   ` Brent Lu
  -1 siblings, 0 replies; 14+ messages in thread
From: Brent Lu @ 2020-10-30  6:36 UTC (permalink / raw)
  To: alsa-devel
  Cc: Cezary Rojewski, Pierre-Louis Bossart, Liam Girdwood, Jie Yang,
	Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Sathyanarayana Nujella, Guennadi Liakhovetski, Kai Vehmanen,
	Yong Zhi, Kuninori Morimoto, Brent Lu, Fred Oh, Rander Wang,
	Bard Liao, Jason Yan, linux-kernel

This patch adds the driver data and updates quirk info for cml with
rt1015 speaker amp and rt5682 headset codec. Due to different mclk
frequency on JSL and CML, we need to use 4 slot TDM 100fs to avoid
the SSP m/n counter.

Signed-off-by: Brent Lu <brent.lu@intel.com>
---
 sound/soc/intel/boards/sof_rt5682.c           | 47 +++++++++++++++++--
 .../intel/common/soc-acpi-intel-cml-match.c   | 13 +++++
 2 files changed, 55 insertions(+), 5 deletions(-)

diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
index ddbb9fe7cc06..7701957e0eb7 100644
--- a/sound/soc/intel/boards/sof_rt5682.c
+++ b/sound/soc/intel/boards/sof_rt5682.c
@@ -42,8 +42,9 @@
 #define SOF_RT5682_NUM_HDMIDEV(quirk)	\
 	((quirk << SOF_RT5682_NUM_HDMIDEV_SHIFT) & SOF_RT5682_NUM_HDMIDEV_MASK)
 #define SOF_RT1015_SPEAKER_AMP_PRESENT		BIT(13)
-#define SOF_MAX98373_SPEAKER_AMP_PRESENT	BIT(14)
-#define SOF_MAX98360A_SPEAKER_AMP_PRESENT	BIT(15)
+#define SOF_RT1015_SPEAKER_AMP_100FS		BIT(14)
+#define SOF_MAX98373_SPEAKER_AMP_PRESENT	BIT(15)
+#define SOF_MAX98360A_SPEAKER_AMP_PRESENT	BIT(16)
 
 /* Default: MCLK on, MCLK 19.2M, SSP0  */
 static unsigned long sof_rt5682_quirk = SOF_RT5682_MCLK_EN |
@@ -291,21 +292,26 @@ static int sof_rt1015_hw_params(struct snd_pcm_substream *substream,
 	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
 	struct snd_soc_card *card = rtd->card;
 	struct snd_soc_dai *codec_dai;
-	int i, ret;
+	int i, fs, ret;
 
 	if (!snd_soc_card_get_codec_dai(card, "rt1015-aif"))
 		return 0;
 
+	if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_100FS)
+		fs = 100;
+	else
+		fs = 64;
+
 	for_each_rtd_codec_dais(rtd, i, codec_dai) {
 		/* Set tdm/i2s1 master bclk ratio */
-		ret = snd_soc_dai_set_bclk_ratio(codec_dai, 64);
+		ret = snd_soc_dai_set_bclk_ratio(codec_dai, fs);
 		if (ret < 0) {
 			dev_err(card->dev, "failed to set bclk ratio\n");
 			return ret;
 		}
 
 		ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK,
-					  params_rate(params) * 64,
+					  params_rate(params) * fs,
 					  params_rate(params) * 256);
 		if (ret < 0) {
 			dev_err(card->dev, "failed to set pll\n");
@@ -319,6 +325,26 @@ static int sof_rt1015_hw_params(struct snd_pcm_substream *substream,
 			dev_err(card->dev, "failed to set sysclk\n");
 			return ret;
 		}
+
+		if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_100FS) {
+			if (!strcmp(codec_dai->component->name, "i2c-10EC1015:00")) {
+				ret = snd_soc_dai_set_tdm_slot(codec_dai,
+							       0x0, 0x1, 4, 24);
+				if (ret < 0) {
+					dev_err(card->dev, "failed to set tdm slot\n");
+					return ret;
+				}
+			}
+
+			if (!strcmp(codec_dai->component->name, "i2c-10EC1015:01")) {
+				ret = snd_soc_dai_set_tdm_slot(codec_dai,
+							       0x0, 0x2, 4, 24);
+				if (ret < 0) {
+					dev_err(card->dev, "failed to set tdm slot\n");
+					return ret;
+				}
+			}
+		}
 	}
 
 	return 0;
@@ -875,6 +901,16 @@ static const struct platform_device_id board_ids[] = {
 					SOF_MAX98360A_SPEAKER_AMP_PRESENT |
 					SOF_RT5682_SSP_AMP(1)),
 	},
+	{
+		.name = "cml_rt1015_rt5682",
+		.driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
+					SOF_RT5682_MCLK_24MHZ |
+					SOF_RT5682_SSP_CODEC(0) |
+					SOF_SPEAKER_AMP_PRESENT |
+					SOF_RT1015_SPEAKER_AMP_PRESENT |
+					SOF_RT1015_SPEAKER_AMP_100FS |
+					SOF_RT5682_SSP_AMP(1)),
+	},
 	{ }
 };
 
@@ -898,3 +934,4 @@ MODULE_ALIAS("platform:tgl_max98357a_rt5682");
 MODULE_ALIAS("platform:jsl_rt5682_rt1015");
 MODULE_ALIAS("platform:tgl_max98373_rt5682");
 MODULE_ALIAS("platform:jsl_rt5682_max98360a");
+MODULE_ALIAS("platform:cml_rt1015_rt5682");
diff --git a/sound/soc/intel/common/soc-acpi-intel-cml-match.c b/sound/soc/intel/common/soc-acpi-intel-cml-match.c
index 26dde88bb227..adddc91918df 100644
--- a/sound/soc/intel/common/soc-acpi-intel-cml-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-cml-match.c
@@ -14,6 +14,11 @@ static struct snd_soc_acpi_codecs rt1011_spk_codecs = {
 	.codecs = {"10EC1011"}
 };
 
+static struct snd_soc_acpi_codecs rt1015_spk_codecs = {
+	.num_codecs = 1,
+	.codecs = {"10EC1015"}
+};
+
 static struct snd_soc_acpi_codecs max98357a_spk_codecs = {
 	.num_codecs = 1,
 	.codecs = {"MX98357A"}
@@ -38,6 +43,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_machines[] = {
 		.sof_fw_filename = "sof-cml.ri",
 		.sof_tplg_filename = "sof-cml-rt1011-rt5682.tplg",
 	},
+	{
+		.id = "10EC5682",
+		.drv_name = "cml_rt1015_rt5682",
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &rt1015_spk_codecs,
+		.sof_fw_filename = "sof-cml.ri",
+		.sof_tplg_filename = "sof-cml-rt1011-rt5682.tplg",
+	},
 	{
 		.id = "10EC5682",
 		.drv_name = "sof_rt5682",
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 1/2] ASoC: intel: sof_rt5682: Add support for cml_rt1015_rt5682
@ 2020-10-30  6:36   ` Brent Lu
  0 siblings, 0 replies; 14+ messages in thread
From: Brent Lu @ 2020-10-30  6:36 UTC (permalink / raw)
  To: alsa-devel
  Cc: Guennadi Liakhovetski, Cezary Rojewski, Kuninori Morimoto,
	Kai Vehmanen, Jason Yan, linux-kernel, Takashi Iwai, Jie Yang,
	Pierre-Louis Bossart, Liam Girdwood, Mark Brown,
	Sathyanarayana Nujella, Fred Oh, Rander Wang, Bard Liao,
	Brent Lu, Yong Zhi

This patch adds the driver data and updates quirk info for cml with
rt1015 speaker amp and rt5682 headset codec. Due to different mclk
frequency on JSL and CML, we need to use 4 slot TDM 100fs to avoid
the SSP m/n counter.

Signed-off-by: Brent Lu <brent.lu@intel.com>
---
 sound/soc/intel/boards/sof_rt5682.c           | 47 +++++++++++++++++--
 .../intel/common/soc-acpi-intel-cml-match.c   | 13 +++++
 2 files changed, 55 insertions(+), 5 deletions(-)

diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
index ddbb9fe7cc06..7701957e0eb7 100644
--- a/sound/soc/intel/boards/sof_rt5682.c
+++ b/sound/soc/intel/boards/sof_rt5682.c
@@ -42,8 +42,9 @@
 #define SOF_RT5682_NUM_HDMIDEV(quirk)	\
 	((quirk << SOF_RT5682_NUM_HDMIDEV_SHIFT) & SOF_RT5682_NUM_HDMIDEV_MASK)
 #define SOF_RT1015_SPEAKER_AMP_PRESENT		BIT(13)
-#define SOF_MAX98373_SPEAKER_AMP_PRESENT	BIT(14)
-#define SOF_MAX98360A_SPEAKER_AMP_PRESENT	BIT(15)
+#define SOF_RT1015_SPEAKER_AMP_100FS		BIT(14)
+#define SOF_MAX98373_SPEAKER_AMP_PRESENT	BIT(15)
+#define SOF_MAX98360A_SPEAKER_AMP_PRESENT	BIT(16)
 
 /* Default: MCLK on, MCLK 19.2M, SSP0  */
 static unsigned long sof_rt5682_quirk = SOF_RT5682_MCLK_EN |
@@ -291,21 +292,26 @@ static int sof_rt1015_hw_params(struct snd_pcm_substream *substream,
 	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
 	struct snd_soc_card *card = rtd->card;
 	struct snd_soc_dai *codec_dai;
-	int i, ret;
+	int i, fs, ret;
 
 	if (!snd_soc_card_get_codec_dai(card, "rt1015-aif"))
 		return 0;
 
+	if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_100FS)
+		fs = 100;
+	else
+		fs = 64;
+
 	for_each_rtd_codec_dais(rtd, i, codec_dai) {
 		/* Set tdm/i2s1 master bclk ratio */
-		ret = snd_soc_dai_set_bclk_ratio(codec_dai, 64);
+		ret = snd_soc_dai_set_bclk_ratio(codec_dai, fs);
 		if (ret < 0) {
 			dev_err(card->dev, "failed to set bclk ratio\n");
 			return ret;
 		}
 
 		ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK,
-					  params_rate(params) * 64,
+					  params_rate(params) * fs,
 					  params_rate(params) * 256);
 		if (ret < 0) {
 			dev_err(card->dev, "failed to set pll\n");
@@ -319,6 +325,26 @@ static int sof_rt1015_hw_params(struct snd_pcm_substream *substream,
 			dev_err(card->dev, "failed to set sysclk\n");
 			return ret;
 		}
+
+		if (sof_rt5682_quirk & SOF_RT1015_SPEAKER_AMP_100FS) {
+			if (!strcmp(codec_dai->component->name, "i2c-10EC1015:00")) {
+				ret = snd_soc_dai_set_tdm_slot(codec_dai,
+							       0x0, 0x1, 4, 24);
+				if (ret < 0) {
+					dev_err(card->dev, "failed to set tdm slot\n");
+					return ret;
+				}
+			}
+
+			if (!strcmp(codec_dai->component->name, "i2c-10EC1015:01")) {
+				ret = snd_soc_dai_set_tdm_slot(codec_dai,
+							       0x0, 0x2, 4, 24);
+				if (ret < 0) {
+					dev_err(card->dev, "failed to set tdm slot\n");
+					return ret;
+				}
+			}
+		}
 	}
 
 	return 0;
@@ -875,6 +901,16 @@ static const struct platform_device_id board_ids[] = {
 					SOF_MAX98360A_SPEAKER_AMP_PRESENT |
 					SOF_RT5682_SSP_AMP(1)),
 	},
+	{
+		.name = "cml_rt1015_rt5682",
+		.driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
+					SOF_RT5682_MCLK_24MHZ |
+					SOF_RT5682_SSP_CODEC(0) |
+					SOF_SPEAKER_AMP_PRESENT |
+					SOF_RT1015_SPEAKER_AMP_PRESENT |
+					SOF_RT1015_SPEAKER_AMP_100FS |
+					SOF_RT5682_SSP_AMP(1)),
+	},
 	{ }
 };
 
@@ -898,3 +934,4 @@ MODULE_ALIAS("platform:tgl_max98357a_rt5682");
 MODULE_ALIAS("platform:jsl_rt5682_rt1015");
 MODULE_ALIAS("platform:tgl_max98373_rt5682");
 MODULE_ALIAS("platform:jsl_rt5682_max98360a");
+MODULE_ALIAS("platform:cml_rt1015_rt5682");
diff --git a/sound/soc/intel/common/soc-acpi-intel-cml-match.c b/sound/soc/intel/common/soc-acpi-intel-cml-match.c
index 26dde88bb227..adddc91918df 100644
--- a/sound/soc/intel/common/soc-acpi-intel-cml-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-cml-match.c
@@ -14,6 +14,11 @@ static struct snd_soc_acpi_codecs rt1011_spk_codecs = {
 	.codecs = {"10EC1011"}
 };
 
+static struct snd_soc_acpi_codecs rt1015_spk_codecs = {
+	.num_codecs = 1,
+	.codecs = {"10EC1015"}
+};
+
 static struct snd_soc_acpi_codecs max98357a_spk_codecs = {
 	.num_codecs = 1,
 	.codecs = {"MX98357A"}
@@ -38,6 +43,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_machines[] = {
 		.sof_fw_filename = "sof-cml.ri",
 		.sof_tplg_filename = "sof-cml-rt1011-rt5682.tplg",
 	},
+	{
+		.id = "10EC5682",
+		.drv_name = "cml_rt1015_rt5682",
+		.machine_quirk = snd_soc_acpi_codec_list,
+		.quirk_data = &rt1015_spk_codecs,
+		.sof_fw_filename = "sof-cml.ri",
+		.sof_tplg_filename = "sof-cml-rt1011-rt5682.tplg",
+	},
 	{
 		.id = "10EC5682",
 		.drv_name = "sof_rt5682",
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/2] ASoC: intel: sof_rt5682: Add quirk for Dooly
  2020-10-30  6:36 ` Brent Lu
@ 2020-10-30  6:36   ` Brent Lu
  -1 siblings, 0 replies; 14+ messages in thread
From: Brent Lu @ 2020-10-30  6:36 UTC (permalink / raw)
  To: alsa-devel
  Cc: Cezary Rojewski, Pierre-Louis Bossart, Liam Girdwood, Jie Yang,
	Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Sathyanarayana Nujella, Guennadi Liakhovetski, Kai Vehmanen,
	Yong Zhi, Kuninori Morimoto, Brent Lu, Fred Oh, Rander Wang,
	Bard Liao, Jason Yan, linux-kernel

This DMI product family string of this board is "Google_Hatch" so the
DMI quirk will take place. However, this board is using rt1015 speaker
amp instead of max98357a specified in the quirk. Therefore, we need an
new DMI quirk for this board.

Signed-off-by: Brent Lu <brent.lu@intel.com>
---
 sound/soc/intel/boards/sof_rt5682.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
index 7701957e0eb7..dfcdf6d4b6c8 100644
--- a/sound/soc/intel/boards/sof_rt5682.c
+++ b/sound/soc/intel/boards/sof_rt5682.c
@@ -100,6 +100,20 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = {
 					SOF_RT5682_MCLK_24MHZ |
 					SOF_RT5682_SSP_CODEC(1)),
 	},
+	{
+		.callback = sof_rt5682_quirk_cb,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Dooly"),
+		},
+		.driver_data = (void *)(SOF_RT5682_MCLK_EN |
+					SOF_RT5682_MCLK_24MHZ |
+					SOF_RT5682_SSP_CODEC(0) |
+					SOF_SPEAKER_AMP_PRESENT |
+					SOF_RT1015_SPEAKER_AMP_PRESENT |
+					SOF_RT1015_SPEAKER_AMP_100FS |
+					SOF_RT5682_SSP_AMP(1)),
+	},
 	{
 		.callback = sof_rt5682_quirk_cb,
 		.matches = {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/2] ASoC: intel: sof_rt5682: Add quirk for Dooly
@ 2020-10-30  6:36   ` Brent Lu
  0 siblings, 0 replies; 14+ messages in thread
From: Brent Lu @ 2020-10-30  6:36 UTC (permalink / raw)
  To: alsa-devel
  Cc: Guennadi Liakhovetski, Cezary Rojewski, Kuninori Morimoto,
	Kai Vehmanen, Jason Yan, linux-kernel, Takashi Iwai, Jie Yang,
	Pierre-Louis Bossart, Liam Girdwood, Mark Brown,
	Sathyanarayana Nujella, Fred Oh, Rander Wang, Bard Liao,
	Brent Lu, Yong Zhi

This DMI product family string of this board is "Google_Hatch" so the
DMI quirk will take place. However, this board is using rt1015 speaker
amp instead of max98357a specified in the quirk. Therefore, we need an
new DMI quirk for this board.

Signed-off-by: Brent Lu <brent.lu@intel.com>
---
 sound/soc/intel/boards/sof_rt5682.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
index 7701957e0eb7..dfcdf6d4b6c8 100644
--- a/sound/soc/intel/boards/sof_rt5682.c
+++ b/sound/soc/intel/boards/sof_rt5682.c
@@ -100,6 +100,20 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = {
 					SOF_RT5682_MCLK_24MHZ |
 					SOF_RT5682_SSP_CODEC(1)),
 	},
+	{
+		.callback = sof_rt5682_quirk_cb,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Dooly"),
+		},
+		.driver_data = (void *)(SOF_RT5682_MCLK_EN |
+					SOF_RT5682_MCLK_24MHZ |
+					SOF_RT5682_SSP_CODEC(0) |
+					SOF_SPEAKER_AMP_PRESENT |
+					SOF_RT1015_SPEAKER_AMP_PRESENT |
+					SOF_RT1015_SPEAKER_AMP_100FS |
+					SOF_RT5682_SSP_AMP(1)),
+	},
 	{
 		.callback = sof_rt5682_quirk_cb,
 		.matches = {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] ASoC: intel: sof_rt5682: Add quirk for Dooly
  2020-10-30  6:36   ` Brent Lu
@ 2020-10-30 15:32     ` Pierre-Louis Bossart
  -1 siblings, 0 replies; 14+ messages in thread
From: Pierre-Louis Bossart @ 2020-10-30 15:32 UTC (permalink / raw)
  To: Brent Lu, alsa-devel
  Cc: Guennadi Liakhovetski, Cezary Rojewski, Kuninori Morimoto,
	Kai Vehmanen, Jason Yan, linux-kernel, Takashi Iwai, Jie Yang,
	Liam Girdwood, Mark Brown, Sathyanarayana Nujella, Fred Oh,
	Rander Wang, Bard Liao, Yong Zhi



On 10/30/20 1:36 AM, Brent Lu wrote:
> This DMI product family string of this board is "Google_Hatch" so the
> DMI quirk will take place. However, this board is using rt1015 speaker
> amp instead of max98357a specified in the quirk. Therefore, we need an
> new DMI quirk for this board.

Do you actually need a DMI quirk for this platform?

the .driver_data below uses the exact same settings as what you would 
use with the generic solution based on ACPI IDs, see below.

Wondering if patch1 would be enough?

> 
> Signed-off-by: Brent Lu <brent.lu@intel.com>
> ---
>   sound/soc/intel/boards/sof_rt5682.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
> index 7701957e0eb7..dfcdf6d4b6c8 100644
> --- a/sound/soc/intel/boards/sof_rt5682.c
> +++ b/sound/soc/intel/boards/sof_rt5682.c
> @@ -100,6 +100,20 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = {
>   					SOF_RT5682_MCLK_24MHZ |
>   					SOF_RT5682_SSP_CODEC(1)),
>   	},
> +	{
> +		.callback = sof_rt5682_quirk_cb,
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
> +			DMI_MATCH(DMI_PRODUCT_NAME, "Dooly"),
> +		},
> +		.driver_data = (void *)(SOF_RT5682_MCLK_EN |
> +					SOF_RT5682_MCLK_24MHZ |
> +					SOF_RT5682_SSP_CODEC(0) |
> +					SOF_SPEAKER_AMP_PRESENT |
> +					SOF_RT1015_SPEAKER_AMP_PRESENT |
> +					SOF_RT1015_SPEAKER_AMP_100FS |
> +					SOF_RT5682_SSP_AMP(1)),
> +	},

is this really needed? it's the same as the .driver_data below:

@@ -875,6 +901,16 @@ static const struct platform_device_id board_ids[] = {
  					SOF_MAX98360A_SPEAKER_AMP_PRESENT |
  					SOF_RT5682_SSP_AMP(1)),
  	},
+	{
+		.name = "cml_rt1015_rt5682",
+		.driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
+					SOF_RT5682_MCLK_24MHZ |
+					SOF_RT5682_SSP_CODEC(0) |
+					SOF_SPEAKER_AMP_PRESENT |
+					SOF_RT1015_SPEAKER_AMP_PRESENT |
+					SOF_RT1015_SPEAKER_AMP_100FS |
+					SOF_RT5682_SSP_AMP(1)),
+	},



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] ASoC: intel: sof_rt5682: Add quirk for Dooly
@ 2020-10-30 15:32     ` Pierre-Louis Bossart
  0 siblings, 0 replies; 14+ messages in thread
From: Pierre-Louis Bossart @ 2020-10-30 15:32 UTC (permalink / raw)
  To: Brent Lu, alsa-devel
  Cc: Guennadi Liakhovetski, Cezary Rojewski, Kuninori Morimoto,
	Kai Vehmanen, Jason Yan, Jie Yang, linux-kernel, Takashi Iwai,
	Liam Girdwood, Mark Brown, Sathyanarayana Nujella, Rander Wang,
	Bard Liao, Fred Oh, Yong Zhi



On 10/30/20 1:36 AM, Brent Lu wrote:
> This DMI product family string of this board is "Google_Hatch" so the
> DMI quirk will take place. However, this board is using rt1015 speaker
> amp instead of max98357a specified in the quirk. Therefore, we need an
> new DMI quirk for this board.

Do you actually need a DMI quirk for this platform?

the .driver_data below uses the exact same settings as what you would 
use with the generic solution based on ACPI IDs, see below.

Wondering if patch1 would be enough?

> 
> Signed-off-by: Brent Lu <brent.lu@intel.com>
> ---
>   sound/soc/intel/boards/sof_rt5682.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
> index 7701957e0eb7..dfcdf6d4b6c8 100644
> --- a/sound/soc/intel/boards/sof_rt5682.c
> +++ b/sound/soc/intel/boards/sof_rt5682.c
> @@ -100,6 +100,20 @@ static const struct dmi_system_id sof_rt5682_quirk_table[] = {
>   					SOF_RT5682_MCLK_24MHZ |
>   					SOF_RT5682_SSP_CODEC(1)),
>   	},
> +	{
> +		.callback = sof_rt5682_quirk_cb,
> +		.matches = {
> +			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
> +			DMI_MATCH(DMI_PRODUCT_NAME, "Dooly"),
> +		},
> +		.driver_data = (void *)(SOF_RT5682_MCLK_EN |
> +					SOF_RT5682_MCLK_24MHZ |
> +					SOF_RT5682_SSP_CODEC(0) |
> +					SOF_SPEAKER_AMP_PRESENT |
> +					SOF_RT1015_SPEAKER_AMP_PRESENT |
> +					SOF_RT1015_SPEAKER_AMP_100FS |
> +					SOF_RT5682_SSP_AMP(1)),
> +	},

is this really needed? it's the same as the .driver_data below:

@@ -875,6 +901,16 @@ static const struct platform_device_id board_ids[] = {
  					SOF_MAX98360A_SPEAKER_AMP_PRESENT |
  					SOF_RT5682_SSP_AMP(1)),
  	},
+	{
+		.name = "cml_rt1015_rt5682",
+		.driver_data = (kernel_ulong_t)(SOF_RT5682_MCLK_EN |
+					SOF_RT5682_MCLK_24MHZ |
+					SOF_RT5682_SSP_CODEC(0) |
+					SOF_SPEAKER_AMP_PRESENT |
+					SOF_RT1015_SPEAKER_AMP_PRESENT |
+					SOF_RT1015_SPEAKER_AMP_100FS |
+					SOF_RT5682_SSP_AMP(1)),
+	},



^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [PATCH 2/2] ASoC: intel: sof_rt5682: Add quirk for Dooly
  2020-10-30 15:32     ` Pierre-Louis Bossart
@ 2020-10-30 16:44       ` Lu, Brent
  -1 siblings, 0 replies; 14+ messages in thread
From: Lu, Brent @ 2020-10-30 16:44 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel
  Cc: Guennadi Liakhovetski, Rojewski, Cezary, Kuninori Morimoto,
	Kai Vehmanen, Jason Yan, linux-kernel, Takashi Iwai, Jie Yang,
	Liam Girdwood, Mark Brown, Nujella, Sathyanarayana, Fred Oh,
	Wang, Rander, Bard Liao, Zhi, Yong

, Brent Lu wrote:
> > This DMI product family string of this board is "Google_Hatch" so the
> > DMI quirk will take place. However, this board is using rt1015 speaker
> > amp instead of max98357a specified in the quirk. Therefore, we need an
> > new DMI quirk for this board.
> 
> Do you actually need a DMI quirk for this platform?
> 
> the .driver_data below uses the exact same settings as what you would use
> with the generic solution based on ACPI IDs, see below.
> 
> Wondering if patch1 would be enough?
> 

Dooly has DMI family string " Google_Hatch" so the DMI quirk will overwrite the
driver_data. I asked google but they prefer not removing this string so it seems to
me that one extra DMI quirk is needed.

                {
                                .callback = sof_rt5682_quirk_cb,
                                .matches = {
                                                DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Hatch"),
                                },
                                .driver_data = (void *)(SOF_RT5682_MCLK_EN |
                                                                                SOF_RT5682_MCLK_24MHZ |
                                                                                SOF_RT5682_SSP_CODEC(0) |
                                                                                SOF_SPEAKER_AMP_PRESENT |
                                                                                SOF_RT5682_SSP_AMP(1)),
                },

The other way is using acpi_dev_present() in probe to update the quirk with correct
codec setting. Which one do you think is better?


Regards,
Brent


^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [PATCH 2/2] ASoC: intel: sof_rt5682: Add quirk for Dooly
@ 2020-10-30 16:44       ` Lu, Brent
  0 siblings, 0 replies; 14+ messages in thread
From: Lu, Brent @ 2020-10-30 16:44 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel
  Cc: Guennadi Liakhovetski, Rojewski,  Cezary, Kuninori Morimoto,
	Kai Vehmanen, Jason Yan, Jie Yang, linux-kernel, Takashi Iwai,
	Liam Girdwood, Mark Brown, Nujella,  Sathyanarayana, Wang,
	Rander, Bard Liao, Fred Oh, Zhi, Yong

, Brent Lu wrote:
> > This DMI product family string of this board is "Google_Hatch" so the
> > DMI quirk will take place. However, this board is using rt1015 speaker
> > amp instead of max98357a specified in the quirk. Therefore, we need an
> > new DMI quirk for this board.
> 
> Do you actually need a DMI quirk for this platform?
> 
> the .driver_data below uses the exact same settings as what you would use
> with the generic solution based on ACPI IDs, see below.
> 
> Wondering if patch1 would be enough?
> 

Dooly has DMI family string " Google_Hatch" so the DMI quirk will overwrite the
driver_data. I asked google but they prefer not removing this string so it seems to
me that one extra DMI quirk is needed.

                {
                                .callback = sof_rt5682_quirk_cb,
                                .matches = {
                                                DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Hatch"),
                                },
                                .driver_data = (void *)(SOF_RT5682_MCLK_EN |
                                                                                SOF_RT5682_MCLK_24MHZ |
                                                                                SOF_RT5682_SSP_CODEC(0) |
                                                                                SOF_SPEAKER_AMP_PRESENT |
                                                                                SOF_RT5682_SSP_AMP(1)),
                },

The other way is using acpi_dev_present() in probe to update the quirk with correct
codec setting. Which one do you think is better?


Regards,
Brent


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] ASoC: intel: sof_rt5682: Add quirk for Dooly
  2020-10-30 16:44       ` Lu, Brent
@ 2020-10-30 16:54         ` Pierre-Louis Bossart
  -1 siblings, 0 replies; 14+ messages in thread
From: Pierre-Louis Bossart @ 2020-10-30 16:54 UTC (permalink / raw)
  To: Lu, Brent, alsa-devel
  Cc: Guennadi Liakhovetski, Rojewski, Cezary, Kuninori Morimoto,
	Kai Vehmanen, Jason Yan, linux-kernel, Takashi Iwai, Jie Yang,
	Liam Girdwood, Mark Brown, Nujella, Sathyanarayana, Fred Oh,
	Wang, Rander, Bard Liao, Zhi, Yong



On 10/30/20 11:44 AM, Lu, Brent wrote:
> , Brent Lu wrote:
>>> This DMI product family string of this board is "Google_Hatch" so the
>>> DMI quirk will take place. However, this board is using rt1015 speaker
>>> amp instead of max98357a specified in the quirk. Therefore, we need an
>>> new DMI quirk for this board.
>>
>> Do you actually need a DMI quirk for this platform?
>>
>> the .driver_data below uses the exact same settings as what you would use
>> with the generic solution based on ACPI IDs, see below.
>>
>> Wondering if patch1 would be enough?
>>
> 
> Dooly has DMI family string " Google_Hatch" so the DMI quirk will overwrite the
> driver_data. I asked google but they prefer not removing this string so it seems to
> me that one extra DMI quirk is needed.

I find this pretty funny. The PRODUCT_FAMILY was added to reduce the 
number of quirks, but of course there's a variant that has nothing to do 
with this 'FAMILY'.

You should add a comment on this, to make sure this information remains 
in the code and we don't lose it during code cleanups.

> 
>                  {
>                                  .callback = sof_rt5682_quirk_cb,
>                                  .matches = {
>                                                  DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Hatch"),
>                                  },
>                                  .driver_data = (void *)(SOF_RT5682_MCLK_EN |
>                                                                                  SOF_RT5682_MCLK_24MHZ |
>                                                                                  SOF_RT5682_SSP_CODEC(0) |
>                                                                                  SOF_SPEAKER_AMP_PRESENT |
>                                                                                  SOF_RT5682_SSP_AMP(1)),
>                  },
> 
> The other way is using acpi_dev_present() in probe to update the quirk with correct
> codec setting. Which one do you think is better?

The DMI quirk you added is probably better for now, I don't know if the 
odds of getting things right with acpi_dev_present() are that high or if 
we are going to get even more variants on top of this variant (e.g. 
tweeter/booster cases...).
If we get too many quirks we'll see later if we can simplify.

So if you don't mind adding a comment on the 'Dooly' quirk in a v3 that 
series is good to go.  Thank you!


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] ASoC: intel: sof_rt5682: Add quirk for Dooly
@ 2020-10-30 16:54         ` Pierre-Louis Bossart
  0 siblings, 0 replies; 14+ messages in thread
From: Pierre-Louis Bossart @ 2020-10-30 16:54 UTC (permalink / raw)
  To: Lu, Brent, alsa-devel
  Cc: Guennadi Liakhovetski, Rojewski, Cezary, Kuninori Morimoto,
	Kai Vehmanen, Jason Yan, Jie Yang, linux-kernel, Takashi Iwai,
	Liam Girdwood, Mark Brown, Nujella, Sathyanarayana, Wang, Rander,
	Bard Liao, Fred Oh, Zhi, Yong



On 10/30/20 11:44 AM, Lu, Brent wrote:
> , Brent Lu wrote:
>>> This DMI product family string of this board is "Google_Hatch" so the
>>> DMI quirk will take place. However, this board is using rt1015 speaker
>>> amp instead of max98357a specified in the quirk. Therefore, we need an
>>> new DMI quirk for this board.
>>
>> Do you actually need a DMI quirk for this platform?
>>
>> the .driver_data below uses the exact same settings as what you would use
>> with the generic solution based on ACPI IDs, see below.
>>
>> Wondering if patch1 would be enough?
>>
> 
> Dooly has DMI family string " Google_Hatch" so the DMI quirk will overwrite the
> driver_data. I asked google but they prefer not removing this string so it seems to
> me that one extra DMI quirk is needed.

I find this pretty funny. The PRODUCT_FAMILY was added to reduce the 
number of quirks, but of course there's a variant that has nothing to do 
with this 'FAMILY'.

You should add a comment on this, to make sure this information remains 
in the code and we don't lose it during code cleanups.

> 
>                  {
>                                  .callback = sof_rt5682_quirk_cb,
>                                  .matches = {
>                                                  DMI_MATCH(DMI_PRODUCT_FAMILY, "Google_Hatch"),
>                                  },
>                                  .driver_data = (void *)(SOF_RT5682_MCLK_EN |
>                                                                                  SOF_RT5682_MCLK_24MHZ |
>                                                                                  SOF_RT5682_SSP_CODEC(0) |
>                                                                                  SOF_SPEAKER_AMP_PRESENT |
>                                                                                  SOF_RT5682_SSP_AMP(1)),
>                  },
> 
> The other way is using acpi_dev_present() in probe to update the quirk with correct
> codec setting. Which one do you think is better?

The DMI quirk you added is probably better for now, I don't know if the 
odds of getting things right with acpi_dev_present() are that high or if 
we are going to get even more variants on top of this variant (e.g. 
tweeter/booster cases...).
If we get too many quirks we'll see later if we can simplify.

So if you don't mind adding a comment on the 'Dooly' quirk in a v3 that 
series is good to go.  Thank you!


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] ASoC: intel: sof_rt5682: Add quirk for Dooly
  2020-10-30 16:44       ` Lu, Brent
@ 2020-10-30 17:01         ` Mark Brown
  -1 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2020-10-30 17:01 UTC (permalink / raw)
  To: Lu, Brent
  Cc: Pierre-Louis Bossart, alsa-devel, Guennadi Liakhovetski,
	Rojewski, Cezary, Kuninori Morimoto, Kai Vehmanen, Jason Yan,
	linux-kernel, Takashi Iwai, Jie Yang, Liam Girdwood, Nujella,
	Sathyanarayana, Fred Oh, Wang, Rander, Bard Liao, Zhi, Yong

[-- Attachment #1: Type: text/plain, Size: 609 bytes --]

On Fri, Oct 30, 2020 at 04:44:17PM +0000, Lu, Brent wrote:
> , Brent Lu wrote:

> > Wondering if patch1 would be enough?

> Dooly has DMI family string " Google_Hatch" so the DMI quirk will overwrite the
> driver_data. I asked google but they prefer not removing this string so it seems to
> me that one extra DMI quirk is needed.

I think this needs at least a comment otherwise someone might come along
later and clean it up.

> The other way is using acpi_dev_present() in probe to update the quirk with correct
> codec setting. Which one do you think is better?

I don't have a strong opinion either way.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/2] ASoC: intel: sof_rt5682: Add quirk for Dooly
@ 2020-10-30 17:01         ` Mark Brown
  0 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2020-10-30 17:01 UTC (permalink / raw)
  To: Lu, Brent
  Cc: Guennadi Liakhovetski, alsa-devel, Kai Vehmanen,
	Kuninori Morimoto, Jason Yan, linux-kernel, Takashi Iwai,
	Jie Yang, Rojewski, Cezary, Pierre-Louis Bossart, Liam Girdwood,
	Fred Oh, Nujella, Sathyanarayana, Wang, Rander, Bard Liao, Zhi,
	Yong

[-- Attachment #1: Type: text/plain, Size: 609 bytes --]

On Fri, Oct 30, 2020 at 04:44:17PM +0000, Lu, Brent wrote:
> , Brent Lu wrote:

> > Wondering if patch1 would be enough?

> Dooly has DMI family string " Google_Hatch" so the DMI quirk will overwrite the
> driver_data. I asked google but they prefer not removing this string so it seems to
> me that one extra DMI quirk is needed.

I think this needs at least a comment otherwise someone might come along
later and clean it up.

> The other way is using acpi_dev_present() in probe to update the quirk with correct
> codec setting. Which one do you think is better?

I don't have a strong opinion either way.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-10-30 17:03 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30  6:36 [PATCH 0/2] Add rt1015 support to CML boards Brent Lu
2020-10-30  6:36 ` Brent Lu
2020-10-30  6:36 ` [PATCH 1/2] ASoC: intel: sof_rt5682: Add support for cml_rt1015_rt5682 Brent Lu
2020-10-30  6:36   ` Brent Lu
2020-10-30  6:36 ` [PATCH 2/2] ASoC: intel: sof_rt5682: Add quirk for Dooly Brent Lu
2020-10-30  6:36   ` Brent Lu
2020-10-30 15:32   ` Pierre-Louis Bossart
2020-10-30 15:32     ` Pierre-Louis Bossart
2020-10-30 16:44     ` Lu, Brent
2020-10-30 16:44       ` Lu, Brent
2020-10-30 16:54       ` Pierre-Louis Bossart
2020-10-30 16:54         ` Pierre-Louis Bossart
2020-10-30 17:01       ` Mark Brown
2020-10-30 17:01         ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.