q6voice.h 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562
  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. #define VSS_IRECORD_TAP_POINT_NONE 0x00010F78
  435. /* Indicates no tapping for specified path. */
  436. #define VSS_IRECORD_TAP_POINT_STREAM_END 0x00010F79
  437. /* Indicates that specified path should be tapped at the end of the stream. */
  438. #define VSS_IRECORD_MODE_TX_RX_STEREO 0x00010F7A
  439. /* Select Tx on left channel and Rx on right channel. */
  440. #define VSS_IRECORD_MODE_TX_RX_MIXING 0x00010F7B
  441. /* Select mixed Tx and Rx paths. */
  442. #define VSS_ISTREAM_EVT_NOT_READY 0x000110FD
  443. #define VSS_ISTREAM_EVT_READY 0x000110FC
  444. #define VSS_ISTREAM_EVT_OOB_NOTIFY_DEC_BUFFER_READY 0x0001136F
  445. /*notify dsp that decoder buffer is ready*/
  446. #define VSS_ISTREAM_EVT_OOB_NOTIFY_ENC_BUFFER_READY 0x0001136C
  447. /*dsp notifying client that encoder buffer is ready*/
  448. #define VSS_ISTREAM_EVT_OOB_NOTIFY_ENC_BUFFER_CONSUMED 0x0001136D
  449. /*notify dsp that encoder buffer is consumed*/
  450. #define VSS_ISTREAM_CMD_SET_OOB_PACKET_EXCHANGE_CONFIG 0x0001136B
  451. #define VSS_ISTREAM_PACKET_EXCHANGE_MODE_INBAND 0
  452. /* In-band packet exchange mode. */
  453. #define VSS_ISTREAM_PACKET_EXCHANGE_MODE_OUT_OF_BAND 1
  454. /* Out-of-band packet exchange mode. */
  455. #define VSS_ISTREAM_CMD_SET_PACKET_EXCHANGE_MODE 0x0001136A
  456. struct vss_iplayback_cmd_start_t {
  457. uint16_t port_id;
  458. /*
  459. * AFE Port ID from which the audio samples are available.
  460. * To use the default AFE pseudo port (0x8005), set this value to
  461. * #VSS_IPLAYBACK_PORT_ID_DEFAULT.
  462. */
  463. } __packed;
  464. struct vss_irecord_cmd_start_t {
  465. uint32_t rx_tap_point;
  466. /* Tap point to use on the Rx path. Supported values are:
  467. * VSS_IRECORD_TAP_POINT_NONE : Do not record Rx path.
  468. * VSS_IRECORD_TAP_POINT_STREAM_END : Rx tap point is at the end of
  469. * the stream.
  470. */
  471. uint32_t tx_tap_point;
  472. /* Tap point to use on the Tx path. Supported values are:
  473. * VSS_IRECORD_TAP_POINT_NONE : Do not record tx path.
  474. * VSS_IRECORD_TAP_POINT_STREAM_END : Tx tap point is at the end of
  475. * the stream.
  476. */
  477. uint16_t port_id;
  478. /* AFE Port ID to whcih the conversation recording stream needs to be
  479. * sent. Set this to #VSS_IRECORD_PORT_ID_DEFAULT to use default AFE
  480. * pseudo ports (0x8003 for Rx and 0x8004 for Tx).
  481. */
  482. uint32_t mode;
  483. /* Recording Mode. The mode parameter value is ignored if the port_id
  484. * is set to #VSS_IRECORD_PORT_ID_DEFAULT.
  485. * The supported values:
  486. * #VSS_IRECORD_MODE_TX_RX_STEREO
  487. * #VSS_IRECORD_MODE_TX_RX_MIXING
  488. */
  489. } __packed;
  490. struct vss_istream_cmd_create_passive_control_session_t {
  491. char name[SESSION_NAME_LEN];
  492. /**<
  493. * A variable-sized stream name.
  494. *
  495. * The stream name size is the payload size minus the size of the other
  496. * fields.
  497. */
  498. } __packed;
  499. #define VSS_IVOLUME_DIRECTION_TX 0
  500. #define VSS_IVOLUME_DIRECTION_RX 1
  501. #define VSS_IVOLUME_MUTE_OFF 0
  502. #define VSS_IVOLUME_MUTE_ON 1
  503. #define DEFAULT_MUTE_RAMP_DURATION 500
  504. #define DEFAULT_VOLUME_RAMP_DURATION 20
  505. #define MAX_RAMP_DURATION 5000
  506. struct vss_ivolume_cmd_mute_v2_t {
  507. uint16_t direction;
  508. /*
  509. * The direction field sets the direction to apply the mute command.
  510. * The Supported values:
  511. * VSS_IVOLUME_DIRECTION_TX
  512. * VSS_IVOLUME_DIRECTION_RX
  513. */
  514. uint16_t mute_flag;
  515. /*
  516. * Turn mute on or off. The Supported values:
  517. * VSS_IVOLUME_MUTE_OFF
  518. * VSS_IVOLUME_MUTE_ON
  519. */
  520. uint16_t ramp_duration_ms;
  521. /*
  522. * Mute change ramp duration in milliseconds.
  523. * The Supported values: 0 to 5000.
  524. */
  525. } __packed;
  526. struct vss_istream_cmd_create_full_control_session_t {
  527. uint16_t direction;
  528. /*
  529. * Stream direction.
  530. *
  531. * 0 : TX only
  532. * 1 : RX only
  533. * 2 : TX and RX
  534. * 3 : TX and RX loopback
  535. */
  536. uint32_t enc_media_type;
  537. /* Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  538. uint32_t dec_media_type;
  539. /* Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  540. uint32_t network_id;
  541. /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */
  542. char name[SESSION_NAME_LEN];
  543. /*
  544. * A variable-sized stream name.
  545. *
  546. * The stream name size is the payload size minus the size of the other
  547. * fields.
  548. */
  549. } __packed;
  550. struct vss_istream_cmd_set_media_type_t {
  551. uint32_t rx_media_id;
  552. /* Set the Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  553. uint32_t tx_media_id;
  554. /* Set the Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  555. } __packed;
  556. struct vss_istream_evt_send_enc_buffer_t {
  557. uint32_t media_id;
  558. /* Media ID of the packet. */
  559. uint8_t packet_data[MAX_VOC_PKT_SIZE];
  560. /* Packet data buffer. */
  561. } __packed;
  562. struct vss_istream_evt_send_dec_buffer_t {
  563. uint32_t media_id;
  564. /* Media ID of the packet. */
  565. uint8_t packet_data[MAX_VOC_PKT_SIZE];
  566. /* Packet data. */
  567. } __packed;
  568. struct vss_istream_cmd_voc_amr_set_enc_rate_t {
  569. uint32_t mode;
  570. /* Set the AMR encoder rate.
  571. *
  572. * 0x00000000 : 4.75 kbps
  573. * 0x00000001 : 5.15 kbps
  574. * 0x00000002 : 5.90 kbps
  575. * 0x00000003 : 6.70 kbps
  576. * 0x00000004 : 7.40 kbps
  577. * 0x00000005 : 7.95 kbps
  578. * 0x00000006 : 10.2 kbps
  579. * 0x00000007 : 12.2 kbps
  580. */
  581. } __packed;
  582. struct vss_istream_cmd_voc_amrwb_set_enc_rate_t {
  583. uint32_t mode;
  584. /* Set the AMR-WB encoder rate.
  585. *
  586. * 0x00000000 : 6.60 kbps
  587. * 0x00000001 : 8.85 kbps
  588. * 0x00000002 : 12.65 kbps
  589. * 0x00000003 : 14.25 kbps
  590. * 0x00000004 : 15.85 kbps
  591. * 0x00000005 : 18.25 kbps
  592. * 0x00000006 : 19.85 kbps
  593. * 0x00000007 : 23.05 kbps
  594. * 0x00000008 : 23.85 kbps
  595. */
  596. } __packed;
  597. struct vss_istream_cmd_cdma_set_enc_minmax_rate_t {
  598. uint16_t min_rate;
  599. /* Set the lower bound encoder rate.
  600. *
  601. * 0x0000 : Blank frame
  602. * 0x0001 : Eighth rate
  603. * 0x0002 : Quarter rate
  604. * 0x0003 : Half rate
  605. * 0x0004 : Full rate
  606. */
  607. uint16_t max_rate;
  608. /* Set the upper bound encoder rate.
  609. *
  610. * 0x0000 : Blank frame
  611. * 0x0001 : Eighth rate
  612. * 0x0002 : Quarter rate
  613. * 0x0003 : Half rate
  614. * 0x0004 : Full rate
  615. */
  616. } __packed;
  617. struct vss_istream_cmd_set_enc_dtx_mode_t {
  618. uint32_t enable;
  619. /* Toggle DTX on or off.
  620. *
  621. * 0 : Disables DTX
  622. * 1 : Enables DTX
  623. */
  624. } __packed;
  625. struct vss_istream_cmd_register_calibration_data_v2_t {
  626. uint32_t cal_mem_handle;
  627. /* Handle to the shared memory that holds the calibration data. */
  628. uint64_t cal_mem_address;
  629. /* Location of calibration data. */
  630. uint32_t cal_mem_size;
  631. /* Size of the calibration data in bytes. */
  632. uint8_t column_info[MAX_COL_INFO_SIZE];
  633. /*
  634. * Column info contains the number of columns and the array of columns
  635. * in the calibration table. The order in which the columns are provided
  636. * here must match the order in which they exist in the calibration
  637. * table provided.
  638. */
  639. } __packed;
  640. struct vss_icommon_cmd_set_ui_property_enable_t {
  641. uint32_t module_id;
  642. /* Unique ID of the module. */
  643. uint32_t param_id;
  644. /* Unique ID of the parameter. */
  645. uint16_t param_size;
  646. /* Size of the parameter in bytes: MOD_ENABLE_PARAM_LEN */
  647. uint16_t reserved;
  648. /* Reserved; set to 0. */
  649. uint16_t enable;
  650. uint16_t reserved_field;
  651. /* Reserved, set to 0. */
  652. };
  653. #define VOICE_MODULE_DHA 0x10001020
  654. #define VOICE_PARAM_DHA_DYNAMIC 0x10001022
  655. #define VOICEPROC_MODULE_VENC 0x00010F07
  656. #define VOICE_PARAM_LOOPBACK_ENABLE 0x00010E18
  657. struct vss_icommon_cmd_set_loopback_enable_t {
  658. uint32_t module_id;
  659. /* Unique ID of the module. */
  660. uint32_t param_id;
  661. /* Unique ID of the parameter. */
  662. uint16_t param_size;
  663. /* Size of the parameter in bytes: MOD_ENABLE_PARAM_LEN */
  664. uint16_t reserved;
  665. /* Reserved; set to 0. */
  666. uint16_t loopback_enable;
  667. uint16_t reserved_field;
  668. /* Reserved, set to 0. */
  669. };
  670. #ifdef CONFIG_SEC_DHA_SOL_MAL
  671. struct oem_dha_parm_send_t {
  672. uint32_t module_id;
  673. /* Unique ID of the module. */
  674. uint32_t param_id;
  675. /* Unique ID of the parameter. */
  676. uint16_t param_size;
  677. /* Size of the parameter in bytes: MOD_ENABLE_PARAM_LEN */
  678. uint16_t reserved;
  679. /* Reserved; set to 0. */
  680. uint16_t eq_mode;
  681. uint16_t select;
  682. int16_t param[12];
  683. } __packed;
  684. struct oem_dha_parm_send_cmd {
  685. struct apr_hdr hdr;
  686. #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)
  687. uint32_t mem_handle;
  688. uint64_t mem_address;
  689. uint32_t mem_size;
  690. #endif
  691. struct oem_dha_parm_send_t dha_send;
  692. } __packed;
  693. #endif /* CONFIG_SEC_DHA_SOL_MAL*/
  694. /*
  695. * Event sent by the stream to the client that enables Rx DTMF
  696. * detection whenever DTMF is detected in the Rx path.
  697. *
  698. * The DTMF detection feature can only be used to detect DTMF
  699. * frequencies as listed in the vss_istream_evt_rx_dtmf_detected_t
  700. * structure.
  701. */
  702. #define VSS_ISTREAM_EVT_RX_DTMF_DETECTED (0x0001101A)
  703. struct vss_istream_cmd_set_rx_dtmf_detection {
  704. /*
  705. * Enables/disables Rx DTMF detection
  706. *
  707. * Possible values are
  708. * 0 - disable
  709. * 1 - enable
  710. *
  711. */
  712. uint32_t enable;
  713. };
  714. #define VSS_ISTREAM_CMD_SET_RX_DTMF_DETECTION (0x00011027)
  715. struct vss_istream_evt_rx_dtmf_detected {
  716. uint16_t low_freq;
  717. /*
  718. * Detected low frequency. Possible values:
  719. * 697 Hz
  720. * 770 Hz
  721. * 852 Hz
  722. * 941 Hz
  723. */
  724. uint16_t high_freq;
  725. /*
  726. * Detected high frequency. Possible values:
  727. * 1209 Hz
  728. * 1336 Hz
  729. * 1477 Hz
  730. * 1633 Hz
  731. */
  732. };
  733. struct cvs_set_rx_dtmf_detection_cmd {
  734. struct apr_hdr hdr;
  735. struct vss_istream_cmd_set_rx_dtmf_detection cvs_dtmf_det;
  736. } __packed;
  737. struct cvs_create_passive_ctl_session_cmd {
  738. struct apr_hdr hdr;
  739. struct vss_istream_cmd_create_passive_control_session_t cvs_session;
  740. } __packed;
  741. struct cvs_create_full_ctl_session_cmd {
  742. struct apr_hdr hdr;
  743. struct vss_istream_cmd_create_full_control_session_t cvs_session;
  744. } __packed;
  745. struct cvs_destroy_session_cmd {
  746. struct apr_hdr hdr;
  747. } __packed;
  748. struct cvs_set_mute_cmd {
  749. struct apr_hdr hdr;
  750. struct vss_ivolume_cmd_mute_v2_t cvs_set_mute;
  751. } __packed;
  752. struct cvs_set_media_type_cmd {
  753. struct apr_hdr hdr;
  754. struct vss_istream_cmd_set_media_type_t media_type;
  755. } __packed;
  756. struct cvs_send_dec_buf_cmd {
  757. struct apr_hdr hdr;
  758. struct vss_istream_evt_send_dec_buffer_t dec_buf;
  759. } __packed;
  760. struct cvs_set_amr_enc_rate_cmd {
  761. struct apr_hdr hdr;
  762. struct vss_istream_cmd_voc_amr_set_enc_rate_t amr_rate;
  763. } __packed;
  764. struct cvs_set_amrwb_enc_rate_cmd {
  765. struct apr_hdr hdr;
  766. struct vss_istream_cmd_voc_amrwb_set_enc_rate_t amrwb_rate;
  767. } __packed;
  768. struct cvs_set_cdma_enc_minmax_rate_cmd {
  769. struct apr_hdr hdr;
  770. struct vss_istream_cmd_cdma_set_enc_minmax_rate_t cdma_rate;
  771. } __packed;
  772. struct cvs_set_enc_dtx_mode_cmd {
  773. struct apr_hdr hdr;
  774. struct vss_istream_cmd_set_enc_dtx_mode_t dtx_mode;
  775. } __packed;
  776. struct cvs_register_cal_data_cmd {
  777. struct apr_hdr hdr;
  778. struct vss_istream_cmd_register_calibration_data_v2_t cvs_cal_data;
  779. } __packed;
  780. struct cvs_deregister_cal_data_cmd {
  781. struct apr_hdr hdr;
  782. } __packed;
  783. struct cvs_set_pp_enable_cmd {
  784. struct apr_hdr hdr;
  785. struct vss_icommon_cmd_set_ui_property_enable_t vss_set_pp;
  786. } __packed;
  787. struct cvs_start_record_cmd {
  788. struct apr_hdr hdr;
  789. struct vss_irecord_cmd_start_t rec_mode;
  790. } __packed;
  791. struct cvs_start_playback_cmd {
  792. struct apr_hdr hdr;
  793. struct vss_iplayback_cmd_start_t playback_mode;
  794. } __packed;
  795. struct cvs_dec_buffer_ready_cmd {
  796. struct apr_hdr hdr;
  797. } __packed;
  798. struct cvs_enc_buffer_consumed_cmd {
  799. struct apr_hdr hdr;
  800. } __packed;
  801. struct cvs_set_loopback_enable_cmd {
  802. struct apr_hdr hdr;
  803. uint32_t mem_handle;
  804. uint64_t mem_address;
  805. uint32_t mem_size;
  806. struct vss_icommon_cmd_set_loopback_enable_t vss_set_loopback;
  807. } __packed;
  808. struct vss_istream_cmd_set_oob_packet_exchange_config_t {
  809. struct apr_hdr hdr;
  810. uint32_t mem_handle;
  811. uint64_t enc_buf_addr;
  812. uint32_t enc_buf_size;
  813. uint64_t dec_buf_addr;
  814. uint32_t dec_buf_size;
  815. } __packed;
  816. struct vss_istream_cmd_set_packet_exchange_mode_t {
  817. struct apr_hdr hdr;
  818. uint32_t mode;
  819. } __packed;
  820. /* TO CVP commands */
  821. #define VSS_IVOCPROC_CMD_CREATE_FULL_CONTROL_SESSION 0x000100C3
  822. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  823. #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
  824. #define VSS_IVOCPROC_CMD_SET_DEVICE_V2 0x000112C6
  825. #define VSS_IVOCPROC_CMD_SET_VP3_DATA 0x000110EB
  826. #define VSS_IVOLUME_CMD_SET_STEP 0x000112C2
  827. #define VSS_IVOCPROC_CMD_ENABLE 0x000100C6
  828. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  829. #define VSS_IVOCPROC_CMD_DISABLE 0x000110E1
  830. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  831. /*
  832. * Registers the memory that contains device specific configuration data with
  833. * the vocproc. The client must register device configuration data with the
  834. * vocproc that corresponds with the device being set on the vocproc.
  835. */
  836. #define VSS_IVOCPROC_CMD_REGISTER_DEVICE_CONFIG 0x00011371
  837. /*
  838. * Deregisters the memory that holds device configuration data from the
  839. vocproc.
  840. */
  841. #define VSS_IVOCPROC_CMD_DEREGISTER_DEVICE_CONFIG 0x00011372
  842. #define VSS_IVOCPROC_CMD_REGISTER_CALIBRATION_DATA_V2 0x00011373
  843. #define VSS_IVOCPROC_CMD_DEREGISTER_CALIBRATION_DATA 0x00011276
  844. #define VSS_IVOCPROC_CMD_REGISTER_VOL_CALIBRATION_DATA 0x00011374
  845. #define VSS_IVOCPROC_CMD_DEREGISTER_VOL_CALIBRATION_DATA 0x00011375
  846. #define VSS_IVOCPROC_TOPOLOGY_ID_NONE 0x00010F70
  847. #define VSS_IVOCPROC_TOPOLOGY_ID_TX_SM_ECNS 0x00010F71
  848. #define VSS_IVOCPROC_TOPOLOGY_ID_TX_DM_FLUENCE 0x00010F72
  849. #define VSS_IVOCPROC_TOPOLOGY_ID_RX_DEFAULT 0x00010F77
  850. /* Newtwork IDs */
  851. #define VSS_ICOMMON_CAL_NETWORK_ID_NONE 0x0001135E
  852. /* Select internal mixing mode. */
  853. #define VSS_IVOCPROC_VOCPROC_MODE_EC_INT_MIXING 0x00010F7C
  854. /* Select external mixing mode. */
  855. #define VSS_IVOCPROC_VOCPROC_MODE_EC_EXT_MIXING 0x00010F7D
  856. /* Default AFE port ID. Applicable to Tx and Rx. */
  857. #define VSS_IVOCPROC_PORT_ID_NONE 0xFFFF
  858. #define VSS_NETWORK_ID_DEFAULT 0x00010037
  859. #define VSS_NETWORK_ID_VOIP_NB 0x00011240
  860. #define VSS_NETWORK_ID_VOIP_WB 0x00011241
  861. #define VSS_NETWORK_ID_VOIP_WV 0x00011242
  862. /* Media types */
  863. #define VSS_MEDIA_ID_EVRC_MODEM 0x00010FC2
  864. /* 80-VF690-47 CDMA enhanced variable rate vocoder modem format. */
  865. #define VSS_MEDIA_ID_AMR_NB_MODEM 0x00010FC6
  866. /* 80-VF690-47 UMTS AMR-NB vocoder modem format. */
  867. #define VSS_MEDIA_ID_AMR_WB_MODEM 0x00010FC7
  868. /* 80-VF690-47 UMTS AMR-WB vocoder modem format. */
  869. #define VSS_MEDIA_ID_PCM_NB 0x00010FCB
  870. #define VSS_MEDIA_ID_PCM_WB 0x00010FCC
  871. /* Linear PCM (16-bit, little-endian). */
  872. #define VSS_MEDIA_ID_G711_ALAW 0x00010FCD
  873. /* G.711 a-law (contains two 10ms vocoder frames). */
  874. #define VSS_MEDIA_ID_G711_MULAW 0x00010FCE
  875. /* G.711 mu-law (contains two 10ms vocoder frames). */
  876. #define VSS_MEDIA_ID_G729 0x00010FD0
  877. /* G.729AB (contains two 10ms vocoder frames. */
  878. #define VSS_MEDIA_ID_4GV_NB_MODEM 0x00010FC3
  879. /*CDMA EVRC-B vocoder modem format */
  880. #define VSS_MEDIA_ID_4GV_WB_MODEM 0x00010FC4
  881. /*CDMA EVRC-WB vocoder modem format */
  882. #define VSS_MEDIA_ID_4GV_NW_MODEM 0x00010FC5
  883. /*CDMA EVRC-NW vocoder modem format */
  884. #define VSS_IVOCPROC_CMD_CREATE_FULL_CONTROL_SESSION_V2 0x000112BF
  885. struct vss_ivocproc_cmd_create_full_control_session_v2_t {
  886. uint16_t direction;
  887. /*
  888. * Vocproc direction. The supported values:
  889. * VSS_IVOCPROC_DIRECTION_RX
  890. * VSS_IVOCPROC_DIRECTION_TX
  891. * VSS_IVOCPROC_DIRECTION_RX_TX
  892. */
  893. uint16_t tx_port_id;
  894. /*
  895. * Tx device port ID to which the vocproc connects. If a port ID is
  896. * not being supplied, set this to #VSS_IVOCPROC_PORT_ID_NONE.
  897. */
  898. uint32_t tx_topology_id;
  899. /*
  900. * Tx path topology ID. If a topology ID is not being supplied, set
  901. * this to #VSS_IVOCPROC_TOPOLOGY_ID_NONE.
  902. */
  903. uint16_t rx_port_id;
  904. /*
  905. * Rx device port ID to which the vocproc connects. If a port ID is
  906. * not being supplied, set this to #VSS_IVOCPROC_PORT_ID_NONE.
  907. */
  908. uint32_t rx_topology_id;
  909. /*
  910. * Rx path topology ID. If a topology ID is not being supplied, set
  911. * this to #VSS_IVOCPROC_TOPOLOGY_ID_NONE.
  912. */
  913. uint32_t profile_id;
  914. /* Voice calibration profile ID. */
  915. uint32_t vocproc_mode;
  916. /*
  917. * Vocproc mode. The supported values:
  918. * VSS_IVOCPROC_VOCPROC_MODE_EC_INT_MIXING
  919. * VSS_IVOCPROC_VOCPROC_MODE_EC_EXT_MIXING
  920. */
  921. uint16_t ec_ref_port_id;
  922. /*
  923. * Port ID to which the vocproc connects for receiving echo
  924. * cancellation reference signal. If a port ID is not being supplied,
  925. * set this to #VSS_IVOCPROC_PORT_ID_NONE. This parameter value is
  926. * ignored when the vocproc_mode parameter is set to
  927. * VSS_IVOCPROC_VOCPROC_MODE_EC_INT_MIXING.
  928. */
  929. char name[SESSION_NAME_LEN];
  930. /*
  931. * Session name string used to identify a session that can be shared
  932. * with passive controllers (optional). The string size, including the
  933. * NULL termination character, is limited to 31 characters.
  934. */
  935. } __packed;
  936. struct vss_ivocproc_cmd_set_volume_index_t {
  937. uint16_t vol_index;
  938. /*
  939. * Volume index utilized by the vocproc to index into the volume table
  940. * provided in VSS_IVOCPROC_CMD_CACHE_VOLUME_CALIBRATION_TABLE and set
  941. * volume on the VDSP.
  942. */
  943. } __packed;
  944. struct vss_ivolume_cmd_set_step_t {
  945. uint16_t direction;
  946. /*
  947. * The direction field sets the direction to apply the volume command.
  948. * The supported values:
  949. * #VSS_IVOLUME_DIRECTION_RX
  950. */
  951. uint32_t value;
  952. /*
  953. * Volume step used to find the corresponding linear volume and
  954. * the best match index in the registered volume calibration table.
  955. */
  956. uint16_t ramp_duration_ms;
  957. /*
  958. * Volume change ramp duration in milliseconds.
  959. * The supported values: 0 to 5000.
  960. */
  961. } __packed;
  962. struct vss_ivocproc_cmd_set_device_v2_t {
  963. uint16_t tx_port_id;
  964. /*
  965. * TX device port ID which vocproc will connect to.
  966. * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port.
  967. */
  968. uint32_t tx_topology_id;
  969. /*
  970. * TX leg topology ID.
  971. * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any
  972. * pre/post-processing blocks and is pass-through.
  973. */
  974. uint16_t rx_port_id;
  975. /*
  976. * RX device port ID which vocproc will connect to.
  977. * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port.
  978. */
  979. uint32_t rx_topology_id;
  980. /*
  981. * RX leg topology ID.
  982. * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any
  983. * pre/post-processing blocks and is pass-through.
  984. */
  985. uint32_t vocproc_mode;
  986. /* Vocproc mode. The supported values:
  987. * VSS_IVOCPROC_VOCPROC_MODE_EC_INT_MIXING - 0x00010F7C
  988. * VSS_IVOCPROC_VOCPROC_MODE_EC_EXT_MIXING - 0x00010F7D
  989. */
  990. uint16_t ec_ref_port_id;
  991. /* Port ID to which the vocproc connects for receiving
  992. * echo
  993. */
  994. } __packed;
  995. struct vss_ivocproc_cmd_register_device_config_t {
  996. uint32_t mem_handle;
  997. /*
  998. * Handle to the shared memory that holds the per-network calibration
  999. * data.
  1000. */
  1001. uint64_t mem_address;
  1002. /* Location of calibration data. */
  1003. uint32_t mem_size;
  1004. /* Size of the calibration data in bytes. */
  1005. } __packed;
  1006. struct vss_ivocproc_cmd_register_calibration_data_v2_t {
  1007. uint32_t cal_mem_handle;
  1008. /*
  1009. * Handle to the shared memory that holds the per-network calibration
  1010. * data.
  1011. */
  1012. uint64_t cal_mem_address;
  1013. /* Location of calibration data. */
  1014. uint32_t cal_mem_size;
  1015. /* Size of the calibration data in bytes. */
  1016. uint8_t column_info[MAX_COL_INFO_SIZE];
  1017. /*
  1018. * Column info contains the number of columns and the array of columns
  1019. * in the calibration table. The order in which the columns are provided
  1020. * here must match the order in which they exist in the calibration
  1021. * table provided.
  1022. */
  1023. } __packed;
  1024. struct vss_ivocproc_cmd_register_volume_cal_data_t {
  1025. uint32_t cal_mem_handle;
  1026. /*
  1027. * Handle to the shared memory that holds the volume calibration
  1028. * data.
  1029. */
  1030. uint64_t cal_mem_address;
  1031. /* Location of volume calibration data. */
  1032. uint32_t cal_mem_size;
  1033. /* Size of the volume calibration data in bytes. */
  1034. uint8_t column_info[MAX_COL_INFO_SIZE];
  1035. /*
  1036. * Column info contains the number of columns and the array of columns
  1037. * in the calibration table. The order in which the columns are provided
  1038. * here must match the order in which they exist in the calibration
  1039. * table provided.
  1040. */
  1041. } __packed;
  1042. struct cvp_create_full_ctl_session_cmd {
  1043. struct apr_hdr hdr;
  1044. struct vss_ivocproc_cmd_create_full_control_session_v2_t cvp_session;
  1045. } __packed;
  1046. struct cvp_command {
  1047. struct apr_hdr hdr;
  1048. } __packed;
  1049. struct cvp_set_device_cmd {
  1050. struct apr_hdr hdr;
  1051. struct vss_ivocproc_cmd_set_device_v2_t cvp_set_device_v2;
  1052. } __packed;
  1053. struct cvp_set_vp3_data_cmd {
  1054. struct apr_hdr hdr;
  1055. } __packed;
  1056. struct cvp_set_rx_volume_index_cmd {
  1057. struct apr_hdr hdr;
  1058. struct vss_ivocproc_cmd_set_volume_index_t cvp_set_vol_idx;
  1059. } __packed;
  1060. struct cvp_set_rx_volume_step_cmd {
  1061. struct apr_hdr hdr;
  1062. struct vss_ivolume_cmd_set_step_t cvp_set_vol_step;
  1063. } __packed;
  1064. struct cvp_register_dev_cfg_cmd {
  1065. struct apr_hdr hdr;
  1066. struct vss_ivocproc_cmd_register_device_config_t cvp_dev_cfg_data;
  1067. } __packed;
  1068. struct cvp_deregister_dev_cfg_cmd {
  1069. struct apr_hdr hdr;
  1070. } __packed;
  1071. struct cvp_register_cal_data_cmd {
  1072. struct apr_hdr hdr;
  1073. struct vss_ivocproc_cmd_register_calibration_data_v2_t cvp_cal_data;
  1074. } __packed;
  1075. struct cvp_deregister_cal_data_cmd {
  1076. struct apr_hdr hdr;
  1077. } __packed;
  1078. struct cvp_register_vol_cal_data_cmd {
  1079. struct apr_hdr hdr;
  1080. struct vss_ivocproc_cmd_register_volume_cal_data_t cvp_vol_cal_data;
  1081. } __packed;
  1082. struct cvp_deregister_vol_cal_data_cmd {
  1083. struct apr_hdr hdr;
  1084. } __packed;
  1085. struct cvp_set_mute_cmd {
  1086. struct apr_hdr hdr;
  1087. struct vss_ivolume_cmd_mute_v2_t cvp_set_mute;
  1088. } __packed;
  1089. /* CB for up-link packets. */
  1090. typedef void (*ul_cb_fn)(uint8_t *voc_pkt,
  1091. uint32_t pkt_len,
  1092. uint32_t timestamp,
  1093. void *private_data);
  1094. /* CB for down-link packets. */
  1095. typedef void (*dl_cb_fn)(uint8_t *voc_pkt,
  1096. void *private_data);
  1097. /* CB for DTMF RX Detection */
  1098. typedef void (*dtmf_rx_det_cb_fn)(uint8_t *pkt,
  1099. char *session,
  1100. void *private_data);
  1101. typedef void (*voip_ssr_cb) (uint32_t opcode,
  1102. void *private_data);
  1103. struct mvs_driver_info {
  1104. uint32_t media_type;
  1105. uint32_t rate;
  1106. uint32_t network_type;
  1107. uint32_t dtx_mode;
  1108. ul_cb_fn ul_cb;
  1109. dl_cb_fn dl_cb;
  1110. voip_ssr_cb ssr_cb;
  1111. void *private_data;
  1112. uint32_t evrc_min_rate;
  1113. uint32_t evrc_max_rate;
  1114. };
  1115. struct dtmf_driver_info {
  1116. dtmf_rx_det_cb_fn dtmf_rx_ul_cb;
  1117. void *private_data;
  1118. };
  1119. struct incall_rec_info {
  1120. uint32_t rec_enable;
  1121. uint32_t rec_mode;
  1122. uint32_t recording;
  1123. };
  1124. struct incall_music_info {
  1125. uint32_t play_enable;
  1126. uint32_t playing;
  1127. int count;
  1128. int force;
  1129. uint16_t port_id;
  1130. };
  1131. struct share_memory_info {
  1132. u32 mem_handle;
  1133. struct share_mem_buf sh_buf;
  1134. struct mem_map_table memtbl;
  1135. };
  1136. struct voice_data {
  1137. int voc_state;/*INIT, CHANGE, RELEASE, RUN */
  1138. /* Shared mem to store decoder and encoder packets */
  1139. struct share_memory_info shmem_info;
  1140. wait_queue_head_t mvm_wait;
  1141. wait_queue_head_t cvs_wait;
  1142. wait_queue_head_t cvp_wait;
  1143. /* Cache the values related to Rx and Tx devices */
  1144. struct device_data dev_rx;
  1145. struct device_data dev_tx;
  1146. /* Cache the values related to Rx and Tx streams */
  1147. struct stream_data stream_rx;
  1148. struct stream_data stream_tx;
  1149. u32 mvm_state;
  1150. u32 cvs_state;
  1151. u32 cvp_state;
  1152. /* Handle to MVM in the Q6 */
  1153. u16 mvm_handle;
  1154. /* Handle to CVS in the Q6 */
  1155. u16 cvs_handle;
  1156. /* Handle to CVP in the Q6 */
  1157. u16 cvp_handle;
  1158. struct mutex lock;
  1159. uint16_t sidetone_gain;
  1160. uint8_t tty_mode;
  1161. /* slowtalk enable value */
  1162. uint32_t st_enable;
  1163. uint32_t dtmf_rx_detect_en;
  1164. /* Local Call Hold mode */
  1165. uint8_t lch_mode;
  1166. struct voice_dev_route_state voc_route_state;
  1167. u32 session_id;
  1168. struct incall_rec_info rec_info;
  1169. struct incall_music_info music_info;
  1170. struct voice_rec_route_state rec_route_state;
  1171. #ifdef CONFIG_SEC_DHA_SOL_MAL
  1172. struct voice_dha_data sec_dha_data;
  1173. #endif /* CONFIG_SEC_DHA_SOL_MAL */
  1174. };
  1175. struct cal_mem {
  1176. struct ion_handle *handle;
  1177. uint32_t phy;
  1178. void *buf;
  1179. };
  1180. #define MAX_VOC_SESSIONS 6
  1181. struct common_data {
  1182. /* these default values are for all devices */
  1183. uint32_t default_mute_val;
  1184. uint32_t default_sample_val;
  1185. uint32_t default_vol_step_val;
  1186. uint32_t default_vol_ramp_duration_ms;
  1187. uint32_t default_mute_ramp_duration_ms;
  1188. bool ec_ref_ext;
  1189. uint16_t ec_port_id;
  1190. /* APR to MVM in the Q6 */
  1191. void *apr_q6_mvm;
  1192. /* APR to CVS in the Q6 */
  1193. void *apr_q6_cvs;
  1194. /* APR to CVP in the Q6 */
  1195. void *apr_q6_cvp;
  1196. struct mem_map_table cal_mem_map_table;
  1197. uint32_t cal_mem_handle;
  1198. struct mem_map_table rtac_mem_map_table;
  1199. uint32_t rtac_mem_handle;
  1200. struct cal_mem cvp_cal;
  1201. struct cal_mem cvs_cal;
  1202. struct mutex common_lock;
  1203. struct mvs_driver_info mvs_info;
  1204. struct dtmf_driver_info dtmf_info;
  1205. struct voice_data voice[MAX_VOC_SESSIONS];
  1206. bool srvcc_rec_flag;
  1207. };
  1208. struct voice_session_itr {
  1209. int cur_idx;
  1210. int session_idx;
  1211. };
  1212. void voc_register_mvs_cb(ul_cb_fn ul_cb,
  1213. dl_cb_fn dl_cb,
  1214. voip_ssr_cb ssr_cb,
  1215. void *private_data);
  1216. void voc_register_dtmf_rx_detection_cb(dtmf_rx_det_cb_fn dtmf_rx_ul_cb,
  1217. void *private_data);
  1218. void voc_config_vocoder(uint32_t media_type,
  1219. uint32_t rate,
  1220. uint32_t network_type,
  1221. uint32_t dtx_mode,
  1222. uint32_t evrc_min_rate,
  1223. uint32_t evrc_max_rate);
  1224. enum {
  1225. DEV_RX = 0,
  1226. DEV_TX,
  1227. };
  1228. enum {
  1229. RX_PATH = 0,
  1230. TX_PATH,
  1231. };
  1232. #define VOC_PATH_PASSIVE 0
  1233. #define VOC_PATH_FULL 1
  1234. #define VOC_PATH_VOLTE_PASSIVE 2
  1235. #define VOC_PATH_VOICE2_PASSIVE 3
  1236. #define VOC_PATH_QCHAT_PASSIVE 4
  1237. #define VOC_PATH_VOWLAN_PASSIVE 5
  1238. #define MAX_SESSION_NAME_LEN 32
  1239. #define VOICE_SESSION_NAME "Voice session"
  1240. #define VOIP_SESSION_NAME "VoIP session"
  1241. #define VOLTE_SESSION_NAME "VoLTE session"
  1242. #define VOICE2_SESSION_NAME "Voice2 session"
  1243. #define QCHAT_SESSION_NAME "QCHAT session"
  1244. #define VOWLAN_SESSION_NAME "VoWLAN session"
  1245. #define VOICE2_SESSION_VSID_STR "10DC1000"
  1246. #define QCHAT_SESSION_VSID_STR "10803000"
  1247. #define VOWLAN_SESSION_VSID_STR "10002000"
  1248. #define VOICE_SESSION_VSID 0x10C01000
  1249. #define VOICE2_SESSION_VSID 0x10DC1000
  1250. #define VOLTE_SESSION_VSID 0x10C02000
  1251. #define VOIP_SESSION_VSID 0x10004000
  1252. #define QCHAT_SESSION_VSID 0x10803000
  1253. #define VOWLAN_SESSION_VSID 0x10002000
  1254. #define ALL_SESSION_VSID 0xFFFFFFFF
  1255. #define VSID_MAX ALL_SESSION_VSID
  1256. #ifdef CONFIG_SEC_DHA_SOL_MAL
  1257. int voice_sec_set_dha_data(uint32_t session_id, short mode,
  1258. short select, short *parameters);
  1259. #endif /* CONFIG_SEC_DHA_SOL_MAL*/
  1260. #define APP_ID_MASK 0x3F000
  1261. #define APP_ID_SHIFT 12
  1262. enum vsid_app_type {
  1263. VSID_APP_NONE = 0,
  1264. VSID_APP_CS_VOICE = 1,
  1265. VSID_APP_IMS = 2, /* IMS voice services covering VoLTE etc */
  1266. VSID_APP_QCHAT = 3,
  1267. VSID_APP_VOIP = 4, /* VoIP on AP HLOS without modem processor */
  1268. VSID_APP_MAX,
  1269. };
  1270. /* called by alsa driver */
  1271. int voc_set_pp_enable(uint32_t session_id, uint32_t module_id,
  1272. uint32_t enable);
  1273. int voc_get_pp_enable(uint32_t session_id, uint32_t module_id);
  1274. uint8_t voc_get_tty_mode(uint32_t session_id);
  1275. int voc_set_tty_mode(uint32_t session_id, uint8_t tty_mode);
  1276. int voc_start_voice_call(uint32_t session_id);
  1277. int voc_end_voice_call(uint32_t session_id);
  1278. int voc_standby_voice_call(uint32_t session_id);
  1279. int voc_resume_voice_call(uint32_t session_id);
  1280. int voc_set_lch(uint32_t session_id, enum voice_lch_mode lch_mode);
  1281. int voc_set_rxtx_port(uint32_t session_id,
  1282. uint32_t dev_port_id,
  1283. uint32_t dev_type);
  1284. int voc_set_rx_vol_step(uint32_t session_id, uint32_t dir, uint32_t vol_step,
  1285. uint32_t ramp_duration);
  1286. int voc_set_tx_mute(uint32_t session_id, uint32_t dir, uint32_t mute,
  1287. uint32_t ramp_duration);
  1288. int voc_set_device_mute(uint32_t session_id, uint32_t dir, uint32_t mute,
  1289. uint32_t ramp_duration);
  1290. int voc_get_rx_device_mute(uint32_t session_id);
  1291. int voc_set_route_flag(uint32_t session_id, uint8_t path_dir, uint8_t set);
  1292. uint8_t voc_get_route_flag(uint32_t session_id, uint8_t path_dir);
  1293. int voc_enable_dtmf_rx_detection(uint32_t session_id, uint32_t enable);
  1294. void voc_disable_dtmf_det_on_active_sessions(void);
  1295. int voc_alloc_cal_shared_memory(void);
  1296. int voc_alloc_voip_shared_memory(void);
  1297. int is_voc_initialized(void);
  1298. int voc_register_vocproc_vol_table(void);
  1299. int voc_deregister_vocproc_vol_table(void);
  1300. int voc_unmap_cal_blocks(void);
  1301. int voc_map_rtac_block(struct rtac_cal_block_data *cal_block);
  1302. int voc_unmap_rtac_block(uint32_t *mem_map_handle);
  1303. uint32_t voc_get_session_id(char *name);
  1304. int voc_start_playback(uint32_t set, uint16_t port_id);
  1305. int voc_start_record(uint32_t port_id, uint32_t set, uint32_t session_id);
  1306. int voice_get_idx_for_session(u32 session_id);
  1307. int voc_set_ext_ec_ref(uint16_t port_id, bool state);
  1308. int voc_update_amr_vocoder_rate(uint32_t session_id);
  1309. int voc_disable_device(uint32_t session_id);
  1310. int voc_enable_device(uint32_t session_id);
  1311. int voc_get_loopback_enable(void);
  1312. void voc_set_loopback_enable(int loopback_enable);
  1313. int voc_get_roaming_enable(void);
  1314. void voc_set_roaming_enable(int loopback_enable);
  1315. #endif