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