q6voice.h 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062
  1. /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef __QDSP6VOICE_H__
  13. #define __QDSP6VOICE_H__
  14. #include <linux/msm_ion.h>
  15. #include <sound/voice_params.h>
  16. #include <dsp/rtac.h>
  17. #include <ipc/apr.h>
  18. #define MAX_VOC_PKT_SIZE 642
  19. #define SESSION_NAME_LEN 20
  20. #define NUM_OF_MEMORY_BLOCKS 1
  21. #define NUM_OF_BUFFERS 2
  22. #define VSS_NUM_CHANNELS_MAX 8
  23. #define VSS_CHANNEL_MAPPING_SIZE (sizeof(uint8_t) * VSS_NUM_CHANNELS_MAX)
  24. /*
  25. * BUFFER BLOCK SIZE based on
  26. * the supported page size
  27. */
  28. #define BUFFER_BLOCK_SIZE 4096
  29. #define MAX_COL_INFO_SIZE 324
  30. #define VOC_REC_UPLINK 0x00
  31. #define VOC_REC_DOWNLINK 0x01
  32. #define VOC_REC_BOTH 0x02
  33. #define VSS_IVERSION_CMD_GET 0x00011378
  34. #define VSS_IVERSION_RSP_GET 0x00011379
  35. #define CVD_VERSION_STRING_MAX_SIZE 31
  36. #define CVD_VERSION_DEFAULT ""
  37. #define CVD_VERSION_0_0 "0.0"
  38. #define CVD_VERSION_2_1 "2.1"
  39. #define CVD_VERSION_2_2 "2.2"
  40. #define CVD_VERSION_2_3 "2.3"
  41. #define CVD_INT_VERSION_DEFAULT 0
  42. #define CVD_INT_VERSION_0_0 1
  43. #define CVD_INT_VERSION_2_1 2
  44. #define CVD_INT_VERSION_2_2 3
  45. #define CVD_INT_VERSION_2_3 4
  46. #define CVD_INT_VERSION_LAST CVD_INT_VERSION_2_3
  47. #define CVD_INT_VERSION_MAX (CVD_INT_VERSION_LAST + 1)
  48. struct cvd_version_table {
  49. char cvd_ver[CVD_VERSION_STRING_MAX_SIZE];
  50. int cvd_ver_int;
  51. };
  52. int voc_get_cvd_version(char *cvd_version);
  53. /* Payload structure for the VSS_IVERSION_RSP_GET command response */
  54. struct vss_iversion_rsp_get_t {
  55. char version[CVD_VERSION_STRING_MAX_SIZE];
  56. /* NULL-terminated version string */
  57. };
  58. enum {
  59. CVP_VOC_RX_TOPOLOGY_CAL = 0,
  60. CVP_VOC_TX_TOPOLOGY_CAL,
  61. CVP_VOCPROC_CAL,
  62. CVP_VOCVOL_CAL,
  63. CVP_VOCDEV_CFG_CAL,
  64. CVP_VOCPROC_COL_CAL,
  65. CVP_VOCVOL_COL_CAL,
  66. CVS_VOCSTRM_CAL,
  67. CVS_VOCSTRM_COL_CAL,
  68. VOICE_RTAC_INFO_CAL,
  69. VOICE_RTAC_APR_CAL,
  70. MAX_VOICE_CAL_TYPES
  71. };
  72. struct voice_header {
  73. uint32_t id;
  74. uint32_t data_len;
  75. };
  76. struct voice_init {
  77. struct voice_header hdr;
  78. void *cb_handle;
  79. };
  80. /* Stream information payload structure */
  81. struct stream_data {
  82. uint32_t stream_mute;
  83. uint32_t stream_mute_ramp_duration_ms;
  84. };
  85. /* Device information payload structure */
  86. struct device_data {
  87. uint32_t dev_mute;
  88. uint32_t sample_rate;
  89. uint16_t bits_per_sample;
  90. uint8_t channel_mapping[VSS_NUM_CHANNELS_MAX];
  91. uint32_t enabled;
  92. uint32_t dev_id;
  93. uint32_t port_id;
  94. uint32_t volume_step_value;
  95. uint32_t volume_ramp_duration_ms;
  96. uint32_t dev_mute_ramp_duration_ms;
  97. uint32_t no_of_channels;
  98. };
  99. /*
  100. * Format information structure to match
  101. * vss_param_endpoint_media_format_info_t
  102. */
  103. struct media_format_info {
  104. uint32_t port_id;
  105. uint16_t num_channels;
  106. uint16_t bits_per_sample;
  107. uint32_t sample_rate;
  108. uint8_t channel_mapping[VSS_NUM_CHANNELS_MAX];
  109. };
  110. enum {
  111. VOC_GENERIC_SET_PARAM_TOKEN = 0,
  112. VOC_RTAC_SET_PARAM_TOKEN,
  113. VOC_SET_MEDIA_FORMAT_PARAM_TOKEN,
  114. VOC_SET_PARAM_TOKEN_MAX
  115. };
  116. struct voice_dev_route_state {
  117. u16 rx_route_flag;
  118. u16 tx_route_flag;
  119. };
  120. struct voice_rec_route_state {
  121. u16 ul_flag;
  122. u16 dl_flag;
  123. };
  124. enum {
  125. VOC_INIT = 0,
  126. VOC_RUN,
  127. VOC_CHANGE,
  128. VOC_RELEASE,
  129. VOC_ERROR,
  130. VOC_STANDBY,
  131. };
  132. struct mem_buffer {
  133. dma_addr_t phys;
  134. void *data;
  135. uint32_t size; /* size of buffer */
  136. };
  137. struct share_mem_buf {
  138. struct dma_buf *dma_buf;
  139. struct mem_buffer buf[NUM_OF_BUFFERS];
  140. };
  141. struct mem_map_table {
  142. dma_addr_t phys;
  143. void *data;
  144. size_t size; /* size of buffer */
  145. struct dma_buf *dma_buf;
  146. };
  147. /* Common */
  148. #define VSS_ICOMMON_CMD_SET_UI_PROPERTY 0x00011103
  149. /* Set a UI property */
  150. #define VSS_ICOMMON_CMD_MAP_MEMORY 0x00011025
  151. #define VSS_ICOMMON_CMD_UNMAP_MEMORY 0x00011026
  152. /* General shared memory; byte-accessible, 4 kB-aligned. */
  153. #define VSS_ICOMMON_MAP_MEMORY_SHMEM8_4K_POOL 3
  154. struct vss_icommon_cmd_map_memory_t {
  155. uint32_t phys_addr;
  156. /* Physical address of a memory region; must be at least
  157. * 4 kB aligned.
  158. */
  159. uint32_t mem_size;
  160. /* Number of bytes in the region; should be a multiple of 32. */
  161. uint16_t mem_pool_id;
  162. /* Type of memory being provided. The memory ID implicitly defines
  163. * the characteristics of the memory. The characteristics might include
  164. * alignment type, permissions, etc.
  165. * Memory pool ID. Possible values:
  166. * 3 -- VSS_ICOMMON_MEM_TYPE_SHMEM8_4K_POOL.
  167. */
  168. } __packed;
  169. struct vss_icommon_cmd_unmap_memory_t {
  170. uint32_t phys_addr;
  171. /* Physical address of a memory region; must be at least
  172. * 4 kB aligned.
  173. */
  174. } __packed;
  175. struct vss_map_memory_cmd {
  176. struct apr_hdr hdr;
  177. struct vss_icommon_cmd_map_memory_t vss_map_mem;
  178. } __packed;
  179. struct vss_unmap_memory_cmd {
  180. struct apr_hdr hdr;
  181. struct vss_icommon_cmd_unmap_memory_t vss_unmap_mem;
  182. } __packed;
  183. struct vss_param_endpoint_media_format_info_t {
  184. /* AFE port ID to which this media format corresponds to. */
  185. uint32_t port_id;
  186. /*
  187. * Number of channels of data.
  188. * Supported values: 1 to 8
  189. */
  190. uint16_t num_channels;
  191. /*
  192. * Bits per sample of data.
  193. * Supported values: 16 and 24
  194. */
  195. uint16_t bits_per_sample;
  196. /*
  197. * Sampling rate in Hz.
  198. * Supported values: 8000, 11025, 16000, 22050, 24000, 32000,
  199. * 44100, 48000, 88200, 96000, 176400, and 192000
  200. */
  201. uint32_t sample_rate;
  202. /*
  203. * The channel[i] mapping describes channel i. Each element i
  204. * of the array describes channel i inside the data buffer. An
  205. * unused or unknown channel is set to 0.
  206. */
  207. uint8_t channel_mapping[VSS_NUM_CHANNELS_MAX];
  208. } __packed;
  209. struct vss_param_vocproc_dev_channel_info_t {
  210. uint32_t num_channels;
  211. uint32_t bits_per_sample;
  212. uint8_t channel_mapping[VSS_NUM_CHANNELS_MAX];
  213. } __packed;
  214. struct vss_param_channel_mixer_info_t {
  215. uint32_t index;
  216. uint16_t num_output_channels;
  217. uint16_t num_input_channels;
  218. uint16_t out_channel_map[2];
  219. uint16_t in_channel_map[1];
  220. uint16_t channel_weight_coeff[2][1];
  221. uint16_t reserved;
  222. } __packed;
  223. struct vss_param_mfc_config_info_t {
  224. uint32_t sample_rate;
  225. uint16_t bits_per_sample;
  226. uint16_t num_channels;
  227. uint16_t channel_type[VSS_NUM_CHANNELS_MAX];
  228. } __packed;
  229. struct vss_icommon_param_data_t {
  230. /* Valid ID of the module. */
  231. uint32_t module_id;
  232. /* Valid ID of the parameter. */
  233. uint32_t param_id;
  234. /*
  235. * Data size of the structure relating to the param_id/module_id
  236. * combination in uint8_t bytes.
  237. */
  238. uint16_t param_size;
  239. /* This field must be set to zero. */
  240. uint16_t reserved;
  241. /*
  242. * Parameter data payload when inband. Should have size param_size.
  243. * Bit size of payload must be a multiple of 4.
  244. */
  245. union {
  246. struct vss_param_endpoint_media_format_info_t media_format_info;
  247. };
  248. } __packed;
  249. struct vss_icommon_param_data_channel_info_v2_t {
  250. /* Valid ID of the module. */
  251. uint32_t module_id;
  252. /* Valid ID of the parameter. */
  253. uint32_t param_id;
  254. /*
  255. * Data size of the structure relating to the param_id/module_id
  256. * combination in uint8_t bytes.
  257. */
  258. uint16_t param_size;
  259. /* This field must be set to zero. */
  260. uint16_t reserved;
  261. struct vss_param_vocproc_dev_channel_info_t channel_info;
  262. } __packed;
  263. struct vss_icommon_cmd_set_param_channel_info_v2_t {
  264. /*
  265. * Pointer to the unique identifier for an address (physical/virtual).
  266. *
  267. * If the parameter data payload is within the message payload
  268. * (in-band), set this field to 0. The parameter data begins at the
  269. * specified data payload address.
  270. *
  271. * If the parameter data is out-of-band, this field is the handle to
  272. * the physical address in the shared memory that holds the parameter
  273. * data.
  274. */
  275. uint32_t mem_handle;
  276. /*
  277. * Location of the parameter data payload.
  278. *
  279. * The payload is an array of vss_icommon_param_data_t. If the
  280. * mem_handle is 0, this field is ignored.
  281. */
  282. uint64_t mem_address;
  283. /* Size of the parameter data payload in bytes. */
  284. uint32_t mem_size;
  285. struct vss_icommon_param_data_channel_info_v2_t param_data;
  286. } __packed;
  287. struct vss_icommon_param_data_ch_mixer_v2_t {
  288. /* Valid ID of the module. */
  289. uint32_t module_id;
  290. /* Valid ID of the parameter. */
  291. uint32_t param_id;
  292. /*
  293. * Data size of the structure relating to the param_id/module_id
  294. * combination in uint8_t bytes.
  295. */
  296. uint16_t param_size;
  297. /* This field must be set to zero. */
  298. uint16_t reserved;
  299. struct vss_param_channel_mixer_info_t ch_mixer_info;
  300. } __packed;
  301. struct vss_icommon_cmd_set_param_ch_mixer_v2_t {
  302. /*
  303. * Pointer to the unique identifier for an address (physical/virtual).
  304. *
  305. * If the parameter data payload is within the message payload
  306. * (in-band), set this field to 0. The parameter data begins at the
  307. * specified data payload address.
  308. *
  309. * If the parameter data is out-of-band, this field is the handle to
  310. * the physical address in the shared memory that holds the parameter
  311. * data.
  312. */
  313. uint32_t mem_handle;
  314. /*
  315. * Location of the parameter data payload.
  316. *
  317. * The payload is an array of vss_icommon_param_data_t. If the
  318. * mem_handle is 0, this field is ignored.
  319. */
  320. uint64_t mem_address;
  321. /* Size of the parameter data payload in bytes. */
  322. uint32_t mem_size;
  323. struct vss_icommon_param_data_ch_mixer_v2_t param_data;
  324. } __packed;
  325. struct vss_icommon_param_data_mfc_config_v2_t {
  326. /* Valid ID of the module. */
  327. uint32_t module_id;
  328. /* Valid ID of the parameter. */
  329. uint32_t param_id;
  330. /*
  331. * Data size of the structure relating to the param_id/module_id
  332. * combination in uint8_t bytes.
  333. */
  334. uint16_t param_size;
  335. /* This field must be set to zero. */
  336. uint16_t reserved;
  337. struct vss_param_mfc_config_info_t mfc_config_info;
  338. } __packed;
  339. struct vss_icommon_cmd_set_param_mfc_config_v2_t {
  340. /*
  341. * Pointer to the unique identifier for an address (physical/virtual).
  342. *
  343. * If the parameter data payload is within the message payload
  344. * (in-band), set this field to 0. The parameter data begins at the
  345. * specified data payload address.
  346. *
  347. * If the parameter data is out-of-band, this field is the handle to
  348. * the physical address in the shared memory that holds the parameter
  349. * data.
  350. */
  351. uint32_t mem_handle;
  352. /*
  353. * Location of the parameter data payload.
  354. *
  355. * The payload is an array of vss_icommon_param_data_t. If the
  356. * mem_handle is 0, this field is ignored.
  357. */
  358. uint64_t mem_address;
  359. /* Size of the parameter data payload in bytes. */
  360. uint32_t mem_size;
  361. struct vss_icommon_param_data_mfc_config_v2_t param_data;
  362. } __packed;
  363. /* Payload structure for the VSS_ICOMMON_CMD_SET_PARAM_V2 command. */
  364. struct vss_icommon_cmd_set_param_v2_t {
  365. /*
  366. * Pointer to the unique identifier for an address (physical/virtual).
  367. *
  368. * If the parameter data payload is within the message payload
  369. * (in-band), set this field to 0. The parameter data begins at the
  370. * specified data payload address.
  371. *
  372. * If the parameter data is out-of-band, this field is the handle to
  373. * the physical address in the shared memory that holds the parameter
  374. * data.
  375. */
  376. uint32_t mem_handle;
  377. /*
  378. * Location of the parameter data payload.
  379. *
  380. * The payload is an array of vss_icommon_param_data_t. If the
  381. * mem_handle is 0, this field is ignored.
  382. */
  383. uint64_t mem_address;
  384. /* Size of the parameter data payload in bytes. */
  385. uint32_t mem_size;
  386. /* Parameter data payload when the data is inband. */
  387. struct vss_icommon_param_data_t param_data;
  388. } __packed;
  389. /* TO MVM commands */
  390. #define VSS_IMVM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x000110FF
  391. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  392. #define VSS_IMVM_CMD_SET_POLICY_DUAL_CONTROL 0x00011327
  393. /*
  394. * VSS_IMVM_CMD_SET_POLICY_DUAL_CONTROL
  395. * Description: This command is required to let MVM know
  396. * who is in control of session.
  397. * Payload: Defined by vss_imvm_cmd_set_policy_dual_control_t.
  398. * Result: Wait for APRV2_IBASIC_RSP_RESULT response.
  399. */
  400. #define VSS_IMVM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110FE
  401. /* Create a new full control MVM session. */
  402. #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
  403. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  404. #define VSS_IMVM_CMD_ATTACH_STREAM 0x0001123C
  405. /* Attach a stream to the MVM. */
  406. #define VSS_IMVM_CMD_DETACH_STREAM 0x0001123D
  407. /* Detach a stream from the MVM. */
  408. #define VSS_IMVM_CMD_ATTACH_VOCPROC 0x0001123E
  409. /* Attach a vocproc to the MVM. The MVM will symmetrically connect this vocproc
  410. * to all the streams currently attached to it.
  411. */
  412. #define VSS_IMVM_CMD_DETACH_VOCPROC 0x0001123F
  413. /* Detach a vocproc from the MVM. The MVM will symmetrically disconnect this
  414. * vocproc from all the streams to which it is currently attached.
  415. */
  416. #define VSS_IMVM_CMD_START_VOICE 0x00011190
  417. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  418. #define VSS_IMVM_CMD_STANDBY_VOICE 0x00011191
  419. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  420. #define VSS_IMVM_CMD_STOP_VOICE 0x00011192
  421. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  422. #define VSS_IMVM_CMD_PAUSE_VOICE 0x0001137D
  423. /* No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  424. #define VSS_ISTREAM_CMD_ATTACH_VOCPROC 0x000110F8
  425. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  426. #define VSS_ISTREAM_CMD_DETACH_VOCPROC 0x000110F9
  427. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  428. #define VSS_ISTREAM_CMD_SET_TTY_MODE 0x00011196
  429. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  430. #define VSS_ICOMMON_CMD_SET_NETWORK 0x0001119C
  431. /* Set the network type. */
  432. #define VSS_ICOMMON_CMD_SET_VOICE_TIMING 0x000111E0
  433. /* Set the voice timing parameters. */
  434. #define VSS_IMEMORY_CMD_MAP_PHYSICAL 0x00011334
  435. #define VSS_IMEMORY_RSP_MAP 0x00011336
  436. #define VSS_IMEMORY_CMD_UNMAP 0x00011337
  437. #define VSS_IMVM_CMD_SET_CAL_NETWORK 0x0001137A
  438. #define VSS_IMVM_CMD_SET_CAL_MEDIA_TYPE 0x0001137B
  439. #define VSS_IHDVOICE_CMD_ENABLE 0x000130A2
  440. #define VSS_IHDVOICE_CMD_DISABLE 0x000130A3
  441. enum msm_audio_voc_rate {
  442. VOC_0_RATE, /* Blank frame */
  443. VOC_8_RATE, /* 1/8 rate */
  444. VOC_4_RATE, /* 1/4 rate */
  445. VOC_2_RATE, /* 1/2 rate */
  446. VOC_1_RATE, /* Full rate */
  447. VOC_8_RATE_NC /* Noncritical 1/8 rate */
  448. };
  449. struct vss_istream_cmd_set_tty_mode_t {
  450. uint32_t mode;
  451. /**<
  452. * TTY mode.
  453. *
  454. * 0 : TTY disabled
  455. * 1 : HCO
  456. * 2 : VCO
  457. * 3 : FULL
  458. */
  459. } __packed;
  460. struct vss_istream_cmd_attach_vocproc_t {
  461. uint16_t handle;
  462. /**< Handle of vocproc being attached. */
  463. } __packed;
  464. struct vss_istream_cmd_detach_vocproc_t {
  465. uint16_t handle;
  466. /**< Handle of vocproc being detached. */
  467. } __packed;
  468. struct vss_imvm_cmd_attach_stream_t {
  469. uint16_t handle;
  470. /* The stream handle to attach. */
  471. } __packed;
  472. struct vss_imvm_cmd_detach_stream_t {
  473. uint16_t handle;
  474. /* The stream handle to detach. */
  475. } __packed;
  476. struct vss_icommon_cmd_set_network_t {
  477. uint32_t network_id;
  478. /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */
  479. } __packed;
  480. struct vss_icommon_cmd_set_voice_timing_t {
  481. uint16_t mode;
  482. /*
  483. * The vocoder frame synchronization mode.
  484. *
  485. * 0 : No frame sync.
  486. * 1 : Hard VFR (20ms Vocoder Frame Reference interrupt).
  487. */
  488. uint16_t enc_offset;
  489. /*
  490. * The offset in microseconds from the VFR to deliver a Tx vocoder
  491. * packet. The offset should be less than 20000us.
  492. */
  493. uint16_t dec_req_offset;
  494. /*
  495. * The offset in microseconds from the VFR to request for an Rx vocoder
  496. * packet. The offset should be less than 20000us.
  497. */
  498. uint16_t dec_offset;
  499. /*
  500. * The offset in microseconds from the VFR to indicate the deadline to
  501. * receive an Rx vocoder packet. The offset should be less than 20000us.
  502. * Rx vocoder packets received after this deadline are not guaranteed to
  503. * be processed.
  504. */
  505. } __packed;
  506. struct vss_imvm_cmd_create_control_session_t {
  507. char name[SESSION_NAME_LEN];
  508. /*
  509. * A variable-sized stream name.
  510. *
  511. * The stream name size is the payload size minus the size of the other
  512. * fields.
  513. */
  514. } __packed;
  515. struct vss_imvm_cmd_set_policy_dual_control_t {
  516. bool enable_flag;
  517. /* Set to TRUE to enable modem state machine control */
  518. } __packed;
  519. struct mvm_attach_vocproc_cmd {
  520. struct apr_hdr hdr;
  521. struct vss_istream_cmd_attach_vocproc_t mvm_attach_cvp_handle;
  522. } __packed;
  523. struct mvm_detach_vocproc_cmd {
  524. struct apr_hdr hdr;
  525. struct vss_istream_cmd_detach_vocproc_t mvm_detach_cvp_handle;
  526. } __packed;
  527. struct mvm_create_ctl_session_cmd {
  528. struct apr_hdr hdr;
  529. struct vss_imvm_cmd_create_control_session_t mvm_session;
  530. } __packed;
  531. struct mvm_modem_dual_control_session_cmd {
  532. struct apr_hdr hdr;
  533. struct vss_imvm_cmd_set_policy_dual_control_t voice_ctl;
  534. } __packed;
  535. struct mvm_set_tty_mode_cmd {
  536. struct apr_hdr hdr;
  537. struct vss_istream_cmd_set_tty_mode_t tty_mode;
  538. } __packed;
  539. struct mvm_attach_stream_cmd {
  540. struct apr_hdr hdr;
  541. struct vss_imvm_cmd_attach_stream_t attach_stream;
  542. } __packed;
  543. struct mvm_detach_stream_cmd {
  544. struct apr_hdr hdr;
  545. struct vss_imvm_cmd_detach_stream_t detach_stream;
  546. } __packed;
  547. struct mvm_set_network_cmd {
  548. struct apr_hdr hdr;
  549. struct vss_icommon_cmd_set_network_t network;
  550. } __packed;
  551. struct mvm_set_voice_timing_cmd {
  552. struct apr_hdr hdr;
  553. struct vss_icommon_cmd_set_voice_timing_t timing;
  554. } __packed;
  555. struct mvm_set_hd_enable_cmd {
  556. struct apr_hdr hdr;
  557. } __packed;
  558. struct vss_imemory_table_descriptor_t {
  559. uint32_t mem_address_lsw;
  560. uint32_t mem_address_msw;
  561. /*
  562. * Base physical address of the table. The address must be aligned
  563. * to LCM( cache_line_size, page_align, max_data_width ), where the
  564. * attributes are specified in #VSS_IMEMORY_CMD_MAP_PHYSICAL, and
  565. * LCM = Least Common Multiple. The table at the address must have
  566. * the format specified by #vss_imemory_table_t.
  567. */
  568. uint32_t mem_size;
  569. /* Size in bytes of the table. */
  570. } __packed;
  571. struct vss_imemory_block_t {
  572. uint64_t mem_address;
  573. /*
  574. * Base address of the memory block. The address is virtual for virtual
  575. * memory and physical for physical memory. The address must be aligned
  576. * to LCM( cache_line_size, page_align, max_data_width ), where the
  577. * attributes are specified in VSS_IMEMORY_CMD_MAP_VIRTUAL or
  578. * VSS_IMEMORY_CMD_MAP_PHYSICAL, and LCM = Least Common Multiple.
  579. */
  580. uint32_t mem_size;
  581. /*
  582. * Size in bytes of the memory block. The size must be multiple of
  583. * page_align, where page_align is specified in
  584. * VSS_IMEMORY_CMD_MAP_VIRTUAL or #VSS_IMEMORY_CMD_MAP_PHYSICAL.
  585. */
  586. } __packed;
  587. struct vss_imemory_table_t {
  588. struct vss_imemory_table_descriptor_t next_table_descriptor;
  589. /*
  590. * Specifies the next table. If there is no next table,
  591. * set the size of the table to 0 and the table address is ignored.
  592. */
  593. struct vss_imemory_block_t blocks[NUM_OF_MEMORY_BLOCKS];
  594. /* Specifies one ore more memory blocks. */
  595. } __packed;
  596. struct vss_imemory_cmd_map_physical_t {
  597. struct apr_hdr hdr;
  598. struct vss_imemory_table_descriptor_t table_descriptor;
  599. bool is_cached;
  600. /*
  601. * Indicates cached or uncached memory. Supported values:
  602. * TRUE - Cached.
  603. */
  604. uint16_t cache_line_size;
  605. /* Cache line size in bytes. Supported values: 128 */
  606. uint32_t access_mask;
  607. /*
  608. * CVD's access permission to the memory while it is mapped.
  609. * Supported values:
  610. * bit 0 - If set, the memory is readable.
  611. * bit 1 - If set, the memory is writable.
  612. */
  613. uint32_t page_align;
  614. /* Page frame alignment in bytes. Supported values: 4096 */
  615. uint8_t min_data_width;
  616. /*
  617. * Minimum native data type width in bits that can be accessed.
  618. * Supported values: 8
  619. */
  620. uint8_t max_data_width;
  621. /*
  622. * Maximum native data type width in bits that can be accessed.
  623. * Supported values: 64
  624. */
  625. } __packed;
  626. struct vss_imvm_cmd_set_cal_network_t {
  627. struct apr_hdr hdr;
  628. uint32_t network_id;
  629. } __packed;
  630. struct vss_imvm_cmd_set_cal_media_type_t {
  631. struct apr_hdr hdr;
  632. uint32_t media_id;
  633. } __packed;
  634. struct vss_imemory_cmd_unmap_t {
  635. struct apr_hdr hdr;
  636. uint32_t mem_handle;
  637. } __packed;
  638. /* TO CVS commands */
  639. #define VSS_ISTREAM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x00011140
  640. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  641. #define VSS_ISTREAM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110F7
  642. /* Create a new full control stream session. */
  643. #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
  644. /*
  645. * This command changes the mute setting. The new mute setting will
  646. * be applied over the specified ramp duration.
  647. */
  648. #define VSS_IVOLUME_CMD_MUTE_V2 0x0001138B
  649. #define VSS_ISTREAM_CMD_REGISTER_CALIBRATION_DATA_V2 0x00011369
  650. #define VSS_ISTREAM_CMD_DEREGISTER_CALIBRATION_DATA 0x0001127A
  651. #define VSS_ISTREAM_CMD_REGISTER_STATIC_CALIBRATION_DATA 0x0001307D
  652. #define VSS_ISTREAM_CMD_DEREGISTER_STATIC_CALIBRATION_DATA 0x0001307E
  653. #define VSS_ISTREAM_CMD_SET_MEDIA_TYPE 0x00011186
  654. /* Set media type on the stream. */
  655. #define VSS_ISTREAM_EVT_SEND_ENC_BUFFER 0x00011015
  656. /* Event sent by the stream to its client to provide an encoded packet. */
  657. #define VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER 0x00011017
  658. /* Event sent by the stream to its client requesting for a decoder packet.
  659. * The client should respond with a VSS_ISTREAM_EVT_SEND_DEC_BUFFER event.
  660. */
  661. #define VSS_ISTREAM_EVT_OOB_NOTIFY_DEC_BUFFER_REQUEST 0x0001136E
  662. #define VSS_ISTREAM_EVT_SEND_DEC_BUFFER 0x00011016
  663. /* Event sent by the client to the stream in response to a
  664. * VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER event, providing a decoder packet.
  665. */
  666. #define VSS_ISTREAM_CMD_VOC_AMR_SET_ENC_RATE 0x0001113E
  667. /* Set AMR encoder rate. */
  668. #define VSS_ISTREAM_CMD_VOC_AMRWB_SET_ENC_RATE 0x0001113F
  669. /* Set AMR-WB encoder rate. */
  670. #define VSS_ISTREAM_CMD_CDMA_SET_ENC_MINMAX_RATE 0x00011019
  671. /* Set encoder minimum and maximum rate. */
  672. #define VSS_ISTREAM_CMD_SET_ENC_DTX_MODE 0x0001101D
  673. /* Set encoder DTX mode. */
  674. #define MODULE_ID_VOICE_MODULE_ST 0x00010EE3
  675. #define VOICE_PARAM_MOD_ENABLE 0x00010E00
  676. #define MOD_ENABLE_PARAM_LEN 4
  677. #define VSS_IPLAYBACK_CMD_START 0x000112BD
  678. /* Start in-call music delivery on the Tx voice path. */
  679. #define VSS_IPLAYBACK_CMD_STOP 0x00011239
  680. /* Stop the in-call music delivery on the Tx voice path. */
  681. #define VSS_IPLAYBACK_PORT_ID_DEFAULT 0x0000FFFF
  682. /* Default AFE port ID. */
  683. #define VSS_IPLAYBACK_PORT_ID_VOICE 0x00008005
  684. /* AFE port ID for VOICE 1. */
  685. #define VSS_IPLAYBACK_PORT_ID_VOICE2 0x00008002
  686. /* AFE port ID for VOICE 2. */
  687. #define VSS_IRECORD_CMD_START 0x000112BE
  688. /* Start in-call conversation recording. */
  689. #define VSS_IRECORD_CMD_STOP 0x00011237
  690. /* Stop in-call conversation recording. */
  691. #define VSS_IRECORD_PORT_ID_DEFAULT 0x0000FFFF
  692. /* Default AFE port ID. */
  693. #define VSS_IRECORD_TAP_POINT_NONE 0x00010F78
  694. /* Indicates no tapping for specified path. */
  695. #define VSS_IRECORD_TAP_POINT_STREAM_END 0x00010F79
  696. /* Indicates that specified path should be tapped at the end of the stream. */
  697. #define VSS_IRECORD_MODE_TX_RX_STEREO 0x00010F7A
  698. /* Select Tx on left channel and Rx on right channel. */
  699. #define VSS_IRECORD_MODE_TX_RX_MIXING 0x00010F7B
  700. /* Select mixed Tx and Rx paths. */
  701. #define VSS_PARAM_VOCPROC_TX_CHANNEL_INFO 0x0001328E
  702. #define VSS_PARAM_VOCPROC_RX_CHANNEL_INFO 0x0001328F
  703. #define VSS_PARAM_VOCPROC_EC_REF_CHANNEL_INFO 0x00013290
  704. #define VSS_PARAM_TX_PORT_ENDPOINT_MEDIA_INFO 0x00013253
  705. #define VSS_PARAM_RX_PORT_ENDPOINT_MEDIA_INFO 0x00013254
  706. #define VSS_PARAM_EC_REF_PORT_ENDPOINT_MEDIA_INFO 0x00013255
  707. #define VSS_MODULE_CVD_GENERIC 0x0001316E
  708. #define VSS_ISTREAM_EVT_NOT_READY 0x000110FD
  709. #define VSS_ISTREAM_EVT_READY 0x000110FC
  710. #define VSS_ISTREAM_EVT_OOB_NOTIFY_DEC_BUFFER_READY 0x0001136F
  711. /*notify dsp that decoder buffer is ready*/
  712. #define VSS_ISTREAM_EVT_OOB_NOTIFY_ENC_BUFFER_READY 0x0001136C
  713. /*dsp notifying client that encoder buffer is ready*/
  714. #define VSS_ISTREAM_EVT_OOB_NOTIFY_ENC_BUFFER_CONSUMED 0x0001136D
  715. /*notify dsp that encoder buffer is consumed*/
  716. #define VSS_ISTREAM_CMD_SET_OOB_PACKET_EXCHANGE_CONFIG 0x0001136B
  717. #define VSS_ISTREAM_PACKET_EXCHANGE_MODE_INBAND 0
  718. /* In-band packet exchange mode. */
  719. #define VSS_ISTREAM_PACKET_EXCHANGE_MODE_OUT_OF_BAND 1
  720. /* Out-of-band packet exchange mode. */
  721. #define VSS_ISTREAM_CMD_SET_PACKET_EXCHANGE_MODE 0x0001136A
  722. struct vss_iplayback_cmd_start_t {
  723. uint16_t port_id;
  724. /*
  725. * AFE Port ID from which the audio samples are available.
  726. * To use the default AFE pseudo port (0x8005), set this value to
  727. * #VSS_IPLAYBACK_PORT_ID_DEFAULT.
  728. */
  729. } __packed;
  730. struct vss_irecord_cmd_start_t {
  731. uint32_t rx_tap_point;
  732. /* Tap point to use on the Rx path. Supported values are:
  733. * VSS_IRECORD_TAP_POINT_NONE : Do not record Rx path.
  734. * VSS_IRECORD_TAP_POINT_STREAM_END : Rx tap point is at the end of
  735. * the stream.
  736. */
  737. uint32_t tx_tap_point;
  738. /* Tap point to use on the Tx path. Supported values are:
  739. * VSS_IRECORD_TAP_POINT_NONE : Do not record tx path.
  740. * VSS_IRECORD_TAP_POINT_STREAM_END : Tx tap point is at the end of
  741. * the stream.
  742. */
  743. uint16_t port_id;
  744. /* AFE Port ID to which the conversation recording stream needs to be
  745. * sent. Set this to #VSS_IRECORD_PORT_ID_DEFAULT to use default AFE
  746. * pseudo ports (0x8003 for Rx and 0x8004 for Tx).
  747. */
  748. uint32_t mode;
  749. /* Recording Mode. The mode parameter value is ignored if the port_id
  750. * is set to #VSS_IRECORD_PORT_ID_DEFAULT.
  751. * The supported values:
  752. * #VSS_IRECORD_MODE_TX_RX_STEREO
  753. * #VSS_IRECORD_MODE_TX_RX_MIXING
  754. */
  755. } __packed;
  756. struct vss_istream_cmd_create_passive_control_session_t {
  757. char name[SESSION_NAME_LEN];
  758. /**<
  759. * A variable-sized stream name.
  760. *
  761. * The stream name size is the payload size minus the size of the other
  762. * fields.
  763. */
  764. } __packed;
  765. #define VSS_IVOLUME_DIRECTION_TX 0
  766. #define VSS_IVOLUME_DIRECTION_RX 1
  767. #define VSS_IVOLUME_MUTE_OFF 0
  768. #define VSS_IVOLUME_MUTE_ON 1
  769. #define DEFAULT_MUTE_RAMP_DURATION 500
  770. #define DEFAULT_VOLUME_RAMP_DURATION 20
  771. #define MAX_RAMP_DURATION 5000
  772. struct vss_ivolume_cmd_mute_v2_t {
  773. uint16_t direction;
  774. /*
  775. * The direction field sets the direction to apply the mute command.
  776. * The Supported values:
  777. * VSS_IVOLUME_DIRECTION_TX
  778. * VSS_IVOLUME_DIRECTION_RX
  779. */
  780. uint16_t mute_flag;
  781. /*
  782. * Turn mute on or off. The Supported values:
  783. * VSS_IVOLUME_MUTE_OFF
  784. * VSS_IVOLUME_MUTE_ON
  785. */
  786. uint16_t ramp_duration_ms;
  787. /*
  788. * Mute change ramp duration in milliseconds.
  789. * The Supported values: 0 to 5000.
  790. */
  791. } __packed;
  792. struct vss_istream_cmd_create_full_control_session_t {
  793. uint16_t direction;
  794. /*
  795. * Stream direction.
  796. *
  797. * 0 : TX only
  798. * 1 : RX only
  799. * 2 : TX and RX
  800. * 3 : TX and RX loopback
  801. */
  802. uint32_t enc_media_type;
  803. /* Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  804. uint32_t dec_media_type;
  805. /* Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  806. uint32_t network_id;
  807. /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */
  808. char name[SESSION_NAME_LEN];
  809. /*
  810. * A variable-sized stream name.
  811. *
  812. * The stream name size is the payload size minus the size of the other
  813. * fields.
  814. */
  815. } __packed;
  816. struct vss_istream_cmd_set_media_type_t {
  817. uint32_t rx_media_id;
  818. /* Set the Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  819. uint32_t tx_media_id;
  820. /* Set the Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  821. } __packed;
  822. struct vss_istream_evt_send_enc_buffer_t {
  823. uint32_t media_id;
  824. /* Media ID of the packet. */
  825. uint8_t packet_data[MAX_VOC_PKT_SIZE];
  826. /* Packet data buffer. */
  827. } __packed;
  828. struct vss_istream_evt_send_dec_buffer_t {
  829. uint32_t media_id;
  830. /* Media ID of the packet. */
  831. uint8_t packet_data[MAX_VOC_PKT_SIZE];
  832. /* Packet data. */
  833. } __packed;
  834. struct vss_istream_cmd_voc_amr_set_enc_rate_t {
  835. uint32_t mode;
  836. /* Set the AMR encoder rate.
  837. *
  838. * 0x00000000 : 4.75 kbps
  839. * 0x00000001 : 5.15 kbps
  840. * 0x00000002 : 5.90 kbps
  841. * 0x00000003 : 6.70 kbps
  842. * 0x00000004 : 7.40 kbps
  843. * 0x00000005 : 7.95 kbps
  844. * 0x00000006 : 10.2 kbps
  845. * 0x00000007 : 12.2 kbps
  846. */
  847. } __packed;
  848. struct vss_istream_cmd_voc_amrwb_set_enc_rate_t {
  849. uint32_t mode;
  850. /* Set the AMR-WB encoder rate.
  851. *
  852. * 0x00000000 : 6.60 kbps
  853. * 0x00000001 : 8.85 kbps
  854. * 0x00000002 : 12.65 kbps
  855. * 0x00000003 : 14.25 kbps
  856. * 0x00000004 : 15.85 kbps
  857. * 0x00000005 : 18.25 kbps
  858. * 0x00000006 : 19.85 kbps
  859. * 0x00000007 : 23.05 kbps
  860. * 0x00000008 : 23.85 kbps
  861. */
  862. } __packed;
  863. struct vss_istream_cmd_cdma_set_enc_minmax_rate_t {
  864. uint16_t min_rate;
  865. /* Set the lower bound encoder rate.
  866. *
  867. * 0x0000 : Blank frame
  868. * 0x0001 : Eighth rate
  869. * 0x0002 : Quarter rate
  870. * 0x0003 : Half rate
  871. * 0x0004 : Full rate
  872. */
  873. uint16_t max_rate;
  874. /* Set the upper bound encoder rate.
  875. *
  876. * 0x0000 : Blank frame
  877. * 0x0001 : Eighth rate
  878. * 0x0002 : Quarter rate
  879. * 0x0003 : Half rate
  880. * 0x0004 : Full rate
  881. */
  882. } __packed;
  883. struct vss_istream_cmd_set_enc_dtx_mode_t {
  884. uint32_t enable;
  885. /* Toggle DTX on or off.
  886. *
  887. * 0 : Disables DTX
  888. * 1 : Enables DTX
  889. */
  890. } __packed;
  891. struct vss_istream_cmd_register_calibration_data_v2_t {
  892. uint32_t cal_mem_handle;
  893. /* Handle to the shared memory that holds the calibration data. */
  894. uint32_t cal_mem_address_lsw;
  895. uint32_t cal_mem_address_msw;
  896. /* Location of calibration data. */
  897. uint32_t cal_mem_size;
  898. /* Size of the calibration data in bytes. */
  899. uint8_t column_info[MAX_COL_INFO_SIZE];
  900. /*
  901. * Column info contains the number of columns and the array of columns
  902. * in the calibration table. The order in which the columns are provided
  903. * here must match the order in which they exist in the calibration
  904. * table provided.
  905. */
  906. } __packed;
  907. struct vss_icommon_cmd_set_ui_property_enable_t {
  908. uint32_t module_id;
  909. /* Unique ID of the module. */
  910. uint32_t param_id;
  911. /* Unique ID of the parameter. */
  912. uint16_t param_size;
  913. /* Size of the parameter in bytes: MOD_ENABLE_PARAM_LEN */
  914. uint16_t reserved;
  915. /* Reserved; set to 0. */
  916. uint16_t enable;
  917. uint16_t reserved_field;
  918. /* Reserved, set to 0. */
  919. };
  920. /*
  921. * Event sent by the stream to the client that enables Rx DTMF
  922. * detection whenever DTMF is detected in the Rx path.
  923. *
  924. * The DTMF detection feature can only be used to detect DTMF
  925. * frequencies as listed in the vss_istream_evt_rx_dtmf_detected_t
  926. * structure.
  927. */
  928. #define VSS_ISTREAM_EVT_RX_DTMF_DETECTED 0x0001101A
  929. struct vss_istream_cmd_set_rx_dtmf_detection {
  930. /*
  931. * Enables/disables Rx DTMF detection
  932. *
  933. * Possible values are
  934. * 0 - disable
  935. * 1 - enable
  936. *
  937. */
  938. uint32_t enable;
  939. };
  940. #define VSS_ISTREAM_CMD_SET_RX_DTMF_DETECTION 0x00011027
  941. struct vss_istream_evt_rx_dtmf_detected {
  942. uint16_t low_freq;
  943. /*
  944. * Detected low frequency. Possible values:
  945. * 697 Hz
  946. * 770 Hz
  947. * 852 Hz
  948. * 941 Hz
  949. */
  950. uint16_t high_freq;
  951. /*
  952. * Detected high frequency. Possible values:
  953. * 1209 Hz
  954. * 1336 Hz
  955. * 1477 Hz
  956. * 1633 Hz
  957. */
  958. };
  959. struct cvs_set_rx_dtmf_detection_cmd {
  960. struct apr_hdr hdr;
  961. struct vss_istream_cmd_set_rx_dtmf_detection cvs_dtmf_det;
  962. } __packed;
  963. struct cvs_create_passive_ctl_session_cmd {
  964. struct apr_hdr hdr;
  965. struct vss_istream_cmd_create_passive_control_session_t cvs_session;
  966. } __packed;
  967. struct cvs_create_full_ctl_session_cmd {
  968. struct apr_hdr hdr;
  969. struct vss_istream_cmd_create_full_control_session_t cvs_session;
  970. } __packed;
  971. struct cvs_destroy_session_cmd {
  972. struct apr_hdr hdr;
  973. } __packed;
  974. struct cvs_set_mute_cmd {
  975. struct apr_hdr hdr;
  976. struct vss_ivolume_cmd_mute_v2_t cvs_set_mute;
  977. } __packed;
  978. struct cvs_set_media_type_cmd {
  979. struct apr_hdr hdr;
  980. struct vss_istream_cmd_set_media_type_t media_type;
  981. } __packed;
  982. struct cvs_send_dec_buf_cmd {
  983. struct apr_hdr hdr;
  984. struct vss_istream_evt_send_dec_buffer_t dec_buf;
  985. } __packed;
  986. struct cvs_set_amr_enc_rate_cmd {
  987. struct apr_hdr hdr;
  988. struct vss_istream_cmd_voc_amr_set_enc_rate_t amr_rate;
  989. } __packed;
  990. struct cvs_set_amrwb_enc_rate_cmd {
  991. struct apr_hdr hdr;
  992. struct vss_istream_cmd_voc_amrwb_set_enc_rate_t amrwb_rate;
  993. } __packed;
  994. struct cvs_set_cdma_enc_minmax_rate_cmd {
  995. struct apr_hdr hdr;
  996. struct vss_istream_cmd_cdma_set_enc_minmax_rate_t cdma_rate;
  997. } __packed;
  998. struct cvs_set_enc_dtx_mode_cmd {
  999. struct apr_hdr hdr;
  1000. struct vss_istream_cmd_set_enc_dtx_mode_t dtx_mode;
  1001. } __packed;
  1002. struct cvs_register_cal_data_cmd {
  1003. struct apr_hdr hdr;
  1004. struct vss_istream_cmd_register_calibration_data_v2_t cvs_cal_data;
  1005. } __packed;
  1006. struct cvs_deregister_cal_data_cmd {
  1007. struct apr_hdr hdr;
  1008. } __packed;
  1009. struct cvs_set_pp_enable_cmd {
  1010. struct apr_hdr hdr;
  1011. struct vss_icommon_cmd_set_ui_property_enable_t vss_set_pp;
  1012. } __packed;
  1013. struct cvs_start_record_cmd {
  1014. struct apr_hdr hdr;
  1015. struct vss_irecord_cmd_start_t rec_mode;
  1016. } __packed;
  1017. struct cvs_start_playback_cmd {
  1018. struct apr_hdr hdr;
  1019. struct vss_iplayback_cmd_start_t playback_mode;
  1020. } __packed;
  1021. struct cvs_dec_buffer_ready_cmd {
  1022. struct apr_hdr hdr;
  1023. } __packed;
  1024. struct cvs_enc_buffer_consumed_cmd {
  1025. struct apr_hdr hdr;
  1026. } __packed;
  1027. struct vss_istream_cmd_set_oob_packet_exchange_config_t {
  1028. struct apr_hdr hdr;
  1029. uint32_t mem_handle;
  1030. uint32_t enc_buf_addr_lsw;
  1031. uint32_t enc_buf_addr_msw;
  1032. uint32_t enc_buf_size;
  1033. uint32_t dec_buf_addr_lsw;
  1034. uint32_t dec_buf_addr_msw;
  1035. uint32_t dec_buf_size;
  1036. } __packed;
  1037. struct vss_istream_cmd_set_packet_exchange_mode_t {
  1038. struct apr_hdr hdr;
  1039. uint32_t mode;
  1040. } __packed;
  1041. /* TO CVP commands */
  1042. #define VSS_IVOCPROC_CMD_CREATE_FULL_CONTROL_SESSION 0x000100C3
  1043. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  1044. #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
  1045. #define VSS_IVOCPROC_CMD_SET_DEVICE_V2 0x000112C6
  1046. #define VSS_IVOCPROC_CMD_SET_DEVICE_V3 0x0001316A
  1047. #define VSS_IVOCPROC_CMD_TOPOLOGY_SET_DEV_CHANNELS 0x00013199
  1048. #define VSS_IVOCPROC_CMD_TOPOLOGY_COMMIT 0x00013198
  1049. #define VSS_IVOCPROC_CMD_SET_VP3_DATA 0x000110EB
  1050. #define VSS_IVOLUME_CMD_SET_STEP 0x000112C2
  1051. #define VSS_IVOCPROC_CMD_ENABLE 0x000100C6
  1052. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  1053. #define VSS_IVOCPROC_CMD_DISABLE 0x000110E1
  1054. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  1055. /*
  1056. * Registers the memory that contains device specific configuration data with
  1057. * the vocproc. The client must register device configuration data with the
  1058. * vocproc that corresponds with the device being set on the vocproc.
  1059. */
  1060. #define VSS_IVOCPROC_CMD_REGISTER_DEVICE_CONFIG 0x00011371
  1061. /*
  1062. * Deregisters the memory that holds device configuration data from the
  1063. vocproc.
  1064. */
  1065. #define VSS_IVOCPROC_CMD_DEREGISTER_DEVICE_CONFIG 0x00011372
  1066. #define VSS_IVOCPROC_CMD_REGISTER_CALIBRATION_DATA_V2 0x00011373
  1067. #define VSS_IVOCPROC_CMD_DEREGISTER_CALIBRATION_DATA 0x00011276
  1068. #define VSS_IVOCPROC_CMD_REGISTER_VOL_CALIBRATION_DATA 0x00011374
  1069. #define VSS_IVOCPROC_CMD_DEREGISTER_VOL_CALIBRATION_DATA 0x00011375
  1070. #define VSS_IVOCPROC_CMD_REGISTER_STATIC_CALIBRATION_DATA 0x00013079
  1071. #define VSS_IVOCPROC_CMD_DEREGISTER_STATIC_CALIBRATION_DATA 0x0001307A
  1072. #define VSS_IVOCPROC_CMD_REGISTER_DYNAMIC_CALIBRATION_DATA 0x0001307B
  1073. #define VSS_IVOCPROC_CMD_DEREGISTER_DYNAMIC_CALIBRATION_DATA 0x0001307C
  1074. #define VSS_IVOCPROC_TOPOLOGY_ID_NONE 0x00010F70
  1075. #define VSS_IVOCPROC_TOPOLOGY_ID_TX_SM_ECNS_V2 0x00010F89
  1076. #define VSS_IVOCPROC_TOPOLOGY_ID_TX_DM_FLUENCE 0x00010F72
  1077. #define VSS_IVOCPROC_TOPOLOGY_ID_RX_DEFAULT 0x00010F77
  1078. /* Newtwork IDs */
  1079. #define VSS_ICOMMON_CAL_NETWORK_ID_NONE 0x0001135E
  1080. /* Select internal mixing mode. */
  1081. #define VSS_IVOCPROC_VOCPROC_MODE_EC_INT_MIXING 0x00010F7C
  1082. /* Select external mixing mode. */
  1083. #define VSS_IVOCPROC_VOCPROC_MODE_EC_EXT_MIXING 0x00010F7D
  1084. /* Default AFE port ID. Applicable to Tx and Rx. */
  1085. #define VSS_IVOCPROC_PORT_ID_NONE 0xFFFF
  1086. #define VSS_NETWORK_ID_DEFAULT 0x00010037
  1087. /* Voice over Internet Protocol (VoIP) network ID. Common for all bands.*/
  1088. #define VSS_NETWORK_ID_VOIP 0x00011362
  1089. /* Media types */
  1090. #define VSS_MEDIA_ID_EVRC_MODEM 0x00010FC2
  1091. /* 80-VF690-47 CDMA enhanced variable rate vocoder modem format. */
  1092. #define VSS_MEDIA_ID_AMR_NB_MODEM 0x00010FC6
  1093. /* 80-VF690-47 UMTS AMR-NB vocoder modem format. */
  1094. #define VSS_MEDIA_ID_AMR_WB_MODEM 0x00010FC7
  1095. /* 80-VF690-47 UMTS AMR-WB vocoder modem format. */
  1096. #define VSS_MEDIA_ID_PCM_8_KHZ 0x00010FCB
  1097. #define VSS_MEDIA_ID_PCM_16_KHZ 0x00010FCC
  1098. #define VSS_MEDIA_ID_PCM_32_KHZ 0x00010FD9
  1099. #define VSS_MEDIA_ID_PCM_48_KHZ 0x00010FD6
  1100. /* Linear PCM (16-bit, little-endian). */
  1101. #define VSS_MEDIA_ID_G711_ALAW 0x00010FCD
  1102. /* G.711 a-law (contains two 10ms vocoder frames). */
  1103. #define VSS_MEDIA_ID_G711_MULAW 0x00010FCE
  1104. /* G.711 mu-law (contains two 10ms vocoder frames). */
  1105. #define VSS_MEDIA_ID_G729 0x00010FD0
  1106. /* G.729AB (contains two 10ms vocoder frames. */
  1107. #define VSS_MEDIA_ID_4GV_NB_MODEM 0x00010FC3
  1108. /*CDMA EVRC-B vocoder modem format */
  1109. #define VSS_MEDIA_ID_4GV_WB_MODEM 0x00010FC4
  1110. /*CDMA EVRC-WB vocoder modem format */
  1111. #define VSS_MEDIA_ID_4GV_NW_MODEM 0x00010FC5
  1112. /*CDMA EVRC-NW vocoder modem format */
  1113. #define VSS_IVOCPROC_CMD_CREATE_FULL_CONTROL_SESSION_V2 0x000112BF
  1114. #define VSS_IVOCPROC_CMD_CREATE_FULL_CONTROL_SESSION_V3 0x00013169
  1115. #define VSS_NUM_DEV_CHANNELS_1 1
  1116. #define VSS_NUM_DEV_CHANNELS_2 2
  1117. #define VSS_NUM_DEV_CHANNELS_3 3
  1118. #define VSS_NUM_DEV_CHANNELS_4 4
  1119. struct vss_ivocproc_cmd_create_full_control_session_v2_t {
  1120. uint16_t direction;
  1121. /*
  1122. * Vocproc direction. The supported values:
  1123. * VSS_IVOCPROC_DIRECTION_RX
  1124. * VSS_IVOCPROC_DIRECTION_TX
  1125. * VSS_IVOCPROC_DIRECTION_RX_TX
  1126. */
  1127. uint16_t tx_port_id;
  1128. /*
  1129. * Tx device port ID to which the vocproc connects. If a port ID is
  1130. * not being supplied, set this to #VSS_IVOCPROC_PORT_ID_NONE.
  1131. */
  1132. uint32_t tx_topology_id;
  1133. /*
  1134. * Tx path topology ID. If a topology ID is not being supplied, set
  1135. * this to #VSS_IVOCPROC_TOPOLOGY_ID_NONE.
  1136. */
  1137. uint16_t rx_port_id;
  1138. /*
  1139. * Rx device port ID to which the vocproc connects. If a port ID is
  1140. * not being supplied, set this to #VSS_IVOCPROC_PORT_ID_NONE.
  1141. */
  1142. uint32_t rx_topology_id;
  1143. /*
  1144. * Rx path topology ID. If a topology ID is not being supplied, set
  1145. * this to #VSS_IVOCPROC_TOPOLOGY_ID_NONE.
  1146. */
  1147. uint32_t profile_id;
  1148. /* Voice calibration profile ID. */
  1149. uint32_t vocproc_mode;
  1150. /*
  1151. * Vocproc mode. The supported values:
  1152. * VSS_IVOCPROC_VOCPROC_MODE_EC_INT_MIXING
  1153. * VSS_IVOCPROC_VOCPROC_MODE_EC_EXT_MIXING
  1154. */
  1155. uint16_t ec_ref_port_id;
  1156. /*
  1157. * Port ID to which the vocproc connects for receiving echo
  1158. * cancellation reference signal. If a port ID is not being supplied,
  1159. * set this to #VSS_IVOCPROC_PORT_ID_NONE. This parameter value is
  1160. * ignored when the vocproc_mode parameter is set to
  1161. * VSS_IVOCPROC_VOCPROC_MODE_EC_INT_MIXING.
  1162. */
  1163. char name[SESSION_NAME_LEN];
  1164. /*
  1165. * Session name string used to identify a session that can be shared
  1166. * with passive controllers (optional). The string size, including the
  1167. * NULL termination character, is limited to 31 characters.
  1168. */
  1169. } __packed;
  1170. struct vss_ivocproc_cmd_set_volume_index_t {
  1171. uint16_t vol_index;
  1172. /*
  1173. * Volume index utilized by the vocproc to index into the volume table
  1174. * provided in VSS_IVOCPROC_CMD_CACHE_VOLUME_CALIBRATION_TABLE and set
  1175. * volume on the VDSP.
  1176. */
  1177. } __packed;
  1178. struct vss_ivolume_cmd_set_step_t {
  1179. uint16_t direction;
  1180. /*
  1181. * The direction field sets the direction to apply the volume command.
  1182. * The supported values:
  1183. * #VSS_IVOLUME_DIRECTION_RX
  1184. */
  1185. uint32_t value;
  1186. /*
  1187. * Volume step used to find the corresponding linear volume and
  1188. * the best match index in the registered volume calibration table.
  1189. */
  1190. uint16_t ramp_duration_ms;
  1191. /*
  1192. * Volume change ramp duration in milliseconds.
  1193. * The supported values: 0 to 5000.
  1194. */
  1195. } __packed;
  1196. struct vss_ivocproc_cmd_set_device_v2_t {
  1197. uint16_t tx_port_id;
  1198. /*
  1199. * TX device port ID which vocproc will connect to.
  1200. * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port.
  1201. */
  1202. uint32_t tx_topology_id;
  1203. /*
  1204. * TX leg topology ID.
  1205. * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any
  1206. * pre/post-processing blocks and is pass-through.
  1207. */
  1208. uint16_t rx_port_id;
  1209. /*
  1210. * RX device port ID which vocproc will connect to.
  1211. * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port.
  1212. */
  1213. uint32_t rx_topology_id;
  1214. /*
  1215. * RX leg topology ID.
  1216. * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any
  1217. * pre/post-processing blocks and is pass-through.
  1218. */
  1219. uint32_t vocproc_mode;
  1220. /* Vocproc mode. The supported values:
  1221. * VSS_IVOCPROC_VOCPROC_MODE_EC_INT_MIXING - 0x00010F7C
  1222. * VSS_IVOCPROC_VOCPROC_MODE_EC_EXT_MIXING - 0x00010F7D
  1223. */
  1224. uint16_t ec_ref_port_id;
  1225. /* Port ID to which the vocproc connects for receiving
  1226. * echo
  1227. */
  1228. } __packed;
  1229. struct vss_ivocproc_cmd_register_device_config_t {
  1230. uint32_t mem_handle;
  1231. /*
  1232. * Handle to the shared memory that holds the per-network calibration
  1233. * data.
  1234. */
  1235. uint32_t mem_address_lsw;
  1236. uint32_t mem_address_msw;
  1237. /* Location of calibration data. */
  1238. uint32_t mem_size;
  1239. /* Size of the calibration data in bytes. */
  1240. } __packed;
  1241. struct vss_ivocproc_cmd_register_calibration_data_v2_t {
  1242. uint32_t cal_mem_handle;
  1243. /*
  1244. * Handle to the shared memory that holds the per-network calibration
  1245. * data.
  1246. */
  1247. uint32_t cal_mem_address_lsw;
  1248. uint32_t cal_mem_address_msw;
  1249. /* Location of calibration data. */
  1250. uint32_t cal_mem_size;
  1251. /* Size of the calibration data in bytes. */
  1252. uint8_t column_info[MAX_COL_INFO_SIZE];
  1253. /*
  1254. * Column info contains the number of columns and the array of columns
  1255. * in the calibration table. The order in which the columns are provided
  1256. * here must match the order in which they exist in the calibration
  1257. * table provided.
  1258. */
  1259. } __packed;
  1260. struct vss_ivocproc_cmd_register_volume_cal_data_t {
  1261. uint32_t cal_mem_handle;
  1262. /*
  1263. * Handle to the shared memory that holds the volume calibration
  1264. * data.
  1265. */
  1266. uint32_t cal_mem_address_lsw;
  1267. uint32_t cal_mem_address_msw;
  1268. /* Location of volume calibration data. */
  1269. uint32_t cal_mem_size;
  1270. /* Size of the volume calibration data in bytes. */
  1271. uint8_t column_info[MAX_COL_INFO_SIZE];
  1272. /*
  1273. * Column info contains the number of columns and the array of columns
  1274. * in the calibration table. The order in which the columns are provided
  1275. * here must match the order in which they exist in the calibration
  1276. * table provided.
  1277. */
  1278. } __packed;
  1279. struct vss_ivocproc_cmd_topology_set_dev_channels_t {
  1280. uint16_t tx_num_channels;
  1281. /*
  1282. * Number of Mics.
  1283. * Supported values
  1284. * 1 VSS_NUM_DEV_CHANNELS_1
  1285. * 2 VSS_NUM_DEV_CHANNELS_2
  1286. * 3 VSS_NUM_DEV_CHANNELS_3
  1287. * 4 VSS_NUM_DEV_CHANNELS_4
  1288. */
  1289. uint16_t rx_num_channels;
  1290. /*
  1291. * Number of speaker channels.
  1292. * Supported values
  1293. * 1 VSS_NUM_DEV_CHANNELS_1
  1294. */
  1295. } __packed;
  1296. /* Starts a vocoder PCM session */
  1297. #define VSS_IVPCM_CMD_START_V2 0x00011339
  1298. /* Default tap point location on the TX path. */
  1299. #define VSS_IVPCM_TAP_POINT_TX_DEFAULT 0x00011289
  1300. /* Default tap point location on the RX path. */
  1301. #define VSS_IVPCM_TAP_POINT_RX_DEFAULT 0x0001128A
  1302. /* Indicates tap point direction is output. */
  1303. #define VSS_IVPCM_TAP_POINT_DIR_OUT 0
  1304. /* Indicates tap point direction is input. */
  1305. #define VSS_IVPCM_TAP_POINT_DIR_IN 1
  1306. /* Indicates tap point direction is output and input. */
  1307. #define VSS_IVPCM_TAP_POINT_DIR_OUT_IN 2
  1308. #define VSS_IVPCM_SAMPLING_RATE_AUTO 0
  1309. /* Indicates 8 KHz vocoder PCM sampling rate. */
  1310. #define VSS_IVPCM_SAMPLING_RATE_8K 8000
  1311. /* Indicates 16 KHz vocoder PCM sampling rate. */
  1312. #define VSS_IVPCM_SAMPLING_RATE_16K 16000
  1313. /* RX and TX */
  1314. #define MAX_TAP_POINTS_SUPPORTED 2
  1315. struct vss_ivpcm_tap_point {
  1316. uint32_t tap_point;
  1317. uint16_t direction;
  1318. uint16_t sampling_rate;
  1319. uint16_t duration;
  1320. } __packed;
  1321. struct vss_ivpcm_cmd_start_v2_t {
  1322. uint32_t mem_handle;
  1323. uint32_t num_tap_points;
  1324. struct vss_ivpcm_tap_point tap_points[MAX_TAP_POINTS_SUPPORTED];
  1325. } __packed;
  1326. #define VSS_IVPCM_EVT_PUSH_BUFFER_V2 0x0001133A
  1327. /* Push buffer event mask indicating output buffer is filled. */
  1328. #define VSS_IVPCM_PUSH_BUFFER_MASK_OUTPUT_BUFFER 1
  1329. /* Push buffer event mask indicating input buffer is consumed. */
  1330. #define VSS_IVPCM_PUSH_BUFFER_MASK_INPUT_BUFFER 2
  1331. struct vss_ivpcm_evt_push_buffer_v2_t {
  1332. uint32_t tap_point;
  1333. uint32_t push_buf_mask;
  1334. uint64_t out_buf_mem_address;
  1335. uint16_t out_buf_mem_size;
  1336. uint64_t in_buf_mem_address;
  1337. uint16_t in_buf_mem_size;
  1338. uint16_t sampling_rate;
  1339. uint16_t num_in_channels;
  1340. } __packed;
  1341. #define VSS_IVPCM_EVT_NOTIFY_V2 0x0001133B
  1342. /* Notify event mask indicates output buffer is filled. */
  1343. #define VSS_IVPCM_NOTIFY_MASK_OUTPUT_BUFFER 1
  1344. /* Notify event mask indicates input buffer is consumed. */
  1345. #define VSS_IVPCM_NOTIFY_MASK_INPUT_BUFFER 2
  1346. /* Notify event mask indicates a timetick */
  1347. #define VSS_IVPCM_NOTIFY_MASK_TIMETICK 4
  1348. /* Notify event mask indicates an error occurred in output buffer operation */
  1349. #define VSS_IVPCM_NOTIFY_MASK_OUTPUT_ERROR 8
  1350. /* Notify event mask indicates an error occurred in input buffer operation */
  1351. #define VSS_IVPCM_NOTIFY_MASK_INPUT_ERROR 16
  1352. struct vss_ivpcm_evt_notify_v2_t {
  1353. uint32_t tap_point;
  1354. uint32_t notify_mask;
  1355. uint64_t out_buff_addr;
  1356. uint64_t in_buff_addr;
  1357. uint16_t filled_out_size;
  1358. uint16_t request_buf_size;
  1359. uint16_t sampling_rate;
  1360. uint16_t num_out_channels;
  1361. } __packed;
  1362. struct cvp_start_cmd {
  1363. struct apr_hdr hdr;
  1364. struct vss_ivpcm_cmd_start_v2_t vpcm_start_cmd;
  1365. } __packed;
  1366. struct cvp_push_buf_cmd {
  1367. struct apr_hdr hdr;
  1368. struct vss_ivpcm_evt_push_buffer_v2_t vpcm_evt_push_buffer;
  1369. } __packed;
  1370. #define VSS_IVPCM_CMD_STOP 0x0001100B
  1371. struct cvp_create_full_ctl_session_cmd {
  1372. struct apr_hdr hdr;
  1373. struct vss_ivocproc_cmd_create_full_control_session_v2_t cvp_session;
  1374. } __packed;
  1375. struct cvp_command {
  1376. struct apr_hdr hdr;
  1377. } __packed;
  1378. struct cvp_set_device_cmd {
  1379. struct apr_hdr hdr;
  1380. struct vss_ivocproc_cmd_set_device_v2_t cvp_set_device_v2;
  1381. } __packed;
  1382. struct cvp_set_dev_channels_cmd {
  1383. struct apr_hdr hdr;
  1384. struct vss_ivocproc_cmd_topology_set_dev_channels_t cvp_set_channels;
  1385. } __packed;
  1386. struct cvp_set_media_format_cmd {
  1387. struct apr_hdr hdr;
  1388. struct vss_icommon_cmd_set_param_v2_t cvp_set_media_param_v2;
  1389. } __packed;
  1390. struct cvp_set_channel_info_cmd_v2 {
  1391. struct apr_hdr hdr;
  1392. struct vss_icommon_cmd_set_param_channel_info_v2_t
  1393. cvp_set_ch_info_param_v2;
  1394. } __packed;
  1395. struct cvp_set_channel_mixer_info_cmd_v2 {
  1396. struct apr_hdr hdr;
  1397. struct vss_icommon_cmd_set_param_ch_mixer_v2_t
  1398. cvp_set_ch_mixer_param_v2;
  1399. } __packed;
  1400. struct cvp_set_mfc_config_cmd_v2 {
  1401. struct apr_hdr hdr;
  1402. struct vss_icommon_cmd_set_param_mfc_config_v2_t cvp_set_mfc_param_v2;
  1403. } __packed;
  1404. struct cvp_set_vp3_data_cmd {
  1405. struct apr_hdr hdr;
  1406. } __packed;
  1407. struct cvp_set_rx_volume_index_cmd {
  1408. struct apr_hdr hdr;
  1409. struct vss_ivocproc_cmd_set_volume_index_t cvp_set_vol_idx;
  1410. } __packed;
  1411. struct cvp_set_rx_volume_step_cmd {
  1412. struct apr_hdr hdr;
  1413. struct vss_ivolume_cmd_set_step_t cvp_set_vol_step;
  1414. } __packed;
  1415. struct cvp_register_dev_cfg_cmd {
  1416. struct apr_hdr hdr;
  1417. struct vss_ivocproc_cmd_register_device_config_t cvp_dev_cfg_data;
  1418. } __packed;
  1419. struct cvp_deregister_dev_cfg_cmd {
  1420. struct apr_hdr hdr;
  1421. } __packed;
  1422. struct cvp_register_cal_data_cmd {
  1423. struct apr_hdr hdr;
  1424. struct vss_ivocproc_cmd_register_calibration_data_v2_t cvp_cal_data;
  1425. } __packed;
  1426. struct cvp_deregister_cal_data_cmd {
  1427. struct apr_hdr hdr;
  1428. } __packed;
  1429. struct cvp_register_vol_cal_data_cmd {
  1430. struct apr_hdr hdr;
  1431. struct vss_ivocproc_cmd_register_volume_cal_data_t cvp_vol_cal_data;
  1432. } __packed;
  1433. struct cvp_deregister_vol_cal_data_cmd {
  1434. struct apr_hdr hdr;
  1435. } __packed;
  1436. struct cvp_set_mute_cmd {
  1437. struct apr_hdr hdr;
  1438. struct vss_ivolume_cmd_mute_v2_t cvp_set_mute;
  1439. } __packed;
  1440. /* CB for up-link packets. */
  1441. typedef void (*ul_cb_fn)(uint8_t *voc_pkt,
  1442. uint32_t pkt_len,
  1443. uint32_t timestamp,
  1444. void *private_data);
  1445. /* CB for down-link packets. */
  1446. typedef void (*dl_cb_fn)(uint8_t *voc_pkt,
  1447. void *private_data);
  1448. /* CB for DTMF RX Detection */
  1449. typedef void (*dtmf_rx_det_cb_fn)(uint8_t *pkt,
  1450. char *session,
  1451. void *private_data);
  1452. typedef void (*voip_ssr_cb) (uint32_t opcode,
  1453. void *private_data);
  1454. typedef void (*hostpcm_cb_fn)(uint8_t *data,
  1455. char *session,
  1456. void *private_data);
  1457. struct mvs_driver_info {
  1458. uint32_t media_type;
  1459. uint32_t rate;
  1460. uint32_t network_type;
  1461. uint32_t dtx_mode;
  1462. ul_cb_fn ul_cb;
  1463. dl_cb_fn dl_cb;
  1464. voip_ssr_cb ssr_cb;
  1465. void *private_data;
  1466. uint32_t evrc_min_rate;
  1467. uint32_t evrc_max_rate;
  1468. };
  1469. struct dtmf_driver_info {
  1470. dtmf_rx_det_cb_fn dtmf_rx_ul_cb;
  1471. void *private_data;
  1472. };
  1473. struct hostpcm_driver_info {
  1474. hostpcm_cb_fn hostpcm_evt_cb;
  1475. void *private_data;
  1476. };
  1477. struct incall_rec_info {
  1478. uint32_t rec_enable;
  1479. uint32_t rec_mode;
  1480. uint32_t recording;
  1481. };
  1482. struct incall_music_info {
  1483. uint32_t play_enable;
  1484. uint32_t playing;
  1485. int count;
  1486. int force;
  1487. uint16_t port_id;
  1488. };
  1489. struct share_memory_info {
  1490. u32 mem_handle;
  1491. struct share_mem_buf sh_buf;
  1492. struct mem_map_table memtbl;
  1493. };
  1494. #define VSS_ISOUNDFOCUS_CMD_SET_SECTORS 0x00013133
  1495. #define VSS_ISOUNDFOCUS_CMD_GET_SECTORS 0x00013134
  1496. #define VSS_ISOUNDFOCUS_RSP_GET_SECTORS 0x00013135
  1497. #define VSS_ISOURCETRACK_CMD_GET_ACTIVITY 0x00013136
  1498. struct vss_isoundfocus_cmd_set_sectors_t {
  1499. uint16_t start_angles[8];
  1500. uint8_t enables[8];
  1501. uint16_t gain_step;
  1502. } __packed;
  1503. /* Payload of the VSS_ISOUNDFOCUS_RSP_GET_SECTORS response */
  1504. struct vss_isoundfocus_rsp_get_sectors_t {
  1505. uint16_t start_angles[8];
  1506. uint8_t enables[8];
  1507. uint16_t gain_step;
  1508. } __packed;
  1509. struct cvp_set_sound_focus_param_cmd_t {
  1510. struct apr_hdr hdr;
  1511. struct vss_isoundfocus_cmd_set_sectors_t cvp_set_sound_focus_param;
  1512. } __packed;
  1513. /* Payload structure for the VSS_ISOURCETRACK_CMD_GET_ACTIVITY command */
  1514. struct vss_isourcetrack_cmd_get_activity_t {
  1515. uint32_t mem_handle;
  1516. uint32_t mem_address_lsw;
  1517. uint32_t mem_address_msw;
  1518. uint32_t mem_size;
  1519. } __packed;
  1520. struct cvp_get_source_tracking_param_cmd_t {
  1521. struct apr_hdr hdr;
  1522. struct vss_isourcetrack_cmd_get_activity_t
  1523. cvp_get_source_tracking_param;
  1524. } __packed;
  1525. /* Structure for the sound activity data */
  1526. struct vss_isourcetrack_activity_data_t {
  1527. uint8_t voice_active[8];
  1528. uint16_t talker_doa;
  1529. uint16_t interferer_doa[3];
  1530. uint8_t sound_strength[360];
  1531. } __packed;
  1532. struct shared_mem_info {
  1533. uint32_t mem_handle;
  1534. struct mem_map_table sh_mem_block;
  1535. struct mem_map_table sh_mem_table;
  1536. };
  1537. struct voice_data {
  1538. int voc_state;/*INIT, CHANGE, RELEASE, RUN */
  1539. /* Shared mem to store decoder and encoder packets */
  1540. struct share_memory_info shmem_info;
  1541. wait_queue_head_t mvm_wait;
  1542. wait_queue_head_t cvs_wait;
  1543. wait_queue_head_t cvp_wait;
  1544. /* Cache the values related to Rx and Tx devices */
  1545. struct device_data dev_rx;
  1546. struct device_data dev_tx;
  1547. /* Cache the values related to Rx and Tx streams */
  1548. struct stream_data stream_rx;
  1549. struct stream_data stream_tx;
  1550. u32 mvm_state;
  1551. u32 cvs_state;
  1552. u32 cvp_state;
  1553. u32 async_err;
  1554. /* Handle to MVM in the Q6 */
  1555. u16 mvm_handle;
  1556. /* Handle to CVS in the Q6 */
  1557. u16 cvs_handle;
  1558. /* Handle to CVP in the Q6 */
  1559. u16 cvp_handle;
  1560. struct mutex lock;
  1561. bool disable_topology;
  1562. uint16_t sidetone_gain;
  1563. uint8_t tty_mode;
  1564. /* slowtalk enable value */
  1565. uint32_t st_enable;
  1566. uint32_t hd_enable;
  1567. uint32_t dtmf_rx_detect_en;
  1568. /* Local Call Hold mode */
  1569. uint8_t lch_mode;
  1570. struct voice_dev_route_state voc_route_state;
  1571. u32 session_id;
  1572. struct incall_rec_info rec_info;
  1573. struct incall_music_info music_info;
  1574. struct voice_rec_route_state rec_route_state;
  1575. };
  1576. #define MAX_VOC_SESSIONS 8
  1577. struct common_data {
  1578. /* these default values are for all devices */
  1579. uint32_t default_mute_val;
  1580. uint32_t default_sample_val;
  1581. uint32_t default_vol_step_val;
  1582. uint32_t default_vol_ramp_duration_ms;
  1583. uint32_t default_mute_ramp_duration_ms;
  1584. bool ec_ref_ext;
  1585. struct media_format_info ec_media_fmt_info;
  1586. /* APR to MVM in the Q6 */
  1587. void *apr_q6_mvm;
  1588. /* APR to CVS in the Q6 */
  1589. void *apr_q6_cvs;
  1590. /* APR to CVP in the Q6 */
  1591. void *apr_q6_cvp;
  1592. struct cal_type_data *cal_data[MAX_VOICE_CAL_TYPES];
  1593. struct mem_map_table cal_mem_map_table;
  1594. uint32_t cal_mem_handle;
  1595. struct mem_map_table rtac_mem_map_table;
  1596. uint32_t rtac_mem_handle;
  1597. uint32_t voice_host_pcm_mem_handle;
  1598. struct mutex common_lock;
  1599. struct mvs_driver_info mvs_info;
  1600. struct dtmf_driver_info dtmf_info;
  1601. struct hostpcm_driver_info hostpcm_info;
  1602. struct voice_data voice[MAX_VOC_SESSIONS];
  1603. bool srvcc_rec_flag;
  1604. bool is_destroy_cvd;
  1605. char cvd_version[CVD_VERSION_STRING_MAX_SIZE];
  1606. int cvp_version;
  1607. bool is_avcs_version_queried;
  1608. bool is_per_vocoder_cal_enabled;
  1609. bool is_sound_focus_resp_success;
  1610. bool is_source_tracking_resp_success;
  1611. struct vss_isoundfocus_rsp_get_sectors_t soundFocusResponse;
  1612. struct shared_mem_info source_tracking_sh_mem;
  1613. struct vss_isourcetrack_activity_data_t sourceTrackingResponse;
  1614. bool sidetone_enable;
  1615. };
  1616. struct voice_session_itr {
  1617. int cur_idx;
  1618. int session_idx;
  1619. };
  1620. void voc_register_mvs_cb(ul_cb_fn ul_cb,
  1621. dl_cb_fn dl_cb,
  1622. voip_ssr_cb ssr_cb,
  1623. void *private_data);
  1624. void voc_register_dtmf_rx_detection_cb(dtmf_rx_det_cb_fn dtmf_rx_ul_cb,
  1625. void *private_data);
  1626. void voc_config_vocoder(uint32_t media_type,
  1627. uint32_t rate,
  1628. uint32_t network_type,
  1629. uint32_t dtx_mode,
  1630. uint32_t evrc_min_rate,
  1631. uint32_t evrc_max_rate);
  1632. enum {
  1633. DEV_RX = 0,
  1634. DEV_TX,
  1635. };
  1636. enum {
  1637. RX_PATH = 0,
  1638. TX_PATH,
  1639. EC_REF_PATH,
  1640. };
  1641. #define VOC_PATH_PASSIVE 0
  1642. #define VOC_PATH_FULL 1
  1643. #define VOC_PATH_VOLTE_PASSIVE 2
  1644. #define VOC_PATH_VOICE2_PASSIVE 3
  1645. #define VOC_PATH_QCHAT_PASSIVE 4
  1646. #define VOC_PATH_VOWLAN_PASSIVE 5
  1647. #define VOC_PATH_VOICEMMODE1_PASSIVE 6
  1648. #define VOC_PATH_VOICEMMODE2_PASSIVE 7
  1649. #define MAX_SESSION_NAME_LEN 32
  1650. #define VOICE_SESSION_NAME "Voice session"
  1651. #define VOIP_SESSION_NAME "VoIP session"
  1652. #define VOLTE_SESSION_NAME "VoLTE session"
  1653. #define VOICE2_SESSION_NAME "Voice2 session"
  1654. #define QCHAT_SESSION_NAME "QCHAT session"
  1655. #define VOWLAN_SESSION_NAME "VoWLAN session"
  1656. #define VOICEMMODE1_NAME "VoiceMMode1"
  1657. #define VOICEMMODE2_NAME "VoiceMMode2"
  1658. #define VOICE2_SESSION_VSID_STR "10DC1000"
  1659. #define QCHAT_SESSION_VSID_STR "10803000"
  1660. #define VOWLAN_SESSION_VSID_STR "10002000"
  1661. #define VOICEMMODE1_VSID_STR "11C05000"
  1662. #define VOICEMMODE2_VSID_STR "11DC5000"
  1663. #define VOICE_SESSION_VSID 0x10C01000
  1664. #define VOICE2_SESSION_VSID 0x10DC1000
  1665. #define VOLTE_SESSION_VSID 0x10C02000
  1666. #define VOIP_SESSION_VSID 0x10004000
  1667. #define QCHAT_SESSION_VSID 0x10803000
  1668. #define VOWLAN_SESSION_VSID 0x10002000
  1669. #define VOICEMMODE1_VSID 0x11C05000
  1670. #define VOICEMMODE2_VSID 0x11DC5000
  1671. #define ALL_SESSION_VSID 0xFFFFFFFF
  1672. #define VSID_MAX ALL_SESSION_VSID
  1673. /* called by alsa driver */
  1674. int voc_set_pp_enable(uint32_t session_id, uint32_t module_id,
  1675. uint32_t enable);
  1676. int voc_get_pp_enable(uint32_t session_id, uint32_t module_id);
  1677. int voc_set_hd_enable(uint32_t session_id, uint32_t enable);
  1678. uint8_t voc_get_tty_mode(uint32_t session_id);
  1679. int voc_set_tty_mode(uint32_t session_id, uint8_t tty_mode);
  1680. int voc_start_voice_call(uint32_t session_id);
  1681. int voc_end_voice_call(uint32_t session_id);
  1682. int voc_standby_voice_call(uint32_t session_id);
  1683. int voc_resume_voice_call(uint32_t session_id);
  1684. int voc_set_lch(uint32_t session_id, enum voice_lch_mode lch_mode);
  1685. int voc_set_rx_vol_step(uint32_t session_id, uint32_t dir, uint32_t vol_step,
  1686. uint32_t ramp_duration);
  1687. int voc_set_tx_mute(uint32_t session_id, uint32_t dir, uint32_t mute,
  1688. uint32_t ramp_duration);
  1689. int voc_set_device_mute(uint32_t session_id, uint32_t dir, uint32_t mute,
  1690. uint32_t ramp_duration);
  1691. int voc_get_rx_device_mute(uint32_t session_id);
  1692. int voc_set_route_flag(uint32_t session_id, uint8_t path_dir, uint8_t set);
  1693. uint8_t voc_get_route_flag(uint32_t session_id, uint8_t path_dir);
  1694. int voc_enable_dtmf_rx_detection(uint32_t session_id, uint32_t enable);
  1695. void voc_disable_dtmf_det_on_active_sessions(void);
  1696. int voc_alloc_cal_shared_memory(void);
  1697. int voc_alloc_voip_shared_memory(void);
  1698. int is_voc_initialized(void);
  1699. int voc_register_vocproc_vol_table(void);
  1700. int voc_deregister_vocproc_vol_table(void);
  1701. int voc_send_cvp_map_vocpcm_memory(uint32_t session_id,
  1702. struct mem_map_table *tp_mem_table,
  1703. phys_addr_t paddr, uint32_t bufsize);
  1704. int voc_send_cvp_unmap_vocpcm_memory(uint32_t session_id);
  1705. int voc_send_cvp_start_vocpcm(uint32_t session_id,
  1706. struct vss_ivpcm_tap_point *vpcm_tp,
  1707. uint32_t no_of_tp);
  1708. int voc_send_cvp_vocpcm_push_buf_evt(uint32_t session_id,
  1709. struct vss_ivpcm_evt_push_buffer_v2_t *push_buff_evt);
  1710. int voc_send_cvp_stop_vocpcm(uint32_t session_id);
  1711. void voc_register_hpcm_evt_cb(hostpcm_cb_fn hostpcm_cb,
  1712. void *private_data);
  1713. void voc_deregister_hpcm_evt_cb(void);
  1714. int voc_map_rtac_block(struct rtac_cal_block_data *cal_block);
  1715. int voc_unmap_rtac_block(uint32_t *mem_map_handle);
  1716. uint32_t voc_get_session_id(char *name);
  1717. int voc_start_playback(uint32_t set, uint16_t port_id);
  1718. int voc_start_record(uint32_t port_id, uint32_t set, uint32_t session_id);
  1719. int voice_get_idx_for_session(u32 session_id);
  1720. int voc_set_ext_ec_ref_port_id(uint16_t port_id, bool state);
  1721. int voc_get_ext_ec_ref_port_id(void);
  1722. int voc_set_ext_ec_ref_media_fmt_info(struct media_format_info *finfo);
  1723. int voc_update_amr_vocoder_rate(uint32_t session_id);
  1724. int voc_disable_device(uint32_t session_id);
  1725. int voc_enable_device(uint32_t session_id);
  1726. void voc_set_destroy_cvd_flag(bool is_destroy_cvd);
  1727. int voc_disable_topology(uint32_t session_id, uint32_t disable);
  1728. int voc_set_device_config(uint32_t session_id, uint8_t path_dir,
  1729. struct media_format_info *finfo);
  1730. uint32_t voice_get_topology(uint32_t topology_idx);
  1731. int voice_set_topology_specific_info(struct voice_data *v,
  1732. uint32_t topology_idx);
  1733. int voc_set_sound_focus(struct sound_focus_param sound_focus_param);
  1734. int voc_get_sound_focus(struct sound_focus_param *soundFocusData);
  1735. int voc_get_source_tracking(struct source_tracking_param *sourceTrackingData);
  1736. int voc_set_afe_sidetone(uint32_t session_id, bool sidetone_enable);
  1737. bool voc_get_afe_sidetone(void);
  1738. #endif