q6voice.h 57 KB

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