[PATCH v3 5/7] ASoC: codec: pcm1681: Enable the PCM1681 supplies

From: Mohammad Rafi Shaik

Date: Fri Oct 09 2026 - 09:14:37 EST


From: Shawn Guo <shengchao.guo@xxxxxxxxxxxxxxxx>

The driver assumes that the analog and digital supplies of the DAC are
already up by the time it probes. That only holds when the rails are
hardwired or left on by the bootloader. Boards which gate them, like
the Qualcomm Nord RRD and Ride, have no way to get them enabled, and
the first register access then fails.

Enable the VCC1, VCC2 and VDD supplies before touching the clock or the
regmap, so that the DAC is powered whenever the driver is bound. The
supplies are optional as far as the regulator core is concerned, so
boards which do not describe them keep working through the dummy
regulator.

Signed-off-by: Shawn Guo <shengchao.guo@xxxxxxxxxxxxxxxx>
Signed-off-by: Mohammad Rafi Shaik <mohammad.rafi.shaik@xxxxxxxxxxxxxxxx>
---
sound/soc/codecs/pcm1681.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/sound/soc/codecs/pcm1681.c b/sound/soc/codecs/pcm1681.c
index 3675b2236..6002da3a5 100644
--- a/sound/soc/codecs/pcm1681.c
+++ b/sound/soc/codecs/pcm1681.c
@@ -14,6 +14,7 @@
#include <linux/of.h>
#include <linux/clk.h>
#include <linux/pm_runtime.h>
+#include <linux/regulator/consumer.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
@@ -337,6 +338,10 @@ static const struct i2c_device_id pcm1681_i2c_id[] = {
};
MODULE_DEVICE_TABLE(i2c, pcm1681_i2c_id);

+static const char * const pcm1681_supply_names[] = {
+ "VCC1", "VCC2", "VDD",
+};
+
static int pcm1681_i2c_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
@@ -347,6 +352,13 @@ static int pcm1681_i2c_probe(struct i2c_client *client)
if (!priv)
return -ENOMEM;

+ ret = devm_regulator_bulk_get_enable(dev,
+ ARRAY_SIZE(pcm1681_supply_names),
+ pcm1681_supply_names);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to enable supplies\n");
+
priv->sck = devm_clk_get_optional(dev, "sck");
if (IS_ERR(priv->sck))
return dev_err_probe(dev, PTR_ERR(priv->sck),

--
2.34.1