[d-kernel] [PATCH 2/3] ASoC: Intel: sof_es8336: modify driver source code for v5.15.x

nickel на altlinux.org nickel на altlinux.org
Вт Дек 20 11:10:50 MSK 2022


From: Vasiliy Kovalev <kovalev at altlinux.org>

- readd dmi match info for following laptops:
  Aquarius Cmp NS685U R11
  CHUWI Innovation And Technology Hi10 X
  Kraftway ACCORD S15T
- add dmi match info for laptop HUAWEI D15 Matebook
- in the updated version of the driver, the default GPIO speakers
  configuration card has been changed. Now there is no need to apply
  quirks for some laptop models:
  3Logic Group Graviton N15i
  3Logic Group Graviton N15i-K2
  3Logic Group Lime 15.6
  DEPO Computers DPC156
  ICL Si16
- disable I2S link information from NHLT
- rename function snd_soc_card_jack_new_pins -> snd_soc_card_jack_new:
  there is no need to add the source code for the new function, so we
  will return the link to the existing one
- report the number of DMic's to the UCM:
  when applying the quirk about the presence of digital microphones in
  the system, you should also provide their number to the UCM manager
  for their correct configuration

Signed-off-by: Vasiliy Kovalev <kovalev at altlinux.org>
Signed-off-by: Nikolai Kostrigin <nickel at altlinux.org>
---
 sound/soc/intel/boards/sof_es8336.c | 78 +++++++++++++++++++++--------
 1 file changed, 57 insertions(+), 21 deletions(-)

diff --git a/sound/soc/intel/boards/sof_es8336.c b/sound/soc/intel/boards/sof_es8336.c
index 606cc3242a60f..4499f6b191d95 100644
--- a/sound/soc/intel/boards/sof_es8336.c
+++ b/sound/soc/intel/boards/sof_es8336.c
@@ -261,7 +261,7 @@ static int sof_es8316_init(struct snd_soc_pcm_runtime *runtime)
 	if (ret)
 		return ret;
 
-	ret = snd_soc_card_jack_new_pins(card, "Headset",
+	ret = snd_soc_card_jack_new(card, "Headset",
 					 SND_JACK_HEADSET | SND_JACK_BTN_0,
 					 &priv->jack, sof_es8316_jack_pins,
 					 ARRAY_SIZE(sof_es8316_jack_pins));
@@ -303,6 +303,23 @@ static int sof_es8336_quirk_cb(const struct dmi_system_id *id)
  * if the topology file is modified as well.
  */
 static const struct dmi_system_id sof_es8336_quirk_table[] = {
+	{
+		.callback = sof_es8336_quirk_cb,
+		.matches = {
+			/* market name: Aquarius Cmp NS685U R11 */
+			DMI_MATCH(DMI_SYS_VENDOR, "Aquarius"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "NS685U R11"),
+		},
+		.driver_data = (void *)(SOF_ES8336_JD_INVERTED)
+	},
+	{
+		.callback = sof_es8336_quirk_cb,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "CHUWI Innovation And Technology"),
+			DMI_MATCH(DMI_BOARD_NAME, "Hi10 X"),
+		},
+		.driver_data = (void *)SOF_ES8336_SSP_CODEC(2)
+	},
 	{
 		.callback = sof_es8336_quirk_cb,
 		.matches = {
@@ -311,6 +328,14 @@ static const struct dmi_system_id sof_es8336_quirk_table[] = {
 		},
 		.driver_data = (void *)(SOF_ES8336_SPEAKERS_EN_GPIO1_QUIRK)
 	},
+	{
+		.callback = sof_es8336_quirk_cb,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "HUAWEI"),
+			DMI_MATCH(DMI_BOARD_NAME, "BOD-WXX9-PCB-B4"),
+		},
+		.driver_data = (void *)(SOF_ES8336_ENABLE_DMIC)
+	},
 	{
 		.callback = sof_es8336_quirk_cb,
 		.matches = {
@@ -320,6 +345,15 @@ static const struct dmi_system_id sof_es8336_quirk_table[] = {
 		.driver_data = (void *)(SOF_ES8336_HEADPHONE_GPIO |
 					SOC_ES8336_HEADSET_MIC1)
 	},
+	{
+		.callback = sof_es8336_quirk_cb,
+		.matches = {
+			/* market name: Kraftway ACCORD S15T */
+			DMI_MATCH(DMI_SYS_VENDOR, "Kraftway"),
+			DMI_MATCH(DMI_BOARD_NAME, "S15T"),
+		},
+		.driver_data = (void *)(SOF_ES8336_JD_INVERTED)
+	},
 	{}
 };
 
@@ -597,25 +631,25 @@ static int sof_es8336_probe(struct platform_device *pdev)
 	 * Because more than one SSP will be enabled for HDMI capture hence wrong codec
 	 * SSP will be set.
 	 */
-	if (mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER) {
-		if (!mach->mach_params.i2s_link_mask) {
-			dev_warn(dev, "No I2S link information provided, using SSP0. This may need to be modified with the quirk module parameter\n");
-		} else {
-			/*
-			 * Set configuration based on platform NHLT.
-			 * In this machine driver, we can only support one SSP for the
-			 * ES8336 link.
-			 * In some cases multiple SSPs can be reported by NHLT, starting MSB-first
-			 * seems to pick the right connection.
-			 */
-			unsigned long ssp;
-
-			/* fls returns 1-based results, SSPs indices are 0-based */
-			ssp = fls(mach->mach_params.i2s_link_mask) - 1;
-
-			quirk |= ssp;
-		}
-	}
+//	if (mach->tplg_quirk_mask & SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER) {
+//		if (!mach->mach_params.i2s_link_mask) {
+//			dev_warn(dev, "No I2S link information provided, using SSP0. This may need to be modified with the quirk module parameter\n");
+//		} else {
+//			/*
+//			 * Set configuration based on platform NHLT.
+//			 * In this machine driver, we can only support one SSP for the
+//			 * ES8336 link.
+//			 * In some cases multiple SSPs can be reported by NHLT, starting MSB-first
+//			 * seems to pick the right connection.
+//			 */
+//			unsigned long ssp;
+//
+//			/* fls returns 1-based results, SSPs indices are 0-based */
+//			ssp = fls(mach->mach_params.i2s_link_mask) - 1;
+//
+//			quirk |= ssp;
+//		}
+//	}
 
 	if (mach->mach_params.dmic_num)
 		quirk |= SOF_ES8336_ENABLE_DMIC;
@@ -627,8 +661,10 @@ static int sof_es8336_probe(struct platform_device *pdev)
 	}
 	log_quirks(dev);
 
-	if (quirk & SOF_ES8336_ENABLE_DMIC)
+	if (quirk & SOF_ES8336_ENABLE_DMIC){
 		dmic_be_num = 2;
+		mach->mach_params.dmic_num = 2;
+	}
 
 	/* compute number of dai links */
 	sof_es8336_card.num_links = 1 + dmic_be_num + hdmi_num;
-- 
2.33.5



Подробная информация о списке рассылки devel-kernel