From f831b055ececb3172f7fe498db5ca1fb43ff644d Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 17 Feb 2012 16:20:33 -0800 Subject: ASoC: core: Add support for masking out parts of coefficient blocks Chip designers frequently include things like the enable and disable controls for algorithms in the register blocks which also hold the coefficients. Since it's desirable to split out the enable/disable control from userspace the plain SND_SOC_BYTES() isn't optimal for these devices. Add a SND_SOC_BYTES_MASK() which allows a bitmask from the first word of the block to be excluded from the control. This supports the needs of devices I've looked at and lets us have a reasonably simple API. Further controls can be added in future if that's needed. Signed-off-by: Mark Brown Acked-by: Liam Girdwood --- include/sound/soc.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/sound') diff --git a/include/sound/soc.h b/include/sound/soc.h index 3e9cae0..82bd773 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -192,6 +192,14 @@ ((unsigned long)&(struct soc_bytes) \ {.base = xbase, .num_regs = xregs }) } +#define SND_SOC_BYTES_MASK(xname, xbase, xregs, xmask) \ +{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ + .info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \ + .put = snd_soc_bytes_put, .private_value = \ + ((unsigned long)&(struct soc_bytes) \ + {.base = xbase, .num_regs = xregs, \ + .mask = xmask }) } + /* * Simplified versions of above macros, declaring a struct and calculating * ARRAY_SIZE internally @@ -904,6 +912,7 @@ struct soc_mixer_control { struct soc_bytes { int base; int num_regs; + u32 mask; }; /* enumerated kcontrol */ -- cgit v1.1