From: Hongyang Zhao <hongyang.zhao@thundersoft.com>
To: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Daniel Drake <drake@endlessm.com>,
Katsuhiro Suzuki <katsuhiro@katsuster.net>,
Matteo Martelli <matteomartelli3@gmail.com>,
Binbin Zhou <zhoubinbin@loongson.cn>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>,
Roger Shimizu <rosh@debian.org>,
linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Hongyang Zhao <hongyang.zhao@thundersoft.com>
Subject: [PATCH v2 2/2] ASoC: codecs: es8316: Add regulator support
Date: Wed, 12 Aug 2026 17:35:44 +0800 [thread overview]
Message-ID: <20260812-es8316-regulator-next-20260722-v2-2-e7078bc9bc9c@thundersoft.com> (raw)
In-Reply-To: <20260812-es8316-regulator-next-20260722-v2-0-e7078bc9bc9c@thundersoft.com>
ES8316 has separate AVDD, CPVDD, DVDD and PVDD supply inputs.
Request and enable the supplies during I2C probe, before initializing
the regmap. Keep them enabled for the lifetime of the I2C device so the
regmap cannot access an unpowered device and its cache remains
synchronized if the ASoC component is unbound and rebound.
Signed-off-by: Hongyang Zhao <hongyang.zhao@thundersoft.com>
---
sound/soc/codecs/es8316.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/sound/soc/codecs/es8316.c b/sound/soc/codecs/es8316.c
index 87f331868dc7..24ec8b211cdb 100644
--- a/sound/soc/codecs/es8316.c
+++ b/sound/soc/codecs/es8316.c
@@ -15,6 +15,7 @@
#include <linux/i2c.h>
#include <linux/mutex.h>
#include <linux/regmap.h>
+#include <linux/regulator/consumer.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
@@ -31,6 +32,13 @@ static const unsigned int supported_mclk_lrck_ratios[] = {
256, 384, 400, 500, 512, 768, 1024
};
+static const char * const es8316_supply_names[] = {
+ "avdd",
+ "cpvdd",
+ "dvdd",
+ "pvdd",
+};
+
struct es8316_priv {
struct mutex lock;
struct clk *mclk;
@@ -866,6 +874,11 @@ static int es8316_i2c_probe(struct i2c_client *i2c_client)
i2c_set_clientdata(i2c_client, es8316);
+ ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(es8316_supply_names),
+ es8316_supply_names);
+ if (ret)
+ return dev_err_probe(dev, ret, "unable to enable supplies\n");
+
es8316->regmap = devm_regmap_init_i2c(i2c_client, &es8316_regmap);
if (IS_ERR(es8316->regmap))
return PTR_ERR(es8316->regmap);
--
2.43.0
next prev parent reply other threads:[~2026-08-12 9:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 9:35 [PATCH v2 0/2] ASoC: es8316: Add regulator support Hongyang Zhao
2026-08-12 9:35 ` [PATCH v2 1/2] ASoC: dt-bindings: es8316: Add regulator supplies Hongyang Zhao
2026-08-12 19:28 ` Rob Herring (Arm)
2026-08-12 19:42 ` Rob Herring
2026-08-13 16:56 ` Hongyang Zhao
2026-08-12 9:35 ` Hongyang Zhao [this message]
2026-08-12 9:57 ` [PATCH v2 2/2] ASoC: codecs: es8316: Add regulator support sashiko-bot
2026-08-12 10:49 ` [PATCH v2 0/2] ASoC: " 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=20260812-es8316-regulator-next-20260722-v2-2-e7078bc9bc9c@thundersoft.com \
--to=hongyang.zhao@thundersoft.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=drake@endlessm.com \
--cc=katsuhiro@katsuster.net \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=matteomartelli3@gmail.com \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
--cc=rosh@debian.org \
--cc=tiwai@suse.com \
--cc=zhoubinbin@loongson.cn \
/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