From: Daniel Kurtz <djkurtz@chromium.org>
To: unlisted-recipients:; (no To-header on input)
Cc: Akshu Agrawal <akshu.agrawal@amd.com>,
Daniel Kurtz <djkurtz@chromium.org>,
Support Opensource <support.opensource@diasemi.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
alsa-devel@alsa-project.org (moderated list:SOUND),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v2] ASoC: da7219: Allow pdata to specify a VDDIO
Date: Sun, 22 Jul 2018 17:28:22 -0600 [thread overview]
Message-ID: <20180722232822.34641-1-djkurtz@chromium.org> (raw)
Some systems do not have software controllable regulators driving the
DA7219's supplies, nor can they use device tree to create "always-on fixed
regulators" to easily pretend like they do.
On these systems the call to devm_regulator_bulk_get() just creates
a set of dummy registers. Calling regulator_get_voltage() on a dummy
regulator just returns -EINVAL, in which case the DA7219 is always set up
to use the default VDDIO voltage range of 2.5-3.6V.
Provide a new device property to let such systems specify a different
VDDIO if needed (e.g., 1.8V).
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
---
Changes for v2:
- fix to use device_property_read_u32()
include/sound/da7219.h | 2 ++
sound/soc/codecs/da7219.c | 19 +++++++++++++------
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/include/sound/da7219.h b/include/sound/da7219.h
index 1bfcb16f2d10ab..16ab125ad4adbf 100644
--- a/include/sound/da7219.h
+++ b/include/sound/da7219.h
@@ -38,6 +38,8 @@ struct da7219_pdata {
const char *dai_clks_name;
+ u32 vddio;
+
/* Mic */
enum da7219_micbias_voltage micbias_lvl;
enum da7219_mic_amp_in_sel mic_amp_in_sel;
diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c
index 980a6a8bf56d38..9893920b26f41f 100644
--- a/sound/soc/codecs/da7219.c
+++ b/sound/soc/codecs/da7219.c
@@ -1634,6 +1634,9 @@ static struct da7219_pdata *da7219_fw_to_pdata(struct snd_soc_component *compone
else
pdata->mic_amp_in_sel = DA7219_MIC_AMP_IN_SEL_DIFF;
+ if (device_property_read_u32(dev, "dlg,vddio", &of_val32) >= 0)
+ pdata->vddio = of_val32;
+
return pdata;
}
@@ -1717,8 +1720,12 @@ static int da7219_handle_supplies(struct snd_soc_component *component)
/* Determine VDDIO voltage provided */
vddio = da7219->supplies[DA7219_SUPPLY_VDDIO].consumer;
ret = regulator_get_voltage(vddio);
+ /* If regulator_get_voltage() fails, try to use vddio from pdata. */
+ if (ret < 0 && da7219->pdata)
+ ret = da7219->pdata->vddio;
if (ret < 1200000)
- dev_warn(component->dev, "Invalid VDDIO voltage\n");
+ dev_warn(component->dev, "Invalid VDDIO voltage: %d mV\n",
+ ret);
else if (ret < 2800000)
io_voltage_lvl = DA7219_IO_VOLTAGE_LEVEL_1_2V_2_8V;
@@ -1872,6 +1879,11 @@ static int da7219_probe(struct snd_soc_component *component)
mutex_init(&da7219->ctrl_lock);
mutex_init(&da7219->pll_lock);
+ /* Handle DT/ACPI/Platform data */
+ da7219->pdata = dev_get_platdata(component->dev);
+ if (!da7219->pdata)
+ da7219->pdata = da7219_fw_to_pdata(component);
+
/* Regulator configuration */
ret = da7219_handle_supplies(component);
if (ret)
@@ -1897,11 +1909,6 @@ static int da7219_probe(struct snd_soc_component *component)
break;
}
- /* Handle DT/ACPI/Platform data */
- da7219->pdata = dev_get_platdata(component->dev);
- if (!da7219->pdata)
- da7219->pdata = da7219_fw_to_pdata(component);
-
da7219_handle_pdata(component);
/* Check if MCLK provided */
--
2.18.0.233.g985f88cf7e-goog
next reply other threads:[~2018-07-22 23:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-22 23:28 Daniel Kurtz [this message]
2018-07-23 14:41 ` Adam Thomson
2018-07-24 16:58 ` 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=20180722232822.34641-1-djkurtz@chromium.org \
--to=djkurtz@chromium.org \
--cc=akshu.agrawal@amd.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=support.opensource@diasemi.com \
--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
all inboxes | Powered by JetHome®