q6voice.h 52 KB

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