Commit 8a7ae8c5 authored by Mark Brown's avatar Mark Brown

Adjust usage of rt5682(s) power supply properties

Merge series from Nícolas F. R. A. Prado <nfraprado@collabora.com>:

This series sets straight the usage of power supply properties for the
rt5682 and rt5682s audio codecs.

These properties were already being used by sc7180-trogdor.dtsi (and
derived DTs like sc7180-trogdor-kingoftown.dtsi).

We start by documenting the power supplies that are already in use and
then add few others that were missing to the bindings.

Then we update the drivers to also support the new supplies.

Finally we update the trogdor DTs so they have the newly added but
required supplies and remove a superfluous one that was causing
warnings.
parents 6426f56b 318ff069
......@@ -90,11 +90,29 @@ properties:
"#sound-dai-cells":
const: 1
AVDD-supply:
description: Regulator supplying analog power through the AVDD pin.
MICVDD-supply:
description: Regulator supplying power for the microphone bias through the
MICVDD pin.
DBVDD-supply:
description: Regulator supplying I/O power through the DBVDD pin.
LDO1-IN-supply:
description: Regulator supplying power to the digital core and charge pump
through the LDO1_IN pin.
additionalProperties: false
required:
- compatible
- reg
- AVDD-supply
- MICVDD-supply
- DBVDD-supply
- LDO1-IN-supply
examples:
- |
......@@ -120,5 +138,10 @@ examples:
clocks = <&osc>;
clock-names = "mclk";
AVDD-supply = <&avdd_reg>;
MICVDD-supply = <&micvdd_reg>;
DBVDD-supply = <&dbvdd_reg>;
LDO1-IN-supply = <&ldo1_in_reg>;
};
};
......@@ -8,6 +8,21 @@ Required properties:
- reg : The I2C address of the device.
- AVDD-supply: phandle to the regulator supplying analog power through the
AVDD pin
- MICVDD-supply: phandle to the regulator supplying power for the microphone
bias through the MICVDD pin. Either MICVDD or VBAT should be present.
- VBAT-supply: phandle to the regulator supplying battery power through the
VBAT pin. Either MICVDD or VBAT should be present.
- DBVDD-supply: phandle to the regulator supplying I/O power through the DBVDD
pin.
- LDO1-IN-supply: phandle to the regulator supplying power to the digital core
and charge pump through the LDO1_IN pin.
Optional properties:
- interrupts : The CODEC's interrupt output.
......@@ -75,4 +90,9 @@ rt5682 {
clocks = <&osc>;
clock-names = "mclk";
AVDD-supply = <&avdd_reg>;
MICVDD-supply = <&micvdd_reg>;
DBVDD-supply = <&dbvdd_reg>;
LDO1-IN-supply = <&ldo1_in_reg>;
};
......@@ -35,6 +35,8 @@ const char *rt5682_supply_names[RT5682_NUM_SUPPLIES] = {
"AVDD",
"MICVDD",
"VBAT",
"DBVDD",
"LDO1-IN",
};
EXPORT_SYMBOL_GPL(rt5682_supply_names);
......
......@@ -1424,7 +1424,7 @@ enum {
RT5682_CLK_SEL_I2S2_ASRC,
};
#define RT5682_NUM_SUPPLIES 3
#define RT5682_NUM_SUPPLIES 5
struct rt5682_priv {
struct snd_soc_component *component;
......
......@@ -44,6 +44,8 @@ static const struct rt5682s_platform_data i2s_default_platform_data = {
static const char *rt5682s_supply_names[RT5682S_NUM_SUPPLIES] = {
[RT5682S_SUPPLY_AVDD] = "AVDD",
[RT5682S_SUPPLY_MICVDD] = "MICVDD",
[RT5682S_SUPPLY_DBVDD] = "DBVDD",
[RT5682S_SUPPLY_LDO1_IN] = "LDO1-IN",
};
static const struct reg_sequence patch_list[] = {
......@@ -3089,6 +3091,14 @@ static void rt5682s_i2c_disable_regulators(void *data)
if (ret)
dev_err(dev, "Failed to disable supply AVDD: %d\n", ret);
ret = regulator_disable(rt5682s->supplies[RT5682S_SUPPLY_DBVDD].consumer);
if (ret)
dev_err(dev, "Failed to disable supply DBVDD: %d\n", ret);
ret = regulator_disable(rt5682s->supplies[RT5682S_SUPPLY_LDO1_IN].consumer);
if (ret)
dev_err(dev, "Failed to disable supply LDO1-IN: %d\n", ret);
usleep_range(1000, 1500);
ret = regulator_disable(rt5682s->supplies[RT5682S_SUPPLY_MICVDD].consumer);
......@@ -3150,6 +3160,18 @@ static int rt5682s_i2c_probe(struct i2c_client *i2c)
return ret;
}
ret = regulator_enable(rt5682s->supplies[RT5682S_SUPPLY_DBVDD].consumer);
if (ret) {
dev_err(&i2c->dev, "Failed to enable supply DBVDD: %d\n", ret);
return ret;
}
ret = regulator_enable(rt5682s->supplies[RT5682S_SUPPLY_LDO1_IN].consumer);
if (ret) {
dev_err(&i2c->dev, "Failed to enable supply LDO1-IN: %d\n", ret);
return ret;
}
if (gpio_is_valid(rt5682s->pdata.ldo1_en)) {
if (devm_gpio_request_one(&i2c->dev, rt5682s->pdata.ldo1_en,
GPIOF_OUT_INIT_HIGH, "rt5682s"))
......
......@@ -1438,6 +1438,8 @@ struct pll_calc_map {
enum {
RT5682S_SUPPLY_AVDD,
RT5682S_SUPPLY_MICVDD,
RT5682S_SUPPLY_DBVDD,
RT5682S_SUPPLY_LDO1_IN,
RT5682S_NUM_SUPPLIES,
};
......
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