From: Bogdan Togorean <bogdan.togorean@gmail.com>
To: alsa-devel@alsa-project.org
Cc: lars@metafoo.de, lgirdwood@gmail.com, broonie@kernel.org,
robh+dt@kernel.org, tiwai@suse.com, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Bogdan Togorean <bogdan.togorean@gmail.com>
Subject: [PATCH 2/2] ASoC: adau1977: Add support for setting MICBIAS via DT
Date: Tue, 19 Feb 2019 16:11:39 +0200 [thread overview]
Message-ID: <20190219141139.24216-3-bogdan.togorean@gmail.com> (raw)
In-Reply-To: <20190219141139.24216-1-bogdan.togorean@gmail.com>
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: Bogdan Togorean <bogdan.togorean@gmail.com>
---
sound/soc/codecs/adau1977.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/sound/soc/codecs/adau1977.c b/sound/soc/codecs/adau1977.c
index 116af6a9ce3b..11c53bcb71dd 100644
--- a/sound/soc/codecs/adau1977.c
+++ b/sound/soc/codecs/adau1977.c
@@ -885,13 +885,15 @@ static int adau1977_setup_micbias(struct adau1977 *adau1977)
struct adau1977_platform_data *pdata = adau1977->dev->platform_data;
unsigned int micbias;
- if (pdata) {
+ if (pdata)
micbias = pdata->micbias;
- if (micbias > ADAU1977_MICBIAS_9V0)
- return -EINVAL;
-
- } else {
+ else if (device_property_read_u32(adau1977->dev, "adi,micbias",
+ &micbias))
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,
--
2.20.1
next prev parent reply other threads:[~2019-02-19 14:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-19 14:11 [PATCH 0/2] ASoC: adau1977: Add support for micbias in DT Bogdan Togorean
2019-02-19 14:11 ` [PATCH 1/2] ASoC: adau1977: Add MICBIAS example in DT bindings Bogdan Togorean
2019-02-19 15:50 ` Applied "ASoC: adau1977: Add MICBIAS example in DT bindings" to the asoc tree Mark Brown
2019-02-22 14:31 ` [PATCH 1/2] ASoC: adau1977: Add MICBIAS example in DT bindings Rob Herring
2019-02-19 14:11 ` Bogdan Togorean [this message]
2019-02-19 15:50 ` Applied "ASoC: adau1977: Add support for setting MICBIAS via DT" to the asoc tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190219141139.24216-3-bogdan.togorean@gmail.com \
--to=bogdan.togorean@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).