Skip to contentSkip to conversation

ASoC: rt5677: Modify the behavior that updates the PLL parameter.

PATCH Applied Oder Chiou 2 participants 9 messages Jan 8, 2015 – Jan 9, 2015

Subsystems (3)
lore
Share & tools
lore

Oder Chiou

author maintainer
#0 lore raw

PATCH 1/3 ASoC: rt5677: Modify the behavior that updates the PLL parameter.

The patch modified the behavior that updates the PLL parameter. It set the update bit before the PLL power up.

---
 sound/soc/codecs/rt5677.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
sound/soc/codecs/rt5677.c +14 -4
index 8900221..d27630a 100644
@@ -2174,10 +2174,14 @@ static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w,
 	struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
 
 	switch (event) {
-	case SND_SOC_DAPM_POST_PMU:
+	case SND_SOC_DAPM_PRE_PMU:
 		regmap_update_bits(rt5677->regmap, RT5677_PLL1_CTRL2, 0x2, 0x2);
+		break;
+
+	case SND_SOC_DAPM_POST_PMU:
 		regmap_update_bits(rt5677->regmap, RT5677_PLL1_CTRL2, 0x2, 0x0);
 		break;
+
 	default:
 		return 0;
 	}
@@ -2192,10 +2196,14 @@ static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w,
 	struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec);
 
 	switch (event) {
-	case SND_SOC_DAPM_POST_PMU:
+	case SND_SOC_DAPM_PRE_PMU:
 		regmap_update_bits(rt5677->regmap, RT5677_PLL2_CTRL2, 0x2, 0x2);
+		break;
+
+	case SND_SOC_DAPM_POST_PMU:
 		regmap_update_bits(rt5677->regmap, RT5677_PLL2_CTRL2, 0x2, 0x0);
 		break;
+
 	default:
 		return 0;
 	}
@@ -2303,9 +2311,11 @@ static int rt5677_vref_event(struct snd_soc_dapm_widget *w,
 
 static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = {
 	SND_SOC_DAPM_SUPPLY("PLL1", RT5677_PWR_ANLG2, RT5677_PWR_PLL1_BIT,
-		0, rt5677_set_pll1_event, SND_SOC_DAPM_POST_PMU),
+		0, rt5677_set_pll1_event, SND_SOC_DAPM_PRE_PMU |
+		SND_SOC_DAPM_POST_PMU),
 	SND_SOC_DAPM_SUPPLY("PLL2", RT5677_PWR_ANLG2, RT5677_PWR_PLL2_BIT,
-		0, rt5677_set_pll2_event, SND_SOC_DAPM_POST_PMU),
+		0, rt5677_set_pll2_event, SND_SOC_DAPM_PRE_PMU |
+		SND_SOC_DAPM_POST_PMU),
 
 	/* ASRC */
 	SND_SOC_DAPM_SUPPLY_S("I2S1 ASRC", 1, RT5677_ASRC_1, 0, 0, NULL, 0),
Signature · 1 line
1.8.1.1.439.g50a6b54
author maintainer
#1 lore raw

PATCH 2/3 ASoC: rt5677: Add the MICBIAS VDD setting in the platform data

The patch adds the MICBIAS VDD setting in the platform data. It can be set to 1V8 or 3V3 in the MICBIAS VDD.

---
 include/sound/rt5677.h    | 3 +++
 sound/soc/codecs/rt5677.c | 5 +++++
 2 files changed, 8 insertions(+)
include/sound/rt5677.h +3 -0
index d9eb7d8..a620704 100644
@@ -37,6 +37,9 @@ struct rt5677_platform_data {
 		OFF, GPIO4, GPIO5 and GPIO6 respectively */
 	unsigned int jd2_gpio;
 	unsigned int jd3_gpio;
+
+	/* Set MICBIAS1 VDD 1v8 or 3v3 */
+	bool micbias1_vdd_3v3;
 };
 
 #endif
sound/soc/codecs/rt5677.c +5 -0
index d27630a..32c368c 100644
@@ -4923,6 +4923,11 @@ static int rt5677_i2c_probe(struct i2c_client *i2c,
 					RT5677_GPIO5_DIR_OUT);
 	}
 
+	if (rt5677->pdata.micbias1_vdd_3v3)
+		regmap_update_bits(rt5677->regmap, RT5677_MICBIAS,
+			RT5677_MICBIAS1_CTRL_VDD_MASK,
+			RT5677_MICBIAS1_CTRL_VDD_3_3V);
+
 	rt5677_init_gpio(i2c);
 	rt5677_init_irq(i2c);
 
Signature · 1 line
1.8.1.1.439.g50a6b54
author maintainer
#3 lore raw

PATCH 3/3 ASoC: rt5677: Add the specific TDM setting for Intel platform.

In reply to Oder Chiou

The patch adds the specific TDM setting for Intel platform in the platform data. It enables the TDM1's capbility that can receive the 100FS data.

---
 include/sound/rt5677.h    | 3 +++
 sound/soc/codecs/rt5677.c | 6 +++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
include/sound/rt5677.h +3 -0
index a620704..1137183 100644
@@ -40,6 +40,9 @@ struct rt5677_platform_data {
 
 	/* Set MICBIAS1 VDD 1v8 or 3v3 */
 	bool micbias1_vdd_3v3;
+
+	/* Set TDM mode for Intel */
+	bool tdm_for_intel;
 };
 
 #endif
sound/soc/codecs/rt5677.c +5 -1
index 32c368c..b1c17b0 100644
@@ -4427,7 +4427,7 @@ static int rt5677_probe(struct snd_soc_codec *codec)
 
 	rt5677_set_bias_level(codec, SND_SOC_BIAS_OFF);
 
-	regmap_write(rt5677->regmap, RT5677_DIG_MISC, 0x0020);
+	regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x0020, 0x0020);
 	regmap_write(rt5677->regmap, RT5677_PWR_DSP2, 0x0c00);
 
 	for (i = 0; i < RT5677_GPIO_NUM; i++)
@@ -4928,6 +4928,10 @@ static int rt5677_i2c_probe(struct i2c_client *i2c,
 			RT5677_MICBIAS1_CTRL_VDD_MASK,
 			RT5677_MICBIAS1_CTRL_VDD_3_3V);
 
+	if (rt5677->pdata.tdm_for_intel)
+		regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x8000,
+			0x8000);
+
 	rt5677_init_gpio(i2c);
 	rt5677_init_irq(i2c);
 
Signature · 1 line
1.8.1.1.439.g50a6b54
maintainer
#5 lore raw
In reply to Oder Chiou
Quoted 2 lines · Oder Chiou

The patch modified the behavior that updates the PLL parameter. It set the update bit before the PLL power up.

This looks like it's a bug fix?

maintainer Applied
#2 lore raw

Re: [PATCH 2/3] ASoC: rt5677: Add the MICBIAS VDD setting in the platform data

In reply to Oder Chiou
Quoted 2 lines · Oder Chiou

The patch adds the MICBIAS VDD setting in the platform data. It can be set to 1V8 or 3V3 in the MICBIAS VDD.

Applied, thanks.

maintainer
#4 lore raw

Re: [PATCH 3/3] ASoC: rt5677: Add the specific TDM setting for Intel platform.

In reply to Oder Chiou
Quoted 2 lines · Oder Chiou

The patch adds the specific TDM setting for Intel platform in the platform data. It enables the TDM1's capbility that can receive the 100FS data.

So, this is total magic number stuff... can you be more specific as to what this 100fs mode is? We do have an interface for setting up TDM but given that this is just flipping one bit I'd expect the hardware isn't actually generic enough to use that so I'd like to better understand what the configuration actually does.

author maintainer
#6 lore raw
In reply to Mark Brown
Quoted 9 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Friday, January 09, 2015 2:36 AM
To: Oder Chiou
Cc: [email protected]; [email protected]; Bard Liao; Flove; John Lin; [email protected]
Subject: Re: [PATCH 1/3] ASoC: rt5677: Modify the behavior that updates the PLL parameter.

Quoted 6 lines
Quoted 2 lines · Oder Chiou

The patch modified the behavior that updates the PLL parameter. It set the update bit before the PLL power up.

This looks like it's a bug fix?

Actually, the previous version had be verified, but our HW engineer recommended to this kind of sequence, thanks.

maintainer Applied
#8 lore raw
In reply to Oder Chiou
Quoted 2 lines · Oder Chiou

The patch modified the behavior that updates the PLL parameter. It set the update bit before the PLL power up.

Applied, thanks.

maintainer
#7 lore raw
In reply to Oder Chiou
Quoted 4 lines · Oder Chiou
Quoted 1 line

This looks like it's a bug fix?

Actually, the previous version had be verified, but our HW engineer recommended to this kind of sequence, thanks.

That does sound like a hardware correctness fix then - something that will fail in some use cases or based on factors like timing.