diff options
-rw-r--r-- | include/sound/tpa6130a2-plat.h | 6 | ||||
-rw-r--r-- | sound/soc/codecs/tpa6130a2.c | 22 |
2 files changed, 26 insertions, 2 deletions
diff --git a/include/sound/tpa6130a2-plat.h b/include/sound/tpa6130a2-plat.h index e8c901e749d8..e29fde6b5cbe 100644 --- a/include/sound/tpa6130a2-plat.h +++ b/include/sound/tpa6130a2-plat.h | |||
@@ -23,7 +23,13 @@ | |||
23 | #ifndef TPA6130A2_PLAT_H | 23 | #ifndef TPA6130A2_PLAT_H |
24 | #define TPA6130A2_PLAT_H | 24 | #define TPA6130A2_PLAT_H |
25 | 25 | ||
26 | enum tpa_model { | ||
27 | TPA6130A2, | ||
28 | TPA6140A2, | ||
29 | }; | ||
30 | |||
26 | struct tpa6130a2_platform_data { | 31 | struct tpa6130a2_platform_data { |
32 | enum tpa_model id; | ||
27 | int power_gpio; | 33 | int power_gpio; |
28 | }; | 34 | }; |
29 | 35 | ||
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c index 8e98ccfab75c..8b27281e62a1 100644 --- a/sound/soc/codecs/tpa6130a2.c +++ b/sound/soc/codecs/tpa6130a2.c | |||
@@ -41,6 +41,11 @@ static const char *tpa6130a2_supply_names[TPA6130A2_NUM_SUPPLIES] = { | |||
41 | "Vdd", | 41 | "Vdd", |
42 | }; | 42 | }; |
43 | 43 | ||
44 | static const char *tpa6140a2_supply_names[TPA6130A2_NUM_SUPPLIES] = { | ||
45 | "HPVdd", | ||
46 | "AVdd", | ||
47 | }; | ||
48 | |||
44 | /* This struct is used to save the context */ | 49 | /* This struct is used to save the context */ |
45 | struct tpa6130a2_data { | 50 | struct tpa6130a2_data { |
46 | struct mutex mutex; | 51 | struct mutex mutex; |
@@ -420,8 +425,21 @@ static int tpa6130a2_probe(struct i2c_client *client, | |||
420 | gpio_direction_output(data->power_gpio, 0); | 425 | gpio_direction_output(data->power_gpio, 0); |
421 | } | 426 | } |
422 | 427 | ||
423 | for (i = 0; i < ARRAY_SIZE(data->supplies); i++) | 428 | switch (pdata->id) { |
424 | data->supplies[i].supply = tpa6130a2_supply_names[i]; | 429 | case TPA6130A2: |
430 | for (i = 0; i < ARRAY_SIZE(data->supplies); i++) | ||
431 | data->supplies[i].supply = tpa6130a2_supply_names[i]; | ||
432 | break; | ||
433 | case TPA6140A2: | ||
434 | for (i = 0; i < ARRAY_SIZE(data->supplies); i++) | ||
435 | data->supplies[i].supply = tpa6140a2_supply_names[i];; | ||
436 | break; | ||
437 | default: | ||
438 | dev_warn(dev, "Unknown TPA model (%d). Assuming 6130A2\n", | ||
439 | pdata->id); | ||
440 | for (i = 0; i < ARRAY_SIZE(data->supplies); i++) | ||
441 | data->supplies[i].supply = tpa6130a2_supply_names[i]; | ||
442 | } | ||
425 | 443 | ||
426 | ret = regulator_bulk_get(dev, ARRAY_SIZE(data->supplies), | 444 | ret = regulator_bulk_get(dev, ARRAY_SIZE(data->supplies), |
427 | data->supplies); | 445 | data->supplies); |