q6voice.h 57 KB

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