aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-09 10:22:38 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-09 10:22:38 -0500
commit7136b6059f6723104ed4653a3a95ebc6d3529787 (patch)
treed9242a5ad96cfc9c6a9c7bf7ebf0e037ef00eac0 /sound/soc
parentde7a8a88e1219bcfb5a6905356dd0a3cfaa85be3 (diff)
parenta5710c0135db75f1c97c31e835f37d1e94096346 (diff)
Merge remote-tracking branch 'asoc/topic/wm9081' into asoc-next
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/wm9081.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c
index 2de74e1ea225..860144e85e06 100644
--- a/sound/soc/codecs/wm9081.c
+++ b/sound/soc/codecs/wm9081.c
@@ -1341,28 +1341,27 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c,
1341 1341
1342 i2c_set_clientdata(i2c, wm9081); 1342 i2c_set_clientdata(i2c, wm9081);
1343 1343
1344 wm9081->regmap = regmap_init_i2c(i2c, &wm9081_regmap); 1344 wm9081->regmap = devm_regmap_init_i2c(i2c, &wm9081_regmap);
1345 if (IS_ERR(wm9081->regmap)) { 1345 if (IS_ERR(wm9081->regmap)) {
1346 ret = PTR_ERR(wm9081->regmap); 1346 ret = PTR_ERR(wm9081->regmap);
1347 dev_err(&i2c->dev, "regmap_init() failed: %d\n", ret); 1347 dev_err(&i2c->dev, "regmap_init() failed: %d\n", ret);
1348 goto err; 1348 return ret;
1349 } 1349 }
1350 1350
1351 ret = regmap_read(wm9081->regmap, WM9081_SOFTWARE_RESET, &reg); 1351 ret = regmap_read(wm9081->regmap, WM9081_SOFTWARE_RESET, &reg);
1352 if (ret != 0) { 1352 if (ret != 0) {
1353 dev_err(&i2c->dev, "Failed to read chip ID: %d\n", ret); 1353 dev_err(&i2c->dev, "Failed to read chip ID: %d\n", ret);
1354 goto err_regmap; 1354 return ret;
1355 } 1355 }
1356 if (reg != 0x9081) { 1356 if (reg != 0x9081) {
1357 dev_err(&i2c->dev, "Device is not a WM9081: ID=0x%x\n", reg); 1357 dev_err(&i2c->dev, "Device is not a WM9081: ID=0x%x\n", reg);
1358 ret = -EINVAL; 1358 return -EINVAL;
1359 goto err_regmap;
1360 } 1359 }
1361 1360
1362 ret = wm9081_reset(wm9081->regmap); 1361 ret = wm9081_reset(wm9081->regmap);
1363 if (ret < 0) { 1362 if (ret < 0) {
1364 dev_err(&i2c->dev, "Failed to issue reset\n"); 1363 dev_err(&i2c->dev, "Failed to issue reset\n");
1365 goto err_regmap; 1364 return ret;
1366 } 1365 }
1367 1366
1368 if (dev_get_platdata(&i2c->dev)) 1367 if (dev_get_platdata(&i2c->dev))
@@ -1382,23 +1381,14 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c,
1382 ret = snd_soc_register_codec(&i2c->dev, 1381 ret = snd_soc_register_codec(&i2c->dev,
1383 &soc_codec_dev_wm9081, &wm9081_dai, 1); 1382 &soc_codec_dev_wm9081, &wm9081_dai, 1);
1384 if (ret < 0) 1383 if (ret < 0)
1385 goto err_regmap; 1384 return ret;
1386 1385
1387 return 0; 1386 return 0;
1388
1389err_regmap:
1390 regmap_exit(wm9081->regmap);
1391err:
1392
1393 return ret;
1394} 1387}
1395 1388
1396static __devexit int wm9081_i2c_remove(struct i2c_client *client) 1389static __devexit int wm9081_i2c_remove(struct i2c_client *client)
1397{ 1390{
1398 struct wm9081_priv *wm9081 = i2c_get_clientdata(client);
1399
1400 snd_soc_unregister_codec(&client->dev); 1391 snd_soc_unregister_codec(&client->dev);
1401 regmap_exit(wm9081->regmap);
1402 return 0; 1392 return 0;
1403} 1393}
1404 1394