Skip to content

Commit

Permalink
ASoC: tpa6130a2: Support for tpa6140's regulators
Browse files Browse the repository at this point in the history
tpa6140a2 uses different names for the regulators.

Signed-off-by: Ilkka Koskinen <ilkka.koskinen@nokia.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Ilkka Koskinen authored and Mark Brown committed Jan 11, 2010
1 parent 53242c6 commit 2138301
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
6 changes: 6 additions & 0 deletions include/sound/tpa6130a2-plat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
#ifndef TPA6130A2_PLAT_H
#define TPA6130A2_PLAT_H

enum tpa_model {
TPA6130A2,
TPA6140A2,
};

struct tpa6130a2_platform_data {
enum tpa_model id;
int power_gpio;
};

Expand Down
22 changes: 20 additions & 2 deletions sound/soc/codecs/tpa6130a2.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ static const char *tpa6130a2_supply_names[TPA6130A2_NUM_SUPPLIES] = {
"Vdd",
};

static const char *tpa6140a2_supply_names[TPA6130A2_NUM_SUPPLIES] = {
"HPVdd",
"AVdd",
};

/* This struct is used to save the context */
struct tpa6130a2_data {
struct mutex mutex;
Expand Down Expand Up @@ -420,8 +425,21 @@ static int tpa6130a2_probe(struct i2c_client *client,
gpio_direction_output(data->power_gpio, 0);
}

for (i = 0; i < ARRAY_SIZE(data->supplies); i++)
data->supplies[i].supply = tpa6130a2_supply_names[i];
switch (pdata->id) {
case TPA6130A2:
for (i = 0; i < ARRAY_SIZE(data->supplies); i++)
data->supplies[i].supply = tpa6130a2_supply_names[i];
break;
case TPA6140A2:
for (i = 0; i < ARRAY_SIZE(data->supplies); i++)
data->supplies[i].supply = tpa6140a2_supply_names[i];;
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->supplies);
Expand Down

0 comments on commit 2138301

Please sign in to comment.