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
00727 #define SND_TPLG_MAX_CHAN 8
00728
00730 typedef struct snd_tplg snd_tplg_t;
00731
00733 enum snd_tplg_type {
00734 SND_TPLG_TYPE_TLV = 0,
00735 SND_TPLG_TYPE_MIXER,
00736 SND_TPLG_TYPE_ENUM,
00737 SND_TPLG_TYPE_TEXT,
00738 SND_TPLG_TYPE_DATA,
00739 SND_TPLG_TYPE_BYTES,
00740 SND_TPLG_TYPE_STREAM_CONFIG,
00741 SND_TPLG_TYPE_STREAM_CAPS,
00742 SND_TPLG_TYPE_PCM,
00743 SND_TPLG_TYPE_DAPM_WIDGET,
00744 SND_TPLG_TYPE_DAPM_GRAPH,
00745 SND_TPLG_TYPE_BE,
00746 SND_TPLG_TYPE_CC,
00747 SND_TPLG_TYPE_MANIFEST,
00748 SND_TPLG_TYPE_TOKEN,
00749 SND_TPLG_TYPE_TUPLE,
00750 SND_TPLG_TYPE_LINK,
00751 SND_TPLG_TYPE_HW_CONFIG,
00752 SND_TPLG_TYPE_DAI,
00753 };
00754
00759 snd_tplg_t *snd_tplg_new(void);
00760
00765 void snd_tplg_free(snd_tplg_t *tplg);
00766
00774 int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile,
00775 const char *outfile);
00776
00782 void snd_tplg_verbose(snd_tplg_t *tplg, int verbose);
00783
00787 struct snd_tplg_tlv_template {
00788 int type;
00789 };
00790
00794 struct snd_tplg_tlv_dbscale_template {
00795 struct snd_tplg_tlv_template hdr;
00796 int min;
00797 int step;
00798 int mute;
00799 };
00800
00804 struct snd_tplg_channel_elem {
00805 int size;
00806 int reg;
00807 int shift;
00808 int id;
00809 };
00810
00814 struct snd_tplg_channel_map_template {
00815 int num_channels;
00816 struct snd_tplg_channel_elem channel[SND_TPLG_MAX_CHAN];
00817 };
00818
00822 struct snd_tplg_pdata_template {
00823 unsigned int length;
00824 const void *data;
00825 };
00826
00830 struct snd_tplg_io_ops_template {
00831 int get;
00832 int put;
00833 int info;
00834 };
00835
00839 struct snd_tplg_ctl_template {
00840 int type;
00841 const char *name;
00842 int access;
00843 struct snd_tplg_io_ops_template ops;
00844 struct snd_tplg_tlv_template *tlv;
00845 };
00846
00850 struct snd_tplg_mixer_template {
00851 struct snd_tplg_ctl_template hdr;
00852 struct snd_tplg_channel_map_template *map;
00853 int min;
00854 int max;
00855 int platform_max;
00856 int invert;
00857 struct snd_soc_tplg_private *priv;
00858 };
00859
00863 struct snd_tplg_enum_template {
00864 struct snd_tplg_ctl_template hdr;
00865 struct snd_tplg_channel_map_template *map;
00866 int items;
00867 int mask;
00868 const char **texts;
00869 const int **values;
00870 struct snd_soc_tplg_private *priv;
00871 };
00872
00876 struct snd_tplg_bytes_template {
00877 struct snd_tplg_ctl_template hdr;
00878 int max;
00879 int mask;
00880 int base;
00881 int num_regs;
00882 struct snd_tplg_io_ops_template ext_ops;
00883 struct snd_soc_tplg_private *priv;
00884 };
00885
00889 struct snd_tplg_graph_elem {
00890 const char *src;
00891 const char *ctl;
00892 const char *sink;
00893 };
00894
00898 struct snd_tplg_graph_template {
00899 int count;
00900 struct snd_tplg_graph_elem elem[0];
00901 };
00902
00906 struct snd_tplg_widget_template {
00907 int id;
00908 const char *name;
00909 const char *sname;
00910 int reg;
00911 int shift;
00912 int mask;
00913 int subseq;
00914 unsigned int invert;
00915 unsigned int ignore_suspend;
00916 unsigned short event_flags;
00917 unsigned short event_type;
00918 struct snd_soc_tplg_private *priv;
00919 int num_ctls;
00920 struct snd_tplg_ctl_template *ctl[0];
00921 };
00922
00926 struct snd_tplg_stream_template {
00927 const char *name;
00928 int format;
00929 int rate;
00930 int period_bytes;
00931 int buffer_bytes;
00932 int channels;
00933 };
00934
00938 struct snd_tplg_stream_caps_template {
00939 const char *name;
00940 uint64_t formats;
00941 unsigned int rates;
00942 unsigned int rate_min;
00943 unsigned int rate_max;
00944 unsigned int channels_min;
00945 unsigned int channels_max;
00946 unsigned int periods_min;
00947 unsigned int periods_max;
00948 unsigned int period_size_min;
00949 unsigned int period_size_max;
00950 unsigned int buffer_size_min;
00951 unsigned int buffer_size_max;
00952 unsigned int sig_bits;
00953 };
00954
00958 struct snd_tplg_pcm_template {
00959 const char *pcm_name;
00960 const char *dai_name;
00961 unsigned int pcm_id;
00962 unsigned int dai_id;
00963 unsigned int playback;
00964 unsigned int capture;
00965 unsigned int compress;
00966 struct snd_tplg_stream_caps_template *caps[2];
00967 unsigned int flag_mask;
00968 unsigned int flags;
00969 struct snd_soc_tplg_private *priv;
00970 int num_streams;
00971 struct snd_tplg_stream_template stream[0];
00972 };
00973
00978 struct snd_tplg_hw_config_template {
00979 int id;
00980 unsigned int fmt;
00981 unsigned char clock_gated;
00982 unsigned char invert_bclk;
00983 unsigned char invert_fsync;
00984 unsigned char bclk_master;
00985 unsigned char fsync_master;
00986 unsigned char mclk_direction;
00987 unsigned short reserved;
00988 unsigned int mclk_rate;
00989 unsigned int bclk_rate;
00990 unsigned int fsync_rate;
00991 unsigned int tdm_slots;
00992 unsigned int tdm_slot_width;
00993 unsigned int tx_slots;
00994 unsigned int rx_slots;
00995 unsigned int tx_channels;
00996 unsigned int *tx_chanmap;
00997 unsigned int rx_channels;
00998 unsigned int *rx_chanmap;
00999 };
01000
01005 struct snd_tplg_dai_template {
01006 const char *dai_name;
01007 unsigned int dai_id;
01008 unsigned int playback;
01009 unsigned int capture;
01010 struct snd_tplg_stream_caps_template *caps[2];
01011 unsigned int flag_mask;
01012 unsigned int flags;
01013 struct snd_soc_tplg_private *priv;
01015 };
01016
01020 struct snd_tplg_link_template {
01021 const char *name;
01022 int id;
01023 const char *stream_name;
01025 int num_streams;
01026 struct snd_tplg_stream_template *stream;
01028 struct snd_tplg_hw_config_template *hw_config;
01029 int num_hw_configs;
01030 int default_hw_config_id;
01031
01032 unsigned int flag_mask;
01033 unsigned int flags;
01034 struct snd_soc_tplg_private *priv;
01035 };
01036
01040 typedef struct snd_tplg_obj_template {
01041 enum snd_tplg_type type;
01042 int index;
01043 int version;
01044 int vendor_type;
01045 union {
01046 struct snd_tplg_widget_template *widget;
01047 struct snd_tplg_mixer_template *mixer;
01048 struct snd_tplg_bytes_template *bytes_ctl;
01049 struct snd_tplg_enum_template *enum_ctl;
01050 struct snd_tplg_graph_template *graph;
01051 struct snd_tplg_pcm_template *pcm;
01052 struct snd_tplg_link_template *link;
01053 struct snd_tplg_dai_template *dai;
01054 };
01055 } snd_tplg_obj_template_t;
01056
01063 int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t);
01064
01071 int snd_tplg_build(snd_tplg_t *tplg, const char *outfile);
01072
01080 int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len);
01081
01088 int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version);
01089
01090
01091
01092 #ifdef __cplusplus
01093 }
01094 #endif
01095
01096 #endif