q6voice.h 55 KB

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