summaryrefslogtreecommitdiffstats
path: root/include/sound/soc-dapm.h
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-02-28 08:31:03 +0100
committerMark Brown <broonie@linaro.org>2014-03-01 04:03:33 +0100
commit29ae2fa5533e607a7d97b7564dc015252f1e73f4 (patch)
treed0d301930177438179ffb297f15c6555e1ed694d /include/sound/soc-dapm.h
parentASoC: Remove unused 'reg2' field from soc_enum struct (diff)
downloadlinux-29ae2fa5533e607a7d97b7564dc015252f1e73f4.tar.xz
linux-29ae2fa5533e607a7d97b7564dc015252f1e73f4.zip
ASoC: Consolidate enum and value enum controls
The implementations for enum and value enum controls are almost identical. The only difference is that the value enum uses an additional look-up table to map the control value to the register value, while the enum control uses a direct mapping. Enums and value enums can easily be distinguished at runtime, for value enums the values field of the snd_soc_enum struct contains the look-up table, while for enums it is NULL. This patch adds two new small helper functions called snd_soc_enum_item_to_val() and snd_soc_enum_val_to_item() which map between register value and control item. If the items field of the snd_soc_enum struct is NULL the function will do a direct mapping otherwise they'll use the look-up table to do the mapping. Using these small helper functions it is possible to use the same kcontrol handlers for both enums and value enums. The functions are added a inline functions in soc.h so they can also be used by the DAPM code to accomplish similar consolidation. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'include/sound/soc-dapm.h')
0 files changed, 0 insertions, 0 deletions