mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-11-27 01:11:31 +00:00
ASoC: wm8960: Add support for the power supplies
WM8960 has the following power supplies: - AVDD - DBVDD - DCVDD - SPKVDD1 - SPKVDD1 Add support for them. Signed-off-by: Fabio Estevam <festevam@denx.de> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230803215506.142922-2-festevam@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
6a41c3a160
commit
422f10adc3
1 changed files with 33 additions and 1 deletions
|
|
@ -120,6 +120,15 @@ static bool wm8960_volatile(struct device *dev, unsigned int reg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define WM8960_NUM_SUPPLIES 5
|
||||||
|
static const char *wm8960_supply_names[WM8960_NUM_SUPPLIES] = {
|
||||||
|
"DCVDD",
|
||||||
|
"DBVDD",
|
||||||
|
"AVDD",
|
||||||
|
"SPKVDD1",
|
||||||
|
"SPKVDD2",
|
||||||
|
};
|
||||||
|
|
||||||
struct wm8960_priv {
|
struct wm8960_priv {
|
||||||
struct clk *mclk;
|
struct clk *mclk;
|
||||||
struct regmap *regmap;
|
struct regmap *regmap;
|
||||||
|
|
@ -137,6 +146,7 @@ struct wm8960_priv {
|
||||||
bool is_stream_in_use[2];
|
bool is_stream_in_use[2];
|
||||||
struct wm8960_data pdata;
|
struct wm8960_data pdata;
|
||||||
ktime_t dsch_start;
|
ktime_t dsch_start;
|
||||||
|
struct regulator_bulk_data supplies[WM8960_NUM_SUPPLIES];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define wm8960_reset(c) regmap_write(c, WM8960_RESET, 0)
|
#define wm8960_reset(c) regmap_write(c, WM8960_RESET, 0)
|
||||||
|
|
@ -1417,6 +1427,7 @@ static int wm8960_i2c_probe(struct i2c_client *i2c)
|
||||||
{
|
{
|
||||||
struct wm8960_data *pdata = dev_get_platdata(&i2c->dev);
|
struct wm8960_data *pdata = dev_get_platdata(&i2c->dev);
|
||||||
struct wm8960_priv *wm8960;
|
struct wm8960_priv *wm8960;
|
||||||
|
unsigned int i;
|
||||||
int ret;
|
int ret;
|
||||||
u8 val;
|
u8 val;
|
||||||
|
|
||||||
|
|
@ -1439,6 +1450,23 @@ static int wm8960_i2c_probe(struct i2c_client *i2c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(wm8960->supplies); i++)
|
||||||
|
wm8960->supplies[i].supply = wm8960_supply_names[i];
|
||||||
|
|
||||||
|
ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8960->supplies),
|
||||||
|
wm8960->supplies);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = regulator_bulk_enable(ARRAY_SIZE(wm8960->supplies),
|
||||||
|
wm8960->supplies);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
wm8960->regmap = devm_regmap_init_i2c(i2c, &wm8960_regmap);
|
wm8960->regmap = devm_regmap_init_i2c(i2c, &wm8960_regmap);
|
||||||
if (IS_ERR(wm8960->regmap))
|
if (IS_ERR(wm8960->regmap))
|
||||||
return PTR_ERR(wm8960->regmap);
|
return PTR_ERR(wm8960->regmap);
|
||||||
|
|
@ -1505,7 +1533,11 @@ static int wm8960_i2c_probe(struct i2c_client *i2c)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wm8960_i2c_remove(struct i2c_client *client)
|
static void wm8960_i2c_remove(struct i2c_client *client)
|
||||||
{}
|
{
|
||||||
|
struct wm8960_priv *wm8960 = i2c_get_clientdata(client);
|
||||||
|
|
||||||
|
regulator_bulk_disable(ARRAY_SIZE(wm8960->supplies), wm8960->supplies);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct i2c_device_id wm8960_i2c_id[] = {
|
static const struct i2c_device_id wm8960_i2c_id[] = {
|
||||||
{ "wm8960", 0 },
|
{ "wm8960", 0 },
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue