Skip to contentSkip to conversation

ASoC: dt-bindings: pcm512x: Add mute-gpios property

PATCH In review Fabio Estevam 2 participants 4 messages Nov 18 – Nov 20

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ASoC: dt-bindings: pcm512x: Add mute-gpios property

From: Fabio Estevam <[email protected]>

Document the optional GPIO connected to the active-low XSMT soft-mute input.

---
 Documentation/devicetree/bindings/sound/ti,pcm512x.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/sound/ti,pcm512x.yaml +4 -0
index 21ea9ff5a2bb..58ea52e79860 100644
@@ -42,6 +42,10 @@ properties:
   '#sound-dai-cells':
     const: 0
 
+  mute-gpios:
+    description: GPIO connected to the active-low XSMT soft-mute input.
+    maxItems: 1
+
   pll-in:
     description: GPIO pin used to connect the pll using <1> through <6>. The
       device will be configured for clock input on the given pll-in pin.
Signature · 1 line
2.43.0
#1 lore raw

PATCH 2/2 ASoC: pcm512x: Support external mute GPIO

From: Fabio Estevam <[email protected]>

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.

---
 sound/soc/codecs/pcm512x.c | 9 +++++++++
 1 file changed, 9 insertions(+)
sound/soc/codecs/pcm512x.c +9 -0
index b760561d0ef7..f6f07de133c4 100644
@@ -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];
Signature · 1 line
2.43.0
maintainer
#2 lore raw

Re: [PATCH 2/2] ASoC: pcm512x: Support external mute GPIO

Quoted 3 lines

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.

Do we need to do both, one of the reasons you'd use a GPIO is to have a lower overhead mechanism?

Signature · 1 line
Mark Brown <[email protected]>
maintainer
#3 lore raw
In reply to Fabio Estevam
Quoted 1 line · Fabio Estevam

ASoC: dt-bindings: pcm512x: Add mute-gpios property

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.5

Thanks!

[1/2] ASoC: dt-bindings: pcm512x: Add mute-gpios property

      https://git.kernel.org/broonie/sound/c/a6ff2055fdbb
[2/2] ASoC: pcm512x: Support external mute GPIO
      https://git.kernel.org/broonie/sound/c/35aa7b7f8501

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark