]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - include/sound/soc.h
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild...
[linux-2.6-omap-h63xx.git] / include / sound / soc.h
1 /*
2  * linux/sound/soc.h -- ALSA SoC Layer
3  *
4  * Author:              Liam Girdwood
5  * Created:             Aug 11th 2005
6  * Copyright:   Wolfson Microelectronics. PLC.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12
13 #ifndef __LINUX_SND_SOC_H
14 #define __LINUX_SND_SOC_H
15
16 #include <linux/platform_device.h>
17 #include <linux/types.h>
18 #include <linux/workqueue.h>
19 #include <sound/core.h>
20 #include <sound/pcm.h>
21 #include <sound/control.h>
22 #include <sound/ac97_codec.h>
23
24 #define SND_SOC_VERSION "0.13.2"
25
26 /*
27  * Convenience kcontrol builders
28  */
29 #define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \
30         ((unsigned long)&(struct soc_mixer_control) \
31         {.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \
32         .invert = xinvert})
33 #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \
34         ((unsigned long)&(struct soc_mixer_control) \
35         {.reg = xreg, .max = xmax, .invert = xinvert})
36 #define SOC_SINGLE(xname, reg, shift, max, invert) \
37 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
38         .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
39         .put = snd_soc_put_volsw, \
40         .private_value =  SOC_SINGLE_VALUE(reg, shift, max, invert) }
41 #define SOC_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
42 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
43         .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
44                  SNDRV_CTL_ELEM_ACCESS_READWRITE,\
45         .tlv.p = (tlv_array), \
46         .info = snd_soc_info_volsw, .get = snd_soc_get_volsw,\
47         .put = snd_soc_put_volsw, \
48         .private_value =  SOC_SINGLE_VALUE(reg, shift, max, invert) }
49 #define SOC_DOUBLE(xname, xreg, shift_left, shift_right, xmax, xinvert) \
50 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
51         .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
52         .put = snd_soc_put_volsw, \
53         .private_value = (unsigned long)&(struct soc_mixer_control) \
54                 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \
55                  .max = xmax, .invert = xinvert} }
56 #define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \
57 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
58         .info = snd_soc_info_volsw_2r, \
59         .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
60         .private_value = (unsigned long)&(struct soc_mixer_control) \
61                 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
62                 .max = xmax, .invert = xinvert} }
63 #define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \
64 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
65         .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
66                  SNDRV_CTL_ELEM_ACCESS_READWRITE,\
67         .tlv.p = (tlv_array), \
68         .info = snd_soc_info_volsw, .get = snd_soc_get_volsw, \
69         .put = snd_soc_put_volsw, \
70         .private_value = (unsigned long)&(struct soc_mixer_control) \
71                 {.reg = xreg, .shift = shift_left, .rshift = shift_right,\
72                  .max = xmax, .invert = xinvert} }
73 #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \
74 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\
75         .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
76                  SNDRV_CTL_ELEM_ACCESS_READWRITE,\
77         .tlv.p = (tlv_array), \
78         .info = snd_soc_info_volsw_2r, \
79         .get = snd_soc_get_volsw_2r, .put = snd_soc_put_volsw_2r, \
80         .private_value = (unsigned long)&(struct soc_mixer_control) \
81                 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
82                 .max = xmax, .invert = xinvert} }
83 #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \
84 {       .iface  = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
85         .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
86                   SNDRV_CTL_ELEM_ACCESS_READWRITE, \
87         .tlv.p  = (tlv_array), \
88         .info   = snd_soc_info_volsw_s8, .get = snd_soc_get_volsw_s8, \
89         .put    = snd_soc_put_volsw_s8, \
90         .private_value = (unsigned long)&(struct soc_mixer_control) \
91                 {.reg = xreg, .min = xmin, .max = xmax} }
92 #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \
93 {       .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \
94         .max = xmax, .texts = xtexts }
95 #define SOC_ENUM_SINGLE(xreg, xshift, xmax, xtexts) \
96         SOC_ENUM_DOUBLE(xreg, xshift, xshift, xmax, xtexts)
97 #define SOC_ENUM_SINGLE_EXT(xmax, xtexts) \
98 {       .max = xmax, .texts = xtexts }
99 #define SOC_ENUM(xname, xenum) \
100 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,\
101         .info = snd_soc_info_enum_double, \
102         .get = snd_soc_get_enum_double, .put = snd_soc_put_enum_double, \
103         .private_value = (unsigned long)&xenum }
104 #define SOC_SINGLE_EXT(xname, xreg, xshift, xmax, xinvert,\
105          xhandler_get, xhandler_put) \
106 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
107         .info = snd_soc_info_volsw, \
108         .get = xhandler_get, .put = xhandler_put, \
109         .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
110 #define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\
111          xhandler_get, xhandler_put, tlv_array) \
112 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
113         .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
114                  SNDRV_CTL_ELEM_ACCESS_READWRITE,\
115         .tlv.p = (tlv_array), \
116         .info = snd_soc_info_volsw, \
117         .get = xhandler_get, .put = xhandler_put, \
118         .private_value = SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) }
119 #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \
120 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
121         .info = snd_soc_info_bool_ext, \
122         .get = xhandler_get, .put = xhandler_put, \
123         .private_value = xdata }
124 #define SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
125 {       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
126         .info = snd_soc_info_enum_ext, \
127         .get = xhandler_get, .put = xhandler_put, \
128         .private_value = (unsigned long)&xenum }
129
130 /*
131  * Bias levels
132  *
133  * @ON:      Bias is fully on for audio playback and capture operations.
134  * @PREPARE: Prepare for audio operations. Called before DAPM switching for
135  *           stream start and stop operations.
136  * @STANDBY: Low power standby state when no playback/capture operations are
137  *           in progress. NOTE: The transition time between STANDBY and ON
138  *           should be as fast as possible and no longer than 10ms.
139  * @OFF:     Power Off. No restrictions on transition times.
140  */
141 enum snd_soc_bias_level {
142         SND_SOC_BIAS_ON,
143         SND_SOC_BIAS_PREPARE,
144         SND_SOC_BIAS_STANDBY,
145         SND_SOC_BIAS_OFF,
146 };
147
148 /*
149  * Digital Audio Interface (DAI) types
150  */
151 #define SND_SOC_DAI_AC97        0x1
152 #define SND_SOC_DAI_I2S         0x2
153 #define SND_SOC_DAI_PCM         0x4
154 #define SND_SOC_DAI_AC97_BUS    0x8     /* for custom i.e. non ac97_codec.c */
155
156 /*
157  * DAI hardware audio formats
158  */
159 #define SND_SOC_DAIFMT_I2S              0       /* I2S mode */
160 #define SND_SOC_DAIFMT_RIGHT_J  1       /* Right justified mode */
161 #define SND_SOC_DAIFMT_LEFT_J   2       /* Left Justified mode */
162 #define SND_SOC_DAIFMT_DSP_A    3       /* L data msb after FRM or LRC */
163 #define SND_SOC_DAIFMT_DSP_B    4       /* L data msb during FRM or LRC */
164 #define SND_SOC_DAIFMT_AC97             5       /* AC97 */
165
166 #define SND_SOC_DAIFMT_MSB      SND_SOC_DAIFMT_LEFT_J
167 #define SND_SOC_DAIFMT_LSB      SND_SOC_DAIFMT_RIGHT_J
168
169 /*
170  * DAI Gating
171  */
172 #define SND_SOC_DAIFMT_CONT                     (0 << 4)        /* continuous clock */
173 #define SND_SOC_DAIFMT_GATED            (1 << 4)        /* clock is gated when not Tx/Rx */
174
175 /*
176  * DAI Sync
177  * Synchronous LR (Left Right) clocks and Frame signals.
178  */
179 #define SND_SOC_DAIFMT_SYNC             (0 << 5)        /* Tx FRM = Rx FRM */
180 #define SND_SOC_DAIFMT_ASYNC            (1 << 5)        /* Tx FRM ~ Rx FRM */
181
182 /*
183  * TDM
184  */
185 #define SND_SOC_DAIFMT_TDM              (1 << 6)
186
187 /*
188  * DAI hardware signal inversions
189  */
190 #define SND_SOC_DAIFMT_NB_NF            (0 << 8)        /* normal bclk + frm */
191 #define SND_SOC_DAIFMT_NB_IF            (1 << 8)        /* normal bclk + inv frm */
192 #define SND_SOC_DAIFMT_IB_NF            (2 << 8)        /* invert bclk + nor frm */
193 #define SND_SOC_DAIFMT_IB_IF            (3 << 8)        /* invert bclk + frm */
194
195 /*
196  * DAI hardware clock masters
197  * This is wrt the codec, the inverse is true for the interface
198  * i.e. if the codec is clk and frm master then the interface is
199  * clk and frame slave.
200  */
201 #define SND_SOC_DAIFMT_CBM_CFM  (0 << 12) /* codec clk & frm master */
202 #define SND_SOC_DAIFMT_CBS_CFM  (1 << 12) /* codec clk slave & frm master */
203 #define SND_SOC_DAIFMT_CBM_CFS  (2 << 12) /* codec clk master & frame slave */
204 #define SND_SOC_DAIFMT_CBS_CFS  (3 << 12) /* codec clk & frm slave */
205
206 #define SND_SOC_DAIFMT_FORMAT_MASK              0x000f
207 #define SND_SOC_DAIFMT_CLOCK_MASK               0x00f0
208 #define SND_SOC_DAIFMT_INV_MASK                 0x0f00
209 #define SND_SOC_DAIFMT_MASTER_MASK              0xf000
210
211
212 /*
213  * Master Clock Directions
214  */
215 #define SND_SOC_CLOCK_IN        0
216 #define SND_SOC_CLOCK_OUT       1
217
218 /*
219  * AC97 codec ID's bitmask
220  */
221 #define SND_SOC_DAI_AC97_ID0    (1 << 0)
222 #define SND_SOC_DAI_AC97_ID1    (1 << 1)
223 #define SND_SOC_DAI_AC97_ID2    (1 << 2)
224 #define SND_SOC_DAI_AC97_ID3    (1 << 3)
225
226 struct snd_soc_device;
227 struct snd_soc_pcm_stream;
228 struct snd_soc_ops;
229 struct snd_soc_dai_mode;
230 struct snd_soc_pcm_runtime;
231 struct snd_soc_dai;
232 struct snd_soc_codec;
233 struct snd_soc_machine_config;
234 struct soc_enum;
235 struct snd_soc_ac97_ops;
236 struct snd_soc_clock_info;
237
238 typedef int (*hw_write_t)(void *,const char* ,int);
239 typedef int (*hw_read_t)(void *,char* ,int);
240
241 extern struct snd_ac97_bus_ops soc_ac97_ops;
242
243 /* pcm <-> DAI connect */
244 void snd_soc_free_pcms(struct snd_soc_device *socdev);
245 int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid);
246 int snd_soc_register_card(struct snd_soc_device *socdev);
247
248 /* set runtime hw params */
249 int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
250         const struct snd_pcm_hardware *hw);
251
252 /* codec IO */
253 #define snd_soc_read(codec, reg) codec->read(codec, reg)
254 #define snd_soc_write(codec, reg, value) codec->write(codec, reg, value)
255
256 /* codec register bit access */
257 int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
258                                 unsigned short mask, unsigned short value);
259 int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg,
260                                 unsigned short mask, unsigned short value);
261
262 int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
263         struct snd_ac97_bus_ops *ops, int num);
264 void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
265
266 /* Digital Audio Interface clocking API.*/
267 int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
268         unsigned int freq, int dir);
269
270 int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
271         int div_id, int div);
272
273 int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
274         int pll_id, unsigned int freq_in, unsigned int freq_out);
275
276 /* Digital Audio interface formatting */
277 int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
278
279 int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
280         unsigned int mask, int slots);
281
282 int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
283
284 /* Digital Audio Interface mute */
285 int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute);
286
287 /*
288  *Controls
289  */
290 struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
291         void *data, char *long_name);
292 int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
293         struct snd_ctl_elem_info *uinfo);
294 int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
295         struct snd_ctl_elem_info *uinfo);
296 int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol,
297         struct snd_ctl_elem_value *ucontrol);
298 int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol,
299         struct snd_ctl_elem_value *ucontrol);
300 int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
301         struct snd_ctl_elem_info *uinfo);
302 int snd_soc_info_volsw_ext(struct snd_kcontrol *kcontrol,
303         struct snd_ctl_elem_info *uinfo);
304 #define snd_soc_info_bool_ext           snd_ctl_boolean_mono_info
305 int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
306         struct snd_ctl_elem_value *ucontrol);
307 int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
308         struct snd_ctl_elem_value *ucontrol);
309 int snd_soc_info_volsw_2r(struct snd_kcontrol *kcontrol,
310         struct snd_ctl_elem_info *uinfo);
311 int snd_soc_get_volsw_2r(struct snd_kcontrol *kcontrol,
312         struct snd_ctl_elem_value *ucontrol);
313 int snd_soc_put_volsw_2r(struct snd_kcontrol *kcontrol,
314         struct snd_ctl_elem_value *ucontrol);
315 int snd_soc_info_volsw_s8(struct snd_kcontrol *kcontrol,
316         struct snd_ctl_elem_info *uinfo);
317 int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
318         struct snd_ctl_elem_value *ucontrol);
319 int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
320         struct snd_ctl_elem_value *ucontrol);
321
322 /* SoC PCM stream information */
323 struct snd_soc_pcm_stream {
324         char *stream_name;
325         u64 formats;                    /* SNDRV_PCM_FMTBIT_* */
326         unsigned int rates;             /* SNDRV_PCM_RATE_* */
327         unsigned int rate_min;          /* min rate */
328         unsigned int rate_max;          /* max rate */
329         unsigned int channels_min;      /* min channels */
330         unsigned int channels_max;      /* max channels */
331         unsigned int active:1;          /* stream is in use */
332 };
333
334 /* SoC audio ops */
335 struct snd_soc_ops {
336         int (*startup)(struct snd_pcm_substream *);
337         void (*shutdown)(struct snd_pcm_substream *);
338         int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *);
339         int (*hw_free)(struct snd_pcm_substream *);
340         int (*prepare)(struct snd_pcm_substream *);
341         int (*trigger)(struct snd_pcm_substream *, int);
342 };
343
344 /* ASoC DAI ops */
345 struct snd_soc_dai_ops {
346         /* DAI clocking configuration */
347         int (*set_sysclk)(struct snd_soc_dai *dai,
348                 int clk_id, unsigned int freq, int dir);
349         int (*set_pll)(struct snd_soc_dai *dai,
350                 int pll_id, unsigned int freq_in, unsigned int freq_out);
351         int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div);
352
353         /* DAI format configuration */
354         int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt);
355         int (*set_tdm_slot)(struct snd_soc_dai *dai,
356                 unsigned int mask, int slots);
357         int (*set_tristate)(struct snd_soc_dai *dai, int tristate);
358
359         /* digital mute */
360         int (*digital_mute)(struct snd_soc_dai *dai, int mute);
361 };
362
363 /* SoC  DAI (Digital Audio Interface) */
364 struct snd_soc_dai {
365         /* DAI description */
366         char *name;
367         unsigned int id;
368         unsigned char type;
369
370         /* DAI callbacks */
371         int (*probe)(struct platform_device *pdev,
372                      struct snd_soc_dai *dai);
373         void (*remove)(struct platform_device *pdev,
374                        struct snd_soc_dai *dai);
375         int (*suspend)(struct platform_device *pdev,
376                 struct snd_soc_dai *dai);
377         int (*resume)(struct platform_device *pdev,
378                 struct snd_soc_dai *dai);
379
380         /* ops */
381         struct snd_soc_ops ops;
382         struct snd_soc_dai_ops dai_ops;
383
384         /* DAI capabilities */
385         struct snd_soc_pcm_stream capture;
386         struct snd_soc_pcm_stream playback;
387
388         /* DAI runtime info */
389         struct snd_pcm_runtime *runtime;
390         struct snd_soc_codec *codec;
391         unsigned int active;
392         unsigned char pop_wait:1;
393         void *dma_data;
394
395         /* DAI private data */
396         void *private_data;
397 };
398
399 /* SoC Audio Codec */
400 struct snd_soc_codec {
401         char *name;
402         struct module *owner;
403         struct mutex mutex;
404
405         /* callbacks */
406         int (*set_bias_level)(struct snd_soc_codec *,
407                               enum snd_soc_bias_level level);
408
409         /* runtime */
410         struct snd_card *card;
411         struct snd_ac97 *ac97;  /* for ad-hoc ac97 devices */
412         unsigned int active;
413         unsigned int pcm_devs;
414         void *private_data;
415
416         /* codec IO */
417         void *control_data; /* codec control (i2c/3wire) data */
418         unsigned int (*read)(struct snd_soc_codec *, unsigned int);
419         int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
420         int (*display_register)(struct snd_soc_codec *, char *,
421                                 size_t, unsigned int);
422         hw_write_t hw_write;
423         hw_read_t hw_read;
424         void *reg_cache;
425         short reg_cache_size;
426         short reg_cache_step;
427
428         /* dapm */
429         struct list_head dapm_widgets;
430         struct list_head dapm_paths;
431         enum snd_soc_bias_level bias_level;
432         enum snd_soc_bias_level suspend_bias_level;
433         struct delayed_work delayed_work;
434
435         /* codec DAI's */
436         struct snd_soc_dai *dai;
437         unsigned int num_dai;
438 };
439
440 /* codec device */
441 struct snd_soc_codec_device {
442         int (*probe)(struct platform_device *pdev);
443         int (*remove)(struct platform_device *pdev);
444         int (*suspend)(struct platform_device *pdev, pm_message_t state);
445         int (*resume)(struct platform_device *pdev);
446 };
447
448 /* SoC platform interface */
449 struct snd_soc_platform {
450         char *name;
451
452         int (*probe)(struct platform_device *pdev);
453         int (*remove)(struct platform_device *pdev);
454         int (*suspend)(struct platform_device *pdev,
455                 struct snd_soc_dai *dai);
456         int (*resume)(struct platform_device *pdev,
457                 struct snd_soc_dai *dai);
458
459         /* pcm creation and destruction */
460         int (*pcm_new)(struct snd_card *, struct snd_soc_dai *,
461                 struct snd_pcm *);
462         void (*pcm_free)(struct snd_pcm *);
463
464         /* platform stream ops */
465         struct snd_pcm_ops *pcm_ops;
466 };
467
468 /* SoC machine DAI configuration, glues a codec and cpu DAI together */
469 struct snd_soc_dai_link  {
470         char *name;                     /* Codec name */
471         char *stream_name;              /* Stream name */
472
473         /* DAI */
474         struct snd_soc_dai *codec_dai;
475         struct snd_soc_dai *cpu_dai;
476
477         /* machine stream operations */
478         struct snd_soc_ops *ops;
479
480         /* codec/machine specific init - e.g. add machine controls */
481         int (*init)(struct snd_soc_codec *codec);
482
483         /* DAI pcm */
484         struct snd_pcm *pcm;
485 };
486
487 /* SoC machine */
488 struct snd_soc_machine {
489         char *name;
490
491         int (*probe)(struct platform_device *pdev);
492         int (*remove)(struct platform_device *pdev);
493
494         /* the pre and post PM functions are used to do any PM work before and
495          * after the codec and DAI's do any PM work. */
496         int (*suspend_pre)(struct platform_device *pdev, pm_message_t state);
497         int (*suspend_post)(struct platform_device *pdev, pm_message_t state);
498         int (*resume_pre)(struct platform_device *pdev);
499         int (*resume_post)(struct platform_device *pdev);
500
501         /* callbacks */
502         int (*set_bias_level)(struct snd_soc_machine *,
503                               enum snd_soc_bias_level level);
504
505         /* CPU <--> Codec DAI links  */
506         struct snd_soc_dai_link *dai_link;
507         int num_links;
508 };
509
510 /* SoC Device - the audio subsystem */
511 struct snd_soc_device {
512         struct device *dev;
513         struct snd_soc_machine *machine;
514         struct snd_soc_platform *platform;
515         struct snd_soc_codec *codec;
516         struct snd_soc_codec_device *codec_dev;
517         struct delayed_work delayed_work;
518         struct work_struct deferred_resume_work;
519         void *codec_data;
520 };
521
522 /* runtime channel data */
523 struct snd_soc_pcm_runtime {
524         struct snd_soc_dai_link *dai;
525         struct snd_soc_device *socdev;
526 };
527
528 /* mixer control */
529 struct soc_mixer_control {
530         int min, max;
531         unsigned int reg, rreg, shift, rshift, invert;
532 };
533
534 /* enumerated kcontrol */
535 struct soc_enum {
536         unsigned short reg;
537         unsigned short reg2;
538         unsigned char shift_l;
539         unsigned char shift_r;
540         unsigned int max;
541         const char **texts;
542         void *dapm;
543 };
544
545 #endif