Changeset 598 for GPL/trunk/alsa-kernel/include/sound/soc.h
- Timestamp:
- Apr 3, 2017, 4:51:56 PM (8 years ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
-
Property svn:mergeinfo
set to
/GPL/branches/uniaud32-2.1.x merged eligible
-
Property svn:mergeinfo
set to
-
GPL/trunk/alsa-kernel/include/sound/soc.h
r464 r598 16 16 #include <linux/platform_device.h> 17 17 #include <linux/types.h> 18 #include <linux/notifier.h> 18 19 #include <linux/workqueue.h> 19 20 #include <linux/interrupt.h> … … 30 31 ((unsigned long)&(struct soc_mixer_control) \ 31 32 {.reg = xreg, .shift = xshift, .rshift = xshift, .max = xmax, \ 32 . invert = xinvert})33 .platform_max = xmax, .invert = xinvert}) 33 34 #define SOC_SINGLE_VALUE_EXT(xreg, xmax, xinvert) \ 34 35 ((unsigned long)&(struct soc_mixer_control) \ 35 {.reg = xreg, .max = xmax, . invert = xinvert})36 {.reg = xreg, .max = xmax, .platform_max = xmax, .invert = xinvert}) 36 37 #define SOC_SINGLE(xname, reg, shift, max, invert) \ 37 38 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ … … 53 54 .private_value = (unsigned long)&(struct soc_mixer_control) \ 54 55 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ 55 .max = xmax, . invert = xinvert} }56 .max = xmax, .platform_max = xmax, .invert = xinvert} } 56 57 #define SOC_DOUBLE_R(xname, reg_left, reg_right, xshift, xmax, xinvert) \ 57 58 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ … … 60 61 .private_value = (unsigned long)&(struct soc_mixer_control) \ 61 62 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ 62 .max = xmax, . invert = xinvert} }63 .max = xmax, .platform_max = xmax, .invert = xinvert} } 63 64 #define SOC_DOUBLE_TLV(xname, xreg, shift_left, shift_right, xmax, xinvert, tlv_array) \ 64 65 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ … … 70 71 .private_value = (unsigned long)&(struct soc_mixer_control) \ 71 72 {.reg = xreg, .shift = shift_left, .rshift = shift_right,\ 72 .max = xmax, . invert = xinvert} }73 .max = xmax, .platform_max = xmax, .invert = xinvert} } 73 74 #define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array) \ 74 75 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname),\ … … 80 81 .private_value = (unsigned long)&(struct soc_mixer_control) \ 81 82 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ 82 .max = xmax, . invert = xinvert} }83 .max = xmax, .platform_max = xmax, .invert = xinvert} } 83 84 #define SOC_DOUBLE_S8_TLV(xname, xreg, xmin, xmax, tlv_array) \ 84 85 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ … … 89 90 .put = snd_soc_put_volsw_s8, \ 90 91 .private_value = (unsigned long)&(struct soc_mixer_control) \ 91 {.reg = xreg, .min = xmin, .max = xmax} } 92 {.reg = xreg, .min = xmin, .max = xmax, \ 93 .platform_max = xmax} } 92 94 #define SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmax, xtexts) \ 93 95 { .reg = xreg, .shift_l = xshift_l, .shift_r = xshift_r, \ … … 126 128 .private_value = (unsigned long)&(struct soc_mixer_control) \ 127 129 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ 128 .max = xmax, . invert = xinvert} }130 .max = xmax, .platform_max = xmax, .invert = xinvert} } 129 131 #define SOC_SINGLE_EXT_TLV(xname, xreg, xshift, xmax, xinvert,\ 130 132 xhandler_get, xhandler_put, tlv_array) \ … … 146 148 .private_value = (unsigned long)&(struct soc_mixer_control) \ 147 149 {.reg = xreg, .shift = shift_left, .rshift = shift_right, \ 148 .max = xmax, . invert = xinvert} }150 .max = xmax, .platform_max = xmax, .invert = xinvert} } 149 151 #define SOC_DOUBLE_R_EXT_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert,\ 150 152 xhandler_get, xhandler_put, tlv_array) \ … … 157 159 .private_value = (unsigned long)&(struct soc_mixer_control) \ 158 160 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \ 159 .max = xmax, . invert = xinvert} }161 .max = xmax, .platform_max = xmax, .invert = xinvert} } 160 162 #define SOC_SINGLE_BOOL_EXT(xname, xdata, xhandler_get, xhandler_put) \ 161 163 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ … … 168 170 .get = xhandler_get, .put = xhandler_put, \ 169 171 .private_value = (unsigned long)&xenum } 172 173 #define SOC_DOUBLE_R_SX_TLV(xname, xreg_left, xreg_right, xshift,\ 174 xmin, xmax, tlv_array) \ 175 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \ 176 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 177 SNDRV_CTL_ELEM_ACCESS_READWRITE, \ 178 .tlv.p = (tlv_array), \ 179 .info = snd_soc_info_volsw_2r_sx, \ 180 .get = snd_soc_get_volsw_2r_sx, \ 181 .put = snd_soc_put_volsw_2r_sx, \ 182 .private_value = (unsigned long)&(struct soc_mixer_control) \ 183 {.reg = xreg_left, \ 184 .rreg = xreg_right, .shift = xshift, \ 185 .min = xmin, .max = xmax} } 186 187 188 /* 189 * Simplified versions of above macros, declaring a struct and calculating 190 * ARRAY_SIZE internally 191 */ 192 #define SOC_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xtexts) \ 193 struct soc_enum name = SOC_ENUM_DOUBLE(xreg, xshift_l, xshift_r, \ 194 ARRAY_SIZE(xtexts), xtexts) 195 #define SOC_ENUM_SINGLE_DECL(name, xreg, xshift, xtexts) \ 196 SOC_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xtexts) 197 #define SOC_ENUM_SINGLE_EXT_DECL(name, xtexts) \ 198 struct soc_enum name = SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(xtexts), xtexts) 199 #define SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift_l, xshift_r, xmask, xtexts, xvalues) \ 200 struct soc_enum name = SOC_VALUE_ENUM_DOUBLE(xreg, xshift_l, xshift_r, xmask, \ 201 ARRAY_SIZE(xtexts), xtexts, xvalues) 202 #define SOC_VALUE_ENUM_SINGLE_DECL(name, xreg, xshift, xmask, xtexts, xvalues) \ 203 SOC_VALUE_ENUM_DOUBLE_DECL(name, xreg, xshift, xshift, xmask, xtexts, xvalues) 170 204 171 205 /* … … 181 215 */ 182 216 enum snd_soc_bias_level { 217 SND_SOC_BIAS_OFF, 218 SND_SOC_BIAS_STANDBY, 219 SND_SOC_BIAS_PREPARE, 183 220 SND_SOC_BIAS_ON, 184 SND_SOC_BIAS_PREPARE,185 SND_SOC_BIAS_STANDBY,186 SND_SOC_BIAS_OFF,187 221 }; 188 222 189 223 struct snd_jack; 190 224 struct snd_soc_card; 191 struct snd_soc_device;192 225 struct snd_soc_pcm_stream; 193 226 struct snd_soc_ops; 194 struct snd_soc_dai_mode;195 227 struct snd_soc_pcm_runtime; 196 228 struct snd_soc_dai; 229 struct snd_soc_dai_driver; 197 230 struct snd_soc_platform; 231 struct snd_soc_dai_link; 232 struct snd_soc_platform_driver; 198 233 struct snd_soc_codec; 234 struct snd_soc_codec_driver; 199 235 struct soc_enum; 200 struct snd_soc_ac97_ops;201 236 struct snd_soc_jack; 202 237 struct snd_soc_jack_pin; 238 struct snd_soc_cache_ops; 239 #include <sound/soc-dapm.h> 240 203 241 #ifdef CONFIG_GPIOLIB 204 242 struct snd_soc_jack_gpio; … … 206 244 207 245 typedef int (*hw_write_t)(void *,const char* ,int); 208 typedef int (*hw_read_t)(void *,char* ,int);209 246 210 247 extern struct snd_ac97_bus_ops soc_ac97_ops; … … 216 253 }; 217 254 218 int snd_soc_register_platform(struct snd_soc_platform *platform); 219 void snd_soc_unregister_platform(struct snd_soc_platform *platform); 220 int snd_soc_register_codec(struct snd_soc_codec *codec); 221 void snd_soc_unregister_codec(struct snd_soc_codec *codec); 255 enum snd_soc_compress_type { 256 SND_SOC_FLAT_COMPRESSION = 1, 257 SND_SOC_LZO_COMPRESSION, 258 SND_SOC_RBTREE_COMPRESSION 259 }; 260 261 int snd_soc_register_card(struct snd_soc_card *card); 262 int snd_soc_unregister_card(struct snd_soc_card *card); 263 int snd_soc_register_platform(struct device *dev, 264 struct snd_soc_platform_driver *platform_drv); 265 void snd_soc_unregister_platform(struct device *dev); 266 int snd_soc_register_codec(struct device *dev, 267 const struct snd_soc_codec_driver *codec_drv, 268 struct snd_soc_dai_driver *dai_drv, int num_dai); 269 void snd_soc_unregister_codec(struct device *dev); 222 270 int snd_soc_codec_volatile_register(struct snd_soc_codec *codec, int reg); 223 271 int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, 224 272 int addr_bits, int data_bits, 225 273 enum snd_soc_control_type control); 226 227 #ifdef CONFIG_PM 228 int snd_soc_suspend_device(struct device *dev); 229 int snd_soc_resume_device(struct device *dev); 230 #endif 231 232 /* pcm <-> DAI connect */ 233 void snd_soc_free_pcms(struct snd_soc_device *socdev); 234 int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid); 235 int snd_soc_init_card(struct snd_soc_device *socdev); 274 int snd_soc_cache_sync(struct snd_soc_codec *codec); 275 int snd_soc_cache_init(struct snd_soc_codec *codec); 276 int snd_soc_cache_exit(struct snd_soc_codec *codec); 277 int snd_soc_cache_write(struct snd_soc_codec *codec, 278 unsigned int reg, unsigned int value); 279 int snd_soc_cache_read(struct snd_soc_codec *codec, 280 unsigned int reg, unsigned int *value); 281 int snd_soc_default_volatile_register(struct snd_soc_codec *codec, 282 unsigned int reg); 283 int snd_soc_default_readable_register(struct snd_soc_codec *codec, 284 unsigned int reg); 285 286 /* Utility functions to get clock rates from various things */ 287 int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots); 288 int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params); 289 int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots); 290 int snd_soc_params_to_bclk(struct snd_pcm_hw_params *parms); 236 291 237 292 /* set runtime hw params */ … … 240 295 241 296 /* Jack reporting */ 242 int snd_soc_jack_new(struct snd_soc_c ard *card, const char *id, int type,297 int snd_soc_jack_new(struct snd_soc_codec *codec, const char *id, int type, 243 298 struct snd_soc_jack *jack); 244 299 void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask); 245 300 int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, 246 301 struct snd_soc_jack_pin *pins); 302 void snd_soc_jack_notifier_register(struct snd_soc_jack *jack, 303 struct notifier_block *nb); 304 void snd_soc_jack_notifier_unregister(struct snd_soc_jack *jack, 305 struct notifier_block *nb); 247 306 #ifdef CONFIG_GPIOLIB 248 307 int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count, … … 255 314 int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg, 256 315 unsigned int mask, unsigned int value); 316 int snd_soc_update_bits_locked(struct snd_soc_codec *codec, 317 unsigned short reg, unsigned int mask, 318 unsigned int value); 257 319 int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg, 258 320 unsigned int mask, unsigned int value); … … 302 364 int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol, 303 365 struct snd_ctl_elem_value *ucontrol); 366 int snd_soc_limit_volume(struct snd_soc_codec *codec, 367 const char *name, int max); 368 int snd_soc_info_volsw_2r_sx(struct snd_kcontrol *kcontrol, 369 struct snd_ctl_elem_info *uinfo); 370 int snd_soc_get_volsw_2r_sx(struct snd_kcontrol *kcontrol, 371 struct snd_ctl_elem_value *ucontrol); 372 int snd_soc_put_volsw_2r_sx(struct snd_kcontrol *kcontrol, 373 struct snd_ctl_elem_value *ucontrol); 374 375 /** 376 * struct snd_soc_reg_access - Describes whether a given register is 377 * readable, writable or volatile. 378 * 379 * @reg: the register number 380 * @read: whether this register is readable 381 * @write: whether this register is writable 382 * @vol: whether this register is volatile 383 */ 384 struct snd_soc_reg_access { 385 u16 reg; 386 u16 read; 387 u16 write; 388 u16 vol; 389 }; 304 390 305 391 /** … … 334 420 int debounce_time; 335 421 struct snd_soc_jack *jack; 336 struct work_struct work; 422 struct delayed_work work; 423 424 int (*jack_status_check)(void); 337 425 }; 338 426 #endif … … 340 428 struct snd_soc_jack { 341 429 struct snd_jack *jack; 342 struct snd_soc_c ard *card;430 struct snd_soc_codec *codec; 343 431 struct list_head pins; 344 432 int status; 433 struct blocking_notifier_head notifier; 345 434 }; 346 435 347 436 /* SoC PCM stream information */ 348 437 struct snd_soc_pcm_stream { 349 c har *stream_name;438 const char *stream_name; 350 439 u64 formats; /* SNDRV_PCM_FMTBIT_* */ 351 440 unsigned int rates; /* SNDRV_PCM_RATE_* */ … … 354 443 unsigned int channels_min; /* min channels */ 355 444 unsigned int channels_max; /* max channels */ 356 unsigned int active:1; /* stream is in use */357 445 }; 358 446 … … 367 455 }; 368 456 369 /* SoC Audio Codec */ 457 /* SoC cache ops */ 458 struct snd_soc_cache_ops { 459 const char *name; 460 enum snd_soc_compress_type id; 461 int (*init)(struct snd_soc_codec *codec); 462 int (*exit)(struct snd_soc_codec *codec); 463 int (*read)(struct snd_soc_codec *codec, unsigned int reg, 464 unsigned int *value); 465 int (*write)(struct snd_soc_codec *codec, unsigned int reg, 466 unsigned int value); 467 int (*sync)(struct snd_soc_codec *codec); 468 }; 469 470 /* SoC Audio Codec device */ 370 471 struct snd_soc_codec { 371 char *name; 372 struct module *owner; 472 const char *name; 473 const char *name_prefix; 474 int id; 475 struct device *dev; 476 const struct snd_soc_codec_driver *driver; 477 373 478 struct mutex mutex; 374 struct device *dev; 375 struct snd_soc_device *socdev; 376 479 struct snd_soc_card *card; 377 480 struct list_head list; 378 379 /* callbacks */ 380 int (*set_bias_level)(struct snd_soc_codec *, 381 enum snd_soc_bias_level level); 481 struct list_head card_list; 482 int num_dai; 483 enum snd_soc_compress_type compress_type; 484 size_t reg_size; /* reg_cache_size * reg_word_size */ 485 int (*volatile_register)(struct snd_soc_codec *, unsigned int); 486 int (*readable_register)(struct snd_soc_codec *, unsigned int); 382 487 383 488 /* runtime */ 384 struct snd_card *card;385 489 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 386 490 unsigned int active; 387 unsigned int pcm_devs; 388 void *private_data; 491 unsigned int cache_only:1; /* Suppress writes to hardware */ 492 unsigned int cache_sync:1; /* Cache needs to be synced to hardware */ 493 unsigned int suspended:1; /* Codec is in suspend PM state */ 494 unsigned int probed:1; /* Codec has been probed */ 495 unsigned int ac97_registered:1; /* Codec has been AC97 registered */ 496 unsigned int ac97_created:1; /* Codec has been created by SoC */ 497 unsigned int sysfs_registered:1; /* codec has been sysfs registered */ 498 unsigned int cache_init:1; /* codec cache has been initialized */ 389 499 390 500 /* codec IO */ 391 501 void *control_data; /* codec control (i2c/3wire) data */ 502 hw_write_t hw_write; 503 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int); 504 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 505 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 506 void *reg_cache; 507 const void *reg_def_copy; 508 const struct snd_soc_cache_ops *cache_ops; 509 struct mutex cache_rw_mutex; 510 511 /* dapm */ 512 struct snd_soc_dapm_context dapm; 513 514 #ifdef CONFIG_DEBUG_FS 515 struct dentry *debugfs_codec_root; 516 struct dentry *debugfs_reg; 517 struct dentry *debugfs_dapm; 518 #endif 519 }; 520 521 /* codec driver */ 522 struct snd_soc_codec_driver { 523 524 /* driver ops */ 525 int (*probe)(struct snd_soc_codec *); 526 int (*remove)(struct snd_soc_codec *); 527 int (*suspend)(struct snd_soc_codec *, 528 pm_message_t state); 529 int (*resume)(struct snd_soc_codec *); 530 531 /* codec IO */ 392 532 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 393 533 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 394 534 int (*display_register)(struct snd_soc_codec *, char *, 395 535 size_t, unsigned int); 396 int (*volatile_register)(unsigned int); 397 int (*readable_register)(unsigned int); 398 hw_write_t hw_write; 399 unsigned int (*hw_read)(struct snd_soc_codec *, unsigned int); 400 void *reg_cache; 536 int (*volatile_register)(struct snd_soc_codec *, unsigned int); 537 int (*readable_register)(struct snd_soc_codec *, unsigned int); 401 538 short reg_cache_size; 402 539 short reg_cache_step; 403 404 /* dapm */ 405 u32 pop_time; 406 struct list_head dapm_widgets; 407 struct list_head dapm_paths; 408 enum snd_soc_bias_level bias_level; 409 enum snd_soc_bias_level suspend_bias_level; 410 struct delayed_work delayed_work; 411 412 /* codec DAI's */ 413 struct snd_soc_dai *dai; 414 unsigned int num_dai; 415 416 #ifdef CONFIG_DEBUG_FS 417 struct dentry *debugfs_reg; 418 struct dentry *debugfs_pop_time; 419 struct dentry *debugfs_dapm; 420 #endif 421 }; 422 423 /* codec device */ 424 struct snd_soc_codec_device { 425 int (*probe)(struct platform_device *pdev); 426 int (*remove)(struct platform_device *pdev); 427 int (*suspend)(struct platform_device *pdev, pm_message_t state); 428 int (*resume)(struct platform_device *pdev); 540 short reg_word_size; 541 const void *reg_cache_default; 542 short reg_access_size; 543 const struct snd_soc_reg_access *reg_access_default; 544 enum snd_soc_compress_type compress_type; 545 546 /* codec bias level */ 547 int (*set_bias_level)(struct snd_soc_codec *, 548 enum snd_soc_bias_level level); 429 549 }; 430 550 431 551 /* SoC platform interface */ 432 struct snd_soc_platform { 433 char *name; 434 struct list_head list; 435 436 int (*probe)(struct platform_device *pdev); 437 int (*remove)(struct platform_device *pdev); 552 struct snd_soc_platform_driver { 553 554 int (*probe)(struct snd_soc_platform *); 555 int (*remove)(struct snd_soc_platform *); 438 556 int (*suspend)(struct snd_soc_dai *dai); 439 557 int (*resume)(struct snd_soc_dai *dai); … … 444 562 void (*pcm_free)(struct snd_pcm *); 445 563 564 /* 565 * For platform caused delay reporting. 566 * Optional. 567 */ 568 snd_pcm_sframes_t (*delay)(struct snd_pcm_substream *, 569 struct snd_soc_dai *); 570 446 571 /* platform stream ops */ 447 struct snd_pcm_ops *pcm_ops; 448 }; 449 450 /* SoC machine DAI configuration, glues a codec and cpu DAI together */ 451 struct snd_soc_dai_link { 452 char *name; /* Codec name */ 453 char *stream_name; /* Stream name */ 454 455 /* DAI */ 456 struct snd_soc_dai *codec_dai; 457 struct snd_soc_dai *cpu_dai; 572 struct snd_pcm_ops *ops; 573 }; 574 575 struct snd_soc_platform { 576 const char *name; 577 int id; 578 struct device *dev; 579 struct snd_soc_platform_driver *driver; 580 581 unsigned int suspended:1; /* platform is suspended */ 582 unsigned int probed:1; 583 584 struct snd_soc_card *card; 585 struct list_head list; 586 struct list_head card_list; 587 }; 588 589 struct snd_soc_dai_link { 590 /* config - must be set by machine driver */ 591 const char *name; /* Codec name */ 592 const char *stream_name; /* Stream name */ 593 const char *codec_name; /* for multi-codec */ 594 const char *platform_name; /* for multi-platform */ 595 const char *cpu_dai_name; 596 const char *codec_dai_name; 597 598 /* Keep DAI active over suspend */ 599 unsigned int ignore_suspend:1; 600 601 /* Symmetry requirements */ 602 unsigned int symmetric_rates:1; 603 604 /* codec/machine specific init - e.g. add machine controls */ 605 int (*init)(struct snd_soc_pcm_runtime *rtd); 458 606 459 607 /* machine stream operations */ 460 608 struct snd_soc_ops *ops; 609 }; 610 611 struct snd_soc_codec_conf { 612 const char *dev_name; 613 614 /* 615 * optional map of kcontrol, widget and path name prefixes that are 616 * associated per device 617 */ 618 const char *name_prefix; 619 620 /* 621 * set this to the desired compression type if you want to 622 * override the one supplied in codec->driver->compress_type 623 */ 624 enum snd_soc_compress_type compress_type; 625 }; 626 627 struct snd_soc_aux_dev { 628 const char *name; /* Codec name */ 629 const char *codec_name; /* for multi-codec */ 461 630 462 631 /* codec/machine specific init - e.g. add machine controls */ 463 int (*init)(struct snd_soc_codec *codec); 464 465 /* Symmetry requirements */ 466 unsigned int symmetric_rates:1; 467 468 /* Symmetry data - only valid if symmetry is being enforced */ 469 unsigned int rate; 470 471 /* DAI pcm */ 472 struct snd_pcm *pcm; 632 int (*init)(struct snd_soc_dapm_context *dapm); 473 633 }; 474 634 475 635 /* SoC card */ 476 636 struct snd_soc_card { 477 c har *name;637 const char *name; 478 638 struct device *dev; 639 struct snd_card *snd_card; 640 struct module *owner; 479 641 480 642 struct list_head list; 481 482 int instantiated; 643 struct mutex mutex; 644 645 bool instantiated; 483 646 484 647 int (*probe)(struct platform_device *pdev); … … 495 658 int (*set_bias_level)(struct snd_soc_card *, 496 659 enum snd_soc_bias_level level); 660 int (*set_bias_level_post)(struct snd_soc_card *, 661 enum snd_soc_bias_level level); 662 663 long pmdown_time; 497 664 498 665 /* CPU <--> Codec DAI links */ 499 666 struct snd_soc_dai_link *dai_link; 500 667 int num_links; 501 502 struct snd_soc_device *socdev; 503 668 struct snd_soc_pcm_runtime *rtd; 669 int num_rtd; 670 671 /* optional codec specific configuration */ 672 struct snd_soc_codec_conf *codec_conf; 673 int num_configs; 674 675 /* 676 * optional auxiliary devices such as amplifiers or codecs with DAI 677 * link unused 678 */ 679 struct snd_soc_aux_dev *aux_dev; 680 int num_aux_devs; 681 struct snd_soc_pcm_runtime *rtd_aux; 682 int num_aux_rtd; 683 684 struct work_struct deferred_resume_work; 685 686 /* lists of probed devices belonging to this card */ 687 struct list_head codec_dev_list; 688 struct list_head platform_dev_list; 689 struct list_head dai_dev_list; 690 691 struct list_head widgets; 692 struct list_head paths; 693 struct list_head dapm_list; 694 695 #ifdef CONFIG_DEBUG_FS 696 struct dentry *debugfs_card_root; 697 struct dentry *debugfs_pop_time; 698 #endif 699 u32 pop_time; 700 }; 701 702 /* SoC machine DAI configuration, glues a codec and cpu DAI together */ 703 struct snd_soc_pcm_runtime { 704 struct device dev; 705 struct snd_soc_card *card; 706 struct snd_soc_dai_link *dai_link; 707 708 unsigned int complete:1; 709 unsigned int dev_registered:1; 710 711 /* Symmetry data - only valid if symmetry is being enforced */ 712 unsigned int rate; 713 long pmdown_time; 714 715 /* runtime devices */ 716 struct snd_pcm *pcm; 504 717 struct snd_soc_codec *codec; 505 506 718 struct snd_soc_platform *platform; 719 struct snd_soc_dai *codec_dai; 720 struct snd_soc_dai *cpu_dai; 721 507 722 struct delayed_work delayed_work; 508 struct work_struct deferred_resume_work;509 };510 511 /* SoC Device - the audio subsystem */512 struct snd_soc_device {513 struct device *dev;514 struct snd_soc_card *card;515 struct snd_soc_codec_device *codec_dev;516 void *codec_data;517 };518 519 /* runtime channel data */520 struct snd_soc_pcm_runtime {521 struct snd_soc_dai_link *dai;522 struct snd_soc_device *socdev;523 723 }; 524 724 525 725 /* mixer control */ 526 726 struct soc_mixer_control { 527 int min, max ;727 int min, max, platform_max; 528 728 unsigned int reg, rreg, shift, rshift, invert; 529 729 }; … … 543 743 544 744 /* codec IO */ 545 static inline unsigned int snd_soc_read(struct snd_soc_codec *codec, 546 unsigned int reg) 745 unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); 746 unsigned int snd_soc_write(struct snd_soc_codec *codec, 747 unsigned int reg, unsigned int val); 748 749 /* device driver data */ 750 751 static inline void snd_soc_codec_set_drvdata(struct snd_soc_codec *codec, 752 void *data) 547 753 { 548 return codec->read(codec, reg);754 dev_set_drvdata(codec->dev, data); 549 755 } 550 756 551 static inline unsigned int snd_soc_write(struct snd_soc_codec *codec, 552 unsigned int reg, unsigned int val) 757 static inline void *snd_soc_codec_get_drvdata(struct snd_soc_codec *codec) 553 758 { 554 return codec->write(codec, reg, val);759 return dev_get_drvdata(codec->dev); 555 760 } 556 761 762 static inline void snd_soc_platform_set_drvdata(struct snd_soc_platform *platform, 763 void *data) 764 { 765 dev_set_drvdata(platform->dev, data); 766 } 767 768 static inline void *snd_soc_platform_get_drvdata(struct snd_soc_platform *platform) 769 { 770 return dev_get_drvdata(platform->dev); 771 } 772 773 static inline void snd_soc_pcm_set_drvdata(struct snd_soc_pcm_runtime *rtd, 774 void *data) 775 { 776 dev_set_drvdata(&rtd->dev, data); 777 } 778 779 static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd) 780 { 781 return dev_get_drvdata(&rtd->dev); 782 } 783 784 static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) 785 { 786 INIT_LIST_HEAD(&card->dai_dev_list); 787 INIT_LIST_HEAD(&card->codec_dev_list); 788 INIT_LIST_HEAD(&card->platform_dev_list); 789 INIT_LIST_HEAD(&card->widgets); 790 INIT_LIST_HEAD(&card->paths); 791 INIT_LIST_HEAD(&card->dapm_list); 792 } 793 557 794 #include <sound/soc-dai.h> 558 795 796 #ifdef CONFIG_DEBUG_FS 797 extern struct dentry *snd_soc_debugfs_root; 559 798 #endif 799 800 #endif
Note:
See TracChangeset
for help on using the changeset viewer.