From: Dharageswari R Date: Tue, 8 Sep 2020 09:28:24 +0000 (+0300) Subject: ASoC: topology: Add support for WO and RO TLV byte kcontrols X-Git-Tag: v5.10-rc1~122^2~1^2^2~118 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=819b9f6002391925b53817ed96638bd40bd1d34f;p=thirdparty%2Flinux.git ASoC: topology: Add support for WO and RO TLV byte kcontrols This patch adds support for write-only and read-only TLV byte kcontrols by checking for appropriate get/put IO handlers. Signed-off-by: Dharageswari R Reviewed-by: Guennadi Liakhovetski Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Signed-off-by: Kai Vehmanen Link: https://lore.kernel.org/r/20200908092825.1813847-1-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index cee9986713187..28faaf58326eb 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -603,10 +603,11 @@ static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr, sbe->get = ext_ops[i].get; } - if (sbe->put && sbe->get) - return 0; - else + if ((k->access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) && !sbe->get) return -EINVAL; + if ((k->access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE) && !sbe->put) + return -EINVAL; + return 0; } /* try and map vendor specific kcontrol handlers first */