Commit 30d86ba4 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Mark Brown

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: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 08a1ed76
...@@ -30,8 +30,9 @@ ...@@ -30,8 +30,9 @@
*/ */
#define SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, xmax, xinvert) \ #define SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, xmax, xinvert) \
((unsigned long)&(struct soc_mixer_control) \ ((unsigned long)&(struct soc_mixer_control) \
{.reg = xreg, .shift = shift_left, .rshift = shift_right, \ {.reg = xreg, .rreg = xreg, .shift = shift_left, \
.max = xmax, .platform_max = xmax, .invert = xinvert}) .rshift = shift_right, .max = xmax, .platform_max = xmax, \
.invert = xinvert})
#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \ #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \
SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert) SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert)
#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ #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,6 +948,18 @@ static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card)
INIT_LIST_HEAD(&card->dapm_list); INIT_LIST_HEAD(&card->dapm_list);
} }
static inline bool snd_soc_volsw_is_stereo(struct soc_mixer_control *mc)
{
if (mc->reg == mc->rreg && mc->shift == mc->rshift)
return 0;
/*
* mc->reg == mc->rreg && mc->shift != mc->rshift, or
* mc->reg != mc->rreg means that the control is
* stereo (bits in one register or in two registers)
*/
return 1;
}
int snd_soc_util_init(void); int snd_soc_util_init(void);
void snd_soc_util_exit(void); void snd_soc_util_exit(void);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment