q6voice.h 59 KB

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