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>2022-05-23 15:58:27 +0100
commit0f55f6919766936cb5bfdd898d9d5d798452eabd (patch)
tree6552b3daf793a8ccf78c0fa572df15a8708b287b
parent36775de0561f6bf701a746062da2c5516e15b4dd (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 037833c509f7..766f369d7bfd 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,
.non_legacy_dai_naming = 1,
@@ -570,6 +580,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);
}