aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorOmair Mohammed Abdullah <omair.m.abdullah@intel.com>2014-07-15 12:04:48 -0400
committerMark Brown <broonie@linaro.org>2014-07-16 17:43:59 -0400
commit7523a271682fc1f35355da344249ce8f8c8b8cb9 (patch)
tree5e1c50131b61909dddd438ad40a63cfb3789d646 /sound/soc/soc-core.c
parent0cea76f3393782d67ccea8f07e9abf341bc4f60e (diff)
ASoC: core: add a helper for extended byte controls using TLV
ALSA supports arbitrary length TLVs for each kcontrol that can be used to pass metadata about the control (e.g. volumes, enum information). The same transport mechanism is now used for arbitrary length data by defining a new helper. Signed-off-by: Omair Mohammed Abdullah <omair.m.abdullah@intel.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b87d7d882e6d..a9ce63f634b2 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3267,6 +3267,27 @@ int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol,
3267} 3267}
3268EXPORT_SYMBOL_GPL(snd_soc_bytes_info_ext); 3268EXPORT_SYMBOL_GPL(snd_soc_bytes_info_ext);
3269 3269
3270int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag,
3271 unsigned int size, unsigned int __user *tlv)
3272{
3273 struct soc_bytes_ext *params = (void *)kcontrol->private_value;
3274 unsigned int count = size < params->max ? size : params->max;
3275 int ret = -ENXIO;
3276
3277 switch (op_flag) {
3278 case SNDRV_CTL_TLV_OP_READ:
3279 if (params->get)
3280 ret = params->get(tlv, count);
3281 break;
3282 case SNDRV_CTL_TLV_OP_WRITE:
3283 if (params->put)
3284 ret = params->put(tlv, count);
3285 break;
3286 }
3287 return ret;
3288}
3289EXPORT_SYMBOL_GPL(snd_soc_bytes_tlv_callback);
3290
3270/** 3291/**
3271 * snd_soc_info_xr_sx - signed multi register info callback 3292 * snd_soc_info_xr_sx - signed multi register info callback
3272 * @kcontrol: mreg control 3293 * @kcontrol: mreg control