ALSA project - the C library reference
topology.h
1 /*
2  *
3  * This library is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU Lesser General Public License as
5  * published by the Free Software Foundation; either version 2.1 of
6  * the License, or (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Copyright (C) 2015 Intel Corporation
18  *
19  */
20 
21 #ifndef __ALSA_TOPOLOGY_H
22 #define __ALSA_TOPOLOGY_H
23 
24 #include <stdint.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
742 #define SND_TPLG_MAX_CHAN 8
743 
745 typedef struct snd_tplg snd_tplg_t;
746 
768 };
769 
771 #define SND_TPLG_INDEX_ALL 0
772 
777 snd_tplg_t *snd_tplg_new(void);
778 
783 void snd_tplg_free(snd_tplg_t *tplg);
784 
792 int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile,
793  const char *outfile);
794 
800 void snd_tplg_verbose(snd_tplg_t *tplg, int verbose);
801 
806  int type;
807 };
808 
814  int min;
815  int step;
816  int mute;
817 };
818 
823  int size;
824  int reg;
825  int shift;
826  int id;
827 };
828 
835 };
836 
841  unsigned int length;
842  const void *data;
843 };
844 
849  int get;
850  int put;
851  int info;
852 };
853 
858  int type;
859  const char *name;
860  int access;
863 };
864 
871  int min;
872  int max;
874  int invert;
875  struct snd_soc_tplg_private *priv;
876 };
877 
884  int items;
885  int mask;
886  const char **texts;
887  const int **values;
888  struct snd_soc_tplg_private *priv;
889 };
890 
896  int max;
897  int mask;
898  int base;
899  int num_regs;
900  struct snd_tplg_io_ops_template ext_ops;
901  struct snd_soc_tplg_private *priv;
902 };
903 
908  const char *src;
909  const char *ctl;
910  const char *sink;
911 };
912 
917  int count;
918  struct snd_tplg_graph_elem elem[0];
919 };
920 
925  int id;
926  const char *name;
927  const char *sname;
928  int reg;
929  int shift;
930  int mask;
931  int subseq;
932  unsigned int invert;
933  unsigned int ignore_suspend;
934  unsigned short event_flags;
935  unsigned short event_type;
936  struct snd_soc_tplg_private *priv;
937  int num_ctls;
938  struct snd_tplg_ctl_template *ctl[0];
939 };
940 
945  const char *name;
946  int format;
947  int rate;
950  int channels;
951 };
952 
957  const char *name;
958  uint64_t formats;
959  unsigned int rates;
960  unsigned int rate_min;
961  unsigned int rate_max;
962  unsigned int channels_min;
963  unsigned int channels_max;
964  unsigned int periods_min;
965  unsigned int periods_max;
966  unsigned int period_size_min;
967  unsigned int period_size_max;
968  unsigned int buffer_size_min;
969  unsigned int buffer_size_max;
970  unsigned int sig_bits;
971 };
972 
977  const char *pcm_name;
978  const char *dai_name;
979  unsigned int pcm_id;
980  unsigned int dai_id;
981  unsigned int playback;
982  unsigned int capture;
983  unsigned int compress;
985  unsigned int flag_mask;
986  unsigned int flags;
987  struct snd_soc_tplg_private *priv;
989  struct snd_tplg_stream_template stream[0];
990 };
991 
997  int id; /* unique ID - - used to match */
998  unsigned int fmt; /* SND_SOC_DAI_FORMAT_ format value */
999  unsigned char clock_gated; /* 1 if clock can be gated to save power */
1000  unsigned char invert_bclk; /* 1 for inverted BCLK, 0 for normal */
1001  unsigned char invert_fsync; /* 1 for inverted frame clock, 0 for normal */
1002  unsigned char bclk_master; /* 1 for master of BCLK, 0 for slave */
1003  unsigned char fsync_master; /* 1 for master of FSYNC, 0 for slave */
1004  unsigned char mclk_direction; /* 0 for input, 1 for output */
1005  unsigned short reserved; /* for 32bit alignment */
1006  unsigned int mclk_rate; /* MCLK or SYSCLK freqency in Hz */
1007  unsigned int bclk_rate; /* BCLK freqency in Hz */
1008  unsigned int fsync_rate; /* frame clock in Hz */
1009  unsigned int tdm_slots; /* number of TDM slots in use */
1010  unsigned int tdm_slot_width; /* width in bits for each slot */
1011  unsigned int tx_slots; /* bit mask for active Tx slots */
1012  unsigned int rx_slots; /* bit mask for active Rx slots */
1013  unsigned int tx_channels; /* number of Tx channels */
1014  unsigned int *tx_chanmap; /* array of slot number */
1015  unsigned int rx_channels; /* number of Rx channels */
1016  unsigned int *rx_chanmap; /* array of slot number */
1017 };
1018 
1024  const char *dai_name;
1025  unsigned int dai_id;
1026  unsigned int playback;
1027  unsigned int capture;
1029  unsigned int flag_mask;
1030  unsigned int flags;
1031  struct snd_soc_tplg_private *priv;
1033 };
1034 
1039  const char *name;
1040  int id;
1041  const char *stream_name;
1047  int num_hw_configs; /* number of hw configs */
1048  int default_hw_config_id; /* default hw config ID for init */
1049 
1050  unsigned int flag_mask; /* bitmask of flags to configure */
1051  unsigned int flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
1052  struct snd_soc_tplg_private *priv;
1053 };
1054 
1058 typedef struct snd_tplg_obj_template {
1060  int index;
1061  int version;
1063  union {
1072  };
1074 
1082 
1089 int snd_tplg_build(snd_tplg_t *tplg, const char *outfile);
1090 
1098 int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len);
1099 
1106 int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version);
1107 
1108 /* \} */
1109 
1110 #ifdef __cplusplus
1111 }
1112 #endif
1113 
1114 #endif /* __ALSA_TOPOLOGY_H */
Definition: topology.h:752
struct snd_soc_tplg_private * priv
Definition: topology.h:901
const char * ctl
Definition: topology.h:909
const char * name
Definition: topology.h:957
int rate
Definition: topology.h:947
uint64_t formats
Definition: topology.h:958
int items
Definition: topology.h:884
int num_ctls
Definition: topology.h:937
unsigned int flags
Definition: topology.h:1030
const int ** values
Definition: topology.h:887
Template type to describe a physical link runtime supported hardware config, i.e. hardware audio form...
Definition: topology.h:996
struct snd_soc_tplg_private * priv
Definition: topology.h:936
unsigned int flag_mask
Definition: topology.h:1029
Template type for enumerated control objects.
Definition: topology.h:881
Definition: topology.h:822
unsigned int rate_min
Definition: topology.h:960
Template type for array of DAPM graph elements.
Definition: topology.h:916
Definition: topology.h:765
Definition: topology.h:761
int reg
Definition: topology.h:928
Definition: topology.h:762
Template type for DAPM widget objects.
Definition: topology.h:924
snd_tplg_type
Definition: topology.h:748
struct snd_tplg_pcm_template * pcm
Definition: topology.h:1069
int mask
Definition: topology.h:885
struct snd_tplg_enum_template * enum_ctl
Definition: topology.h:1067
struct snd_tplg_bytes_template * bytes_ctl
Definition: topology.h:1066
Definition: topology.h:758
struct snd_soc_tplg_private * priv
Definition: topology.h:875
struct snd_tplg_channel_map_template * map
Definition: topology.h:883
Definition: topology.h:757
int access
Definition: topology.h:860
Definition: topology.h:767
unsigned int dai_id
Definition: topology.h:1025
unsigned int ignore_suspend
Definition: topology.h:933
int subseq
Definition: topology.h:931
int snd_tplg_add_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
Register topology template object.
Definition: parser.c:357
Definition: topology.h:750
snd_tplg_t * snd_tplg_new(void)
Create a new topology parser instance.
Definition: parser.c:450
struct snd_tplg_widget_template * widget
Definition: topology.h:1064
Template type for control objects.
Definition: topology.h:857
int platform_max
Definition: topology.h:873
unsigned int length
Definition: topology.h:841
Definition: topology.h:1058
unsigned int buffer_size_max
Definition: topology.h:969
unsigned int invert
Definition: topology.h:932
struct snd_soc_tplg_private * priv
Definition: topology.h:888
unsigned int rate_max
Definition: topology.h:961
int count
Definition: topology.h:917
const char * dai_name
Definition: topology.h:978
const char * name
Definition: topology.h:926
int format
Definition: topology.h:946
Definition: topology.h:763
struct snd_tplg snd_tplg_t
Definition: topology.h:745
int reg
Definition: topology.h:824
Template type for TLV Scale objects.
Definition: topology.h:812
int vendor_type
Definition: topology.h:1062
Stream configurations.
Definition: topology.h:944
void snd_tplg_free(snd_tplg_t *tplg)
Free a topology parser instance.
Definition: parser.c:487
int max
Definition: topology.h:896
unsigned int capture
Definition: topology.h:982
int max
Definition: topology.h:872
int shift
Definition: topology.h:929
int buffer_bytes
Definition: topology.h:949
int mute
Definition: topology.h:816
int num_regs
Definition: topology.h:899
struct snd_tplg_mixer_template * mixer
Definition: topology.h:1065
Definition: topology.h:753
#define SND_TPLG_MAX_CHAN
Definition: topology.h:742
unsigned short event_type
Definition: topology.h:935
Generic Template Object.
Template type for PCM (FE DAI & DAI links).
Definition: topology.h:976
const char ** texts
Definition: topology.h:886
int snd_tplg_build_file(snd_tplg_t *tplg, const char *infile, const char *outfile)
Parse and build topology text file into binary file.
Definition: parser.c:311
int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version)
Set an optional vendor specific version number.
Definition: parser.c:428
struct snd_soc_tplg_private * priv
Definition: topology.h:987
unsigned int buffer_size_min
Definition: topology.h:968
const char * src
Definition: topology.h:908
struct snd_tplg_dai_template * dai
Definition: topology.h:1071
Template type for single DAPM graph element.
Definition: topology.h:907
Definition: topology.h:755
int min
Definition: topology.h:814
void snd_tplg_verbose(snd_tplg_t *tplg, int verbose)
Enable verbose reporting of binary file output.
Definition: parser.c:435
const char * sink
Definition: topology.h:910
Template type for TLV Scale objects.
Definition: topology.h:894
int id
Definition: topology.h:925
Template type for object operations mapping.
Definition: topology.h:848
int put
Definition: topology.h:850
unsigned int capture
Definition: topology.h:1027
struct snd_tplg_channel_map_template * map
Definition: topology.h:870
int mask
Definition: topology.h:897
unsigned int flag_mask
Definition: topology.h:985
Definition: topology.h:766
unsigned int pcm_id
Definition: topology.h:979
Template type for all TLV objects.
Definition: topology.h:805
unsigned int len
Definition: seq_event.h:198
unsigned int periods_max
Definition: topology.h:965
const char * name
Definition: topology.h:859
Template type for physical DAI. It can be used to configure backend DAIs for DPCM.
Definition: topology.h:1023
Definition: topology.h:756
Definition: topology.h:764
int mask
Definition: topology.h:930
unsigned int periods_min
Definition: topology.h:964
unsigned int sig_bits
Definition: topology.h:970
Definition: topology.h:759
unsigned short event_flags
Definition: topology.h:934
Definition: topology.h:760
Definition: topology.h:749
int shift
Definition: topology.h:825
const void * data
Definition: topology.h:842
int invert
Definition: topology.h:874
int num_streams
Definition: topology.h:988
int type
Definition: topology.h:806
int size
Definition: topology.h:823
struct snd_tplg_graph_template * graph
Definition: topology.h:1068
Template type for mixer control objects.
Definition: topology.h:868
struct snd_soc_tplg_private * priv
Definition: topology.h:1031
struct snd_tplg_link_template * link
Definition: topology.h:1070
unsigned int channels_min
Definition: topology.h:962
const char * name
Definition: topology.h:945
const char * sname
Definition: topology.h:927
unsigned int dai_id
Definition: topology.h:980
int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len)
Attach private data to topology manifest.
Definition: parser.c:413
unsigned int playback
Definition: topology.h:981
int type
Definition: topology.h:858
int channels
Definition: topology.h:950
int num_channels
Definition: topology.h:833
unsigned int period_size_min
Definition: topology.h:966
Template type for channel mapping.
Definition: topology.h:832
unsigned int period_size_max
Definition: topology.h:967
unsigned int compress
Definition: topology.h:983
int min
Definition: topology.h:871
unsigned int playback
Definition: topology.h:1026
unsigned int channels_max
Definition: topology.h:963
struct snd_tplg_tlv_template * tlv
Definition: topology.h:862
int base
Definition: topology.h:898
int info
Definition: topology.h:851
unsigned int flags
Definition: topology.h:986
int snd_tplg_build(snd_tplg_t *tplg, const char *outfile)
Build all registered topology data into binary file.
Definition: parser.c:384
int step
Definition: topology.h:815
Definition: topology.h:754
unsigned int rates
Definition: topology.h:959
int index
Definition: topology.h:1060
const char * dai_name
Definition: topology.h:1024
Template type for private data objects.
Definition: topology.h:840
int id
Definition: topology.h:826
Stream Capabilities.
Definition: topology.h:956
int period_bytes
Definition: topology.h:948
int version
Definition: topology.h:1061
Definition: topology.h:751
const char * pcm_name
Definition: topology.h:977