From becc52742111afeaba86ff20cdbeda90e350018a Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 27 Sep 2016 00:37:43 +0100 Subject: 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 --- sound/soc/codecs/uda134x.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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 #include +#include #include #include #include @@ -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); } -- cgit