asoc.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM
  4. *
  5. * Copyright (C) 2012 Texas Instruments Inc.
  6. * Copyright (C) 2015 Intel Corporation.
  7. *
  8. * Simple file API to load FW that includes mixers, coefficients, DAPM graphs,
  9. * algorithms, equalisers, DAIs, widgets etc.
  10. */
  11. #ifndef __LINUX_UAPI_SND_ASOC_H
  12. #define __LINUX_UAPI_SND_ASOC_H
  13. #include <linux/types.h>
  14. #include <sound/asound.h>
  15. /*
  16. * Maximum number of channels topology kcontrol can represent.
  17. */
  18. #define SND_SOC_TPLG_MAX_CHAN 8
  19. /*
  20. * Maximum number of PCM formats capability
  21. */
  22. #define SND_SOC_TPLG_MAX_FORMATS 16
  23. /*
  24. * Maximum number of PCM stream configs
  25. */
  26. #define SND_SOC_TPLG_STREAM_CONFIG_MAX 8
  27. /*
  28. * Maximum number of physical link's hardware configs
  29. */
  30. #define SND_SOC_TPLG_HW_CONFIG_MAX 8
  31. /* individual kcontrol info types - can be mixed with other types */
  32. #define SND_SOC_TPLG_CTL_VOLSW 1
  33. #define SND_SOC_TPLG_CTL_VOLSW_SX 2
  34. #define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3
  35. #define SND_SOC_TPLG_CTL_ENUM 4
  36. #define SND_SOC_TPLG_CTL_BYTES 5
  37. #define SND_SOC_TPLG_CTL_ENUM_VALUE 6
  38. #define SND_SOC_TPLG_CTL_RANGE 7
  39. #define SND_SOC_TPLG_CTL_STROBE 8
  40. /* individual widget kcontrol info types - can be mixed with other types */
  41. #define SND_SOC_TPLG_DAPM_CTL_VOLSW 64
  42. #define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65
  43. #define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66
  44. #define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67
  45. #define SND_SOC_TPLG_DAPM_CTL_PIN 68
  46. /* DAPM widget types - add new items to the end */
  47. #define SND_SOC_TPLG_DAPM_INPUT 0
  48. #define SND_SOC_TPLG_DAPM_OUTPUT 1
  49. #define SND_SOC_TPLG_DAPM_MUX 2
  50. #define SND_SOC_TPLG_DAPM_MIXER 3
  51. #define SND_SOC_TPLG_DAPM_PGA 4
  52. #define SND_SOC_TPLG_DAPM_OUT_DRV 5
  53. #define SND_SOC_TPLG_DAPM_ADC 6
  54. #define SND_SOC_TPLG_DAPM_DAC 7
  55. #define SND_SOC_TPLG_DAPM_SWITCH 8
  56. #define SND_SOC_TPLG_DAPM_PRE 9
  57. #define SND_SOC_TPLG_DAPM_POST 10
  58. #define SND_SOC_TPLG_DAPM_AIF_IN 11
  59. #define SND_SOC_TPLG_DAPM_AIF_OUT 12
  60. #define SND_SOC_TPLG_DAPM_DAI_IN 13
  61. #define SND_SOC_TPLG_DAPM_DAI_OUT 14
  62. #define SND_SOC_TPLG_DAPM_DAI_LINK 15
  63. #define SND_SOC_TPLG_DAPM_BUFFER 16
  64. #define SND_SOC_TPLG_DAPM_SCHEDULER 17
  65. #define SND_SOC_TPLG_DAPM_EFFECT 18
  66. #define SND_SOC_TPLG_DAPM_SIGGEN 19
  67. #define SND_SOC_TPLG_DAPM_SRC 20
  68. #define SND_SOC_TPLG_DAPM_ASRC 21
  69. #define SND_SOC_TPLG_DAPM_ENCODER 22
  70. #define SND_SOC_TPLG_DAPM_DECODER 23
  71. #define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DECODER
  72. /* Header magic number and string sizes */
  73. #define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */
  74. /* string sizes */
  75. #define SND_SOC_TPLG_NUM_TEXTS 16
  76. /* ABI version */
  77. #define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */
  78. #define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */
  79. /* Max size of TLV data */
  80. #define SND_SOC_TPLG_TLV_SIZE 32
  81. /*
  82. * File and Block header data types.
  83. * Add new generic and vendor types to end of list.
  84. * Generic types are handled by the core whilst vendors types are passed
  85. * to the component drivers for handling.
  86. */
  87. #define SND_SOC_TPLG_TYPE_MIXER 1
  88. #define SND_SOC_TPLG_TYPE_BYTES 2
  89. #define SND_SOC_TPLG_TYPE_ENUM 3
  90. #define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4
  91. #define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5
  92. #define SND_SOC_TPLG_TYPE_DAI_LINK 6
  93. #define SND_SOC_TPLG_TYPE_PCM 7
  94. #define SND_SOC_TPLG_TYPE_MANIFEST 8
  95. #define SND_SOC_TPLG_TYPE_CODEC_LINK 9
  96. #define SND_SOC_TPLG_TYPE_BACKEND_LINK 10
  97. #define SND_SOC_TPLG_TYPE_PDATA 11
  98. #define SND_SOC_TPLG_TYPE_DAI 12
  99. #define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI
  100. /* vendor block IDs - please add new vendor types to end */
  101. #define SND_SOC_TPLG_TYPE_VENDOR_FW 1000
  102. #define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001
  103. #define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002
  104. #define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003
  105. #define SND_SOC_TPLG_STREAM_PLAYBACK 0
  106. #define SND_SOC_TPLG_STREAM_CAPTURE 1
  107. /* vendor tuple types */
  108. #define SND_SOC_TPLG_TUPLE_TYPE_UUID 0
  109. #define SND_SOC_TPLG_TUPLE_TYPE_STRING 1
  110. #define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2
  111. #define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3
  112. #define SND_SOC_TPLG_TUPLE_TYPE_WORD 4
  113. #define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5
  114. /* DAI flags */
  115. #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0)
  116. #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
  117. #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
  118. /* DAI clock gating */
  119. #define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0
  120. #define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1
  121. #define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2
  122. /* DAI mclk_direction */
  123. #define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */
  124. #define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */
  125. /* DAI physical PCM data formats.
  126. * Add new formats to the end of the list.
  127. */
  128. #define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */
  129. #define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */
  130. #define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */
  131. #define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */
  132. #define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */
  133. #define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */
  134. #define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */
  135. /* left and right justified also known as MSB and LSB respectively */
  136. #define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J
  137. #define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J
  138. /* DAI link flags */
  139. #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0)
  140. #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
  141. #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
  142. #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3)
  143. /* DAI topology BCLK parameter
  144. * For the backwards capability, by default codec is bclk provider
  145. */
  146. #define SND_SOC_TPLG_BCLK_CP 0 /* codec is bclk provider */
  147. #define SND_SOC_TPLG_BCLK_CC 1 /* codec is bclk consumer */
  148. /* keep previous definitions for compatibility */
  149. #define SND_SOC_TPLG_BCLK_CM SND_SOC_TPLG_BCLK_CP
  150. #define SND_SOC_TPLG_BCLK_CS SND_SOC_TPLG_BCLK_CC
  151. /* DAI topology FSYNC parameter
  152. * For the backwards capability, by default codec is fsync provider
  153. */
  154. #define SND_SOC_TPLG_FSYNC_CP 0 /* codec is fsync provider */
  155. #define SND_SOC_TPLG_FSYNC_CC 1 /* codec is fsync consumer */
  156. /* keep previous definitions for compatibility */
  157. #define SND_SOC_TPLG_FSYNC_CM SND_SOC_TPLG_FSYNC_CP
  158. #define SND_SOC_TPLG_FSYNC_CS SND_SOC_TPLG_FSYNC_CC
  159. /*
  160. * Block Header.
  161. * This header precedes all object and object arrays below.
  162. */
  163. struct snd_soc_tplg_hdr {
  164. __le32 magic; /* magic number */
  165. __le32 abi; /* ABI version */
  166. __le32 version; /* optional vendor specific version details */
  167. __le32 type; /* SND_SOC_TPLG_TYPE_ */
  168. __le32 size; /* size of this structure */
  169. __le32 vendor_type; /* optional vendor specific type info */
  170. __le32 payload_size; /* data bytes, excluding this header */
  171. __le32 index; /* identifier for block */
  172. __le32 count; /* number of elements in block */
  173. } __attribute__((packed));
  174. /* vendor tuple for uuid */
  175. struct snd_soc_tplg_vendor_uuid_elem {
  176. __le32 token;
  177. char uuid[16];
  178. } __attribute__((packed));
  179. /* vendor tuple for a bool/byte/short/word value */
  180. struct snd_soc_tplg_vendor_value_elem {
  181. __le32 token;
  182. __le32 value;
  183. } __attribute__((packed));
  184. /* vendor tuple for string */
  185. struct snd_soc_tplg_vendor_string_elem {
  186. __le32 token;
  187. char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  188. } __attribute__((packed));
  189. struct snd_soc_tplg_vendor_array {
  190. __le32 size; /* size in bytes of the array, including all elements */
  191. __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */
  192. __le32 num_elems; /* number of elements in array */
  193. union {
  194. __DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_uuid_elem, uuid);
  195. __DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_value_elem, value);
  196. __DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_string_elem, string);
  197. };
  198. } __attribute__((packed));
  199. /*
  200. * Private data.
  201. * All topology objects may have private data that can be used by the driver or
  202. * firmware. Core will ignore this data.
  203. */
  204. struct snd_soc_tplg_private {
  205. __le32 size; /* in bytes of private data */
  206. union {
  207. __DECLARE_FLEX_ARRAY(char, data);
  208. __DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_array, array);
  209. };
  210. } __attribute__((packed));
  211. /*
  212. * Kcontrol TLV data.
  213. */
  214. struct snd_soc_tplg_tlv_dbscale {
  215. __le32 min;
  216. __le32 step;
  217. __le32 mute;
  218. } __attribute__((packed));
  219. struct snd_soc_tplg_ctl_tlv {
  220. __le32 size; /* in bytes of this structure */
  221. __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */
  222. union {
  223. __le32 data[SND_SOC_TPLG_TLV_SIZE];
  224. struct snd_soc_tplg_tlv_dbscale scale;
  225. };
  226. } __attribute__((packed));
  227. /*
  228. * Kcontrol channel data
  229. */
  230. struct snd_soc_tplg_channel {
  231. __le32 size; /* in bytes of this structure */
  232. __le32 reg;
  233. __le32 shift;
  234. __le32 id; /* ID maps to Left, Right, LFE etc */
  235. } __attribute__((packed));
  236. /*
  237. * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops
  238. * Kcontrol ops need get/put/info.
  239. * Bytes ext ops need get/put.
  240. */
  241. struct snd_soc_tplg_io_ops {
  242. __le32 get;
  243. __le32 put;
  244. __le32 info;
  245. } __attribute__((packed));
  246. /*
  247. * kcontrol header
  248. */
  249. struct snd_soc_tplg_ctl_hdr {
  250. __le32 size; /* in bytes of this structure */
  251. __le32 type;
  252. char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  253. __le32 access;
  254. struct snd_soc_tplg_io_ops ops;
  255. struct snd_soc_tplg_ctl_tlv tlv;
  256. } __attribute__((packed));
  257. /*
  258. * Stream Capabilities
  259. */
  260. struct snd_soc_tplg_stream_caps {
  261. __le32 size; /* in bytes of this structure */
  262. char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  263. __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */
  264. __le32 rates; /* supported rates SNDRV_PCM_RATE_* */
  265. __le32 rate_min; /* min rate */
  266. __le32 rate_max; /* max rate */
  267. __le32 channels_min; /* min channels */
  268. __le32 channels_max; /* max channels */
  269. __le32 periods_min; /* min number of periods */
  270. __le32 periods_max; /* max number of periods */
  271. __le32 period_size_min; /* min period size bytes */
  272. __le32 period_size_max; /* max period size bytes */
  273. __le32 buffer_size_min; /* min buffer size bytes */
  274. __le32 buffer_size_max; /* max buffer size bytes */
  275. __le32 sig_bits; /* number of bits of content */
  276. } __attribute__((packed));
  277. /*
  278. * FE or BE Stream configuration supported by SW/FW
  279. */
  280. struct snd_soc_tplg_stream {
  281. __le32 size; /* in bytes of this structure */
  282. char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */
  283. __le64 format; /* SNDRV_PCM_FMTBIT_* */
  284. __le32 rate; /* SNDRV_PCM_RATE_* */
  285. __le32 period_bytes; /* size of period in bytes */
  286. __le32 buffer_bytes; /* size of buffer in bytes */
  287. __le32 channels; /* channels */
  288. } __attribute__((packed));
  289. /*
  290. * Describes a physical link's runtime supported hardware config,
  291. * i.e. hardware audio formats.
  292. */
  293. struct snd_soc_tplg_hw_config {
  294. __le32 size; /* in bytes of this structure */
  295. __le32 id; /* unique ID - - used to match */
  296. __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */
  297. __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */
  298. __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */
  299. __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */
  300. __u8 bclk_provider; /* SND_SOC_TPLG_BCLK_ value */
  301. __u8 fsync_provider; /* SND_SOC_TPLG_FSYNC_ value */
  302. __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */
  303. __le16 reserved; /* for 32bit alignment */
  304. __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */
  305. __le32 bclk_rate; /* BCLK freqency in Hz */
  306. __le32 fsync_rate; /* frame clock in Hz */
  307. __le32 tdm_slots; /* number of TDM slots in use */
  308. __le32 tdm_slot_width; /* width in bits for each slot */
  309. __le32 tx_slots; /* bit mask for active Tx slots */
  310. __le32 rx_slots; /* bit mask for active Rx slots */
  311. __le32 tx_channels; /* number of Tx channels */
  312. __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
  313. __le32 rx_channels; /* number of Rx channels */
  314. __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
  315. } __attribute__((packed));
  316. /*
  317. * Manifest. List totals for each payload type. Not used in parsing, but will
  318. * be passed to the component driver before any other objects in order for any
  319. * global component resource allocations.
  320. *
  321. * File block representation for manifest :-
  322. * +-----------------------------------+----+
  323. * | struct snd_soc_tplg_hdr | 1 |
  324. * +-----------------------------------+----+
  325. * | struct snd_soc_tplg_manifest | 1 |
  326. * +-----------------------------------+----+
  327. */
  328. struct snd_soc_tplg_manifest {
  329. __le32 size; /* in bytes of this structure */
  330. __le32 control_elems; /* number of control elements */
  331. __le32 widget_elems; /* number of widget elements */
  332. __le32 graph_elems; /* number of graph elements */
  333. __le32 pcm_elems; /* number of PCM elements */
  334. __le32 dai_link_elems; /* number of DAI link elements */
  335. __le32 dai_elems; /* number of physical DAI elements */
  336. __le32 reserved[20]; /* reserved for new ABI element types */
  337. struct snd_soc_tplg_private priv;
  338. } __attribute__((packed));
  339. /*
  340. * Mixer kcontrol.
  341. *
  342. * File block representation for mixer kcontrol :-
  343. * +-----------------------------------+----+
  344. * | struct snd_soc_tplg_hdr | 1 |
  345. * +-----------------------------------+----+
  346. * | struct snd_soc_tplg_mixer_control | N |
  347. * +-----------------------------------+----+
  348. */
  349. struct snd_soc_tplg_mixer_control {
  350. struct snd_soc_tplg_ctl_hdr hdr;
  351. __le32 size; /* in bytes of this structure */
  352. __le32 min;
  353. __le32 max;
  354. __le32 platform_max;
  355. __le32 invert;
  356. __le32 num_channels;
  357. struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
  358. struct snd_soc_tplg_private priv;
  359. } __attribute__((packed));
  360. /*
  361. * Enumerated kcontrol
  362. *
  363. * File block representation for enum kcontrol :-
  364. * +-----------------------------------+----+
  365. * | struct snd_soc_tplg_hdr | 1 |
  366. * +-----------------------------------+----+
  367. * | struct snd_soc_tplg_enum_control | N |
  368. * +-----------------------------------+----+
  369. */
  370. struct snd_soc_tplg_enum_control {
  371. struct snd_soc_tplg_ctl_hdr hdr;
  372. __le32 size; /* in bytes of this structure */
  373. __le32 num_channels;
  374. struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
  375. __le32 items;
  376. __le32 mask;
  377. __le32 count;
  378. char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  379. __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4];
  380. struct snd_soc_tplg_private priv;
  381. } __attribute__((packed));
  382. /*
  383. * Bytes kcontrol
  384. *
  385. * File block representation for bytes kcontrol :-
  386. * +-----------------------------------+----+
  387. * | struct snd_soc_tplg_hdr | 1 |
  388. * +-----------------------------------+----+
  389. * | struct snd_soc_tplg_bytes_control | N |
  390. * +-----------------------------------+----+
  391. */
  392. struct snd_soc_tplg_bytes_control {
  393. struct snd_soc_tplg_ctl_hdr hdr;
  394. __le32 size; /* in bytes of this structure */
  395. __le32 max;
  396. __le32 mask;
  397. __le32 base;
  398. __le32 num_regs;
  399. struct snd_soc_tplg_io_ops ext_ops;
  400. struct snd_soc_tplg_private priv;
  401. } __attribute__((packed));
  402. /*
  403. * DAPM Graph Element
  404. *
  405. * File block representation for DAPM graph elements :-
  406. * +-------------------------------------+----+
  407. * | struct snd_soc_tplg_hdr | 1 |
  408. * +-------------------------------------+----+
  409. * | struct snd_soc_tplg_dapm_graph_elem | N |
  410. * +-------------------------------------+----+
  411. */
  412. struct snd_soc_tplg_dapm_graph_elem {
  413. char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  414. char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  415. char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  416. } __attribute__((packed));
  417. /*
  418. * DAPM Widget.
  419. *
  420. * File block representation for DAPM widget :-
  421. * +-------------------------------------+-----+
  422. * | struct snd_soc_tplg_hdr | 1 |
  423. * +-------------------------------------+-----+
  424. * | struct snd_soc_tplg_dapm_widget | N |
  425. * +-------------------------------------+-----+
  426. * | struct snd_soc_tplg_enum_control | 0|1 |
  427. * | struct snd_soc_tplg_mixer_control | 0|N |
  428. * +-------------------------------------+-----+
  429. *
  430. * Optional enum or mixer control can be appended to the end of each widget
  431. * in the block.
  432. */
  433. struct snd_soc_tplg_dapm_widget {
  434. __le32 size; /* in bytes of this structure */
  435. __le32 id; /* SND_SOC_DAPM_CTL */
  436. char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  437. char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  438. __le32 reg; /* negative reg = no direct dapm */
  439. __le32 shift; /* bits to shift */
  440. __le32 mask; /* non-shifted mask */
  441. __le32 subseq; /* sort within widget type */
  442. __le32 invert; /* invert the power bit */
  443. __le32 ignore_suspend; /* kept enabled over suspend */
  444. __le16 event_flags;
  445. __le16 event_type;
  446. __le32 num_kcontrols;
  447. struct snd_soc_tplg_private priv;
  448. /*
  449. * kcontrols that relate to this widget
  450. * follow here after widget private data
  451. */
  452. } __attribute__((packed));
  453. /*
  454. * Describes SW/FW specific features of PCM (FE DAI & DAI link).
  455. *
  456. * File block representation for PCM :-
  457. * +-----------------------------------+-----+
  458. * | struct snd_soc_tplg_hdr | 1 |
  459. * +-----------------------------------+-----+
  460. * | struct snd_soc_tplg_pcm | N |
  461. * +-----------------------------------+-----+
  462. */
  463. struct snd_soc_tplg_pcm {
  464. __le32 size; /* in bytes of this structure */
  465. char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  466. char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  467. __le32 pcm_id; /* unique ID - used to match with DAI link */
  468. __le32 dai_id; /* unique ID - used to match */
  469. __le32 playback; /* supports playback mode */
  470. __le32 capture; /* supports capture mode */
  471. __le32 compress; /* 1 = compressed; 0 = PCM */
  472. struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
  473. __le32 num_streams; /* number of streams */
  474. struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
  475. __le32 flag_mask; /* bitmask of flags to configure */
  476. __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
  477. struct snd_soc_tplg_private priv;
  478. } __attribute__((packed));
  479. /*
  480. * Describes the physical link runtime supported configs or params
  481. *
  482. * File block representation for physical link config :-
  483. * +-----------------------------------+-----+
  484. * | struct snd_soc_tplg_hdr | 1 |
  485. * +-----------------------------------+-----+
  486. * | struct snd_soc_tplg_link_config | N |
  487. * +-----------------------------------+-----+
  488. */
  489. struct snd_soc_tplg_link_config {
  490. __le32 size; /* in bytes of this structure */
  491. __le32 id; /* unique ID - used to match */
  492. char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
  493. char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */
  494. struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
  495. __le32 num_streams; /* number of streams */
  496. struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */
  497. __le32 num_hw_configs; /* number of hw configs */
  498. __le32 default_hw_config_id; /* default hw config ID for init */
  499. __le32 flag_mask; /* bitmask of flags to configure */
  500. __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
  501. struct snd_soc_tplg_private priv;
  502. } __attribute__((packed));
  503. /*
  504. * Describes SW/FW specific features of physical DAI.
  505. * It can be used to configure backend DAIs for DPCM.
  506. *
  507. * File block representation for physical DAI :-
  508. * +-----------------------------------+-----+
  509. * | struct snd_soc_tplg_hdr | 1 |
  510. * +-----------------------------------+-----+
  511. * | struct snd_soc_tplg_dai | N |
  512. * +-----------------------------------+-----+
  513. */
  514. struct snd_soc_tplg_dai {
  515. __le32 size; /* in bytes of this structure */
  516. char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
  517. __le32 dai_id; /* unique ID - used to match */
  518. __le32 playback; /* supports playback mode */
  519. __le32 capture; /* supports capture mode */
  520. struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
  521. __le32 flag_mask; /* bitmask of flags to configure */
  522. __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */
  523. struct snd_soc_tplg_private priv;
  524. } __attribute__((packed));
  525. /*
  526. * Old version of ABI structs, supported for backward compatibility.
  527. */
  528. /* Manifest v4 */
  529. struct snd_soc_tplg_manifest_v4 {
  530. __le32 size; /* in bytes of this structure */
  531. __le32 control_elems; /* number of control elements */
  532. __le32 widget_elems; /* number of widget elements */
  533. __le32 graph_elems; /* number of graph elements */
  534. __le32 pcm_elems; /* number of PCM elements */
  535. __le32 dai_link_elems; /* number of DAI link elements */
  536. struct snd_soc_tplg_private priv;
  537. } __attribute__((packed));
  538. /* Stream Capabilities v4 */
  539. struct snd_soc_tplg_stream_caps_v4 {
  540. __le32 size; /* in bytes of this structure */
  541. char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  542. __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */
  543. __le32 rates; /* supported rates SNDRV_PCM_RATE_* */
  544. __le32 rate_min; /* min rate */
  545. __le32 rate_max; /* max rate */
  546. __le32 channels_min; /* min channels */
  547. __le32 channels_max; /* max channels */
  548. __le32 periods_min; /* min number of periods */
  549. __le32 periods_max; /* max number of periods */
  550. __le32 period_size_min; /* min period size bytes */
  551. __le32 period_size_max; /* max period size bytes */
  552. __le32 buffer_size_min; /* min buffer size bytes */
  553. __le32 buffer_size_max; /* max buffer size bytes */
  554. } __attribute__((packed));
  555. /* PCM v4 */
  556. struct snd_soc_tplg_pcm_v4 {
  557. __le32 size; /* in bytes of this structure */
  558. char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  559. char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
  560. __le32 pcm_id; /* unique ID - used to match with DAI link */
  561. __le32 dai_id; /* unique ID - used to match */
  562. __le32 playback; /* supports playback mode */
  563. __le32 capture; /* supports capture mode */
  564. __le32 compress; /* 1 = compressed; 0 = PCM */
  565. struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
  566. __le32 num_streams; /* number of streams */
  567. struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */
  568. } __attribute__((packed));
  569. /* Physical link config v4 */
  570. struct snd_soc_tplg_link_config_v4 {
  571. __le32 size; /* in bytes of this structure */
  572. __le32 id; /* unique ID - used to match */
  573. struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
  574. __le32 num_streams; /* number of streams */
  575. } __attribute__((packed));
  576. #endif