Skip to contentSkip to conversation

ASoC: Intel: sdw_max98373: add card_late_probe support

PATCH In review Pierre-Louis Bossart 2 participants 6 messages Jun 25, 2020 – Jun 26, 2020

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

PATCH 16/17 ASoC: Intel: sdw_max98373: add card_late_probe support

From: randerwang <[email protected]>

Disable Left and Right Spk pin after boot so that sof can get suspended. Please check patch: ASoC: Intel: Boards:
tgl_max98373: add dai_trigger function

---
 sound/soc/intel/boards/sof_sdw.c          | 19 ++++++++++++++++++-
 sound/soc/intel/boards/sof_sdw_common.h   |  6 ++++++
 sound/soc/intel/boards/sof_sdw_max98373.c | 12 ++++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)
sound/soc/intel/boards/sof_sdw.c +18 -1
index 45be9ec6d4ef..be8eccb50450 100644
@@ -237,6 +237,7 @@ static struct sof_sdw_codec_info codec_info_list[] = {
 		.direction = {true, true},
 		.dai_name = "max98373-aif1",
 		.init = sof_sdw_mx8373_init,
+		.codec_card_late_probe = sof_sdw_mx8373_late_probe,
 	},
 	{
 		.id = 0x5682,
@@ -927,13 +928,29 @@ static int sof_card_dai_links_create(struct device *dev,
 	return 0;
 }
 
+static int sof_sdw_card_late_probe(struct snd_soc_card *card)
+{
+	int i, ret;
+
+	for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) {
+		if (!codec_info_list[i].late_probe)
+			continue;
+
+		ret = codec_info_list[i].codec_card_late_probe(card);
+		if (ret < 0)
+			return ret;
+	}
+
+	return sof_sdw_hdmi_card_late_probe(card);
+}
+
 /* SoC card */
 static const char sdw_card_long_name[] = "Intel Soundwire SOF";
 
 static struct snd_soc_card card_sof_sdw = {
 	.name = "soundwire",
 	.owner = THIS_MODULE,
-	.late_probe = sof_sdw_hdmi_card_late_probe,
+	.late_probe = sof_sdw_card_late_probe,
 	.codec_conf = codec_conf,
 	.num_configs = ARRAY_SIZE(codec_conf),
 };
sound/soc/intel/boards/sof_sdw_common.h +6 -0
index 3f820cf99a89..426017626b16 100644
@@ -11,6 +11,7 @@
 
 #include <linux/bits.h>
 #include <linux/types.h>
+#include <sound/soc.h>
 
 #define MAX_NO_PROPS 2
 #define MAX_HDMI_NUM 4
@@ -61,6 +62,9 @@ struct sof_sdw_codec_info {
 		     struct snd_soc_dai_link *dai_links,
 		     struct sof_sdw_codec_info *info,
 		     bool playback);
+
+	bool late_probe;
+	int (*codec_card_late_probe)(struct snd_soc_card *card);
 };
 
 struct mc_private {
@@ -114,6 +118,8 @@ int sof_sdw_mx8373_init(const struct snd_soc_acpi_link_adr *link,
 			struct sof_sdw_codec_info *info,
 			bool playback);
 
+int sof_sdw_mx8373_late_probe(struct snd_soc_card *card);
+
 /* RT5682 support */
 int sof_sdw_rt5682_init(const struct snd_soc_acpi_link_adr *link,
 			struct snd_soc_dai_link *dai_links,
sound/soc/intel/boards/sof_sdw_max98373.c +12 -0
index a38ddc099a95..6437872a9b3d 100644
@@ -68,7 +68,19 @@ int sof_sdw_mx8373_init(const struct snd_soc_acpi_link_adr *link,
 	if (info->amp_num == 2)
 		dai_links->init = spk_init;
 
+	info->late_probe = true;
+
 	dai_links->ops = &max_98373_sdw_ops;
 
 	return 0;
 }
+
+int sof_sdw_mx8373_late_probe(struct snd_soc_card *card)
+{
+	struct snd_soc_dapm_context *dapm = &card->dapm;
+
+	/* Disable Left and Right Spk pin after boot */
+	snd_soc_dapm_disable_pin(dapm, "Left Spk");
+	snd_soc_dapm_disable_pin(dapm, "Right Spk");
+	return snd_soc_dapm_sync(dapm);
+}
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 5 lines · Pierre-Louis Bossart

From: randerwang <[email protected]>

Disable Left and Right Spk pin after boot so that sof can get suspended. Please check patch: ASoC: Intel: Boards:
tgl_max98373: add dai_trigger function

This doesn't apply against current code, please check and resend.

#2 lore raw
Quoted 8 lines · Mark Brown
Quoted 5 lines · Pierre-Louis Bossart

From: randerwang <[email protected]>

Disable Left and Right Spk pin after boot so that sof can get suspended. Please check patch: ASoC: Intel: Boards:
tgl_max98373: add dai_trigger function

This doesn't apply against current code, please check and resend.

Not sure what happened here, I always apply the patches on your latest branch in a separate tree, then re-extract them and recheck. maybe an email glitch, SMTP was behaving yesterday?

087e499f3588 (HEAD) ASoC: Intel: common: add match table for TGL MAX98373 + RT5682 SoundWire driver b823b27ac76a ASoC: Intel: sdw_max98373: add card_late_probe support
e880afab0e1e ASoC: Intel: sof_sdw: Add MAX98373 support
420f436a475d ASoc: Intel: cml_rt1011_rt5682: explicitly access first codec 5c1e816dc7f8 ASoC: Intel: Boards: tgl_max98373: Update TDM configuration in hw_params 580146e7aa3c ASoC: intel: cml_rt1011_rt5682: use for_each_card_prelinks 5be6a56bf667 ASoC: Intel: Boards: cml_rt1011_rt5682: use statically define codec config ec850dd28467 ASoC: Intel: Boards: cml_rt1011_rt5682: reduce log level for printing quirk ff4ddc936df9 ASoC: intel: sof_rt5682: Add support for jsl-max98360a-rt5682 340cd9f9204a ASoC: Intel: Boards: tgl_max98373: Fix the comment for max_98373_components 1411290ca7d7 ASoC: Intel: Boards: tgl_max98373: add dai_trigger function 66cc4de87f59 ASoC: Intel: boards: byt*.c: remove cast in dev_info quirk log 4d57ebbdc285 ASoC: Intel: sof_sdw: add quirk override with kernel parameter c0279ffae76b ASoC: Intel: bxt_rt298: add missing .owner field
6d3f35161e30 ASoC: Intel: sof_sdw: add missing .owner field
84b3d261c3c2 ASoC: Intel: cml_rt1011_rt5682: add missing .owner field
af35def7968d ASoC: SOF: nocodec: add missing .owner field
6f81e520b290 (broonie/for-5.9) ASoC: tas2562: Fix shut-down gpio property

maintainer
#3 lore raw
Quoted 7 lines · Pierre-Louis Bossart
Quoted 1 line · Mark Brown

This doesn't apply against current code, please check and resend.

Not sure what happened here, I always apply the patches on your latest branch in a separate tree, then re-extract them and recheck. maybe an email glitch, SMTP was behaving yesterday?

You didn't thread a bunch of patches in your series yesterday, if there were dependencies within the series they may have been disrupted.

#4 lore raw
Quoted 11 lines · Mark Brown
Quoted 7 lines · Pierre-Louis Bossart
Quoted 1 line · Mark Brown

This doesn't apply against current code, please check and resend.

Not sure what happened here, I always apply the patches on your latest branch in a separate tree, then re-extract them and recheck. maybe an email glitch, SMTP was behaving yesterday?

You didn't thread a bunch of patches in your series yesterday, if there were dependencies within the series they may have been disrupted.

that's probably it. git send-email died after a timeout at about 2/3rds of the series. I wasn't sure what to do so sent the missed patches separately. I didn't think of threading... Not sure however if there's a way to recover from this sort of errors. Maybe use -in-reply-to=<patch0 id> --nothread ?

maintainer
#5 lore raw
Quoted 2 lines · Pierre-Louis Bossart

Not sure however if there's a way to recover from this sort of errors. Maybe use -in-reply-to=<patch0 id> --nothread ?

Yes, that should do the right thing I think.