diff options
author | Jarkko Nikula <jhnikula@gmail.com> | 2010-05-19 03:52:28 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-05-20 05:28:39 -0400 |
commit | ad8332c1302bcb4f80d593fd3eb477be9d7f5604 (patch) | |
tree | d0e3ab8c75ad11601f59f0e9da5b080c92dfb0c9 /sound/soc | |
parent | 266d38c8e3d7f62152b1448fd9a7265f32f32d87 (diff) |
ASoC: tpa6130a2: Remove CPVSS and HPVdd supplies
These pins are for decoupling capacitors for the internal charge pumps
in TPA6130A2 and TPA6140A2 and not for connecting external supply.
Thanks to Eduardo Valentin <eduardo.valentin@nokia.com> for pointing out the
issue with TPA6130A2 and Ilkka Koskinen <ilkka.koskinen@nokia.com> with
TPA6140A2.
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Reviewed-by: Ilkka Koskinen <ilkka.koskinen@nokia.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/tpa6130a2.c | 52 |
1 files changed, 18 insertions, 34 deletions
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index 89788921280e..20ac67700395 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c | |||
@@ -35,22 +35,11 @@ | |||
35 | 35 | ||
36 | static struct i2c_client *tpa6130a2_client; | 36 | static struct i2c_client *tpa6130a2_client; |
37 | 37 | ||
38 | #define TPA6130A2_NUM_SUPPLIES 2 | ||
39 | static const char *tpa6130a2_supply_names[TPA6130A2_NUM_SUPPLIES] = { | ||
40 | "CPVSS", | ||
41 | "Vdd", | ||
42 | }; | ||
43 | |||
44 | static const char *tpa6140a2_supply_names[TPA6130A2_NUM_SUPPLIES] = { | ||
45 | "HPVdd", | ||
46 | "AVdd", | ||
47 | }; | ||
48 | |||
49 | /* This struct is used to save the context */ | 38 | /* This struct is used to save the context */ |
50 | struct tpa6130a2_data { | 39 | struct tpa6130a2_data { |
51 | struct mutex mutex; | 40 | struct mutex mutex; |
52 | unsigned char regs[TPA6130A2_CACHEREGNUM]; | 41 | unsigned char regs[TPA6130A2_CACHEREGNUM]; |
53 | struct regulator_bulk_data supplies[TPA6130A2_NUM_SUPPLIES]; | 42 | struct regulator *supply; |
54 | int power_gpio; | 43 | int power_gpio; |
55 | unsigned char power_state; | 44 | unsigned char power_state; |
56 | enum tpa_model id; | 45 | enum tpa_model id; |
@@ -135,11 +124,10 @@ static int tpa6130a2_power(int power) | |||
135 | if (data->power_gpio >= 0) | 124 | if (data->power_gpio >= 0) |
136 | gpio_set_value(data->power_gpio, 1); | 125 | gpio_set_value(data->power_gpio, 1); |
137 | 126 | ||
138 | ret = regulator_bulk_enable(ARRAY_SIZE(data->supplies), | 127 | ret = regulator_enable(data->supply); |
139 | data->supplies); | ||
140 | if (ret != 0) { | 128 | if (ret != 0) { |
141 | dev_err(&tpa6130a2_client->dev, | 129 | dev_err(&tpa6130a2_client->dev, |
142 | "Failed to enable supplies: %d\n", ret); | 130 | "Failed to enable supply: %d\n", ret); |
143 | goto exit; | 131 | goto exit; |
144 | } | 132 | } |
145 | 133 | ||
@@ -160,11 +148,10 @@ static int tpa6130a2_power(int power) | |||
160 | if (data->power_gpio >= 0) | 148 | if (data->power_gpio >= 0) |
161 | gpio_set_value(data->power_gpio, 0); | 149 | gpio_set_value(data->power_gpio, 0); |
162 | 150 | ||
163 | ret = regulator_bulk_disable(ARRAY_SIZE(data->supplies), | 151 | ret = regulator_disable(data->supply); |
164 | data->supplies); | ||
165 | if (ret != 0) { | 152 | if (ret != 0) { |
166 | dev_err(&tpa6130a2_client->dev, | 153 | dev_err(&tpa6130a2_client->dev, |
167 | "Failed to disable supplies: %d\n", ret); | 154 | "Failed to disable supply: %d\n", ret); |
168 | goto exit; | 155 | goto exit; |
169 | } | 156 | } |
170 | 157 | ||
@@ -411,7 +398,8 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client, | |||
411 | struct device *dev; | 398 | struct device *dev; |
412 | struct tpa6130a2_data *data; | 399 | struct tpa6130a2_data *data; |
413 | struct tpa6130a2_platform_data *pdata; | 400 | struct tpa6130a2_platform_data *pdata; |
414 | int i, ret; | 401 | const char *regulator; |
402 | int ret; | ||
415 | 403 | ||
416 | dev = &client->dev; | 404 | dev = &client->dev; |
417 | 405 | ||
@@ -453,25 +441,21 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client, | |||
453 | } | 441 | } |
454 | 442 | ||
455 | switch (data->id) { | 443 | switch (data->id) { |
444 | default: | ||
445 | dev_warn(dev, "Unknown TPA model (%d). Assuming 6130A2\n", | ||
446 | pdata->id); | ||
456 | case TPA6130A2: | 447 | case TPA6130A2: |
457 | for (i = 0; i < ARRAY_SIZE(data->supplies); i++) | 448 | regulator = "Vdd"; |
458 | data->supplies[i].supply = tpa6130a2_supply_names[i]; | ||
459 | break; | 449 | break; |
460 | case TPA6140A2: | 450 | case TPA6140A2: |
461 | for (i = 0; i < ARRAY_SIZE(data->supplies); i++) | 451 | regulator = "AVdd"; |
462 | data->supplies[i].supply = tpa6140a2_supply_names[i];; | ||
463 | break; | 452 | break; |
464 | default: | ||
465 | dev_warn(dev, "Unknown TPA model (%d). Assuming 6130A2\n", | ||
466 | pdata->id); | ||
467 | for (i = 0; i < ARRAY_SIZE(data->supplies); i++) | ||
468 | data->supplies[i].supply = tpa6130a2_supply_names[i]; | ||
469 | } | 453 | } |
470 | 454 | ||
471 | ret = regulator_bulk_get(dev, ARRAY_SIZE(data->supplies), | 455 | data->supply = regulator_get(dev, regulator); |
472 | data->supplies); | 456 | if (IS_ERR(data->supply)) { |
473 | if (ret != 0) { | 457 | ret = PTR_ERR(data->supply); |
474 | dev_err(dev, "Failed to request supplies: %d\n", ret); | 458 | dev_err(dev, "Failed to request supply: %d\n", ret); |
475 | goto err_regulator; | 459 | goto err_regulator; |
476 | } | 460 | } |
477 | 461 | ||
@@ -494,7 +478,7 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client, | |||
494 | return 0; | 478 | return 0; |
495 | 479 | ||
496 | err_power: | 480 | err_power: |
497 | regulator_bulk_free(ARRAY_SIZE(data->supplies), data->supplies); | 481 | regulator_put(data->supply); |
498 | err_regulator: | 482 | err_regulator: |
499 | if (data->power_gpio >= 0) | 483 | if (data->power_gpio >= 0) |
500 | gpio_free(data->power_gpio); | 484 | gpio_free(data->power_gpio); |
@@ -515,7 +499,7 @@ static int __devexit tpa6130a2_remove(struct i2c_client *client) | |||
515 | if (data->power_gpio >= 0) | 499 | if (data->power_gpio >= 0) |
516 | gpio_free(data->power_gpio); | 500 | gpio_free(data->power_gpio); |
517 | 501 | ||
518 | regulator_bulk_free(ARRAY_SIZE(data->supplies), data->supplies); | 502 | regulator_put(data->supply); |
519 | 503 | ||
520 | kfree(data); | 504 | kfree(data); |
521 | tpa6130a2_client = NULL; | 505 | tpa6130a2_client = NULL; |