aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-10 13:31:26 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-02-21 14:34:48 -0500
commit71d08516b80638a69d5efea4e8cb832c053f9dd9 (patch)
tree5f3c1497024c4669a1443fd30263ed81b591aa15 /include/sound
parent2b4bdee2920fb3894f9116f76343f8b31f9e4da8 (diff)
ASoC: core: Add SND_SOC_BYTES control for coefficient blocks
Allow devices to export blocks of registers to the application layer, intended for use for reading and writing coefficient data which can't usefully be worked with by the kernel at runtime (for example, due to requiring complex and expensive calculations or being the results of callibration procedures). Currently drivers are using platform data to provide configurations for coefficient blocks which isn't at all convenient for runtime management or configuration development. Currently only devices using regmap are supported, an error will be generated for any attempt to work with a byte control on a non-regmap device. There's no fundamental block to other devices so support could be added if required. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 1e16d6e3f2a8..3e9cae001eab 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -185,6 +185,12 @@
185 .rreg = xreg_right, .shift = xshift, \ 185 .rreg = xreg_right, .shift = xshift, \
186 .min = xmin, .max = xmax} } 186 .min = xmin, .max = xmax} }
187 187
188#define SND_SOC_BYTES(xname, xbase, xregs) \
189{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
190 .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
191 .put = snd_soc_bytes_put, .private_value = \
192 ((unsigned long)&(struct soc_bytes) \
193 {.base = xbase, .num_regs = xregs }) }
188 194
189/* 195/*
190 * Simplified versions of above macros, declaring a struct and calculating 196 * Simplified versions of above macros, declaring a struct and calculating
@@ -413,6 +419,13 @@ int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol,
413 struct snd_ctl_elem_value *ucontrol); 419 struct snd_ctl_elem_value *ucontrol);
414int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol, 420int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol,
415 struct snd_ctl_elem_value *ucontrol); 421 struct snd_ctl_elem_value *ucontrol);
422int snd_soc_bytes_info(struct snd_kcontrol *kcontrol,
423 struct snd_ctl_elem_info *uinfo);
424int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
425 struct snd_ctl_elem_value *ucontrol);
426int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
427 struct snd_ctl_elem_value *ucontrol);
428
416 429
417/** 430/**
418 * struct snd_soc_reg_access - Describes whether a given register is 431 * struct snd_soc_reg_access - Describes whether a given register is
@@ -888,6 +901,11 @@ struct soc_mixer_control {
888 unsigned int reg, rreg, shift, rshift, invert; 901 unsigned int reg, rreg, shift, rshift, invert;
889}; 902};
890 903
904struct soc_bytes {
905 int base;
906 int num_regs;
907};
908
891/* enumerated kcontrol */ 909/* enumerated kcontrol */
892struct soc_enum { 910struct soc_enum {
893 unsigned short reg; 911 unsigned short reg;