aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-01-13 02:37:24 -0500
committerTakashi Iwai <tiwai@suse.de>2011-01-13 02:37:24 -0500
commit6db9a0f326d3144d790d9479309df480a8f562e4 (patch)
tree650a8950c35c087278ecee1b8d123f75f601ebc8 /include/sound
parentc400c9e23feb5bb3fbe8a8d4581ecce3b19a2f38 (diff)
parent18b022eb117e7f70c191267551ff865f278a9258 (diff)
Merge branch 'topic/asoc' into for-linus
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/alc5623.h15
-rw-r--r--include/sound/soc-dai.h4
-rw-r--r--include/sound/soc-dapm.h99
-rw-r--r--include/sound/soc.h116
4 files changed, 177 insertions, 57 deletions
diff --git a/include/sound/alc5623.h b/include/sound/alc5623.h
new file mode 100644
index 00000000000..422c97d43df
--- /dev/null
+++ b/include/sound/alc5623.h
@@ -0,0 +1,15 @@
1#ifndef _INCLUDE_SOUND_ALC5623_H
2#define _INCLUDE_SOUND_ALC5623_H
3struct alc5623_platform_data {
4 /* configure : */
5 /* Lineout/Speaker Amps Vmid ratio control */
6 /* enable/disable adc/dac high pass filters */
7 unsigned int add_ctrl;
8 /* configure : */
9 /* output to enable when jack is low */
10 /* output to enable when jack is high */
11 /* jack detect (gpio/nc/jack detect [12] */
12 unsigned int jack_det_ctrl;
13};
14#endif
15
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index e7b68024800..1bafe95dcf4 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -16,8 +16,6 @@
16 16
17#include <linux/list.h> 17#include <linux/list.h>
18 18
19#include <sound/soc.h>
20
21struct snd_pcm_substream; 19struct snd_pcm_substream;
22 20
23/* 21/*
@@ -205,7 +203,7 @@ struct snd_soc_dai_driver {
205 int (*resume)(struct snd_soc_dai *dai); 203 int (*resume)(struct snd_soc_dai *dai);
206 204
207 /* ops */ 205 /* ops */
208 struct snd_soc_dai_ops *ops; 206 const struct snd_soc_dai_ops *ops;
209 207
210 /* DAI capabilities */ 208 /* DAI capabilities */
211 struct snd_soc_pcm_stream capture; 209 struct snd_soc_pcm_stream capture;
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 8fd3b41b763..8031769ac48 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -16,7 +16,6 @@
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <sound/control.h> 18#include <sound/control.h>
19#include <sound/soc.h>
20 19
21/* widget has no PM register bit */ 20/* widget has no PM register bit */
22#define SND_SOC_NOPM -1 21#define SND_SOC_NOPM -1
@@ -72,6 +71,10 @@
72 wcontrols, wncontrols) \ 71 wcontrols, wncontrols) \
73{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ 72{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
74 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols} 73 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols}
74#define SND_SOC_DAPM_OUT_DRV(wname, wreg, wshift, winvert,\
75 wcontrols, wncontrols) \
76{ .id = snd_soc_dapm_out_drv, .name = wname, .reg = wreg, .shift = wshift, \
77 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols}
75#define SND_SOC_DAPM_MIXER(wname, wreg, wshift, winvert, \ 78#define SND_SOC_DAPM_MIXER(wname, wreg, wshift, winvert, \
76 wcontrols, wncontrols)\ 79 wcontrols, wncontrols)\
77{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 80{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
@@ -90,6 +93,9 @@
90#define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \ 93#define SND_SOC_DAPM_MUX(wname, wreg, wshift, winvert, wcontrols) \
91{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \ 94{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \
92 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1} 95 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1}
96#define SND_SOC_DAPM_VIRT_MUX(wname, wreg, wshift, winvert, wcontrols) \
97{ .id = snd_soc_dapm_virt_mux, .name = wname, .reg = wreg, .shift = wshift, \
98 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1}
93#define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \ 99#define SND_SOC_DAPM_VALUE_MUX(wname, wreg, wshift, winvert, wcontrols) \
94{ .id = snd_soc_dapm_value_mux, .name = wname, .reg = wreg, \ 100{ .id = snd_soc_dapm_value_mux, .name = wname, .reg = wreg, \
95 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \ 101 .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \
@@ -116,6 +122,11 @@
116{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \ 122{ .id = snd_soc_dapm_pga, .name = wname, .reg = wreg, .shift = wshift, \
117 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \ 123 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \
118 .event = wevent, .event_flags = wflags} 124 .event = wevent, .event_flags = wflags}
125#define SND_SOC_DAPM_OUT_DRV_E(wname, wreg, wshift, winvert, wcontrols, \
126 wncontrols, wevent, wflags) \
127{ .id = snd_soc_dapm_out_drv, .name = wname, .reg = wreg, .shift = wshift, \
128 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \
129 .event = wevent, .event_flags = wflags}
119#define SND_SOC_DAPM_MIXER_E(wname, wreg, wshift, winvert, wcontrols, \ 130#define SND_SOC_DAPM_MIXER_E(wname, wreg, wshift, winvert, wcontrols, \
120 wncontrols, wevent, wflags) \ 131 wncontrols, wevent, wflags) \
121{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \ 132{ .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
@@ -140,6 +151,11 @@
140{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \ 151{ .id = snd_soc_dapm_mux, .name = wname, .reg = wreg, .shift = wshift, \
141 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \ 152 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \
142 .event = wevent, .event_flags = wflags} 153 .event = wevent, .event_flags = wflags}
154#define SND_SOC_DAPM_VIRT_MUX_E(wname, wreg, wshift, winvert, wcontrols, \
155 wevent, wflags) \
156{ .id = snd_soc_dapm_virt_mux, .name = wname, .reg = wreg, .shift = wshift, \
157 .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = 1, \
158 .event = wevent, .event_flags = wflags}
143 159
144/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */ 160/* Simplified versions of above macros, assuming wncontrols = ARRAY_SIZE(wcontrols) */
145#define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \ 161#define SOC_PGA_E_ARRAY(wname, wreg, wshift, winvert, wcontrols, \
@@ -219,13 +235,6 @@
219 .info = snd_soc_info_volsw, \ 235 .info = snd_soc_info_volsw, \
220 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 236 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
221 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 237 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
222#define SOC_DAPM_DOUBLE(xname, reg, shift_left, shift_right, max, invert, \
223 power) \
224{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
225 .info = snd_soc_info_volsw, \
226 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
227 .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\
228 ((max) << 16) | ((invert) << 24) }
229#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \ 238#define SOC_DAPM_SINGLE_TLV(xname, reg, shift, max, invert, tlv_array) \
230{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 239{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
231 .info = snd_soc_info_volsw, \ 240 .info = snd_soc_info_volsw, \
@@ -233,15 +242,6 @@
233 .tlv.p = (tlv_array), \ 242 .tlv.p = (tlv_array), \
234 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \ 243 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
235 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) } 244 .private_value = SOC_SINGLE_VALUE(reg, shift, max, invert) }
236#define SOC_DAPM_DOUBLE_TLV(xname, reg, shift_left, shift_right, max, invert, \
237 power, tlv_array) \
238{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
239 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | SNDRV_CTL_ELEM_ACCESS_READWRITE,\
240 .tlv.p = (tlv_array), \
241 .info = snd_soc_info_volsw, \
242 .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw, \
243 .private_value = (reg) | ((shift_left) << 8) | ((shift_right) << 12) |\
244 ((max) << 16) | ((invert) << 24) }
245#define SOC_DAPM_ENUM(xname, xenum) \ 245#define SOC_DAPM_ENUM(xname, xenum) \
246{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 246{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
247 .info = snd_soc_info_enum_double, \ 247 .info = snd_soc_info_enum_double, \
@@ -297,6 +297,7 @@ enum snd_soc_dapm_type;
297struct snd_soc_dapm_path; 297struct snd_soc_dapm_path;
298struct snd_soc_dapm_pin; 298struct snd_soc_dapm_pin;
299struct snd_soc_dapm_route; 299struct snd_soc_dapm_route;
300struct snd_soc_dapm_context;
300 301
301int dapm_reg_event(struct snd_soc_dapm_widget *w, 302int dapm_reg_event(struct snd_soc_dapm_widget *w,
302 struct snd_kcontrol *kcontrol, int event); 303 struct snd_kcontrol *kcontrol, int event);
@@ -324,16 +325,16 @@ int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
324 struct snd_ctl_elem_value *uncontrol); 325 struct snd_ctl_elem_value *uncontrol);
325int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, 326int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
326 struct snd_ctl_elem_value *uncontrol); 327 struct snd_ctl_elem_value *uncontrol);
327int snd_soc_dapm_new_control(struct snd_soc_codec *codec, 328int snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
328 const struct snd_soc_dapm_widget *widget); 329 const struct snd_soc_dapm_widget *widget);
329int snd_soc_dapm_new_controls(struct snd_soc_codec *codec, 330int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
330 const struct snd_soc_dapm_widget *widget, 331 const struct snd_soc_dapm_widget *widget,
331 int num); 332 int num);
332 333
333/* dapm path setup */ 334/* dapm path setup */
334int snd_soc_dapm_new_widgets(struct snd_soc_codec *codec); 335int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm);
335void snd_soc_dapm_free(struct snd_soc_codec *codec); 336void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm);
336int snd_soc_dapm_add_routes(struct snd_soc_codec *codec, 337int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
337 const struct snd_soc_dapm_route *route, int num); 338 const struct snd_soc_dapm_route *route, int num);
338 339
339/* dapm events */ 340/* dapm events */
@@ -343,27 +344,33 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card);
343 344
344/* dapm sys fs - used by the core */ 345/* dapm sys fs - used by the core */
345int snd_soc_dapm_sys_add(struct device *dev); 346int snd_soc_dapm_sys_add(struct device *dev);
346void snd_soc_dapm_debugfs_init(struct snd_soc_codec *codec); 347void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm);
347 348
348/* dapm audio pin control and status */ 349/* dapm audio pin control and status */
349int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin); 350int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm,
350int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin); 351 const char *pin);
351int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin); 352int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm,
352int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin); 353 const char *pin);
353int snd_soc_dapm_sync(struct snd_soc_codec *codec); 354int snd_soc_dapm_nc_pin(struct snd_soc_dapm_context *dapm, const char *pin);
354int snd_soc_dapm_force_enable_pin(struct snd_soc_codec *codec, 355int snd_soc_dapm_get_pin_status(struct snd_soc_dapm_context *dapm,
356 const char *pin);
357int snd_soc_dapm_sync(struct snd_soc_dapm_context *dapm);
358int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
355 const char *pin); 359 const char *pin);
356int snd_soc_dapm_ignore_suspend(struct snd_soc_codec *codec, const char *pin); 360int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
361 const char *pin);
357 362
358/* dapm widget types */ 363/* dapm widget types */
359enum snd_soc_dapm_type { 364enum snd_soc_dapm_type {
360 snd_soc_dapm_input = 0, /* input pin */ 365 snd_soc_dapm_input = 0, /* input pin */
361 snd_soc_dapm_output, /* output pin */ 366 snd_soc_dapm_output, /* output pin */
362 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */ 367 snd_soc_dapm_mux, /* selects 1 analog signal from many inputs */
368 snd_soc_dapm_virt_mux, /* virtual version of snd_soc_dapm_mux */
363 snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */ 369 snd_soc_dapm_value_mux, /* selects 1 analog signal from many inputs */
364 snd_soc_dapm_mixer, /* mixes several analog signals together */ 370 snd_soc_dapm_mixer, /* mixes several analog signals together */
365 snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */ 371 snd_soc_dapm_mixer_named_ctl, /* mixer with named controls */
366 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */ 372 snd_soc_dapm_pga, /* programmable gain/attenuation (volume) */
373 snd_soc_dapm_out_drv, /* output driver */
367 snd_soc_dapm_adc, /* analog to digital converter */ 374 snd_soc_dapm_adc, /* analog to digital converter */
368 snd_soc_dapm_dac, /* digital to analog converter */ 375 snd_soc_dapm_dac, /* digital to analog converter */
369 snd_soc_dapm_micbias, /* microphone bias (power) */ 376 snd_soc_dapm_micbias, /* microphone bias (power) */
@@ -425,6 +432,7 @@ struct snd_soc_dapm_widget {
425 char *sname; /* stream name */ 432 char *sname; /* stream name */
426 struct snd_soc_codec *codec; 433 struct snd_soc_codec *codec;
427 struct list_head list; 434 struct list_head list;
435 struct snd_soc_dapm_context *dapm;
428 436
429 /* dapm control */ 437 /* dapm control */
430 short reg; /* negative reg = no direct dapm */ 438 short reg; /* negative reg = no direct dapm */
@@ -461,4 +469,35 @@ struct snd_soc_dapm_widget {
461 struct list_head power_list; 469 struct list_head power_list;
462}; 470};
463 471
472struct snd_soc_dapm_update {
473 struct snd_soc_dapm_widget *widget;
474 struct snd_kcontrol *kcontrol;
475 int reg;
476 int mask;
477 int val;
478};
479
480/* DAPM context */
481struct snd_soc_dapm_context {
482 int n_widgets; /* number of widgets in this context */
483 enum snd_soc_bias_level bias_level;
484 enum snd_soc_bias_level suspend_bias_level;
485 struct delayed_work delayed_work;
486 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
487
488 struct snd_soc_dapm_update *update;
489
490 struct device *dev; /* from parent - for debug */
491 struct snd_soc_codec *codec; /* parent codec */
492 struct snd_soc_card *card; /* parent card */
493
494 /* used during DAPM updates */
495 int dev_power;
496 struct list_head list;
497
498#ifdef CONFIG_DEBUG_FS
499 struct dentry *debugfs_dapm;
500#endif
501};
502
464#endif 503#endif
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 5c3bce83f28..74921f20a1d 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -222,10 +222,8 @@ enum snd_soc_bias_level {
222 222
223struct snd_jack; 223struct snd_jack;
224struct snd_soc_card; 224struct snd_soc_card;
225struct snd_soc_device;
226struct snd_soc_pcm_stream; 225struct snd_soc_pcm_stream;
227struct snd_soc_ops; 226struct snd_soc_ops;
228struct snd_soc_dai_mode;
229struct snd_soc_pcm_runtime; 227struct snd_soc_pcm_runtime;
230struct snd_soc_dai; 228struct snd_soc_dai;
231struct snd_soc_dai_driver; 229struct snd_soc_dai_driver;
@@ -235,9 +233,10 @@ struct snd_soc_platform_driver;
235struct snd_soc_codec; 233struct snd_soc_codec;
236struct snd_soc_codec_driver; 234struct snd_soc_codec_driver;
237struct soc_enum; 235struct soc_enum;
238struct snd_soc_ac97_ops;
239struct snd_soc_jack; 236struct snd_soc_jack;
240struct snd_soc_jack_pin; 237struct snd_soc_jack_pin;
238struct snd_soc_cache_ops;
239#include <sound/soc-dapm.h>
241 240
242#ifdef CONFIG_GPIOLIB 241#ifdef CONFIG_GPIOLIB
243struct snd_soc_jack_gpio; 242struct snd_soc_jack_gpio;
@@ -253,17 +252,30 @@ enum snd_soc_control_type {
253 SND_SOC_SPI, 252 SND_SOC_SPI,
254}; 253};
255 254
255enum snd_soc_compress_type {
256 SND_SOC_FLAT_COMPRESSION = 1,
257 SND_SOC_LZO_COMPRESSION,
258 SND_SOC_RBTREE_COMPRESSION
259};
260
256int snd_soc_register_platform(struct device *dev, 261int snd_soc_register_platform(struct device *dev,
257 struct snd_soc_platform_driver *platform_drv); 262 struct snd_soc_platform_driver *platform_drv);
258void snd_soc_unregister_platform(struct device *dev); 263void snd_soc_unregister_platform(struct device *dev);
259int snd_soc_register_codec(struct device *dev, 264int snd_soc_register_codec(struct device *dev,
260 struct snd_soc_codec_driver *codec_drv, 265 const struct snd_soc_codec_driver *codec_drv,
261 struct snd_soc_dai_driver *dai_drv, int num_dai); 266 struct snd_soc_dai_driver *dai_drv, int num_dai);
262void snd_soc_unregister_codec(struct device *dev); 267void snd_soc_unregister_codec(struct device *dev);
263int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg); 268int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg);
264int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, 269int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
265 int addr_bits, int data_bits, 270 int addr_bits, int data_bits,
266 enum snd_soc_control_type control); 271 enum snd_soc_control_type control);
272int snd_soc_cache_sync(struct snd_soc_codec *codec);
273int snd_soc_cache_init(struct snd_soc_codec *codec);
274int snd_soc_cache_exit(struct snd_soc_codec *codec);
275int snd_soc_cache_write(struct snd_soc_codec *codec,
276 unsigned int reg, unsigned int value);
277int snd_soc_cache_read(struct snd_soc_codec *codec,
278 unsigned int reg, unsigned int *value);
267 279
268/* Utility functions to get clock rates from various things */ 280/* Utility functions to get clock rates from various things */
269int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); 281int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots);
@@ -420,23 +432,37 @@ struct snd_soc_ops {
420 int (*trigger)(struct snd_pcm_substream *, int); 432 int (*trigger)(struct snd_pcm_substream *, int);
421}; 433};
422 434
435/* SoC cache ops */
436struct snd_soc_cache_ops {
437 const char *name;
438 enum snd_soc_compress_type id;
439 int (*init)(struct snd_soc_codec *codec);
440 int (*exit)(struct snd_soc_codec *codec);
441 int (*read)(struct snd_soc_codec *codec, unsigned int reg,
442 unsigned int *value);
443 int (*write)(struct snd_soc_codec *codec, unsigned int reg,
444 unsigned int value);
445 int (*sync)(struct snd_soc_codec *codec);
446};
447
423/* SoC Audio Codec device */ 448/* SoC Audio Codec device */
424struct snd_soc_codec { 449struct snd_soc_codec {
425 const char *name; 450 const char *name;
451 const char *name_prefix;
426 int id; 452 int id;
427 struct device *dev; 453 struct device *dev;
428 struct snd_soc_codec_driver *driver; 454 const struct snd_soc_codec_driver *driver;
429 455
430 struct mutex mutex; 456 struct mutex mutex;
431 struct snd_soc_card *card; 457 struct snd_soc_card *card;
432 struct list_head list; 458 struct list_head list;
433 struct list_head card_list; 459 struct list_head card_list;
434 int num_dai; 460 int num_dai;
461 enum snd_soc_compress_type compress_type;
435 462
436 /* runtime */ 463 /* runtime */
437 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 464 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
438 unsigned int active; 465 unsigned int active;
439 unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */
440 unsigned int cache_only:1; /* Suppress writes to hardware */ 466 unsigned int cache_only:1; /* Suppress writes to hardware */
441 unsigned int cache_sync:1; /* Cache needs to be synced to hardware */ 467 unsigned int cache_sync:1; /* Cache needs to be synced to hardware */
442 unsigned int suspended:1; /* Codec is in suspend PM state */ 468 unsigned int suspended:1; /* Codec is in suspend PM state */
@@ -444,25 +470,25 @@ struct snd_soc_codec {
444 unsigned int ac97_registered:1; /* Codec has been AC97 registered */ 470 unsigned int ac97_registered:1; /* Codec has been AC97 registered */
445 unsigned int ac97_created:1; /* Codec has been created by SoC */ 471 unsigned int ac97_created:1; /* Codec has been created by SoC */
446 unsigned int sysfs_registered:1; /* codec has been sysfs registered */ 472 unsigned int sysfs_registered:1; /* codec has been sysfs registered */
473 unsigned int cache_init:1; /* codec cache has been initialized */
447 474
448 /* codec IO */ 475 /* codec IO */
449 void *control_data; /* codec control (i2c/3wire) data */ 476 void *control_data; /* codec control (i2c/3wire) data */
450 hw_write_t hw_write; 477 hw_write_t hw_write;
451 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int); 478 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int);
479 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
480 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
452 void *reg_cache; 481 void *reg_cache;
482 const void *reg_def_copy;
483 const struct snd_soc_cache_ops *cache_ops;
484 struct mutex cache_rw_mutex;
453 485
454 /* dapm */ 486 /* dapm */
455 u32 pop_time; 487 struct snd_soc_dapm_context dapm;
456 struct list_head dapm_widgets;
457 struct list_head dapm_paths;
458 enum snd_soc_bias_level bias_level;
459 enum snd_soc_bias_level suspend_bias_level;
460 struct delayed_work delayed_work;
461 488
462#ifdef CONFIG_DEBUG_FS 489#ifdef CONFIG_DEBUG_FS
463 struct dentry *debugfs_codec_root; 490 struct dentry *debugfs_codec_root;
464 struct dentry *debugfs_reg; 491 struct dentry *debugfs_reg;
465 struct dentry *debugfs_pop_time;
466 struct dentry *debugfs_dapm; 492 struct dentry *debugfs_dapm;
467#endif 493#endif
468}; 494};
@@ -488,6 +514,7 @@ struct snd_soc_codec_driver {
488 short reg_cache_step; 514 short reg_cache_step;
489 short reg_word_size; 515 short reg_word_size;
490 const void *reg_cache_default; 516 const void *reg_cache_default;
517 enum snd_soc_compress_type compress_type;
491 518
492 /* codec bias level */ 519 /* codec bias level */
493 int (*set_bias_level)(struct snd_soc_codec *, 520 int (*set_bias_level)(struct snd_soc_codec *,
@@ -554,6 +581,30 @@ struct snd_soc_dai_link {
554 struct snd_soc_ops *ops; 581 struct snd_soc_ops *ops;
555}; 582};
556 583
584struct snd_soc_codec_conf {
585 const char *dev_name;
586
587 /*
588 * optional map of kcontrol, widget and path name prefixes that are
589 * associated per device
590 */
591 const char *name_prefix;
592
593 /*
594 * set this to the desired compression type if you want to
595 * override the one supplied in codec->driver->compress_type
596 */
597 enum snd_soc_compress_type compress_type;
598};
599
600struct snd_soc_aux_dev {
601 const char *name; /* Codec name */
602 const char *codec_name; /* for multi-codec */
603
604 /* codec/machine specific init - e.g. add machine controls */
605 int (*init)(struct snd_soc_dapm_context *dapm);
606};
607
557/* SoC card */ 608/* SoC card */
558struct snd_soc_card { 609struct snd_soc_card {
559 const char *name; 610 const char *name;
@@ -579,6 +630,8 @@ struct snd_soc_card {
579 /* callbacks */ 630 /* callbacks */
580 int (*set_bias_level)(struct snd_soc_card *, 631 int (*set_bias_level)(struct snd_soc_card *,
581 enum snd_soc_bias_level level); 632 enum snd_soc_bias_level level);
633 int (*set_bias_level_post)(struct snd_soc_card *,
634 enum snd_soc_bias_level level);
582 635
583 long pmdown_time; 636 long pmdown_time;
584 637
@@ -588,12 +641,35 @@ struct snd_soc_card {
588 struct snd_soc_pcm_runtime *rtd; 641 struct snd_soc_pcm_runtime *rtd;
589 int num_rtd; 642 int num_rtd;
590 643
644 /* optional codec specific configuration */
645 struct snd_soc_codec_conf *codec_conf;
646 int num_configs;
647
648 /*
649 * optional auxiliary devices such as amplifiers or codecs with DAI
650 * link unused
651 */
652 struct snd_soc_aux_dev *aux_dev;
653 int num_aux_devs;
654 struct snd_soc_pcm_runtime *rtd_aux;
655 int num_aux_rtd;
656
591 struct work_struct deferred_resume_work; 657 struct work_struct deferred_resume_work;
592 658
593 /* lists of probed devices belonging to this card */ 659 /* lists of probed devices belonging to this card */
594 struct list_head codec_dev_list; 660 struct list_head codec_dev_list;
595 struct list_head platform_dev_list; 661 struct list_head platform_dev_list;
596 struct list_head dai_dev_list; 662 struct list_head dai_dev_list;
663
664 struct list_head widgets;
665 struct list_head paths;
666 struct list_head dapm_list;
667
668#ifdef CONFIG_DEBUG_FS
669 struct dentry *debugfs_card_root;
670 struct dentry *debugfs_pop_time;
671#endif
672 u32 pop_time;
597}; 673};
598 674
599/* SoC machine DAI configuration, glues a codec and cpu DAI together */ 675/* SoC machine DAI configuration, glues a codec and cpu DAI together */
@@ -639,17 +715,9 @@ struct soc_enum {
639}; 715};
640 716
641/* codec IO */ 717/* codec IO */
642static inline unsigned int snd_soc_read(struct snd_soc_codec *codec, 718unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
643 unsigned int reg) 719unsigned int snd_soc_write(struct snd_soc_codec *codec,
644{ 720 unsigned int reg, unsigned int val);
645 return codec->driver->read(codec, reg);
646}
647
648static inline unsigned int snd_soc_write(struct snd_soc_codec *codec,
649 unsigned int reg, unsigned int val)
650{
651 return codec->driver->write(codec, reg, val);
652}
653 721
654/* device driver data */ 722/* device driver data */
655 723