summaryrefslogtreecommitdiff
path: root/include/sound
diff options
context:
space:
mode:
authorKristoffer KARLSSON <kristoffer.karlsson@stericsson.com>2012-04-20 11:32:13 +0200
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-23 20:05:06 +0100
commit4183eed288f31c3b9142476915e842f879f36b8e (patch)
tree136c22b92898e96e370776adcbe3656aa029f669 /include/sound
parentc1a4ecd921229a410b9a71cb7877250e85c26c1c (diff)
ASoC: core: Add signed multi register control
Added control type that can span multiple consecutive codec registers forming a single signed value in a MSB/LSB manner. The control dynamically adjusts to the register word size configured in driver. Added convenience macro. SOC_SINGLE_XR_SX Added accessor implementations. snd_soc_info_xr_sx snd_soc_get_xr_sx snd_soc_put_xr_sx Signed-off-by: Kristoffer KARLSSON <kristoffer.karlsson@stericsson.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index afc3204d389b..c0656b771c38 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -210,6 +210,15 @@
{.base = xbase, .num_regs = xregs, \
.mask = xmask }) }
+#define SOC_SINGLE_XR_SX(xname, xregbase, xregcount, xnbits, \
+ xmin, xmax, xinvert) \
+{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
+ .info = snd_soc_info_xr_sx, .get = snd_soc_get_xr_sx, \
+ .put = snd_soc_put_xr_sx, \
+ .private_value = (unsigned long)&(struct soc_mreg_control) \
+ {.regbase = xregbase, .regcount = xregcount, .nbits = xnbits, \
+ .invert = xinvert, .min = xmin, .max = xmax} }
+
/*
* Simplified versions of above macros, declaring a struct and calculating
* ARRAY_SIZE internally
@@ -446,7 +455,12 @@ int snd_soc_bytes_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
-
+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,
+ struct snd_ctl_elem_value *ucontrol);
+int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol);
/**
* struct snd_soc_reg_access - Describes whether a given register is
@@ -932,6 +946,12 @@ struct soc_bytes {
u32 mask;
};
+/* multi register control */
+struct soc_mreg_control {
+ long min, max;
+ unsigned int regbase, regcount, nbits, invert;
+};
+
/* enumerated kcontrol */
struct soc_enum {
unsigned short reg;