From: Daniel Kurtz <djkurtz@chromium.org> To: unlisted-recipients:; (no To-header on input) Cc: Dylan Reid <dgreid@chromium.org>, Jimmy Cheng-Yi Chiang <cychiang@google.com>, 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] ASoC: da7219: Allow pdata to specify a VDDIO Date: Fri, 20 Jul 2018 18:12:35 -0600 [thread overview] Message-ID: <20180721001235.164891-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> --- This patch tries to solve the same problem as in the following patches, but does so in a way that doesn't require registering fixed regulators in the audio machine-driver: https://patchwork.kernel.org/patch/10531097 & 10531099 https://patchwork.kernel.org/patch/10536023/ 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..d8f202c57f958d 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_string(dev, "dlg,vddio", &of_val32)) + 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
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Kurtz <djkurtz@chromium.org> Cc: Dylan Reid <dgreid@chromium.org>, Jimmy Cheng-Yi Chiang <cychiang@google.com>, 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>, "moderated list:SOUND" <alsa-devel@alsa-project.org>, open list <linux-kernel@vger.kernel.org> Subject: [PATCH] ASoC: da7219: Allow pdata to specify a VDDIO Date: Fri, 20 Jul 2018 18:12:35 -0600 [thread overview] Message-ID: <20180721001235.164891-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> --- This patch tries to solve the same problem as in the following patches, but does so in a way that doesn't require registering fixed regulators in the audio machine-driver: https://patchwork.kernel.org/patch/10531097 & 10531099 https://patchwork.kernel.org/patch/10536023/ 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..d8f202c57f958d 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_string(dev, "dlg,vddio", &of_val32)) + 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-21 0:12 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-07-21 0:12 Daniel Kurtz [this message] 2018-07-21 0:12 ` [PATCH] ASoC: da7219: Allow pdata to specify a VDDIO Daniel Kurtz 2018-07-21 1:20 ` kbuild test robot 2018-07-21 1:20 ` kbuild test robot 2018-07-21 3:18 ` kbuild test robot 2018-07-21 3:18 ` kbuild test robot 2018-07-21 3:37 ` kbuild test robot 2018-07-21 3:37 ` kbuild test robot
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=20180721001235.164891-1-djkurtz@chromium.org \ --to=djkurtz@chromium.org \ --cc=akshu.agrawal@amd.com \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@kernel.org \ --cc=cychiang@google.com \ --cc=dgreid@chromium.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.