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