asoc: avoid adding global control in loopback probing twice

Add condition control to avoid mixer being added twice,
to avoid kernel error printing.

Change-Id: I832e4c08ac06fe885c1497bce4bd4ada96ef83fb
Signed-off-by: Guodong Hu <guodhu@codeaurora.org>
This commit is contained in:
Guodong Hu 2020-10-16 11:01:51 +08:00
commit 88dba174c9

View file

@ -198,11 +198,15 @@ static struct snd_kcontrol_new msm_loopback_controls[] = {
static int msm_pcm_loopback_probe(struct snd_soc_component *component)
{
snd_soc_add_component_controls(component, msm_loopback_controls,
ARRAY_SIZE(msm_loopback_controls));
if (of_property_read_bool(component->dev->of_node,
"qcom,msm-pcm-loopback")) {
snd_soc_add_component_controls(component, msm_loopback_controls,
ARRAY_SIZE(msm_loopback_controls));
}
return 0;
}
static int pcm_loopback_set_volume(struct msm_pcm_loopback *prtd,
uint32_t volume)
{