00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __ALSA_TOPOLOGY_H
00022 #define __ALSA_TOPOLOGY_H
00023
00024 #include <stdint.h>
00025
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029
00462 #define SND_TPLG_MAX_CHAN 8
00463
00465 typedef struct snd_tplg snd_tplg_t;
00466
00468 enum snd_tplg_type {
00469 SND_TPLG_TYPE_TLV = 0,
00470 SND_TPLG_TYPE_MIXER,
00471 SND_TPLG_TYPE_ENUM,
00472 SND_TPLG_TYPE_TEXT,
00473 SND_TPLG_TYPE_DATA,
00474 SND_TPLG_TYPE_BYTES,
00475 SND_TPLG_TYPE_STREAM_CONFIG,
00476 SND_TPLG_TYPE_STREAM_CAPS,
00477 SND_TPLG_TYPE_PCM,
00478 SND_TPLG_TYPE_DAPM_WIDGET,
00479 SND_TPLG_TYPE_DAPM_GRAPH,
00480 SND_TPLG_TYPE_BE,
00481 SND_TPLG_TYPE_CC,
00482 SND_TPLG_TYPE_MANIFEST,
00483 };
00484
00489 snd_tplg_t *snd_tplg_new(void);
00490
00495 void snd_tplg_free(snd_tplg_t *tplg);
00496
00504 int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile,
00505 const char *outfile);
00506
00512 void snd_tplg_verbose(snd_tplg_t *tplg, int verbose);
00513
00517 struct snd_tplg_tlv_template {
00518 int type;
00519 };
00520
00524 struct snd_tplg_tlv_dbscale_template {
00525 struct snd_tplg_tlv_template hdr;
00526 int min;
00527 int step;
00528 int mute;
00529 };
00530
00534 struct snd_tplg_channel_elem {
00535 int size;
00536 int reg;
00537 int shift;
00538 int id;
00539 };
00540
00544 struct snd_tplg_channel_map_template {
00545 int num_channels;
00546 struct snd_tplg_channel_elem channel[SND_TPLG_MAX_CHAN];
00547 };
00548
00552 struct snd_tplg_pdata_template {
00553 unsigned int length;
00554 const void *data;
00555 };
00556
00560 struct snd_tplg_io_ops_template {
00561 int get;
00562 int put;
00563 int info;
00564 };
00565
00569 struct snd_tplg_ctl_template {
00570 int type;
00571 const char *name;
00572 int access;
00573 struct snd_tplg_io_ops_template ops;
00574 struct snd_tplg_tlv_template *tlv;
00575 };
00576
00580 struct snd_tplg_mixer_template {
00581 struct snd_tplg_ctl_template hdr;
00582 struct snd_tplg_channel_map_template *map;
00583 int min;
00584 int max;
00585 int platform_max;
00586 int invert;
00587 struct snd_soc_tplg_private *priv;
00588 };
00589
00593 struct snd_tplg_enum_template {
00594 struct snd_tplg_ctl_template hdr;
00595 struct snd_tplg_channel_map_template *map;
00596 int items;
00597 int mask;
00598 const char **texts;
00599 const int **values;
00600 struct snd_soc_tplg_private *priv;
00601 };
00602
00606 struct snd_tplg_bytes_template {
00607 struct snd_tplg_ctl_template hdr;
00608 int max;
00609 int mask;
00610 int base;
00611 int num_regs;
00612 struct snd_tplg_io_ops_template ext_ops;
00613 struct snd_soc_tplg_private *priv;
00614 };
00615
00619 struct snd_tplg_graph_elem {
00620 const char *src;
00621 const char *ctl;
00622 const char *sink;
00623 };
00624
00628 struct snd_tplg_graph_template {
00629 int count;
00630 struct snd_tplg_graph_elem elem[0];
00631 };
00632
00636 struct snd_tplg_widget_template {
00637 int id;
00638 const char *name;
00639 const char *sname;
00640 int reg;
00641 int shift;
00642 int mask;
00643 int subseq;
00644 unsigned int invert;
00645 unsigned int ignore_suspend;
00646 unsigned short event_flags;
00647 unsigned short event_type;
00648 struct snd_soc_tplg_private *priv;
00649 int num_ctls;
00650 struct snd_tplg_ctl_template *ctl[0];
00651 };
00652
00656 struct snd_tplg_stream_template {
00657 const char *name;
00658 int format;
00659 int rate;
00660 int period_bytes;
00661 int buffer_bytes;
00662 int channels;
00663 };
00664
00668 struct snd_tplg_stream_caps_template {
00669 const char *name;
00670 uint64_t formats;
00671 unsigned int rates;
00672 unsigned int rate_min;
00673 unsigned int rate_max;
00674 unsigned int channels_min;
00675 unsigned int channels_max;
00676 unsigned int periods_min;
00677 unsigned int periods_max;
00678 unsigned int period_size_min;
00679 unsigned int period_size_max;
00680 unsigned int buffer_size_min;
00681 unsigned int buffer_size_max;
00682 };
00683
00687 struct snd_tplg_pcm_template {
00688 const char *pcm_name;
00689 const char *dai_name;
00690 unsigned int pcm_id;
00691 unsigned int dai_id;
00692 unsigned int playback;
00693 unsigned int capture;
00694 unsigned int compress;
00695 struct snd_tplg_stream_caps_template *caps[2];
00696 int num_streams;
00697 struct snd_tplg_stream_template stream[0];
00698 };
00699
00703 struct snd_tplg_link_template {
00704 const char *name;
00705 int id;
00706 int num_streams;
00707 struct snd_tplg_stream_template stream[0];
00708 };
00709
00713 typedef struct snd_tplg_obj_template {
00714 enum snd_tplg_type type;
00715 int index;
00716 int version;
00717 int vendor_type;
00718 union {
00719 struct snd_tplg_widget_template *widget;
00720 struct snd_tplg_mixer_template *mixer;
00721 struct snd_tplg_bytes_template *bytes_ctl;
00722 struct snd_tplg_enum_template *enum_ctl;
00723 struct snd_tplg_graph_template *graph;
00724 struct snd_tplg_pcm_template *pcm;
00725 struct snd_tplg_link_template *link;
00726 };
00727 } snd_tplg_obj_template_t;
00728
00735 int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t);
00736
00743 int snd_tplg_build(snd_tplg_t *tplg, const char *outfile);
00744
00752 int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len);
00753
00760 int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version);
00761
00762
00763
00764 #ifdef __cplusplus
00765 }
00766 #endif
00767
00768 #endif