aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/tpa6130a2.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/tpa6130a2.c')
-rw-r--r--sound/soc/codecs/tpa6130a2.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index 565ff39ad3a3..ec78073e3588 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -398,7 +398,8 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
398 TPA6130A2_MUTE_L; 398 TPA6130A2_MUTE_L;
399 399
400 if (data->power_gpio >= 0) { 400 if (data->power_gpio >= 0) {
401 ret = gpio_request(data->power_gpio, "tpa6130a2 enable"); 401 ret = devm_gpio_request(dev, data->power_gpio,
402 "tpa6130a2 enable");
402 if (ret < 0) { 403 if (ret < 0) {
403 dev_err(dev, "Failed to request power GPIO (%d)\n", 404 dev_err(dev, "Failed to request power GPIO (%d)\n",
404 data->power_gpio); 405 data->power_gpio);
@@ -419,16 +420,16 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
419 break; 420 break;
420 } 421 }
421 422
422 data->supply = regulator_get(dev, regulator); 423 data->supply = devm_regulator_get(dev, regulator);
423 if (IS_ERR(data->supply)) { 424 if (IS_ERR(data->supply)) {
424 ret = PTR_ERR(data->supply); 425 ret = PTR_ERR(data->supply);
425 dev_err(dev, "Failed to request supply: %d\n", ret); 426 dev_err(dev, "Failed to request supply: %d\n", ret);
426 goto err_regulator; 427 goto err_gpio;
427 } 428 }
428 429
429 ret = tpa6130a2_power(1); 430 ret = tpa6130a2_power(1);
430 if (ret != 0) 431 if (ret != 0)
431 goto err_power; 432 goto err_gpio;
432 433
433 434
434 /* Read version */ 435 /* Read version */
@@ -440,15 +441,10 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
440 /* Disable the chip */ 441 /* Disable the chip */
441 ret = tpa6130a2_power(0); 442 ret = tpa6130a2_power(0);
442 if (ret != 0) 443 if (ret != 0)
443 goto err_power; 444 goto err_gpio;
444 445
445 return 0; 446 return 0;
446 447
447err_power:
448 regulator_put(data->supply);
449err_regulator:
450 if (data->power_gpio >= 0)
451 gpio_free(data->power_gpio);
452err_gpio: 448err_gpio:
453 tpa6130a2_client = NULL; 449 tpa6130a2_client = NULL;
454 450
@@ -457,14 +453,7 @@ err_gpio:
457 453
458static int __devexit tpa6130a2_remove(struct i2c_client *client) 454static int __devexit tpa6130a2_remove(struct i2c_client *client)
459{ 455{
460 struct tpa6130a2_data *data = i2c_get_clientdata(client);
461
462 tpa6130a2_power(0); 456 tpa6130a2_power(0);
463
464 if (data->power_gpio >= 0)
465 gpio_free(data->power_gpio);
466
467 regulator_put(data->supply);
468 tpa6130a2_client = NULL; 457 tpa6130a2_client = NULL;
469 458
470 return 0; 459 return 0;