q6voice.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368
  1. /* Copyright (c) 2011-2013, 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 <linux/msm_ion.h>
  16. #define MAX_VOC_PKT_SIZE 642
  17. #define SESSION_NAME_LEN 21
  18. #define VOC_REC_UPLINK 0x00
  19. #define VOC_REC_DOWNLINK 0x01
  20. #define VOC_REC_BOTH 0x02
  21. /* Needed for VOIP & VOLTE support */
  22. /* Due to Q6 memory map issue */
  23. enum {
  24. VOIP_CAL,
  25. VOLTE_CAL,
  26. NUM_VOICE_CAL_BUFFERS
  27. };
  28. enum {
  29. CVP_CAL,
  30. CVS_CAL,
  31. NUM_VOICE_CAL_TYPES
  32. };
  33. struct voice_header {
  34. uint32_t id;
  35. uint32_t data_len;
  36. };
  37. struct voice_init {
  38. struct voice_header hdr;
  39. void *cb_handle;
  40. };
  41. /* Device information payload structure */
  42. struct device_data {
  43. uint32_t volume; /* in index */
  44. uint32_t mute;
  45. uint32_t sample;
  46. uint32_t enabled;
  47. uint32_t dev_id;
  48. uint32_t port_id;
  49. };
  50. struct voice_dev_route_state {
  51. u16 rx_route_flag;
  52. u16 tx_route_flag;
  53. };
  54. struct voice_rec_route_state {
  55. u16 ul_flag;
  56. u16 dl_flag;
  57. };
  58. enum {
  59. VOC_INIT = 0,
  60. VOC_RUN,
  61. VOC_CHANGE,
  62. VOC_RELEASE,
  63. VOC_STANDBY,
  64. };
  65. /* Common */
  66. #define VSS_ICOMMON_CMD_SET_UI_PROPERTY 0x00011103
  67. /* Set a UI property */
  68. #define VSS_ICOMMON_CMD_MAP_MEMORY 0x00011025
  69. #define VSS_ICOMMON_CMD_UNMAP_MEMORY 0x00011026
  70. /* General shared memory; byte-accessible, 4 kB-aligned. */
  71. #define VSS_ICOMMON_MAP_MEMORY_SHMEM8_4K_POOL 3
  72. struct vss_icommon_cmd_map_memory_t {
  73. uint32_t phys_addr;
  74. /* Physical address of a memory region; must be at least
  75. * 4 kB aligned.
  76. */
  77. uint32_t mem_size;
  78. /* Number of bytes in the region; should be a multiple of 32. */
  79. uint16_t mem_pool_id;
  80. /* Type of memory being provided. The memory ID implicitly defines
  81. * the characteristics of the memory. The characteristics might include
  82. * alignment type, permissions, etc.
  83. * Memory pool ID. Possible values:
  84. * 3 -- VSS_ICOMMON_MEM_TYPE_SHMEM8_4K_POOL.
  85. */
  86. } __packed;
  87. struct vss_icommon_cmd_unmap_memory_t {
  88. uint32_t phys_addr;
  89. /* Physical address of a memory region; must be at least
  90. * 4 kB aligned.
  91. */
  92. } __packed;
  93. struct vss_map_memory_cmd {
  94. struct apr_hdr hdr;
  95. struct vss_icommon_cmd_map_memory_t vss_map_mem;
  96. } __packed;
  97. struct vss_unmap_memory_cmd {
  98. struct apr_hdr hdr;
  99. struct vss_icommon_cmd_unmap_memory_t vss_unmap_mem;
  100. } __packed;
  101. /* TO MVM commands */
  102. #define VSS_IMVM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x000110FF
  103. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  104. #define VSS_IMVM_CMD_SET_POLICY_DUAL_CONTROL 0x00011327
  105. /*
  106. * VSS_IMVM_CMD_SET_POLICY_DUAL_CONTROL
  107. * Description: This command is required to let MVM know
  108. * who is in control of session.
  109. * Payload: Defined by vss_imvm_cmd_set_policy_dual_control_t.
  110. * Result: Wait for APRV2_IBASIC_RSP_RESULT response.
  111. */
  112. #define VSS_IMVM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110FE
  113. /* Create a new full control MVM session. */
  114. #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
  115. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  116. #define VSS_IMVM_CMD_ATTACH_STREAM 0x0001123C
  117. /* Attach a stream to the MVM. */
  118. #define VSS_IMVM_CMD_DETACH_STREAM 0x0001123D
  119. /* Detach a stream from the MVM. */
  120. #define VSS_IMVM_CMD_ATTACH_VOCPROC 0x0001123E
  121. /* Attach a vocproc to the MVM. The MVM will symmetrically connect this vocproc
  122. * to all the streams currently attached to it.
  123. */
  124. #define VSS_IMVM_CMD_DETACH_VOCPROC 0x0001123F
  125. /* Detach a vocproc from the MVM. The MVM will symmetrically disconnect this
  126. * vocproc from all the streams to which it is currently attached.
  127. */
  128. #define VSS_IMVM_CMD_START_VOICE 0x00011190
  129. /*
  130. * Start Voice call command.
  131. * Wait for APRV2_IBASIC_RSP_RESULT response.
  132. * No pay load.
  133. */
  134. #define VSS_IMVM_CMD_STANDBY_VOICE 0x00011191
  135. /* No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  136. #define VSS_IMVM_CMD_STOP_VOICE 0x00011192
  137. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  138. #define VSS_ISTREAM_CMD_ATTACH_VOCPROC 0x000110F8
  139. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  140. #define VSS_ISTREAM_CMD_DETACH_VOCPROC 0x000110F9
  141. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  142. #define VSS_ISTREAM_CMD_SET_TTY_MODE 0x00011196
  143. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  144. #define VSS_ICOMMON_CMD_SET_NETWORK 0x0001119C
  145. /* Set the network type. */
  146. #define VSS_ICOMMON_CMD_SET_VOICE_TIMING 0x000111E0
  147. /* Set the voice timing parameters. */
  148. #define VSS_IWIDEVOICE_CMD_SET_WIDEVOICE 0x00011243
  149. /* Enable/disable WideVoice */
  150. enum msm_audio_voc_rate {
  151. VOC_0_RATE, /* Blank frame */
  152. VOC_8_RATE, /* 1/8 rate */
  153. VOC_4_RATE, /* 1/4 rate */
  154. VOC_2_RATE, /* 1/2 rate */
  155. VOC_1_RATE /* Full rate */
  156. };
  157. struct vss_istream_cmd_set_tty_mode_t {
  158. uint32_t mode;
  159. /**<
  160. * TTY mode.
  161. *
  162. * 0 : TTY disabled
  163. * 1 : HCO
  164. * 2 : VCO
  165. * 3 : FULL
  166. */
  167. } __packed;
  168. struct vss_istream_cmd_attach_vocproc_t {
  169. uint16_t handle;
  170. /**< Handle of vocproc being attached. */
  171. } __packed;
  172. struct vss_istream_cmd_detach_vocproc_t {
  173. uint16_t handle;
  174. /**< Handle of vocproc being detached. */
  175. } __packed;
  176. struct vss_imvm_cmd_attach_stream_t {
  177. uint16_t handle;
  178. /* The stream handle to attach. */
  179. } __packed;
  180. struct vss_imvm_cmd_detach_stream_t {
  181. uint16_t handle;
  182. /* The stream handle to detach. */
  183. } __packed;
  184. struct vss_icommon_cmd_set_network_t {
  185. uint32_t network_id;
  186. /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */
  187. } __packed;
  188. struct vss_icommon_cmd_set_voice_timing_t {
  189. uint16_t mode;
  190. /*
  191. * The vocoder frame synchronization mode.
  192. *
  193. * 0 : No frame sync.
  194. * 1 : Hard VFR (20ms Vocoder Frame Reference interrupt).
  195. */
  196. uint16_t enc_offset;
  197. /*
  198. * The offset in microseconds from the VFR to deliver a Tx vocoder
  199. * packet. The offset should be less than 20000us.
  200. */
  201. uint16_t dec_req_offset;
  202. /*
  203. * The offset in microseconds from the VFR to request for an Rx vocoder
  204. * packet. The offset should be less than 20000us.
  205. */
  206. uint16_t dec_offset;
  207. /*
  208. * The offset in microseconds from the VFR to indicate the deadline to
  209. * receive an Rx vocoder packet. The offset should be less than 20000us.
  210. * Rx vocoder packets received after this deadline are not guaranteed to
  211. * be processed.
  212. */
  213. } __packed;
  214. struct vss_imvm_cmd_create_control_session_t {
  215. char name[SESSION_NAME_LEN];
  216. /*
  217. * A variable-sized stream name.
  218. *
  219. * The stream name size is the payload size minus the size of the other
  220. * fields.
  221. */
  222. } __packed;
  223. struct vss_imvm_cmd_set_policy_dual_control_t {
  224. bool enable_flag;
  225. /* Set to TRUE to enable modem state machine control */
  226. } __packed;
  227. struct vss_iwidevoice_cmd_set_widevoice_t {
  228. uint32_t enable;
  229. /* WideVoice enable/disable; possible values:
  230. * - 0 -- WideVoice disabled
  231. * - 1 -- WideVoice enabled
  232. */
  233. } __packed;
  234. struct mvm_attach_vocproc_cmd {
  235. struct apr_hdr hdr;
  236. struct vss_istream_cmd_attach_vocproc_t mvm_attach_cvp_handle;
  237. } __packed;
  238. struct mvm_detach_vocproc_cmd {
  239. struct apr_hdr hdr;
  240. struct vss_istream_cmd_detach_vocproc_t mvm_detach_cvp_handle;
  241. } __packed;
  242. struct mvm_create_ctl_session_cmd {
  243. struct apr_hdr hdr;
  244. struct vss_imvm_cmd_create_control_session_t mvm_session;
  245. } __packed;
  246. struct mvm_modem_dual_control_session_cmd {
  247. struct apr_hdr hdr;
  248. struct vss_imvm_cmd_set_policy_dual_control_t voice_ctl;
  249. } __packed;
  250. struct mvm_set_tty_mode_cmd {
  251. struct apr_hdr hdr;
  252. struct vss_istream_cmd_set_tty_mode_t tty_mode;
  253. } __packed;
  254. struct mvm_attach_stream_cmd {
  255. struct apr_hdr hdr;
  256. struct vss_imvm_cmd_attach_stream_t attach_stream;
  257. } __packed;
  258. struct mvm_detach_stream_cmd {
  259. struct apr_hdr hdr;
  260. struct vss_imvm_cmd_detach_stream_t detach_stream;
  261. } __packed;
  262. struct mvm_set_network_cmd {
  263. struct apr_hdr hdr;
  264. struct vss_icommon_cmd_set_network_t network;
  265. } __packed;
  266. struct mvm_set_voice_timing_cmd {
  267. struct apr_hdr hdr;
  268. struct vss_icommon_cmd_set_voice_timing_t timing;
  269. } __packed;
  270. struct mvm_set_widevoice_enable_cmd {
  271. struct apr_hdr hdr;
  272. struct vss_iwidevoice_cmd_set_widevoice_t vss_set_wv;
  273. } __packed;
  274. /* TO CVS commands */
  275. #define VSS_ISTREAM_CMD_CREATE_PASSIVE_CONTROL_SESSION 0x00011140
  276. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  277. #define VSS_ISTREAM_CMD_CREATE_FULL_CONTROL_SESSION 0x000110F7
  278. /* Create a new full control stream session. */
  279. #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
  280. #define VSS_ISTREAM_CMD_SET_MUTE 0x00011022
  281. #define VSS_ISTREAM_CMD_REGISTER_CALIBRATION_DATA 0x00011279
  282. #define VSS_ISTREAM_CMD_DEREGISTER_CALIBRATION_DATA 0x0001127A
  283. #define VSS_ISTREAM_CMD_SET_MEDIA_TYPE 0x00011186
  284. /* Set media type on the stream. */
  285. #define VSS_ISTREAM_EVT_SEND_ENC_BUFFER 0x00011015
  286. /* Event sent by the stream to its client to provide an encoded packet. */
  287. #define VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER 0x00011017
  288. /* Event sent by the stream to its client requesting for a decoder packet.
  289. * The client should respond with a VSS_ISTREAM_EVT_SEND_DEC_BUFFER event.
  290. */
  291. #define VSS_ISTREAM_EVT_SEND_DEC_BUFFER 0x00011016
  292. /* Event sent by the client to the stream in response to a
  293. * VSS_ISTREAM_EVT_REQUEST_DEC_BUFFER event, providing a decoder packet.
  294. */
  295. #define VSS_ISTREAM_CMD_VOC_AMR_SET_ENC_RATE 0x0001113E
  296. /* Set AMR encoder rate. */
  297. #define VSS_ISTREAM_CMD_VOC_AMRWB_SET_ENC_RATE 0x0001113F
  298. /* Set AMR-WB encoder rate. */
  299. #define VSS_ISTREAM_CMD_CDMA_SET_ENC_MINMAX_RATE 0x00011019
  300. /* Set encoder minimum and maximum rate. */
  301. #define VSS_ISTREAM_CMD_SET_ENC_DTX_MODE 0x0001101D
  302. /* Set encoder DTX mode. */
  303. #define MODULE_ID_VOICE_MODULE_FENS 0x00010EEB
  304. #define MODULE_ID_VOICE_MODULE_ST 0x00010EE3
  305. #define VOICE_PARAM_MOD_ENABLE 0x00010E00
  306. #define MOD_ENABLE_PARAM_LEN 4
  307. #define VSS_ISTREAM_CMD_START_PLAYBACK 0x00011238
  308. /* Start in-call music delivery on the Tx voice path. */
  309. #define VSS_ISTREAM_CMD_STOP_PLAYBACK 0x00011239
  310. /* Stop the in-call music delivery on the Tx voice path. */
  311. #define VSS_ISTREAM_CMD_START_RECORD 0x00011236
  312. /* Start in-call conversation recording. */
  313. #define VSS_ISTREAM_CMD_STOP_RECORD 0x00011237
  314. /* Stop in-call conversation recording. */
  315. #define VSS_TAP_POINT_NONE 0x00010F78
  316. /* Indicates no tapping for specified path. */
  317. #define VSS_TAP_POINT_STREAM_END 0x00010F79
  318. /* Indicates that specified path should be tapped at the end of the stream. */
  319. struct vss_istream_cmd_start_record_t {
  320. uint32_t rx_tap_point;
  321. /* Tap point to use on the Rx path. Supported values are:
  322. * VSS_TAP_POINT_NONE : Do not record Rx path.
  323. * VSS_TAP_POINT_STREAM_END : Rx tap point is at the end of the stream.
  324. */
  325. uint32_t tx_tap_point;
  326. /* Tap point to use on the Tx path. Supported values are:
  327. * VSS_TAP_POINT_NONE : Do not record tx path.
  328. * VSS_TAP_POINT_STREAM_END : Tx tap point is at the end of the stream.
  329. */
  330. } __packed;
  331. struct vss_istream_cmd_create_passive_control_session_t {
  332. char name[SESSION_NAME_LEN];
  333. /**<
  334. * A variable-sized stream name.
  335. *
  336. * The stream name size is the payload size minus the size of the other
  337. * fields.
  338. */
  339. } __packed;
  340. struct vss_istream_cmd_set_mute_t {
  341. uint16_t direction;
  342. /**<
  343. * 0 : TX only
  344. * 1 : RX only
  345. * 2 : TX and Rx
  346. */
  347. uint16_t mute_flag;
  348. /**<
  349. * Mute, un-mute.
  350. *
  351. * 0 : Silence disable
  352. * 1 : Silence enable
  353. * 2 : CNG enable. Applicable to TX only. If set on RX behavior
  354. * will be the same as 1
  355. */
  356. } __packed;
  357. struct vss_istream_cmd_create_full_control_session_t {
  358. uint16_t direction;
  359. /*
  360. * Stream direction.
  361. *
  362. * 0 : TX only
  363. * 1 : RX only
  364. * 2 : TX and RX
  365. * 3 : TX and RX loopback
  366. */
  367. uint32_t enc_media_type;
  368. /* Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  369. uint32_t dec_media_type;
  370. /* Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  371. uint32_t network_id;
  372. /* Network ID. (Refer to VSS_NETWORK_ID_XXX). */
  373. char name[SESSION_NAME_LEN];
  374. /*
  375. * A variable-sized stream name.
  376. *
  377. * The stream name size is the payload size minus the size of the other
  378. * fields.
  379. */
  380. } __packed;
  381. struct vss_istream_cmd_set_media_type_t {
  382. uint32_t rx_media_id;
  383. /* Set the Rx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  384. uint32_t tx_media_id;
  385. /* Set the Tx vocoder type. (Refer to VSS_MEDIA_ID_XXX). */
  386. } __packed;
  387. struct vss_istream_evt_send_enc_buffer_t {
  388. uint32_t media_id;
  389. /* Media ID of the packet. */
  390. uint8_t packet_data[MAX_VOC_PKT_SIZE];
  391. /* Packet data buffer. */
  392. } __packed;
  393. struct vss_istream_evt_send_dec_buffer_t {
  394. uint32_t media_id;
  395. /* Media ID of the packet. */
  396. uint8_t packet_data[MAX_VOC_PKT_SIZE];
  397. /* Packet data. */
  398. } __packed;
  399. struct vss_istream_cmd_voc_amr_set_enc_rate_t {
  400. uint32_t mode;
  401. /* Set the AMR encoder rate.
  402. *
  403. * 0x00000000 : 4.75 kbps
  404. * 0x00000001 : 5.15 kbps
  405. * 0x00000002 : 5.90 kbps
  406. * 0x00000003 : 6.70 kbps
  407. * 0x00000004 : 7.40 kbps
  408. * 0x00000005 : 7.95 kbps
  409. * 0x00000006 : 10.2 kbps
  410. * 0x00000007 : 12.2 kbps
  411. */
  412. } __packed;
  413. struct vss_istream_cmd_voc_amrwb_set_enc_rate_t {
  414. uint32_t mode;
  415. /* Set the AMR-WB encoder rate.
  416. *
  417. * 0x00000000 : 6.60 kbps
  418. * 0x00000001 : 8.85 kbps
  419. * 0x00000002 : 12.65 kbps
  420. * 0x00000003 : 14.25 kbps
  421. * 0x00000004 : 15.85 kbps
  422. * 0x00000005 : 18.25 kbps
  423. * 0x00000006 : 19.85 kbps
  424. * 0x00000007 : 23.05 kbps
  425. * 0x00000008 : 23.85 kbps
  426. */
  427. } __packed;
  428. struct vss_istream_cmd_cdma_set_enc_minmax_rate_t {
  429. uint16_t min_rate;
  430. /* Set the lower bound encoder rate.
  431. *
  432. * 0x0000 : Blank frame
  433. * 0x0001 : Eighth rate
  434. * 0x0002 : Quarter rate
  435. * 0x0003 : Half rate
  436. * 0x0004 : Full rate
  437. */
  438. uint16_t max_rate;
  439. /* Set the upper bound encoder rate.
  440. *
  441. * 0x0000 : Blank frame
  442. * 0x0001 : Eighth rate
  443. * 0x0002 : Quarter rate
  444. * 0x0003 : Half rate
  445. * 0x0004 : Full rate
  446. */
  447. } __packed;
  448. struct vss_istream_cmd_set_enc_dtx_mode_t {
  449. uint32_t enable;
  450. /* Toggle DTX on or off.
  451. *
  452. * 0 : Disables DTX
  453. * 1 : Enables DTX
  454. */
  455. } __packed;
  456. struct vss_istream_cmd_register_calibration_data_t {
  457. uint32_t phys_addr;
  458. /* Phsical address to be registered with stream. The calibration data
  459. * is stored at this address.
  460. */
  461. uint32_t mem_size;
  462. /* Size of the calibration data in bytes. */
  463. };
  464. struct vss_icommon_cmd_set_ui_property_enable_t {
  465. uint32_t module_id;
  466. /* Unique ID of the module. */
  467. uint32_t param_id;
  468. /* Unique ID of the parameter. */
  469. uint16_t param_size;
  470. /* Size of the parameter in bytes: MOD_ENABLE_PARAM_LEN */
  471. uint16_t reserved;
  472. /* Reserved; set to 0. */
  473. uint16_t enable;
  474. uint16_t reserved_field;
  475. /* Reserved, set to 0. */
  476. };
  477. /*
  478. * Event sent by the stream to the client that enables Rx DTMF
  479. * detection whenever DTMF is detected in the Rx path.
  480. *
  481. * The DTMF detection feature can only be used to detect DTMF
  482. * frequencies as listed in the vss_istream_evt_rx_dtmf_detected_t
  483. * structure.
  484. */
  485. #define VSS_ISTREAM_EVT_RX_DTMF_DETECTED 0x0001101A
  486. struct vss_istream_cmd_set_rx_dtmf_detection {
  487. /*
  488. * Enables/disables Rx DTMF detection
  489. *
  490. * Possible values are
  491. * 0 - disable
  492. * 1 - enable
  493. *
  494. */
  495. uint32_t enable;
  496. };
  497. #define VSS_ISTREAM_CMD_SET_RX_DTMF_DETECTION 0x00011027
  498. struct vss_istream_evt_rx_dtmf_detected {
  499. uint16_t low_freq;
  500. /*
  501. * Detected low frequency. Possible values:
  502. * 697 Hz
  503. * 770 Hz
  504. * 852 Hz
  505. * 941 Hz
  506. */
  507. uint16_t high_freq;
  508. /*
  509. * Detected high frequency. Possible values:
  510. * 1209 Hz
  511. * 1336 Hz
  512. * 1477 Hz
  513. * 1633 Hz
  514. */
  515. };
  516. struct cvs_set_rx_dtmf_detection_cmd {
  517. struct apr_hdr hdr;
  518. struct vss_istream_cmd_set_rx_dtmf_detection cvs_dtmf_det;
  519. } __packed;
  520. /* VOCODER PCM APIS */
  521. #define VSS_IVPCM_CMD_STOP 0x0001100B
  522. #define VSS_IVPCM_CMD_START 0x00011009
  523. /* Default tap point location on the TX path. */
  524. #define VSS_IVPCM_TAP_POINT_TX_DEFAULT 0x00011289
  525. /* Default tap point location on the RX path. */
  526. #define VSS_IVPCM_TAP_POINT_RX_DEFAULT 0x0001128A
  527. /*
  528. * Vocoder PCM sampling rate IDs.
  529. * Sampling rate matches the operating sampling rate
  530. * of the post-proc chain on the VDSP at the location
  531. * of the tap point.
  532. */
  533. #define VSS_IVPCM_SAMPLING_RATE_AUTO 0
  534. #define VSS_IVPCM_SAMPLING_RATE_8K 8000
  535. #define VSS_IVPCM_SAMPLING_RATE_16K 16000
  536. /* Output tap point */
  537. #define VSS_IVPCM_TAP_POINT_DIR_OUT 0
  538. /* Input tap point */
  539. #define VSS_IVPCM_TAP_POINT_DIR_IN 1
  540. /* Output-input tap point */
  541. #define VSS_IVPCM_TAP_POINT_DIR_OUT_IN 2
  542. /* RX & TX*/
  543. #define MAX_TAP_POINTS_SUPPORTED 2
  544. struct vss_ivpcm_tap_point {
  545. uint32_t tap_point;
  546. /*
  547. * Tap point location GUID. Supported values:
  548. * VSS_IVPCM_TAP_POINT_TX_DEFAULT
  549. * VSS_IVPCM_TAP_POINT_RX_DEFAULT
  550. */
  551. uint16_t direction;
  552. /*
  553. * Data flow direction of the tap point. Supported values:
  554. * VSS_IVPCM_TAP_POINT_DIR_OUT -- output
  555. * VSS_IVPCM_TAP_POINT_DIR_IN -- input
  556. * VSS_IVPCM_TAP_POINT_DIR_OUT_IN -- Output-input
  557. */
  558. uint16_t sampling_rate;
  559. /*
  560. * Sampling rate of the tap point. If the tap point is output-input,
  561. * then output sampling rate and the input sampling rate are the same.
  562. * Supported values:
  563. * VSS_IVPCM_SAMPLING_RATE_AUTO
  564. * VSS_IVPCM_SAMPLING_RATE_8K
  565. * VSS_IVPCM_SAMPLING_RATE_16K
  566. */
  567. uint16_t duration;
  568. /*
  569. * Duration of buffer in milliseconds.
  570. * Unsupported, set to 0.
  571. */
  572. } __packed;
  573. struct vss_ivpcm_start_cmd {
  574. uint32_t num_tap_points;
  575. struct vss_ivpcm_tap_point tap_points[MAX_TAP_POINTS_SUPPORTED];
  576. } __packed;
  577. #define VSS_IVPCM_EVT_NOTIFY 0x0001128B
  578. /* Notify event masks. */
  579. /* output buffer filled. */
  580. #define VSS_IVPCM_NOTIFY_MASK_OUTPUT_BUFFER 1
  581. /* input buffer consumed. */
  582. #define VSS_IVPCM_NOTIFY_MASK_INPUT_BUFFER 2
  583. /* event is a timetick. */
  584. #define VSS_IVPCM_NOTIFY_MASK_TIMETICK 4
  585. /* error in output buffer operation. */
  586. #define VSS_IVPCM_NOTIFY_MASK_OUTPUT_ERROR 8
  587. /* error in input buffer operation. */
  588. #define VSS_IVPCM_NOTIFY_MASK_INPUT_ERROR 16
  589. /*
  590. *Payload structure for the #VSS_IVPCM_EVT_NOTIFY command.
  591. */
  592. struct vss_ivpcm_evt_notify {
  593. uint32_t tap_point;
  594. /*
  595. * GUID indicating tap point location for which this notification is
  596. * being issued.
  597. */
  598. uint32_t notify_mask;
  599. /*
  600. * Bitmask indicating the notification mode.
  601. * Bitmask description:
  602. * bit 0 -- output buffer filled, VSS_IVPCM_NOTIFY_MASK_OUTPUT_BUFFER
  603. * bit 1 -- input buffer consumed, VSS_IVPCM_NOTIFY_MASK_INPUT_BUFFER
  604. * bit 2 -- notify event is a timetick, VSS_IVPCM_NOTIFY_MASK_TIMETICK
  605. * bit 3 -- error in output buffer, VSS_IVPCM_NOTIFY_MASK_OUTPUT_ERROR
  606. * This bit will be set if there is an error in output buffer
  607. * operation.This bit will be set along with "output buffer
  608. * filled" bit to return the output buffer with error
  609. * indication
  610. * bit 4 -- error in input buffer operation, use
  611. * VSS_IVPCM_NOTIFY_MASK_INPUT_ERROR. This bit will be set if
  612. * there is an error in input buffer operation. This bit will
  613. * be set along with "input buffer consumed" bit to return the
  614. * input buffer with error indication.
  615. */
  616. uint32_t out_buff_addr;
  617. /*
  618. * If bit 0 of the notify_mask is set, this field indicates the
  619. * physical address of the output buffer. Otherwise ignore.
  620. */
  621. uint32_t in_buff_addr;
  622. /*
  623. * If bit 1 of the notify_mask is set, this field indicates the
  624. * physicaladdress of the input buffer. Otherwise ignore.
  625. */
  626. uint16_t filled_out_size;
  627. /*
  628. * If bit 0 of the notify_mask is set, this field indicates
  629. * the filled size
  630. * of the output buffer located at the out_buff_addr. Otherwise ignore.
  631. */
  632. uint16_t request_buff_size;
  633. /* Request size of the input buffer. */
  634. uint16_t sampling_rate;
  635. /*
  636. * Sampling rate of the input/output buffer. Supported values:
  637. * VSS_IVPCM_SAMPLING_RATE_8K
  638. * VSS_IVPCM_SAMPLING_RATE_16K
  639. */
  640. uint16_t num_out_channels;
  641. /* Number of output channels contained in the filled output buffer.*/
  642. } __packed;
  643. #define VSS_IVPCM_EVT_PUSH_BUFFER 0x0001100A
  644. /* Push buffer event masks. */
  645. /* output buffer filled. */
  646. #define VSS_IVPCM_PUSH_BUFFER_MASK_OUTPUT_BUFFER 1
  647. /* input buffer consumed. */
  648. #define VSS_IVPCM_PUSH_BUFFER_MASK_INPUT_BUFFER 2
  649. struct vss_ivpcm_evt_push_buffer {
  650. uint32_t tap_point;
  651. /* tap point for which the buffer(s) is(are) provided. */
  652. uint32_t push_buf_mask;
  653. /*
  654. * Bitmask inticating whether an output buffer is being provided or an
  655. * input buffer or both. Bitmask description:
  656. * bit 0 -- output buffer, use VSS_IVPCM_PUSH_BUFFER_MASK_OUTPUT_BUFFER
  657. * bit 1 -- input buffer, use VSS_IVPCM_PUSH_BUFFER_MASK_INPUT_BUFFER.
  658. */
  659. uint32_t out_buf_addr;
  660. /*
  661. * If bit 0 of the push_buf_mask is set, this field indicates the
  662. * physical address of the output buffer. Otherwise it is ingored.
  663. */
  664. uint32_t in_buf_addr;
  665. /*
  666. * If bit 1 of the push_buf_mask is set, this field indicates the
  667. * physical address of the input buffer. Otherwise it is ignored.
  668. */
  669. uint16_t out_buf_size;
  670. /*
  671. * If bit 0 of the push_buf_mask is set, this field indicates the size
  672. * of the buffer at out_buf_addr. Otherwise it is ignored.
  673. * The client should allocate the output buffer to accommodate the
  674. * maximum expected sampling rate.
  675. */
  676. uint16_t in_buf_size;
  677. /*
  678. * If bit 1 of the push_buf_mask is set, this field indicates the size
  679. * of the input buffer at in_buff_addr. Otherwise it is ignored.
  680. */
  681. uint16_t sampling_rate;
  682. /*
  683. * If bit 1 of the push_buf_mask is set, this field indicates the
  684. * sampling rate of the input buffer. Otherwise it is ignored.
  685. * Supported values:
  686. * VSS_IVPCM_SAMPLING_RATE_8K
  687. * VSS_IVPCM_SAMPLING_RATE_16K
  688. */
  689. uint16_t num_in_channels;
  690. /*
  691. * If bit 1 of the push_buf_mask is set, this field indicates the
  692. * number of channels contained in the input buffer. Otherwise it
  693. * is ignored.
  694. * Supported values:1
  695. */
  696. } __packed;
  697. struct cvp_push_buf_cmd {
  698. struct apr_hdr hdr;
  699. struct vss_ivpcm_evt_push_buffer vpcm_evt_push_buffer;
  700. } __packed;
  701. struct cvp_start_cmd {
  702. struct apr_hdr hdr;
  703. struct vss_ivpcm_start_cmd vpcm_start_cmd;
  704. } __packed;
  705. struct cvp_stop_cmd {
  706. struct apr_hdr hdr;
  707. } __packed;
  708. struct cvs_create_passive_ctl_session_cmd {
  709. struct apr_hdr hdr;
  710. struct vss_istream_cmd_create_passive_control_session_t cvs_session;
  711. } __packed;
  712. struct cvs_create_full_ctl_session_cmd {
  713. struct apr_hdr hdr;
  714. struct vss_istream_cmd_create_full_control_session_t cvs_session;
  715. } __packed;
  716. struct cvs_destroy_session_cmd {
  717. struct apr_hdr hdr;
  718. } __packed;
  719. struct cvs_set_mute_cmd {
  720. struct apr_hdr hdr;
  721. struct vss_istream_cmd_set_mute_t cvs_set_mute;
  722. } __packed;
  723. struct cvs_set_media_type_cmd {
  724. struct apr_hdr hdr;
  725. struct vss_istream_cmd_set_media_type_t media_type;
  726. } __packed;
  727. struct cvs_send_dec_buf_cmd {
  728. struct apr_hdr hdr;
  729. struct vss_istream_evt_send_dec_buffer_t dec_buf;
  730. } __packed;
  731. struct cvs_set_amr_enc_rate_cmd {
  732. struct apr_hdr hdr;
  733. struct vss_istream_cmd_voc_amr_set_enc_rate_t amr_rate;
  734. } __packed;
  735. struct cvs_set_amrwb_enc_rate_cmd {
  736. struct apr_hdr hdr;
  737. struct vss_istream_cmd_voc_amrwb_set_enc_rate_t amrwb_rate;
  738. } __packed;
  739. struct cvs_set_cdma_enc_minmax_rate_cmd {
  740. struct apr_hdr hdr;
  741. struct vss_istream_cmd_cdma_set_enc_minmax_rate_t cdma_rate;
  742. } __packed;
  743. struct cvs_set_enc_dtx_mode_cmd {
  744. struct apr_hdr hdr;
  745. struct vss_istream_cmd_set_enc_dtx_mode_t dtx_mode;
  746. } __packed;
  747. struct cvs_register_cal_data_cmd {
  748. struct apr_hdr hdr;
  749. struct vss_istream_cmd_register_calibration_data_t cvs_cal_data;
  750. } __packed;
  751. struct cvs_deregister_cal_data_cmd {
  752. struct apr_hdr hdr;
  753. } __packed;
  754. struct cvs_set_pp_enable_cmd {
  755. struct apr_hdr hdr;
  756. struct vss_icommon_cmd_set_ui_property_enable_t vss_set_pp;
  757. } __packed;
  758. struct cvs_start_record_cmd {
  759. struct apr_hdr hdr;
  760. struct vss_istream_cmd_start_record_t rec_mode;
  761. } __packed;
  762. /* TO CVP commands */
  763. #define VSS_IVOCPROC_CMD_CREATE_FULL_CONTROL_SESSION 0x000100C3
  764. /**< Wait for APRV2_IBASIC_RSP_RESULT response. */
  765. #define APRV2_IBASIC_CMD_DESTROY_SESSION 0x0001003C
  766. #define VSS_IVOCPROC_CMD_SET_DEVICE 0x000100C4
  767. #define VSS_IVOCPROC_CMD_SET_DEVICE_V2 0x000112C6
  768. #define VSS_IVOCPROC_CMD_SET_VP3_DATA 0x000110EB
  769. #define VSS_IVOCPROC_CMD_SET_RX_VOLUME_INDEX 0x000110EE
  770. #define VSS_IVOCPROC_CMD_ENABLE 0x000100C6
  771. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  772. #define VSS_IVOCPROC_CMD_DISABLE 0x000110E1
  773. /**< No payload. Wait for APRV2_IBASIC_RSP_RESULT response. */
  774. #define VSS_IVOCPROC_CMD_REGISTER_CALIBRATION_DATA 0x00011275
  775. #define VSS_IVOCPROC_CMD_DEREGISTER_CALIBRATION_DATA 0x00011276
  776. #define VSS_IVOCPROC_CMD_REGISTER_VOLUME_CAL_TABLE 0x00011277
  777. #define VSS_IVOCPROC_CMD_DEREGISTER_VOLUME_CAL_TABLE 0x00011278
  778. #define VSS_IVOCPROC_TOPOLOGY_ID_NONE 0x00010F70
  779. #define VSS_IVOCPROC_TOPOLOGY_ID_TX_SM_ECNS 0x00010F71
  780. #define VSS_IVOCPROC_TOPOLOGY_ID_TX_DM_FLUENCE 0x00010F72
  781. #define VSS_IVOCPROC_TOPOLOGY_ID_RX_DEFAULT 0x00010F77
  782. /* Newtwork IDs */
  783. #define VSS_NETWORK_ID_DEFAULT 0x00010037
  784. #define VSS_NETWORK_ID_VOIP_NB 0x00011240
  785. #define VSS_NETWORK_ID_VOIP_WB 0x00011241
  786. #define VSS_NETWORK_ID_VOIP_WV 0x00011242
  787. /* Media types */
  788. #define VSS_MEDIA_ID_EVRC_MODEM 0x00010FC2
  789. /* 80-VF690-47 CDMA enhanced variable rate vocoder modem format. */
  790. #define VSS_MEDIA_ID_AMR_NB_MODEM 0x00010FC6
  791. /* 80-VF690-47 UMTS AMR-NB vocoder modem format. */
  792. #define VSS_MEDIA_ID_AMR_WB_MODEM 0x00010FC7
  793. /* 80-VF690-47 UMTS AMR-WB vocoder modem format. */
  794. #define VSS_MEDIA_ID_PCM_NB 0x00010FCB
  795. #define VSS_MEDIA_ID_PCM_WB 0x00010FCC
  796. /* Linear PCM (16-bit, little-endian). */
  797. #define VSS_MEDIA_ID_G711_ALAW 0x00010FCD
  798. /* G.711 a-law (contains two 10ms vocoder frames). */
  799. #define VSS_MEDIA_ID_G711_MULAW 0x00010FCE
  800. /* G.711 mu-law (contains two 10ms vocoder frames). */
  801. #define VSS_MEDIA_ID_G729 0x00010FD0
  802. /* G.729AB (contains two 10ms vocoder frames. */
  803. #define VSS_MEDIA_ID_4GV_NB_MODEM 0x00010FC3
  804. /*CDMA EVRC-B vocoder modem format */
  805. #define VSS_MEDIA_ID_4GV_WB_MODEM 0x00010FC4
  806. /*CDMA EVRC-WB vocoder modem format */
  807. #define VSS_IVOCPROC_CMD_SET_MUTE 0x000110EF
  808. #define VOICE_CMD_SET_PARAM 0x00011006
  809. #define VOICE_CMD_GET_PARAM 0x00011007
  810. #define VOICE_EVT_GET_PARAM_ACK 0x00011008
  811. /* Default AFE port ID. Applicable to Tx and Rx. */
  812. #define VSS_IVOCPROC_PORT_ID_NONE 0xFFFF
  813. struct vss_ivocproc_cmd_create_full_control_session_t {
  814. uint16_t direction;
  815. /*
  816. * stream direction.
  817. * 0 : TX only
  818. * 1 : RX only
  819. * 2 : TX and RX
  820. */
  821. uint32_t tx_port_id;
  822. /*
  823. * TX device port ID which vocproc will connect to. If not supplying a
  824. * port ID set to VSS_IVOCPROC_PORT_ID_NONE.
  825. */
  826. uint32_t tx_topology_id;
  827. /*
  828. * Tx leg topology ID. If not supplying a topology ID set to
  829. * VSS_IVOCPROC_TOPOLOGY_ID_NONE.
  830. */
  831. uint32_t rx_port_id;
  832. /*
  833. * RX device port ID which vocproc will connect to. If not supplying a
  834. * port ID set to VSS_IVOCPROC_PORT_ID_NONE.
  835. */
  836. uint32_t rx_topology_id;
  837. /*
  838. * Rx leg topology ID. If not supplying a topology ID set to
  839. * VSS_IVOCPROC_TOPOLOGY_ID_NONE.
  840. */
  841. int32_t network_id;
  842. /*
  843. * Network ID. (Refer to VSS_NETWORK_ID_XXX). If not supplying a network
  844. * ID set to VSS_NETWORK_ID_DEFAULT.
  845. */
  846. } __packed;
  847. struct vss_ivocproc_cmd_set_volume_index_t {
  848. uint16_t vol_index;
  849. /**<
  850. * Volume index utilized by the vocproc to index into the volume table
  851. * provided in VSS_IVOCPROC_CMD_CACHE_VOLUME_CALIBRATION_TABLE and set
  852. * volume on the VDSP.
  853. */
  854. } __packed;
  855. struct vss_ivocproc_cmd_set_device_t {
  856. uint32_t tx_port_id;
  857. /**<
  858. * TX device port ID which vocproc will connect to.
  859. * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port.
  860. */
  861. uint32_t tx_topology_id;
  862. /**<
  863. * TX leg topology ID.
  864. * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any
  865. * pre/post-processing blocks and is pass-through.
  866. */
  867. int32_t rx_port_id;
  868. /**<
  869. * RX device port ID which vocproc will connect to.
  870. * VSS_IVOCPROC_PORT_ID_NONE means vocproc will not connect to any port.
  871. */
  872. uint32_t rx_topology_id;
  873. /**<
  874. * RX leg topology ID.
  875. * VSS_IVOCPROC_TOPOLOGY_ID_NONE means vocproc does not contain any
  876. * pre/post-processing blocks and is pass-through.
  877. */
  878. } __packed;
  879. /* Internal EC */
  880. #define VSS_IVOCPROC_VOCPROC_MODE_EC_INT_MIXING 0x00010F7C
  881. /* External EC */
  882. #define VSS_IVOCPROC_VOCPROC_MODE_EC_EXT_MIXING 0x00010F7D
  883. struct vss_ivocproc_cmd_set_device_v2_t {
  884. uint16_t tx_port_id;
  885. /* Tx device port ID to which the vocproc connects. */
  886. uint32_t tx_topology_id;
  887. /* Tx path topology ID. */
  888. uint16_t rx_port_id;
  889. /* Rx device port ID to which the vocproc connects. */
  890. uint32_t rx_topology_id;
  891. /* Rx path topology ID. */
  892. uint32_t vocproc_mode;
  893. /* Vocproc mode. The supported values:
  894. * VSS_IVOCPROC_VOCPROC_MODE_EC_INT_MIXING - 0x00010F7C
  895. * VSS_IVOCPROC_VOCPROC_MODE_EC_EXT_MIXING - 0x00010F7D
  896. */
  897. uint16_t ec_ref_port_id;
  898. /* Port ID to which the vocproc connects for receiving
  899. * echo cancellation reference signal.
  900. */
  901. } __packed;
  902. struct vss_ivocproc_cmd_register_calibration_data_t {
  903. uint32_t phys_addr;
  904. /* Phsical address to be registered with vocproc. Calibration data
  905. * is stored at this address.
  906. */
  907. uint32_t mem_size;
  908. /* Size of the calibration data in bytes. */
  909. } __packed;
  910. struct vss_ivocproc_cmd_register_volume_cal_table_t {
  911. uint32_t phys_addr;
  912. /* Phsical address to be registered with the vocproc. The volume
  913. * calibration table is stored at this location.
  914. */
  915. uint32_t mem_size;
  916. /* Size of the volume calibration table in bytes. */
  917. } __packed;
  918. struct vss_ivocproc_cmd_set_mute_t {
  919. uint16_t direction;
  920. /*
  921. * 0 : TX only.
  922. * 1 : RX only.
  923. * 2 : TX and Rx.
  924. */
  925. uint16_t mute_flag;
  926. /*
  927. * Mute, un-mute.
  928. *
  929. * 0 : Disable.
  930. * 1 : Enable.
  931. */
  932. } __packed;
  933. struct cvp_create_full_ctl_session_cmd {
  934. struct apr_hdr hdr;
  935. struct vss_ivocproc_cmd_create_full_control_session_t cvp_session;
  936. } __packed;
  937. struct cvp_command {
  938. struct apr_hdr hdr;
  939. } __packed;
  940. struct cvp_set_device_cmd {
  941. struct apr_hdr hdr;
  942. struct vss_ivocproc_cmd_set_device_t cvp_set_device;
  943. } __packed;
  944. struct cvp_set_device_cmd_v2 {
  945. struct apr_hdr hdr;
  946. struct vss_ivocproc_cmd_set_device_v2_t cvp_set_device_v2;
  947. } __packed;
  948. struct cvp_set_vp3_data_cmd {
  949. struct apr_hdr hdr;
  950. } __packed;
  951. struct cvp_set_rx_volume_index_cmd {
  952. struct apr_hdr hdr;
  953. struct vss_ivocproc_cmd_set_volume_index_t cvp_set_vol_idx;
  954. } __packed;
  955. struct cvp_register_cal_data_cmd {
  956. struct apr_hdr hdr;
  957. struct vss_ivocproc_cmd_register_calibration_data_t cvp_cal_data;
  958. } __packed;
  959. struct cvp_deregister_cal_data_cmd {
  960. struct apr_hdr hdr;
  961. } __packed;
  962. struct cvp_register_vol_cal_table_cmd {
  963. struct apr_hdr hdr;
  964. struct vss_ivocproc_cmd_register_volume_cal_table_t cvp_vol_cal_tbl;
  965. } __packed;
  966. struct cvp_deregister_vol_cal_table_cmd {
  967. struct apr_hdr hdr;
  968. } __packed;
  969. struct cvp_set_mute_cmd {
  970. struct apr_hdr hdr;
  971. struct vss_ivocproc_cmd_set_mute_t cvp_set_mute;
  972. } __packed;
  973. /* CB for up-link packets. */
  974. typedef void (*ul_cb_fn)(uint8_t *voc_pkt,
  975. uint32_t pkt_len,
  976. void *private_data);
  977. /* CB for down-link packets. */
  978. typedef void (*dl_cb_fn)(uint8_t *voc_pkt,
  979. uint32_t *pkt_len,
  980. void *private_data);
  981. /* CB for DTMF RX Detection */
  982. typedef void (*dtmf_rx_det_cb_fn)(uint8_t *pkt,
  983. char *session,
  984. void *private_data);
  985. typedef void (*hostpcm_cb_fn)(uint8_t *data,
  986. char *session,
  987. void *private_data);
  988. struct mvs_driver_info {
  989. uint32_t media_type;
  990. uint32_t rate;
  991. uint32_t network_type;
  992. uint32_t dtx_mode;
  993. ul_cb_fn ul_cb;
  994. dl_cb_fn dl_cb;
  995. void *private_data;
  996. };
  997. struct dtmf_driver_info {
  998. dtmf_rx_det_cb_fn dtmf_rx_ul_cb;
  999. void *private_data;
  1000. };
  1001. struct hostpcm_driver_info {
  1002. hostpcm_cb_fn hostpcm_evt_cb;
  1003. void *private_data;
  1004. };
  1005. struct incall_rec_info {
  1006. uint32_t rec_enable;
  1007. uint32_t rec_mode;
  1008. uint32_t recording;
  1009. };
  1010. struct incall_music_info {
  1011. uint32_t play_enable;
  1012. uint32_t playing;
  1013. int count;
  1014. int force;
  1015. };
  1016. struct voice_data {
  1017. int voc_state;/*INIT, CHANGE, RELEASE, RUN */
  1018. wait_queue_head_t mvm_wait;
  1019. wait_queue_head_t cvs_wait;
  1020. wait_queue_head_t cvp_wait;
  1021. /* cache the values related to Rx and Tx */
  1022. struct device_data dev_rx;
  1023. struct device_data dev_tx;
  1024. u32 mvm_state;
  1025. u32 cvs_state;
  1026. u32 cvp_state;
  1027. /* Handle to MVM in the Q6 */
  1028. u16 mvm_handle;
  1029. /* Handle to CVS in the Q6 */
  1030. u16 cvs_handle;
  1031. /* Handle to CVP in the Q6 */
  1032. u16 cvp_handle;
  1033. struct mutex lock;
  1034. uint16_t sidetone_gain;
  1035. uint8_t tty_mode;
  1036. /* widevoice enable value */
  1037. uint8_t wv_enable;
  1038. /* slowtalk enable value */
  1039. uint32_t st_enable;
  1040. /* FENC enable value */
  1041. uint32_t fens_enable;
  1042. uint32_t dtmf_rx_detect_en;
  1043. bool disable_topology;
  1044. struct voice_dev_route_state voc_route_state;
  1045. u16 session_id;
  1046. struct incall_rec_info rec_info;
  1047. struct incall_music_info music_info;
  1048. struct voice_rec_route_state rec_route_state;
  1049. };
  1050. struct cal_mem {
  1051. /* Physical Address */
  1052. uint32_t paddr;
  1053. /* Kernel Virtual Address */
  1054. uint32_t kvaddr;
  1055. };
  1056. struct cal_data {
  1057. struct cal_mem cal_data[NUM_VOICE_CAL_TYPES];
  1058. };
  1059. #define MAX_VOC_SESSIONS 4
  1060. #define SESSION_ID_BASE 0xFFF0
  1061. struct common_data {
  1062. /* these default values are for all devices */
  1063. uint32_t default_mute_val;
  1064. uint32_t default_vol_val;
  1065. uint32_t default_sample_val;
  1066. bool ec_ref_ext;
  1067. uint16_t ec_port_id;
  1068. /* APR to MVM in the Q6 */
  1069. void *apr_q6_mvm;
  1070. /* APR to CVS in the Q6 */
  1071. void *apr_q6_cvs;
  1072. /* APR to CVP in the Q6 */
  1073. void *apr_q6_cvp;
  1074. struct ion_client *ion_client;
  1075. struct ion_handle *ion_handle;
  1076. struct cal_data voice_cal[NUM_VOICE_CAL_BUFFERS];
  1077. struct mutex common_lock;
  1078. struct mvs_driver_info mvs_info;
  1079. struct dtmf_driver_info dtmf_info;
  1080. struct hostpcm_driver_info hostpcm_info;
  1081. struct voice_data voice[MAX_VOC_SESSIONS];
  1082. };
  1083. void voc_register_mvs_cb(ul_cb_fn ul_cb,
  1084. dl_cb_fn dl_cb,
  1085. void *private_data);
  1086. void voc_register_dtmf_rx_detection_cb(dtmf_rx_det_cb_fn dtmf_rx_ul_cb,
  1087. void *private_data);
  1088. void voc_register_hpcm_evt_cb(dtmf_rx_det_cb_fn dtmf_rx_ul_cb,
  1089. void *private_data);
  1090. void voc_config_vocoder(uint32_t media_type,
  1091. uint32_t rate,
  1092. uint32_t network_type,
  1093. uint32_t dtx_mode);
  1094. enum {
  1095. DEV_RX = 0,
  1096. DEV_TX,
  1097. };
  1098. enum {
  1099. RX_PATH = 0,
  1100. TX_PATH,
  1101. };
  1102. /* called by alsa driver */
  1103. int voc_set_pp_enable(uint16_t session_id, uint32_t module_id, uint32_t enable);
  1104. int voc_get_pp_enable(uint16_t session_id, uint32_t module_id);
  1105. int voc_set_widevoice_enable(uint16_t session_id, uint32_t wv_enable);
  1106. uint32_t voc_get_widevoice_enable(uint16_t session_id);
  1107. uint8_t voc_get_tty_mode(uint16_t session_id);
  1108. int voc_set_tty_mode(uint16_t session_id, uint8_t tty_mode);
  1109. int voc_start_voice_call(uint16_t session_id);
  1110. int voc_standby_voice_call(uint16_t session_id);
  1111. int voc_resume_voice_call(uint16_t session_id);
  1112. int voc_end_voice_call(uint16_t session_id);
  1113. int voc_set_rxtx_port(uint16_t session_id,
  1114. uint32_t dev_port_id,
  1115. uint32_t dev_type);
  1116. int voc_set_rx_vol_index(uint16_t session_id, uint32_t dir, uint32_t voc_idx);
  1117. int voc_set_tx_mute(uint16_t session_id, uint32_t dir, uint32_t mute);
  1118. int voc_set_rx_device_mute(uint16_t session_id, uint32_t mute);
  1119. int voc_get_rx_device_mute(uint16_t session_id);
  1120. int voc_disable_topology(uint16_t session_id, uint32_t disable);
  1121. int voc_disable_cvp(uint16_t session_id);
  1122. int voc_enable_cvp(uint16_t session_id);
  1123. int voc_set_route_flag(uint16_t session_id, uint8_t path_dir, uint8_t set);
  1124. uint8_t voc_get_route_flag(uint16_t session_id, uint8_t path_dir);
  1125. int voc_enable_dtmf_rx_detection(uint16_t session_id, uint32_t enable);
  1126. void voc_disable_dtmf_det_on_active_sessions(void);
  1127. int voc_send_cvp_map_vocpcm_memory(u16 session_id, uint32_t paddr,
  1128. uint32_t bufsize);
  1129. int voc_send_cvp_unmap_vocpcm_memory(u16 session_id, uint32_t paddr);
  1130. int voc_send_cvp_start_vocpcm(u16 session_id,
  1131. struct vss_ivpcm_tap_point *vpcm_tp, uint32_t no_of_tp);
  1132. int voc_send_cvp_stop_vocpcm(u16 session_id);
  1133. int voc_send_cvp_vocpcm_push_buf_evt(u16 session_id,
  1134. struct vss_ivpcm_evt_push_buffer *push_buff_evt);
  1135. #define MAX_SESSION_NAME_LEN 32
  1136. #define VOICE_SESSION_NAME "Voice session"
  1137. #define VOIP_SESSION_NAME "VoIP session"
  1138. #define VOLTE_SESSION_NAME "VoLTE session"
  1139. #define VOICE2_SESSION_NAME "Voice2 session"
  1140. #define VOC_PATH_PASSIVE 0
  1141. #define VOC_PATH_FULL 1
  1142. #define VOC_PATH_VOLTE_PASSIVE 2
  1143. #define VOC_PATH_VOICE2_PASSIVE 3
  1144. uint16_t voc_get_session_id(char *name);
  1145. int voc_start_playback(uint32_t set);
  1146. int voc_start_record(uint32_t port_id, uint32_t set);
  1147. int voc_set_ext_ec_ref(uint16_t port_id, bool state);
  1148. #endif