aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/soc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound/soc.h')
-rw-r--r--include/sound/soc.h67
1 files changed, 55 insertions, 12 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index f47ef1f75f18..e6ea6f750941 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -16,38 +16,63 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/workqueue.h> 18#include <linux/workqueue.h>
19#include <sound/driver.h>
20#include <sound/core.h> 19#include <sound/core.h>
21#include <sound/pcm.h> 20#include <sound/pcm.h>
22#include <sound/control.h> 21#include <sound/control.h>
23#include <sound/ac97_codec.h> 22#include <sound/ac97_codec.h>
24 23
25#define SND_SOC_VERSION "0.13.1" 24#define SND_SOC_VERSION "0.13.2"
26 25
27/* 26/*
28 * Convenience kcontrol builders 27 * Convenience kcontrol builders
29 */ 28 */
30#define SOC_SINGLE_VALUE(reg,shift,mask,invert) ((reg) | ((shift) << 8) |\ 29#define SOC_SINGLE_VALUE(reg, shift, max, invert) ((reg) | ((shift) << 8) |\
31 ((shift) << 12) | ((mask) << 16) | ((invert) << 24)) 30 ((shift) << 12) | ((max) << 16) | ((invert) << 24))
32#define SOC_SINGLE_VALUE_EXT(reg,mask,invert) ((reg) | ((mask) << 16) |\ 31#define SOC_SINGLE_VALUE_EXT(reg, max, invert) ((reg) | ((max) << 16) |\
33 ((invert) << 31)) 32 ((invert) << 31))
34#define SOC_SINGLE(xname, reg, shift, mask, invert) \ 33#define SOC_SINGLE(xname, reg, shift, max, invert) \
35{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 34{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
36 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\ 35 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
37 .put = snd_soc_put_volsw, \ 36 .put = snd_soc_put_volsw, \
38 .private_value = SOC_SINGLE_VALUE(reg, shift, mask, invert) } 37 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
39#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) \
40{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ 47{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
41 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \ 48 .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
42 .put = snd_soc_put_volsw, \ 49 .put = snd_soc_put_volsw, \
43 .private_value = (reg) | ((shift_left) << 8) | \ 50 .private_value = (reg) | ((shift_left) << 8) | \
44 ((shift_right) << 12) | ((mask) << 16) | ((invert) << 24) } 51 ((shift_right) << 12) | ((max) << 16) | ((invert) << 24) }
45#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) \
46{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 53{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
47 .info = snd_soc_info_volsw_2r, \ 54 .info = snd_soc_info_volsw_2r, \
48 .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, \
49 .private_value = (reg_left) | ((shift) << 8) | \ 56 .private_value = (reg_left) | ((shift) << 8) | \
50 ((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) }
51#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \ 76#define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, xtexts) \
52{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ 77{ .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
53 .mask = xmask, .texts = xtexts } 78 .mask = xmask, .texts = xtexts }
@@ -105,9 +130,21 @@
105#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 */
106 131
107/* 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/*
108 * DAI hardware signal inversions 145 * DAI hardware signal inversions
109 */ 146 */
110#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bit clock + frame */ 147#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bclk + frm */
111#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 */
112#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 */
113#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */ 150#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */
@@ -410,6 +447,9 @@ struct snd_soc_dai_link {
410 447
411 /* codec/machine specific init - e.g. add machine controls */ 448 /* codec/machine specific init - e.g. add machine controls */
412 int (*init)(struct snd_soc_codec *codec); 449 int (*init)(struct snd_soc_codec *codec);
450
451 /* DAI pcm */
452 struct snd_pcm *pcm;
413}; 453};
414 454
415/* SoC machine */ 455/* SoC machine */
@@ -426,6 +466,9 @@ struct snd_soc_machine {
426 int (*resume_pre)(struct platform_device *pdev); 466 int (*resume_pre)(struct platform_device *pdev);
427 int (*resume_post)(struct platform_device *pdev); 467 int (*resume_post)(struct platform_device *pdev);
428 468
469 /* callbacks */
470 int (*dapm_event)(struct snd_soc_machine *, int event);
471
429 /* CPU <--> Codec DAI links */ 472 /* CPU <--> Codec DAI links */
430 struct snd_soc_dai_link *dai_link; 473 struct snd_soc_dai_link *dai_link;
431 int num_links; 474 int num_links;