diff options
author | Omair Mohammed Abdullah <omair.m.abdullah@intel.com> | 2014-07-15 20:04:48 +0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-07-17 01:43:59 +0400 |
commit | 7523a271682fc1f35355da344249ce8f8c8b8cb9 (patch) | |
tree | 5e1c50131b61909dddd438ad40a63cfb3789d646 /include/sound | |
parent | 0cea76f3393782d67ccea8f07e9abf341bc4f60e (diff) | |
download | linux-7523a271682fc1f35355da344249ce8f8c8b8cb9.tar.xz |
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 'include/sound')
-rw-r--r-- | include/sound/soc.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index ed9e2d7e5fdc..688fa667dee5 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -270,7 +270,14 @@ .get = xhandler_get, .put = xhandler_put, \ .private_value = (unsigned long)&(struct soc_bytes_ext) \ {.max = xcount} } - +#define SND_SOC_BYTES_TLV(xname, xcount, xhandler_get, xhandler_put) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ + .access = SNDRV_CTL_ELEM_ACCESS_TLV_READWRITE | \ + SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ + .tlv.c = (snd_soc_bytes_tlv_callback), \ + .info = snd_soc_info_bytes_ext, \ + .private_value = (unsigned long)&(struct soc_bytes_ext) \ + {.max = xcount, .get = xhandler_get, .put = xhandler_put, } } #define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \ xmin, xmax, xinvert) \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ @@ -552,6 +559,8 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *ucontrol); +int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag, + unsigned int size, unsigned int __user *tlv); int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol, @@ -1119,6 +1128,9 @@ struct soc_bytes { struct soc_bytes_ext { int max; + /* used for TLV byte control */ + int (*get)(unsigned int __user *bytes, unsigned int size); + int (*put)(const unsigned int __user *bytes, unsigned int size); }; /* multi register control */ |