From: Fabio Estevam <festevam@gmail.com>
To: broonie@kernel.org
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
shenghao-ding@ti.com, kevin-lu@ti.com, baojun.xu@ti.com,
sen@ti.com, linux-sound@vger.kernel.org,
devicetree@vger.kernel.org, Fabio Estevam <festevam@nabladev.com>
Subject: [PATCH 2/2] ASoC: pcm512x: Support external mute GPIO
Date: Wed, 18 Nov 2026 18:18:00 -0300 [thread overview]
Message-ID: <20261118211800.63292-2-festevam@gmail.com> (raw)
In-Reply-To: <20261118211800.63292-1-festevam@gmail.com>
From: Fabio Estevam <festevam@nabladev.com>
Drive the optional XSMT mute GPIO alongside the PCM512x digital mute.
Assert it before muting the DAC and release it after the digital unmute
has completed.
Signed-off-by: Fabio Estevam <festevam@nabladev.com>
---
sound/soc/codecs/pcm512x.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
index b760561d0ef7..f6f07de133c4 100644
--- a/sound/soc/codecs/pcm512x.c
+++ b/sound/soc/codecs/pcm512x.c
@@ -7,6 +7,7 @@
*/
#include <linux/cleanup.h>
+#include <linux/gpio/consumer.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/clk.h>
@@ -31,6 +32,7 @@ static const char * const pcm512x_supply_names[PCM512x_NUM_SUPPLIES] = {
struct pcm512x_priv {
struct regmap *regmap;
+ struct gpio_desc *mute_gpio;
struct clk *sclk;
struct regulator_bulk_data supplies[PCM512x_NUM_SUPPLIES];
struct notifier_block supply_nb[PCM512x_NUM_SUPPLIES];
@@ -1463,6 +1465,7 @@ static int pcm512x_mute(struct snd_soc_dai *dai, int mute, int direction)
guard(mutex)(&pcm512x->mutex);
if (mute) {
+ gpiod_set_value_cansleep(pcm512x->mute_gpio, 1);
pcm512x->mute |= 0x1;
ret = regmap_update_bits(pcm512x->regmap, PCM512x_MUTE,
PCM512x_RQML | PCM512x_RQMR,
@@ -1486,6 +1489,8 @@ static int pcm512x_mute(struct snd_soc_dai *dai, int mute, int direction)
return ret;
}
+ gpiod_set_value_cansleep(pcm512x->mute_gpio, 0);
+
regmap_read_poll_timeout(pcm512x->regmap,
PCM512x_ANALOG_MUTE_DET,
mute_det,
@@ -1581,6 +1586,10 @@ int pcm512x_probe(struct device *dev, struct regmap *regmap)
dev_set_drvdata(dev, pcm512x);
pcm512x->regmap = regmap;
+ pcm512x->mute_gpio = devm_gpiod_get_optional(dev, "mute", GPIOD_OUT_HIGH);
+ if (IS_ERR(pcm512x->mute_gpio))
+ return dev_err_probe(dev, PTR_ERR(pcm512x->mute_gpio),
+ "Failed to get mute GPIO\n");
for (i = 0; i < ARRAY_SIZE(pcm512x->supplies); i++)
pcm512x->supplies[i].supply = pcm512x_supply_names[i];
--
2.43.0
prev parent reply other threads:[~2026-11-18 21:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 21:17 [PATCH 1/2] ASoC: dt-bindings: pcm512x: Add mute-gpios property Fabio Estevam
2026-11-18 21:18 ` Fabio Estevam [this message]
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=20261118211800.63292-2-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=baojun.xu@ti.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=festevam@nabladev.com \
--cc=kevin-lu@ti.com \
--cc=krzk+dt@kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sen@ti.com \
--cc=shenghao-ding@ti.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