aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Nelson <eric@nelint.com>2016-06-06 19:14:48 -0400
committerMark Brown <broonie@kernel.org>2016-06-15 09:09:09 -0400
commit940adb280d23512965409c1fd6b42cc796ce6eb8 (patch)
treea30f6c7eea548375ccb200773cce879c707b8ddc
parent7e74436410a9a74f41f3be9cc45b504e83544f60 (diff)
ASoC: sgtl5000: Fix regulator support
Regulator support on SGTL5000 is broken because the VDDIO and VDDA and VDDD should be powered on before enabling MCLK as shown in Figure 4 of [1]. This requires moving control of the regulators from the codec block to the I2C block of the driver. The bulk of this patch consists of swapping the codec device with the i2c client. The new field num_supplies in struct sgtl5000_priv is used instead of ARRAY_SIZE(supplies) to handle the special case when the internal LDO is used instead of external VDDD. Note that ER1 in the SGTL5000 Errata document [2] suggests that all designs should use external VDDD. Since the internal LDO can only be enabled after I2C is available, there's no benefit in treating it as a regulator, so this patch removes the regulator structure surrounding it. Instead, a single block of code in sgtl5000_i2c_probe() performs the initialization sequence in section 2.2.1.1 of [3] and page 26 of [1]. References: [1] SGTL5000 data sheet http://cache.nxp.com/files/analog/doc/data_sheet/SGTL5000.pdf [2] SGTL5000 errata http://cache.nxp.com/files/analog/doc/errata/SGTL5000ER.pdf [3] SGTL5000 Initialization and programming app note http://cache.nxp.com/files/analog/doc/app_note/AN3663.pdf Signed-off-by: Eric Nelson <eric@nelint.com> Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com> Tested-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/sgtl5000.c343
1 files changed, 78 insertions, 265 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 23766bc4f8e8..77bdd1daa322 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -92,36 +92,8 @@ static const char *supply_names[SGTL5000_SUPPLY_NUM] = {
92 "VDDD" 92 "VDDD"
93}; 93};
94 94
95#define LDO_CONSUMER_NAME "VDDD_LDO"
96#define LDO_VOLTAGE 1200000 95#define LDO_VOLTAGE 1200000
97 96
98static struct regulator_consumer_supply ldo_consumer[] = {
99 REGULATOR_SUPPLY(LDO_CONSUMER_NAME, NULL),
100};
101
102static struct regulator_init_data ldo_init_data = {
103 .constraints = {
104 .min_uV = 1200000,
105 .max_uV = 1200000,
106 .valid_modes_mask = REGULATOR_MODE_NORMAL,
107 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
108 },
109 .num_consumer_supplies = 1,
110 .consumer_supplies = &ldo_consumer[0],
111};
112
113/*
114 * sgtl5000 internal ldo regulator,
115 * enabled when VDDD not provided
116 */
117struct ldo_regulator {
118 struct regulator_desc desc;
119 struct regulator_dev *dev;
120 int voltage;
121 void *codec_data;
122 bool enabled;
123};
124
125enum sgtl5000_micbias_resistor { 97enum sgtl5000_micbias_resistor {
126 SGTL5000_MICBIAS_OFF = 0, 98 SGTL5000_MICBIAS_OFF = 0,
127 SGTL5000_MICBIAS_2K = 2, 99 SGTL5000_MICBIAS_2K = 2,
@@ -135,7 +107,7 @@ struct sgtl5000_priv {
135 int master; /* i2s master or not */ 107 int master; /* i2s master or not */
136 int fmt; /* i2s data format */ 108 int fmt; /* i2s data format */
137 struct regulator_bulk_data supplies[SGTL5000_SUPPLY_NUM]; 109 struct regulator_bulk_data supplies[SGTL5000_SUPPLY_NUM];
138 struct ldo_regulator *ldo; 110 int num_supplies;
139 struct regmap *regmap; 111 struct regmap *regmap;
140 struct clk *mclk; 112 struct clk *mclk;
141 int revision; 113 int revision;
@@ -778,155 +750,6 @@ static int sgtl5000_pcm_hw_params(struct snd_pcm_substream *substream,
778 return 0; 750 return 0;
779} 751}
780 752
781#ifdef CONFIG_REGULATOR
782static int ldo_regulator_is_enabled(struct regulator_dev *dev)
783{
784 struct ldo_regulator *ldo = rdev_get_drvdata(dev);
785
786 return ldo->enabled;
787}
788
789static int ldo_regulator_enable(struct regulator_dev *dev)
790{
791 struct ldo_regulator *ldo = rdev_get_drvdata(dev);
792 struct snd_soc_codec *codec = (struct snd_soc_codec *)ldo->codec_data;
793 int reg;
794
795 if (ldo_regulator_is_enabled(dev))
796 return 0;
797
798 /* set regulator value firstly */
799 reg = (1600 - ldo->voltage / 1000) / 50;
800 reg = clamp(reg, 0x0, 0xf);
801
802 /* amend the voltage value, unit: uV */
803 ldo->voltage = (1600 - reg * 50) * 1000;
804
805 /* set voltage to register */
806 snd_soc_update_bits(codec, SGTL5000_CHIP_LINREG_CTRL,
807 SGTL5000_LINREG_VDDD_MASK, reg);
808
809 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
810 SGTL5000_LINEREG_D_POWERUP,
811 SGTL5000_LINEREG_D_POWERUP);
812
813 /* when internal ldo is enabled, simple digital power can be disabled */
814 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
815 SGTL5000_LINREG_SIMPLE_POWERUP,
816 0);
817
818 ldo->enabled = 1;
819 return 0;
820}
821
822static int ldo_regulator_disable(struct regulator_dev *dev)
823{
824 struct ldo_regulator *ldo = rdev_get_drvdata(dev);
825 struct snd_soc_codec *codec = (struct snd_soc_codec *)ldo->codec_data;
826
827 snd_soc_update_bits(codec, SGTL5000_CHIP_ANA_POWER,
828 SGTL5000_LINEREG_D_POWERUP,
829 0);
830
831 /* clear voltage info */
832 snd_soc_update_bits(codec, SGTL5000_CHIP_LINREG_CTRL,
833 SGTL5000_LINREG_VDDD_MASK, 0);
834
835 ldo->enabled = 0;
836
837 return 0;
838}
839
840static int ldo_regulator_get_voltage(struct regulator_dev *dev)
841{
842 struct ldo_regulator *ldo = rdev_get_drvdata(dev);
843
844 return ldo->voltage;
845}
846
847static struct regulator_ops ldo_regulator_ops = {
848 .is_enabled = ldo_regulator_is_enabled,
849 .enable = ldo_regulator_enable,
850 .disable = ldo_regulator_disable,
851 .get_voltage = ldo_regulator_get_voltage,
852};
853
854static int ldo_regulator_register(struct snd_soc_codec *codec,
855 struct regulator_init_data *init_data,
856 int voltage)
857{
858 struct ldo_regulator *ldo;
859 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
860 struct regulator_config config = { };
861
862 ldo = kzalloc(sizeof(struct ldo_regulator), GFP_KERNEL);
863
864 if (!ldo)
865 return -ENOMEM;
866
867 ldo->desc.name = kstrdup(dev_name(codec->dev), GFP_KERNEL);
868 if (!ldo->desc.name) {
869 kfree(ldo);
870 dev_err(codec->dev, "failed to allocate decs name memory\n");
871 return -ENOMEM;
872 }
873
874 ldo->desc.type = REGULATOR_VOLTAGE;
875 ldo->desc.owner = THIS_MODULE;
876 ldo->desc.ops = &ldo_regulator_ops;
877 ldo->desc.n_voltages = 1;
878
879 ldo->codec_data = codec;
880 ldo->voltage = voltage;
881
882 config.dev = codec->dev;
883 config.driver_data = ldo;
884 config.init_data = init_data;
885
886 ldo->dev = regulator_register(&ldo->desc, &config);
887 if (IS_ERR(ldo->dev)) {
888 int ret = PTR_ERR(ldo->dev);
889
890 dev_err(codec->dev, "failed to register regulator\n");
891 kfree(ldo->desc.name);
892 kfree(ldo);
893
894 return ret;
895 }
896 sgtl5000->ldo = ldo;
897
898 return 0;
899}
900
901static int ldo_regulator_remove(struct snd_soc_codec *codec)
902{
903 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
904 struct ldo_regulator *ldo = sgtl5000->ldo;
905
906 if (!ldo)
907 return 0;
908
909 regulator_unregister(ldo->dev);
910 kfree(ldo->desc.name);
911 kfree(ldo);
912
913 return 0;
914}
915#else
916static int ldo_regulator_register(struct snd_soc_codec *codec,
917 struct regulator_init_data *init_data,
918 int voltage)
919{
920 dev_err(codec->dev, "this setup needs regulator support in the kernel\n");
921 return -EINVAL;
922}
923
924static int ldo_regulator_remove(struct snd_soc_codec *codec)
925{
926 return 0;
927}
928#endif
929
930/* 753/*
931 * set dac bias 754 * set dac bias
932 * common state changes: 755 * common state changes:
@@ -950,7 +773,7 @@ static int sgtl5000_set_bias_level(struct snd_soc_codec *codec,
950 case SND_SOC_BIAS_STANDBY: 773 case SND_SOC_BIAS_STANDBY:
951 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { 774 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) {
952 ret = regulator_bulk_enable( 775 ret = regulator_bulk_enable(
953 ARRAY_SIZE(sgtl5000->supplies), 776 sgtl5000->num_supplies,
954 sgtl5000->supplies); 777 sgtl5000->supplies);
955 if (ret) 778 if (ret)
956 return ret; 779 return ret;
@@ -964,7 +787,7 @@ static int sgtl5000_set_bias_level(struct snd_soc_codec *codec,
964 "Failed to restore cache: %d\n", ret); 787 "Failed to restore cache: %d\n", ret);
965 788
966 regcache_cache_only(sgtl5000->regmap, true); 789 regcache_cache_only(sgtl5000->regmap, true);
967 regulator_bulk_disable(ARRAY_SIZE(sgtl5000->supplies), 790 regulator_bulk_disable(sgtl5000->num_supplies,
968 sgtl5000->supplies); 791 sgtl5000->supplies);
969 792
970 return ret; 793 return ret;
@@ -974,8 +797,8 @@ static int sgtl5000_set_bias_level(struct snd_soc_codec *codec,
974 break; 797 break;
975 case SND_SOC_BIAS_OFF: 798 case SND_SOC_BIAS_OFF:
976 regcache_cache_only(sgtl5000->regmap, true); 799 regcache_cache_only(sgtl5000->regmap, true);
977 regulator_bulk_disable(ARRAY_SIZE(sgtl5000->supplies), 800 regulator_bulk_disable(sgtl5000->num_supplies,
978 sgtl5000->supplies); 801 sgtl5000->supplies);
979 break; 802 break;
980 } 803 }
981 804
@@ -1130,7 +953,9 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec)
1130 953
1131 vdda = regulator_get_voltage(sgtl5000->supplies[VDDA].consumer); 954 vdda = regulator_get_voltage(sgtl5000->supplies[VDDA].consumer);
1132 vddio = regulator_get_voltage(sgtl5000->supplies[VDDIO].consumer); 955 vddio = regulator_get_voltage(sgtl5000->supplies[VDDIO].consumer);
1133 vddd = regulator_get_voltage(sgtl5000->supplies[VDDD].consumer); 956 vddd = (sgtl5000->num_supplies > VDDD)
957 ? regulator_get_voltage(sgtl5000->supplies[VDDD].consumer)
958 : LDO_VOLTAGE;
1134 959
1135 vdda = vdda / 1000; 960 vdda = vdda / 1000;
1136 vddio = vddio / 1000; 961 vddio = vddio / 1000;
@@ -1255,78 +1080,43 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec)
1255 return 0; 1080 return 0;
1256} 1081}
1257 1082
1258static int sgtl5000_replace_vddd_with_ldo(struct snd_soc_codec *codec) 1083static int sgtl5000_enable_regulators(struct i2c_client *client)
1259{
1260 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
1261 int ret;
1262
1263 /* set internal ldo to 1.2v */
1264 ret = ldo_regulator_register(codec, &ldo_init_data, LDO_VOLTAGE);
1265 if (ret) {
1266 dev_err(codec->dev,
1267 "Failed to register vddd internal supplies: %d\n", ret);
1268 return ret;
1269 }
1270
1271 sgtl5000->supplies[VDDD].supply = LDO_CONSUMER_NAME;
1272
1273 dev_info(codec->dev, "Using internal LDO instead of VDDD\n");
1274 return 0;
1275}
1276
1277static int sgtl5000_enable_regulators(struct snd_soc_codec *codec)
1278{ 1084{
1279 int ret; 1085 int ret;
1280 int i; 1086 int i;
1281 int external_vddd = 0; 1087 int external_vddd = 0;
1282 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
1283 struct regulator *vddd; 1088 struct regulator *vddd;
1089 struct sgtl5000_priv *sgtl5000 = i2c_get_clientdata(client);
1284 1090
1285 for (i = 0; i < ARRAY_SIZE(sgtl5000->supplies); i++) 1091 for (i = 0; i < ARRAY_SIZE(sgtl5000->supplies); i++)
1286 sgtl5000->supplies[i].supply = supply_names[i]; 1092 sgtl5000->supplies[i].supply = supply_names[i];
1287 1093
1288 /* External VDDD only works before revision 0x11 */ 1094 vddd = regulator_get_optional(&client->dev, "VDDD");
1289 if (sgtl5000->revision < 0x11) { 1095 if (IS_ERR(vddd)) {
1290 vddd = regulator_get_optional(codec->dev, "VDDD"); 1096 /* See if it's just not registered yet */
1291 if (IS_ERR(vddd)) { 1097 if (PTR_ERR(vddd) == -EPROBE_DEFER)
1292 /* See if it's just not registered yet */ 1098 return -EPROBE_DEFER;
1293 if (PTR_ERR(vddd) == -EPROBE_DEFER) 1099 } else {
1294 return -EPROBE_DEFER; 1100 external_vddd = 1;
1295 } else { 1101 regulator_put(vddd);
1296 external_vddd = 1;
1297 regulator_put(vddd);
1298 }
1299 }
1300
1301 if (!external_vddd) {
1302 ret = sgtl5000_replace_vddd_with_ldo(codec);
1303 if (ret)
1304 return ret;
1305 } 1102 }
1306 1103
1307 ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(sgtl5000->supplies), 1104 sgtl5000->num_supplies = ARRAY_SIZE(sgtl5000->supplies)
1105 - 1 + external_vddd;
1106 ret = regulator_bulk_get(&client->dev, sgtl5000->num_supplies,
1308 sgtl5000->supplies); 1107 sgtl5000->supplies);
1309 if (ret) 1108 if (ret)
1310 goto err_ldo_remove; 1109 return ret;
1311
1312 ret = regulator_bulk_enable(ARRAY_SIZE(sgtl5000->supplies),
1313 sgtl5000->supplies);
1314 if (ret)
1315 goto err_regulator_free;
1316
1317 /* wait for all power rails bring up */
1318 udelay(10);
1319 1110
1320 return 0; 1111 ret = regulator_bulk_enable(sgtl5000->num_supplies,
1112 sgtl5000->supplies);
1113 if (!ret)
1114 usleep_range(10, 20);
1115 else
1116 regulator_bulk_free(sgtl5000->num_supplies,
1117 sgtl5000->supplies);
1321 1118
1322err_regulator_free:
1323 regulator_bulk_free(ARRAY_SIZE(sgtl5000->supplies),
1324 sgtl5000->supplies);
1325err_ldo_remove:
1326 if (!external_vddd)
1327 ldo_regulator_remove(codec);
1328 return ret; 1119 return ret;
1329
1330} 1120}
1331 1121
1332static int sgtl5000_probe(struct snd_soc_codec *codec) 1122static int sgtl5000_probe(struct snd_soc_codec *codec)
@@ -1334,10 +1124,6 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
1334 int ret; 1124 int ret;
1335 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); 1125 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
1336 1126
1337 ret = sgtl5000_enable_regulators(codec);
1338 if (ret)
1339 return ret;
1340
1341 /* power up sgtl5000 */ 1127 /* power up sgtl5000 */
1342 ret = sgtl5000_set_power_regs(codec); 1128 ret = sgtl5000_set_power_regs(codec);
1343 if (ret) 1129 if (ret)
@@ -1388,25 +1174,11 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
1388 return 0; 1174 return 0;
1389 1175
1390err: 1176err:
1391 regulator_bulk_disable(ARRAY_SIZE(sgtl5000->supplies),
1392 sgtl5000->supplies);
1393 regulator_bulk_free(ARRAY_SIZE(sgtl5000->supplies),
1394 sgtl5000->supplies);
1395 ldo_regulator_remove(codec);
1396
1397 return ret; 1177 return ret;
1398} 1178}
1399 1179
1400static int sgtl5000_remove(struct snd_soc_codec *codec) 1180static int sgtl5000_remove(struct snd_soc_codec *codec)
1401{ 1181{
1402 struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec);
1403
1404 regulator_bulk_disable(ARRAY_SIZE(sgtl5000->supplies),
1405 sgtl5000->supplies);
1406 regulator_bulk_free(ARRAY_SIZE(sgtl5000->supplies),
1407 sgtl5000->supplies);
1408 ldo_regulator_remove(codec);
1409
1410 return 0; 1182 return 0;
1411} 1183}
1412 1184
@@ -1474,11 +1246,17 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
1474 if (!sgtl5000) 1246 if (!sgtl5000)
1475 return -ENOMEM; 1247 return -ENOMEM;
1476 1248
1249 i2c_set_clientdata(client, sgtl5000);
1250
1251 ret = sgtl5000_enable_regulators(client);
1252 if (ret)
1253 return ret;
1254
1477 sgtl5000->regmap = devm_regmap_init_i2c(client, &sgtl5000_regmap); 1255 sgtl5000->regmap = devm_regmap_init_i2c(client, &sgtl5000_regmap);
1478 if (IS_ERR(sgtl5000->regmap)) { 1256 if (IS_ERR(sgtl5000->regmap)) {
1479 ret = PTR_ERR(sgtl5000->regmap); 1257 ret = PTR_ERR(sgtl5000->regmap);
1480 dev_err(&client->dev, "Failed to allocate regmap: %d\n", ret); 1258 dev_err(&client->dev, "Failed to allocate regmap: %d\n", ret);
1481 return ret; 1259 goto disable_regs;
1482 } 1260 }
1483 1261
1484 sgtl5000->mclk = devm_clk_get(&client->dev, NULL); 1262 sgtl5000->mclk = devm_clk_get(&client->dev, NULL);
@@ -1487,21 +1265,25 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
1487 dev_err(&client->dev, "Failed to get mclock: %d\n", ret); 1265 dev_err(&client->dev, "Failed to get mclock: %d\n", ret);
1488 /* Defer the probe to see if the clk will be provided later */ 1266 /* Defer the probe to see if the clk will be provided later */
1489 if (ret == -ENOENT) 1267 if (ret == -ENOENT)
1490 return -EPROBE_DEFER; 1268 ret = -EPROBE_DEFER;
1491 return ret; 1269 goto disable_regs;
1492 } 1270 }
1493 1271
1494 ret = clk_prepare_enable(sgtl5000->mclk); 1272 ret = clk_prepare_enable(sgtl5000->mclk);
1495 if (ret) 1273 if (ret) {
1496 return ret; 1274 dev_err(&client->dev, "Error enabling clock %d\n", ret);
1275 goto disable_regs;
1276 }
1497 1277
1498 /* Need 8 clocks before I2C accesses */ 1278 /* Need 8 clocks before I2C accesses */
1499 udelay(1); 1279 udelay(1);
1500 1280
1501 /* read chip information */ 1281 /* read chip information */
1502 ret = regmap_read(sgtl5000->regmap, SGTL5000_CHIP_ID, &reg); 1282 ret = regmap_read(sgtl5000->regmap, SGTL5000_CHIP_ID, &reg);
1503 if (ret) 1283 if (ret) {
1284 dev_err(&client->dev, "Error reading chip id %d\n", ret);
1504 goto disable_clk; 1285 goto disable_clk;
1286 }
1505 1287
1506 if (((reg & SGTL5000_PARTID_MASK) >> SGTL5000_PARTID_SHIFT) != 1288 if (((reg & SGTL5000_PARTID_MASK) >> SGTL5000_PARTID_SHIFT) !=
1507 SGTL5000_PARTID_PART_ID) { 1289 SGTL5000_PARTID_PART_ID) {
@@ -1515,6 +1297,31 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
1515 dev_info(&client->dev, "sgtl5000 revision 0x%x\n", rev); 1297 dev_info(&client->dev, "sgtl5000 revision 0x%x\n", rev);
1516 sgtl5000->revision = rev; 1298 sgtl5000->revision = rev;
1517 1299
1300 /* Follow section 2.2.1.1 of AN3663 */
1301 if (sgtl5000->num_supplies <= VDDD) {
1302 /* internal VDDD at 1.2V */
1303 regmap_update_bits(sgtl5000->regmap,
1304 SGTL5000_CHIP_LINREG_CTRL,
1305 SGTL5000_LINREG_VDDD_MASK, 8);
1306 regmap_update_bits(sgtl5000->regmap,
1307 SGTL5000_CHIP_ANA_POWER,
1308 SGTL5000_LINEREG_D_POWERUP
1309 | SGTL5000_LINREG_SIMPLE_POWERUP,
1310 SGTL5000_LINEREG_D_POWERUP);
1311 dev_info(&client->dev, "Using internal LDO instead of VDDD: check ER1\n");
1312 } else {
1313 /* using external LDO for VDDD
1314 * Clear startup powerup and simple powerup
1315 * bits to save power
1316 */
1317 regmap_update_bits(sgtl5000->regmap,
1318 SGTL5000_CHIP_ANA_POWER,
1319 SGTL5000_STARTUP_POWERUP
1320 | SGTL5000_LINREG_SIMPLE_POWERUP,
1321 0);
1322 dev_dbg(&client->dev, "Using external VDDD\n");
1323 }
1324
1518 if (np) { 1325 if (np) {
1519 if (!of_property_read_u32(np, 1326 if (!of_property_read_u32(np,
1520 "micbias-resistor-k-ohms", &value)) { 1327 "micbias-resistor-k-ohms", &value)) {
@@ -1556,8 +1363,6 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
1556 } 1363 }
1557 } 1364 }
1558 1365
1559 i2c_set_clientdata(client, sgtl5000);
1560
1561 /* Ensure sgtl5000 will start with sane register values */ 1366 /* Ensure sgtl5000 will start with sane register values */
1562 ret = sgtl5000_fill_defaults(sgtl5000); 1367 ret = sgtl5000_fill_defaults(sgtl5000);
1563 if (ret) 1368 if (ret)
@@ -1572,6 +1377,11 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
1572 1377
1573disable_clk: 1378disable_clk:
1574 clk_disable_unprepare(sgtl5000->mclk); 1379 clk_disable_unprepare(sgtl5000->mclk);
1380
1381disable_regs:
1382 regulator_bulk_disable(sgtl5000->num_supplies, sgtl5000->supplies);
1383 regulator_bulk_free(sgtl5000->num_supplies, sgtl5000->supplies);
1384
1575 return ret; 1385 return ret;
1576} 1386}
1577 1387
@@ -1581,6 +1391,9 @@ static int sgtl5000_i2c_remove(struct i2c_client *client)
1581 1391
1582 snd_soc_unregister_codec(&client->dev); 1392 snd_soc_unregister_codec(&client->dev);
1583 clk_disable_unprepare(sgtl5000->mclk); 1393 clk_disable_unprepare(sgtl5000->mclk);
1394 regulator_bulk_disable(sgtl5000->num_supplies, sgtl5000->supplies);
1395 regulator_bulk_free(sgtl5000->num_supplies, sgtl5000->supplies);
1396
1584 return 0; 1397 return 0;
1585} 1398}
1586 1399