| .. | .. |
|---|
| 16 | 16 | #include <sound/asoc.h> |
|---|
| 17 | 17 | |
|---|
| 18 | 18 | struct device; |
|---|
| 19 | +struct snd_pcm_substream; |
|---|
| 20 | +struct snd_soc_pcm_runtime; |
|---|
| 21 | +struct soc_enum; |
|---|
| 19 | 22 | |
|---|
| 20 | 23 | /* widget has no PM register bit */ |
|---|
| 21 | 24 | #define SND_SOC_NOPM -1 |
|---|
| .. | .. |
|---|
| 214 | 217 | .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD} |
|---|
| 215 | 218 | |
|---|
| 216 | 219 | /* stream domain */ |
|---|
| 217 | | -#define SND_SOC_DAPM_AIF_IN(wname, stname, wslot, wreg, wshift, winvert) \ |
|---|
| 220 | +#define SND_SOC_DAPM_AIF_IN(wname, stname, wchan, wreg, wshift, winvert) \ |
|---|
| 218 | 221 | { .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \ |
|---|
| 219 | | - SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), } |
|---|
| 220 | | -#define SND_SOC_DAPM_AIF_IN_E(wname, stname, wslot, wreg, wshift, winvert, \ |
|---|
| 222 | + .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), } |
|---|
| 223 | +#define SND_SOC_DAPM_AIF_IN_E(wname, stname, wchan, wreg, wshift, winvert, \ |
|---|
| 221 | 224 | wevent, wflags) \ |
|---|
| 222 | 225 | { .id = snd_soc_dapm_aif_in, .name = wname, .sname = stname, \ |
|---|
| 223 | | - SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ |
|---|
| 226 | + .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ |
|---|
| 224 | 227 | .event = wevent, .event_flags = wflags } |
|---|
| 225 | | -#define SND_SOC_DAPM_AIF_OUT(wname, stname, wslot, wreg, wshift, winvert) \ |
|---|
| 228 | +#define SND_SOC_DAPM_AIF_OUT(wname, stname, wchan, wreg, wshift, winvert) \ |
|---|
| 226 | 229 | { .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \ |
|---|
| 227 | | - SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), } |
|---|
| 228 | | -#define SND_SOC_DAPM_AIF_OUT_E(wname, stname, wslot, wreg, wshift, winvert, \ |
|---|
| 230 | + .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), } |
|---|
| 231 | +#define SND_SOC_DAPM_AIF_OUT_E(wname, stname, wchan, wreg, wshift, winvert, \ |
|---|
| 229 | 232 | wevent, wflags) \ |
|---|
| 230 | 233 | { .id = snd_soc_dapm_aif_out, .name = wname, .sname = stname, \ |
|---|
| 231 | | - SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ |
|---|
| 234 | + .channel = wchan, SND_SOC_DAPM_INIT_REG_VAL(wreg, wshift, winvert), \ |
|---|
| 232 | 235 | .event = wevent, .event_flags = wflags } |
|---|
| 233 | 236 | #define SND_SOC_DAPM_DAC(wname, stname, wreg, wshift, winvert) \ |
|---|
| 234 | 237 | { .id = snd_soc_dapm_dac, .name = wname, .sname = stname, \ |
|---|
| .. | .. |
|---|
| 376 | 379 | struct snd_soc_dapm_update; |
|---|
| 377 | 380 | enum snd_soc_dapm_direction; |
|---|
| 378 | 381 | |
|---|
| 382 | +/* |
|---|
| 383 | + * Bias levels |
|---|
| 384 | + * |
|---|
| 385 | + * @ON: Bias is fully on for audio playback and capture operations. |
|---|
| 386 | + * @PREPARE: Prepare for audio operations. Called before DAPM switching for |
|---|
| 387 | + * stream start and stop operations. |
|---|
| 388 | + * @STANDBY: Low power standby state when no playback/capture operations are |
|---|
| 389 | + * in progress. NOTE: The transition time between STANDBY and ON |
|---|
| 390 | + * should be as fast as possible and no longer than 10ms. |
|---|
| 391 | + * @OFF: Power Off. No restrictions on transition times. |
|---|
| 392 | + */ |
|---|
| 393 | +enum snd_soc_bias_level { |
|---|
| 394 | + SND_SOC_BIAS_OFF = 0, |
|---|
| 395 | + SND_SOC_BIAS_STANDBY = 1, |
|---|
| 396 | + SND_SOC_BIAS_PREPARE = 2, |
|---|
| 397 | + SND_SOC_BIAS_ON = 3, |
|---|
| 398 | +}; |
|---|
| 399 | + |
|---|
| 379 | 400 | int dapm_regulator_event(struct snd_soc_dapm_widget *w, |
|---|
| 380 | 401 | struct snd_kcontrol *kcontrol, int event); |
|---|
| 381 | 402 | int dapm_clock_event(struct snd_soc_dapm_widget *w, |
|---|
| .. | .. |
|---|
| 404 | 425 | struct snd_soc_dapm_widget *snd_soc_dapm_new_control( |
|---|
| 405 | 426 | struct snd_soc_dapm_context *dapm, |
|---|
| 406 | 427 | const struct snd_soc_dapm_widget *widget); |
|---|
| 428 | +struct snd_soc_dapm_widget *snd_soc_dapm_new_control_unlocked( |
|---|
| 429 | + struct snd_soc_dapm_context *dapm, |
|---|
| 430 | + const struct snd_soc_dapm_widget *widget); |
|---|
| 407 | 431 | int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, |
|---|
| 408 | 432 | struct snd_soc_dai *dai); |
|---|
| 409 | 433 | int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card); |
|---|
| 410 | 434 | void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card); |
|---|
| 411 | | -int snd_soc_dapm_new_pcm(struct snd_soc_card *card, |
|---|
| 412 | | - struct snd_soc_pcm_runtime *rtd, |
|---|
| 413 | | - const struct snd_soc_pcm_stream *params, |
|---|
| 414 | | - unsigned int num_params, |
|---|
| 415 | | - struct snd_soc_dapm_widget *source, |
|---|
| 416 | | - struct snd_soc_dapm_widget *sink); |
|---|
| 435 | + |
|---|
| 436 | +int snd_soc_dapm_update_dai(struct snd_pcm_substream *substream, |
|---|
| 437 | + struct snd_pcm_hw_params *params, |
|---|
| 438 | + struct snd_soc_dai *dai); |
|---|
| 417 | 439 | |
|---|
| 418 | 440 | /* dapm path setup */ |
|---|
| 419 | 441 | int snd_soc_dapm_new_widgets(struct snd_soc_card *card); |
|---|
| 420 | 442 | void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm); |
|---|
| 443 | +void snd_soc_dapm_init(struct snd_soc_dapm_context *dapm, |
|---|
| 444 | + struct snd_soc_card *card, |
|---|
| 445 | + struct snd_soc_component *component); |
|---|
| 421 | 446 | int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm, |
|---|
| 422 | 447 | const struct snd_soc_dapm_route *route, int num); |
|---|
| 423 | 448 | int snd_soc_dapm_del_routes(struct snd_soc_dapm_context *dapm, |
|---|
| .. | .. |
|---|
| 430 | 455 | /* dapm events */ |
|---|
| 431 | 456 | void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, |
|---|
| 432 | 457 | int event); |
|---|
| 458 | +void snd_soc_dapm_stream_stop(struct snd_soc_pcm_runtime *rtd, int stream); |
|---|
| 433 | 459 | void snd_soc_dapm_shutdown(struct snd_soc_card *card); |
|---|
| 434 | 460 | |
|---|
| 435 | 461 | /* external DAPM widget events */ |
|---|
| .. | .. |
|---|
| 477 | 503 | struct snd_soc_dapm_widget_list **list, |
|---|
| 478 | 504 | bool (*custom_stop_condition)(struct snd_soc_dapm_widget *, |
|---|
| 479 | 505 | enum snd_soc_dapm_direction)); |
|---|
| 506 | +void snd_soc_dapm_dai_free_widgets(struct snd_soc_dapm_widget_list **list); |
|---|
| 480 | 507 | |
|---|
| 481 | 508 | struct snd_soc_dapm_context *snd_soc_dapm_kcontrol_dapm( |
|---|
| 482 | 509 | struct snd_kcontrol *kcontrol); |
|---|
| .. | .. |
|---|
| 527 | 554 | snd_soc_dapm_asrc, /* DSP/CODEC ASRC component */ |
|---|
| 528 | 555 | snd_soc_dapm_encoder, /* FW/SW audio encoder component */ |
|---|
| 529 | 556 | snd_soc_dapm_decoder, /* FW/SW audio decoder component */ |
|---|
| 557 | + |
|---|
| 558 | + /* Don't edit below this line */ |
|---|
| 559 | + SND_SOC_DAPM_TYPE_COUNT |
|---|
| 530 | 560 | }; |
|---|
| 531 | 561 | |
|---|
| 532 | 562 | enum snd_soc_dapm_subclass { |
|---|
| .. | .. |
|---|
| 548 | 578 | /* Note: currently only supported for links where source is a supply */ |
|---|
| 549 | 579 | int (*connected)(struct snd_soc_dapm_widget *source, |
|---|
| 550 | 580 | struct snd_soc_dapm_widget *sink); |
|---|
| 581 | + |
|---|
| 582 | + struct snd_soc_dobj dobj; |
|---|
| 551 | 583 | }; |
|---|
| 552 | 584 | |
|---|
| 553 | 585 | /* dapm audio path between two widgets */ |
|---|
| .. | .. |
|---|
| 592 | 624 | void *priv; /* widget specific data */ |
|---|
| 593 | 625 | struct regulator *regulator; /* attached regulator */ |
|---|
| 594 | 626 | struct pinctrl *pinctrl; /* attached pinctrl */ |
|---|
| 595 | | - const struct snd_soc_pcm_stream *params; /* params for dai links */ |
|---|
| 596 | | - unsigned int num_params; /* number of params for dai links */ |
|---|
| 597 | | - unsigned int params_select; /* currently selected param for dai link */ |
|---|
| 598 | 627 | |
|---|
| 599 | 628 | /* dapm control */ |
|---|
| 600 | 629 | int reg; /* negative reg = no direct dapm */ |
|---|
| .. | .. |
|---|
| 636 | 665 | int endpoints[2]; |
|---|
| 637 | 666 | |
|---|
| 638 | 667 | struct clk *clk; |
|---|
| 668 | + |
|---|
| 669 | + int channel; |
|---|
| 639 | 670 | }; |
|---|
| 640 | 671 | |
|---|
| 641 | 672 | struct snd_soc_dapm_update { |
|---|
| .. | .. |
|---|
| 659 | 690 | unsigned int idle_bias_off:1; /* Use BIAS_OFF instead of STANDBY */ |
|---|
| 660 | 691 | /* Go to BIAS_OFF in suspend if the DAPM context is idle */ |
|---|
| 661 | 692 | unsigned int suspend_bias_off:1; |
|---|
| 662 | | - void (*seq_notifier)(struct snd_soc_dapm_context *, |
|---|
| 663 | | - enum snd_soc_dapm_type, int); |
|---|
| 664 | 693 | |
|---|
| 665 | 694 | struct device *dev; /* from parent - for debug */ |
|---|
| 666 | 695 | struct snd_soc_component *component; /* parent component */ |
|---|
| .. | .. |
|---|
| 669 | 698 | /* used during DAPM updates */ |
|---|
| 670 | 699 | enum snd_soc_bias_level target_bias_level; |
|---|
| 671 | 700 | struct list_head list; |
|---|
| 672 | | - |
|---|
| 673 | | - int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); |
|---|
| 674 | | - int (*set_bias_level)(struct snd_soc_dapm_context *dapm, |
|---|
| 675 | | - enum snd_soc_bias_level level); |
|---|
| 676 | 701 | |
|---|
| 677 | 702 | struct snd_soc_dapm_wcache path_sink_cache; |
|---|
| 678 | 703 | struct snd_soc_dapm_wcache path_source_cache; |
|---|
| .. | .. |
|---|
| 685 | 710 | /* A list of widgets associated with an object, typically a snd_kcontrol */ |
|---|
| 686 | 711 | struct snd_soc_dapm_widget_list { |
|---|
| 687 | 712 | int num_widgets; |
|---|
| 688 | | - struct snd_soc_dapm_widget *widgets[0]; |
|---|
| 713 | + struct snd_soc_dapm_widget *widgets[]; |
|---|
| 689 | 714 | }; |
|---|
| 690 | 715 | |
|---|
| 716 | +#define for_each_dapm_widgets(list, i, widget) \ |
|---|
| 717 | + for ((i) = 0; \ |
|---|
| 718 | + (i) < list->num_widgets && (widget = list->widgets[i]); \ |
|---|
| 719 | + (i)++) |
|---|
| 720 | + |
|---|
| 691 | 721 | struct snd_soc_dapm_stats { |
|---|
| 692 | 722 | int power_checks; |
|---|
| 693 | 723 | int path_checks; |
|---|