Commit 65d257ee authored by Bogdan Togorean's avatar Bogdan Togorean Committed by Mark Brown

ASoC: adau1977: Add support for setting MICBIAS via DT

If platform_data is NULL add reading of optional adi,micbias
property from DT. If adi,micbias is not set keep the default
value for micbias.
Signed-off-by: default avatarBogdan Togorean <bogdan.togorean@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent fb7a9745
...@@ -885,13 +885,15 @@ static int adau1977_setup_micbias(struct adau1977 *adau1977) ...@@ -885,13 +885,15 @@ static int adau1977_setup_micbias(struct adau1977 *adau1977)
struct adau1977_platform_data *pdata = adau1977->dev->platform_data; struct adau1977_platform_data *pdata = adau1977->dev->platform_data;
unsigned int micbias; unsigned int micbias;
if (pdata) { if (pdata)
micbias = pdata->micbias; micbias = pdata->micbias;
if (micbias > ADAU1977_MICBIAS_9V0) else if (device_property_read_u32(adau1977->dev, "adi,micbias",
return -EINVAL; &micbias))
} else {
micbias = ADAU1977_MICBIAS_8V5; micbias = ADAU1977_MICBIAS_8V5;
if (micbias > ADAU1977_MICBIAS_9V0) {
dev_err(adau1977->dev, "Invalid value for 'adi,micbias'\n");
return -EINVAL;
} }
return regmap_update_bits(adau1977->regmap, ADAU1977_REG_MICBIAS, return regmap_update_bits(adau1977->regmap, ADAU1977_REG_MICBIAS,
......
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