diff options
author | Jon Smirl <jonsmirl@gmail.com> | 2008-07-29 06:42:26 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-07-29 15:32:16 -0400 |
commit | 4eaa9819dc08d7bfd1065ce530e31b18a119dcaf (patch) | |
tree | 022aa2195b94f0d886851c3cbcad818a13967644 /include/sound | |
parent | 58cd33c0f375578cfda25a52ed280caa888b6254 (diff) |
ALSA: ASoC: Convert bitfields in ASoC into full int width
Convert bitfields in ASoC into full int width. This is a
simple mechanical conversion. Two places in the DAPM code
were fixed to properly use mask.
Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'include/sound')
-rw-r--r-- | include/sound/soc.h | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index 2ce530efcf11..e647a34c8091 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -26,10 +26,12 @@ | |||
26 | /* | 26 | /* |
27 | * Convenience kcontrol builders | 27 | * Convenience kcontrol builders |
28 | */ | 28 | */ |
29 | #define SOC_SINGLE_VALUE(reg, shift, max, invert) ((reg) | ((shift) << 8) |\ | 29 | #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \ |
30 | ((shift) << 12) | ((max) << 16) | ((invert) << 24)) | 30 | ((unsigned long)&(struct soc_mixer_control) \ |
31 | #define SOC_SINGLE_VALUE_EXT(reg, max, invert) ((reg) | ((max) << 16) |\ | 31 | {.reg = xreg, .shift = xshift, .max = xmax, .invert = xinvert}) |
32 | ((invert) << 31)) | 32 | #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ |
33 | ((unsigned long)&(struct soc_mixer_control) \ | ||
34 | {.reg = xreg, .max = xmax, .invert = xinvert}) | ||
33 | #define SOC_SINGLE(xname, reg, shift, max, invert) \ | 35 | #define SOC_SINGLE(xname, reg, shift, max, invert) \ |
34 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | 36 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
35 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ | 37 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ |
@@ -43,45 +45,49 @@ | |||
43 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ | 45 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ |
44 | .put = snd_soc_put_volsw, \ | 46 | .put = snd_soc_put_volsw, \ |
45 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } | 47 | .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } |
46 | #define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \ | 48 | #define SOC_DOUBLE(xname, xreg, shift_left, shift_right, xmax, xinvert) \ |
47 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | 49 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ |
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 = (reg) | ((shift_left) << 8) | \ | 52 | .private_value = (unsigned long)&(struct soc_mixer_control) \ |
51 | ((shift_right) << 12) | ((max) << 16) | ((invert) << 24) } | 53 | {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ |
52 | #define SOC_DOUBLE_R(xname, reg_left, reg_right, shift, max, invert) \ | 54 | .max = xmax, .invert = xinvert} } |
55 | #define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \ | ||
53 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | 56 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ |
54 | .info = snd_soc_info_volsw_2r, \ | 57 | .info = snd_soc_info_volsw_2r, \ |
55 | .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ | 58 | .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ |
56 | .private_value = (reg_left) | ((shift) << 8) | \ | 59 | .private_value = (unsigned long)&(struct soc_mixer_control) \ |
57 | ((max) << 12) | ((invert) << 20) | ((reg_right) << 24) } | 60 | {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ |
58 | #define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \ | 61 | .max = xmax, .invert = xinvert} } |
62 | #define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \ | ||
59 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | 63 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ |
60 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | 64 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ |
61 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ | 65 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ |
62 | .tlv.p = (tlv_array), \ | 66 | .tlv.p = (tlv_array), \ |
63 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ | 67 | .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ |
64 | .put = snd_soc_put_volsw, \ | 68 | .put = snd_soc_put_volsw, \ |
65 | .private_value = (reg) | ((shift_left) << 8) | \ | 69 | .private_value = (unsigned long)&(struct soc_mixer_control) \ |
66 | ((shift_right) << 12) | ((max) << 16) | ((invert) << 24) } | 70 | {.reg = xreg, .shift = shift_left, .rshift = shift_right,\ |
67 | #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, shift, max, invert, tlv_array) \ | 71 | .max = xmax, .invert = xinvert} } |
72 | #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \ | ||
68 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ | 73 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ |
69 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | 74 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ |
70 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ | 75 | SNDRV_CTL_ELEM_ACCESS_READWRITE,\ |
71 | .tlv.p = (tlv_array), \ | 76 | .tlv.p = (tlv_array), \ |
72 | .info = snd_soc_info_volsw_2r, \ | 77 | .info = snd_soc_info_volsw_2r, \ |
73 | .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ | 78 | .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ |
74 | .private_value = (reg_left) | ((shift) << 8) | \ | 79 | .private_value = (unsigned long)&(struct soc_mixer_control) \ |
75 | ((max) << 12) | ((invert) << 20) | ((reg_right) << 24) } | 80 | {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ |
76 | #define SOC_DOUBLE_S8_TLV(xname, reg, min, max, tlv_array) \ | 81 | .max = xmax, .invert = xinvert} } |
82 | #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ | ||
77 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ | 83 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ |
78 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | 84 | .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
79 | SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | 85 | SNDRV_CTL_ELEM_ACCESS_READWRITE, \ |
80 | .tlv.p = (tlv_array), \ | 86 | .tlv.p = (tlv_array), \ |
81 | .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \ | 87 | .info = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \ |
82 | .put = snd_soc_put_volsw_s8, \ | 88 | .put = snd_soc_put_volsw_s8, \ |
83 | .private_value = (reg) | (((signed char)max) << 16) | \ | 89 | .private_value = (unsigned long)&(struct soc_mixer_control) \ |
84 | (((signed char)min) << 24) } | 90 | {.reg = xreg, .min = xmin, .max = xmax} } |
85 | #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \ | 91 | #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \ |
86 | { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ | 92 | { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ |
87 | .mask = xmask, .texts = xtexts } | 93 | .mask = xmask, .texts = xtexts } |
@@ -518,6 +524,12 @@ struct snd_soc_pcm_runtime { | |||
518 | struct snd_soc_device *socdev; | 524 | struct snd_soc_device *socdev; |
519 | }; | 525 | }; |
520 | 526 | ||
527 | /* mixer control */ | ||
528 | struct soc_mixer_control { | ||
529 | int min, max; | ||
530 | uint reg, rreg, shift, rshift, invert; | ||
531 | }; | ||
532 | |||
521 | /* enumerated kcontrol */ | 533 | /* enumerated kcontrol */ |
522 | struct soc_enum { | 534 | struct soc_enum { |
523 | unsigned short reg; | 535 | unsigned short reg; |