aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/max98088.h50
-rw-r--r--include/sound/sh_fsi.h3
-rw-r--r--include/sound/soc-dai.h98
-rw-r--r--include/sound/soc-dapm.h18
-rw-r--r--include/sound/soc-of-simple.h25
-rw-r--r--include/sound/soc.h245
-rw-r--r--include/sound/tlv320aic3x.h43
-rw-r--r--include/sound/wm8962.h32
8 files changed, 349 insertions, 165 deletions
diff --git a/include/sound/max98088.h b/include/sound/max98088.h
new file mode 100644
index 000000000000..c3ba8239182d
--- /dev/null
+++ b/include/sound/max98088.h
@@ -0,0 +1,50 @@
1/*
2 * Platform data for MAX98088
3 *
4 * Copyright 2010 Maxim Integrated Products
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 */
12
13#ifndef __SOUND_MAX98088_PDATA_H__
14#define __SOUND_MAX98088_PDATA_H__
15
16/* Equalizer filter response configuration */
17struct max98088_eq_cfg {
18 const char *name;
19 unsigned int rate;
20 u16 band1[5];
21 u16 band2[5];
22 u16 band3[5];
23 u16 band4[5];
24 u16 band5[5];
25};
26
27/* codec platform data */
28struct max98088_pdata {
29
30 /* Equalizers for DAI1 and DAI2 */
31 struct max98088_eq_cfg *eq_cfg;
32 unsigned int eq_cfgcnt;
33
34 /* Receiver output can be configured as power amplifier or LINE out */
35 /* Set receiver_mode to:
36 * 0 = amplifier output, or
37 * 1 = LINE level output
38 */
39 unsigned int receiver_mode:1;
40
41 /* Analog/digital microphone configuration:
42 * 0 = analog microphone input (normal setting)
43 * 1 = digital microphone input
44 */
45 unsigned int digmic_left_mode:1;
46 unsigned int digmic_right_mode:1;
47
48};
49
50#endif
diff --git a/include/sound/sh_fsi.h b/include/sound/sh_fsi.h
index 9d51d6f35893..fa60cbda90a4 100644
--- a/include/sound/sh_fsi.h
+++ b/include/sound/sh_fsi.h
@@ -114,7 +114,4 @@ struct sh_fsi_platform_info {
114 int (*set_rate)(int is_porta, int rate); /* for master mode */ 114 int (*set_rate)(int is_porta, int rate); /* for master mode */
115}; 115};
116 116
117extern struct snd_soc_dai fsi_soc_dai[2];
118extern struct snd_soc_platform fsi_soc_platform;
119
120#endif /* __SOUND_FSI_H */ 117#endif /* __SOUND_FSI_H */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 377693a14385..e7b680248006 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -91,15 +91,17 @@ struct snd_pcm_substream;
91 SNDRV_PCM_FMTBIT_S32_LE |\ 91 SNDRV_PCM_FMTBIT_S32_LE |\
92 SNDRV_PCM_FMTBIT_S32_BE) 92 SNDRV_PCM_FMTBIT_S32_BE)
93 93
94struct snd_soc_dai_ops; 94struct snd_soc_dai_driver;
95struct snd_soc_dai; 95struct snd_soc_dai;
96struct snd_ac97_bus_ops; 96struct snd_ac97_bus_ops;
97 97
98/* Digital Audio Interface registration */ 98/* Digital Audio Interface registration */
99int snd_soc_register_dai(struct snd_soc_dai *dai); 99int snd_soc_register_dai(struct device *dev,
100void snd_soc_unregister_dai(struct snd_soc_dai *dai); 100 struct snd_soc_dai_driver *dai_drv);
101int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count); 101void snd_soc_unregister_dai(struct device *dev);
102void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count); 102int snd_soc_register_dais(struct device *dev,
103 struct snd_soc_dai_driver *dai_drv, size_t count);
104void snd_soc_unregister_dais(struct device *dev, size_t count);
103 105
104/* Digital Audio Interface clocking API.*/ 106/* Digital Audio Interface clocking API.*/
105int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, 107int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
@@ -126,16 +128,6 @@ int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate);
126/* Digital Audio Interface mute */ 128/* Digital Audio Interface mute */
127int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute); 129int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute);
128 130
129/*
130 * Digital Audio Interface.
131 *
132 * Describes the Digital Audio Interface in terms of its ALSA, DAI and AC97
133 * operations and capabilities. Codec and platform drivers will register this
134 * structure for every DAI they have.
135 *
136 * This structure covers the clocking, formating and ALSA operations for each
137 * interface.
138 */
139struct snd_soc_dai_ops { 131struct snd_soc_dai_ops {
140 /* 132 /*
141 * DAI clocking configuration, all optional. 133 * DAI clocking configuration, all optional.
@@ -191,24 +183,24 @@ struct snd_soc_dai_ops {
191}; 183};
192 184
193/* 185/*
194 * Digital Audio Interface runtime data. 186 * Digital Audio Interface Driver.
195 * 187 *
196 * Holds runtime data for a DAI. 188 * Describes the Digital Audio Interface in terms of its ALSA, DAI and AC97
189 * operations and capabilities. Codec and platform drivers will register this
190 * structure for every DAI they have.
191 *
192 * This structure covers the clocking, formating and ALSA operations for each
193 * interface.
197 */ 194 */
198struct snd_soc_dai { 195struct snd_soc_dai_driver {
199 /* DAI description */ 196 /* DAI description */
200 char *name; 197 const char *name;
201 unsigned int id; 198 unsigned int id;
202 int ac97_control; 199 int ac97_control;
203 200
204 struct device *dev; 201 /* DAI driver callbacks */
205 void *ac97_pdata; /* platform_data for the ac97 codec */ 202 int (*probe)(struct snd_soc_dai *dai);
206 203 int (*remove)(struct snd_soc_dai *dai);
207 /* DAI callbacks */
208 int (*probe)(struct platform_device *pdev,
209 struct snd_soc_dai *dai);
210 void (*remove)(struct platform_device *pdev,
211 struct snd_soc_dai *dai);
212 int (*suspend)(struct snd_soc_dai *dai); 204 int (*suspend)(struct snd_soc_dai *dai);
213 int (*resume)(struct snd_soc_dai *dai); 205 int (*resume)(struct snd_soc_dai *dai);
214 206
@@ -219,26 +211,51 @@ struct snd_soc_dai {
219 struct snd_soc_pcm_stream capture; 211 struct snd_soc_pcm_stream capture;
220 struct snd_soc_pcm_stream playback; 212 struct snd_soc_pcm_stream playback;
221 unsigned int symmetric_rates:1; 213 unsigned int symmetric_rates:1;
214};
215
216/*
217 * Digital Audio Interface runtime data.
218 *
219 * Holds runtime data for a DAI.
220 */
221struct snd_soc_dai {
222 const char *name;
223 int id;
224 struct device *dev;
225 void *ac97_pdata; /* platform_data for the ac97 codec */
226
227 /* driver ops */
228 struct snd_soc_dai_driver *driver;
222 229
223 /* DAI runtime info */ 230 /* DAI runtime info */
224 struct snd_soc_codec *codec; 231 unsigned int capture_active:1; /* stream is in use */
232 unsigned int playback_active:1; /* stream is in use */
233 unsigned int symmetric_rates:1;
234 struct snd_pcm_runtime *runtime;
225 unsigned int active; 235 unsigned int active;
226 unsigned char pop_wait:1; 236 unsigned char pop_wait:1;
237 unsigned char probed:1;
227 238
228 /* DAI private data */ 239 /* DAI DMA data */
229 void *private_data; 240 void *playback_dma_data;
241 void *capture_dma_data;
230 242
231 /* parent platform */ 243 /* parent platform/codec */
232 struct snd_soc_platform *platform; 244 union {
245 struct snd_soc_platform *platform;
246 struct snd_soc_codec *codec;
247 };
248 struct snd_soc_card *card;
233 249
234 struct list_head list; 250 struct list_head list;
251 struct list_head card_list;
235}; 252};
236 253
237static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai, 254static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai,
238 const struct snd_pcm_substream *ss) 255 const struct snd_pcm_substream *ss)
239{ 256{
240 return (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) ? 257 return (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
241 dai->playback.dma_data : dai->capture.dma_data; 258 dai->playback_dma_data : dai->capture_dma_data;
242} 259}
243 260
244static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai, 261static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai,
@@ -246,9 +263,20 @@ static inline void snd_soc_dai_set_dma_data(struct snd_soc_dai *dai,
246 void *data) 263 void *data)
247{ 264{
248 if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK) 265 if (ss->stream == SNDRV_PCM_STREAM_PLAYBACK)
249 dai->playback.dma_data = data; 266 dai->playback_dma_data = data;
250 else 267 else
251 dai->capture.dma_data = data; 268 dai->capture_dma_data = data;
269}
270
271static inline void snd_soc_dai_set_drvdata(struct snd_soc_dai *dai,
272 void *data)
273{
274 dev_set_drvdata(dai->dev, data);
275}
276
277static inline void *snd_soc_dai_get_drvdata(struct snd_soc_dai *dai)
278{
279 return dev_get_drvdata(dai->dev);
252} 280}
253 281
254#endif 282#endif
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index c5d9987bc897..8fd3b41b763f 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -172,9 +172,19 @@
172#define SND_SOC_DAPM_AIF_IN(wname, stname, wslot, wreg, wshift, winvert) \ 172#define SND_SOC_DAPM_AIF_IN(wname, stname, wslot, wreg, wshift, winvert) \
173{ .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \ 173{ .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \
174 .reg = wreg, .shift = wshift, .invert = winvert } 174 .reg = wreg, .shift = wshift, .invert = winvert }
175#define SND_SOC_DAPM_AIF_IN_E(wname, stname, wslot, wreg, wshift, winvert, \
176 wevent, wflags) \
177{ .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \
178 .reg = wreg, .shift = wshift, .invert = winvert, \
179 .event = wevent, .event_flags = wflags }
175#define SND_SOC_DAPM_AIF_OUT(wname, stname, wslot, wreg, wshift, winvert) \ 180#define SND_SOC_DAPM_AIF_OUT(wname, stname, wslot, wreg, wshift, winvert) \
176{ .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \ 181{ .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \
177 .reg = wreg, .shift = wshift, .invert = winvert } 182 .reg = wreg, .shift = wshift, .invert = winvert }
183#define SND_SOC_DAPM_AIF_OUT_E(wname, stname, wslot, wreg, wshift, winvert, \
184 wevent, wflags) \
185{ .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \
186 .reg = wreg, .shift = wshift, .invert = winvert, \
187 .event = wevent, .event_flags = wflags }
178#define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \ 188#define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \
179{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \ 189{ .id = snd_soc_dapm_dac, .name = wname, .sname = stname, .reg = wreg, \
180 .shift = wshift, .invert = winvert} 190 .shift = wshift, .invert = winvert}
@@ -322,14 +332,14 @@ int snd_soc_dapm_new_controls(struct snd_soc_codec *codec,
322 332
323/* dapm path setup */ 333/* dapm path setup */
324int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec); 334int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec);
325void snd_soc_dapm_free(struct snd_soc_device *socdev); 335void snd_soc_dapm_free(struct snd_soc_codec *codec);
326int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, 336int snd_soc_dapm_add_routes(struct snd_soc_codec *codec,
327 const struct snd_soc_dapm_route *route, int num); 337 const struct snd_soc_dapm_route *route, int num);
328 338
329/* dapm events */ 339/* dapm events */
330int snd_soc_dapm_stream_event(struct snd_soc_codec *codec, char *stream, 340int snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd,
331 int event); 341 const char *stream, int event);
332void snd_soc_dapm_shutdown(struct snd_soc_device *socdev); 342void snd_soc_dapm_shutdown(struct snd_soc_card *card);
333 343
334/* dapm sys fs - used by the core */ 344/* dapm sys fs - used by the core */
335int snd_soc_dapm_sys_add(struct device *dev); 345int snd_soc_dapm_sys_add(struct device *dev);
diff --git a/include/sound/soc-of-simple.h b/include/sound/soc-of-simple.h
deleted file mode 100644
index a064e1934a56..000000000000
--- a/include/sound/soc-of-simple.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * OF helpers for ALSA SoC
3 *
4 * Copyright (C) 2008, Secret Lab Technologies Ltd.
5 */
6
7#ifndef _INCLUDE_SOC_OF_H_
8#define _INCLUDE_SOC_OF_H_
9
10#if defined(CONFIG_SND_SOC_OF_SIMPLE) || defined(CONFIG_SND_SOC_OF_SIMPLE_MODULE)
11
12#include <linux/of.h>
13#include <sound/soc.h>
14
15int of_snd_soc_register_codec(struct snd_soc_codec_device *codec_dev,
16 void *codec_data, struct snd_soc_dai *dai,
17 struct device_node *node);
18
19int of_snd_soc_register_platform(struct snd_soc_platform *platform,
20 struct device_node *node,
21 struct snd_soc_dai *cpu_dai);
22
23#endif
24
25#endif /* _INCLUDE_SOC_OF_H_ */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 65e9d03ed4f5..5c3bce83f28a 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -214,10 +214,10 @@
214 * @OFF: Power Off. No restrictions on transition times. 214 * @OFF: Power Off. No restrictions on transition times.
215 */ 215 */
216enum snd_soc_bias_level { 216enum snd_soc_bias_level {
217 SND_SOC_BIAS_ON,
218 SND_SOC_BIAS_PREPARE,
219 SND_SOC_BIAS_STANDBY,
220 SND_SOC_BIAS_OFF, 217 SND_SOC_BIAS_OFF,
218 SND_SOC_BIAS_STANDBY,
219 SND_SOC_BIAS_PREPARE,
220 SND_SOC_BIAS_ON,
221}; 221};
222 222
223struct snd_jack; 223struct snd_jack;
@@ -228,13 +228,17 @@ struct snd_soc_ops;
228struct snd_soc_dai_mode; 228struct snd_soc_dai_mode;
229struct snd_soc_pcm_runtime; 229struct snd_soc_pcm_runtime;
230struct snd_soc_dai; 230struct snd_soc_dai;
231struct snd_soc_dai_driver;
231struct snd_soc_platform; 232struct snd_soc_platform;
232struct snd_soc_dai_link; 233struct snd_soc_dai_link;
234struct snd_soc_platform_driver;
233struct snd_soc_codec; 235struct snd_soc_codec;
236struct snd_soc_codec_driver;
234struct soc_enum; 237struct soc_enum;
235struct snd_soc_ac97_ops; 238struct snd_soc_ac97_ops;
236struct snd_soc_jack; 239struct snd_soc_jack;
237struct snd_soc_jack_pin; 240struct snd_soc_jack_pin;
241
238#ifdef CONFIG_GPIOLIB 242#ifdef CONFIG_GPIOLIB
239struct snd_soc_jack_gpio; 243struct snd_soc_jack_gpio;
240#endif 244#endif
@@ -249,19 +253,18 @@ enum snd_soc_control_type {
249 SND_SOC_SPI, 253 SND_SOC_SPI,
250}; 254};
251 255
252int snd_soc_register_platform(struct snd_soc_platform *platform); 256int snd_soc_register_platform(struct device *dev,
253void snd_soc_unregister_platform(struct snd_soc_platform *platform); 257 struct snd_soc_platform_driver *platform_drv);
254int snd_soc_register_codec(struct snd_soc_codec *codec); 258void snd_soc_unregister_platform(struct device *dev);
255void snd_soc_unregister_codec(struct snd_soc_codec *codec); 259int snd_soc_register_codec(struct device *dev,
260 struct snd_soc_codec_driver *codec_drv,
261 struct snd_soc_dai_driver *dai_drv, int num_dai);
262void snd_soc_unregister_codec(struct device *dev);
256int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg); 263int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg);
257int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, 264int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
258 int addr_bits, int data_bits, 265 int addr_bits, int data_bits,
259 enum snd_soc_control_type control); 266 enum snd_soc_control_type control);
260 267
261/* pcm <-> DAI connect */
262void snd_soc_free_pcms(struct snd_soc_device *socdev);
263int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid);
264
265/* Utility functions to get clock rates from various things */ 268/* Utility functions to get clock rates from various things */
266int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); 269int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
267int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params); 270int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params);
@@ -273,7 +276,7 @@ int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
273 const struct snd_pcm_hardware *hw); 276 const struct snd_pcm_hardware *hw);
274 277
275/* Jack reporting */ 278/* Jack reporting */
276int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type, 279int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type,
277 struct snd_soc_jack *jack); 280 struct snd_soc_jack *jack);
278void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask); 281void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
279int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, 282int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
@@ -382,7 +385,7 @@ struct snd_soc_jack_gpio {
382 int invert; 385 int invert;
383 int debounce_time; 386 int debounce_time;
384 struct snd_soc_jack *jack; 387 struct snd_soc_jack *jack;
385 struct work_struct work; 388 struct delayed_work work;
386 389
387 int (*jack_status_check)(void); 390 int (*jack_status_check)(void);
388}; 391};
@@ -390,7 +393,7 @@ struct snd_soc_jack_gpio {
390 393
391struct snd_soc_jack { 394struct snd_soc_jack {
392 struct snd_jack *jack; 395 struct snd_jack *jack;
393 struct snd_soc_card *card; 396 struct snd_soc_codec *codec;
394 struct list_head pins; 397 struct list_head pins;
395 int status; 398 int status;
396 struct blocking_notifier_head notifier; 399 struct blocking_notifier_head notifier;
@@ -398,15 +401,13 @@ struct snd_soc_jack {
398 401
399/* SoC PCM stream information */ 402/* SoC PCM stream information */
400struct snd_soc_pcm_stream { 403struct snd_soc_pcm_stream {
401 char *stream_name; 404 const char *stream_name;
402 u64 formats; /* SNDRV_PCM_FMTBIT_* */ 405 u64 formats; /* SNDRV_PCM_FMTBIT_* */
403 unsigned int rates; /* SNDRV_PCM_RATE_* */ 406 unsigned int rates; /* SNDRV_PCM_RATE_* */
404 unsigned int rate_min; /* min rate */ 407 unsigned int rate_min; /* min rate */
405 unsigned int rate_max; /* max rate */ 408 unsigned int rate_max; /* max rate */
406 unsigned int channels_min; /* min channels */ 409 unsigned int channels_min; /* min channels */
407 unsigned int channels_max; /* max channels */ 410 unsigned int channels_max; /* max channels */
408 unsigned int active; /* stream is in use */
409 void *dma_data; /* used by platform code */
410}; 411};
411 412
412/* SoC audio ops */ 413/* SoC audio ops */
@@ -419,44 +420,36 @@ struct snd_soc_ops {
419 int (*trigger)(struct snd_pcm_substream *, int); 420 int (*trigger)(struct snd_pcm_substream *, int);
420}; 421};
421 422
422/* SoC Audio Codec */ 423/* SoC Audio Codec device */
423struct snd_soc_codec { 424struct snd_soc_codec {
424 char *name; 425 const char *name;
425 struct module *owner; 426 int id;
426 struct mutex mutex;
427 struct device *dev; 427 struct device *dev;
428 struct snd_soc_device *socdev; 428 struct snd_soc_codec_driver *driver;
429 429
430 struct mutex mutex;
431 struct snd_soc_card *card;
430 struct list_head list; 432 struct list_head list;
431 433 struct list_head card_list;
432 /* callbacks */ 434 int num_dai;
433 int (*set_bias_level)(struct snd_soc_codec *,
434 enum snd_soc_bias_level level);
435 435
436 /* runtime */ 436 /* runtime */
437 struct snd_card *card;
438 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 437 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
439 unsigned int active; 438 unsigned int active;
440 unsigned int pcm_devs; 439 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
441 void *drvdata; 440 unsigned int cache_only:1; /* Suppress writes to hardware */
441 unsigned int cache_sync:1; /* Cache needs to be synced to hardware */
442 unsigned int suspended:1; /* Codec is in suspend PM state */
443 unsigned int probed:1; /* Codec has been probed */
444 unsigned int ac97_registered:1; /* Codec has been AC97 registered */
445 unsigned int ac97_created:1; /* Codec has been created by SoC */
446 unsigned int sysfs_registered:1; /* codec has been sysfs registered */
442 447
443 /* codec IO */ 448 /* codec IO */
444 void *control_data; /* codec control (i2c/3wire) data */ 449 void *control_data; /* codec control (i2c/3wire) data */
445 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
446 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
447 int (*display_register)(struct snd_soc_codec *, char *,
448 size_t, unsigned int);
449 int (*volatile_register)(unsigned int);
450 int (*readable_register)(unsigned int);
451 hw_write_t hw_write; 450 hw_write_t hw_write;
452 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int); 451 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
453 void *reg_cache; 452 void *reg_cache;
454 short reg_cache_size;
455 short reg_cache_step;
456
457 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
458 unsigned int cache_only:1; /* Suppress writes to hardware */
459 unsigned int cache_sync:1; /* Cache needs to be synced to hardware */
460 453
461 /* dapm */ 454 /* dapm */
462 u32 pop_time; 455 u32 pop_time;
@@ -466,10 +459,6 @@ struct snd_soc_codec {
466 enum snd_soc_bias_level suspend_bias_level; 459 enum snd_soc_bias_level suspend_bias_level;
467 struct delayed_work delayed_work; 460 struct delayed_work delayed_work;
468 461
469 /* codec DAI's */
470 struct snd_soc_dai *dai;
471 unsigned int num_dai;
472
473#ifdef CONFIG_DEBUG_FS 462#ifdef CONFIG_DEBUG_FS
474 struct dentry *debugfs_codec_root; 463 struct dentry *debugfs_codec_root;
475 struct dentry *debugfs_reg; 464 struct dentry *debugfs_reg;
@@ -478,23 +467,40 @@ struct snd_soc_codec {
478#endif 467#endif
479}; 468};
480 469
481/* codec device */ 470/* codec driver */
482struct snd_soc_codec_device { 471struct snd_soc_codec_driver {
483 int (*probe)(struct platform_device *pdev); 472
484 int (*remove)(struct platform_device *pdev); 473 /* driver ops */
485 int (*suspend)(struct platform_device *pdev, pm_message_t state); 474 int (*probe)(struct snd_soc_codec *);
486 int (*resume)(struct platform_device *pdev); 475 int (*remove)(struct snd_soc_codec *);
476 int (*suspend)(struct snd_soc_codec *,
477 pm_message_t state);
478 int (*resume)(struct snd_soc_codec *);
479
480 /* codec IO */
481 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
482 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
483 int (*display_register)(struct snd_soc_codec *, char *,
484 size_t, unsigned int);
485 int (*volatile_register)(unsigned int);
486 int (*readable_register)(unsigned int);
487 short reg_cache_size;
488 short reg_cache_step;
489 short reg_word_size;
490 const void *reg_cache_default;
491
492 /* codec bias level */
493 int (*set_bias_level)(struct snd_soc_codec *,
494 enum snd_soc_bias_level level);
487}; 495};
488 496
489/* SoC platform interface */ 497/* SoC platform interface */
490struct snd_soc_platform { 498struct snd_soc_platform_driver {
491 char *name;
492 struct list_head list;
493 499
494 int (*probe)(struct platform_device *pdev); 500 int (*probe)(struct snd_soc_platform *);
495 int (*remove)(struct platform_device *pdev); 501 int (*remove)(struct snd_soc_platform *);
496 int (*suspend)(struct snd_soc_dai_link *dai_link); 502 int (*suspend)(struct snd_soc_dai *dai);
497 int (*resume)(struct snd_soc_dai_link *dai_link); 503 int (*resume)(struct snd_soc_dai *dai);
498 504
499 /* pcm creation and destruction */ 505 /* pcm creation and destruction */
500 int (*pcm_new)(struct snd_card *, struct snd_soc_dai *, 506 int (*pcm_new)(struct snd_card *, struct snd_soc_dai *,
@@ -509,23 +515,31 @@ struct snd_soc_platform {
509 struct snd_soc_dai *); 515 struct snd_soc_dai *);
510 516
511 /* platform stream ops */ 517 /* platform stream ops */
512 struct snd_pcm_ops *pcm_ops; 518 struct snd_pcm_ops *ops;
513}; 519};
514 520
515/* SoC machine DAI configuration, glues a codec and cpu DAI together */ 521struct snd_soc_platform {
516struct snd_soc_dai_link { 522 const char *name;
517 char *name; /* Codec name */ 523 int id;
518 char *stream_name; /* Stream name */ 524 struct device *dev;
525 struct snd_soc_platform_driver *driver;
519 526
520 /* DAI */ 527 unsigned int suspended:1; /* platform is suspended */
521 struct snd_soc_dai *codec_dai; 528 unsigned int probed:1;
522 struct snd_soc_dai *cpu_dai;
523 529
524 /* machine stream operations */ 530 struct snd_soc_card *card;
525 struct snd_soc_ops *ops; 531 struct list_head list;
532 struct list_head card_list;
533};
526 534
527 /* codec/machine specific init - e.g. add machine controls */ 535struct snd_soc_dai_link {
528 int (*init)(struct snd_soc_codec *codec); 536 /* config - must be set by machine driver */
537 const char *name; /* Codec name */
538 const char *stream_name; /* Stream name */
539 const char *codec_name; /* for multi-codec */
540 const char *platform_name; /* for multi-platform */
541 const char *cpu_dai_name;
542 const char *codec_dai_name;
529 543
530 /* Keep DAI active over suspend */ 544 /* Keep DAI active over suspend */
531 unsigned int ignore_suspend:1; 545 unsigned int ignore_suspend:1;
@@ -533,21 +547,24 @@ struct snd_soc_dai_link {
533 /* Symmetry requirements */ 547 /* Symmetry requirements */
534 unsigned int symmetric_rates:1; 548 unsigned int symmetric_rates:1;
535 549
536 /* Symmetry data - only valid if symmetry is being enforced */ 550 /* codec/machine specific init - e.g. add machine controls */
537 unsigned int rate; 551 int (*init)(struct snd_soc_pcm_runtime *rtd);
538 552
539 /* DAI pcm */ 553 /* machine stream operations */
540 struct snd_pcm *pcm; 554 struct snd_soc_ops *ops;
541}; 555};
542 556
543/* SoC card */ 557/* SoC card */
544struct snd_soc_card { 558struct snd_soc_card {
545 char *name; 559 const char *name;
546 struct device *dev; 560 struct device *dev;
561 struct snd_card *snd_card;
562 struct module *owner;
547 563
548 struct list_head list; 564 struct list_head list;
565 struct mutex mutex;
549 566
550 int instantiated; 567 bool instantiated;
551 568
552 int (*probe)(struct platform_device *pdev); 569 int (*probe)(struct platform_device *pdev);
553 int (*remove)(struct platform_device *pdev); 570 int (*remove)(struct platform_device *pdev);
@@ -568,28 +585,38 @@ struct snd_soc_card {
568 /* CPU <--> Codec DAI links */ 585 /* CPU <--> Codec DAI links */
569 struct snd_soc_dai_link *dai_link; 586 struct snd_soc_dai_link *dai_link;
570 int num_links; 587 int num_links;
588 struct snd_soc_pcm_runtime *rtd;
589 int num_rtd;
571 590
572 struct snd_soc_device *socdev;
573
574 struct snd_soc_codec *codec;
575
576 struct snd_soc_platform *platform;
577 struct delayed_work delayed_work;
578 struct work_struct deferred_resume_work; 591 struct work_struct deferred_resume_work;
592
593 /* lists of probed devices belonging to this card */
594 struct list_head codec_dev_list;
595 struct list_head platform_dev_list;
596 struct list_head dai_dev_list;
579}; 597};
580 598
581/* SoC Device - the audio subsystem */ 599/* SoC machine DAI configuration, glues a codec and cpu DAI together */
582struct snd_soc_device { 600struct snd_soc_pcm_runtime {
583 struct device *dev; 601 struct device dev;
584 struct snd_soc_card *card; 602 struct snd_soc_card *card;
585 struct snd_soc_codec_device *codec_dev; 603 struct snd_soc_dai_link *dai_link;
586 void *codec_data; 604
587}; 605 unsigned int complete:1;
606 unsigned int dev_registered:1;
607
608 /* Symmetry data - only valid if symmetry is being enforced */
609 unsigned int rate;
610 long pmdown_time;
588 611
589/* runtime channel data */ 612 /* runtime devices */
590struct snd_soc_pcm_runtime { 613 struct snd_pcm *pcm;
591 struct snd_soc_dai_link *dai; 614 struct snd_soc_codec *codec;
592 struct snd_soc_device *socdev; 615 struct snd_soc_platform *platform;
616 struct snd_soc_dai *codec_dai;
617 struct snd_soc_dai *cpu_dai;
618
619 struct delayed_work delayed_work;
593}; 620};
594 621
595/* mixer control */ 622/* mixer control */
@@ -615,24 +642,48 @@ struct soc_enum {
615static inline unsigned int snd_soc_read(struct snd_soc_codec *codec, 642static inline unsigned int snd_soc_read(struct snd_soc_codec *codec,
616 unsigned int reg) 643 unsigned int reg)
617{ 644{
618 return codec->read(codec, reg); 645 return codec->driver->read(codec, reg);
619} 646}
620 647
621static inline unsigned int snd_soc_write(struct snd_soc_codec *codec, 648static inline unsigned int snd_soc_write(struct snd_soc_codec *codec,
622 unsigned int reg, unsigned int val) 649 unsigned int reg, unsigned int val)
623{ 650{
624 return codec->write(codec, reg, val); 651 return codec->driver->write(codec, reg, val);
625} 652}
626 653
654/* device driver data */
655
627static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec, 656static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec,
628 void *data) 657 void *data)
629{ 658{
630 codec->drvdata = data; 659 dev_set_drvdata(codec->dev, data);
631} 660}
632 661
633static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec) 662static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec)
634{ 663{
635 return codec->drvdata; 664 return dev_get_drvdata(codec->dev);
665}
666
667static inline void snd_soc_platform_set_drvdata(struct snd_soc_platform *platform,
668 void *data)
669{
670 dev_set_drvdata(platform->dev, data);
671}
672
673static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platform)
674{
675 return dev_get_drvdata(platform->dev);
676}
677
678static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd,
679 void *data)
680{
681 dev_set_drvdata(&rtd->dev, data);
682}
683
684static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
685{
686 return dev_get_drvdata(&rtd->dev);
636} 687}
637 688
638#include <sound/soc-dai.h> 689#include <sound/soc-dai.h>
diff --git a/include/sound/tlv320aic3x.h b/include/sound/tlv320aic3x.h
index b1a5f34e5cfa..99e0308bf2c2 100644
--- a/include/sound/tlv320aic3x.h
+++ b/include/sound/tlv320aic3x.h
@@ -10,8 +10,49 @@
10#ifndef __TLV320AIC3x_H__ 10#ifndef __TLV320AIC3x_H__
11#define __TLV320AIC3x_H__ 11#define __TLV320AIC3x_H__
12 12
13/* GPIO API */
14enum {
15 AIC3X_GPIO1_FUNC_DISABLED = 0,
16 AIC3X_GPIO1_FUNC_AUDIO_WORDCLK_ADC = 1,
17 AIC3X_GPIO1_FUNC_CLOCK_MUX = 2,
18 AIC3X_GPIO1_FUNC_CLOCK_MUX_DIV2 = 3,
19 AIC3X_GPIO1_FUNC_CLOCK_MUX_DIV4 = 4,
20 AIC3X_GPIO1_FUNC_CLOCK_MUX_DIV8 = 5,
21 AIC3X_GPIO1_FUNC_SHORT_CIRCUIT_IRQ = 6,
22 AIC3X_GPIO1_FUNC_AGC_NOISE_IRQ = 7,
23 AIC3X_GPIO1_FUNC_INPUT = 8,
24 AIC3X_GPIO1_FUNC_OUTPUT = 9,
25 AIC3X_GPIO1_FUNC_DIGITAL_MIC_MODCLK = 10,
26 AIC3X_GPIO1_FUNC_AUDIO_WORDCLK = 11,
27 AIC3X_GPIO1_FUNC_BUTTON_IRQ = 12,
28 AIC3X_GPIO1_FUNC_HEADSET_DETECT_IRQ = 13,
29 AIC3X_GPIO1_FUNC_HEADSET_DETECT_OR_BUTTON_IRQ = 14,
30 AIC3X_GPIO1_FUNC_ALL_IRQ = 16
31};
32
33enum {
34 AIC3X_GPIO2_FUNC_DISABLED = 0,
35 AIC3X_GPIO2_FUNC_HEADSET_DETECT_IRQ = 2,
36 AIC3X_GPIO2_FUNC_INPUT = 3,
37 AIC3X_GPIO2_FUNC_OUTPUT = 4,
38 AIC3X_GPIO2_FUNC_DIGITAL_MIC_INPUT = 5,
39 AIC3X_GPIO2_FUNC_AUDIO_BITCLK = 8,
40 AIC3X_GPIO2_FUNC_HEADSET_DETECT_OR_BUTTON_IRQ = 9,
41 AIC3X_GPIO2_FUNC_ALL_IRQ = 10,
42 AIC3X_GPIO2_FUNC_SHORT_CIRCUIT_OR_AGC_IRQ = 11,
43 AIC3X_GPIO2_FUNC_HEADSET_OR_BUTTON_PRESS_OR_SHORT_CIRCUIT_IRQ = 12,
44 AIC3X_GPIO2_FUNC_SHORT_CIRCUIT_IRQ = 13,
45 AIC3X_GPIO2_FUNC_AGC_NOISE_IRQ = 14,
46 AIC3X_GPIO2_FUNC_BUTTON_PRESS_IRQ = 15
47};
48
49struct aic3x_setup_data {
50 unsigned int gpio_func[2];
51};
52
13struct aic3x_pdata { 53struct aic3x_pdata {
14 int gpio_reset; /* < 0 if not used */ 54 int gpio_reset; /* < 0 if not used */
55 struct aic3x_setup_data *setup;
15}; 56};
16 57
17#endif \ No newline at end of file 58#endif
diff --git a/include/sound/wm8962.h b/include/sound/wm8962.h
new file mode 100644
index 000000000000..2b5306c503fb
--- /dev/null
+++ b/include/sound/wm8962.h
@@ -0,0 +1,32 @@
1/*
2 * wm8962.h -- WM8962 Soc Audio driver platform data
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _WM8962_PDATA_H
10#define _WM8962_PDATA_H
11
12#define WM8962_MAX_GPIO 6
13
14/* Use to set GPIO default values to zero */
15#define WM8962_GPIO_SET 0x10000
16
17struct wm8962_pdata {
18 int gpio_base;
19 u32 gpio_init[WM8962_MAX_GPIO];
20
21 /* Setup for microphone detection, raw value to be written to
22 * R48(0x30) - only microphone related bits will be updated.
23 * Detection may be enabled here for use with signals brought
24 * out on the GPIOs. */
25 u32 mic_cfg;
26
27 bool irq_active_low;
28
29 bool spk_mono; /* Speaker outputs tied together as mono */
30};
31
32#endif