Commit ad8332c1 authored by Jarkko Nikula's avatar Jarkko Nikula Committed by Liam Girdwood

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: default avatarJarkko Nikula <jhnikula@gmail.com>
Acked-by: default avatarPeter Ujfalusi <peter.ujfalusi@nokia.com>
Reviewed-by: default avatarIlkka Koskinen <ilkka.koskinen@nokia.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent 266d38c8
...@@ -35,22 +35,11 @@ ...@@ -35,22 +35,11 @@
static struct i2c_client *tpa6130a2_client; static struct i2c_client *tpa6130a2_client;
#define TPA6130A2_NUM_SUPPLIES 2
static const char *tpa6130a2_supply_names[TPA6130A2_NUM_SUPPLIES] = {
"CPVSS",
"Vdd",
};
static const char *tpa6140a2_supply_names[TPA6130A2_NUM_SUPPLIES] = {
"HPVdd",
"AVdd",
};
/* This struct is used to save the context */ /* This struct is used to save the context */
struct tpa6130a2_data { struct tpa6130a2_data {
struct mutex mutex; struct mutex mutex;
unsigned char regs[TPA6130A2_CACHEREGNUM]; unsigned char regs[TPA6130A2_CACHEREGNUM];
struct regulator_bulk_data supplies[TPA6130A2_NUM_SUPPLIES]; struct regulator *supply;
int power_gpio; int power_gpio;
unsigned char power_state; unsigned char power_state;
enum tpa_model id; enum tpa_model id;
...@@ -135,11 +124,10 @@ static int tpa6130a2_power(int power) ...@@ -135,11 +124,10 @@ static int tpa6130a2_power(int power)
if (data->power_gpio >= 0) if (data->power_gpio >= 0)
gpio_set_value(data->power_gpio, 1); gpio_set_value(data->power_gpio, 1);
ret = regulator_bulk_enable(ARRAY_SIZE(data->supplies), ret = regulator_enable(data->supply);
data->supplies);
if (ret != 0) { if (ret != 0) {
dev_err(&tpa6130a2_client->dev, dev_err(&tpa6130a2_client->dev,
"Failed to enable supplies: %d\n", ret); "Failed to enable supply: %d\n", ret);
goto exit; goto exit;
} }
...@@ -160,11 +148,10 @@ static int tpa6130a2_power(int power) ...@@ -160,11 +148,10 @@ static int tpa6130a2_power(int power)
if (data->power_gpio >= 0) if (data->power_gpio >= 0)
gpio_set_value(data->power_gpio, 0); gpio_set_value(data->power_gpio, 0);
ret = regulator_bulk_disable(ARRAY_SIZE(data->supplies), ret = regulator_disable(data->supply);
data->supplies);
if (ret != 0) { if (ret != 0) {
dev_err(&tpa6130a2_client->dev, dev_err(&tpa6130a2_client->dev,
"Failed to disable supplies: %d\n", ret); "Failed to disable supply: %d\n", ret);
goto exit; goto exit;
} }
...@@ -411,7 +398,8 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client, ...@@ -411,7 +398,8 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
struct device *dev; struct device *dev;
struct tpa6130a2_data *data; struct tpa6130a2_data *data;
struct tpa6130a2_platform_data *pdata; struct tpa6130a2_platform_data *pdata;
int i, ret; const char *regulator;
int ret;
dev = &client->dev; dev = &client->dev;
...@@ -453,25 +441,21 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client, ...@@ -453,25 +441,21 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
} }
switch (data->id) { switch (data->id) {
default:
dev_warn(dev, "Unknown TPA model (%d). Assuming 6130A2\n",
pdata->id);
case TPA6130A2: case TPA6130A2:
for (i = 0; i < ARRAY_SIZE(data->supplies); i++) regulator = "Vdd";
data->supplies[i].supply = tpa6130a2_supply_names[i];
break; break;
case TPA6140A2: case TPA6140A2:
for (i = 0; i < ARRAY_SIZE(data->supplies); i++) regulator = "AVdd";
data->supplies[i].supply = tpa6140a2_supply_names[i];;
break; break;
default:
dev_warn(dev, "Unknown TPA model (%d). Assuming 6130A2\n",
pdata->id);
for (i = 0; i < ARRAY_SIZE(data->supplies); i++)
data->supplies[i].supply = tpa6130a2_supply_names[i];
} }
ret = regulator_bulk_get(dev, ARRAY_SIZE(data->supplies), data->supply = regulator_get(dev, regulator);
data->supplies); if (IS_ERR(data->supply)) {
if (ret != 0) { ret = PTR_ERR(data->supply);
dev_err(dev, "Failed to request supplies: %d\n", ret); dev_err(dev, "Failed to request supply: %d\n", ret);
goto err_regulator; goto err_regulator;
} }
...@@ -494,7 +478,7 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client, ...@@ -494,7 +478,7 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
return 0; return 0;
err_power: err_power:
regulator_bulk_free(ARRAY_SIZE(data->supplies), data->supplies); regulator_put(data->supply);
err_regulator: err_regulator:
if (data->power_gpio >= 0) if (data->power_gpio >= 0)
gpio_free(data->power_gpio); gpio_free(data->power_gpio);
...@@ -515,7 +499,7 @@ static int __devexit tpa6130a2_remove(struct i2c_client *client) ...@@ -515,7 +499,7 @@ static int __devexit tpa6130a2_remove(struct i2c_client *client)
if (data->power_gpio >= 0) if (data->power_gpio >= 0)
gpio_free(data->power_gpio); gpio_free(data->power_gpio);
regulator_bulk_free(ARRAY_SIZE(data->supplies), data->supplies); regulator_put(data->supply);
kfree(data); kfree(data);
tpa6130a2_client = NULL; tpa6130a2_client = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment