aboutsummaryrefslogtreecommitdiff
path: root/include/sound
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-02-28 08:31:05 +0100
committerMark Brown <broonie@linaro.org>2014-03-01 12:03:34 +0900
commitb948837a32cc2a510c2baf90111c8c5dde801a66 (patch)
tree7415413fdeef3225ca1937b405c3a84ddabffbd3 /include/sound
parent3727b4968453dbab8fe18f979d67285eb6b66801 (diff)
ASoC: Add macros for defining virtual enums
With the upcoming consolidation of normal MUXs and virtual MUXs we need to be able to distinguish between enums with and without a backing register at the enum level. Use the same approach as used for virtual mixer controls by setting the reg field of the enum to SND_SOC_NOPM for enums without a backing register. This patch adds a set of helper macros that can be used to define such enums. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 60c700ccc51..08cb677b464 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -189,6 +189,8 @@
.mask = xmask, .items = xitems, .texts = xtexts, .values = xvalues}
#define SOC_VALUE_ENUM_SINGLE(xreg, xshift, xmask, xnitmes, xtexts, xvalues) \
SOC_VALUE_ENUM_DOUBLE(xreg, xshift, xshift, xmask, xnitmes, xtexts, xvalues)
+#define SOC_ENUM_SINGLE_VIRT(xitems, xtexts) \
+ SOC_ENUM_SINGLE(SND_SOC_NOPM, 0, xitems, xtexts)
#define SOC_ENUM(xname, xenum) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
.info = snd_soc_info_enum_double, \
@@ -293,6 +295,8 @@
ARRAY_SIZE(xtexts), xtexts, xvalues)
#define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \
SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues)
+#define SOC_ENUM_SINGLE_VIRT_DECL(name, xtexts) \
+ const struct soc_enum name = SOC_ENUM_SINGLE_VIRT(ARRAY_SIZE(xtexts), xtexts)
/*
* Component probe and remove ordering levels for components with runtime
@@ -1092,7 +1096,7 @@ struct soc_mreg_control {
/* enumerated kcontrol */
struct soc_enum {
- unsigned short reg;
+ int reg;
unsigned char shift_l;
unsigned char shift_r;
unsigned int items;