q6voice.h 58 KB

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