Skip to contentSkip to conversation

ASoC: sgtl5000: Fix wrong register name in restore

PATCH Applied [email protected] 2 participants 3 messages Jan 16, 2012

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

PATCH 1/2 ASoC: sgtl5000: Fix wrong register name in restore

From: Zeng Zhaoming <[email protected]>

Correct SGTL5000_CHIP_CLK_CTRL to SGTL5000_CHIP_REF_CTRL in sgtl5000_restore_regs(), and add comment to explain the restore order.

---
 sound/soc/codecs/sgtl5000.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
sound/soc/codecs/sgtl5000.c +9 -2
index fc9b127..71df1fe 100644
@@ -987,12 +987,12 @@ static int sgtl5000_restore_regs(struct snd_soc_codec *codec)
 	/* restore regular registers */
 	for (reg = 0; reg <= SGTL5000_CHIP_SHORT_CTRL; reg += 2) {
 
-		/* this regs depends on the others */
+		/* These regs should restore in particular order */
 		if (reg == SGTL5000_CHIP_ANA_POWER ||
 			reg == SGTL5000_CHIP_CLK_CTRL ||
 			reg == SGTL5000_CHIP_LINREG_CTRL ||
 			reg == SGTL5000_CHIP_LINE_OUT_CTRL ||
-			reg == SGTL5000_CHIP_CLK_CTRL)
+			reg == SGTL5000_CHIP_REF_CTRL)
 			continue;
 
 		snd_soc_write(codec, reg, cache[reg]);
@@ -1005,6 +1005,13 @@ static int sgtl5000_restore_regs(struct snd_soc_codec *codec)
 	/*
 	 * restore power and other regs according
 	 * to set_power() and set_clock()
+	 * the order of restore is:
+	 * 1. SGTL5000_CHIP_CLK_CTRL MCLK_FREQ bits (1:0) should be restore after
+	 *    SGTL5000_CHIP_ANA_POWER PLL bits set
+	 * 2. SGTL5000_CHIP_LINREG_CTRL should be set before
+	 *    SGTL5000_CHIP_ANA_POWER LINREG_D restored
+	 * 3. SGTL5000_CHIP_REF_CTRL controls Analog Ground Voltage,
+	 *    I prefer to resotre it after SGTL5000_CHIP_ANA_POWER restored
 	 */
 	snd_soc_write(codec, SGTL5000_CHIP_LINREG_CTRL,
 			cache[SGTL5000_CHIP_LINREG_CTRL]);
Signature · 1 line
1.7.6.1.385.gb7fcd0
#1 lore raw
Quoted 10 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Monday, January 16, 2012 3:16 PM
To: [email protected]
Cc: Dong Aisheng-B29396; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 1/2] ASoC: sgtl5000: Fix wrong register name in restore
Importance: High

Quoted 5 lines

From: Zeng Zhaoming <[email protected]>

Correct SGTL5000_CHIP_CLK_CTRL to SGTL5000_CHIP_REF_CTRL in sgtl5000_restore_regs(), and add comment to explain the restore order.

The change is ok to me.
One minor thing:

Quoted 26 lines
---
 sound/soc/codecs/sgtl5000.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
sound/soc/codecs/sgtl5000.c index renamed from sound/soc/codecs/sgtl5000.c +0 -0

fc9b127..71df1fe 100644

sound/soc/codecs/sgtl5000.c +2 -2
@@ -987,12 +987,12 @@ static int sgtl5000_restore_regs(struct snd_soc_codec
 *codec)
 	/* restore regular registers */
 	for (reg = 0; reg <= SGTL5000_CHIP_SHORT_CTRL; reg += 2) {
 
-		/* this regs depends on the others */
+		/* These regs should restore in particular order */
 		if (reg == SGTL5000_CHIP_ANA_POWER ||
 			reg == SGTL5000_CHIP_CLK_CTRL ||
 			reg == SGTL5000_CHIP_LINREG_CTRL ||
 			reg == SGTL5000_CHIP_LINE_OUT_CTRL ||
-			reg == SGTL5000_CHIP_CLK_CTRL)
+			reg == SGTL5000_CHIP_REF_CTRL)
 			continue;
 

snd_soc_write(codec, reg, cache[reg]); @@ -1005,6 +1005,13 @@
static int sgtl5000_restore_regs(struct snd_soc_codec *codec)

sound/soc/codecs/sgtl5000.c static int sgtl5000_restore_regs(struct snd_soc_codec *codec) · line 1007

Quoted 3 lines
sound/soc/codecs/sgtl5000.c +0 -0
 	/*
 	 * restore power and other regs according
 	 * to set_power() and set_clock()

There's no such functions in this driver.
Can we change the comment to something like:
"restore power and other regs according to the power and clock setting sequence". That's easier to understand.

Quoted 11 lines
sound/soc/codecs/sgtl5000.c +7 -1
+	 * the order of restore is:
+	 * 1. SGTL5000_CHIP_CLK_CTRL MCLK_FREQ bits (1:0) should be restore after
+	 *    SGTL5000_CHIP_ANA_POWER PLL bits set
+	 * 2. SGTL5000_CHIP_LINREG_CTRL should be set before
+	 *    SGTL5000_CHIP_ANA_POWER LINREG_D restored
+	 * 3. SGTL5000_CHIP_REF_CTRL controls Analog Ground Voltage,
+	 *    I prefer to resotre it after SGTL5000_CHIP_ANA_POWER restored
 	 */
 	snd_soc_write(codec, SGTL5000_CHIP_LINREG_CTRL,
 			cache[SGTL5000_CHIP_LINREG_CTRL]);
--
Quoted 2 lines

1.7.6.1.385.gb7fcd0

Regards
Dong Aisheng

#2 lore raw
Quoted 42 lines · On Mon 2012-01-16 08:35:46, Dong Aisheng-B29396 wrote:
Quoted 10 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Monday, January 16, 2012 3:16 PM
To: [email protected]
Cc: Dong Aisheng-B29396; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: [PATCH 1/2] ASoC: sgtl5000: Fix wrong register name in restore
Importance: High

Quoted 5 lines

From: Zeng Zhaoming <[email protected]>

Correct SGTL5000_CHIP_CLK_CTRL to SGTL5000_CHIP_REF_CTRL in sgtl5000_restore_regs(), and add comment to explain the restore order.

The change is ok to me.
One minor thing:

Quoted 24 lines
---
 sound/soc/codecs/sgtl5000.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
sound/soc/codecs/sgtl5000.c index renamed from sound/soc/codecs/sgtl5000.c +0 -0

fc9b127..71df1fe 100644

sound/soc/codecs/sgtl5000.c +2 -2
@@ -987,12 +987,12 @@ static int sgtl5000_restore_regs(struct snd_soc_codec
 *codec)
 	/* restore regular registers */
 	for (reg = 0; reg <= SGTL5000_CHIP_SHORT_CTRL; reg += 2) {
 
-		/* this regs depends on the others */
+		/* These regs should restore in particular order */
 		if (reg == SGTL5000_CHIP_ANA_POWER ||
 			reg == SGTL5000_CHIP_CLK_CTRL ||
 			reg == SGTL5000_CHIP_LINREG_CTRL ||
 			reg == SGTL5000_CHIP_LINE_OUT_CTRL ||
-			reg == SGTL5000_CHIP_CLK_CTRL)
+			reg == SGTL5000_CHIP_REF_CTRL)
 			continue;
 
Quoted 9 lines

sound/soc/codecs/sgtl5000.c static int sgtl5000_restore_regs(struct snd_soc_codec *codec) · line 1007

Quoted 5 lines

snd_soc_write(codec, reg, cache[reg]); @@ -1005,6 +1005,13 @@
static int sgtl5000_restore_regs(struct snd_soc_codec *codec)

sound/soc/codecs/sgtl5000.c +0 -0
 	/*
 	 * restore power and other regs according
 	 * to set_power() and set_clock()

There's no such functions in this driver.
Can we change the comment to something like:
"restore power and other regs according to the power and clock setting sequence". That's easier to understand.

Thanks, you will see this next.

Quoted 17 lines
Quoted 12 lines
sound/soc/codecs/sgtl5000.c +7 -1
+	 * the order of restore is:
+	 * 1. SGTL5000_CHIP_CLK_CTRL MCLK_FREQ bits (1:0) should be restore after
+	 *    SGTL5000_CHIP_ANA_POWER PLL bits set
+	 * 2. SGTL5000_CHIP_LINREG_CTRL should be set before
+	 *    SGTL5000_CHIP_ANA_POWER LINREG_D restored
+	 * 3. SGTL5000_CHIP_REF_CTRL controls Analog Ground Voltage,
+	 *    I prefer to resotre it after SGTL5000_CHIP_ANA_POWER restored
 	 */
 	snd_soc_write(codec, SGTL5000_CHIP_LINREG_CTRL,
 			cache[SGTL5000_CHIP_LINREG_CTRL]);
--
Quoted 2 lines

1.7.6.1.385.gb7fcd0

Regards
Dong Aisheng