apr_audio.h 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930
  1. /*
  2. *
  3. * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 and
  7. * only version 2 as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. */
  15. #ifndef _APR_AUDIO_H_
  16. #define _APR_AUDIO_H_
  17. /* ASM opcodes without APR payloads*/
  18. #include <mach/qdsp6v2/apr.h>
  19. /*
  20. * Audio Front End (AFE)
  21. */
  22. /* Port ID. Update afe_get_port_index when a new port is added here. */
  23. #define PRIMARY_I2S_RX 0 /* index = 0 */
  24. #define PRIMARY_I2S_TX 1 /* index = 1 */
  25. #define PCM_RX 2 /* index = 2 */
  26. #define PCM_TX 3 /* index = 3 */
  27. #define SECONDARY_I2S_RX 4 /* index = 4 */
  28. #define SECONDARY_I2S_TX 5 /* index = 5 */
  29. #define MI2S_RX 6 /* index = 6 */
  30. #define MI2S_TX 7 /* index = 7 */
  31. #define HDMI_RX 8 /* index = 8 */
  32. #define RSVD_2 9 /* index = 9 */
  33. #define RSVD_3 10 /* index = 10 */
  34. #define DIGI_MIC_TX 11 /* index = 11 */
  35. #define VOICE_RECORD_RX 0x8003 /* index = 12 */
  36. #define VOICE_RECORD_TX 0x8004 /* index = 13 */
  37. #define VOICE_PLAYBACK_TX 0x8005 /* index = 14 */
  38. /* Slimbus Multi channel port id pool */
  39. #define SLIMBUS_0_RX 0x4000 /* index = 15 */
  40. #define SLIMBUS_0_TX 0x4001 /* index = 16 */
  41. #define SLIMBUS_1_RX 0x4002 /* index = 17 */
  42. #define SLIMBUS_1_TX 0x4003 /* index = 18 */
  43. #define SLIMBUS_2_RX 0x4004
  44. #define SLIMBUS_2_TX 0x4005
  45. #define SLIMBUS_3_RX 0x4006
  46. #define SLIMBUS_3_TX 0x4007
  47. #define SLIMBUS_4_RX 0x4008
  48. #define SLIMBUS_4_TX 0x4009 /* index = 24 */
  49. #define INT_BT_SCO_RX 0x3000 /* index = 25 */
  50. #define INT_BT_SCO_TX 0x3001 /* index = 26 */
  51. #define INT_BT_A2DP_RX 0x3002 /* index = 27 */
  52. #define INT_FM_RX 0x3004 /* index = 28 */
  53. #define INT_FM_TX 0x3005 /* index = 29 */
  54. #define RT_PROXY_PORT_001_RX 0x2000 /* index = 30 */
  55. #define RT_PROXY_PORT_001_TX 0x2001 /* index = 31 */
  56. #define SECONDARY_PCM_RX 12 /* index = 32 */
  57. #define SECONDARY_PCM_TX 13 /* index = 33 */
  58. #define PSEUDOPORT_01 0x8001 /* index =34 */
  59. #define AFE_PORT_INVALID 0xFFFF
  60. #define SLIMBUS_EXTPROC_RX AFE_PORT_INVALID
  61. #define AFE_PORT_CMD_START 0x000100ca
  62. #define AFE_EVENT_RTPORT_START 0
  63. #define AFE_EVENT_RTPORT_STOP 1
  64. #define AFE_EVENT_RTPORT_LOW_WM 2
  65. #define AFE_EVENT_RTPORT_HI_WM 3
  66. struct afe_port_start_command {
  67. struct apr_hdr hdr;
  68. u16 port_id;
  69. u16 gain; /* Q13 */
  70. u32 sample_rate; /* 8 , 16, 48khz */
  71. } __attribute__ ((packed));
  72. #define AFE_PORT_CMD_STOP 0x000100cb
  73. struct afe_port_stop_command {
  74. struct apr_hdr hdr;
  75. u16 port_id;
  76. u16 reserved;
  77. } __attribute__ ((packed));
  78. #define AFE_PORT_CMD_APPLY_GAIN 0x000100cc
  79. struct afe_port_gain_command {
  80. struct apr_hdr hdr;
  81. u16 port_id;
  82. u16 gain;/* Q13 */
  83. } __attribute__ ((packed));
  84. #define AFE_PORT_CMD_SIDETONE_CTL 0x000100cd
  85. struct afe_port_sidetone_command {
  86. struct apr_hdr hdr;
  87. u16 rx_port_id; /* Primary i2s tx = 1 */
  88. /* PCM tx = 3 */
  89. /* Secondary i2s tx = 5 */
  90. /* Mi2s tx = 7 */
  91. /* Digital mic tx = 11 */
  92. u16 tx_port_id; /* Primary i2s rx = 0 */
  93. /* PCM rx = 2 */
  94. /* Secondary i2s rx = 4 */
  95. /* Mi2S rx = 6 */
  96. /* HDMI rx = 8 */
  97. u16 gain; /* Q13 */
  98. u16 enable; /* 1 = enable, 0 = disable */
  99. } __attribute__ ((packed));
  100. #define AFE_PORT_CMD_LOOPBACK 0x000100ce
  101. struct afe_loopback_command {
  102. struct apr_hdr hdr;
  103. u16 tx_port_id; /* Primary i2s rx = 0 */
  104. /* PCM rx = 2 */
  105. /* Secondary i2s rx = 4 */
  106. /* Mi2S rx = 6 */
  107. /* HDMI rx = 8 */
  108. u16 rx_port_id; /* Primary i2s tx = 1 */
  109. /* PCM tx = 3 */
  110. /* Secondary i2s tx = 5 */
  111. /* Mi2s tx = 7 */
  112. /* Digital mic tx = 11 */
  113. u16 mode; /* Default -1, DSP will conver
  114. the tx to rx format */
  115. u16 enable; /* 1 = enable, 0 = disable */
  116. } __attribute__ ((packed));
  117. #define AFE_PSEUDOPORT_CMD_START 0x000100cf
  118. struct afe_pseudoport_start_command {
  119. struct apr_hdr hdr;
  120. u16 port_id; /* Pseudo Port 1 = 0x8000 */
  121. /* Pseudo Port 2 = 0x8001 */
  122. /* Pseudo Port 3 = 0x8002 */
  123. u16 timing; /* FTRT = 0 , AVTimer = 1, */
  124. } __attribute__ ((packed));
  125. #define AFE_PSEUDOPORT_CMD_STOP 0x000100d0
  126. struct afe_pseudoport_stop_command {
  127. struct apr_hdr hdr;
  128. u16 port_id; /* Pseudo Port 1 = 0x8000 */
  129. /* Pseudo Port 2 = 0x8001 */
  130. /* Pseudo Port 3 = 0x8002 */
  131. u16 reserved;
  132. } __attribute__ ((packed));
  133. #define AFE_CMD_GET_ACTIVE_PORTS 0x000100d1
  134. #define AFE_CMD_GET_ACTIVE_HANDLES_FOR_PORT 0x000100d2
  135. struct afe_get_active_handles_command {
  136. struct apr_hdr hdr;
  137. u16 port_id;
  138. u16 reserved;
  139. } __attribute__ ((packed));
  140. /*
  141. * Opcode for AFE to start DTMF.
  142. */
  143. #define AFE_PORTS_CMD_DTMF_CTL 0x00010102
  144. /** DTMF payload.*/
  145. struct afe_dtmf_generation_command {
  146. struct apr_hdr hdr;
  147. /*
  148. * Duration of the DTMF tone in ms.
  149. * -1 -> continuous,
  150. * 0 -> disable
  151. */
  152. int64_t duration_in_ms;
  153. /*
  154. * The DTMF high tone frequency.
  155. */
  156. uint16_t high_freq;
  157. /*
  158. * The DTMF low tone frequency.
  159. */
  160. uint16_t low_freq;
  161. /*
  162. * The DTMF volume setting
  163. */
  164. uint16_t gain;
  165. /*
  166. * The number of ports to enable/disable on.
  167. */
  168. uint16_t num_ports;
  169. /*
  170. * The Destination ports - array .
  171. * For DTMF on multiple ports, portIds needs to
  172. * be populated numPorts times.
  173. */
  174. uint16_t port_ids;
  175. /*
  176. * variable for 32 bit alignment of APR packet.
  177. */
  178. uint16_t reserved;
  179. } __packed;
  180. #define AFE_PCM_CFG_MODE_PCM 0x0
  181. #define AFE_PCM_CFG_MODE_AUX 0x1
  182. #define AFE_PCM_CFG_SYNC_EXT 0x0
  183. #define AFE_PCM_CFG_SYNC_INT 0x1
  184. #define AFE_PCM_CFG_FRM_8BPF 0x0
  185. #define AFE_PCM_CFG_FRM_16BPF 0x1
  186. #define AFE_PCM_CFG_FRM_32BPF 0x2
  187. #define AFE_PCM_CFG_FRM_64BPF 0x3
  188. #define AFE_PCM_CFG_FRM_128BPF 0x4
  189. #define AFE_PCM_CFG_FRM_256BPF 0x5
  190. #define AFE_PCM_CFG_QUANT_ALAW_NOPAD 0x0
  191. #define AFE_PCM_CFG_QUANT_MULAW_NOPAD 0x1
  192. #define AFE_PCM_CFG_QUANT_LINEAR_NOPAD 0x2
  193. #define AFE_PCM_CFG_QUANT_ALAW_PAD 0x3
  194. #define AFE_PCM_CFG_QUANT_MULAW_PAD 0x4
  195. #define AFE_PCM_CFG_QUANT_LINEAR_PAD 0x5
  196. #define AFE_PCM_CFG_CDATAOE_MASTER 0x0
  197. #define AFE_PCM_CFG_CDATAOE_SHARE 0x1
  198. struct afe_port_pcm_cfg {
  199. u16 mode; /* PCM (short sync) = 0, AUXPCM (long sync) = 1 */
  200. u16 sync; /* external = 0 , internal = 1 */
  201. u16 frame; /* 8 bpf = 0 */
  202. /* 16 bpf = 1 */
  203. /* 32 bpf = 2 */
  204. /* 64 bpf = 3 */
  205. /* 128 bpf = 4 */
  206. /* 256 bpf = 5 */
  207. u16 quant;
  208. u16 slot; /* Slot for PCM stream , 0 - 31 */
  209. u16 data; /* 0, PCM block is the only master */
  210. /* 1, PCM block is shares to driver data out signal */
  211. /* other master */
  212. u16 reserved;
  213. } __attribute__ ((packed));
  214. enum {
  215. AFE_I2S_SD0 = 1,
  216. AFE_I2S_SD1,
  217. AFE_I2S_SD2,
  218. AFE_I2S_SD3,
  219. AFE_I2S_QUAD01,
  220. AFE_I2S_QUAD23,
  221. AFE_I2S_6CHS,
  222. AFE_I2S_8CHS,
  223. };
  224. #define AFE_MI2S_MONO 0
  225. #define AFE_MI2S_STEREO 3
  226. #define AFE_MI2S_4CHANNELS 4
  227. #define AFE_MI2S_6CHANNELS 6
  228. #define AFE_MI2S_8CHANNELS 8
  229. struct afe_port_mi2s_cfg {
  230. u16 bitwidth; /* 16,24,32 */
  231. u16 line; /* Called ChannelMode in documentation */
  232. /* i2s_sd0 = 1 */
  233. /* i2s_sd1 = 2 */
  234. /* i2s_sd2 = 3 */
  235. /* i2s_sd3 = 4 */
  236. /* i2s_quad01 = 5 */
  237. /* i2s_quad23 = 6 */
  238. /* i2s_6chs = 7 */
  239. /* i2s_8chs = 8 */
  240. u16 channel; /* Called MonoStereo in documentation */
  241. /* i2s mono = 0 */
  242. /* i2s mono right = 1 */
  243. /* i2s mono left = 2 */
  244. /* i2s stereo = 3 */
  245. u16 ws; /* 0, word select signal from external source */
  246. /* 1, word select signal from internal source */
  247. u16 format; /* don't touch this field if it is not for */
  248. /* AFE_PORT_CMD_I2S_CONFIG opcode */
  249. } __attribute__ ((packed));
  250. struct afe_port_hdmi_cfg {
  251. u16 bitwidth; /* 16,24,32 */
  252. u16 channel_mode; /* HDMI Stereo = 0 */
  253. /* HDMI_3Point1 (4-ch) = 1 */
  254. /* HDMI_5Point1 (6-ch) = 2 */
  255. /* HDMI_6Point1 (8-ch) = 3 */
  256. u16 data_type; /* HDMI_Linear = 0 */
  257. /* HDMI_non_Linear = 1 */
  258. } __attribute__ ((packed));
  259. struct afe_port_hdmi_multi_ch_cfg {
  260. u16 data_type; /* HDMI_Linear = 0 */
  261. /* HDMI_non_Linear = 1 */
  262. u16 channel_allocation; /* The default is 0 (Stereo) */
  263. u16 reserved; /* must be set to 0 */
  264. } __packed;
  265. /* Slimbus Device Ids */
  266. #define AFE_SLIMBUS_DEVICE_1 0x0
  267. #define AFE_SLIMBUS_DEVICE_2 0x1
  268. #define AFE_PORT_MAX_AUDIO_CHAN_CNT 16
  269. struct afe_port_slimbus_cfg {
  270. u16 slimbus_dev_id; /* SLIMBUS Device id.*/
  271. u16 slave_dev_pgd_la; /* Slave ported generic device
  272. * logical address.
  273. */
  274. u16 slave_dev_intfdev_la; /* Slave interface device logical
  275. * address.
  276. */
  277. u16 bit_width; /** bit width of the samples, 16, 24.*/
  278. u16 data_format; /** data format.*/
  279. u16 num_channels; /** Number of channels.*/
  280. /** Slave port mapping for respective channels.*/
  281. u16 slave_port_mapping[AFE_PORT_MAX_AUDIO_CHAN_CNT];
  282. u16 reserved;
  283. } __packed;
  284. struct afe_port_slimbus_sch_cfg {
  285. u16 slimbus_dev_id; /* SLIMBUS Device id.*/
  286. u16 bit_width; /** bit width of the samples, 16, 24.*/
  287. u16 data_format; /** data format.*/
  288. u16 num_channels; /** Number of channels.*/
  289. u16 reserved;
  290. /** Slave channel mapping for respective channels.*/
  291. u8 slave_ch_mapping[8];
  292. } __packed;
  293. struct afe_port_rtproxy_cfg {
  294. u16 bitwidth; /* 16,24,32 */
  295. u16 interleaved; /* interleaved = 1 */
  296. /* Noninterleaved = 0 */
  297. u16 frame_sz; /* 5ms buffers = 160bytes */
  298. u16 jitter; /* 10ms of jitter = 320 */
  299. u16 lw_mark; /* Low watermark in bytes for triggering event*/
  300. u16 hw_mark; /* High watermark bytes for triggering event*/
  301. u16 rsvd;
  302. int num_ch; /* 1 to 8 */
  303. } __packed;
  304. struct afe_port_pseudo_cfg {
  305. u16 bit_width;
  306. u16 num_channels;
  307. u16 data_format;
  308. u16 timing_mode;
  309. u16 reserved;
  310. } __packed;
  311. #define AFE_PORT_AUDIO_IF_CONFIG 0x000100d3
  312. #define AFE_PORT_AUDIO_SLIM_SCH_CONFIG 0x000100e4
  313. #define AFE_PORT_MULTI_CHAN_HDMI_AUDIO_IF_CONFIG 0x000100D9
  314. #define AFE_PORT_CMD_I2S_CONFIG 0x000100E7
  315. union afe_port_config {
  316. struct afe_port_pcm_cfg pcm;
  317. struct afe_port_mi2s_cfg mi2s;
  318. struct afe_port_hdmi_cfg hdmi;
  319. struct afe_port_hdmi_multi_ch_cfg hdmi_multi_ch;
  320. struct afe_port_slimbus_cfg slimbus;
  321. struct afe_port_slimbus_sch_cfg slim_sch;
  322. struct afe_port_rtproxy_cfg rtproxy;
  323. struct afe_port_pseudo_cfg pseudo;
  324. } __attribute__((packed));
  325. struct afe_audioif_config_command {
  326. struct apr_hdr hdr;
  327. u16 port_id;
  328. union afe_port_config port;
  329. } __attribute__ ((packed));
  330. #define AFE_TEST_CODEC_LOOPBACK_CTL 0x000100d5
  331. struct afe_codec_loopback_command {
  332. u16 port_inf; /* Primary i2s = 0 */
  333. /* PCM = 2 */
  334. /* Secondary i2s = 4 */
  335. /* Mi2s = 6 */
  336. u16 enable; /* 0, disable. 1, enable */
  337. } __attribute__ ((packed));
  338. #define AFE_PARAM_ID_SIDETONE_GAIN 0x00010300
  339. struct afe_param_sidetone_gain {
  340. u16 gain;
  341. u16 reserved;
  342. } __attribute__ ((packed));
  343. #define AFE_PARAM_ID_SAMPLING_RATE 0x00010301
  344. struct afe_param_sampling_rate {
  345. u32 sampling_rate;
  346. } __attribute__ ((packed));
  347. #define AFE_PARAM_ID_CHANNELS 0x00010302
  348. struct afe_param_channels {
  349. u16 channels;
  350. u16 reserved;
  351. } __attribute__ ((packed));
  352. #define AFE_PARAM_ID_LOOPBACK_GAIN 0x00010303
  353. struct afe_param_loopback_gain {
  354. u16 gain;
  355. u16 reserved;
  356. } __attribute__ ((packed));
  357. /* Parameter ID used to configure and enable/disable the loopback path. The
  358. * difference with respect to the existing API, AFE_PORT_CMD_LOOPBACK, is that
  359. * it allows Rx port to be configured as source port in loopback path. Port-id
  360. * in AFE_PORT_CMD_SET_PARAM cmd is the source port whcih can be Tx or Rx port.
  361. * In addition, we can configure the type of routing mode to handle different
  362. * use cases.
  363. */
  364. enum {
  365. /* Regular loopback from source to destination port */
  366. LB_MODE_DEFAULT = 1,
  367. /* Sidetone feed from Tx source to Rx destination port */
  368. LB_MODE_SIDETONE,
  369. /* Echo canceller reference, voice + audio + DTMF */
  370. LB_MODE_EC_REF_VOICE_AUDIO,
  371. /* Echo canceller reference, voice alone */
  372. LB_MODE_EC_REF_VOICE
  373. };
  374. #define AFE_PARAM_ID_LOOPBACK_CONFIG 0x0001020B
  375. #define AFE_API_VERSION_LOOPBACK_CONFIG 0x1
  376. struct afe_param_loopback_cfg {
  377. /* Minor version used for tracking the version of the configuration
  378. * interface.
  379. */
  380. uint32_t loopback_cfg_minor_version;
  381. /* Destination Port Id. */
  382. uint16_t dst_port_id;
  383. /* Specifies data path type from src to dest port. Supported values:
  384. * LB_MODE_DEFAULT
  385. * LB_MODE_SIDETONE
  386. * LB_MODE_EC_REF_VOICE_AUDIO
  387. * LB_MODE_EC_REF_VOICE
  388. */
  389. uint16_t routing_mode;
  390. /* Specifies whether to enable (1) or disable (0) an AFE loopback. */
  391. uint16_t enable;
  392. /* Reserved for 32-bit alignment. This field must be set to 0. */
  393. uint16_t reserved;
  394. } __packed;
  395. #define AFE_MODULE_ID_PORT_INFO 0x00010200
  396. /* Module ID for the loopback-related parameters. */
  397. #define AFE_MODULE_LOOPBACK 0x00010205
  398. struct afe_param_payload_base {
  399. u32 module_id;
  400. u32 param_id;
  401. u16 param_size;
  402. u16 reserved;
  403. } __packed;
  404. struct afe_param_payload {
  405. struct afe_param_payload_base base;
  406. union {
  407. struct afe_param_sidetone_gain sidetone_gain;
  408. struct afe_param_sampling_rate sampling_rate;
  409. struct afe_param_channels channels;
  410. struct afe_param_loopback_gain loopback_gain;
  411. struct afe_param_loopback_cfg loopback_cfg;
  412. } __attribute__((packed)) param;
  413. } __attribute__ ((packed));
  414. #define AFE_PORT_CMD_SET_PARAM 0x000100dc
  415. struct afe_port_cmd_set_param {
  416. struct apr_hdr hdr;
  417. u16 port_id;
  418. u16 payload_size;
  419. u32 payload_address;
  420. struct afe_param_payload payload;
  421. } __attribute__ ((packed));
  422. struct afe_port_cmd_set_param_no_payload {
  423. struct apr_hdr hdr;
  424. u16 port_id;
  425. u16 payload_size;
  426. u32 payload_address;
  427. } __packed;
  428. #define AFE_EVENT_GET_ACTIVE_PORTS 0x00010100
  429. struct afe_get_active_ports_rsp {
  430. u16 num_ports;
  431. u16 port_id;
  432. } __attribute__ ((packed));
  433. #define AFE_EVENT_GET_ACTIVE_HANDLES 0x00010102
  434. struct afe_get_active_handles_rsp {
  435. u16 port_id;
  436. u16 num_handles;
  437. u16 mode; /* 0, voice rx */
  438. /* 1, voice tx */
  439. /* 2, audio rx */
  440. /* 3, audio tx */
  441. u16 handle;
  442. } __attribute__ ((packed));
  443. #define AFE_SERVICE_CMD_MEMORY_MAP 0x000100DE
  444. struct afe_cmd_memory_map {
  445. struct apr_hdr hdr;
  446. u32 phy_addr;
  447. u32 mem_sz;
  448. u16 mem_id;
  449. u16 rsvd;
  450. } __packed;
  451. #define AFE_SERVICE_CMD_MEMORY_UNMAP 0x000100DF
  452. struct afe_cmd_memory_unmap {
  453. struct apr_hdr hdr;
  454. u32 phy_addr;
  455. } __packed;
  456. #define AFE_SERVICE_CMD_REG_RTPORT 0x000100E0
  457. struct afe_cmd_reg_rtport {
  458. struct apr_hdr hdr;
  459. u16 port_id;
  460. u16 rsvd;
  461. } __packed;
  462. #define AFE_SERVICE_CMD_UNREG_RTPORT 0x000100E1
  463. struct afe_cmd_unreg_rtport {
  464. struct apr_hdr hdr;
  465. u16 port_id;
  466. u16 rsvd;
  467. } __packed;
  468. #define AFE_SERVICE_CMD_RTPORT_WR 0x000100E2
  469. struct afe_cmd_rtport_wr {
  470. struct apr_hdr hdr;
  471. u16 port_id;
  472. u16 rsvd;
  473. u32 buf_addr;
  474. u32 bytes_avail;
  475. } __packed;
  476. #define AFE_SERVICE_CMD_RTPORT_RD 0x000100E3
  477. struct afe_cmd_rtport_rd {
  478. struct apr_hdr hdr;
  479. u16 port_id;
  480. u16 rsvd;
  481. u32 buf_addr;
  482. u32 bytes_avail;
  483. } __packed;
  484. #define AFE_EVENT_RT_PROXY_PORT_STATUS 0x00010105
  485. #define ADM_MAX_COPPS 5
  486. #define ADM_SERVICE_CMD_GET_COPP_HANDLES 0x00010300
  487. struct adm_get_copp_handles_command {
  488. struct apr_hdr hdr;
  489. } __attribute__ ((packed));
  490. #define ADM_CMD_MATRIX_MAP_ROUTINGS 0x00010301
  491. struct adm_routings_session {
  492. u16 id;
  493. u16 num_copps;
  494. u16 copp_id[ADM_MAX_COPPS+1]; /*Padding if numCopps is odd */
  495. } __packed;
  496. struct adm_routings_command {
  497. struct apr_hdr hdr;
  498. u32 path; /* 0 = Rx, 1 Tx */
  499. u32 num_sessions;
  500. struct adm_routings_session session[8];
  501. } __attribute__ ((packed));
  502. #define ADM_CMD_MATRIX_RAMP_GAINS 0x00010302
  503. struct adm_ramp_gain {
  504. struct apr_hdr hdr;
  505. u16 session_id;
  506. u16 copp_id;
  507. u16 initial_gain;
  508. u16 gain_increment;
  509. u16 ramp_duration;
  510. u16 reserved;
  511. } __attribute__ ((packed));
  512. struct adm_ramp_gains_command {
  513. struct apr_hdr hdr;
  514. u32 id;
  515. u32 num_gains;
  516. struct adm_ramp_gain gains[ADM_MAX_COPPS];
  517. } __attribute__ ((packed));
  518. #define ADM_CMD_COPP_OPEN 0x00010304
  519. struct adm_copp_open_command {
  520. struct apr_hdr hdr;
  521. u16 flags;
  522. u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */
  523. u16 endpoint_id1;
  524. u16 endpoint_id2;
  525. u32 topology_id;
  526. u16 channel_config;
  527. u16 reserved;
  528. u32 rate;
  529. } __attribute__ ((packed));
  530. #define ADM_CMD_COPP_CLOSE 0x00010305
  531. #define ADM_CMD_MULTI_CHANNEL_COPP_OPEN 0x00010310
  532. #define ADM_CMD_MULTI_CHANNEL_COPP_OPEN_V3 0x00010333
  533. struct adm_multi_ch_copp_open_command {
  534. struct apr_hdr hdr;
  535. u16 flags;
  536. u16 mode; /* 1-RX, 2-Live TX, 3-Non Live TX */
  537. u16 endpoint_id1;
  538. u16 endpoint_id2;
  539. u32 topology_id;
  540. u16 channel_config;
  541. u16 reserved;
  542. u32 rate;
  543. u8 dev_channel_mapping[8];
  544. } __packed;
  545. struct adm_multi_channel_copp_open_v3 {
  546. struct apr_hdr hdr;
  547. u16 flags;
  548. u16 mode;
  549. u16 endpoint_id1;
  550. u16 endpoint_id2;
  551. u32 topology_id;
  552. u16 channel_config;
  553. u16 bit_width;
  554. u32 rate;
  555. u8 dev_channel_mapping[8];
  556. };
  557. #define ADM_CMD_MEMORY_MAP 0x00010C30
  558. struct adm_cmd_memory_map{
  559. struct apr_hdr hdr;
  560. u32 buf_add;
  561. u32 buf_size;
  562. u16 mempool_id;
  563. u16 reserved;
  564. } __attribute__((packed));
  565. #define ADM_CMD_MEMORY_UNMAP 0x00010C31
  566. struct adm_cmd_memory_unmap{
  567. struct apr_hdr hdr;
  568. u32 buf_add;
  569. } __attribute__((packed));
  570. #define ADM_CMD_MEMORY_MAP_REGIONS 0x00010C47
  571. struct adm_memory_map_regions{
  572. u32 phys;
  573. u32 buf_size;
  574. } __attribute__((packed));
  575. struct adm_cmd_memory_map_regions{
  576. struct apr_hdr hdr;
  577. u16 mempool_id;
  578. u16 nregions;
  579. } __attribute__((packed));
  580. #define ADM_CMD_MEMORY_UNMAP_REGIONS 0x00010C48
  581. struct adm_memory_unmap_regions{
  582. u32 phys;
  583. } __attribute__((packed));
  584. struct adm_cmd_memory_unmap_regions{
  585. struct apr_hdr hdr;
  586. u16 nregions;
  587. u16 reserved;
  588. } __attribute__((packed));
  589. #define DEFAULT_COPP_TOPOLOGY 0x00010be3
  590. #define DEFAULT_POPP_TOPOLOGY 0x00010be4
  591. #define VPM_TX_SM_ECNS_COPP_TOPOLOGY 0x00010F71
  592. #define VPM_TX_DM_FLUENCE_COPP_TOPOLOGY 0x00010F72
  593. #define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY 0x00010F75
  594. #define LOWLATENCY_POPP_TOPOLOGY 0x00010C68
  595. #define LOWLATENCY_COPP_TOPOLOGY 0x00010312
  596. #define PCM_BITS_PER_SAMPLE 16
  597. #define ASM_OPEN_WRITE_PERF_MODE_BIT (1<<28)
  598. #define ASM_OPEN_READ_PERF_MODE_BIT (1<<29)
  599. #define ADM_MULTI_CH_COPP_OPEN_PERF_MODE_BIT (1<<13)
  600. #define ASM_MAX_EQ_BANDS 12
  601. struct asm_eq_band {
  602. u32 band_idx; /* The band index, 0 .. 11 */
  603. u32 filter_type; /* Filter band type */
  604. u32 center_freq_hz; /* Filter band center frequency */
  605. u32 filter_gain; /* Filter band initial gain (dB) */
  606. /* Range is +12 dB to -12 dB with 1dB increments. */
  607. u32 q_factor;
  608. } __attribute__ ((packed));
  609. struct asm_equalizer_params {
  610. u32 enable;
  611. u32 num_bands;
  612. struct asm_eq_band eq_bands[ASM_MAX_EQ_BANDS];
  613. } __attribute__ ((packed));
  614. struct asm_master_gain_params {
  615. u16 master_gain;
  616. u16 padding;
  617. } __attribute__ ((packed));
  618. struct asm_lrchannel_gain_params {
  619. u16 left_gain;
  620. u16 right_gain;
  621. } __attribute__ ((packed));
  622. struct asm_mute_params {
  623. u32 muteflag;
  624. } __attribute__ ((packed));
  625. struct asm_softvolume_params {
  626. u32 period;
  627. u32 step;
  628. u32 rampingcurve;
  629. } __attribute__ ((packed));
  630. struct asm_softpause_params {
  631. u32 enable;
  632. u32 period;
  633. u32 step;
  634. u32 rampingcurve;
  635. } __packed;
  636. struct asm_pp_param_data_hdr {
  637. u32 module_id;
  638. u32 param_id;
  639. u16 param_size;
  640. u16 reserved;
  641. } __attribute__ ((packed));
  642. struct asm_pp_params_command {
  643. struct apr_hdr hdr;
  644. u32 *payload;
  645. u32 payload_size;
  646. struct asm_pp_param_data_hdr params;
  647. } __attribute__ ((packed));
  648. #define EQUALIZER_MODULE_ID 0x00010c27
  649. #define EQUALIZER_PARAM_ID 0x00010c28
  650. #define VOLUME_CONTROL_MODULE_ID 0x00010bfe
  651. #define MASTER_GAIN_PARAM_ID 0x00010bff
  652. #define L_R_CHANNEL_GAIN_PARAM_ID 0x00010c00
  653. #define MUTE_CONFIG_PARAM_ID 0x00010c01
  654. #define SOFT_PAUSE_PARAM_ID 0x00010D6A
  655. #define SOFT_VOLUME_PARAM_ID 0x00010C29
  656. #define IIR_FILTER_ENABLE_PARAM_ID 0x00010c03
  657. #define IIR_FILTER_PREGAIN_PARAM_ID 0x00010c04
  658. #define IIR_FILTER_CONFIG_PARAM_ID 0x00010c05
  659. #define MBADRC_MODULE_ID 0x00010c06
  660. #define MBADRC_ENABLE_PARAM_ID 0x00010c07
  661. #define MBADRC_CONFIG_PARAM_ID 0x00010c08
  662. #define ADM_CMD_SET_PARAMS 0x00010306
  663. #define ADM_CMD_GET_PARAMS 0x0001030B
  664. #define ADM_CMDRSP_GET_PARAMS 0x0001030C
  665. struct adm_set_params_command {
  666. struct apr_hdr hdr;
  667. u32 payload;
  668. u32 payload_size;
  669. } __attribute__ ((packed));
  670. #define ADM_CMD_TAP_COPP_PCM 0x00010307
  671. struct adm_tap_copp_pcm_command {
  672. struct apr_hdr hdr;
  673. } __attribute__ ((packed));
  674. /* QDSP6 to Client messages
  675. */
  676. #define ADM_SERVICE_CMDRSP_GET_COPP_HANDLES 0x00010308
  677. struct adm_get_copp_handles_respond {
  678. struct apr_hdr hdr;
  679. u32 handles;
  680. u32 copp_id;
  681. } __attribute__ ((packed));
  682. #define ADM_CMDRSP_COPP_OPEN 0x0001030A
  683. struct adm_copp_open_respond {
  684. u32 status;
  685. u16 copp_id;
  686. u16 reserved;
  687. } __attribute__ ((packed));
  688. #define ADM_CMDRSP_MULTI_CHANNEL_COPP_OPEN 0x00010311
  689. #define ADM_CMDRSP_MULTI_CHANNEL_COPP_OPEN_V3 0x00010334
  690. #define ASM_STREAM_PRIORITY_NORMAL 0
  691. #define ASM_STREAM_PRIORITY_LOW 1
  692. #define ASM_STREAM_PRIORITY_HIGH 2
  693. #define ASM_STREAM_PRIORITY_RESERVED 3
  694. #define ASM_END_POINT_DEVICE_MATRIX 0
  695. #define ASM_END_POINT_STREAM 1
  696. #define AAC_ENC_MODE_AAC_LC 0x02
  697. #define AAC_ENC_MODE_AAC_P 0x05
  698. #define AAC_ENC_MODE_EAAC_P 0x1D
  699. #define ASM_STREAM_CMD_CLOSE 0x00010BCD
  700. #define ASM_STREAM_CMD_FLUSH 0x00010BCE
  701. #define ASM_STREAM_CMD_SET_PP_PARAMS 0x00010BCF
  702. #define ASM_STREAM_CMD_GET_PP_PARAMS 0x00010BD0
  703. #define ASM_STREAM_CMDRSP_GET_PP_PARAMS 0x00010BD1
  704. #define ASM_SESSION_CMD_PAUSE 0x00010BD3
  705. #define ASM_SESSION_CMD_GET_SESSION_TIME 0x00010BD4
  706. #define ASM_DATA_CMD_EOS 0x00010BDB
  707. #define ASM_DATA_EVENT_EOS 0x00010BDD
  708. #define ASM_SERVICE_CMD_GET_STREAM_HANDLES 0x00010C0B
  709. #define ASM_STREAM_CMD_FLUSH_READBUFS 0x00010C09
  710. #define ASM_SESSION_EVENT_RX_UNDERFLOW 0x00010C17
  711. #define ASM_SESSION_EVENT_TX_OVERFLOW 0x00010C18
  712. #define ASM_SERVICE_CMD_GET_WALLCLOCK_TIME 0x00010C19
  713. #define ASM_DATA_CMDRSP_EOS 0x00010C1C
  714. /* ASM Data structures */
  715. /* common declarations */
  716. struct asm_pcm_cfg {
  717. u16 ch_cfg;
  718. u16 bits_per_sample;
  719. u32 sample_rate;
  720. u16 is_signed;
  721. u16 interleaved;
  722. };
  723. #define PCM_CHANNEL_NULL 0
  724. /* Front left channel. */
  725. #define PCM_CHANNEL_FL 1
  726. /* Front right channel. */
  727. #define PCM_CHANNEL_FR 2
  728. /* Front center channel. */
  729. #define PCM_CHANNEL_FC 3
  730. /* Left surround channel.*/
  731. #define PCM_CHANNEL_LS 4
  732. /* Right surround channel.*/
  733. #define PCM_CHANNEL_RS 5
  734. /* Low frequency effect channel. */
  735. #define PCM_CHANNEL_LFE 6
  736. /* Center surround channel; Rear center channel. */
  737. #define PCM_CHANNEL_CS 7
  738. /* Left back channel; Rear left channel. */
  739. #define PCM_CHANNEL_LB 8
  740. /* Right back channel; Rear right channel. */
  741. #define PCM_CHANNEL_RB 9
  742. /* Top surround channel. */
  743. #define PCM_CHANNEL_TS 10
  744. /* Center vertical height channel.*/
  745. #define PCM_CHANNEL_CVH 11
  746. /* Mono surround channel.*/
  747. #define PCM_CHANNEL_MS 12
  748. /* Front left of center. */
  749. #define PCM_CHANNEL_FLC 13
  750. /* Front right of center. */
  751. #define PCM_CHANNEL_FRC 14
  752. /* Rear left of center. */
  753. #define PCM_CHANNEL_RLC 15
  754. /* Rear right of center. */
  755. #define PCM_CHANNEL_RRC 16
  756. #define PCM_FORMAT_MAX_NUM_CHANNEL 8
  757. /* Maximum number of channels supported
  758. * in ASM_ENCDEC_DEC_CHAN_MAP command
  759. */
  760. #define MAX_CHAN_MAP_CHANNELS 16
  761. /*
  762. * Multiple-channel PCM decoder format block structure used in the
  763. * #ASM_STREAM_CMD_OPEN_WRITE command.
  764. * The data must be in little-endian format.
  765. */
  766. struct asm_multi_channel_pcm_fmt_blk {
  767. u16 num_channels; /*
  768. * Number of channels.
  769. * Supported values:1 to 8
  770. */
  771. u16 bits_per_sample; /*
  772. * Number of bits per sample per channel.
  773. * Supported values: 16, 24 When used for
  774. * playback, the client must send 24-bit
  775. * samples packed in 32-bit words. The
  776. * 24-bit samples must be placed in the most
  777. * significant 24 bits of the 32-bit word. When
  778. * used for recording, the aDSP sends 24-bit
  779. * samples packed in 32-bit words. The 24-bit
  780. * samples are placed in the most significant
  781. * 24 bits of the 32-bit word.
  782. */
  783. u32 sample_rate; /*
  784. * Number of samples per second
  785. * (in Hertz). Supported values:
  786. * 2000 to 48000
  787. */
  788. u16 is_signed; /*
  789. * Flag that indicates the samples
  790. * are signed (1).
  791. */
  792. u16 is_interleaved; /*
  793. * Flag that indicates whether the channels are
  794. * de-interleaved (0) or interleaved (1).
  795. * Interleaved format means corresponding
  796. * samples from the left and right channels are
  797. * interleaved within the buffer.
  798. * De-interleaved format means samples from
  799. * each channel are contiguous in the buffer.
  800. * The samples from one channel immediately
  801. * follow those of the previous channel.
  802. */
  803. u8 channel_mapping[8]; /*
  804. * Supported values:
  805. * PCM_CHANNEL_NULL, PCM_CHANNEL_FL,
  806. * PCM_CHANNEL_FR, PCM_CHANNEL_FC,
  807. * PCM_CHANNEL_LS, PCM_CHANNEL_RS,
  808. * PCM_CHANNEL_LFE, PCM_CHANNEL_CS,
  809. * PCM_CHANNEL_LB, PCM_CHANNEL_RB,
  810. * PCM_CHANNEL_TS, PCM_CHANNEL_CVH,
  811. * PCM_CHANNEL_MS, PCM_CHANNEL_FLC,
  812. * PCM_CHANNEL_FRC, PCM_CHANNEL_RLC,
  813. * PCM_CHANNEL_RRC.
  814. * Channel[i] mapping describes channel I. Each
  815. * element i of the array describes channel I
  816. * inside the buffer where I < num_channels.
  817. * An unused channel is set to zero.
  818. */
  819. };
  820. struct asm_dts_enc_cfg {
  821. uint32_t sample_rate;
  822. /*
  823. * Samples at which input is to be encoded.
  824. * Supported values:
  825. * 44100 -- encode at 44.1 Khz
  826. * 48000 -- encode at 48 Khz
  827. */
  828. uint32_t num_channels;
  829. /*
  830. * Number of channels for multi-channel encoding.
  831. * Supported values: 1 to 6
  832. */
  833. uint8_t channel_mapping[6];
  834. /*
  835. * Channel array of size 16. Channel[i] mapping describes channel I.
  836. * Each element i of the array describes channel I inside the buffer
  837. * where num_channels. An unused channel is set to zero. Only first
  838. * num_channels elements are valid
  839. * Supported values:
  840. * - # PCM_CHANNEL_L
  841. * - # PCM_CHANNEL_R
  842. * - # PCM_CHANNEL_C
  843. * - # PCM_CHANNEL_LS
  844. * - # PCM_CHANNEL_RS
  845. * - # PCM_CHANNEL_LFE
  846. */
  847. };
  848. struct asm_adpcm_cfg {
  849. u16 ch_cfg;
  850. u16 bits_per_sample;
  851. u32 sample_rate;
  852. u32 block_size;
  853. };
  854. struct asm_yadpcm_cfg {
  855. u16 ch_cfg;
  856. u16 bits_per_sample;
  857. u32 sample_rate;
  858. };
  859. struct asm_midi_cfg {
  860. u32 nMode;
  861. };
  862. struct asm_wma_cfg {
  863. u16 format_tag;
  864. u16 ch_cfg;
  865. u32 sample_rate;
  866. u32 avg_bytes_per_sec;
  867. u16 block_align;
  868. u16 valid_bits_per_sample;
  869. u32 ch_mask;
  870. u16 encode_opt;
  871. u16 adv_encode_opt;
  872. u32 adv_encode_opt2;
  873. u32 drc_peak_ref;
  874. u32 drc_peak_target;
  875. u32 drc_ave_ref;
  876. u32 drc_ave_target;
  877. };
  878. struct asm_wmapro_cfg {
  879. u16 format_tag;
  880. u16 ch_cfg;
  881. u32 sample_rate;
  882. u32 avg_bytes_per_sec;
  883. u16 block_align;
  884. u16 valid_bits_per_sample;
  885. u32 ch_mask;
  886. u16 encode_opt;
  887. u16 adv_encode_opt;
  888. u32 adv_encode_opt2;
  889. u32 drc_peak_ref;
  890. u32 drc_peak_target;
  891. u32 drc_ave_ref;
  892. u32 drc_ave_target;
  893. };
  894. struct asm_aac_cfg {
  895. u16 format;
  896. u16 aot;
  897. u16 ep_config;
  898. u16 section_data_resilience;
  899. u16 scalefactor_data_resilience;
  900. u16 spectral_data_resilience;
  901. u16 ch_cfg;
  902. u16 reserved;
  903. u32 sample_rate;
  904. };
  905. struct asm_amrwbplus_cfg {
  906. u32 size_bytes;
  907. u32 version;
  908. u32 num_channels;
  909. u32 amr_band_mode;
  910. u32 amr_dtx_mode;
  911. u32 amr_frame_fmt;
  912. u32 amr_lsf_idx;
  913. };
  914. struct asm_flac_cfg {
  915. u16 stream_info_present;
  916. u16 min_blk_size;
  917. u16 max_blk_size;
  918. u16 ch_cfg;
  919. u16 sample_size;
  920. u16 sample_rate;
  921. u16 md5_sum;
  922. u32 ext_sample_rate;
  923. u32 min_frame_size;
  924. u32 max_frame_size;
  925. };
  926. struct asm_vorbis_cfg {
  927. u32 ch_cfg;
  928. u32 bit_rate;
  929. u32 min_bit_rate;
  930. u32 max_bit_rate;
  931. u16 bit_depth_pcm_sample;
  932. u16 bit_stream_format;
  933. };
  934. struct asm_aac_read_cfg {
  935. u32 bitrate;
  936. u32 enc_mode;
  937. u16 format;
  938. u16 ch_cfg;
  939. u32 sample_rate;
  940. };
  941. struct asm_amrnb_read_cfg {
  942. u16 mode;
  943. u16 dtx_mode;
  944. };
  945. struct asm_amrwb_read_cfg {
  946. u16 mode;
  947. u16 dtx_mode;
  948. };
  949. struct asm_evrc_read_cfg {
  950. u16 max_rate;
  951. u16 min_rate;
  952. u16 rate_modulation_cmd;
  953. u16 reserved;
  954. };
  955. struct asm_qcelp13_read_cfg {
  956. u16 max_rate;
  957. u16 min_rate;
  958. u16 reduced_rate_level;
  959. u16 rate_modulation_cmd;
  960. };
  961. struct asm_sbc_read_cfg {
  962. u32 subband;
  963. u32 block_len;
  964. u32 ch_mode;
  965. u32 alloc_method;
  966. u32 bit_rate;
  967. u32 sample_rate;
  968. };
  969. struct asm_sbc_bitrate {
  970. u32 bitrate;
  971. };
  972. struct asm_immed_decode {
  973. u32 mode;
  974. };
  975. struct asm_sbr_ps {
  976. u32 enable;
  977. };
  978. struct asm_dual_mono {
  979. u16 sce_left;
  980. u16 sce_right;
  981. };
  982. struct asm_dec_chan_map {
  983. u32 num_channels; /* Number of decoder output
  984. * channels. A value of 0
  985. * indicates native channel
  986. * mapping, which is valid
  987. * only for NT mode. This
  988. * means the output of the
  989. * decoder is to be preserved
  990. * as is.
  991. */
  992. u8 channel_mapping[MAX_CHAN_MAP_CHANNELS];/* Channel array of size
  993. * num_channels. It can grow
  994. * till MAX_CHAN_MAP_CHANNELS.
  995. * Channel[i] mapping
  996. * describes channel I inside
  997. * the decoder output buffer.
  998. * Valid channel mapping
  999. * values are to be present at
  1000. * the beginning of the array.
  1001. * All remaining elements of
  1002. * the array are to be filled
  1003. * with PCM_CHANNEL_NULL.
  1004. */
  1005. };
  1006. struct asm_encode_cfg_blk {
  1007. u32 frames_per_buf;
  1008. u32 format_id;
  1009. u32 cfg_size;
  1010. union {
  1011. struct asm_pcm_cfg pcm;
  1012. struct asm_aac_read_cfg aac;
  1013. struct asm_amrnb_read_cfg amrnb;
  1014. struct asm_evrc_read_cfg evrc;
  1015. struct asm_qcelp13_read_cfg qcelp13;
  1016. struct asm_sbc_read_cfg sbc;
  1017. struct asm_amrwb_read_cfg amrwb;
  1018. struct asm_multi_channel_pcm_fmt_blk mpcm;
  1019. struct asm_dts_enc_cfg dts;
  1020. } __attribute__((packed)) cfg;
  1021. };
  1022. struct asm_frame_meta_info {
  1023. u32 offset_to_frame;
  1024. u32 frame_size;
  1025. u32 encoded_pcm_samples;
  1026. u32 msw_ts;
  1027. u32 lsw_ts;
  1028. u32 nflags;
  1029. };
  1030. /* Stream level commands */
  1031. #define ASM_STREAM_CMD_OPEN_READ 0x00010BCB
  1032. #define ASM_STREAM_CMD_OPEN_READ_V2_1 0x00010DB2
  1033. struct asm_stream_cmd_open_read {
  1034. struct apr_hdr hdr;
  1035. u32 uMode;
  1036. u32 src_endpoint;
  1037. u32 pre_proc_top;
  1038. u32 format;
  1039. } __attribute__((packed));
  1040. struct asm_stream_cmd_open_read_v2_1 {
  1041. struct apr_hdr hdr;
  1042. u32 uMode;
  1043. u32 src_endpoint;
  1044. u32 pre_proc_top;
  1045. u32 format;
  1046. u16 bits_per_sample;
  1047. u16 reserved;
  1048. } __packed;
  1049. /* Supported formats */
  1050. #define LINEAR_PCM 0x00010BE5
  1051. #define DTMF 0x00010BE6
  1052. #define ADPCM 0x00010BE7
  1053. #define YADPCM 0x00010BE8
  1054. #define MP3 0x00010BE9
  1055. #define MPEG4_AAC 0x00010BEA
  1056. #define AMRNB_FS 0x00010BEB
  1057. #define AMRWB_FS 0x00010BEC
  1058. #define V13K_FS 0x00010BED
  1059. #define EVRC_FS 0x00010BEE
  1060. #define EVRCB_FS 0x00010BEF
  1061. #define EVRCWB_FS 0x00010BF0
  1062. #define MIDI 0x00010BF1
  1063. #define SBC 0x00010BF2
  1064. #define WMA_V10PRO 0x00010BF3
  1065. #define WMA_V9 0x00010BF4
  1066. #define AMR_WB_PLUS 0x00010BF5
  1067. #define AC3_DECODER 0x00010BF6
  1068. #define EAC3_DECODER 0x00010C3C
  1069. #define DTS 0x00010D88
  1070. #define DTS_LBR 0x00010DBB
  1071. #define MP2 0x00010DBE
  1072. #define ATRAC 0x00010D89
  1073. #define MAT 0x00010D8A
  1074. #define G711_ALAW_FS 0x00010BF7
  1075. #define G711_MLAW_FS 0x00010BF8
  1076. #define G711_PCM_FS 0x00010BF9
  1077. #define MPEG4_MULTI_AAC 0x00010D86
  1078. #define US_POINT_EPOS_FORMAT 0x00012310
  1079. #define US_RAW_FORMAT 0x0001127C
  1080. #define US_PROX_FORMAT 0x0001272B
  1081. #define MULTI_CHANNEL_PCM 0x00010C66
  1082. #define ASM_ENCDEC_SBCRATE 0x00010C13
  1083. #define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
  1084. #define ASM_ENCDEC_CFG_BLK 0x00010C2C
  1085. #define ASM_ENCDEC_SBCRATE 0x00010C13
  1086. #define ASM_ENCDEC_IMMDIATE_DECODE 0x00010C14
  1087. #define ASM_ENCDEC_CFG_BLK 0x00010C2C
  1088. #define ASM_STREAM_CMD_OPEN_READ_COMPRESSED 0x00010D95
  1089. struct asm_stream_cmd_open_read_compressed {
  1090. struct apr_hdr hdr;
  1091. u32 uMode;
  1092. u32 frame_per_buf;
  1093. } __packed;
  1094. #define ASM_STREAM_CMD_OPEN_WRITE 0x00010BCA
  1095. #define ASM_STREAM_CMD_OPEN_WRITE_V2_1 0x00010DB1
  1096. struct asm_stream_cmd_open_write {
  1097. struct apr_hdr hdr;
  1098. u32 uMode;
  1099. u16 sink_endpoint;
  1100. u16 stream_handle;
  1101. u32 post_proc_top;
  1102. u32 format;
  1103. } __attribute__((packed));
  1104. #define IEC_61937_MASK 0x00000001
  1105. #define IEC_60958_MASK 0x00000002
  1106. #define ASM_STREAM_CMD_OPEN_WRITE_COMPRESSED 0x00010D84
  1107. struct asm_stream_cmd_open_write_compressed {
  1108. struct apr_hdr hdr;
  1109. u32 flags;
  1110. u32 format;
  1111. } __packed;
  1112. #define ASM_STREAM_CMD_OPEN_TRANSCODE_LOOPBACK 0x00010DBA
  1113. struct asm_stream_cmd_open_transcode_loopback {
  1114. struct apr_hdr hdr;
  1115. uint32_t mode_flags;
  1116. /*
  1117. * All bits are reserved. Clients must set them to zero.
  1118. */
  1119. uint32_t src_format_id;
  1120. /*
  1121. * Specifies the media format of the input audio stream.
  1122. * Supported values:
  1123. * - #ASM_MEDIA_FMT_LINEAR_PCM
  1124. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM
  1125. */
  1126. uint32_t sink_format_id;
  1127. /*
  1128. * Specifies the media format of the output stream.
  1129. * Supported values:
  1130. * - #ASM_MEDIA_FMT_LINEAR_PCM
  1131. * - #ASM_MEDIA_FMT_MULTI_CHANNEL_PCM
  1132. * - #ASM_MEDIA_FMT_DTS
  1133. */
  1134. uint32_t audproc_topo_id;
  1135. /*
  1136. * Postprocessing topology ID, which specifies the topology (order of
  1137. * processing) of postprocessing algorithms.
  1138. * Supported values:
  1139. * - #ASM_STREAM_POSTPROC_TOPO_ID_DEFAULT
  1140. * - #ASM_STREAM_POSTPROC_TOPO_ID_PEAKMETER
  1141. * - #ASM_STREAM_POSTPROC_TOPO_ID_NONE
  1142. * - #ASM_STREAM_POSTPROC_TOPO_ID_MCH_PEAK_VOL
  1143. */
  1144. uint16_t src_endpoint_type;
  1145. /*
  1146. * Specifies the source endpoint that provides the input samples.
  1147. * Supported values:
  1148. * - 0 -- Tx device matrix or stream router
  1149. * (gateway to the hardware ports)
  1150. * - All other values are reserved
  1151. * Clients must set this field to zero. Otherwise, an error is returned.
  1152. */
  1153. uint16_t sink_endpoint_type;
  1154. /*
  1155. * Specifies the sink endpoint type.
  1156. * Supported values:
  1157. * - 0 -- Rx device matrix or stream router
  1158. * (gateway to the hardware ports)
  1159. * - All other values are reserved
  1160. * Clients must set this field to zero. Otherwise, an error is returned.
  1161. */
  1162. uint16_t bits_per_sample;
  1163. /*
  1164. * Number of bits per sample processed by the ASM modules.
  1165. * Supported values: 16, 24
  1166. */
  1167. uint16_t reserved;
  1168. /*
  1169. * This field must be set to zero.
  1170. */
  1171. } __packed;
  1172. /*
  1173. * ID of the DTS mix LFE channel to front channels parameter in the
  1174. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  1175. * asm_dts_generic_param_t
  1176. * ASM_PARAM_ID_DTS_MIX_LFE_TO_FRONT
  1177. */
  1178. #define ASM_PARAM_ID_DTS_MIX_LFE_TO_FRONT 0x00010DB6
  1179. /*
  1180. * ID of the DTS DRC ratio parameter in the
  1181. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  1182. * asm_dts_generic_param_t
  1183. * ASM_PARAM_ID_DTS_DRC_RATIO
  1184. */
  1185. #define ASM_PARAM_ID_DTS_DRC_RATIO 0x00010DB7
  1186. /*
  1187. * ID of the DTS enable dialog normalization parameter in the
  1188. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  1189. * asm_dts_generic_param_t
  1190. * ASM_PARAM_ID_DTS_ENABLE_DIALNORM
  1191. */
  1192. #define ASM_PARAM_ID_DTS_ENABLE_DIALNORM 0x00010DB8
  1193. /*
  1194. * ID of the DTS enable parse REV2AUX parameter in the
  1195. * #ASM_STREAM_CMD_SET_ENCDEC_PARAM command.
  1196. * asm_dts_generic_param_t
  1197. * ASM_PARAM_ID_DTS_ENABLE_PARSE_REV2AUX
  1198. */
  1199. #define ASM_PARAM_ID_DTS_ENABLE_PARSE_REV2AUX 0x00010DB9
  1200. struct asm_dts_generic_param {
  1201. int32_t generic_parameter;
  1202. /*
  1203. * #ASM_PARAM_ID_DTS_MIX_LFE_TO_FRONT:
  1204. * - if enabled, mixes LFE channel to front
  1205. * while downmixing (if necessary)
  1206. * - Supported values: 1-> enable, 0-> disable
  1207. * - Default: disabled
  1208. * #ASM_PARAM_ID_DTS_DRC_RATIO:
  1209. * - percentage of DRC ratio.
  1210. * - Supported values: 0-100
  1211. * - Default: 0, DRC is disabled.
  1212. * #ASM_PARAM_ID_DTS_ENABLE_DIALNORM:
  1213. * - flag to enable dialog normalization post processing.
  1214. * - Supported values: 1-> enable, 0-> disable.
  1215. * - Default: enabled.
  1216. * #ASM_PARAM_ID_DTS_ENABLE_PARSE_REV2AUX:
  1217. * - flag to enable parsing of rev2aux chunk in the bitstream.
  1218. * This chunk contains broadcast metadata.
  1219. * - Supported values: 1-> enable, 0-> disable.
  1220. * - Default: disabled.
  1221. */
  1222. };
  1223. struct asm_stream_cmd_dts_dec_param {
  1224. struct apr_hdr hdr;
  1225. u32 param_id;
  1226. u32 param_size;
  1227. struct asm_dts_generic_param generic_param;
  1228. } __packed;
  1229. #define ASM_STREAM_CMD_OPEN_READWRITE 0x00010BCC
  1230. struct asm_stream_cmd_open_read_write {
  1231. struct apr_hdr hdr;
  1232. u32 uMode;
  1233. u32 post_proc_top;
  1234. u32 write_format;
  1235. u32 read_format;
  1236. } __attribute__((packed));
  1237. #define ASM_STREAM_CMD_OPEN_LOOPBACK 0x00010D6E
  1238. struct asm_stream_cmd_open_loopback {
  1239. struct apr_hdr hdr;
  1240. u32 mode_flags;
  1241. /* Mode flags.
  1242. * Bit 0-31: reserved; client should set these bits to 0
  1243. */
  1244. u16 src_endpointype;
  1245. /* Endpoint type. 0 = Tx Matrix */
  1246. u16 sink_endpointype;
  1247. /* Endpoint type. 0 = Rx Matrix */
  1248. u32 postprocopo_id;
  1249. /* Postprocessor topology ID. Specifies the topology of
  1250. * postprocessing algorithms.
  1251. */
  1252. } __packed;
  1253. #define ADM_CMD_CONNECT_AFE_PORT 0x00010320
  1254. #define ADM_CMD_DISCONNECT_AFE_PORT 0x00010321
  1255. struct adm_cmd_connect_afe_port {
  1256. struct apr_hdr hdr;
  1257. u8 mode; /*mode represent the interface is for RX or TX*/
  1258. u8 session_id; /*ASM session ID*/
  1259. u16 afe_port_id;
  1260. } __packed;
  1261. #define ADM_CMD_CONNECT_AFE_PORT_V2 0x00010332
  1262. struct adm_cmd_connect_afe_port_v2 {
  1263. struct apr_hdr hdr;
  1264. u8 mode; /*mode represent the interface is for RX or TX*/
  1265. u8 session_id; /*ASM session ID*/
  1266. u16 afe_port_id;
  1267. u32 num_channels;
  1268. u32 sampling_rate;
  1269. } __packed;
  1270. #define ASM_STREAM_CMD_SET_ENCDEC_PARAM 0x00010C10
  1271. #define ASM_STREAM_CMD_GET_ENCDEC_PARAM 0x00010C11
  1272. #define ASM_ENCDEC_CFG_BLK_ID 0x00010C2C
  1273. #define ASM_ENABLE_SBR_PS 0x00010C63
  1274. #define ASM_CONFIGURE_DUAL_MONO 0x00010C64
  1275. struct asm_stream_cmd_encdec_cfg_blk{
  1276. struct apr_hdr hdr;
  1277. u32 param_id;
  1278. u32 param_size;
  1279. struct asm_encode_cfg_blk enc_blk;
  1280. } __attribute__((packed));
  1281. struct asm_stream_cmd_encdec_sbc_bitrate{
  1282. struct apr_hdr hdr;
  1283. u32 param_id;
  1284. struct asm_sbc_bitrate sbc_bitrate;
  1285. } __attribute__((packed));
  1286. struct asm_stream_cmd_encdec_immed_decode{
  1287. struct apr_hdr hdr;
  1288. u32 param_id;
  1289. u32 param_size;
  1290. struct asm_immed_decode dec;
  1291. } __attribute__((packed));
  1292. struct asm_stream_cmd_encdec_sbr{
  1293. struct apr_hdr hdr;
  1294. u32 param_id;
  1295. u32 param_size;
  1296. struct asm_sbr_ps sbr_ps;
  1297. } __attribute__((packed));
  1298. struct asm_stream_cmd_encdec_dualmono {
  1299. struct apr_hdr hdr;
  1300. u32 param_id;
  1301. u32 param_size;
  1302. struct asm_dual_mono channel_map;
  1303. } __packed;
  1304. #define ASM_PARAM_ID_AAC_STEREO_MIX_COEFF_SELECTION_FLAG 0x00010DD8
  1305. /* Structure for AAC decoder stereo coefficient setting. */
  1306. struct asm_aac_stereo_mix_coeff_selection_param {
  1307. struct apr_hdr hdr;
  1308. u32 param_id;
  1309. u32 param_size;
  1310. u32 aac_stereo_mix_coeff_flag;
  1311. } __packed;
  1312. #define ASM_ENCDEC_DEC_CHAN_MAP 0x00010D82
  1313. struct asm_stream_cmd_encdec_channelmap {
  1314. struct apr_hdr hdr;
  1315. u32 param_id;
  1316. u32 param_size;
  1317. struct asm_dec_chan_map chan_map;
  1318. } __packed;
  1319. #define ASM_STREAM _CMD_ADJUST_SAMPLES 0x00010C0A
  1320. struct asm_stream_cmd_adjust_samples{
  1321. struct apr_hdr hdr;
  1322. u16 nsamples;
  1323. u16 reserved;
  1324. } __attribute__((packed));
  1325. #define ASM_STREAM_CMD_TAP_POPP_PCM 0x00010BF9
  1326. struct asm_stream_cmd_tap_popp_pcm{
  1327. struct apr_hdr hdr;
  1328. u16 enable;
  1329. u16 reserved;
  1330. u32 module_id;
  1331. } __attribute__((packed));
  1332. /* Session Level commands */
  1333. #define ASM_SESSION_CMD_MEMORY_MAP 0x00010C32
  1334. struct asm_stream_cmd_memory_map{
  1335. struct apr_hdr hdr;
  1336. u32 buf_add;
  1337. u32 buf_size;
  1338. u16 mempool_id;
  1339. u16 reserved;
  1340. } __attribute__((packed));
  1341. #define ASM_SESSION_CMD_MEMORY_UNMAP 0x00010C33
  1342. struct asm_stream_cmd_memory_unmap{
  1343. struct apr_hdr hdr;
  1344. u32 buf_add;
  1345. } __attribute__((packed));
  1346. #define ASM_SESSION_CMD_MEMORY_MAP_REGIONS 0x00010C45
  1347. struct asm_memory_map_regions{
  1348. u32 phys;
  1349. u32 buf_size;
  1350. } __attribute__((packed));
  1351. struct asm_stream_cmd_memory_map_regions{
  1352. struct apr_hdr hdr;
  1353. u16 mempool_id;
  1354. u16 nregions;
  1355. } __attribute__((packed));
  1356. #define ASM_SESSION_CMD_MEMORY_UNMAP_REGIONS 0x00010C46
  1357. struct asm_memory_unmap_regions{
  1358. u32 phys;
  1359. } __attribute__((packed));
  1360. struct asm_stream_cmd_memory_unmap_regions{
  1361. struct apr_hdr hdr;
  1362. u16 nregions;
  1363. u16 reserved;
  1364. } __attribute__((packed));
  1365. #define ASM_SESSION_CMD_RUN 0x00010BD2
  1366. struct asm_stream_cmd_run{
  1367. struct apr_hdr hdr;
  1368. u32 flags;
  1369. u32 msw_ts;
  1370. u32 lsw_ts;
  1371. } __attribute__((packed));
  1372. /* Session level events */
  1373. #define ASM_SESSION_CMD_REGISTER_FOR_RX_UNDERFLOW_EVENTS 0x00010BD5
  1374. struct asm_stream_cmd_reg_rx_underflow_event{
  1375. struct apr_hdr hdr;
  1376. u16 enable;
  1377. u16 reserved;
  1378. } __attribute__((packed));
  1379. #define ASM_SESSION_CMD_REGISTER_FOR_TX_OVERFLOW_EVENTS 0x00010BD6
  1380. struct asm_stream_cmd_reg_tx_overflow_event{
  1381. struct apr_hdr hdr;
  1382. u16 enable;
  1383. u16 reserved;
  1384. } __attribute__((packed));
  1385. /* Data Path commands */
  1386. #define ASM_DATA_CMD_WRITE 0x00010BD9
  1387. struct asm_stream_cmd_write{
  1388. struct apr_hdr hdr;
  1389. u32 buf_add;
  1390. u32 avail_bytes;
  1391. u32 uid;
  1392. u32 msw_ts;
  1393. u32 lsw_ts;
  1394. u32 uflags;
  1395. } __attribute__((packed));
  1396. #define ASM_DATA_CMD_READ 0x00010BDA
  1397. struct asm_stream_cmd_read{
  1398. struct apr_hdr hdr;
  1399. u32 buf_add;
  1400. u32 buf_size;
  1401. u32 uid;
  1402. } __attribute__((packed));
  1403. #define ASM_DATA_CMD_READ_COMPRESSED 0x00010DBF
  1404. struct asm_stream_cmd_read_compressed {
  1405. struct apr_hdr hdr;
  1406. u32 buf_add;
  1407. u32 buf_size;
  1408. u32 uid;
  1409. } __packed;
  1410. #define ASM_DATA_CMD_MEDIA_FORMAT_UPDATE 0x00010BDC
  1411. #define ASM_DATA_EVENT_ENC_SR_CM_NOTIFY 0x00010BDE
  1412. struct asm_stream_media_format_update{
  1413. struct apr_hdr hdr;
  1414. u32 format;
  1415. u32 cfg_size;
  1416. union {
  1417. struct asm_pcm_cfg pcm_cfg;
  1418. struct asm_adpcm_cfg adpcm_cfg;
  1419. struct asm_yadpcm_cfg yadpcm_cfg;
  1420. struct asm_midi_cfg midi_cfg;
  1421. struct asm_wma_cfg wma_cfg;
  1422. struct asm_wmapro_cfg wmapro_cfg;
  1423. struct asm_aac_cfg aac_cfg;
  1424. struct asm_flac_cfg flac_cfg;
  1425. struct asm_vorbis_cfg vorbis_cfg;
  1426. struct asm_multi_channel_pcm_fmt_blk multi_ch_pcm_cfg;
  1427. struct asm_amrwbplus_cfg amrwbplus_cfg;
  1428. } __attribute__((packed)) write_cfg;
  1429. } __attribute__((packed));
  1430. /* Command Responses */
  1431. #define ASM_STREAM_CMDRSP_GET_ENCDEC_PARAM 0x00010C12
  1432. struct asm_stream_cmdrsp_get_readwrite_param{
  1433. struct apr_hdr hdr;
  1434. u32 status;
  1435. u32 param_id;
  1436. u16 param_size;
  1437. u16 padding;
  1438. union {
  1439. struct asm_sbc_bitrate sbc_bitrate;
  1440. struct asm_immed_decode aac_dec;
  1441. } __attribute__((packed)) read_write_cfg;
  1442. } __attribute__((packed));
  1443. #define ASM_SESSION_CMDRSP_GET_SESSION_TIME 0x00010BD8
  1444. struct asm_stream_cmdrsp_get_session_time{
  1445. struct apr_hdr hdr;
  1446. u32 status;
  1447. u32 msw_ts;
  1448. u32 lsw_ts;
  1449. } __attribute__((packed));
  1450. #define ASM_DATA_EVENT_WRITE_DONE 0x00010BDF
  1451. struct asm_data_event_write_done{
  1452. u32 buf_add;
  1453. u32 status;
  1454. } __attribute__((packed));
  1455. #define ASM_DATA_EVENT_READ_DONE 0x00010BE0
  1456. struct asm_data_event_read_done{
  1457. u32 status;
  1458. u32 buffer_add;
  1459. u32 enc_frame_size;
  1460. u32 offset;
  1461. u32 msw_ts;
  1462. u32 lsw_ts;
  1463. u32 flags;
  1464. u32 num_frames;
  1465. u32 id;
  1466. } __attribute__((packed));
  1467. #define ASM_DATA_EVENT_READ_COMPRESSED_DONE 0x00010DC0
  1468. struct asm_data_event_read_compressed_done {
  1469. u32 status;
  1470. u32 buffer_add;
  1471. u32 enc_frame_size;
  1472. u32 offset;
  1473. u32 msw_ts;
  1474. u32 lsw_ts;
  1475. u32 flags;
  1476. u32 num_frames;
  1477. u32 id;
  1478. } __packed;
  1479. #define ASM_DATA_EVENT_SR_CM_CHANGE_NOTIFY 0x00010C65
  1480. struct asm_data_event_sr_cm_change_notify {
  1481. u32 sample_rate;
  1482. u16 no_of_channels;
  1483. u16 reserved;
  1484. u8 channel_map[8];
  1485. } __packed;
  1486. /* service level events */
  1487. #define ASM_SERVICE_CMDRSP_GET_STREAM_HANDLES 0x00010C1B
  1488. struct asm_svc_cmdrsp_get_strm_handles{
  1489. struct apr_hdr hdr;
  1490. u32 num_handles;
  1491. u32 stream_handles;
  1492. } __attribute__((packed));
  1493. #define ASM_SERVICE_CMDRSP_GET_WALLCLOCK_TIME 0x00010C1A
  1494. struct asm_svc_cmdrsp_get_wallclock_time{
  1495. struct apr_hdr hdr;
  1496. u32 status;
  1497. u32 msw_ts;
  1498. u32 lsw_ts;
  1499. } __attribute__((packed));
  1500. /*
  1501. * Error code
  1502. */
  1503. #define ADSP_EOK 0x00000000 /* Success / completed / no errors. */
  1504. #define ADSP_EFAILED 0x00000001 /* General failure. */
  1505. #define ADSP_EBADPARAM 0x00000002 /* Bad operation parameter(s). */
  1506. #define ADSP_EUNSUPPORTED 0x00000003 /* Unsupported routine/operation. */
  1507. #define ADSP_EVERSION 0x00000004 /* Unsupported version. */
  1508. #define ADSP_EUNEXPECTED 0x00000005 /* Unexpected problem encountered. */
  1509. #define ADSP_EPANIC 0x00000006 /* Unhandled problem occurred. */
  1510. #define ADSP_ENORESOURCE 0x00000007 /* Unable to allocate resource(s). */
  1511. #define ADSP_EHANDLE 0x00000008 /* Invalid handle. */
  1512. #define ADSP_EALREADY 0x00000009 /* Operation is already processed. */
  1513. #define ADSP_ENOTREADY 0x0000000A /* Operation not ready to be processed*/
  1514. #define ADSP_EPENDING 0x0000000B /* Operation is pending completion*/
  1515. #define ADSP_EBUSY 0x0000000C /* Operation could not be accepted or
  1516. processed. */
  1517. #define ADSP_EABORTED 0x0000000D /* Operation aborted due to an error. */
  1518. #define ADSP_EPREEMPTED 0x0000000E /* Operation preempted by higher priority*/
  1519. #define ADSP_ECONTINUE 0x0000000F /* Operation requests intervention
  1520. to complete. */
  1521. #define ADSP_EIMMEDIATE 0x00000010 /* Operation requests immediate
  1522. intervention to complete. */
  1523. #define ADSP_ENOTIMPL 0x00000011 /* Operation is not implemented. */
  1524. #define ADSP_ENEEDMORE 0x00000012 /* Operation needs more data or resources*/
  1525. /* SRS TRUMEDIA GUIDS */
  1526. #define SRS_TRUMEDIA_TOPOLOGY_ID 0x00010D90
  1527. #define SRS_TRUMEDIA_MODULE_ID 0x10005010
  1528. #define SRS_TRUMEDIA_PARAMS 0x10005011
  1529. #define SRS_TRUMEDIA_PARAMS_WOWHD 0x10005012
  1530. #define SRS_TRUMEDIA_PARAMS_CSHP 0x10005013
  1531. #define SRS_TRUMEDIA_PARAMS_HPF 0x10005014
  1532. #define SRS_TRUMEDIA_PARAMS_PEQ 0x10005015
  1533. #define SRS_TRUMEDIA_PARAMS_HL 0x10005016
  1534. /* SRS STUDIO SOUND 3D GUIDS */
  1535. #define SRS_SS3D_TOPOLOGY_ID 0x00010720
  1536. #define SRS_SS3D_MODULE_ID 0x10005020
  1537. #define SRS_SS3D_PARAMS 0x10005021
  1538. #define SRS_SS3D_PARAMS_CTRL 0x10005022
  1539. #define SRS_SS3D_PARAMS_FILTER 0x10005023
  1540. /* SRS ALSA CMD MASKS */
  1541. #define SRS_CMD_UPLOAD 0x7FFF0000
  1542. #define SRS_PARAM_INDEX_MASK 0x80000000
  1543. #define SRS_PARAM_OFFSET_MASK 0x3FFF0000
  1544. #define SRS_PARAM_VALUE_MASK 0x0000FFFF
  1545. /* SRS TRUMEDIA start */
  1546. #define SRS_ID_GLOBAL 0x00000001
  1547. #define SRS_ID_WOWHD 0x00000002
  1548. #define SRS_ID_CSHP 0x00000003
  1549. #define SRS_ID_HPF 0x00000004
  1550. #define SRS_ID_PEQ 0x00000005
  1551. #define SRS_ID_HL 0x00000006
  1552. struct srs_trumedia_params_GLOBAL {
  1553. uint8_t v1;
  1554. uint8_t v2;
  1555. uint8_t v3;
  1556. uint8_t v4;
  1557. uint8_t v5;
  1558. uint8_t v6;
  1559. uint8_t v7;
  1560. uint8_t v8;
  1561. } __packed;
  1562. struct srs_trumedia_params_WOWHD {
  1563. uint32_t v1;
  1564. uint16_t v2;
  1565. uint16_t v3;
  1566. uint16_t v4;
  1567. uint16_t v5;
  1568. uint16_t v6;
  1569. uint16_t v7;
  1570. uint16_t v8;
  1571. uint16_t v____A1;
  1572. uint32_t v9;
  1573. uint16_t v10;
  1574. uint16_t v11;
  1575. uint32_t v12[16];
  1576. } __packed;
  1577. struct srs_trumedia_params_CSHP {
  1578. uint32_t v1;
  1579. uint16_t v2;
  1580. uint16_t v3;
  1581. uint16_t v4;
  1582. uint16_t v5;
  1583. uint16_t v6;
  1584. uint16_t v____A1;
  1585. uint32_t v7;
  1586. uint16_t v8;
  1587. uint16_t v9;
  1588. uint32_t v10[16];
  1589. } __packed;
  1590. struct srs_trumedia_params_HPF {
  1591. uint32_t v1;
  1592. uint32_t v2[26];
  1593. } __packed;
  1594. struct srs_trumedia_params_PEQ {
  1595. uint32_t v1;
  1596. uint16_t v2;
  1597. uint16_t v3;
  1598. uint16_t v4;
  1599. uint16_t v____A1;
  1600. uint32_t v5[26];
  1601. uint32_t v6[26];
  1602. } __packed;
  1603. struct srs_trumedia_params_HL {
  1604. uint16_t v1;
  1605. uint16_t v2;
  1606. uint16_t v3;
  1607. uint16_t v____A1;
  1608. int32_t v4;
  1609. uint32_t v5;
  1610. uint16_t v6;
  1611. uint16_t v____A2;
  1612. uint32_t v7;
  1613. } __packed;
  1614. struct srs_trumedia_params {
  1615. struct srs_trumedia_params_GLOBAL global;
  1616. struct srs_trumedia_params_WOWHD wowhd;
  1617. struct srs_trumedia_params_CSHP cshp;
  1618. struct srs_trumedia_params_HPF hpf;
  1619. struct srs_trumedia_params_PEQ peq;
  1620. struct srs_trumedia_params_HL hl;
  1621. } __packed;
  1622. int srs_trumedia_open(int port_id, int srs_tech_id, void *srs_params);
  1623. /* SRS TruMedia end */
  1624. /* SRS Studio Sound 3D start */
  1625. #define SRS_ID_SS3D_GLOBAL 0x00000001
  1626. #define SRS_ID_SS3D_CTRL 0x00000002
  1627. #define SRS_ID_SS3D_FILTER 0x00000003
  1628. struct srs_SS3D_params_GLOBAL {
  1629. uint8_t v1;
  1630. uint8_t v2;
  1631. uint8_t v3;
  1632. uint8_t v4;
  1633. uint8_t v5;
  1634. uint8_t v6;
  1635. uint8_t v7;
  1636. uint8_t v8;
  1637. } __packed;
  1638. struct srs_SS3D_ctrl_params {
  1639. uint8_t v[236];
  1640. } __packed;
  1641. struct srs_SS3D_filter_params {
  1642. uint8_t v[28 + 2752];
  1643. } __packed;
  1644. struct srs_SS3D_params {
  1645. struct srs_SS3D_params_GLOBAL global;
  1646. struct srs_SS3D_ctrl_params ss3d;
  1647. struct srs_SS3D_filter_params ss3d_f;
  1648. } __packed;
  1649. int srs_ss3d_open(int port_id, int srs_tech_id, void *srs_params);
  1650. /* SRS Studio Sound 3D end */
  1651. #endif /*_APR_AUDIO_H_*/