diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2011-10-04 07:39:38 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-10-04 11:27:05 -0400 |
commit | 460acbec1e7ba727519689902f51a6257279bbae (patch) | |
tree | 40db58ef6c7f85d87e0387e9d077fa9276ea1b83 /include | |
parent | 672f4c4d754273b4187e44f725ea418a97fa2a62 (diff) |
ASoC: core: Introduce SOC_DOUBLE_VALUE macro
With the new macro we can remove duplicated code
for the SOC_DOUBLE type of controls.
We can also remap the SOC_SINGLE_VALUE macro to
SOC_DOUBLE_VALUE
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/sound/soc.h | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index a4dc699d4801..3d7c7f7cda6c 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -28,10 +28,12 @@ | |||
28 | /* | 28 | /* |
29 | * Convenience kcontrol builders | 29 | * Convenience kcontrol builders |
30 | */ | 30 | */ |
31 | #define SOC_SINGLE_VALUE(xreg, xshift, 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 = xshift, .rshift = xshift, .max = xmax, \ | 33 | {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ |
34 | .platform_max = xmax, .invert = xinvert}) | 34 | .max = xmax, .platform_max = xmax, .invert = xinvert}) |
35 | #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \ | ||
36 | SOC_DOUBLE_VALUE(xreg, xshift, xshift, xmax, xinvert) | ||
35 | #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ | 37 | #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ |
36 | ((unsigned long)&(struct soc_mixer_control) \ | 38 | ((unsigned long)&(struct soc_mixer_control) \ |
37 | {.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert}) | 39 | {.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert}) |
@@ -48,13 +50,12 @@ | |||
48 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ | 50 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ |
49 | .put = snd_soc_put_volsw, \ | 51 | .put = snd_soc_put_volsw, \ |
50 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } | 52 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } |
51 | #define SOC_DOUBLE(xname, xreg, shift_left, shift_right, xmax, xinvert) \ | 53 | #define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ |
52 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | 54 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ |
53 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ | 55 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ |
54 | .put = snd_soc_put_volsw, \ | 56 | .put = snd_soc_put_volsw, \ |
55 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | 57 | .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \ |
56 | {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ | 58 | max, invert) } |
57 | .max = xmax, .platform_max = xmax, .invert = xinvert} } | ||
58 | #define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \ | 59 | #define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \ |
59 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | 60 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ |
60 | .info = snd_soc_info_volsw_2r, \ | 61 | .info = snd_soc_info_volsw_2r, \ |
@@ -62,16 +63,15 @@ | |||
62 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | 63 | .private_value = (unsigned long)&(struct soc_mixer_control) \ |
63 | {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ | 64 | {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ |
64 | .max = xmax, .platform_max = xmax, .invert = xinvert} } | 65 | .max = xmax, .platform_max = xmax, .invert = xinvert} } |
65 | #define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \ | 66 | #define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \ |
66 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | 67 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ |
67 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | 68 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ |
68 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ | 69 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ |
69 | .tlv.p = (tlv_array), \ | 70 | .tlv.p = (tlv_array), \ |
70 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ | 71 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ |
71 | .put = snd_soc_put_volsw, \ | 72 | .put = snd_soc_put_volsw, \ |
72 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | 73 | .private_value = SOC_DOUBLE_VALUE(reg, shift_left, shift_right, \ |
73 | {.reg = xreg, .shift = shift_left, .rshift = shift_right,\ | 74 | max, invert) } |
74 | .max = xmax, .platform_max = xmax, .invert = xinvert} } | ||
75 | #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \ | 75 | #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \ |
76 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | 76 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ |
77 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | 77 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ |
@@ -121,14 +121,13 @@ | |||
121 | .info = snd_soc_info_volsw, \ | 121 | .info = snd_soc_info_volsw, \ |
122 | .get = xhandler_get, .put = xhandler_put, \ | 122 | .get = xhandler_get, .put = xhandler_put, \ |
123 | .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) } | 123 | .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) } |
124 | #define SOC_DOUBLE_EXT(xname, xreg, shift_left, shift_right, xmax, xinvert,\ | 124 | #define SOC_DOUBLE_EXT(xname, reg, shift_left, shift_right, max, invert,\ |
125 | xhandler_get, xhandler_put) \ | 125 | xhandler_get, xhandler_put) \ |
126 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | 126 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ |
127 | .info = snd_soc_info_volsw, \ | 127 | .info = snd_soc_info_volsw, \ |
128 | .get = xhandler_get, .put = xhandler_put, \ | 128 | .get = xhandler_get, .put = xhandler_put, \ |
129 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | 129 | .private_value = \ |
130 | {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ | 130 | SOC_DOUBLE_VALUE(reg, shift_left, shift_right, max, invert) } |
131 | .max = xmax, .platform_max = xmax, .invert = xinvert} } | ||
132 | #define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\ | 131 | #define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\ |
133 | xhandler_get, xhandler_put, tlv_array) \ | 132 | xhandler_get, xhandler_put, tlv_array) \ |
134 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 133 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
@@ -146,9 +145,8 @@ | |||
146 | .tlv.p = (tlv_array), \ | 145 | .tlv.p = (tlv_array), \ |
147 | .info = snd_soc_info_volsw, \ | 146 | .info = snd_soc_info_volsw, \ |
148 | .get = xhandler_get, .put = xhandler_put, \ | 147 | .get = xhandler_get, .put = xhandler_put, \ |
149 | .private_value = (unsigned long)&(struct soc_mixer_control) \ | 148 | .private_value = SOC_DOUBLE_VALUE(xreg, shift_left, shift_right, \ |
150 | {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ | 149 | xmax, xinvert) } |
151 | .max = xmax, .platform_max = xmax, .invert = xinvert} } | ||
152 | #define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\ | 150 | #define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\ |
153 | xhandler_get, xhandler_put, tlv_array) \ | 151 | xhandler_get, xhandler_put, tlv_array) \ |
154 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | 152 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ |