asoc.h 22 KB

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