diff mbox

[RFC,5/6] ASoC: sgtl5000: disable internal PLL early

Message ID 1424991273-10081-6-git-send-email-eric.nelson@boundarydevices.com (mailing list archive)
State Accepted, archived
Commit 08dea16e0960ea5caf7876045b747145cb677096
Headers show

Commit Message

Eric Nelson Feb. 26, 2015, 10:54 p.m. UTC
To handle the soft reboot case, the internal PLL must be
disabled in SGTL5000_CHIP_CLK_CTRL before clearing bits
SGTL5000_VCOAMP_POWERUP and SGTL5000_PLL_POWERUP in
register SGTL5000_CHIP_ANA_POWER.

Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
---
 sound/soc/codecs/sgtl5000.c | 9 ++++++++-
 sound/soc/codecs/sgtl5000.h | 1 +
 2 files changed, 9 insertions(+), 1 deletion(-)

Comments

Mark Brown March 6, 2015, 8:15 p.m. UTC | #1
On Thu, Feb 26, 2015 at 03:54:32PM -0700, Eric Nelson wrote:

>  static const struct reg_default sgtl5000_reg_defaults[] = {
>  	{ SGTL5000_CHIP_DIG_POWER,		0x0000 },
> -	{ SGTL5000_CHIP_CLK_CTRL,		0x0008 },

Again, you shouldn't be changing the register defaults table unless the
defaults don't match power up values.
Eric Nelson March 6, 2015, 10:16 p.m. UTC | #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Mark,

On 03/06/2015 01:15 PM, Mark Brown wrote:
> On Thu, Feb 26, 2015 at 03:54:32PM -0700, Eric Nelson wrote:
> 
>> static const struct reg_default sgtl5000_reg_defaults[] = { {
>> SGTL5000_CHIP_DIG_POWER,		0x0000 }, -	{ SGTL5000_CHIP_CLK_CTRL,
>> 0x0008 },
> 
> Again, you shouldn't be changing the register defaults table unless
> the defaults don't match power up values.
> 

I described the rational in response to patch 2: there's a
dependency on the PLLs being disabled before a write to
ANA_POWER.

Regards,


Eric
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJU+ic1AAoJEFUqXmm9AiVra7wIAJ26meDf/UaeEjWcDgPdFPEU
68kZeNWXh6M1LliJCLwxtdp/WQLErJOh51vtT3foTcm1DF2WUIaqggX5J1BFccJT
Nu3//Q4SWf2yQhFQvsE0Vu+c2edQdh2JKvs3dN8HOxrlNXu5wfS0o2hhoKoqHisT
ROzipaV/MsHwA36l8iK383vpmz3cZjzTJdKWl7Pnr24LffWwPbtqpRUgKFuccl2B
bL61s8YujMgDCMC8D8k/p3h3EaOGNq0NOQUSiL+ISIpQlqsI7jLEgo9BtVTjpg0S
3fyykr1Wi93C1k1xag5ZAEdckvo1YemVyUdNUrX1aVStkarM+5l57rnncHnjUmM=
=+E9A
-----END PGP SIGNATURE-----
diff mbox

Patch

diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index c373991..5f7dd5d 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -38,7 +38,6 @@ 
 /* default value of sgtl5000 registers */
 static const struct reg_default sgtl5000_reg_defaults[] = {
 	{ SGTL5000_CHIP_DIG_POWER,		0x0000 },
-	{ SGTL5000_CHIP_CLK_CTRL,		0x0008 },
 	{ SGTL5000_CHIP_I2S_CTRL,		0x0010 },
 	{ SGTL5000_CHIP_SSS_CTRL,		0x0010 },
 	{ SGTL5000_CHIP_ADCDAC_CTRL,		0x020c },
@@ -1248,6 +1247,14 @@  static int sgtl5000_i2c_probe(struct i2c_client *client,
 	dev_info(&client->dev, "sgtl5000 revision 0x%x\n", rev);
 	sgtl5000->revision = rev;
 
+	/* reconfigure the clocks in case we're using the PLL */
+	ret = regmap_write(sgtl5000->regmap,
+			   SGTL5000_CHIP_CLK_CTRL,
+			   SGTL5000_CHIP_CLK_CTRL_DEFAULT);
+	if (ret)
+		dev_err(&client->dev,
+			"Error %d initializing CHIP_CLK_CTRL\n", ret);
+
 	/* Follow section 2.2.1.1 of AN3663 */
 	ana_pwr = SGTL5000_ANA_POWER_DEFAULT;
 	if (sgtl5000->num_supplies <= VDDD) {
diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h
index 6fdc589..a97e3f4 100644
--- a/sound/soc/codecs/sgtl5000.h
+++ b/sound/soc/codecs/sgtl5000.h
@@ -92,6 +92,7 @@ 
 /*
  * SGTL5000_CHIP_CLK_CTRL
  */
+#define SGTL5000_CHIP_CLK_CTRL_DEFAULT		0x0008
 #define SGTL5000_RATE_MODE_MASK			0x0030
 #define SGTL5000_RATE_MODE_SHIFT		4
 #define SGTL5000_RATE_MODE_WIDTH		2