summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2016-09-27 00:37:43 +0100
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2024-01-08 10:29:52 +0000
commitbecc52742111afeaba86ff20cdbeda90e350018a (patch)
treeb2afe8c66d4bef16e5daef4dacfe12a12f37b571
parent3f47cf1750732ef06903bc324fefa356f8866161 (diff)
asoc: uda134x: add support for UDA134x QMUTE via gpiolib
Add support for the UDA134x QMUTE signal via the gpiolib layer. We assert QMUTE when powering up the device, keeping it muted until we are starting up the playback stream. The reverse happens when the playback stream is shut down. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--sound/soc/codecs/uda134x.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c
index 1a62bec94005..d07b98bda2d3 100644
--- a/sound/soc/codecs/uda134x.c
+++ b/sound/soc/codecs/uda134x.c
@@ -12,6 +12,7 @@
#include <linux/module.h>
#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
#include <linux/slab.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
@@ -37,6 +38,8 @@ struct uda134x_priv {
struct regmap *regmap;
struct uda134x_platform_data *pd;
+
+ struct gpio_desc *qmute;
};
static const struct reg_default uda134x_reg_defaults[] = {
@@ -125,6 +128,9 @@ static int uda134x_mute(struct snd_soc_dai *dai, int mute, int direction)
pr_debug("%s mute: %d\n", __func__, mute);
+ if (uda134x->qmute)
+ gpiod_set_value_cansleep(uda134x->qmute, mute);
+
if (mute)
val = mask;
else
@@ -304,6 +310,8 @@ static int uda134x_set_bias_level(struct snd_soc_component *component,
case SND_SOC_BIAS_PREPARE:
/* power on */
if (pd->power) {
+ if (uda134x->qmute)
+ gpiod_set_value_cansleep(uda134x->qmute, 1);
pd->power(1);
regcache_sync(uda134x->regmap);
}
@@ -315,6 +323,8 @@ static int uda134x_set_bias_level(struct snd_soc_component *component,
if (pd->power) {
pd->power(0);
regcache_mark_dirty(uda134x->regmap);
+ if (uda134x->qmute)
+ gpiod_set_value_cansleep(uda134x->qmute, 0);
}
break;
}
@@ -524,7 +534,7 @@ static const struct snd_soc_component_driver soc_component_dev_uda134x = {
.dapm_routes = uda134x_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(uda134x_dapm_routes),
.suspend_bias_off = 1,
- .idle_bias_on = 1,
+ .idle_bias_on = 0,
.use_pmdown_time = 1,
.endianness = 1,
};
@@ -569,6 +579,11 @@ static int uda134x_codec_probe(struct platform_device *pdev)
if (IS_ERR(uda134x->regmap))
return PTR_ERR(uda134x->regmap);
+ uda134x->qmute = devm_gpiod_get_optional(&pdev->dev, "qmute",
+ GPIOD_OUT_LOW);
+ if (IS_ERR(uda134x->qmute))
+ return PTR_ERR(uda134x->qmute);
+
return devm_snd_soc_register_component(&pdev->dev,
&soc_component_dev_uda134x, &uda134x_dai, 1);
}