LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: bjorn.andersson@linaro.org, broonie@kernel.org, robh@kernel.org
Cc: plai@codeaurora.org, tiwai@suse.de, devicetree@vger.kernel.org,
perex@perex.cz, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org, lgirdwood@gmail.com,
bgoswami@codeaurora.org,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [PATCH v2 15/16] ASoC: qcom: audioreach: topology add dapm pga support
Date: Wed, 14 Jul 2021 16:30:38 +0100 [thread overview]
Message-ID: <20210714153039.28373-16-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20210714153039.28373-1-srinivas.kandagatla@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
sound/soc/qcom/audioreach/topology.c | 62 +++++++++++++++++++++++++++-
1 file changed, 61 insertions(+), 1 deletion(-)
diff --git a/sound/soc/qcom/audioreach/topology.c b/sound/soc/qcom/audioreach/topology.c
index 8080243a47ef..14ecb115e63e 100644
--- a/sound/soc/qcom/audioreach/topology.c
+++ b/sound/soc/qcom/audioreach/topology.c
@@ -706,6 +706,25 @@ static int audioreach_widget_load_mixer(struct snd_soc_component *component,
return 0;
}
+static int audioreach_widget_load_pga(struct snd_soc_component *component,
+ int index, struct snd_soc_dapm_widget *w,
+ struct snd_soc_tplg_dapm_widget *tplg_w)
+{
+ struct audioreach_module *mod;
+ struct snd_soc_dobj *dobj;
+ int ret;
+
+ ret = audioreach_widget_load_module_common(component, index, w, tplg_w);
+ if (ret)
+ return ret;
+
+ dobj = &w->dobj;
+ mod = dobj->private;
+ mod->gain = VOL_CTRL_DEFAULT_GAIN;
+
+ return 0;
+}
+
static int audioreach_widget_ready(struct snd_soc_component *component,
int index, struct snd_soc_dapm_widget *w,
struct snd_soc_tplg_dapm_widget *tplg_w)
@@ -725,8 +744,9 @@ static int audioreach_widget_ready(struct snd_soc_component *component,
break;
case snd_soc_dapm_mixer:
return audioreach_widget_load_mixer(component, index, w, tplg_w);
- case snd_soc_dapm_dai_link:
case snd_soc_dapm_pga:
+ return audioreach_widget_load_pga(component, index, w, tplg_w);
+ case snd_soc_dapm_dai_link:
case snd_soc_dapm_scheduler:
case snd_soc_dapm_out_drv:
default:
@@ -898,6 +918,40 @@ static int audioreach_put_audio_mixer(struct snd_kcontrol *kcontrol,
return 0;
}
+static int audioreach_get_vol_ctrl_audio_mixer(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_dapm_widget *dw = snd_soc_dapm_kcontrol_widget(kcontrol);
+ struct audioreach_module *mod = dw->dobj.private;
+
+ /* Check if the graph is active or not */
+ ucontrol->value.integer.value[0] = mod->gain;
+
+ return 0;
+}
+
+static int audioreach_put_vol_ctrl_audio_mixer(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_dapm_widget *dw = snd_soc_dapm_kcontrol_widget(kcontrol);
+ struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
+ struct snd_soc_component *c = snd_soc_dapm_to_component(dapm);
+ struct audioreach_module *mod = dw->dobj.private;
+ struct q6apm *apm = dev_get_drvdata(c->dev);
+ int vol = ucontrol->value.integer.value[0];
+
+ /* Check if the graph is active or not */
+ if (dw->power) {
+ audioreach_gain_set_vol_ctrl(apm, mod, vol);
+ mod->gain = vol;
+ return 1;
+ }
+
+ dev_err(apm->dev, "Unable to set volume as graph is not active\n");
+ return 0;
+
+}
+
static int audioreach_control_load_mix(struct snd_soc_component *scomp,
struct snd_ar_control *scontrol,
struct snd_kcontrol_new *kc,
@@ -948,6 +1002,10 @@ static int audioreach_control_load(struct snd_soc_component *scomp, int index,
dobj = &sm->dobj;
ret = audioreach_control_load_mix(scomp, scontrol, kc, hdr);
break;
+ case SND_SOC_AR_TPLG_VOL_CTL:
+ sm = (struct soc_mixer_control *)kc->private_value;
+ dobj = &sm->dobj;
+ break;
default:
dev_warn(scomp->dev, "control type not supported %d:%d:%d\n",
hdr->ops.get, hdr->ops.put, hdr->ops.info);
@@ -972,6 +1030,8 @@ static int audioreach_control_unload(struct snd_soc_component *scomp,
static const struct snd_soc_tplg_kcontrol_ops audioreach_io_ops[] = {
{SND_SOC_AR_TPLG_FE_BE_GRAPH_CTL_MIX, audioreach_get_audio_mixer,
audioreach_put_audio_mixer, snd_soc_info_volsw},
+ {SND_SOC_AR_TPLG_VOL_CTL, audioreach_get_vol_ctrl_audio_mixer,
+ audioreach_put_vol_ctrl_audio_mixer, snd_soc_info_volsw},
};
static struct snd_soc_tplg_ops audioreach_tplg_ops = {
--
2.21.0
next prev parent reply other threads:[~2021-07-14 15:31 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-14 15:30 [PATCH v2 00/16] ASoC: qcom: Add AudioReach support Srinivas Kandagatla
2021-07-14 15:30 ` [PATCH v2 01/16] soc: dt-bindings: qcom: add gpr bindings Srinivas Kandagatla
2021-07-14 16:05 ` Pierre-Louis Bossart
2021-07-14 15:30 ` [PATCH v2 02/16] soc: qcom: apr: make code more reuseable Srinivas Kandagatla
2021-07-14 20:36 ` kernel test robot
2021-07-14 15:30 ` [PATCH v2 03/16] soc: qcom: apr: Add GPR support Srinivas Kandagatla
2021-07-14 16:20 ` Pierre-Louis Bossart
2021-07-15 10:31 ` Srinivas Kandagatla
2021-07-14 15:30 ` [PATCH v2 04/16] ASoC: qcom: dt-bindings: add bindings Audio Processing manager Srinivas Kandagatla
2021-07-28 17:36 ` Rob Herring
2021-07-29 9:18 ` Srinivas Kandagatla
2021-07-29 11:13 ` Mark Brown
2021-07-30 11:06 ` Srinivas Kandagatla
2021-07-14 15:30 ` [PATCH v2 05/16] ASoC: qcom: audioreach: add basic pkt alloc support Srinivas Kandagatla
2021-07-14 16:30 ` Pierre-Louis Bossart
2021-07-15 10:31 ` Srinivas Kandagatla
2021-07-14 15:30 ` [PATCH v2 06/16] ASoC: qcom: audioreach: add q6apm support Srinivas Kandagatla
2021-07-14 16:40 ` Pierre-Louis Bossart
2021-07-15 10:31 ` Srinivas Kandagatla
2021-07-14 15:30 ` [PATCH v2 07/16] ASoC: qcom: audioreach: add module configuration command helpers Srinivas Kandagatla
2021-07-14 16:48 ` Pierre-Louis Bossart
2021-07-15 10:32 ` Srinivas Kandagatla
2021-07-14 15:30 ` [PATCH v2 08/16] ASoC: qcom: audioreach: add topology support Srinivas Kandagatla
2021-07-14 15:30 ` [PATCH v2 09/16] ASoC: qcom: audioreach: add q6apm-dai support Srinivas Kandagatla
2021-07-14 16:59 ` Pierre-Louis Bossart
2021-07-15 10:32 ` Srinivas Kandagatla
2021-07-14 15:30 ` [PATCH v2 10/16] ASoC: qcom: audioreach: add bedai support Srinivas Kandagatla
2021-07-14 17:03 ` Pierre-Louis Bossart
2021-07-15 10:32 ` Srinivas Kandagatla
2021-07-14 15:30 ` [PATCH v2 11/16] ASoC: qcom: dt-bindings: add bindings for Proxy Resource Manager Srinivas Kandagatla
2021-07-14 15:30 ` [PATCH v2 12/16] ASoC: qcom: audioreach: add q6prm support Srinivas Kandagatla
2021-07-14 17:09 ` Pierre-Louis Bossart
2021-07-15 10:32 ` Srinivas Kandagatla
2021-07-15 7:40 ` kernel test robot
2021-07-14 15:30 ` [PATCH v2 13/16] ASoC: qcom: dt-bindings: add audioreach soundcard compatibles Srinivas Kandagatla
2021-07-14 15:30 ` [PATCH v2 14/16] ASoC: qcom: audioreach: add volume ctrl module support Srinivas Kandagatla
2021-07-14 15:30 ` Srinivas Kandagatla [this message]
2021-07-14 15:30 ` [PATCH v2 16/16] ASoC: qcom: sm8250: Add audioreach support Srinivas Kandagatla
2021-07-14 17:12 ` Pierre-Louis Bossart
2021-07-15 10:32 ` Srinivas Kandagatla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210714153039.28373-16-srinivas.kandagatla@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=bgoswami@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=plai@codeaurora.org \
--cc=robh@kernel.org \
--cc=tiwai@suse.de \
--subject='Re: [PATCH v2 15/16] ASoC: qcom: audioreach: topology add dapm pga support' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).