summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2016-09-27 00:37:43 +0100
committerRussell King <rmk+kernel@armlinux.org.uk>2020-10-12 21:55:20 +0100
commit01fbe7c5abe9af9054b8594f14fa55c3e6e78304 (patch)
tree2486c6a832ee9b617d77db0c3d5b750f68f9c0ed /sound
parent12e762c4de24f0a491315605745f07129abfd4c8 (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>
Diffstat (limited to 'sound')
-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 bf9182cedb82..1c8784503c4f 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);
}