Skip to contentSkip to conversation

BYT/CHT codec/machine drivers update

PATCH In review Pierre-Louis Bossart 3 participants 28 messages Aug 22, 2017 – Sep 25, 2017

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

cover BYT/CHT codec/machine drivers update

Finally took the time to cleanup known fixes for codec and machine drivers. I tested on Baytrail/Cherrytrail and w/ RT5640, 45 and 72.

This should be the last batch of fixes before we move on to the integration of SOF (Sound Open Firmware) support in the mainline.

This batch contains two patches already submitted by Thierry Escande on alsa-devel but never merged.

Fang, Yang A (1):
ASoC: ts3a227e: add acpi table

Pierre-Louis Bossart (12):
ASoC: Intel: boards: use devm_clk_get() unconditionally
ASoC: intel: cht_bsw_max98090: add support for clock framework
ASoC: Intel: cht_bsw_max98090: Fix I2S config + unused code
ASoC: Intel: atom: add support for Baytrail Chromebooks
ASoC: Intel: bytcr-rt5651: fix capture routes
ASoC: Intel: bytcr_rt5651: add MCLK support
ASoC: Intel: bytcr_rt5651: filter codec name
ASoC: codecs: rt5645: add quirks for Asus T100HA
ASoC: Intel: bytcr_rt5640: simplify MCLK quirk tests
ASoC: codecs: rt5670: add jack detection quirk for Dell Venue 5585
ASoC: Intel: cht_bsw_rt5672: use actual HID in suspend/resume
ASoC: Intel: cht_bsw_rt5672: fix card name

Thierry Escande (1):
ASoc: cht_bsw_max98090_ti: Fix jack initialization

 sound/soc/codecs/rt5645.c                    |  20 ++
 sound/soc/codecs/rt5670.c                    |  16 ++
 sound/soc/codecs/ts3a227e.c                  |  10 +
 sound/soc/intel/atom/sst/sst_acpi.c          |   8 +
 sound/soc/intel/boards/bytcr_rt5640.c        |   8 +-
 sound/soc/intel/boards/bytcr_rt5651.c        | 278 ++++++++++++++++++++++++---
 sound/soc/intel/boards/cht_bsw_max98090_ti.c | 157 ++++++++++++---
 sound/soc/intel/boards/cht_bsw_rt5645.c      |  14 +-
 sound/soc/intel/boards/cht_bsw_rt5672.c      |  36 ++--
 9 files changed, 460 insertions(+), 87 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/14 ASoC: Intel: boards: use devm_clk_get() unconditionally

The clock framework was only used in Baytrail, on Cherrytrail the firmware takes care of the MCLK/plt_clk_3.

With the fix in 'commit d31fd43c0f9a
("clk: x86: Do not gate clocks enabled by the firmware")'

the firmware-managed clocks are not impacted by enable/disable requests make at the driver level, and the rates are identical.

Remove all checks for Baytrail and use devm_clk_get() unconditionally. Tested on Asus T100HA (CHT) and Asus T100TAF (BYT)

---
 sound/soc/intel/boards/bytcr_rt5640.c   |  2 +-
 sound/soc/intel/boards/cht_bsw_rt5645.c | 14 ++++++--------
 sound/soc/intel/boards/cht_bsw_rt5672.c | 26 ++++++--------------------
 3 files changed, 13 insertions(+), 29 deletions(-)
sound/soc/intel/boards/bytcr_rt5640.c +1 -1
index 4a76b09..15b1e29 100644
@@ -891,7 +891,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 			byt_rt5640_cpu_dai_name;
 	}
 
-	if ((byt_rt5640_quirk & BYT_RT5640_MCLK_EN) && (is_valleyview())) {
+	if (byt_rt5640_quirk & BYT_RT5640_MCLK_EN) {
 		priv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
 		if (IS_ERR(priv->mclk)) {
 			ret_val = PTR_ERR(priv->mclk);
sound/soc/intel/boards/cht_bsw_rt5645.c +6 -8
index 5bcde01..d553e2b 100644
@@ -682,14 +682,12 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 			cht_rt5645_cpu_dai_name;
 	}
 
-	if (is_valleyview()) {
-		drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
-		if (IS_ERR(drv->mclk)) {
-			dev_err(&pdev->dev,
-				"Failed to get MCLK from pmc_plt_clk_3: %ld\n",
-				PTR_ERR(drv->mclk));
-			return PTR_ERR(drv->mclk);
-		}
+	drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
+	if (IS_ERR(drv->mclk)) {
+		dev_err(&pdev->dev,
+			"Failed to get MCLK from pmc_plt_clk_3: %ld\n",
+			PTR_ERR(drv->mclk));
+		return PTR_ERR(drv->mclk);
 	}
 
 	snd_soc_card_set_drvdata(card, drv);
sound/soc/intel/boards/cht_bsw_rt5672.c +6 -20
index f597d55..ad2f27e 100644
@@ -394,18 +394,6 @@ static struct snd_soc_card snd_soc_card_cht = {
 	.resume_post = cht_resume_post,
 };
 
-static bool is_valleyview(void)
-{
-	static const struct x86_cpu_id cpu_ids[] = {
-		{ X86_VENDOR_INTEL, 6, 55 }, /* Valleyview, Bay Trail */
-		{}
-	};
-
-	if (!x86_match_cpu(cpu_ids))
-		return false;
-	return true;
-}
-
 #define RT5672_I2C_DEFAULT	"i2c-10EC5670:00"
 
 static int snd_cht_mc_probe(struct platform_device *pdev)
@@ -439,14 +427,12 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 		}
 	}
 
-	if (is_valleyview()) {
-		drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
-		if (IS_ERR(drv->mclk)) {
-			dev_err(&pdev->dev,
-				"Failed to get MCLK from pmc_plt_clk_3: %ld\n",
-				PTR_ERR(drv->mclk));
-			return PTR_ERR(drv->mclk);
-		}
+	drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
+	if (IS_ERR(drv->mclk)) {
+		dev_err(&pdev->dev,
+			"Failed to get MCLK from pmc_plt_clk_3: %ld\n",
+			PTR_ERR(drv->mclk));
+		return PTR_ERR(drv->mclk);
 	}
 	snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
 
Signature · 1 line
2.9.3
Reviewed-by on v1 1/14
#2 lore raw

Re: [PATCH 01/14] ASoC: Intel: boards: use devm_clk_get() unconditionally

Quoted 9 lines · Pierre-Louis Bossart

The clock framework was only used in Baytrail, on Cherrytrail the firmware takes care of the MCLK/plt_clk_3.

With the fix in 'commit d31fd43c0f9a
("clk: x86: Do not gate clocks enabled by the firmware")'

the firmware-managed clocks are not impacted by enable/disable requests make at the driver level, and the rates are identical.

Quoted 6 lines

Remove all checks for Baytrail and use devm_clk_get() unconditionally. Tested on Asus T100HA (CHT) and Asus T100TAF (BYT)

Cc: Andy Shevchenko <[email protected]>
Signed-off-by: Pierre-Louis Bossart <pierre- [email protected]>

It's a good clean up! (I believe it had been tested on CHT platforms as well)

P.S. Shouldn't the corresponding asm/cpu_device_id.h header, or some other(s), be removed from inclusion as well?

Quoted 104 lines

---
 sound/soc/intel/boards/bytcr_rt5640.c   |  2 +- sound/soc/intel/boards/cht_bsw_rt5645.c | 14 ++++++-------- sound/soc/intel/boards/cht_bsw_rt5672.c | 26 ++++++----------------
----

 3 files changed, 13 insertions(+), 29 deletions(-)
sound/soc/intel/boards/bytcr_rt5640.c +0 -0
index 4a76b09..15b1e29 100644
@@ -891,7 +891,7 @@ static int snd_byt_rt5640_mc_probe(struct
 platform_device *pdev)
  			byt_rt5640_cpu_dai_name;
  	}

sound/soc/intel/boards/bytcr_rt5640.c +0 -1
-	if ((byt_rt5640_quirk & BYT_RT5640_MCLK_EN) &&

(is_valleyview())) {

sound/soc/intel/boards/bytcr_rt5640.c +1 -0
+	if (byt_rt5640_quirk & BYT_RT5640_MCLK_EN) {

  priv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
  if (IS_ERR(priv->mclk)) { ret_val = PTR_ERR(priv->mclk);

sound/soc/intel/boards/cht_bsw_rt5645.c +0 -0
index 5bcde01..d553e2b 100644
@@ -682,14 +682,12 @@ static int snd_cht_mc_probe(struct
 platform_device *pdev)
  			cht_rt5645_cpu_dai_name;
  	}

sound/soc/intel/boards/cht_bsw_rt5645.c +0 -2
-	if (is_valleyview()) {
-		drv->mclk = devm_clk_get(&pdev->dev,

"pmc_plt_clk_3");

sound/soc/intel/boards/cht_bsw_rt5645.c +0 -3
-		if (IS_ERR(drv->mclk)) {
-			dev_err(&pdev->dev,
-				"Failed to get MCLK from

pmc_plt_clk_3: %ld\n",

sound/soc/intel/boards/cht_bsw_rt5645.c +4 -3
-				PTR_ERR(drv->mclk));
-			return PTR_ERR(drv->mclk);
-		}
+	drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
+	if (IS_ERR(drv->mclk)) {
+		dev_err(&pdev->dev,
+			"Failed to get MCLK from pmc_plt_clk_3:

%ld\n",

sound/soc/intel/boards/cht_bsw_rt5645.c +2 -0
+			PTR_ERR(drv->mclk));
+		return PTR_ERR(drv->mclk);

  }

  snd_soc_card_set_drvdata(card, drv);

sound/soc/intel/boards/cht_bsw_rt5672.c +0 -0
index f597d55..ad2f27e 100644
@@ -394,18 +394,6 @@ static struct snd_soc_card snd_soc_card_cht = {
  	.resume_post = cht_resume_post,
  };

sound/soc/intel/boards/cht_bsw_rt5672.c +0 -4
-static bool is_valleyview(void)
-{
-	static const struct x86_cpu_id cpu_ids[] = {
-		{ X86_VENDOR_INTEL, 6, 55 }, /* Valleyview, Bay Trail

*/

sound/soc/intel/boards/cht_bsw_rt5672.c +0 -8
-		{}
-	};
-
-	if (!x86_match_cpu(cpu_ids))
-		return false;
-	return true;
-}
-

 #define RT5672_I2C_DEFAULT "i2c-10EC5670:00"

 static int snd_cht_mc_probe(struct platform_device *pdev)

sound/soc/intel/boards/cht_bsw_rt5672.c +0 -0
@@ -439,14 +427,12 @@ static int snd_cht_mc_probe(struct
 platform_device *pdev)
  		}
  	}

sound/soc/intel/boards/cht_bsw_rt5672.c +0 -2
-	if (is_valleyview()) {
-		drv->mclk = devm_clk_get(&pdev->dev,

"pmc_plt_clk_3");

sound/soc/intel/boards/cht_bsw_rt5672.c +0 -3
-		if (IS_ERR(drv->mclk)) {
-			dev_err(&pdev->dev,
-				"Failed to get MCLK from

pmc_plt_clk_3: %ld\n",

sound/soc/intel/boards/cht_bsw_rt5672.c +4 -3
-				PTR_ERR(drv->mclk));
-			return PTR_ERR(drv->mclk);
-		}
+	drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
+	if (IS_ERR(drv->mclk)) {
+		dev_err(&pdev->dev,
+			"Failed to get MCLK from pmc_plt_clk_3:

%ld\n",

sound/soc/intel/boards/cht_bsw_rt5672.c +2 -0
+			PTR_ERR(drv->mclk));
+		return PTR_ERR(drv->mclk);

  } snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);

Signature · 6 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#3 lore raw

PATCH 2/14 ASoC: intel: cht_bsw_max98090: add support for clock framework

In reply to Pierre-Louis Bossart

Add MCLK management to reuse this driver for platforms where the firmware does not manage the MCLK. This should solve issues with distributions unable to support Chromebooks as well as atom/sst platforms.

---
 sound/soc/intel/boards/cht_bsw_max98090_ti.c | 101 +++++++++++++++++++++++++++
 1 file changed, 101 insertions(+)
sound/soc/intel/boards/cht_bsw_max98090_ti.c +101 -0
index 20755ec..fc4c381 100644
@@ -23,6 +23,9 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/acpi.h>
+#include <asm/cpu_device_id.h>
+#include <asm/platform_sst_audio.h>
+#include <linux/clk.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
@@ -37,13 +40,64 @@
 struct cht_mc_private {
 	struct snd_soc_jack jack;
 	bool ts3a227e_present;
+	struct clk *mclk;
 };
 
+static inline struct snd_soc_dai *cht_get_codec_dai(struct snd_soc_card *card)
+{
+	struct snd_soc_pcm_runtime *rtd;
+
+	list_for_each_entry(rtd, &card->rtd_list, list) {
+		if (!strncmp(rtd->codec_dai->name, CHT_CODEC_DAI,
+			     strlen(CHT_CODEC_DAI)))
+			return rtd->codec_dai;
+	}
+	return NULL;
+}
+
+static int platform_clock_control(struct snd_soc_dapm_widget *w,
+					  struct snd_kcontrol *k, int  event)
+{
+	struct snd_soc_dapm_context *dapm = w->dapm;
+	struct snd_soc_card *card = dapm->card;
+	struct snd_soc_dai *codec_dai;
+	struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
+	int ret;
+
+	codec_dai = cht_get_codec_dai(card);
+	if (!codec_dai) {
+		dev_err(card->dev, "Codec dai not found; Unable to set platform clock\n");
+		return -EIO;
+	}
+
+	if (SND_SOC_DAPM_EVENT_ON(event)) {
+		if (ctx->mclk) {
+			ret = clk_prepare_enable(ctx->mclk);
+			if (ret < 0) {
+				dev_err(card->dev,
+					"could not configure MCLK state");
+				return ret;
+			}
+		}
+	} else {
+
+		/* FIXME: if there is no clock can jack detection work ? */
+
+		if (ctx->mclk)
+			clk_disable_unprepare(ctx->mclk);
+	}
+
+	return 0;
+}
+
 static const struct snd_soc_dapm_widget cht_dapm_widgets[] = {
 	SND_SOC_DAPM_HP("Headphone", NULL),
 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
 	SND_SOC_DAPM_MIC("Int Mic", NULL),
 	SND_SOC_DAPM_SPK("Ext Spk", NULL),
+	SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
+			    platform_clock_control, SND_SOC_DAPM_PRE_PMU |
+			    SND_SOC_DAPM_POST_PMD),
 };
 
 static const struct snd_soc_dapm_route cht_audio_map[] = {
@@ -60,6 +114,10 @@ static const struct snd_soc_dapm_route cht_audio_map[] = {
 	{"codec_in0", NULL, "ssp2 Rx" },
 	{"codec_in1", NULL, "ssp2 Rx" },
 	{"ssp2 Rx", NULL, "HiFi Capture"},
+	{"Headphone", NULL, "Platform Clock"},
+	{"Headset Mic", NULL, "Platform Clock"},
+	{"Int Mic", NULL, "Platform Clock"},
+	{"Ext Spk", NULL, "Platform Clock"},
 };
 
 static const struct snd_kcontrol_new cht_mc_controls[] = {
@@ -141,6 +199,26 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
 	if (ctx->ts3a227e_present)
 		snd_soc_jack_notifier_register(jack, &cht_jack_nb);
 
+	if (ctx->mclk) {
+		/*
+		 * The firmware might enable the clock at
+		 * boot (this information may or may not
+		 * be reflected in the enable clock register).
+		 * To change the rate we must disable the clock
+		 * first to cover these cases. Due to common
+		 * clock framework restrictions that do not allow
+		 * to disable a clock that has not been enabled,
+		 * we need to enable the clock first.
+		 */
+		ret = clk_prepare_enable(ctx->mclk);
+		if (!ret)
+			clk_disable_unprepare(ctx->mclk);
+
+		ret = clk_set_rate(ctx->mclk, CHT_PLAT_CLK_3_HZ);
+
+		if (ret)
+			dev_err(runtime->dev, "unable to set MCLK rate\n");
+	}
 	return ret;
 }
 
@@ -275,6 +353,18 @@ static struct snd_soc_card snd_soc_card_cht = {
 	.num_controls = ARRAY_SIZE(cht_mc_controls),
 };
 
+static bool is_valleyview(void)
+{
+	static const struct x86_cpu_id cpu_ids[] = {
+		{ X86_VENDOR_INTEL, 6, 55 }, /* Valleyview, Bay Trail */
+		{}
+	};
+
+	if (!x86_match_cpu(cpu_ids))
+		return false;
+	return true;
+}
+
 static int snd_cht_mc_probe(struct platform_device *pdev)
 {
 	int ret_val = 0;
@@ -294,6 +384,17 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
 	/* register the soc card */
 	snd_soc_card_cht.dev = &pdev->dev;
 	snd_soc_card_set_drvdata(&snd_soc_card_cht, drv);
+
+	if (is_valleyview()) {
+		drv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
+		if (IS_ERR(drv->mclk)) {
+			dev_err(&pdev->dev,
+				"Failed to get MCLK from pmc_plt_clk_3: %ld\n",
+				PTR_ERR(drv->mclk));
+			return PTR_ERR(drv->mclk);
+		}
+	}
+
 	ret_val = devm_snd_soc_register_card(&pdev->dev, &snd_soc_card_cht);
 	if (ret_val) {
 		dev_err(&pdev->dev,
Signature · 1 line
2.9.3
#4 lore raw

PATCH 3/14 ASoC: Intel: cht_bsw_max98090: Fix I2S config + unused code

In reply to Pierre-Louis Bossart

This driver probably never worked, the slots are configured for 2ch 16 bit and the SSP2 as 24 bits, the cpu_dai configured as LEFT_J and the codec_dai as I2S.

---
 sound/soc/intel/boards/cht_bsw_max98090_ti.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/intel/boards/cht_bsw_max98090_ti.c +3 -3
index fc4c381..957bae2 100644
@@ -238,7 +238,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
 		return ret;
 	}
 
-	fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF
+	fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
 				| SND_SOC_DAIFMT_CBS_CFS;
 
 	ret = snd_soc_dai_set_fmt(rtd->cpu_dai, fmt);
@@ -251,8 +251,8 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
 	rate->min = rate->max = 48000;
 	channels->min = channels->max = 2;
 
-	/* set SSP2 to 24-bit */
-	params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
+	/* set SSP2 to 16-bit */
+	params_set_format(params, SNDRV_PCM_FORMAT_S16_LE);
 	return 0;
 }
 
Signature · 1 line
2.9.3
maintainer
#5 lore raw

Applied "ASoC: Intel: cht_bsw_max98090: Fix I2S config + unused code" to the asoc tree

The patch

ASoC: Intel: cht_bsw_max98090: Fix I2S config + unused code

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

From: Pierre-Louis Bossart <[email protected]>
Date: Fri, 8 Sep 2017 00:13:04 -0500
Subject: [PATCH] ASoC: Intel: cht_bsw_max98090: Fix I2S config + unused code

This driver probably never worked, the slots are configured for 2ch 16 bit and the SSP2 as 24 bits, the cpu_dai configured as LEFT_J and the codec_dai as I2S.

---
 sound/soc/intel/boards/cht_bsw_max98090_ti.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/intel/boards/cht_bsw_max98090_ti.c +3 -3
index 20755ecc7f9e..455a55af7ad2 100644
@@ -160,7 +160,7 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
 		return ret;
 	}
 
-	fmt = SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF
+	fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
 				| SND_SOC_DAIFMT_CBS_CFS;
 
 	ret = snd_soc_dai_set_fmt(rtd->cpu_dai, fmt);
@@ -173,8 +173,8 @@ static int cht_codec_fixup(struct snd_soc_pcm_runtime *rtd,
 	rate->min = rate->max = 48000;
 	channels->min = channels->max = 2;
 
-	/* set SSP2 to 24-bit */
-	params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
+	/* set SSP2 to 16-bit */
+	params_set_format(params, SNDRV_PCM_FORMAT_S16_LE);
 	return 0;
 }
 
Signature · 1 line
2.14.1
#6 lore raw

PATCH 4/14 ASoc: cht_bsw_max98090_ti: Fix jack initialization

In reply to Pierre-Louis Bossart

From: Thierry Escande <[email protected]>

If the ts3a227e audio accessory detection hardware is present and its driver probed, the jack needs to be created before enabling jack detection in the ts3a227e driver. With this patch, the jack is instantiated in the max98090 headset init function if the ts3a227e is present. This fixes a null pointer dereference as the jack detection enabling function in the ts3a driver was called before the jack is created.

---
 sound/soc/intel/boards/cht_bsw_max98090_ti.c | 50 +++++++++++++++++-----------
 1 file changed, 30 insertions(+), 20 deletions(-)
sound/soc/intel/boards/cht_bsw_max98090_ti.c +30 -20
index 957bae2..7feaaa0 100644
@@ -174,30 +174,21 @@ static int cht_codec_init(struct snd_soc_pcm_runtime *runtime)
 	struct cht_mc_private *ctx = snd_soc_card_get_drvdata(runtime->card);
 	struct snd_soc_jack *jack = &ctx->jack;
 
-	/**
-	* TI supports 4 butons headset detection
-	* KEY_MEDIA
-	* KEY_VOICECOMMAND
-	* KEY_VOLUMEUP
-	* KEY_VOLUMEDOWN
-	*/
-	if (ctx->ts3a227e_present)
-		jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
-					SND_JACK_BTN_0 | SND_JACK_BTN_1 |
-					SND_JACK_BTN_2 | SND_JACK_BTN_3;
-	else
-		jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE;
+	if (ctx->ts3a227e_present) {
+		/*
+		 * The jack has already been created in the
+		 * cht_max98090_headset_init() function.
+		 */
+		snd_soc_jack_notifier_register(jack, &cht_jack_nb);
+		return 0;
+	}
+
+	jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE;
 
 	ret = snd_soc_card_jack_new(runtime->card, "Headset Jack",
 					jack_type, jack, NULL, 0);
-
-	if (ret) {
+	if (ret)
 		dev_err(runtime->dev, "Headset Jack creation failed %d\n", ret);
-		return ret;
-	}
-
-	if (ctx->ts3a227e_present)
-		snd_soc_jack_notifier_register(jack, &cht_jack_nb);
 
 	if (ctx->mclk) {
 		/*
@@ -266,6 +257,25 @@ static int cht_max98090_headset_init(struct snd_soc_component *component)
 {
 	struct snd_soc_card *card = component->card;
 	struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
+	struct snd_soc_jack *jack = &ctx->jack;
+	int jack_type;
+	int ret;
+
+	/*
+	 * TI supports 4 butons headset detection
+	 * KEY_MEDIA
+	 * KEY_VOICECOMMAND
+	 * KEY_VOLUMEUP
+	 * KEY_VOLUMEDOWN
+	 */
+	jack_type = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE |
+		    SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+		    SND_JACK_BTN_2 | SND_JACK_BTN_3;
+
+	ret = snd_soc_card_jack_new(card, "Headset Jack", jack_type,
+				    jack, NULL, 0);
+	if (ret)
+		return ret;
 
 	return ts3a227e_enable_jack_detect(component, &ctx->jack);
 }
Signature · 1 line
2.9.3
#7 lore raw

PATCH 5/14 ASoC: ts3a227e: add acpi table

In reply to Pierre-Louis Bossart

From: "Fang, Yang A" <[email protected]>

This patch adds the acpi match table for the ts3a227e audio accessory detection device. This enables headset features like jack plug/unplug notifications, mic presence, and button pressed events.

---
 sound/soc/codecs/ts3a227e.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
sound/soc/codecs/ts3a227e.c +10 -0
index 4356843..738e04b 100644
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/of_gpio.h>
 #include <linux/regmap.h>
+#include <linux/acpi.h>
 
 #include <sound/core.h>
 #include <sound/jack.h>
@@ -374,11 +375,20 @@ static const struct of_device_id ts3a227e_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, ts3a227e_of_match);
 
+#ifdef CONFIG_ACPI
+static struct acpi_device_id ts3a227e_acpi_match[] = {
+	{ "104C227E", 0 },
+	{},
+};
+MODULE_DEVICE_TABLE(acpi, ts3a227e_acpi_match);
+#endif
+
 static struct i2c_driver ts3a227e_driver = {
 	.driver = {
 		.name = "ts3a227e",
 		.pm = &ts3a227e_pm,
 		.of_match_table = of_match_ptr(ts3a227e_of_match),
+		.acpi_match_table = ACPI_PTR(ts3a227e_acpi_match),
 	},
 	.probe = ts3a227e_i2c_probe,
 	.id_table = ts3a227e_i2c_ids,
Signature · 1 line
2.9.3
maintainer
#8 lore raw

Re: [PATCH 05/14] ASoC: ts3a227e: add acpi table

Quoted 9 lines · Pierre-Louis Bossart

From: "Fang, Yang A" <[email protected]>

This patch adds the acpi match table for the ts3a227e audio accessory detection device. This enables headset features like jack plug/unplug notifications, mic presence, and button pressed events.

---

I can't apply this as you haven't sent a signed-off-by for it, please see SubmttingPatches for details.

#9 lore raw

PATCH 6/14 ASoC: Intel: atom: add support for Baytrail Chromebooks

In reply to Pierre-Louis Bossart

Baytrail Chromebooks used to be managed with legacy driver which is not compatible with atom/sst drivers. Reuse CHT driver to handle max98098 codec

---
 sound/soc/intel/atom/sst/sst_acpi.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/soc/intel/atom/sst/sst_acpi.c +8 -0
index 0e928d5..ff4a517 100644
@@ -536,6 +536,14 @@ static struct sst_acpi_mach sst_acpi_bytcr[] = {
 		.board = "cht-bsw",
 		.pdata = &byt_rvp_platform_data
 	},
+	/* use CHT driver to Baytrail Chromebooks */
+	{
+		.id = "193C9890",
+		.drv_name = "cht-bsw-max98090",
+		.fw_filename = "intel/fw_sst_0f28.bin",
+		.board = "cht-bsw",
+		.pdata = &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
Signature · 1 line
2.9.3
maintainer
#10 lore raw

Applied "ASoC: Intel: atom: use cht_bsw_max98090 for Baytrail Chromebooks" to the asoc tree

The patch

ASoC: Intel: atom: use cht_bsw_max98090 for Baytrail Chromebooks

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

From: Pierre-Louis Bossart <[email protected]>
Date: Fri, 8 Sep 2017 00:13:06 -0500
Subject: [PATCH] ASoC: Intel: atom: use cht_bsw_max98090 for Baytrail
Chromebooks

Baytrail Chromebooks used to be managed with legacy driver which is not compatible with atom/sst drivers. Reuse CHT driver to handle max98098 codec and allow distributions to support all Atom platforms with the same build.

The legacy byt-max98090 can still be used but in a build for Baytrail+max98090 only.

---
 sound/soc/intel/atom/sst/sst_acpi.c | 8 ++++++++
 1 file changed, 8 insertions(+)
sound/soc/intel/atom/sst/sst_acpi.c +8 -0
index 0e928d54305d..ff4a5175a6cd 100644
@@ -536,6 +536,14 @@ static struct sst_acpi_mach sst_acpi_bytcr[] = {
 		.board = "cht-bsw",
 		.pdata = &byt_rvp_platform_data
 	},
+	/* use CHT driver to Baytrail Chromebooks */
+	{
+		.id = "193C9890",
+		.drv_name = "cht-bsw-max98090",
+		.fw_filename = "intel/fw_sst_0f28.bin",
+		.board = "cht-bsw",
+		.pdata = &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
Signature · 1 line
2.14.1
#11 lore raw

PATCH 7/14 ASoC: Intel: bytcr-rt5651: fix capture routes

In reply to Pierre-Louis Bossart

There is only one dmic path and the routes were not added. Probably a copy-paste mistake when initially creating the file

---
 sound/soc/intel/boards/bytcr_rt5651.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
sound/soc/intel/boards/bytcr_rt5651.c +8 -12
index 4a3516b..441f735 100644
@@ -54,12 +54,9 @@ static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = {
 	{"Speaker", NULL, "LOUTR"},
 };
 
-static const struct snd_soc_dapm_route byt_rt5651_intmic_dmic1_map[] = {
-	{"DMIC1", NULL, "Internal Mic"},
-};
-
-static const struct snd_soc_dapm_route byt_rt5651_intmic_dmic2_map[] = {
-	{"DMIC2", NULL, "Internal Mic"},
+static const struct snd_soc_dapm_route byt_rt5651_intmic_dmic_map[] = {
+	{"DMIC L1", NULL, "Internal Mic"},
+	{"DMIC R1", NULL, "Internal Mic"},
 };
 
 static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_map[] = {
@@ -133,14 +130,13 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
 		custom_map = byt_rt5651_intmic_in1_map;
 		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in1_map);
 		break;
-	case BYT_RT5651_DMIC2_MAP:
-		custom_map = byt_rt5651_intmic_dmic2_map;
-		num_routes = ARRAY_SIZE(byt_rt5651_intmic_dmic2_map);
-		break;
 	default:
-		custom_map = byt_rt5651_intmic_dmic1_map;
-		num_routes = ARRAY_SIZE(byt_rt5651_intmic_dmic1_map);
+		custom_map = byt_rt5651_intmic_dmic_map;
+		num_routes = ARRAY_SIZE(byt_rt5651_intmic_dmic_map);
 	}
+	ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
+	if (ret)
+		return ret;
 
 	ret = snd_soc_add_card_controls(card, byt_rt5651_controls,
 					ARRAY_SIZE(byt_rt5651_controls));
Signature · 1 line
2.9.3
maintainer
#12 lore raw

Applied "ASoC: Intel: bytcr-rt5651: fix capture routes" to the asoc tree

The patch

ASoC: Intel: bytcr-rt5651: fix capture routes

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

From: Pierre-Louis Bossart <[email protected]>
Date: Fri, 8 Sep 2017 12:43:53 -0500
Subject: [PATCH] ASoC: Intel: bytcr-rt5651: fix capture routes

There is only one dmic path and the routes were not added. Probably a copy-paste mistake when initially creating the file

---
 sound/soc/intel/boards/bytcr_rt5651.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
sound/soc/intel/boards/bytcr_rt5651.c +8 -12
index 4a3516b38c2c..441f735a198f 100644
@@ -54,12 +54,9 @@ static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = {
 	{"Speaker", NULL, "LOUTR"},
 };
 
-static const struct snd_soc_dapm_route byt_rt5651_intmic_dmic1_map[] = {
-	{"DMIC1", NULL, "Internal Mic"},
-};
-
-static const struct snd_soc_dapm_route byt_rt5651_intmic_dmic2_map[] = {
-	{"DMIC2", NULL, "Internal Mic"},
+static const struct snd_soc_dapm_route byt_rt5651_intmic_dmic_map[] = {
+	{"DMIC L1", NULL, "Internal Mic"},
+	{"DMIC R1", NULL, "Internal Mic"},
 };
 
 static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_map[] = {
@@ -133,14 +130,13 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
 		custom_map = byt_rt5651_intmic_in1_map;
 		num_routes = ARRAY_SIZE(byt_rt5651_intmic_in1_map);
 		break;
-	case BYT_RT5651_DMIC2_MAP:
-		custom_map = byt_rt5651_intmic_dmic2_map;
-		num_routes = ARRAY_SIZE(byt_rt5651_intmic_dmic2_map);
-		break;
 	default:
-		custom_map = byt_rt5651_intmic_dmic1_map;
-		num_routes = ARRAY_SIZE(byt_rt5651_intmic_dmic1_map);
+		custom_map = byt_rt5651_intmic_dmic_map;
+		num_routes = ARRAY_SIZE(byt_rt5651_intmic_dmic_map);
 	}
+	ret = snd_soc_dapm_add_routes(&card->dapm, custom_map, num_routes);
+	if (ret)
+		return ret;
 
 	ret = snd_soc_add_card_controls(card, byt_rt5651_controls,
 					ARRAY_SIZE(byt_rt5651_controls));
Signature · 1 line
2.14.1
#13 lore raw

PATCH 8/14 ASoC: Intel: bytcr_rt5651: add MCLK support

In reply to Pierre-Louis Bossart

Same as for other codecs, enable MCLK by default

MCLK is disabled on MinnowBoard B3 since it's not routed on the LSE connector

---
 sound/soc/intel/boards/bytcr_rt5651.c | 232 +++++++++++++++++++++++++++++++---
 1 file changed, 215 insertions(+), 17 deletions(-)
sound/soc/intel/boards/bytcr_rt5651.c +215 -17
index 441f735..b813c4c 100644
@@ -24,6 +24,9 @@
 #include <linux/device.h>
 #include <linux/dmi.h>
 #include <linux/slab.h>
+#include <asm/cpu_device_id.h>
+#include <asm/platform_sst_audio.h>
+#include <linux/clk.h>
 #include <sound/pcm.h>
 #include <sound/pcm_params.h>
 #include <sound/soc.h>
@@ -31,14 +34,119 @@
 #include "../../codecs/rt5651.h"
 #include "../atom/sst-atom-controls.h"
 
+enum {
+	BYT_RT5651_DMIC_MAP,
+	BYT_RT5651_IN1_MAP,
+};
+
+#define BYT_RT5651_MAP(quirk)	((quirk) & 0xff)
+#define BYT_RT5651_DMIC_EN	BIT(16)
+#define BYT_RT5651_MCLK_EN	BIT(17)
+#define BYT_RT5651_MCLK_25MHZ	BIT(18)
+
+struct byt_rt5651_private {
+	struct clk *mclk;
+};
+
+static unsigned long byt_rt5651_quirk = BYT_RT5651_DMIC_MAP |
+					BYT_RT5651_DMIC_EN |
+					BYT_RT5651_MCLK_EN;
+
+static void log_quirks(struct device *dev)
+{
+	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_DMIC_MAP)
+		dev_info(dev, "quirk DMIC_MAP enabled");
+	if (BYT_RT5651_MAP(byt_rt5651_quirk) == BYT_RT5651_IN1_MAP)
+		dev_info(dev, "quirk IN1_MAP enabled");
+	if (byt_rt5651_quirk & BYT_RT5651_DMIC_EN)
+		dev_info(dev, "quirk DMIC enabled");
+	if (byt_rt5651_quirk & BYT_RT5651_MCLK_EN)
+		dev_info(dev, "quirk MCLK_EN enabled");
+	if (byt_rt5651_quirk & BYT_RT5651_MCLK_25MHZ)
+		dev_info(dev, "quirk MCLK_25MHZ enabled");
+}
+
+#define BYT_CODEC_DAI1	"rt5651-aif1"
+
+static inline struct snd_soc_dai *byt_get_codec_dai(struct snd_soc_card *card)
+{
+	struct snd_soc_pcm_runtime *rtd;
+
+	list_for_each_entry(rtd, &card->rtd_list, list) {
+		if (!strncmp(rtd->codec_dai->name, BYT_CODEC_DAI1,
+			     strlen(BYT_CODEC_DAI1)))
+			return rtd->codec_dai;
+	}
+	return NULL;
+}
+
+static int platform_clock_control(struct snd_soc_dapm_widget *w,
+				  struct snd_kcontrol *k, int  event)
+{
+	struct snd_soc_dapm_context *dapm = w->dapm;
+	struct snd_soc_card *card = dapm->card;
+	struct snd_soc_dai *codec_dai;
+	struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
+	int ret;
+
+	codec_dai = byt_get_codec_dai(card);
+	if (!codec_dai) {
+		dev_err(card->dev,
+			"Codec dai not found; Unable to set platform clock\n");
+		return -EIO;
+	}
+
+	if (SND_SOC_DAPM_EVENT_ON(event)) {
+		if (priv->mclk) {
+			ret = clk_prepare_enable(priv->mclk);
+			if (ret < 0) {
+				dev_err(card->dev,
+					"could not configure MCLK state");
+				return ret;
+			}
+		}
+		ret = snd_soc_dai_set_sysclk(codec_dai, RT5651_SCLK_S_PLL1,
+					     48000 * 512,
+					     SND_SOC_CLOCK_IN);
+	} else {
+		/*
+		 * Set codec clock source to internal clock before
+		 * turning off the platform clock. Codec needs clock
+		 * for Jack detection and button press
+		 */
+		ret = snd_soc_dai_set_sysclk(codec_dai, RT5651_SCLK_S_RCCLK,
+					     48000 * 512,
+					     SND_SOC_CLOCK_IN);
+		if (!ret)
+			if (priv->mclk)
+				clk_disable_unprepare(priv->mclk);
+	}
+
+	if (ret < 0) {
+		dev_err(card->dev, "can't set codec sysclk: %d\n", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
 static const struct snd_soc_dapm_widget byt_rt5651_widgets[] = {
 	SND_SOC_DAPM_HP("Headphone", NULL),
 	SND_SOC_DAPM_MIC("Headset Mic", NULL),
 	SND_SOC_DAPM_MIC("Internal Mic", NULL),
 	SND_SOC_DAPM_SPK("Speaker", NULL),
+	SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
+			    platform_clock_control, SND_SOC_DAPM_PRE_PMU |
+			    SND_SOC_DAPM_POST_PMD),
+
 };
 
 static const struct snd_soc_dapm_route byt_rt5651_audio_map[] = {
+	{"Headphone", NULL, "Platform Clock"},
+	{"Headset Mic", NULL, "Platform Clock"},
+	{"Internal Mic", NULL, "Platform Clock"},
+	{"Speaker", NULL, "Platform Clock"},
+
 	{"AIF1 Playback", NULL, "ssp2 Tx"},
 	{"ssp2 Tx", NULL, "codec_out0"},
 	{"ssp2 Tx", NULL, "codec_out1"},
@@ -64,18 +172,6 @@ static const struct snd_soc_dapm_route byt_rt5651_intmic_in1_map[] = {
 	{"IN1P", NULL, "Internal Mic"},
 };
 
-enum {
-	BYT_RT5651_DMIC1_MAP,
-	BYT_RT5651_DMIC2_MAP,
-	BYT_RT5651_IN1_MAP,
-};
-
-#define BYT_RT5651_MAP(quirk)	((quirk) & 0xff)
-#define BYT_RT5651_DMIC_EN	BIT(16)
-
-static unsigned long byt_rt5651_quirk = BYT_RT5651_DMIC1_MAP |
-					BYT_RT5651_DMIC_EN;
-
 static const struct snd_kcontrol_new byt_rt5651_controls[] = {
 	SOC_DAPM_PIN_SWITCH("Headphone"),
 	SOC_DAPM_PIN_SWITCH("Headset Mic"),
@@ -100,9 +196,26 @@ static int byt_rt5651_aif1_hw_params(struct snd_pcm_substream *substream,
 		return ret;
 	}
 
-	ret = snd_soc_dai_set_pll(codec_dai, 0, RT5651_PLL1_S_BCLK1,
-				  params_rate(params) * 50,
-				  params_rate(params) * 512);
+	if (!(byt_rt5651_quirk & BYT_RT5651_MCLK_EN)) {
+		/* 2x25 bit slots on SSP2 */
+		ret = snd_soc_dai_set_pll(codec_dai, 0,
+					RT5651_PLL1_S_BCLK1,
+					params_rate(params) * 50,
+					params_rate(params) * 512);
+	} else {
+		if (byt_rt5651_quirk & BYT_RT5651_MCLK_25MHZ) {
+			ret = snd_soc_dai_set_pll(codec_dai, 0,
+						RT5651_PLL1_S_MCLK,
+						25000000,
+						params_rate(params) * 512);
+		} else {
+			ret = snd_soc_dai_set_pll(codec_dai, 0,
+						RT5651_PLL1_S_MCLK,
+						19200000,
+						params_rate(params) * 512);
+		}
+	}
+
 	if (ret < 0) {
 		dev_err(rtd->dev, "can't set codec pll: %d\n", ret);
 		return ret;
@@ -111,8 +224,22 @@ static int byt_rt5651_aif1_hw_params(struct snd_pcm_substream *substream,
 	return 0;
 }
 
+static int byt_rt5651_quirk_cb(const struct dmi_system_id *id)
+{
+	byt_rt5651_quirk = (unsigned long)id->driver_data;
+	return 1;
+}
+
 static const struct dmi_system_id byt_rt5651_quirk_table[] = {
-	{}
+	{
+		.callback = byt_rt5651_quirk_cb,
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Circuitco"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Minnowboard Max B3 PLATFORM"),
+		},
+		.driver_data = (unsigned long *)(BYT_RT5651_DMIC_MAP |
+						 BYT_RT5651_DMIC_EN),
+	},
 };
 
 static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
@@ -120,11 +247,11 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
 	int ret;
 	struct snd_soc_card *card = runtime->card;
 	const struct snd_soc_dapm_route *custom_map;
+	struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
 	int num_routes;
 
 	card->dapm.idle_bias_off = true;
 
-	dmi_check_system(byt_rt5651_quirk_table);
 	switch (BYT_RT5651_MAP(byt_rt5651_quirk)) {
 	case BYT_RT5651_IN1_MAP:
 		custom_map = byt_rt5651_intmic_in1_map;
@@ -147,6 +274,30 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
 	snd_soc_dapm_ignore_suspend(&card->dapm, "Headphone");
 	snd_soc_dapm_ignore_suspend(&card->dapm, "Speaker");
 
+	if (priv->mclk) {
+		/*
+		 * The firmware might enable the clock at
+		 * boot (this information may or may not
+		 * be reflected in the enable clock register).
+		 * To change the rate we must disable the clock
+		 * first to cover these cases. Due to common
+		 * clock framework restrictions that do not allow
+		 * to disable a clock that has not been enabled,
+		 * we need to enable the clock first.
+		 */
+		ret = clk_prepare_enable(priv->mclk);
+		if (!ret)
+			clk_disable_unprepare(priv->mclk);
+
+		if (byt_rt5651_quirk & BYT_RT5651_MCLK_25MHZ)
+			ret = clk_set_rate(priv->mclk, 25000000);
+		else
+			ret = clk_set_rate(priv->mclk, 19200000);
+
+		if (ret)
+			dev_err(card->dev, "unable to set MCLK rate\n");
+	}
+
 	return ret;
 }
 
@@ -295,10 +446,57 @@ static struct snd_soc_card byt_rt5651_card = {
 static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 {
 	int ret_val = 0;
+	struct byt_rt5651_private *priv;
+
+	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_ATOMIC);
+	if (!priv)
+		return -ENOMEM;
 
 	/* register the soc card */
 	byt_rt5651_card.dev = &pdev->dev;
 
+	mach = byt_rt5651_card.dev->platform_data;
+	snd_soc_card_set_drvdata(&byt_rt5651_card, priv);
+
+	/* fix index of codec dai */
+	dai_index = MERR_DPCM_COMPR + 1;
+	for (i = 0; i < ARRAY_SIZE(byt_rt5651_dais); i++) {
+		if (!strcmp(byt_rt5651_dais[i].codec_name, "i2c-10EC5651:00")) {
+			dai_index = i;
+			break;
+		}
+	}
+
+	/* fixup codec name based on HID */
+	i2c_name = sst_acpi_find_name_from_hid(mach->id);
+	if (i2c_name != NULL) {
+		snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
+			"%s%s", "i2c-", i2c_name);
+
+		byt_rt5651_dais[dai_index].codec_name = byt_rt5651_codec_name;
+	}
+
+	/* check quirks before creating card */
+	dmi_check_system(byt_rt5651_quirk_table);
+	log_quirks(&pdev->dev);
+
+	if (byt_rt5651_quirk & BYT_RT5651_MCLK_EN) {
+		priv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
+		if (IS_ERR(priv->mclk)) {
+			dev_err(&pdev->dev,
+				"Failed to get MCLK from pmc_plt_clk_3: %ld\n",
+				PTR_ERR(priv->mclk));
+			/*
+			 * Fall back to bit clock usage for -ENOENT (clock not
+			 * available likely due to missing dependencies), bail
+			 * for all other errors, including -EPROBE_DEFER
+			 */
+			if (ret_val != -ENOENT)
+				return ret_val;
+			byt_rt5651_quirk &= ~BYT_RT5651_MCLK_EN;
+		}
+	}
+
 	ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5651_card);
 
 	if (ret_val) {
Signature · 1 line
2.9.3
#14 lore raw

PATCH 9/14 ASoC: Intel: bytcr_rt5651: filter codec name

In reply to Pierre-Louis Bossart

Use same fix as other codecs to work around BIOS/ACPI issues

---
 sound/soc/intel/boards/bytcr_rt5651.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
sound/soc/intel/boards/bytcr_rt5651.c +26 -0
index b813c4c..17d3e144 100644
@@ -33,6 +33,7 @@
 #include <sound/jack.h>
 #include "../../codecs/rt5651.h"
 #include "../atom/sst-atom-controls.h"
+#include "../common/sst-acpi.h"
 
 enum {
 	BYT_RT5651_DMIC_MAP,
@@ -443,9 +444,15 @@ static struct snd_soc_card byt_rt5651_card = {
 	.fully_routed = true,
 };
 
+static char byt_rt5651_codec_name[16]; /* i2c-<HID>:00 with HID being 8 chars */
+
 static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 {
 	int ret_val = 0;
+	struct sst_acpi_mach *mach;
+	const char *i2c_name = NULL;
+	int i;
+	int dai_index;
 	struct byt_rt5651_private *priv;
 
 	priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_ATOMIC);
@@ -454,6 +461,25 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 
 	/* register the soc card */
 	byt_rt5651_card.dev = &pdev->dev;
+	mach = byt_rt5651_card.dev->platform_data;
+
+	/* fix index of codec dai */
+	dai_index = MERR_DPCM_COMPR + 1;
+	for (i = 0; i < ARRAY_SIZE(byt_rt5651_dais); i++) {
+		if (!strcmp(byt_rt5651_dais[i].codec_name, "i2c-10EC5651:00")) {
+			dai_index = i;
+			break;
+		}
+	}
+
+	/* fixup codec name based on HID */
+	i2c_name = sst_acpi_find_name_from_hid(mach->id);
+	if (i2c_name != NULL) {
+		snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
+			"%s%s", "i2c-", i2c_name);
+
+		byt_rt5651_dais[dai_index].codec_name = byt_rt5651_codec_name;
+	}
 
 	mach = byt_rt5651_card.dev->platform_data;
 	snd_soc_card_set_drvdata(&byt_rt5651_card, priv);
Signature · 1 line
2.9.3
#15 lore raw

PATCH 10/14 ASoC: codecs: rt5645: add quirks for Asus T100HA

In reply to Pierre-Louis Bossart

Fix jack detection and dmic setup

---
 sound/soc/codecs/rt5645.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
sound/soc/codecs/rt5645.c +20 -0
index ce31d0d..1ce9a74 100644
@@ -3637,6 +3637,24 @@ static const struct dmi_system_id dmi_platform_gpd_win[] = {
 	{}
 };
 
+static struct rt5645_platform_data general_platform_data2 = {
+	.dmic1_data_pin = RT5645_DMIC_DATA_IN2N,
+	.dmic2_data_pin = RT5645_DMIC2_DISABLE,
+	.jd_mode = 3,
+	.inv_jd1_1 = true,
+};
+
+static struct dmi_system_id dmi_platform_asus_t100ha[] = {
+	{
+		.ident = "ASUS T100HAN",
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "T100HAN"),
+		},
+	},
+	{ }
+};
+
 static bool rt5645_check_dp(struct device *dev)
 {
 	if (device_property_present(dev, "realtek,in2-differential") ||
@@ -3689,6 +3707,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
 		rt5645->pdata = general_platform_data;
 	else if (dmi_check_system(dmi_platform_gpd_win))
 		rt5645->pdata = gpd_win_platform_data;
+	else if (dmi_check_system(dmi_platform_asus_t100ha))
+		rt5645->pdata = general_platform_data2;
 
 	if (quirk != -1) {
 		rt5645->pdata.in2_diff = QUIRK_IN2_DIFF(quirk);
Signature · 1 line
2.9.3
maintainer
#16 lore raw

Applied "ASoC: codecs: rt5645: add quirks for Asus T100HA" to the asoc tree

The patch

ASoC: codecs: rt5645: add quirks for Asus T100HA

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

From: Pierre-Louis Bossart <[email protected]>
Date: Tue, 22 Aug 2017 15:32:35 -0500
Subject: [PATCH] ASoC: codecs: rt5645: add quirks for Asus T100HA

Fix jack detection and dmic setup

---
 sound/soc/codecs/rt5645.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
sound/soc/codecs/rt5645.c +20 -0
index 9ec58166f7c4..500bb42d0804 100644
@@ -3637,6 +3637,24 @@ static const struct dmi_system_id dmi_platform_gpd_win[] = {
 	{}
 };
 
+static struct rt5645_platform_data general_platform_data2 = {
+	.dmic1_data_pin = RT5645_DMIC_DATA_IN2N,
+	.dmic2_data_pin = RT5645_DMIC2_DISABLE,
+	.jd_mode = 3,
+	.inv_jd1_1 = true,
+};
+
+static struct dmi_system_id dmi_platform_asus_t100ha[] = {
+	{
+		.ident = "ASUS T100HAN",
+		.matches = {
+			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "T100HAN"),
+		},
+	},
+	{ }
+};
+
 static bool rt5645_check_dp(struct device *dev)
 {
 	if (device_property_present(dev, "realtek,in2-differential") ||
@@ -3689,6 +3707,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
 		rt5645->pdata = general_platform_data;
 	else if (dmi_check_system(dmi_platform_gpd_win))
 		rt5645->pdata = gpd_win_platform_data;
+	else if (dmi_check_system(dmi_platform_asus_t100ha))
+		rt5645->pdata = general_platform_data2;
 
 	if (quirk != -1) {
 		rt5645->pdata.in2_diff = QUIRK_IN2_DIFF(quirk);
Signature · 1 line
2.14.1
#17 lore raw

PATCH 11/14 ASoC: Intel: bytcr_rt5640: simplify MCLK quirk tests

In reply to Pierre-Louis Bossart

remove redundant tests to check MCLK (align with other machine drivers)

---
 sound/soc/intel/boards/bytcr_rt5640.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/intel/boards/bytcr_rt5640.c +3 -3
index 15b1e29..7cee09d 100644
@@ -178,7 +178,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
 	}
 
 	if (SND_SOC_DAPM_EVENT_ON(event)) {
-		if ((byt_rt5640_quirk & BYT_RT5640_MCLK_EN) && priv->mclk) {
+		if (priv->mclk) {
 			ret = clk_prepare_enable(priv->mclk);
 			if (ret < 0) {
 				dev_err(card->dev,
@@ -199,7 +199,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
 					     48000 * 512,
 					     SND_SOC_CLOCK_IN);
 		if (!ret) {
-			if ((byt_rt5640_quirk & BYT_RT5640_MCLK_EN) && priv->mclk)
+			if (priv->mclk)
 				clk_disable_unprepare(priv->mclk);
 		}
 	}
@@ -549,7 +549,7 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
 	snd_soc_dapm_ignore_suspend(&card->dapm, "Headphone");
 	snd_soc_dapm_ignore_suspend(&card->dapm, "Speaker");
 
-	if ((byt_rt5640_quirk & BYT_RT5640_MCLK_EN) && priv->mclk) {
+	if (priv->mclk) {
 		/*
 		 * The firmware might enable the clock at
 		 * boot (this information may or may not
Signature · 1 line
2.9.3
maintainer
#18 lore raw

Applied "ASoC: Intel: bytcr_rt5640: simplify MCLK quirk tests" to the asoc tree

The patch

ASoC: Intel: bytcr_rt5640: simplify MCLK quirk tests

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

From: Pierre-Louis Bossart <[email protected]>
Date: Fri, 8 Sep 2017 12:43:56 -0500
Subject: [PATCH] ASoC: Intel: bytcr_rt5640: simplify MCLK quirk tests

remove redundant tests to check MCLK (align with other machine drivers). some checks remain since when the MCLK is disabled we fall back to using the bclk as PLL reference

---
 sound/soc/intel/boards/bytcr_rt5640.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/intel/boards/bytcr_rt5640.c +3 -3
index 15b1e292b0c3..7cee09d08ad7 100644
@@ -178,7 +178,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
 	}
 
 	if (SND_SOC_DAPM_EVENT_ON(event)) {
-		if ((byt_rt5640_quirk & BYT_RT5640_MCLK_EN) && priv->mclk) {
+		if (priv->mclk) {
 			ret = clk_prepare_enable(priv->mclk);
 			if (ret < 0) {
 				dev_err(card->dev,
@@ -199,7 +199,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
 					     48000 * 512,
 					     SND_SOC_CLOCK_IN);
 		if (!ret) {
-			if ((byt_rt5640_quirk & BYT_RT5640_MCLK_EN) && priv->mclk)
+			if (priv->mclk)
 				clk_disable_unprepare(priv->mclk);
 		}
 	}
@@ -549,7 +549,7 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime)
 	snd_soc_dapm_ignore_suspend(&card->dapm, "Headphone");
 	snd_soc_dapm_ignore_suspend(&card->dapm, "Speaker");
 
-	if ((byt_rt5640_quirk & BYT_RT5640_MCLK_EN) && priv->mclk) {
+	if (priv->mclk) {
 		/*
 		 * The firmware might enable the clock at
 		 * boot (this information may or may not
Signature · 1 line
2.14.1
#19 lore raw

PATCH 12/14 ASoC: codecs: rt5670: add jack detection quirk for Dell Venue 5585

In reply to Pierre-Louis Bossart

Jack is not detected by default, using jdmode=3 works fine

---
 sound/soc/codecs/rt5670.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
sound/soc/codecs/rt5670.c +16 -0
index e56c12a..9545764 100644
@@ -2851,6 +2851,17 @@ static const struct dmi_system_id dmi_platform_intel_bytcht_jdmode2[] = {
 	{}
 };
 
+static const struct dmi_system_id dmi_platform_intel_bytcht_jdmode3[] = {
+	{
+		.ident = "Dell Venue 8 Pro 5855",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Venue 8 Pro 5855"),
+		},
+	},
+	{}
+};
+
 static int rt5670_i2c_probe(struct i2c_client *i2c,
 		    const struct i2c_device_id *id)
 {
@@ -2880,6 +2891,11 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
 		rt5670->pdata.dmic1_data_pin = RT5670_DMIC_DATA_IN2P;
 		rt5670->pdata.dev_gpio = true;
 		rt5670->pdata.jd_mode = 2;
+	} else if (dmi_check_system(dmi_platform_intel_bytcht_jdmode3)) {
+		rt5670->pdata.dmic_en = true;
+		rt5670->pdata.dmic1_data_pin = RT5670_DMIC_DATA_IN2P;
+		rt5670->pdata.dev_gpio = true;
+		rt5670->pdata.jd_mode = 3;
 	}
 
 	rt5670->regmap = devm_regmap_init_i2c(i2c, &rt5670_regmap);
Signature · 1 line
2.9.3
maintainer
#20 lore raw

Applied "ASoC: codecs: rt5670: add jack detection quirk for Dell Venue 5585" to the asoc tree

The patch

ASoC: codecs: rt5670: add jack detection quirk for Dell Venue 5585

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

From: Pierre-Louis Bossart <[email protected]>
Date: Tue, 22 Aug 2017 15:32:37 -0500
Subject: [PATCH] ASoC: codecs: rt5670: add jack detection quirk for Dell Venue
5585

Jack is not detected by default, using jdmode=3 works fine

---
 sound/soc/codecs/rt5670.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
sound/soc/codecs/rt5670.c +16 -0
index 0f4e5bc4476f..4ea51b487b8c 100644
@@ -2851,6 +2851,17 @@ static const struct dmi_system_id dmi_platform_intel_bytcht_jdmode2[] = {
 	{}
 };
 
+static const struct dmi_system_id dmi_platform_intel_bytcht_jdmode3[] = {
+	{
+		.ident = "Dell Venue 8 Pro 5855",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Venue 8 Pro 5855"),
+		},
+	},
+	{}
+};
+
 static int rt5670_i2c_probe(struct i2c_client *i2c,
 		    const struct i2c_device_id *id)
 {
@@ -2880,6 +2891,11 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
 		rt5670->pdata.dmic1_data_pin = RT5670_DMIC_DATA_IN2P;
 		rt5670->pdata.dev_gpio = true;
 		rt5670->pdata.jd_mode = 2;
+	} else if (dmi_check_system(dmi_platform_intel_bytcht_jdmode3)) {
+		rt5670->pdata.dmic_en = true;
+		rt5670->pdata.dmic1_data_pin = RT5670_DMIC_DATA_IN2P;
+		rt5670->pdata.dev_gpio = true;
+		rt5670->pdata.jd_mode = 3;
 	}
 
 	rt5670->regmap = devm_regmap_init_i2c(i2c, &rt5670_regmap);
Signature · 1 line
2.14.1
#21 lore raw

PATCH 13/14 ASoC: Intel: cht_bsw_rt5672: use actual HID in suspend/resume

In reply to Pierre-Louis Bossart

The code scans all components looking for the default name i2c-10EC5670:00, which of course doesn't work in platforms where the BIOS uses a different HID such as Dell 5585

Since we already have the correct information available, just use the actual codec name and length.

---
 sound/soc/intel/boards/cht_bsw_rt5672.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/intel/boards/cht_bsw_rt5672.c +6 -2
index ad2f27e..a637bb5 100644
@@ -348,9 +348,11 @@ static struct snd_soc_dai_link cht_dailink[] = {
 static int cht_suspend_pre(struct snd_soc_card *card)
 {
 	struct snd_soc_component *component;
+	struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
 
 	list_for_each_entry(component, &card->component_dev_list, card_list) {
-		if (!strcmp(component->name, "i2c-10EC5670:00")) {
+		if (!strncmp(component->name,
+			     ctx->codec_name, sizeof(ctx->codec_name))) {
 			struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
 
 			dev_dbg(codec->dev, "disabling jack detect before going to suspend.\n");
@@ -364,9 +366,11 @@ static int cht_suspend_pre(struct snd_soc_card *card)
 static int cht_resume_post(struct snd_soc_card *card)
 {
 	struct snd_soc_component *component;
+	struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
 
 	list_for_each_entry(component, &card->component_dev_list, card_list) {
-		if (!strcmp(component->name, "i2c-10EC5670:00")) {
+		if (!strncmp(component->name,
+			     ctx->codec_name, sizeof(ctx->codec_name))) {
 			struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
 
 			dev_dbg(codec->dev, "enabling jack detect for resume.\n");
Signature · 1 line
2.9.3
maintainer
#22 lore raw

Applied "ASoC: Intel: cht_bsw_rt5672: use actual HID in suspend/resume" to the asoc tree

The patch

ASoC: Intel: cht_bsw_rt5672: use actual HID in suspend/resume

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

From: Pierre-Louis Bossart <[email protected]>
Date: Thu, 7 Sep 2017 20:12:55 -0500
Subject: [PATCH] ASoC: Intel: cht_bsw_rt5672: use actual HID in suspend/resume

The code scans all components looking for the default name i2c-10EC5670:00, which of course doesn't work in platforms where the BIOS uses a different HID such as Dell 5585

Since we already have the correct information available, just use the actual codec name and length.

---
 sound/soc/intel/boards/cht_bsw_rt5672.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/intel/boards/cht_bsw_rt5672.c +6 -2
index a0e60bc1f84f..5b1e3ee965a7 100644
@@ -347,9 +347,11 @@ static struct snd_soc_dai_link cht_dailink[] = {
 static int cht_suspend_pre(struct snd_soc_card *card)
 {
 	struct snd_soc_component *component;
+	struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
 
 	list_for_each_entry(component, &card->component_dev_list, card_list) {
-		if (!strcmp(component->name, "i2c-10EC5670:00")) {
+		if (!strncmp(component->name,
+			     ctx->codec_name, sizeof(ctx->codec_name))) {
 			struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
 
 			dev_dbg(codec->dev, "disabling jack detect before going to suspend.\n");
@@ -363,9 +365,11 @@ static int cht_suspend_pre(struct snd_soc_card *card)
 static int cht_resume_post(struct snd_soc_card *card)
 {
 	struct snd_soc_component *component;
+	struct cht_mc_private *ctx = snd_soc_card_get_drvdata(card);
 
 	list_for_each_entry(component, &card->component_dev_list, card_list) {
-		if (!strcmp(component->name, "i2c-10EC5670:00")) {
+		if (!strncmp(component->name,
+			     ctx->codec_name, sizeof(ctx->codec_name))) {
 			struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
 
 			dev_dbg(codec->dev, "enabling jack detect for resume.\n");
Signature · 1 line
2.14.1
#23 lore raw

PATCH 14/14 ASoC: Intel: cht_bsw_rt5672: fix card name

In reply to Pierre-Louis Bossart

For now reason the current card name is a ridiculous 'cherrytrailcraudio'. This isn't very useful or self-explanatory, change to driver name cht-bsw-rt5672.

---
 sound/soc/intel/boards/cht_bsw_rt5672.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/boards/cht_bsw_rt5672.c +1 -1
index a637bb5..a139362 100644
@@ -384,7 +384,7 @@ static int cht_resume_post(struct snd_soc_card *card)
 
 /* SoC card */
 static struct snd_soc_card snd_soc_card_cht = {
-	.name = "cherrytrailcraudio",
+	.name = "cht-bsw-rt5672",
 	.owner = THIS_MODULE,
 	.dai_link = cht_dailink,
 	.num_links = ARRAY_SIZE(cht_dailink),
Signature · 1 line
2.9.3
maintainer
#24 lore raw

Applied "ASoC: Intel: cht_bsw_rt5672: fix card name" to the asoc tree

The patch

ASoC: Intel: cht_bsw_rt5672: fix card name

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

From: Pierre-Louis Bossart <[email protected]>
Date: Thu, 7 Sep 2017 20:12:56 -0500
Subject: [PATCH] ASoC: Intel: cht_bsw_rt5672: fix card name

For now reason the current card name is a ridiculous 'cherrytrailcraudio'. This isn't very useful or self-explanatory, change to driver name cht-bsw-rt5672.

---
 sound/soc/intel/boards/cht_bsw_rt5672.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/boards/cht_bsw_rt5672.c +1 -1
index 5b1e3ee965a7..f799b76fdedf 100644
@@ -383,7 +383,7 @@ static int cht_resume_post(struct snd_soc_card *card)
 
 /* SoC card */
 static struct snd_soc_card snd_soc_card_cht = {
-	.name = "cherrytrailcraudio",
+	.name = "cht-bsw-rt5672",
 	.owner = THIS_MODULE,
 	.dai_link = cht_dailink,
 	.num_links = ARRAY_SIZE(cht_dailink),
Signature · 1 line
2.14.1
#25 lore raw
In reply to Pierre-Louis Bossart

Mark, please don't merge this for now. There were a couple of minor comments sent privately to me and I need to address them. I will send an update later this week. Thanks.

Quoted 40 lines · Pierre-Louis Bossart

Finally took the time to cleanup known fixes for codec and machine drivers. I tested on Baytrail/Cherrytrail and w/ RT5640, 45 and 72.

This should be the last batch of fixes before we move on to the integration of SOF (Sound Open Firmware) support in the mainline.

This batch contains two patches already submitted by Thierry Escande on alsa-devel but never merged.

Fang, Yang A (1):
ASoC: ts3a227e: add acpi table

Pierre-Louis Bossart (12):
ASoC: Intel: boards: use devm_clk_get() unconditionally
ASoC: intel: cht_bsw_max98090: add support for clock framework
ASoC: Intel: cht_bsw_max98090: Fix I2S config + unused code
ASoC: Intel: atom: add support for Baytrail Chromebooks
ASoC: Intel: bytcr-rt5651: fix capture routes
ASoC: Intel: bytcr_rt5651: add MCLK support
ASoC: Intel: bytcr_rt5651: filter codec name
ASoC: codecs: rt5645: add quirks for Asus T100HA
ASoC: Intel: bytcr_rt5640: simplify MCLK quirk tests
ASoC: codecs: rt5670: add jack detection quirk for Dell Venue 5585
ASoC: Intel: cht_bsw_rt5672: use actual HID in suspend/resume
ASoC: Intel: cht_bsw_rt5672: fix card name

Thierry Escande (1):
ASoc: cht_bsw_max98090_ti: Fix jack initialization

 sound/soc/codecs/rt5645.c                    |  20 ++
 sound/soc/codecs/rt5670.c                    |  16 ++
 sound/soc/codecs/ts3a227e.c                  |  10 +
 sound/soc/intel/atom/sst/sst_acpi.c          |   8 +
 sound/soc/intel/boards/bytcr_rt5640.c        |   8 +-
 sound/soc/intel/boards/bytcr_rt5651.c        | 278 ++++++++++++++++++++++++---
 sound/soc/intel/boards/cht_bsw_max98090_ti.c | 157 ++++++++++++---
 sound/soc/intel/boards/cht_bsw_rt5645.c      |  14 +-
 sound/soc/intel/boards/cht_bsw_rt5672.c      |  36 ++--
 9 files changed, 460 insertions(+), 87 deletions(-)
maintainer
#26 lore raw
Quoted 3 lines · Pierre-Louis Bossart

Mark, please don't merge this for now. There were a couple of minor comments sent privately to me and I need to address them. I will send an update later this week. Thanks.

OK, I did also send you a very major comment about the missing signoffs on a lot of the patches...

#27 lore raw
Quoted 7 lines · Mark Brown
Quoted 3 lines · Pierre-Louis Bossart

Mark, please don't merge this for now. There were a couple of minor comments sent privately to me and I need to address them. I will send an update later this week. Thanks.

OK, I did also send you a very major comment about the missing signoffs on a lot of the patches...

I must have had an email issue, I didn't see your replies and which patches you merged, sorry about the noise.
Yes, the missing signed-offs were flagged by Vinod, i didn't know they were required since they were already posted a while back and I didn't touch those patches. Point taken, i already fixed this. There was another issue with a missing error handling which is agreed on with Thierry Escande. I am also planning to get more testing done for the maxim codec, I am told that the machine driver worked as is but the code can't possibly function with a mismatch of both protocol and slot width so there is something fishy to look into.