soc.h (ca9eed76133c00e7f4b1eeb4c1a6cb800cd2654c) | soc.h (3ba9e10a6d3b6abf5f5952572cff8f8d5a35ae54) |
---|---|
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 --- 7 unchanged lines hidden (view full) --- 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 | 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 --- 7 unchanged lines hidden (view full) --- 16#include <linux/platform_device.h> 17#include <linux/types.h> 18#include <linux/workqueue.h> 19#include <sound/core.h> 20#include <sound/pcm.h> 21#include <sound/control.h> 22#include <sound/ac97_codec.h> 23 |
24#define SND_SOC_VERSION "0.13.2" 25 | |
26/* 27 * Convenience kcontrol builders 28 */ 29#define SOC_SINGLE_VALUE(xreg, xshift, xmax, xinvert) \ 30 ((unsigned long)&(struct soc_mixer_control) \ 31 {.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \ 32 .invert = xinvert}) 33#define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ --- 106 unchanged lines hidden (view full) --- 140 */ 141enum snd_soc_bias_level { 142 SND_SOC_BIAS_ON, 143 SND_SOC_BIAS_PREPARE, 144 SND_SOC_BIAS_STANDBY, 145 SND_SOC_BIAS_OFF, 146}; 147 | 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) \ --- 106 unchanged lines hidden (view full) --- 138 */ 139enum 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 |
148/* 149 * Digital Audio Interface (DAI) types 150 */ 151#define SND_SOC_DAI_AC97 0x1 152#define SND_SOC_DAI_I2S 0x2 153#define SND_SOC_DAI_PCM 0x4 154#define SND_SOC_DAI_AC97_BUS 0x8 /* for custom i.e. non ac97_codec.c */ 155 156/* 157 * DAI hardware audio formats 158 */ 159#define SND_SOC_DAIFMT_I2S 0 /* I2S mode */ 160#define SND_SOC_DAIFMT_RIGHT_J 1 /* Right justified mode */ 161#define SND_SOC_DAIFMT_LEFT_J 2 /* Left Justified mode */ 162#define SND_SOC_DAIFMT_DSP_A 3 /* L data msb after FRM or LRC */ 163#define SND_SOC_DAIFMT_DSP_B 4 /* L data msb during FRM or LRC */ 164#define SND_SOC_DAIFMT_AC97 5 /* AC97 */ 165 166#define SND_SOC_DAIFMT_MSB SND_SOC_DAIFMT_LEFT_J 167#define SND_SOC_DAIFMT_LSB SND_SOC_DAIFMT_RIGHT_J 168 169/* 170 * DAI Gating 171 */ 172#define SND_SOC_DAIFMT_CONT (0 << 4) /* continuous clock */ 173#define SND_SOC_DAIFMT_GATED (1 << 4) /* clock is gated when not Tx/Rx */ 174 175/* 176 * DAI Sync 177 * Synchronous LR (Left Right) clocks and Frame signals. 178 */ 179#define SND_SOC_DAIFMT_SYNC (0 << 5) /* Tx FRM = Rx FRM */ 180#define SND_SOC_DAIFMT_ASYNC (1 << 5) /* Tx FRM ~ Rx FRM */ 181 182/* 183 * TDM 184 */ 185#define SND_SOC_DAIFMT_TDM (1 << 6) 186 187/* 188 * DAI hardware signal inversions 189 */ 190#define SND_SOC_DAIFMT_NB_NF (0 << 8) /* normal bclk + frm */ 191#define SND_SOC_DAIFMT_NB_IF (1 << 8) /* normal bclk + inv frm */ 192#define SND_SOC_DAIFMT_IB_NF (2 << 8) /* invert bclk + nor frm */ 193#define SND_SOC_DAIFMT_IB_IF (3 << 8) /* invert bclk + frm */ 194 195/* 196 * DAI hardware clock masters 197 * This is wrt the codec, the inverse is true for the interface 198 * i.e. if the codec is clk and frm master then the interface is 199 * clk and frame slave. 200 */ 201#define SND_SOC_DAIFMT_CBM_CFM (0 << 12) /* codec clk & frm master */ 202#define SND_SOC_DAIFMT_CBS_CFM (1 << 12) /* codec clk slave & frm master */ 203#define SND_SOC_DAIFMT_CBM_CFS (2 << 12) /* codec clk master & frame slave */ 204#define SND_SOC_DAIFMT_CBS_CFS (3 << 12) /* codec clk & frm slave */ 205 206#define SND_SOC_DAIFMT_FORMAT_MASK 0x000f 207#define SND_SOC_DAIFMT_CLOCK_MASK 0x00f0 208#define SND_SOC_DAIFMT_INV_MASK 0x0f00 209#define SND_SOC_DAIFMT_MASTER_MASK 0xf000 210 211 212/* 213 * Master Clock Directions 214 */ 215#define SND_SOC_CLOCK_IN 0 216#define SND_SOC_CLOCK_OUT 1 217 218/* 219 * AC97 codec ID's bitmask 220 */ 221#define SND_SOC_DAI_AC97_ID0 (1 << 0) 222#define SND_SOC_DAI_AC97_ID1 (1 << 1) 223#define SND_SOC_DAI_AC97_ID2 (1 << 2) 224#define SND_SOC_DAI_AC97_ID3 (1 << 3) 225 | |
226struct snd_soc_device; 227struct snd_soc_pcm_stream; 228struct snd_soc_ops; 229struct snd_soc_dai_mode; 230struct snd_soc_pcm_runtime; 231struct snd_soc_dai; 232struct snd_soc_codec; | 146struct snd_soc_device; 147struct snd_soc_pcm_stream; 148struct snd_soc_ops; 149struct snd_soc_dai_mode; 150struct snd_soc_pcm_runtime; 151struct snd_soc_dai; 152struct snd_soc_codec; |
233struct snd_soc_machine_config; | |
234struct soc_enum; 235struct snd_soc_ac97_ops; 236struct snd_soc_clock_info; 237 238typedef int (*hw_write_t)(void *,const char* ,int); 239typedef int (*hw_read_t)(void *,char* ,int); 240 241extern struct snd_ac97_bus_ops soc_ac97_ops; --- 16 unchanged lines hidden (view full) --- 258 unsigned short mask, unsigned short value); 259int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, 260 unsigned short mask, unsigned short value); 261 262int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, 263 struct snd_ac97_bus_ops *ops, int num); 264void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); 265 | 153struct soc_enum; 154struct snd_soc_ac97_ops; 155struct snd_soc_clock_info; 156 157typedef int (*hw_write_t)(void *,const char* ,int); 158typedef int (*hw_read_t)(void *,char* ,int); 159 160extern struct snd_ac97_bus_ops soc_ac97_ops; --- 16 unchanged lines hidden (view full) --- 177 unsigned short mask, unsigned short value); 178int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, 179 unsigned short mask, unsigned short value); 180 181int snd_soc_new_ac97_codec(struct snd_soc_codec *codec, 182 struct snd_ac97_bus_ops *ops, int num); 183void snd_soc_free_ac97_codec(struct snd_soc_codec *codec); 184 |
266/* Digital Audio Interface clocking API.*/ 267int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, 268 unsigned int freq, int dir); 269 270int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai, 271 int div_id, int div); 272 273int snd_soc_dai_set_pll(struct snd_soc_dai *dai, 274 int pll_id, unsigned int freq_in, unsigned int freq_out); 275 276/* Digital Audio interface formatting */ 277int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt); 278 279int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, 280 unsigned int mask, int slots); 281 282int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate); 283 284/* Digital Audio Interface mute */ 285int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute); 286 | |
287/* 288 *Controls 289 */ 290struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, 291 void *data, char *long_name); 292int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, 293 struct snd_ctl_elem_info *uinfo); 294int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol, --- 41 unchanged lines hidden (view full) --- 336 int (*startup)(struct snd_pcm_substream *); 337 void (*shutdown)(struct snd_pcm_substream *); 338 int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *); 339 int (*hw_free)(struct snd_pcm_substream *); 340 int (*prepare)(struct snd_pcm_substream *); 341 int (*trigger)(struct snd_pcm_substream *, int); 342}; 343 | 185/* 186 *Controls 187 */ 188struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template, 189 void *data, char *long_name); 190int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, 191 struct snd_ctl_elem_info *uinfo); 192int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol, --- 41 unchanged lines hidden (view full) --- 234 int (*startup)(struct snd_pcm_substream *); 235 void (*shutdown)(struct snd_pcm_substream *); 236 int (*hw_params)(struct snd_pcm_substream *, struct snd_pcm_hw_params *); 237 int (*hw_free)(struct snd_pcm_substream *); 238 int (*prepare)(struct snd_pcm_substream *); 239 int (*trigger)(struct snd_pcm_substream *, int); 240}; 241 |
344/* ASoC DAI ops */ 345struct snd_soc_dai_ops { 346 /* DAI clocking configuration */ 347 int (*set_sysclk)(struct snd_soc_dai *dai, 348 int clk_id, unsigned int freq, int dir); 349 int (*set_pll)(struct snd_soc_dai *dai, 350 int pll_id, unsigned int freq_in, unsigned int freq_out); 351 int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div); 352 353 /* DAI format configuration */ 354 int (*set_fmt)(struct snd_soc_dai *dai, unsigned int fmt); 355 int (*set_tdm_slot)(struct snd_soc_dai *dai, 356 unsigned int mask, int slots); 357 int (*set_tristate)(struct snd_soc_dai *dai, int tristate); 358 359 /* digital mute */ 360 int (*digital_mute)(struct snd_soc_dai *dai, int mute); 361}; 362 363/* SoC DAI (Digital Audio Interface) */ 364struct snd_soc_dai { 365 /* DAI description */ 366 char *name; 367 unsigned int id; 368 unsigned char type; 369 370 /* DAI callbacks */ 371 int (*probe)(struct platform_device *pdev, 372 struct snd_soc_dai *dai); 373 void (*remove)(struct platform_device *pdev, 374 struct snd_soc_dai *dai); 375 int (*suspend)(struct platform_device *pdev, 376 struct snd_soc_dai *dai); 377 int (*resume)(struct platform_device *pdev, 378 struct snd_soc_dai *dai); 379 380 /* ops */ 381 struct snd_soc_ops ops; 382 struct snd_soc_dai_ops dai_ops; 383 384 /* DAI capabilities */ 385 struct snd_soc_pcm_stream capture; 386 struct snd_soc_pcm_stream playback; 387 388 /* DAI runtime info */ 389 struct snd_pcm_runtime *runtime; 390 struct snd_soc_codec *codec; 391 unsigned int active; 392 unsigned char pop_wait:1; 393 void *dma_data; 394 395 /* DAI private data */ 396 void *private_data; 397}; 398 | |
399/* SoC Audio Codec */ 400struct snd_soc_codec { 401 char *name; 402 struct module *owner; 403 struct mutex mutex; 404 405 /* callbacks */ 406 int (*set_bias_level)(struct snd_soc_codec *, --- 14 unchanged lines hidden (view full) --- 421 size_t, unsigned int); 422 hw_write_t hw_write; 423 hw_read_t hw_read; 424 void *reg_cache; 425 short reg_cache_size; 426 short reg_cache_step; 427 428 /* dapm */ | 242/* SoC Audio Codec */ 243struct snd_soc_codec { 244 char *name; 245 struct module *owner; 246 struct mutex mutex; 247 248 /* callbacks */ 249 int (*set_bias_level)(struct snd_soc_codec *, --- 14 unchanged lines hidden (view full) --- 264 size_t, unsigned int); 265 hw_write_t hw_write; 266 hw_read_t hw_read; 267 void *reg_cache; 268 short reg_cache_size; 269 short reg_cache_step; 270 271 /* dapm */ |
272 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; --- 42 unchanged lines hidden (view full) --- 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 | 273 struct list_head dapm_widgets; 274 struct list_head dapm_paths; 275 enum snd_soc_bias_level bias_level; 276 enum snd_soc_bias_level suspend_bias_level; 277 struct delayed_work delayed_work; 278 279 /* codec DAI's */ 280 struct snd_soc_dai *dai; --- 42 unchanged lines hidden (view full) --- 323 324 /* codec/machine specific init - e.g. add machine controls */ 325 int (*init)(struct snd_soc_codec *codec); 326 327 /* DAI pcm */ 328 struct snd_pcm *pcm; 329}; 330 |
487/* SoC machine */ 488struct snd_soc_machine { | 331/* SoC card */ 332struct snd_soc_card { |
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 */ | 333 char *name; 334 335 int (*probe)(struct platform_device *pdev); 336 int (*remove)(struct platform_device *pdev); 337 338 /* the pre and post PM functions are used to do any PM work before and 339 * after the codec and DAI's do any PM work. */ 340 int (*suspend_pre)(struct platform_device *pdev, pm_message_t state); 341 int (*suspend_post)(struct platform_device *pdev, pm_message_t state); 342 int (*resume_pre)(struct platform_device *pdev); 343 int (*resume_post)(struct platform_device *pdev); 344 345 /* callbacks */ |
502 int (*set_bias_level)(struct snd_soc_machine *, | 346 int (*set_bias_level)(struct snd_soc_card *, |
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 */ 511struct snd_soc_device { 512 struct device *dev; | 347 enum snd_soc_bias_level level); 348 349 /* CPU <--> Codec DAI links */ 350 struct snd_soc_dai_link *dai_link; 351 int num_links; 352}; 353 354/* SoC Device - the audio subsystem */ 355struct snd_soc_device { 356 struct device *dev; |
513 struct snd_soc_machine *machine; | 357 struct snd_soc_card *card; |
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; | 358 struct snd_soc_platform *platform; 359 struct snd_soc_codec *codec; 360 struct snd_soc_codec_device *codec_dev; 361 struct delayed_work delayed_work; 362 struct work_struct deferred_resume_work; 363 void *codec_data; |
364#ifdef CONFIG_DEBUG_FS 365 struct dentry *debugfs_root; 366#endif |
|
520}; 521 522/* runtime channel data */ 523struct snd_soc_pcm_runtime { 524 struct snd_soc_dai_link *dai; 525 struct snd_soc_device *socdev; 526}; 527 --- 9 unchanged lines hidden (view full) --- 537 unsigned short reg2; 538 unsigned char shift_l; 539 unsigned char shift_r; 540 unsigned int max; 541 const char **texts; 542 void *dapm; 543}; 544 | 367}; 368 369/* runtime channel data */ 370struct snd_soc_pcm_runtime { 371 struct snd_soc_dai_link *dai; 372 struct snd_soc_device *socdev; 373}; 374 --- 9 unchanged lines hidden (view full) --- 384 unsigned short reg2; 385 unsigned char shift_l; 386 unsigned char shift_r; 387 unsigned int max; 388 const char **texts; 389 void *dapm; 390}; 391 |
392#include <sound/soc-dai.h> 393 |
|
545#endif | 394#endif |