aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorPhilipp Zabel <philipp.zabel@gmail.com>2008-01-10 08:37:42 -0500
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:29:50 -0500
commita7a4ac86b4754f44eb06221f3087debb4775d588 (patch)
tree63240035ca77fca21c4bb3b0db7566f53501053a /include/sound
parent0b4d221b8d56deefca4984d01b3a010107ae1f72 (diff)
[ALSA] ASoC TLV support
Add TLV support to ASoC. Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Liam Girdwood <lg@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-dapm.h24
-rw-r--r--include/sound/soc.h58
2 files changed, 68 insertions, 14 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 4158cbaa0f25..491f81e89847 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -131,18 +131,34 @@
131 .shift = wshift, .invert = winvert} 131 .shift = wshift, .invert = winvert}
132 132
133/* dapm kcontrol types */ 133/* dapm kcontrol types */
134#define SOC_DAPM_SINGLE(xname, reg, shift, mask, invert) \ 134#define SOC_DAPM_SINGLE(xname, reg, shift, max, invert) \
135{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 135{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
136 .info = snd_soc_info_volsw, \ 136 .info = snd_soc_info_volsw, \
137 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 137 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
138 .private_value = SOC_SINGLE_VALUE(reg, shift, mask, invert) } 138 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
139#define SOC_DAPM_DOUBLE(xname, reg, shift_left, shift_right, mask, invert, \ 139#define SOC_DAPM_DOUBLE(xname, reg, shift_left, shift_right, max, invert, \
140 power) \ 140 power) \
141{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 141{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
142 .info = snd_soc_info_volsw, \ 142 .info = snd_soc_info_volsw, \
143 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 143 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
144 .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\ 144 .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\
145 ((mask) << 16) | ((invert) << 24) } 145 ((max) << 16) | ((invert) << 24) }
146#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
147{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
148 .info = snd_soc_info_volsw, \
149 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
150 .tlv.p = (tlv_array), \
151 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
152 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
153#define SOC_DAPM_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, \
154 power, tlv_array) \
155{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
156 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
157 .tlv.p = (tlv_array), \
158 .info = snd_soc_info_volsw, \
159 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
160 .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\
161 ((max) << 16) | ((invert) << 24) }
146#define SOC_DAPM_ENUM(xname, xenum) \ 162#define SOC_DAPM_ENUM(xname, xenum) \
147{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 163{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
148 .info = snd_soc_info_enum_double, \ 164 .info = snd_soc_info_enum_double, \
diff --git a/include/sound/soc.h b/include/sound/soc.h
index add5f948e383..0afcdfe42a46 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -26,27 +26,53 @@
26/* 26/*
27 * Convenience kcontrol builders 27 * Convenience kcontrol builders
28 */ 28 */
29#define SOC_SINGLE_VALUE(reg,shift,mask,invert) ((reg) | ((shift) << 8) |\ 29#define SOC_SINGLE_VALUE(reg, shift, max, invert) ((reg) | ((shift) << 8) |\
30 ((shift) << 12) | ((mask) << 16) | ((invert) << 24)) 30 ((shift) << 12) | ((max) << 16) | ((invert) << 24))
31#define SOC_SINGLE_VALUE_EXT(reg,mask,invert) ((reg) | ((mask) << 16) |\ 31#define SOC_SINGLE_VALUE_EXT(reg, max, invert) ((reg) | ((max) << 16) |\
32 ((invert) << 31)) 32 ((invert) << 31))
33#define SOC_SINGLE(xname, reg, shift, mask, invert) \ 33#define SOC_SINGLE(xname, reg, shift, max, invert) \
34{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 34{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
35 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 35 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
36 .put = snd_soc_put_volsw, \ 36 .put = snd_soc_put_volsw, \
37 .private_value = SOC_SINGLE_VALUE(reg, shift, mask, invert) } 37 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
38#define SOC_DOUBLE(xname, reg, shift_left, shift_right, mask, invert) \ 38#define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
39{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
40 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
41 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
42 .tlv.p = (tlv_array), \
43 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
44 .put = snd_soc_put_volsw, \
45 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
46#define SOC_DOUBLE(xname, reg, shift_left, shift_right, max, invert) \
39{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 47{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
40 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 48 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
41 .put = snd_soc_put_volsw, \ 49 .put = snd_soc_put_volsw, \
42 .private_value = (reg) | ((shift_left) << 8) | \ 50 .private_value = (reg) | ((shift_left) << 8) | \
43 ((shift_right) << 12) | ((mask) << 16) | ((invert) << 24) } 51 ((shift_right) << 12) | ((max) << 16) | ((invert) << 24) }
44#define SOC_DOUBLE_R(xname, reg_left, reg_right, shift, mask, invert) \ 52#define SOC_DOUBLE_R(xname, reg_left, reg_right, shift, max, invert) \
45{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 53{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
46 .info = snd_soc_info_volsw_2r, \ 54 .info = snd_soc_info_volsw_2r, \
47 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \ 55 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
48 .private_value = (reg_left) | ((shift) << 8) | \ 56 .private_value = (reg_left) | ((shift) << 8) | \
49 ((mask) << 12) | ((invert) << 20) | ((reg_right) << 24) } 57 ((max) << 12) | ((invert) << 20) | ((reg_right) << 24) }
58#define SOC_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, tlv_array) \
59{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
60 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
61 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
62 .tlv.p = (tlv_array), \
63 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
64 .put = snd_soc_put_volsw, \
65 .private_value = (reg) | ((shift_left) << 8) | \
66 ((shift_right) << 12) | ((max) << 16) | ((invert) << 24) }
67#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, shift, max, invert, tlv_array) \
68{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
69 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
70 SNDRV_CTL_ELEM_ACCESS_READWRITE,\
71 .tlv.p = (tlv_array), \
72 .info = snd_soc_info_volsw_2r, \
73 .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
74 .private_value = (reg_left) | ((shift) << 8) | \
75 ((max) << 12) | ((invert) << 20) | ((reg_right) << 24) }
50#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \ 76#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \
51{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 77{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
52 .mask = xmask, .texts = xtexts } 78 .mask = xmask, .texts = xtexts }
@@ -104,9 +130,21 @@
104#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated when not Tx/Rx */ 130#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated when not Tx/Rx */
105 131
106/* 132/*
133 * DAI Sync
134 * Synchronous LR (Left Right) clocks and Frame signals.
135 */
136#define SND_SOC_DAIFMT_SYNC (0 << 5) /* Tx FRM = Rx FRM */
137#define SND_SOC_DAIFMT_ASYNC (1 << 5) /* Tx FRM ~ Rx FRM */
138
139/*
140 * TDM
141 */
142#define SND_SOC_DAIFMT_TDM (1 << 6)
143
144/*
107 * DAI hardware signal inversions 145 * DAI hardware signal inversions
108 */ 146 */
109#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */ 147#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bclk + frm */
110#define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */ 148#define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */
111#define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */ 149#define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */
112#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */ 150#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */