diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2011-10-05 03:29:22 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-10-05 12:10:09 -0400 |
commit | 30d86ba47f79d566fffe9ba577caf247d06a3796 (patch) | |
tree | 07dbc0f940832ca806f81f8adbb91b0e80273dab /include/sound/soc.h | |
parent | 08a1ed76f5cf94bef07cb370b079760553a87b4b (diff) |
ASoC: core: Change SOC_SINGLE/DOUBLE_VALUE representation
SOC_SINGLE/DOUBLE_VALUE is used for mixer controls, where the
bits are within one register.
Assign .rreg to be the same as .reg for these types.
With this change we can tell if the mixer in question:
is mono:
mc->reg == mc->rreg && mc->shift == mc->rshift
is stereo, within single register:
mc->reg == mc->rreg && mc->shift != mc->rshift
is stereo, in two registers:
mc->reg != mc->rreg
The patch provide a small inline function to query, if the mixer
is stereo, or mono.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include/sound/soc.h')
-rw-r--r-- | include/sound/soc.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index 8ab1cfed1067..88ff2d899a4d 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -30,8 +30,9 @@ | |||
30 | */ | 30 | */ |
31 | #define SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, xmax, xinvert) \ | 31 | #define SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, xmax, xinvert) \ |
32 | ((unsigned long)&(struct soc_mixer_control) \ | 32 | ((unsigned long)&(struct soc_mixer_control) \ |
33 | {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ | 33 | {.reg = xreg, .rreg = xreg, .shift = shift_left, \ |
34 | .max = xmax, .platform_max = xmax, .invert = xinvert}) | 34 | .rshift = shift_right, .max = xmax, .platform_max = xmax, \ |
35 | .invert = xinvert}) | ||
35 | #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \ | 36 | #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \ |
36 | SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert) | 37 | SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert) |
37 | #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ | 38 | #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ |
@@ -947,6 +948,18 @@ static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) | |||
947 | INIT_LIST_HEAD(&card->dapm_list); | 948 | INIT_LIST_HEAD(&card->dapm_list); |
948 | } | 949 | } |
949 | 950 | ||
951 | static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc) | ||
952 | { | ||
953 | if (mc->reg == mc->rreg && mc->shift == mc->rshift) | ||
954 | return 0; | ||
955 | /* | ||
956 | * mc->reg == mc->rreg && mc->shift != mc->rshift, or | ||
957 | * mc->reg != mc->rreg means that the control is | ||
958 | * stereo (bits in one register or in two registers) | ||
959 | */ | ||
960 | return 1; | ||
961 | } | ||
962 | |||
950 | int snd_soc_util_init(void); | 963 | int snd_soc_util_init(void); |
951 | void snd_soc_util_exit(void); | 964 | void snd_soc_util_exit(void); |
952 | 965 | ||