q6voice.h 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565
  1. /* Copyright (c) 2012-2014, 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 <mach/qdsp6v2/apr.h>
  15. #include <mach/qdsp6v2/rtac.h>
  16. #include <linux/msm_ion.h>
  17. #include <sound/voice_params.h>
  18. #define MAX_VOC_PKT_SIZE 642
  19. #ifdef CONFIG_DSDA_VIA_UART
  20. #define SESSION_NAME_LEN 21
  21. #else
  22. #define SESSION_NAME_LEN 20
  23. #endif /* CONFIG_DSDA_VIA_UART */
  24. #define NUM_OF_MEMORY_BLOCKS 1
  25. #define NUM_OF_BUFFERS 2
  26. /*
  27. * BUFFER BLOCK SIZE based on
  28. * the supported page size
  29. */
  30. #define BUFFER_BLOCK_SIZE 4096
  31. #define MAX_COL_INFO_SIZE 324
  32. #define VOC_REC_UPLINK 0x00
  33. #define VOC_REC_DOWNLINK 0x01
  34. #define VOC_REC_BOTH 0x02
  35. struct voice_header {
  36. uint32_t id;
  37. uint32_t data_len;
  38. };
  39. struct voice_init {
  40. struct voice_header hdr;
  41. void *cb_handle;
  42. };
  43. /* Stream information payload structure */
  44. struct stream_data {
  45. uint32_t stream_mute;
  46. uint32_t stream_mute_ramp_duration_ms;
  47. };
  48. /* Device information payload structure */
  49. struct device_data {
  50. uint32_t dev_mute;
  51. uint32_t sample;
  52. uint32_t enabled;
  53. uint32_t dev_id;
  54. uint32_t port_id;
  55. uint32_t volume_step_value;
  56. uint32_t volume_ramp_duration_ms;
  57. uint32_t dev_mute_ramp_duration_ms;
  58. };
  59. struct voice_dev_route_state {
  60. u16 rx_route_flag;
  61. u16 tx_route_flag;
  62. };
  63. struct voice_rec_route_state {
  64. u16 ul_flag;
  65. u16 dl_flag;
  66. };
  67. #ifdef CONFIG_SEC_DHA_SOL_MAL
  68. struct voice_dha_data {
  69. short dha_mode;
  70. short dha_select;
  71. short dha_params[12];
  72. };
  73. #endif /* CONFIG_SEC_DHA_SOL_MAL */
  74. enum {
  75. VOC_INIT = 0,
  76. VOC_RUN,
  77. VOC_CHANGE,
  78. VOC_RELEASE,
  79. VOC_ERROR,
  80. VOC_STANDBY,
  81. };
  82. struct mem_buffer {
  83. dma_addr_t phys;
  84. void *data;
  85. uint32_t size; /* size of buffer */
  86. };
  87. struct share_mem_buf {
  88. struct ion_handle *handle;
  89. struct ion_client *client;
  90. struct mem_buffer buf[NUM_OF_BUFFERS];
  91. };
  92. struct mem_map_table {
  93. dma_addr_t phys;
  94. void *data;
  95. size_t size; /* size of buffer */
  96. struct ion_handle *handle;
  97. struct ion_client *client;
  98. };
  99. #ifdef CONFIG_SEC_DHA_SOL_MAL
  100. #define VSS_ICOMMON_CMD_DHA_SET 0x0001128A
  101. #endif /*CONFIG_SEC_DHA_SOL_MAL*/
  102. /* Common */
  103. #define VSS_ICOMMON_CMD_SET_UI_PROPERTY 0x00011103
  104. /* Set a UI property */
  105. #define VSS_ICOMMON_CMD_MAP_MEMORY 0x00011025
  106. #define VSS_ICOMMON_CMD_UNMAP_MEMORY 0x00011026
  107. /* General shared memory; byte-accessible, 4 kB-aligned. */
  108. #define VSS_ICOMMON_MAP_MEMORY_SHMEM8_4K_POOL 3
  109. struct vss_icommon_cmd_map_memory_t {
  110. uint32_t phys_addr;
  111. /* Physical address of a memory region; must be at least
  112. * 4 kB aligned.
  113. */
  114. uint32_t mem_size;
  115. /* Number of bytes in the region; should be a multiple of 32. */
  116. uint16_t mem_pool_id;
  117. /* Type of memory being provided. The memory ID implicitly defines
  118. * the characteristics of the memory. The characteristics might include
  119. * alignment type, permissions, etc.
  120. * Memory pool ID. Possible values:
  121. * 3 -- VSS_ICOMMON_MEM_TYPE_SHMEM8_4K_POOL.
  122. */
  123. } __packed;
  124. struct vss_icommon_cmd_unmap_memory_t {
  125. uint32_t phys_addr;
  126. /* Physical address of a memory region; must be at least
  127. * 4 kB aligned.
  128. */
  129. } __packed;
  130. struct vss_map_memory_cmd {
  131. struct apr_hdr hdr;
  132. struct vss_icommon_cmd_map_memory_t vss_map_mem;
  133. } __packed;
  134. struct vss_unmap_memory_cmd {
  135. struct apr_hdr hdr;
  136. struct vss_icommon_cmd_unmap_memory_t vss_unmap_mem;
  137. } __packed;
  138. /* TO MVM commands */
  139. #define VSS_IMVM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x000110FF
  140. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  141. #define VSS_IMVM_CMD_SET_POLICY_DUAL_CONTROL 0x00011327
  142. /*
  143. * VSS_IMVM_CMD_SET_POLICY_DUAL_CONTROL
  144. * Description: This command is required to let MVM know
  145. * who is in control of session.
  146. * Payload: Defined by vss_imvm_cmd_set_policy_dual_control_t.
  147. * Result: Wait for APRV2_IBASIC_RSP_RESULT response.
  148. */
  149. #define VSS_IMVM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110FE
  150. /* Create a new full control MVM session. */
  151. #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
  152. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  153. #define VSS_IMVM_CMD_ATTACH_STREAM 0x0001123C
  154. /* Attach a stream to the MVM. */
  155. #define VSS_IMVM_CMD_DETACH_STREAM 0x0001123D
  156. /* Detach a stream from the MVM. */
  157. #define VSS_IMVM_CMD_ATTACH_VOCPROC 0x0001123E
  158. /* Attach a vocproc to the MVM. The MVM will symmetrically connect this vocproc
  159. * to all the streams currently attached to it.
  160. */
  161. #define VSS_IMVM_CMD_DETACH_VOCPROC 0x0001123F
  162. /* Detach a vocproc from the MVM. The MVM will symmetrically disconnect this
  163. * vocproc from all the streams to which it is currently attached.
  164. */
  165. #define VSS_IMVM_CMD_START_VOICE 0x00011190
  166. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  167. #define VSS_IMVM_CMD_STANDBY_VOICE 0x00011191
  168. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  169. #define VSS_IMVM_CMD_STOP_VOICE 0x00011192
  170. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  171. #define VSS_IMVM_CMD_PAUSE_VOICE 0x0001137D
  172. /* No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  173. #define VSS_ISTREAM_CMD_ATTACH_VOCPROC 0x000110F8
  174. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  175. #define VSS_ISTREAM_CMD_DETACH_VOCPROC 0x000110F9
  176. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  177. #define VSS_ISTREAM_CMD_SET_TTY_MODE 0x00011196
  178. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  179. #define VSS_ICOMMON_CMD_SET_NETWORK 0x0001119C
  180. /* Set the network type. */
  181. #define VSS_ICOMMON_CMD_SET_VOICE_TIMING 0x000111E0
  182. /* Set the voice timing parameters. */
  183. #define VSS_IMEMORY_CMD_MAP_PHYSICAL 0x00011334
  184. #define VSS_IMEMORY_RSP_MAP 0x00011336
  185. #define VSS_IMEMORY_CMD_UNMAP 0x00011337
  186. #define VSS_IMVM_CMD_SET_CAL_NETWORK 0x0001137A
  187. #define VSS_IMVM_CMD_SET_CAL_MEDIA_TYPE 0x0001137B
  188. enum msm_audio_voc_rate {
  189. VOC_0_RATE, /* Blank frame */
  190. VOC_8_RATE, /* 1/8 rate */
  191. VOC_4_RATE, /* 1/4 rate */
  192. VOC_2_RATE, /* 1/2 rate */
  193. VOC_1_RATE, /* Full rate */
  194. VOC_8_RATE_NC /* Noncritical 1/8 rate */
  195. };
  196. struct vss_istream_cmd_set_tty_mode_t {
  197. uint32_t mode;
  198. /**<
  199. * TTY mode.
  200. *
  201. * 0 : TTY disabled
  202. * 1 : HCO
  203. * 2 : VCO
  204. * 3 : FULL
  205. */
  206. } __packed;
  207. struct vss_istream_cmd_attach_vocproc_t {
  208. uint16_t handle;
  209. /**< Handle of vocproc being attached. */
  210. } __packed;
  211. struct vss_istream_cmd_detach_vocproc_t {
  212. uint16_t handle;
  213. /**< Handle of vocproc being detached. */
  214. } __packed;
  215. struct vss_imvm_cmd_attach_stream_t {
  216. uint16_t handle;
  217. /* The stream handle to attach. */
  218. } __packed;
  219. struct vss_imvm_cmd_detach_stream_t {
  220. uint16_t handle;
  221. /* The stream handle to detach. */
  222. } __packed;
  223. struct vss_icommon_cmd_set_network_t {
  224. uint32_t network_id;
  225. /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */
  226. } __packed;
  227. struct vss_icommon_cmd_set_voice_timing_t {
  228. uint16_t mode;
  229. /*
  230. * The vocoder frame synchronization mode.
  231. *
  232. * 0 : No frame sync.
  233. * 1 : Hard VFR (20ms Vocoder Frame Reference interrupt).
  234. */
  235. uint16_t enc_offset;
  236. /*
  237. * The offset in microseconds from the VFR to deliver a Tx vocoder
  238. * packet. The offset should be less than 20000us.
  239. */
  240. uint16_t dec_req_offset;
  241. /*
  242. * The offset in microseconds from the VFR to request for an Rx vocoder
  243. * packet. The offset should be less than 20000us.
  244. */
  245. uint16_t dec_offset;
  246. /*
  247. * The offset in microseconds from the VFR to indicate the deadline to
  248. * receive an Rx vocoder packet. The offset should be less than 20000us.
  249. * Rx vocoder packets received after this deadline are not guaranteed to
  250. * be processed.
  251. */
  252. } __packed;
  253. struct vss_imvm_cmd_create_control_session_t {
  254. char name[SESSION_NAME_LEN];
  255. /*
  256. * A variable-sized stream name.
  257. *
  258. * The stream name size is the payload size minus the size of the other
  259. * fields.
  260. */
  261. } __packed;
  262. struct vss_imvm_cmd_set_policy_dual_control_t {
  263. bool enable_flag;
  264. /* Set to TRUE to enable modem state machine control */
  265. } __packed;
  266. struct mvm_attach_vocproc_cmd {
  267. struct apr_hdr hdr;
  268. struct vss_istream_cmd_attach_vocproc_t mvm_attach_cvp_handle;
  269. } __packed;
  270. struct mvm_detach_vocproc_cmd {
  271. struct apr_hdr hdr;
  272. struct vss_istream_cmd_detach_vocproc_t mvm_detach_cvp_handle;
  273. } __packed;
  274. struct mvm_create_ctl_session_cmd {
  275. struct apr_hdr hdr;
  276. struct vss_imvm_cmd_create_control_session_t mvm_session;
  277. } __packed;
  278. struct mvm_modem_dual_control_session_cmd {
  279. struct apr_hdr hdr;
  280. struct vss_imvm_cmd_set_policy_dual_control_t voice_ctl;
  281. } __packed;
  282. struct mvm_set_tty_mode_cmd {
  283. struct apr_hdr hdr;
  284. struct vss_istream_cmd_set_tty_mode_t tty_mode;
  285. } __packed;
  286. struct mvm_attach_stream_cmd {
  287. struct apr_hdr hdr;
  288. struct vss_imvm_cmd_attach_stream_t attach_stream;
  289. } __packed;
  290. struct mvm_detach_stream_cmd {
  291. struct apr_hdr hdr;
  292. struct vss_imvm_cmd_detach_stream_t detach_stream;
  293. } __packed;
  294. struct mvm_set_network_cmd {
  295. struct apr_hdr hdr;
  296. struct vss_icommon_cmd_set_network_t network;
  297. } __packed;
  298. struct mvm_set_voice_timing_cmd {
  299. struct apr_hdr hdr;
  300. struct vss_icommon_cmd_set_voice_timing_t timing;
  301. } __packed;
  302. struct vss_imemory_table_descriptor_t {
  303. uint64_t mem_address;
  304. /*
  305. * Base physical address of the table. The address must be aligned
  306. * to LCM( cache_line_size, page_align, max_data_width ), where the
  307. * attributes are specified in #VSS_IMEMORY_CMD_MAP_PHYSICAL, and
  308. * LCM = Least Common Multiple. The table at the address must have
  309. * the format specified by #vss_imemory_table_t.
  310. */
  311. uint32_t mem_size;
  312. /* Size in bytes of the table. */
  313. } __packed;
  314. struct vss_imemory_block_t {
  315. uint64_t mem_address;
  316. /*
  317. * Base address of the memory block. The address is virtual for virtual
  318. * memory and physical for physical memory. The address must be aligned
  319. * to LCM( cache_line_size, page_align, max_data_width ), where the
  320. * attributes are specified in VSS_IMEMORY_CMD_MAP_VIRTUAL or
  321. * VSS_IMEMORY_CMD_MAP_PHYSICAL, and LCM = Least Common Multiple.
  322. */
  323. uint32_t mem_size;
  324. /*
  325. * Size in bytes of the memory block. The size must be multiple of
  326. * page_align, where page_align is specified in
  327. * VSS_IMEMORY_CMD_MAP_VIRTUAL or #VSS_IMEMORY_CMD_MAP_PHYSICAL.
  328. */
  329. } __packed;
  330. struct vss_imemory_table_t {
  331. struct vss_imemory_table_descriptor_t next_table_descriptor;
  332. /*
  333. * Specifies the next table. If there is no next table,
  334. * set the size of the table to 0 and the table address is ignored.
  335. */
  336. struct vss_imemory_block_t blocks[NUM_OF_MEMORY_BLOCKS];
  337. /* Specifies one ore more memory blocks. */
  338. } __packed;
  339. struct vss_imemory_cmd_map_physical_t {
  340. struct apr_hdr hdr;
  341. struct vss_imemory_table_descriptor_t table_descriptor;
  342. bool is_cached;
  343. /*
  344. * Indicates cached or uncached memory. Supported values:
  345. * TRUE - Cached.
  346. */
  347. uint16_t cache_line_size;
  348. /* Cache line size in bytes. Supported values: 128 */
  349. uint32_t access_mask;
  350. /*
  351. * CVD's access permission to the memory while it is mapped.
  352. * Supported values:
  353. * bit 0 - If set, the memory is readable.
  354. * bit 1 - If set, the memory is writable.
  355. */
  356. uint32_t page_align;
  357. /* Page frame alignment in bytes. Supported values: 4096 */
  358. uint8_t min_data_width;
  359. /*
  360. * Minimum native data type width in bits that can be accessed.
  361. * Supported values: 8
  362. */
  363. uint8_t max_data_width;
  364. /*
  365. * Maximum native data type width in bits that can be accessed.
  366. * Supported values: 64
  367. */
  368. } __packed;
  369. struct vss_imvm_cmd_set_cal_network_t {
  370. struct apr_hdr hdr;
  371. uint32_t network_id;
  372. } __packed;
  373. struct vss_imvm_cmd_set_cal_media_type_t {
  374. struct apr_hdr hdr;
  375. uint32_t media_id;
  376. } __packed;
  377. struct vss_imemory_cmd_unmap_t {
  378. struct apr_hdr hdr;
  379. uint32_t mem_handle;
  380. } __packed;
  381. /* TO CVS commands */
  382. #define VSS_ISTREAM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x00011140
  383. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  384. #define VSS_ISTREAM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110F7
  385. /* Create a new full control stream session. */
  386. #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
  387. /*
  388. * This command changes the mute setting. The new mute setting will
  389. * be applied over the specified ramp duration.
  390. */
  391. #define VSS_IVOLUME_CMD_MUTE_V2 0x0001138B
  392. #define VSS_ISTREAM_CMD_REGISTER_CALIBRATION_DATA_V2 0x00011369
  393. #define VSS_ISTREAM_CMD_DEREGISTER_CALIBRATION_DATA 0x0001127A
  394. #define VSS_ISTREAM_CMD_SET_MEDIA_TYPE 0x00011186
  395. /* Set media type on the stream. */
  396. #define VSS_ISTREAM_EVT_SEND_ENC_BUFFER 0x00011015
  397. /* Event sent by the stream to its client to provide an encoded packet. */
  398. #define VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER 0x00011017
  399. /* Event sent by the stream to its client requesting for a decoder packet.
  400. * The client should respond with a VSS_ISTREAM_EVT_SEND_DEC_BUFFER event.
  401. */
  402. #define VSS_ISTREAM_EVT_OOB_NOTIFY_DEC_BUFFER_REQUEST 0x0001136E
  403. #define VSS_ISTREAM_EVT_SEND_DEC_BUFFER 0x00011016
  404. /* Event sent by the client to the stream in response to a
  405. * VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER event, providing a decoder packet.
  406. */
  407. #define VSS_ISTREAM_CMD_VOC_AMR_SET_ENC_RATE 0x0001113E
  408. /* Set AMR encoder rate. */
  409. #define VSS_ISTREAM_CMD_VOC_AMRWB_SET_ENC_RATE 0x0001113F
  410. /* Set AMR-WB encoder rate. */
  411. #define VSS_ISTREAM_CMD_CDMA_SET_ENC_MINMAX_RATE 0x00011019
  412. /* Set encoder minimum and maximum rate. */
  413. #define VSS_ISTREAM_CMD_SET_ENC_DTX_MODE 0x0001101D
  414. /* Set encoder DTX mode. */
  415. #define MODULE_ID_VOICE_MODULE_ST 0x00010EE3
  416. #define VOICE_PARAM_MOD_ENABLE 0x00010E00
  417. #define MOD_ENABLE_PARAM_LEN 4
  418. #define VSS_IPLAYBACK_CMD_START 0x000112BD
  419. /* Start in-call music delivery on the Tx voice path. */
  420. #define VSS_IPLAYBACK_CMD_STOP 0x00011239
  421. /* Stop the in-call music delivery on the Tx voice path. */
  422. #define VSS_IPLAYBACK_PORT_ID_DEFAULT 0x0000FFFF
  423. /* Default AFE port ID. */
  424. #define VSS_IPLAYBACK_PORT_ID_VOICE 0x00008005
  425. /* AFE port ID for VOICE 1. */
  426. #define VSS_IPLAYBACK_PORT_ID_VOICE2 0x00008002
  427. /* AFE port ID for VOICE 2. */
  428. #define VSS_IRECORD_CMD_START 0x000112BE
  429. /* Start in-call conversation recording. */
  430. #define VSS_IRECORD_CMD_STOP 0x00011237
  431. /* Stop in-call conversation recording. */
  432. #define VSS_IRECORD_PORT_ID_DEFAULT 0x0000FFFF
  433. /* Default AFE port ID. */
  434. /* Port explicitly identifying TX and RX streams */
  435. #define VSS_IRECORD_PORT_ID_TX_RX 0x00008003
  436. #define VSS_IRECORD_TAP_POINT_NONE 0x00010F78
  437. /* Indicates no tapping for specified path. */
  438. #define VSS_IRECORD_TAP_POINT_STREAM_END 0x00010F79
  439. /* Indicates that specified path should be tapped at the end of the stream. */
  440. #define VSS_IRECORD_MODE_TX_RX_STEREO 0x00010F7A
  441. /* Select Tx on left channel and Rx on right channel. */
  442. #define VSS_IRECORD_MODE_TX_RX_MIXING 0x00010F7B
  443. /* Select mixed Tx and Rx paths. */
  444. #define VSS_ISTREAM_EVT_NOT_READY 0x000110FD
  445. #define VSS_ISTREAM_EVT_READY 0x000110FC
  446. #define VSS_ISTREAM_EVT_OOB_NOTIFY_DEC_BUFFER_READY 0x0001136F
  447. /*notify dsp that decoder buffer is ready*/
  448. #define VSS_ISTREAM_EVT_OOB_NOTIFY_ENC_BUFFER_READY 0x0001136C
  449. /*dsp notifying client that encoder buffer is ready*/
  450. #define VSS_ISTREAM_EVT_OOB_NOTIFY_ENC_BUFFER_CONSUMED 0x0001136D
  451. /*notify dsp that encoder buffer is consumed*/
  452. #define VSS_ISTREAM_CMD_SET_OOB_PACKET_EXCHANGE_CONFIG 0x0001136B
  453. #define VSS_ISTREAM_PACKET_EXCHANGE_MODE_INBAND 0
  454. /* In-band packet exchange mode. */
  455. #define VSS_ISTREAM_PACKET_EXCHANGE_MODE_OUT_OF_BAND 1
  456. /* Out-of-band packet exchange mode. */
  457. #define VSS_ISTREAM_CMD_SET_PACKET_EXCHANGE_MODE 0x0001136A
  458. struct vss_iplayback_cmd_start_t {
  459. uint16_t port_id;
  460. /*
  461. * AFE Port ID from which the audio samples are available.
  462. * To use the default AFE pseudo port (0x8005), set this value to
  463. * #VSS_IPLAYBACK_PORT_ID_DEFAULT.
  464. */
  465. } __packed;
  466. struct vss_irecord_cmd_start_t {
  467. uint32_t rx_tap_point;
  468. /* Tap point to use on the Rx path. Supported values are:
  469. * VSS_IRECORD_TAP_POINT_NONE : Do not record Rx path.
  470. * VSS_IRECORD_TAP_POINT_STREAM_END : Rx tap point is at the end of
  471. * the stream.
  472. */
  473. uint32_t tx_tap_point;
  474. /* Tap point to use on the Tx path. Supported values are:
  475. * VSS_IRECORD_TAP_POINT_NONE : Do not record tx path.
  476. * VSS_IRECORD_TAP_POINT_STREAM_END : Tx tap point is at the end of
  477. * the stream.
  478. */
  479. uint16_t port_id;
  480. /* AFE Port ID to whcih the conversation recording stream needs to be
  481. * sent. Set this to #VSS_IRECORD_PORT_ID_DEFAULT to use default AFE
  482. * pseudo ports (0x8003 for Rx and 0x8004 for Tx).
  483. */
  484. uint32_t mode;
  485. /* Recording Mode. The mode parameter value is ignored if the port_id
  486. * is set to #VSS_IRECORD_PORT_ID_DEFAULT.
  487. * The supported values:
  488. * #VSS_IRECORD_MODE_TX_RX_STEREO
  489. * #VSS_IRECORD_MODE_TX_RX_MIXING
  490. */
  491. } __packed;
  492. struct vss_istream_cmd_create_passive_control_session_t {
  493. char name[SESSION_NAME_LEN];
  494. /**<
  495. * A variable-sized stream name.
  496. *
  497. * The stream name size is the payload size minus the size of the other
  498. * fields.
  499. */
  500. } __packed;
  501. #define VSS_IVOLUME_DIRECTION_TX 0
  502. #define VSS_IVOLUME_DIRECTION_RX 1
  503. #define VSS_IVOLUME_MUTE_OFF 0
  504. #define VSS_IVOLUME_MUTE_ON 1
  505. #define DEFAULT_MUTE_RAMP_DURATION 500
  506. #define DEFAULT_VOLUME_RAMP_DURATION 20
  507. #define MAX_RAMP_DURATION 5000
  508. struct vss_ivolume_cmd_mute_v2_t {
  509. uint16_t direction;
  510. /*
  511. * The direction field sets the direction to apply the mute command.
  512. * The Supported values:
  513. * VSS_IVOLUME_DIRECTION_TX
  514. * VSS_IVOLUME_DIRECTION_RX
  515. */
  516. uint16_t mute_flag;
  517. /*
  518. * Turn mute on or off. The Supported values:
  519. * VSS_IVOLUME_MUTE_OFF
  520. * VSS_IVOLUME_MUTE_ON
  521. */
  522. uint16_t ramp_duration_ms;
  523. /*
  524. * Mute change ramp duration in milliseconds.
  525. * The Supported values: 0 to 5000.
  526. */
  527. } __packed;
  528. struct vss_istream_cmd_create_full_control_session_t {
  529. uint16_t direction;
  530. /*
  531. * Stream direction.
  532. *
  533. * 0 : TX only
  534. * 1 : RX only
  535. * 2 : TX and RX
  536. * 3 : TX and RX loopback
  537. */
  538. uint32_t enc_media_type;
  539. /* Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  540. uint32_t dec_media_type;
  541. /* Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  542. uint32_t network_id;
  543. /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */
  544. char name[SESSION_NAME_LEN];
  545. /*
  546. * A variable-sized stream name.
  547. *
  548. * The stream name size is the payload size minus the size of the other
  549. * fields.
  550. */
  551. } __packed;
  552. struct vss_istream_cmd_set_media_type_t {
  553. uint32_t rx_media_id;
  554. /* Set the Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  555. uint32_t tx_media_id;
  556. /* Set the Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  557. } __packed;
  558. struct vss_istream_evt_send_enc_buffer_t {
  559. uint32_t media_id;
  560. /* Media ID of the packet. */
  561. uint8_t packet_data[MAX_VOC_PKT_SIZE];
  562. /* Packet data buffer. */
  563. } __packed;
  564. struct vss_istream_evt_send_dec_buffer_t {
  565. uint32_t media_id;
  566. /* Media ID of the packet. */
  567. uint8_t packet_data[MAX_VOC_PKT_SIZE];
  568. /* Packet data. */
  569. } __packed;
  570. struct vss_istream_cmd_voc_amr_set_enc_rate_t {
  571. uint32_t mode;
  572. /* Set the AMR encoder rate.
  573. *
  574. * 0x00000000 : 4.75 kbps
  575. * 0x00000001 : 5.15 kbps
  576. * 0x00000002 : 5.90 kbps
  577. * 0x00000003 : 6.70 kbps
  578. * 0x00000004 : 7.40 kbps
  579. * 0x00000005 : 7.95 kbps
  580. * 0x00000006 : 10.2 kbps
  581. * 0x00000007 : 12.2 kbps
  582. */
  583. } __packed;
  584. struct vss_istream_cmd_voc_amrwb_set_enc_rate_t {
  585. uint32_t mode;
  586. /* Set the AMR-WB encoder rate.
  587. *
  588. * 0x00000000 : 6.60 kbps
  589. * 0x00000001 : 8.85 kbps
  590. * 0x00000002 : 12.65 kbps
  591. * 0x00000003 : 14.25 kbps
  592. * 0x00000004 : 15.85 kbps
  593. * 0x00000005 : 18.25 kbps
  594. * 0x00000006 : 19.85 kbps
  595. * 0x00000007 : 23.05 kbps
  596. * 0x00000008 : 23.85 kbps
  597. */
  598. } __packed;
  599. struct vss_istream_cmd_cdma_set_enc_minmax_rate_t {
  600. uint16_t min_rate;
  601. /* Set the lower bound encoder rate.
  602. *
  603. * 0x0000 : Blank frame
  604. * 0x0001 : Eighth rate
  605. * 0x0002 : Quarter rate
  606. * 0x0003 : Half rate
  607. * 0x0004 : Full rate
  608. */
  609. uint16_t max_rate;
  610. /* Set the upper bound encoder rate.
  611. *
  612. * 0x0000 : Blank frame
  613. * 0x0001 : Eighth rate
  614. * 0x0002 : Quarter rate
  615. * 0x0003 : Half rate
  616. * 0x0004 : Full rate
  617. */
  618. } __packed;
  619. struct vss_istream_cmd_set_enc_dtx_mode_t {
  620. uint32_t enable;
  621. /* Toggle DTX on or off.
  622. *
  623. * 0 : Disables DTX
  624. * 1 : Enables DTX
  625. */
  626. } __packed;
  627. struct vss_istream_cmd_register_calibration_data_v2_t {
  628. uint32_t cal_mem_handle;
  629. /* Handle to the shared memory that holds the calibration data. */
  630. uint64_t cal_mem_address;
  631. /* Location of calibration data. */
  632. uint32_t cal_mem_size;
  633. /* Size of the calibration data in bytes. */
  634. uint8_t column_info[MAX_COL_INFO_SIZE];
  635. /*
  636. * Column info contains the number of columns and the array of columns
  637. * in the calibration table. The order in which the columns are provided
  638. * here must match the order in which they exist in the calibration
  639. * table provided.
  640. */
  641. } __packed;
  642. struct vss_icommon_cmd_set_ui_property_enable_t {
  643. uint32_t module_id;
  644. /* Unique ID of the module. */
  645. uint32_t param_id;
  646. /* Unique ID of the parameter. */
  647. uint16_t param_size;
  648. /* Size of the parameter in bytes: MOD_ENABLE_PARAM_LEN */
  649. uint16_t reserved;
  650. /* Reserved; set to 0. */
  651. uint16_t enable;
  652. uint16_t reserved_field;
  653. /* Reserved, set to 0. */
  654. };
  655. #define VOICE_MODULE_DHA 0x10001020
  656. #define VOICE_PARAM_DHA_DYNAMIC 0x10001022
  657. #define VOICEPROC_MODULE_VENC 0x00010F07
  658. #define VOICE_PARAM_LOOPBACK_ENABLE 0x00010E18
  659. struct vss_icommon_cmd_set_loopback_enable_t {
  660. uint32_t module_id;
  661. /* Unique ID of the module. */
  662. uint32_t param_id;
  663. /* Unique ID of the parameter. */
  664. uint16_t param_size;
  665. /* Size of the parameter in bytes: MOD_ENABLE_PARAM_LEN */
  666. uint16_t reserved;
  667. /* Reserved; set to 0. */
  668. uint16_t loopback_enable;
  669. uint16_t reserved_field;
  670. /* Reserved, set to 0. */
  671. };
  672. #ifdef CONFIG_SEC_DHA_SOL_MAL
  673. struct oem_dha_parm_send_t {
  674. uint32_t module_id;
  675. /* Unique ID of the module. */
  676. uint32_t param_id;
  677. /* Unique ID of the parameter. */
  678. uint16_t param_size;
  679. /* Size of the parameter in bytes: MOD_ENABLE_PARAM_LEN */
  680. uint16_t reserved;
  681. /* Reserved; set to 0. */
  682. uint16_t eq_mode;
  683. uint16_t select;
  684. int16_t param[12];
  685. } __packed;
  686. struct oem_dha_parm_send_cmd {
  687. struct apr_hdr hdr;
  688. #if !defined(CONFIG_MACH_S3VE3G_EUR) && !defined(CONFIG_MACH_MS01_EUR_3G) && !defined(CONFIG_MACH_MS01_EUR_LTE) && !defined(CONFIG_MACH_MS01_KOR_LTE) && !defined(CONFIG_DSDA_VIA_UART)
  689. uint32_t mem_handle;
  690. uint64_t mem_address;
  691. uint32_t mem_size;
  692. #endif
  693. struct oem_dha_parm_send_t dha_send;
  694. } __packed;
  695. #endif /* CONFIG_SEC_DHA_SOL_MAL*/
  696. /*
  697. * Event sent by the stream to the client that enables Rx DTMF
  698. * detection whenever DTMF is detected in the Rx path.
  699. *
  700. * The DTMF detection feature can only be used to detect DTMF
  701. * frequencies as listed in the vss_istream_evt_rx_dtmf_detected_t
  702. * structure.
  703. */
  704. #define VSS_ISTREAM_EVT_RX_DTMF_DETECTED (0x0001101A)
  705. struct vss_istream_cmd_set_rx_dtmf_detection {
  706. /*
  707. * Enables/disables Rx DTMF detection
  708. *
  709. * Possible values are
  710. * 0 - disable
  711. * 1 - enable
  712. *
  713. */
  714. uint32_t enable;
  715. };
  716. #define VSS_ISTREAM_CMD_SET_RX_DTMF_DETECTION (0x00011027)
  717. struct vss_istream_evt_rx_dtmf_detected {
  718. uint16_t low_freq;
  719. /*
  720. * Detected low frequency. Possible values:
  721. * 697 Hz
  722. * 770 Hz
  723. * 852 Hz
  724. * 941 Hz
  725. */
  726. uint16_t high_freq;
  727. /*
  728. * Detected high frequency. Possible values:
  729. * 1209 Hz
  730. * 1336 Hz
  731. * 1477 Hz
  732. * 1633 Hz
  733. */
  734. };
  735. struct cvs_set_rx_dtmf_detection_cmd {
  736. struct apr_hdr hdr;
  737. struct vss_istream_cmd_set_rx_dtmf_detection cvs_dtmf_det;
  738. } __packed;
  739. struct cvs_create_passive_ctl_session_cmd {
  740. struct apr_hdr hdr;
  741. struct vss_istream_cmd_create_passive_control_session_t cvs_session;
  742. } __packed;
  743. struct cvs_create_full_ctl_session_cmd {
  744. struct apr_hdr hdr;
  745. struct vss_istream_cmd_create_full_control_session_t cvs_session;
  746. } __packed;
  747. struct cvs_destroy_session_cmd {
  748. struct apr_hdr hdr;
  749. } __packed;
  750. struct cvs_set_mute_cmd {
  751. struct apr_hdr hdr;
  752. struct vss_ivolume_cmd_mute_v2_t cvs_set_mute;
  753. } __packed;
  754. struct cvs_set_media_type_cmd {
  755. struct apr_hdr hdr;
  756. struct vss_istream_cmd_set_media_type_t media_type;
  757. } __packed;
  758. struct cvs_send_dec_buf_cmd {
  759. struct apr_hdr hdr;
  760. struct vss_istream_evt_send_dec_buffer_t dec_buf;
  761. } __packed;
  762. struct cvs_set_amr_enc_rate_cmd {
  763. struct apr_hdr hdr;
  764. struct vss_istream_cmd_voc_amr_set_enc_rate_t amr_rate;
  765. } __packed;
  766. struct cvs_set_amrwb_enc_rate_cmd {
  767. struct apr_hdr hdr;
  768. struct vss_istream_cmd_voc_amrwb_set_enc_rate_t amrwb_rate;
  769. } __packed;
  770. struct cvs_set_cdma_enc_minmax_rate_cmd {
  771. struct apr_hdr hdr;
  772. struct vss_istream_cmd_cdma_set_enc_minmax_rate_t cdma_rate;
  773. } __packed;
  774. struct cvs_set_enc_dtx_mode_cmd {
  775. struct apr_hdr hdr;
  776. struct vss_istream_cmd_set_enc_dtx_mode_t dtx_mode;
  777. } __packed;
  778. struct cvs_register_cal_data_cmd {
  779. struct apr_hdr hdr;
  780. struct vss_istream_cmd_register_calibration_data_v2_t cvs_cal_data;
  781. } __packed;
  782. struct cvs_deregister_cal_data_cmd {
  783. struct apr_hdr hdr;
  784. } __packed;
  785. struct cvs_set_pp_enable_cmd {
  786. struct apr_hdr hdr;
  787. struct vss_icommon_cmd_set_ui_property_enable_t vss_set_pp;
  788. } __packed;
  789. struct cvs_start_record_cmd {
  790. struct apr_hdr hdr;
  791. struct vss_irecord_cmd_start_t rec_mode;
  792. } __packed;
  793. struct cvs_start_playback_cmd {
  794. struct apr_hdr hdr;
  795. struct vss_iplayback_cmd_start_t playback_mode;
  796. } __packed;
  797. struct cvs_dec_buffer_ready_cmd {
  798. struct apr_hdr hdr;
  799. } __packed;
  800. struct cvs_enc_buffer_consumed_cmd {
  801. struct apr_hdr hdr;
  802. } __packed;
  803. struct cvs_set_loopback_enable_cmd {
  804. struct apr_hdr hdr;
  805. uint32_t mem_handle;
  806. uint64_t mem_address;
  807. uint32_t mem_size;
  808. struct vss_icommon_cmd_set_loopback_enable_t vss_set_loopback;
  809. } __packed;
  810. struct vss_istream_cmd_set_oob_packet_exchange_config_t {
  811. struct apr_hdr hdr;
  812. uint32_t mem_handle;
  813. uint64_t enc_buf_addr;
  814. uint32_t enc_buf_size;
  815. uint64_t dec_buf_addr;
  816. uint32_t dec_buf_size;
  817. } __packed;
  818. struct vss_istream_cmd_set_packet_exchange_mode_t {
  819. struct apr_hdr hdr;
  820. uint32_t mode;
  821. } __packed;
  822. /* TO CVP commands */
  823. #define VSS_IVOCPROC_CMD_CREATE_FULL_CONTROL_SESSION 0x000100C3
  824. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  825. #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
  826. #define VSS_IVOCPROC_CMD_SET_DEVICE_V2 0x000112C6
  827. #define VSS_IVOCPROC_CMD_SET_VP3_DATA 0x000110EB
  828. #define VSS_IVOLUME_CMD_SET_STEP 0x000112C2
  829. #define VSS_IVOCPROC_CMD_ENABLE 0x000100C6
  830. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  831. #define VSS_IVOCPROC_CMD_DISABLE 0x000110E1
  832. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  833. /*
  834. * Registers the memory that contains device specific configuration data with
  835. * the vocproc. The client must register device configuration data with the
  836. * vocproc that corresponds with the device being set on the vocproc.
  837. */
  838. #define VSS_IVOCPROC_CMD_REGISTER_DEVICE_CONFIG 0x00011371
  839. /*
  840. * Deregisters the memory that holds device configuration data from the
  841. vocproc.
  842. */
  843. #define VSS_IVOCPROC_CMD_DEREGISTER_DEVICE_CONFIG 0x00011372
  844. #define VSS_IVOCPROC_CMD_REGISTER_CALIBRATION_DATA_V2 0x00011373
  845. #define VSS_IVOCPROC_CMD_DEREGISTER_CALIBRATION_DATA 0x00011276
  846. #define VSS_IVOCPROC_CMD_REGISTER_VOL_CALIBRATION_DATA 0x00011374
  847. #define VSS_IVOCPROC_CMD_DEREGISTER_VOL_CALIBRATION_DATA 0x00011375
  848. #define VSS_IVOCPROC_TOPOLOGY_ID_NONE 0x00010F70
  849. #define VSS_IVOCPROC_TOPOLOGY_ID_TX_SM_ECNS 0x00010F71
  850. #define VSS_IVOCPROC_TOPOLOGY_ID_TX_DM_FLUENCE 0x00010F72
  851. #define VSS_IVOCPROC_TOPOLOGY_ID_RX_DEFAULT 0x00010F77
  852. /* Newtwork IDs */
  853. #define VSS_ICOMMON_CAL_NETWORK_ID_NONE 0x0001135E
  854. /* Select internal mixing mode. */
  855. #define VSS_IVOCPROC_VOCPROC_MODE_EC_INT_MIXING 0x00010F7C
  856. /* Select external mixing mode. */
  857. #define VSS_IVOCPROC_VOCPROC_MODE_EC_EXT_MIXING 0x00010F7D
  858. /* Default AFE port ID. Applicable to Tx and Rx. */
  859. #define VSS_IVOCPROC_PORT_ID_NONE 0xFFFF
  860. #define VSS_NETWORK_ID_DEFAULT 0x00010037
  861. #define VSS_NETWORK_ID_VOIP_NB 0x00011240
  862. #define VSS_NETWORK_ID_VOIP_WB 0x00011241
  863. #define VSS_NETWORK_ID_VOIP_WV 0x00011242
  864. /* Media types */
  865. #define VSS_MEDIA_ID_EVRC_MODEM 0x00010FC2
  866. /* 80-VF690-47 CDMA enhanced variable rate vocoder modem format. */
  867. #define VSS_MEDIA_ID_AMR_NB_MODEM 0x00010FC6
  868. /* 80-VF690-47 UMTS AMR-NB vocoder modem format. */
  869. #define VSS_MEDIA_ID_AMR_WB_MODEM 0x00010FC7
  870. /* 80-VF690-47 UMTS AMR-WB vocoder modem format. */
  871. #define VSS_MEDIA_ID_PCM_NB 0x00010FCB
  872. #define VSS_MEDIA_ID_PCM_WB 0x00010FCC
  873. /* Linear PCM (16-bit, little-endian). */
  874. #define VSS_MEDIA_ID_G711_ALAW 0x00010FCD
  875. /* G.711 a-law (contains two 10ms vocoder frames). */
  876. #define VSS_MEDIA_ID_G711_MULAW 0x00010FCE
  877. /* G.711 mu-law (contains two 10ms vocoder frames). */
  878. #define VSS_MEDIA_ID_G729 0x00010FD0
  879. /* G.729AB (contains two 10ms vocoder frames. */
  880. #define VSS_MEDIA_ID_4GV_NB_MODEM 0x00010FC3
  881. /*CDMA EVRC-B vocoder modem format */
  882. #define VSS_MEDIA_ID_4GV_WB_MODEM 0x00010FC4
  883. /*CDMA EVRC-WB vocoder modem format */
  884. #define VSS_MEDIA_ID_4GV_NW_MODEM 0x00010FC5
  885. /*CDMA EVRC-NW vocoder modem format */
  886. #define VSS_IVOCPROC_CMD_CREATE_FULL_CONTROL_SESSION_V2 0x000112BF
  887. struct vss_ivocproc_cmd_create_full_control_session_v2_t {
  888. uint16_t direction;
  889. /*
  890. * Vocproc direction. The supported values:
  891. * VSS_IVOCPROC_DIRECTION_RX
  892. * VSS_IVOCPROC_DIRECTION_TX
  893. * VSS_IVOCPROC_DIRECTION_RX_TX
  894. */
  895. uint16_t tx_port_id;
  896. /*
  897. * Tx device port ID to which the vocproc connects. If a port ID is
  898. * not being supplied, set this to #VSS_IVOCPROC_PORT_ID_NONE.
  899. */
  900. uint32_t tx_topology_id;
  901. /*
  902. * Tx path topology ID. If a topology ID is not being supplied, set
  903. * this to #VSS_IVOCPROC_TOPOLOGY_ID_NONE.
  904. */
  905. uint16_t rx_port_id;
  906. /*
  907. * Rx device port ID to which the vocproc connects. If a port ID is
  908. * not being supplied, set this to #VSS_IVOCPROC_PORT_ID_NONE.
  909. */
  910. uint32_t rx_topology_id;
  911. /*
  912. * Rx path topology ID. If a topology ID is not being supplied, set
  913. * this to #VSS_IVOCPROC_TOPOLOGY_ID_NONE.
  914. */
  915. uint32_t profile_id;
  916. /* Voice calibration profile ID. */
  917. uint32_t vocproc_mode;
  918. /*
  919. * Vocproc mode. The supported values:
  920. * VSS_IVOCPROC_VOCPROC_MODE_EC_INT_MIXING
  921. * VSS_IVOCPROC_VOCPROC_MODE_EC_EXT_MIXING
  922. */
  923. uint16_t ec_ref_port_id;
  924. /*
  925. * Port ID to which the vocproc connects for receiving echo
  926. * cancellation reference signal. If a port ID is not being supplied,
  927. * set this to #VSS_IVOCPROC_PORT_ID_NONE. This parameter value is
  928. * ignored when the vocproc_mode parameter is set to
  929. * VSS_IVOCPROC_VOCPROC_MODE_EC_INT_MIXING.
  930. */
  931. char name[SESSION_NAME_LEN];
  932. /*
  933. * Session name string used to identify a session that can be shared
  934. * with passive controllers (optional). The string size, including the
  935. * NULL termination character, is limited to 31 characters.
  936. */
  937. } __packed;
  938. struct vss_ivocproc_cmd_set_volume_index_t {
  939. uint16_t vol_index;
  940. /*
  941. * Volume index utilized by the vocproc to index into the volume table
  942. * provided in VSS_IVOCPROC_CMD_CACHE_VOLUME_CALIBRATION_TABLE and set
  943. * volume on the VDSP.
  944. */
  945. } __packed;
  946. struct vss_ivolume_cmd_set_step_t {
  947. uint16_t direction;
  948. /*
  949. * The direction field sets the direction to apply the volume command.
  950. * The supported values:
  951. * #VSS_IVOLUME_DIRECTION_RX
  952. */
  953. uint32_t value;
  954. /*
  955. * Volume step used to find the corresponding linear volume and
  956. * the best match index in the registered volume calibration table.
  957. */
  958. uint16_t ramp_duration_ms;
  959. /*
  960. * Volume change ramp duration in milliseconds.
  961. * The supported values: 0 to 5000.
  962. */
  963. } __packed;
  964. struct vss_ivocproc_cmd_set_device_v2_t {
  965. uint16_t tx_port_id;
  966. /*
  967. * TX device port ID which vocproc will connect to.
  968. * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port.
  969. */
  970. uint32_t tx_topology_id;
  971. /*
  972. * TX leg topology ID.
  973. * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any
  974. * pre/post-processing blocks and is pass-through.
  975. */
  976. uint16_t rx_port_id;
  977. /*
  978. * RX device port ID which vocproc will connect to.
  979. * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port.
  980. */
  981. uint32_t rx_topology_id;
  982. /*
  983. * RX leg topology ID.
  984. * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any
  985. * pre/post-processing blocks and is pass-through.
  986. */
  987. uint32_t vocproc_mode;
  988. /* Vocproc mode. The supported values:
  989. * VSS_IVOCPROC_VOCPROC_MODE_EC_INT_MIXING - 0x00010F7C
  990. * VSS_IVOCPROC_VOCPROC_MODE_EC_EXT_MIXING - 0x00010F7D
  991. */
  992. uint16_t ec_ref_port_id;
  993. /* Port ID to which the vocproc connects for receiving
  994. * echo
  995. */
  996. } __packed;
  997. struct vss_ivocproc_cmd_register_device_config_t {
  998. uint32_t mem_handle;
  999. /*
  1000. * Handle to the shared memory that holds the per-network calibration
  1001. * data.
  1002. */
  1003. uint64_t mem_address;
  1004. /* Location of calibration data. */
  1005. uint32_t mem_size;
  1006. /* Size of the calibration data in bytes. */
  1007. } __packed;
  1008. struct vss_ivocproc_cmd_register_calibration_data_v2_t {
  1009. uint32_t cal_mem_handle;
  1010. /*
  1011. * Handle to the shared memory that holds the per-network calibration
  1012. * data.
  1013. */
  1014. uint64_t cal_mem_address;
  1015. /* Location of calibration data. */
  1016. uint32_t cal_mem_size;
  1017. /* Size of the calibration data in bytes. */
  1018. uint8_t column_info[MAX_COL_INFO_SIZE];
  1019. /*
  1020. * Column info contains the number of columns and the array of columns
  1021. * in the calibration table. The order in which the columns are provided
  1022. * here must match the order in which they exist in the calibration
  1023. * table provided.
  1024. */
  1025. } __packed;
  1026. struct vss_ivocproc_cmd_register_volume_cal_data_t {
  1027. uint32_t cal_mem_handle;
  1028. /*
  1029. * Handle to the shared memory that holds the volume calibration
  1030. * data.
  1031. */
  1032. uint64_t cal_mem_address;
  1033. /* Location of volume calibration data. */
  1034. uint32_t cal_mem_size;
  1035. /* Size of the volume calibration data in bytes. */
  1036. uint8_t column_info[MAX_COL_INFO_SIZE];
  1037. /*
  1038. * Column info contains the number of columns and the array of columns
  1039. * in the calibration table. The order in which the columns are provided
  1040. * here must match the order in which they exist in the calibration
  1041. * table provided.
  1042. */
  1043. } __packed;
  1044. struct cvp_create_full_ctl_session_cmd {
  1045. struct apr_hdr hdr;
  1046. struct vss_ivocproc_cmd_create_full_control_session_v2_t cvp_session;
  1047. } __packed;
  1048. struct cvp_command {
  1049. struct apr_hdr hdr;
  1050. } __packed;
  1051. struct cvp_set_device_cmd {
  1052. struct apr_hdr hdr;
  1053. struct vss_ivocproc_cmd_set_device_v2_t cvp_set_device_v2;
  1054. } __packed;
  1055. struct cvp_set_vp3_data_cmd {
  1056. struct apr_hdr hdr;
  1057. } __packed;
  1058. struct cvp_set_rx_volume_index_cmd {
  1059. struct apr_hdr hdr;
  1060. struct vss_ivocproc_cmd_set_volume_index_t cvp_set_vol_idx;
  1061. } __packed;
  1062. struct cvp_set_rx_volume_step_cmd {
  1063. struct apr_hdr hdr;
  1064. struct vss_ivolume_cmd_set_step_t cvp_set_vol_step;
  1065. } __packed;
  1066. struct cvp_register_dev_cfg_cmd {
  1067. struct apr_hdr hdr;
  1068. struct vss_ivocproc_cmd_register_device_config_t cvp_dev_cfg_data;
  1069. } __packed;
  1070. struct cvp_deregister_dev_cfg_cmd {
  1071. struct apr_hdr hdr;
  1072. } __packed;
  1073. struct cvp_register_cal_data_cmd {
  1074. struct apr_hdr hdr;
  1075. struct vss_ivocproc_cmd_register_calibration_data_v2_t cvp_cal_data;
  1076. } __packed;
  1077. struct cvp_deregister_cal_data_cmd {
  1078. struct apr_hdr hdr;
  1079. } __packed;
  1080. struct cvp_register_vol_cal_data_cmd {
  1081. struct apr_hdr hdr;
  1082. struct vss_ivocproc_cmd_register_volume_cal_data_t cvp_vol_cal_data;
  1083. } __packed;
  1084. struct cvp_deregister_vol_cal_data_cmd {
  1085. struct apr_hdr hdr;
  1086. } __packed;
  1087. struct cvp_set_mute_cmd {
  1088. struct apr_hdr hdr;
  1089. struct vss_ivolume_cmd_mute_v2_t cvp_set_mute;
  1090. } __packed;
  1091. /* CB for up-link packets. */
  1092. typedef void (*ul_cb_fn)(uint8_t *voc_pkt,
  1093. uint32_t pkt_len,
  1094. uint32_t timestamp,
  1095. void *private_data);
  1096. /* CB for down-link packets. */
  1097. typedef void (*dl_cb_fn)(uint8_t *voc_pkt,
  1098. void *private_data);
  1099. /* CB for DTMF RX Detection */
  1100. typedef void (*dtmf_rx_det_cb_fn)(uint8_t *pkt,
  1101. char *session,
  1102. void *private_data);
  1103. typedef void (*voip_ssr_cb) (uint32_t opcode,
  1104. void *private_data);
  1105. struct mvs_driver_info {
  1106. uint32_t media_type;
  1107. uint32_t rate;
  1108. uint32_t network_type;
  1109. uint32_t dtx_mode;
  1110. ul_cb_fn ul_cb;
  1111. dl_cb_fn dl_cb;
  1112. voip_ssr_cb ssr_cb;
  1113. void *private_data;
  1114. uint32_t evrc_min_rate;
  1115. uint32_t evrc_max_rate;
  1116. };
  1117. struct dtmf_driver_info {
  1118. dtmf_rx_det_cb_fn dtmf_rx_ul_cb;
  1119. void *private_data;
  1120. };
  1121. struct incall_rec_info {
  1122. uint32_t rec_enable;
  1123. uint32_t rec_mode;
  1124. uint32_t recording;
  1125. };
  1126. struct incall_music_info {
  1127. uint32_t play_enable;
  1128. uint32_t playing;
  1129. int count;
  1130. int force;
  1131. uint16_t port_id;
  1132. };
  1133. struct share_memory_info {
  1134. u32 mem_handle;
  1135. struct share_mem_buf sh_buf;
  1136. struct mem_map_table memtbl;
  1137. };
  1138. struct voice_data {
  1139. int voc_state;/*INIT, CHANGE, RELEASE, RUN */
  1140. /* Shared mem to store decoder and encoder packets */
  1141. struct share_memory_info shmem_info;
  1142. wait_queue_head_t mvm_wait;
  1143. wait_queue_head_t cvs_wait;
  1144. wait_queue_head_t cvp_wait;
  1145. /* Cache the values related to Rx and Tx devices */
  1146. struct device_data dev_rx;
  1147. struct device_data dev_tx;
  1148. /* Cache the values related to Rx and Tx streams */
  1149. struct stream_data stream_rx;
  1150. struct stream_data stream_tx;
  1151. u32 mvm_state;
  1152. u32 cvs_state;
  1153. u32 cvp_state;
  1154. /* Handle to MVM in the Q6 */
  1155. u16 mvm_handle;
  1156. /* Handle to CVS in the Q6 */
  1157. u16 cvs_handle;
  1158. /* Handle to CVP in the Q6 */
  1159. u16 cvp_handle;
  1160. struct mutex lock;
  1161. uint16_t sidetone_gain;
  1162. uint8_t tty_mode;
  1163. /* slowtalk enable value */
  1164. uint32_t st_enable;
  1165. uint32_t dtmf_rx_detect_en;
  1166. /* Local Call Hold mode */
  1167. uint8_t lch_mode;
  1168. struct voice_dev_route_state voc_route_state;
  1169. u32 session_id;
  1170. struct incall_rec_info rec_info;
  1171. struct incall_music_info music_info;
  1172. struct voice_rec_route_state rec_route_state;
  1173. #ifdef CONFIG_SEC_DHA_SOL_MAL
  1174. struct voice_dha_data sec_dha_data;
  1175. #endif /* CONFIG_SEC_DHA_SOL_MAL */
  1176. };
  1177. struct cal_mem {
  1178. struct ion_handle *handle;
  1179. uint32_t phy;
  1180. void *buf;
  1181. };
  1182. #define MAX_VOC_SESSIONS 6
  1183. struct common_data {
  1184. /* these default values are for all devices */
  1185. uint32_t default_mute_val;
  1186. uint32_t default_sample_val;
  1187. uint32_t default_vol_step_val;
  1188. uint32_t default_vol_ramp_duration_ms;
  1189. uint32_t default_mute_ramp_duration_ms;
  1190. bool ec_ref_ext;
  1191. uint16_t ec_port_id;
  1192. /* APR to MVM in the Q6 */
  1193. void *apr_q6_mvm;
  1194. /* APR to CVS in the Q6 */
  1195. void *apr_q6_cvs;
  1196. /* APR to CVP in the Q6 */
  1197. void *apr_q6_cvp;
  1198. struct mem_map_table cal_mem_map_table;
  1199. uint32_t cal_mem_handle;
  1200. struct mem_map_table rtac_mem_map_table;
  1201. uint32_t rtac_mem_handle;
  1202. struct cal_mem cvp_cal;
  1203. struct cal_mem cvs_cal;
  1204. struct mutex common_lock;
  1205. struct mvs_driver_info mvs_info;
  1206. struct dtmf_driver_info dtmf_info;
  1207. struct voice_data voice[MAX_VOC_SESSIONS];
  1208. bool srvcc_rec_flag;
  1209. };
  1210. struct voice_session_itr {
  1211. int cur_idx;
  1212. int session_idx;
  1213. };
  1214. void voc_register_mvs_cb(ul_cb_fn ul_cb,
  1215. dl_cb_fn dl_cb,
  1216. voip_ssr_cb ssr_cb,
  1217. void *private_data);
  1218. void voc_register_dtmf_rx_detection_cb(dtmf_rx_det_cb_fn dtmf_rx_ul_cb,
  1219. void *private_data);
  1220. void voc_config_vocoder(uint32_t media_type,
  1221. uint32_t rate,
  1222. uint32_t network_type,
  1223. uint32_t dtx_mode,
  1224. uint32_t evrc_min_rate,
  1225. uint32_t evrc_max_rate);
  1226. enum {
  1227. DEV_RX = 0,
  1228. DEV_TX,
  1229. };
  1230. enum {
  1231. RX_PATH = 0,
  1232. TX_PATH,
  1233. };
  1234. #define VOC_PATH_PASSIVE 0
  1235. #define VOC_PATH_FULL 1
  1236. #define VOC_PATH_VOLTE_PASSIVE 2
  1237. #define VOC_PATH_VOICE2_PASSIVE 3
  1238. #define VOC_PATH_QCHAT_PASSIVE 4
  1239. #define VOC_PATH_VOWLAN_PASSIVE 5
  1240. #define MAX_SESSION_NAME_LEN 32
  1241. #define VOICE_SESSION_NAME "Voice session"
  1242. #define VOIP_SESSION_NAME "VoIP session"
  1243. #define VOLTE_SESSION_NAME "VoLTE session"
  1244. #define VOICE2_SESSION_NAME "Voice2 session"
  1245. #define QCHAT_SESSION_NAME "QCHAT session"
  1246. #define VOWLAN_SESSION_NAME "VoWLAN session"
  1247. #define VOICE2_SESSION_VSID_STR "10DC1000"
  1248. #define QCHAT_SESSION_VSID_STR "10803000"
  1249. #define VOWLAN_SESSION_VSID_STR "10002000"
  1250. #define VOICE_SESSION_VSID 0x10C01000
  1251. #define VOICE2_SESSION_VSID 0x10DC1000
  1252. #define VOLTE_SESSION_VSID 0x10C02000
  1253. #define VOIP_SESSION_VSID 0x10004000
  1254. #define QCHAT_SESSION_VSID 0x10803000
  1255. #define VOWLAN_SESSION_VSID 0x10002000
  1256. #define ALL_SESSION_VSID 0xFFFFFFFF
  1257. #define VSID_MAX ALL_SESSION_VSID
  1258. #ifdef CONFIG_SEC_DHA_SOL_MAL
  1259. int voice_sec_set_dha_data(uint32_t session_id, short mode,
  1260. short select, short *parameters);
  1261. #endif /* CONFIG_SEC_DHA_SOL_MAL*/
  1262. #define APP_ID_MASK 0x3F000
  1263. #define APP_ID_SHIFT 12
  1264. enum vsid_app_type {
  1265. VSID_APP_NONE = 0,
  1266. VSID_APP_CS_VOICE = 1,
  1267. VSID_APP_IMS = 2, /* IMS voice services covering VoLTE etc */
  1268. VSID_APP_QCHAT = 3,
  1269. VSID_APP_VOIP = 4, /* VoIP on AP HLOS without modem processor */
  1270. VSID_APP_MAX,
  1271. };
  1272. /* called by alsa driver */
  1273. int voc_set_pp_enable(uint32_t session_id, uint32_t module_id,
  1274. uint32_t enable);
  1275. int voc_get_pp_enable(uint32_t session_id, uint32_t module_id);
  1276. uint8_t voc_get_tty_mode(uint32_t session_id);
  1277. int voc_set_tty_mode(uint32_t session_id, uint8_t tty_mode);
  1278. int voc_start_voice_call(uint32_t session_id);
  1279. int voc_end_voice_call(uint32_t session_id);
  1280. int voc_standby_voice_call(uint32_t session_id);
  1281. int voc_resume_voice_call(uint32_t session_id);
  1282. int voc_set_lch(uint32_t session_id, enum voice_lch_mode lch_mode);
  1283. int voc_set_rxtx_port(uint32_t session_id,
  1284. uint32_t dev_port_id,
  1285. uint32_t dev_type);
  1286. int voc_set_rx_vol_step(uint32_t session_id, uint32_t dir, uint32_t vol_step,
  1287. uint32_t ramp_duration);
  1288. int voc_set_tx_mute(uint32_t session_id, uint32_t dir, uint32_t mute,
  1289. uint32_t ramp_duration);
  1290. int voc_set_device_mute(uint32_t session_id, uint32_t dir, uint32_t mute,
  1291. uint32_t ramp_duration);
  1292. int voc_get_rx_device_mute(uint32_t session_id);
  1293. int voc_set_route_flag(uint32_t session_id, uint8_t path_dir, uint8_t set);
  1294. uint8_t voc_get_route_flag(uint32_t session_id, uint8_t path_dir);
  1295. int voc_enable_dtmf_rx_detection(uint32_t session_id, uint32_t enable);
  1296. void voc_disable_dtmf_det_on_active_sessions(void);
  1297. int voc_alloc_cal_shared_memory(void);
  1298. int voc_alloc_voip_shared_memory(void);
  1299. int is_voc_initialized(void);
  1300. int voc_register_vocproc_vol_table(void);
  1301. int voc_deregister_vocproc_vol_table(void);
  1302. int voc_unmap_cal_blocks(void);
  1303. int voc_map_rtac_block(struct rtac_cal_block_data *cal_block);
  1304. int voc_unmap_rtac_block(uint32_t *mem_map_handle);
  1305. uint32_t voc_get_session_id(char *name);
  1306. int voc_start_playback(uint32_t set, uint16_t port_id);
  1307. int voc_start_record(uint32_t port_id, uint32_t set, uint32_t session_id);
  1308. int voice_get_idx_for_session(u32 session_id);
  1309. int voc_set_ext_ec_ref(uint16_t port_id, bool state);
  1310. int voc_update_amr_vocoder_rate(uint32_t session_id);
  1311. int voc_disable_device(uint32_t session_id);
  1312. int voc_enable_device(uint32_t session_id);
  1313. int voc_get_loopback_enable(void);
  1314. void voc_set_loopback_enable(int loopback_enable);
  1315. int voc_get_roaming_enable(void);
  1316. void voc_set_roaming_enable(int loopback_enable);
  1317. #endif