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
00629 #define SND_TPLG_MAX_CHAN 8
00630
00632 typedef struct snd_tplg snd_tplg_t;
00633
00635 enum snd_tplg_type {
00636 SND_TPLG_TYPE_TLV = 0,
00637 SND_TPLG_TYPE_MIXER,
00638 SND_TPLG_TYPE_ENUM,
00639 SND_TPLG_TYPE_TEXT,
00640 SND_TPLG_TYPE_DATA,
00641 SND_TPLG_TYPE_BYTES,
00642 SND_TPLG_TYPE_STREAM_CONFIG,
00643 SND_TPLG_TYPE_STREAM_CAPS,
00644 SND_TPLG_TYPE_PCM,
00645 SND_TPLG_TYPE_DAPM_WIDGET,
00646 SND_TPLG_TYPE_DAPM_GRAPH,
00647 SND_TPLG_TYPE_BE,
00648 SND_TPLG_TYPE_CC,
00649 SND_TPLG_TYPE_MANIFEST,
00650 SND_TPLG_TYPE_TOKEN,
00651 SND_TPLG_TYPE_TUPLE,
00652 };
00653
00658 snd_tplg_t *snd_tplg_new(void);
00659
00664 void snd_tplg_free(snd_tplg_t *tplg);
00665
00673 int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile,
00674 const char *outfile);
00675
00681 void snd_tplg_verbose(snd_tplg_t *tplg, int verbose);
00682
00686 struct snd_tplg_tlv_template {
00687 int type;
00688 };
00689
00693 struct snd_tplg_tlv_dbscale_template {
00694 struct snd_tplg_tlv_template hdr;
00695 int min;
00696 int step;
00697 int mute;
00698 };
00699
00703 struct snd_tplg_channel_elem {
00704 int size;
00705 int reg;
00706 int shift;
00707 int id;
00708 };
00709
00713 struct snd_tplg_channel_map_template {
00714 int num_channels;
00715 struct snd_tplg_channel_elem channel[SND_TPLG_MAX_CHAN];
00716 };
00717
00721 struct snd_tplg_pdata_template {
00722 unsigned int length;
00723 const void *data;
00724 };
00725
00729 struct snd_tplg_io_ops_template {
00730 int get;
00731 int put;
00732 int info;
00733 };
00734
00738 struct snd_tplg_ctl_template {
00739 int type;
00740 const char *name;
00741 int access;
00742 struct snd_tplg_io_ops_template ops;
00743 struct snd_tplg_tlv_template *tlv;
00744 };
00745
00749 struct snd_tplg_mixer_template {
00750 struct snd_tplg_ctl_template hdr;
00751 struct snd_tplg_channel_map_template *map;
00752 int min;
00753 int max;
00754 int platform_max;
00755 int invert;
00756 struct snd_soc_tplg_private *priv;
00757 };
00758
00762 struct snd_tplg_enum_template {
00763 struct snd_tplg_ctl_template hdr;
00764 struct snd_tplg_channel_map_template *map;
00765 int items;
00766 int mask;
00767 const char **texts;
00768 const int **values;
00769 struct snd_soc_tplg_private *priv;
00770 };
00771
00775 struct snd_tplg_bytes_template {
00776 struct snd_tplg_ctl_template hdr;
00777 int max;
00778 int mask;
00779 int base;
00780 int num_regs;
00781 struct snd_tplg_io_ops_template ext_ops;
00782 struct snd_soc_tplg_private *priv;
00783 };
00784
00788 struct snd_tplg_graph_elem {
00789 const char *src;
00790 const char *ctl;
00791 const char *sink;
00792 };
00793
00797 struct snd_tplg_graph_template {
00798 int count;
00799 struct snd_tplg_graph_elem elem[0];
00800 };
00801
00805 struct snd_tplg_widget_template {
00806 int id;
00807 const char *name;
00808 const char *sname;
00809 int reg;
00810 int shift;
00811 int mask;
00812 int subseq;
00813 unsigned int invert;
00814 unsigned int ignore_suspend;
00815 unsigned short event_flags;
00816 unsigned short event_type;
00817 struct snd_soc_tplg_private *priv;
00818 int num_ctls;
00819 struct snd_tplg_ctl_template *ctl[0];
00820 };
00821
00825 struct snd_tplg_stream_template {
00826 const char *name;
00827 int format;
00828 int rate;
00829 int period_bytes;
00830 int buffer_bytes;
00831 int channels;
00832 };
00833
00837 struct snd_tplg_stream_caps_template {
00838 const char *name;
00839 uint64_t formats;
00840 unsigned int rates;
00841 unsigned int rate_min;
00842 unsigned int rate_max;
00843 unsigned int channels_min;
00844 unsigned int channels_max;
00845 unsigned int periods_min;
00846 unsigned int periods_max;
00847 unsigned int period_size_min;
00848 unsigned int period_size_max;
00849 unsigned int buffer_size_min;
00850 unsigned int buffer_size_max;
00851 };
00852
00856 struct snd_tplg_pcm_template {
00857 const char *pcm_name;
00858 const char *dai_name;
00859 unsigned int pcm_id;
00860 unsigned int dai_id;
00861 unsigned int playback;
00862 unsigned int capture;
00863 unsigned int compress;
00864 struct snd_tplg_stream_caps_template *caps[2];
00865 int num_streams;
00866 struct snd_tplg_stream_template stream[0];
00867 };
00868
00872 struct snd_tplg_link_template {
00873 const char *name;
00874 int id;
00875 int num_streams;
00876 struct snd_tplg_stream_template stream[0];
00877 };
00878
00882 typedef struct snd_tplg_obj_template {
00883 enum snd_tplg_type type;
00884 int index;
00885 int version;
00886 int vendor_type;
00887 union {
00888 struct snd_tplg_widget_template *widget;
00889 struct snd_tplg_mixer_template *mixer;
00890 struct snd_tplg_bytes_template *bytes_ctl;
00891 struct snd_tplg_enum_template *enum_ctl;
00892 struct snd_tplg_graph_template *graph;
00893 struct snd_tplg_pcm_template *pcm;
00894 struct snd_tplg_link_template *link;
00895 };
00896 } snd_tplg_obj_template_t;
00897
00904 int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t);
00905
00912 int snd_tplg_build(snd_tplg_t *tplg, const char *outfile);
00913
00921 int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len);
00922
00929 int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version);
00930
00931
00932
00933 #ifdef __cplusplus
00934 }
00935 #endif
00936
00937 #endif