aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/codecs/sgtl5000.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 1f4093f3f3a1..bd291d2b327d 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -115,6 +115,7 @@ struct sgtl5000_priv {
115 struct ldo_regulator *ldo; 115 struct ldo_regulator *ldo;
116 struct regmap *regmap; 116 struct regmap *regmap;
117 struct clk *mclk; 117 struct clk *mclk;
118 int revision;
118}; 119};
119 120
120/* 121/*
@@ -1300,9 +1301,7 @@ static int sgtl5000_replace_vddd_with_ldo(struct snd_soc_codec *codec)
1300 1301
1301static int sgtl5000_enable_regulators(struct snd_soc_codec *codec) 1302static int sgtl5000_enable_regulators(struct snd_soc_codec *codec)
1302{ 1303{
1303 int reg;
1304 int ret; 1304 int ret;
1305 int rev;
1306 int i; 1305 int i;
1307 int external_vddd = 0; 1306 int external_vddd = 0;
1308 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); 1307 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
@@ -1332,14 +1331,7 @@ static int sgtl5000_enable_regulators(struct snd_soc_codec *codec)
1332 * workaround for revision 0x11 and later, 1331 * workaround for revision 0x11 and later,
1333 * roll back to use internal LDO 1332 * roll back to use internal LDO
1334 */ 1333 */
1335 1334 if (external_vddd && sgtl5000->revision >= 0x11) {
1336 ret = regmap_read(sgtl5000->regmap, SGTL5000_CHIP_ID, &reg);
1337 if (ret)
1338 goto err_regulator_disable;
1339
1340 rev = (reg & SGTL5000_REVID_MASK) >> SGTL5000_REVID_SHIFT;
1341
1342 if (external_vddd && rev >= 0x11) {
1343 /* disable all regulator first */ 1335 /* disable all regulator first */
1344 regulator_bulk_disable(ARRAY_SIZE(sgtl5000->supplies), 1336 regulator_bulk_disable(ARRAY_SIZE(sgtl5000->supplies),
1345 sgtl5000->supplies); 1337 sgtl5000->supplies);
@@ -1362,9 +1354,6 @@ static int sgtl5000_enable_regulators(struct snd_soc_codec *codec)
1362 1354
1363 return 0; 1355 return 0;
1364 1356
1365err_regulator_disable:
1366 regulator_bulk_disable(ARRAY_SIZE(sgtl5000->supplies),
1367 sgtl5000->supplies);
1368err_regulator_free: 1357err_regulator_free:
1369 regulator_bulk_free(ARRAY_SIZE(sgtl5000->supplies), 1358 regulator_bulk_free(ARRAY_SIZE(sgtl5000->supplies),
1370 sgtl5000->supplies); 1359 sgtl5000->supplies);
@@ -1566,6 +1555,7 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
1566 1555
1567 rev = (reg & SGTL5000_REVID_MASK) >> SGTL5000_REVID_SHIFT; 1556 rev = (reg & SGTL5000_REVID_MASK) >> SGTL5000_REVID_SHIFT;
1568 dev_info(&client->dev, "sgtl5000 revision 0x%x\n", rev); 1557 dev_info(&client->dev, "sgtl5000 revision 0x%x\n", rev);
1558 sgtl5000->revision = rev;
1569 1559
1570 i2c_set_clientdata(client, sgtl5000); 1560 i2c_set_clientdata(client, sgtl5000);
1571 1561