q6voice.h 56 KB

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