q6audio-v2.c 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807
  1. /* Copyright (c) 2012-2017, 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. #include <linux/slab.h>
  13. #include <linux/wait.h>
  14. #include <linux/sched.h>
  15. #include <linux/jiffies.h>
  16. #include <linux/uaccess.h>
  17. #include <linux/atomic.h>
  18. #include <dsp/q6afe-v2.h>
  19. #include <dsp/q6audio-v2.h>
  20. int q6audio_get_port_index(u16 port_id)
  21. {
  22. switch (port_id) {
  23. case PRIMARY_I2S_RX: return IDX_PRIMARY_I2S_RX;
  24. case PRIMARY_I2S_TX: return IDX_PRIMARY_I2S_TX;
  25. case AFE_PORT_ID_PRIMARY_PCM_RX:
  26. return IDX_AFE_PORT_ID_PRIMARY_PCM_RX;
  27. case AFE_PORT_ID_PRIMARY_PCM_TX:
  28. return IDX_AFE_PORT_ID_PRIMARY_PCM_TX;
  29. case AFE_PORT_ID_SECONDARY_PCM_RX:
  30. return IDX_AFE_PORT_ID_SECONDARY_PCM_RX;
  31. case AFE_PORT_ID_SECONDARY_PCM_TX:
  32. return IDX_AFE_PORT_ID_SECONDARY_PCM_TX;
  33. case AFE_PORT_ID_TERTIARY_PCM_RX:
  34. return IDX_AFE_PORT_ID_TERTIARY_PCM_RX;
  35. case AFE_PORT_ID_TERTIARY_PCM_TX:
  36. return IDX_AFE_PORT_ID_TERTIARY_PCM_TX;
  37. case AFE_PORT_ID_QUATERNARY_PCM_RX:
  38. return IDX_AFE_PORT_ID_QUATERNARY_PCM_RX;
  39. case AFE_PORT_ID_QUATERNARY_PCM_TX:
  40. return IDX_AFE_PORT_ID_QUATERNARY_PCM_TX;
  41. case SECONDARY_I2S_RX: return IDX_SECONDARY_I2S_RX;
  42. case SECONDARY_I2S_TX: return IDX_SECONDARY_I2S_TX;
  43. case MI2S_RX: return IDX_MI2S_RX;
  44. case MI2S_TX: return IDX_MI2S_TX;
  45. case HDMI_RX: return IDX_HDMI_RX;
  46. case DISPLAY_PORT_RX: return IDX_DISPLAY_PORT_RX;
  47. case AFE_PORT_ID_SPDIF_RX: return IDX_SPDIF_RX;
  48. case RSVD_2: return IDX_RSVD_2;
  49. case RSVD_3: return IDX_RSVD_3;
  50. case DIGI_MIC_TX: return IDX_DIGI_MIC_TX;
  51. case VOICE_RECORD_RX: return IDX_VOICE_RECORD_RX;
  52. case VOICE_RECORD_TX: return IDX_VOICE_RECORD_TX;
  53. case VOICE_PLAYBACK_TX: return IDX_VOICE_PLAYBACK_TX;
  54. case VOICE2_PLAYBACK_TX: return IDX_VOICE2_PLAYBACK_TX;
  55. case SLIMBUS_0_RX: return IDX_SLIMBUS_0_RX;
  56. case SLIMBUS_0_TX: return IDX_SLIMBUS_0_TX;
  57. case SLIMBUS_1_RX: return IDX_SLIMBUS_1_RX;
  58. case SLIMBUS_1_TX: return IDX_SLIMBUS_1_TX;
  59. case SLIMBUS_2_RX: return IDX_SLIMBUS_2_RX;
  60. case SLIMBUS_2_TX: return IDX_SLIMBUS_2_TX;
  61. case SLIMBUS_3_RX: return IDX_SLIMBUS_3_RX;
  62. case SLIMBUS_3_TX: return IDX_SLIMBUS_3_TX;
  63. case SLIMBUS_4_RX: return IDX_SLIMBUS_4_RX;
  64. case SLIMBUS_4_TX: return IDX_SLIMBUS_4_TX;
  65. case SLIMBUS_5_RX: return IDX_SLIMBUS_5_RX;
  66. case SLIMBUS_5_TX: return IDX_SLIMBUS_5_TX;
  67. case SLIMBUS_6_RX: return IDX_SLIMBUS_6_RX;
  68. case SLIMBUS_6_TX: return IDX_SLIMBUS_6_TX;
  69. case SLIMBUS_7_RX: return IDX_SLIMBUS_7_RX;
  70. case SLIMBUS_7_TX: return IDX_SLIMBUS_7_TX;
  71. case SLIMBUS_8_RX: return IDX_SLIMBUS_8_RX;
  72. case SLIMBUS_8_TX: return IDX_SLIMBUS_8_TX;
  73. case INT_BT_SCO_RX: return IDX_INT_BT_SCO_RX;
  74. case INT_BT_SCO_TX: return IDX_INT_BT_SCO_TX;
  75. case INT_BT_A2DP_RX: return IDX_INT_BT_A2DP_RX;
  76. case INT_FM_RX: return IDX_INT_FM_RX;
  77. case INT_FM_TX: return IDX_INT_FM_TX;
  78. case RT_PROXY_PORT_001_RX: return IDX_RT_PROXY_PORT_001_RX;
  79. case RT_PROXY_PORT_001_TX: return IDX_RT_PROXY_PORT_001_TX;
  80. case AFE_PORT_ID_PRIMARY_MI2S_RX:
  81. return IDX_AFE_PORT_ID_PRIMARY_MI2S_RX;
  82. case AFE_PORT_ID_PRIMARY_MI2S_TX:
  83. return IDX_AFE_PORT_ID_PRIMARY_MI2S_TX;
  84. case AFE_PORT_ID_QUATERNARY_MI2S_RX:
  85. return IDX_AFE_PORT_ID_QUATERNARY_MI2S_RX;
  86. case AFE_PORT_ID_QUATERNARY_MI2S_TX:
  87. return IDX_AFE_PORT_ID_QUATERNARY_MI2S_TX;
  88. case AFE_PORT_ID_SECONDARY_MI2S_RX:
  89. return IDX_AFE_PORT_ID_SECONDARY_MI2S_RX;
  90. case AFE_PORT_ID_SECONDARY_MI2S_TX:
  91. return IDX_AFE_PORT_ID_SECONDARY_MI2S_TX;
  92. case AFE_PORT_ID_TERTIARY_MI2S_RX:
  93. return IDX_AFE_PORT_ID_TERTIARY_MI2S_RX;
  94. case AFE_PORT_ID_TERTIARY_MI2S_TX:
  95. return IDX_AFE_PORT_ID_TERTIARY_MI2S_TX;
  96. case AUDIO_PORT_ID_I2S_RX:
  97. return IDX_AUDIO_PORT_ID_I2S_RX;
  98. case AFE_PORT_ID_SECONDARY_MI2S_RX_SD1:
  99. return IDX_AFE_PORT_ID_SECONDARY_MI2S_RX_SD1;
  100. case AFE_PORT_ID_PRIMARY_TDM_RX:
  101. return IDX_AFE_PORT_ID_PRIMARY_TDM_RX_0;
  102. case AFE_PORT_ID_PRIMARY_TDM_TX:
  103. return IDX_AFE_PORT_ID_PRIMARY_TDM_TX_0;
  104. case AFE_PORT_ID_PRIMARY_TDM_RX_1:
  105. return IDX_AFE_PORT_ID_PRIMARY_TDM_RX_1;
  106. case AFE_PORT_ID_PRIMARY_TDM_TX_1:
  107. return IDX_AFE_PORT_ID_PRIMARY_TDM_TX_1;
  108. case AFE_PORT_ID_PRIMARY_TDM_RX_2:
  109. return IDX_AFE_PORT_ID_PRIMARY_TDM_RX_2;
  110. case AFE_PORT_ID_PRIMARY_TDM_TX_2:
  111. return IDX_AFE_PORT_ID_PRIMARY_TDM_TX_2;
  112. case AFE_PORT_ID_PRIMARY_TDM_RX_3:
  113. return IDX_AFE_PORT_ID_PRIMARY_TDM_RX_3;
  114. case AFE_PORT_ID_PRIMARY_TDM_TX_3:
  115. return IDX_AFE_PORT_ID_PRIMARY_TDM_TX_3;
  116. case AFE_PORT_ID_PRIMARY_TDM_RX_4:
  117. return IDX_AFE_PORT_ID_PRIMARY_TDM_RX_4;
  118. case AFE_PORT_ID_PRIMARY_TDM_TX_4:
  119. return IDX_AFE_PORT_ID_PRIMARY_TDM_TX_4;
  120. case AFE_PORT_ID_PRIMARY_TDM_RX_5:
  121. return IDX_AFE_PORT_ID_PRIMARY_TDM_RX_5;
  122. case AFE_PORT_ID_PRIMARY_TDM_TX_5:
  123. return IDX_AFE_PORT_ID_PRIMARY_TDM_TX_5;
  124. case AFE_PORT_ID_PRIMARY_TDM_RX_6:
  125. return IDX_AFE_PORT_ID_PRIMARY_TDM_RX_6;
  126. case AFE_PORT_ID_PRIMARY_TDM_TX_6:
  127. return IDX_AFE_PORT_ID_PRIMARY_TDM_TX_6;
  128. case AFE_PORT_ID_PRIMARY_TDM_RX_7:
  129. return IDX_AFE_PORT_ID_PRIMARY_TDM_RX_7;
  130. case AFE_PORT_ID_PRIMARY_TDM_TX_7:
  131. return IDX_AFE_PORT_ID_PRIMARY_TDM_TX_7;
  132. case AFE_PORT_ID_SECONDARY_TDM_RX:
  133. return IDX_AFE_PORT_ID_SECONDARY_TDM_RX_0;
  134. case AFE_PORT_ID_SECONDARY_TDM_TX:
  135. return IDX_AFE_PORT_ID_SECONDARY_TDM_TX_0;
  136. case AFE_PORT_ID_SECONDARY_TDM_RX_1:
  137. return IDX_AFE_PORT_ID_SECONDARY_TDM_RX_1;
  138. case AFE_PORT_ID_SECONDARY_TDM_TX_1:
  139. return IDX_AFE_PORT_ID_SECONDARY_TDM_TX_1;
  140. case AFE_PORT_ID_SECONDARY_TDM_RX_2:
  141. return IDX_AFE_PORT_ID_SECONDARY_TDM_RX_2;
  142. case AFE_PORT_ID_SECONDARY_TDM_TX_2:
  143. return IDX_AFE_PORT_ID_SECONDARY_TDM_TX_2;
  144. case AFE_PORT_ID_SECONDARY_TDM_RX_3:
  145. return IDX_AFE_PORT_ID_SECONDARY_TDM_RX_3;
  146. case AFE_PORT_ID_SECONDARY_TDM_TX_3:
  147. return IDX_AFE_PORT_ID_SECONDARY_TDM_TX_3;
  148. case AFE_PORT_ID_SECONDARY_TDM_RX_4:
  149. return IDX_AFE_PORT_ID_SECONDARY_TDM_RX_4;
  150. case AFE_PORT_ID_SECONDARY_TDM_TX_4:
  151. return IDX_AFE_PORT_ID_SECONDARY_TDM_TX_4;
  152. case AFE_PORT_ID_SECONDARY_TDM_RX_5:
  153. return IDX_AFE_PORT_ID_SECONDARY_TDM_RX_5;
  154. case AFE_PORT_ID_SECONDARY_TDM_TX_5:
  155. return IDX_AFE_PORT_ID_SECONDARY_TDM_TX_5;
  156. case AFE_PORT_ID_SECONDARY_TDM_RX_6:
  157. return IDX_AFE_PORT_ID_SECONDARY_TDM_RX_6;
  158. case AFE_PORT_ID_SECONDARY_TDM_TX_6:
  159. return IDX_AFE_PORT_ID_SECONDARY_TDM_TX_6;
  160. case AFE_PORT_ID_SECONDARY_TDM_RX_7:
  161. return IDX_AFE_PORT_ID_SECONDARY_TDM_RX_7;
  162. case AFE_PORT_ID_SECONDARY_TDM_TX_7:
  163. return IDX_AFE_PORT_ID_SECONDARY_TDM_TX_7;
  164. case AFE_PORT_ID_TERTIARY_TDM_RX:
  165. return IDX_AFE_PORT_ID_TERTIARY_TDM_RX_0;
  166. case AFE_PORT_ID_TERTIARY_TDM_TX:
  167. return IDX_AFE_PORT_ID_TERTIARY_TDM_TX_0;
  168. case AFE_PORT_ID_TERTIARY_TDM_RX_1:
  169. return IDX_AFE_PORT_ID_TERTIARY_TDM_RX_1;
  170. case AFE_PORT_ID_TERTIARY_TDM_TX_1:
  171. return IDX_AFE_PORT_ID_TERTIARY_TDM_TX_1;
  172. case AFE_PORT_ID_TERTIARY_TDM_RX_2:
  173. return IDX_AFE_PORT_ID_TERTIARY_TDM_RX_2;
  174. case AFE_PORT_ID_TERTIARY_TDM_TX_2:
  175. return IDX_AFE_PORT_ID_TERTIARY_TDM_TX_2;
  176. case AFE_PORT_ID_TERTIARY_TDM_RX_3:
  177. return IDX_AFE_PORT_ID_TERTIARY_TDM_RX_3;
  178. case AFE_PORT_ID_TERTIARY_TDM_TX_3:
  179. return IDX_AFE_PORT_ID_TERTIARY_TDM_TX_3;
  180. case AFE_PORT_ID_TERTIARY_TDM_RX_4:
  181. return IDX_AFE_PORT_ID_TERTIARY_TDM_RX_4;
  182. case AFE_PORT_ID_TERTIARY_TDM_TX_4:
  183. return IDX_AFE_PORT_ID_TERTIARY_TDM_TX_4;
  184. case AFE_PORT_ID_TERTIARY_TDM_RX_5:
  185. return IDX_AFE_PORT_ID_TERTIARY_TDM_RX_5;
  186. case AFE_PORT_ID_TERTIARY_TDM_TX_5:
  187. return IDX_AFE_PORT_ID_TERTIARY_TDM_TX_5;
  188. case AFE_PORT_ID_TERTIARY_TDM_RX_6:
  189. return IDX_AFE_PORT_ID_TERTIARY_TDM_RX_6;
  190. case AFE_PORT_ID_TERTIARY_TDM_TX_6:
  191. return IDX_AFE_PORT_ID_TERTIARY_TDM_TX_6;
  192. case AFE_PORT_ID_TERTIARY_TDM_RX_7:
  193. return IDX_AFE_PORT_ID_TERTIARY_TDM_RX_7;
  194. case AFE_PORT_ID_TERTIARY_TDM_TX_7:
  195. return IDX_AFE_PORT_ID_TERTIARY_TDM_TX_7;
  196. case AFE_PORT_ID_QUATERNARY_TDM_RX:
  197. return IDX_AFE_PORT_ID_QUATERNARY_TDM_RX_0;
  198. case AFE_PORT_ID_QUATERNARY_TDM_TX:
  199. return IDX_AFE_PORT_ID_QUATERNARY_TDM_TX_0;
  200. case AFE_PORT_ID_QUATERNARY_TDM_RX_1:
  201. return IDX_AFE_PORT_ID_QUATERNARY_TDM_RX_1;
  202. case AFE_PORT_ID_QUATERNARY_TDM_TX_1:
  203. return IDX_AFE_PORT_ID_QUATERNARY_TDM_TX_1;
  204. case AFE_PORT_ID_QUATERNARY_TDM_RX_2:
  205. return IDX_AFE_PORT_ID_QUATERNARY_TDM_RX_2;
  206. case AFE_PORT_ID_QUATERNARY_TDM_TX_2:
  207. return IDX_AFE_PORT_ID_QUATERNARY_TDM_TX_2;
  208. case AFE_PORT_ID_QUATERNARY_TDM_RX_3:
  209. return IDX_AFE_PORT_ID_QUATERNARY_TDM_RX_3;
  210. case AFE_PORT_ID_QUATERNARY_TDM_TX_3:
  211. return IDX_AFE_PORT_ID_QUATERNARY_TDM_TX_3;
  212. case AFE_PORT_ID_QUATERNARY_TDM_RX_4:
  213. return IDX_AFE_PORT_ID_QUATERNARY_TDM_RX_4;
  214. case AFE_PORT_ID_QUATERNARY_TDM_TX_4:
  215. return IDX_AFE_PORT_ID_QUATERNARY_TDM_TX_4;
  216. case AFE_PORT_ID_QUATERNARY_TDM_RX_5:
  217. return IDX_AFE_PORT_ID_QUATERNARY_TDM_RX_5;
  218. case AFE_PORT_ID_QUATERNARY_TDM_TX_5:
  219. return IDX_AFE_PORT_ID_QUATERNARY_TDM_TX_5;
  220. case AFE_PORT_ID_QUATERNARY_TDM_RX_6:
  221. return IDX_AFE_PORT_ID_QUATERNARY_TDM_RX_6;
  222. case AFE_PORT_ID_QUATERNARY_TDM_TX_6:
  223. return IDX_AFE_PORT_ID_QUATERNARY_TDM_TX_6;
  224. case AFE_PORT_ID_QUATERNARY_TDM_RX_7:
  225. return IDX_AFE_PORT_ID_QUATERNARY_TDM_RX_7;
  226. case AFE_PORT_ID_QUATERNARY_TDM_TX_7:
  227. return IDX_AFE_PORT_ID_QUATERNARY_TDM_TX_7;
  228. case AFE_PORT_ID_SENARY_MI2S_TX:
  229. return IDX_AFE_PORT_ID_SENARY_MI2S_TX;
  230. case AFE_PORT_ID_USB_RX:
  231. return IDX_AFE_PORT_ID_USB_RX;
  232. case AFE_PORT_ID_USB_TX:
  233. return IDX_AFE_PORT_ID_USB_TX;
  234. case AFE_PORT_ID_INT0_MI2S_RX:
  235. return IDX_AFE_PORT_ID_INT0_MI2S_RX;
  236. case AFE_PORT_ID_INT0_MI2S_TX:
  237. return IDX_AFE_PORT_ID_INT0_MI2S_TX;
  238. case AFE_PORT_ID_INT1_MI2S_RX:
  239. return IDX_AFE_PORT_ID_INT1_MI2S_RX;
  240. case AFE_PORT_ID_INT1_MI2S_TX:
  241. return IDX_AFE_PORT_ID_INT1_MI2S_TX;
  242. case AFE_PORT_ID_INT2_MI2S_RX:
  243. return IDX_AFE_PORT_ID_INT2_MI2S_RX;
  244. case AFE_PORT_ID_INT2_MI2S_TX:
  245. return IDX_AFE_PORT_ID_INT2_MI2S_TX;
  246. case AFE_PORT_ID_INT3_MI2S_RX:
  247. return IDX_AFE_PORT_ID_INT3_MI2S_RX;
  248. case AFE_PORT_ID_INT3_MI2S_TX:
  249. return IDX_AFE_PORT_ID_INT3_MI2S_TX;
  250. case AFE_PORT_ID_INT4_MI2S_RX:
  251. return IDX_AFE_PORT_ID_INT4_MI2S_RX;
  252. case AFE_PORT_ID_INT4_MI2S_TX:
  253. return IDX_AFE_PORT_ID_INT4_MI2S_TX;
  254. case AFE_PORT_ID_INT5_MI2S_RX:
  255. return IDX_AFE_PORT_ID_INT5_MI2S_RX;
  256. case AFE_PORT_ID_INT5_MI2S_TX:
  257. return IDX_AFE_PORT_ID_INT5_MI2S_TX;
  258. case AFE_PORT_ID_INT6_MI2S_RX:
  259. return IDX_AFE_PORT_ID_INT6_MI2S_RX;
  260. case AFE_PORT_ID_INT6_MI2S_TX:
  261. return IDX_AFE_PORT_ID_INT6_MI2S_TX;
  262. default: return -EINVAL;
  263. }
  264. }
  265. int q6audio_get_port_id(u16 port_id)
  266. {
  267. switch (port_id) {
  268. case PRIMARY_I2S_RX: return PRIMARY_I2S_RX;
  269. case PRIMARY_I2S_TX: return PRIMARY_I2S_TX;
  270. case AFE_PORT_ID_PRIMARY_PCM_RX:
  271. return AFE_PORT_ID_PRIMARY_PCM_RX;
  272. case AFE_PORT_ID_PRIMARY_PCM_TX:
  273. return AFE_PORT_ID_PRIMARY_PCM_TX;
  274. case AFE_PORT_ID_SECONDARY_PCM_RX:
  275. return AFE_PORT_ID_SECONDARY_PCM_RX;
  276. case AFE_PORT_ID_SECONDARY_PCM_TX:
  277. return AFE_PORT_ID_SECONDARY_PCM_TX;
  278. case AFE_PORT_ID_TERTIARY_PCM_RX:
  279. return AFE_PORT_ID_TERTIARY_PCM_RX;
  280. case AFE_PORT_ID_TERTIARY_PCM_TX:
  281. return AFE_PORT_ID_TERTIARY_PCM_TX;
  282. case AFE_PORT_ID_QUATERNARY_PCM_RX:
  283. return AFE_PORT_ID_QUATERNARY_PCM_RX;
  284. case AFE_PORT_ID_QUATERNARY_PCM_TX:
  285. return AFE_PORT_ID_QUATERNARY_PCM_TX;
  286. case SECONDARY_I2S_RX: return AFE_PORT_ID_SECONDARY_MI2S_RX;
  287. case SECONDARY_I2S_TX: return AFE_PORT_ID_SECONDARY_MI2S_TX;
  288. case MI2S_RX: return AFE_PORT_ID_PRIMARY_MI2S_RX;
  289. case MI2S_TX: return AFE_PORT_ID_PRIMARY_MI2S_TX;
  290. case HDMI_RX: return AFE_PORT_ID_MULTICHAN_HDMI_RX;
  291. case DISPLAY_PORT_RX:
  292. return AFE_PORT_ID_HDMI_OVER_DP_RX;
  293. case AFE_PORT_ID_SPDIF_RX: return AFE_PORT_ID_SPDIF_RX;
  294. case RSVD_2: return IDX_RSVD_2;
  295. case RSVD_3: return IDX_RSVD_3;
  296. case DIGI_MIC_TX: return AFE_PORT_ID_DIGITAL_MIC_TX;
  297. case VOICE_RECORD_RX: return AFE_PORT_ID_VOICE_RECORD_RX;
  298. case VOICE_RECORD_TX: return AFE_PORT_ID_VOICE_RECORD_TX;
  299. case VOICE_PLAYBACK_TX: return AFE_PORT_ID_VOICE_PLAYBACK_TX;
  300. case VOICE2_PLAYBACK_TX: return AFE_PORT_ID_VOICE2_PLAYBACK_TX;
  301. case SLIMBUS_0_RX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_RX;
  302. case SLIMBUS_0_TX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_TX;
  303. case SLIMBUS_1_RX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_1_RX;
  304. case SLIMBUS_1_TX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_1_TX;
  305. case SLIMBUS_2_RX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_2_RX;
  306. case SLIMBUS_2_TX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_2_TX;
  307. case SLIMBUS_3_RX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_3_RX;
  308. case SLIMBUS_3_TX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_3_TX;
  309. case SLIMBUS_4_RX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_4_RX;
  310. case SLIMBUS_4_TX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_4_TX;
  311. case SLIMBUS_5_RX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_RX;
  312. case SLIMBUS_5_TX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_TX;
  313. case SLIMBUS_6_RX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_6_RX;
  314. case SLIMBUS_6_TX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_6_TX;
  315. case SLIMBUS_7_RX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_7_RX;
  316. case SLIMBUS_7_TX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_7_TX;
  317. case SLIMBUS_8_RX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_8_RX;
  318. case SLIMBUS_8_TX: return AFE_PORT_ID_SLIMBUS_MULTI_CHAN_8_TX;
  319. case INT_BT_SCO_RX: return AFE_PORT_ID_INTERNAL_BT_SCO_RX;
  320. case INT_BT_SCO_TX: return AFE_PORT_ID_INTERNAL_BT_SCO_TX;
  321. case INT_BT_A2DP_RX: return AFE_PORT_ID_INTERNAL_BT_A2DP_RX;
  322. case INT_FM_RX: return AFE_PORT_ID_INTERNAL_FM_RX;
  323. case INT_FM_TX: return AFE_PORT_ID_INTERNAL_FM_TX;
  324. case RT_PROXY_PORT_001_RX: return AFE_PORT_ID_RT_PROXY_PORT_001_RX;
  325. case RT_PROXY_PORT_001_TX: return AFE_PORT_ID_RT_PROXY_PORT_001_TX;
  326. case AFE_PORT_ID_PRIMARY_MI2S_RX:
  327. return AFE_PORT_ID_PRIMARY_MI2S_RX;
  328. case AFE_PORT_ID_PRIMARY_MI2S_TX:
  329. return AFE_PORT_ID_PRIMARY_MI2S_TX;
  330. case AFE_PORT_ID_QUATERNARY_MI2S_RX:
  331. return AFE_PORT_ID_QUATERNARY_MI2S_RX;
  332. case AFE_PORT_ID_QUATERNARY_MI2S_TX:
  333. return AFE_PORT_ID_QUATERNARY_MI2S_TX;
  334. case AFE_PORT_ID_SECONDARY_MI2S_RX:
  335. return AFE_PORT_ID_SECONDARY_MI2S_RX;
  336. case AFE_PORT_ID_SECONDARY_MI2S_TX:
  337. return AFE_PORT_ID_SECONDARY_MI2S_TX;
  338. case AFE_PORT_ID_TERTIARY_MI2S_RX:
  339. return AFE_PORT_ID_TERTIARY_MI2S_RX;
  340. case AFE_PORT_ID_TERTIARY_MI2S_TX:
  341. return AFE_PORT_ID_TERTIARY_MI2S_TX;
  342. case AUDIO_PORT_ID_I2S_RX:
  343. return AUDIO_PORT_ID_I2S_RX;
  344. case AFE_PORT_ID_SECONDARY_MI2S_RX_SD1:
  345. return AFE_PORT_ID_SECONDARY_MI2S_RX_SD1;
  346. case AFE_PORT_ID_PRIMARY_TDM_RX:
  347. return AFE_PORT_ID_PRIMARY_TDM_RX;
  348. case AFE_PORT_ID_PRIMARY_TDM_TX:
  349. return AFE_PORT_ID_PRIMARY_TDM_TX;
  350. case AFE_PORT_ID_PRIMARY_TDM_RX_1:
  351. return AFE_PORT_ID_PRIMARY_TDM_RX_1;
  352. case AFE_PORT_ID_PRIMARY_TDM_TX_1:
  353. return AFE_PORT_ID_PRIMARY_TDM_TX_1;
  354. case AFE_PORT_ID_PRIMARY_TDM_RX_2:
  355. return AFE_PORT_ID_PRIMARY_TDM_RX_2;
  356. case AFE_PORT_ID_PRIMARY_TDM_TX_2:
  357. return AFE_PORT_ID_PRIMARY_TDM_TX_2;
  358. case AFE_PORT_ID_PRIMARY_TDM_RX_3:
  359. return AFE_PORT_ID_PRIMARY_TDM_RX_3;
  360. case AFE_PORT_ID_PRIMARY_TDM_TX_3:
  361. return AFE_PORT_ID_PRIMARY_TDM_TX_3;
  362. case AFE_PORT_ID_PRIMARY_TDM_RX_4:
  363. return AFE_PORT_ID_PRIMARY_TDM_RX_4;
  364. case AFE_PORT_ID_PRIMARY_TDM_TX_4:
  365. return AFE_PORT_ID_PRIMARY_TDM_TX_4;
  366. case AFE_PORT_ID_PRIMARY_TDM_RX_5:
  367. return AFE_PORT_ID_PRIMARY_TDM_RX_5;
  368. case AFE_PORT_ID_PRIMARY_TDM_TX_5:
  369. return AFE_PORT_ID_PRIMARY_TDM_TX_5;
  370. case AFE_PORT_ID_PRIMARY_TDM_RX_6:
  371. return AFE_PORT_ID_PRIMARY_TDM_RX_6;
  372. case AFE_PORT_ID_PRIMARY_TDM_TX_6:
  373. return AFE_PORT_ID_PRIMARY_TDM_TX_6;
  374. case AFE_PORT_ID_PRIMARY_TDM_RX_7:
  375. return AFE_PORT_ID_PRIMARY_TDM_RX_7;
  376. case AFE_PORT_ID_PRIMARY_TDM_TX_7:
  377. return AFE_PORT_ID_PRIMARY_TDM_TX_7;
  378. case AFE_PORT_ID_SECONDARY_TDM_RX:
  379. return AFE_PORT_ID_SECONDARY_TDM_RX;
  380. case AFE_PORT_ID_SECONDARY_TDM_TX:
  381. return AFE_PORT_ID_SECONDARY_TDM_TX;
  382. case AFE_PORT_ID_SECONDARY_TDM_RX_1:
  383. return AFE_PORT_ID_SECONDARY_TDM_RX_1;
  384. case AFE_PORT_ID_SECONDARY_TDM_TX_1:
  385. return AFE_PORT_ID_SECONDARY_TDM_TX_1;
  386. case AFE_PORT_ID_SECONDARY_TDM_RX_2:
  387. return AFE_PORT_ID_SECONDARY_TDM_RX_2;
  388. case AFE_PORT_ID_SECONDARY_TDM_TX_2:
  389. return AFE_PORT_ID_SECONDARY_TDM_TX_2;
  390. case AFE_PORT_ID_SECONDARY_TDM_RX_3:
  391. return AFE_PORT_ID_SECONDARY_TDM_RX_3;
  392. case AFE_PORT_ID_SECONDARY_TDM_TX_3:
  393. return AFE_PORT_ID_SECONDARY_TDM_TX_3;
  394. case AFE_PORT_ID_SECONDARY_TDM_RX_4:
  395. return AFE_PORT_ID_SECONDARY_TDM_RX_4;
  396. case AFE_PORT_ID_SECONDARY_TDM_TX_4:
  397. return AFE_PORT_ID_SECONDARY_TDM_TX_4;
  398. case AFE_PORT_ID_SECONDARY_TDM_RX_5:
  399. return AFE_PORT_ID_SECONDARY_TDM_RX_5;
  400. case AFE_PORT_ID_SECONDARY_TDM_TX_5:
  401. return AFE_PORT_ID_SECONDARY_TDM_TX_5;
  402. case AFE_PORT_ID_SECONDARY_TDM_RX_6:
  403. return AFE_PORT_ID_SECONDARY_TDM_RX_6;
  404. case AFE_PORT_ID_SECONDARY_TDM_TX_6:
  405. return AFE_PORT_ID_SECONDARY_TDM_TX_6;
  406. case AFE_PORT_ID_SECONDARY_TDM_RX_7:
  407. return AFE_PORT_ID_SECONDARY_TDM_RX_7;
  408. case AFE_PORT_ID_SECONDARY_TDM_TX_7:
  409. return AFE_PORT_ID_SECONDARY_TDM_TX_7;
  410. case AFE_PORT_ID_TERTIARY_TDM_RX:
  411. return AFE_PORT_ID_TERTIARY_TDM_RX;
  412. case AFE_PORT_ID_TERTIARY_TDM_TX:
  413. return AFE_PORT_ID_TERTIARY_TDM_TX;
  414. case AFE_PORT_ID_TERTIARY_TDM_RX_1:
  415. return AFE_PORT_ID_TERTIARY_TDM_RX_1;
  416. case AFE_PORT_ID_TERTIARY_TDM_TX_1:
  417. return AFE_PORT_ID_TERTIARY_TDM_TX_1;
  418. case AFE_PORT_ID_TERTIARY_TDM_RX_2:
  419. return AFE_PORT_ID_TERTIARY_TDM_RX_2;
  420. case AFE_PORT_ID_TERTIARY_TDM_TX_2:
  421. return AFE_PORT_ID_TERTIARY_TDM_TX_2;
  422. case AFE_PORT_ID_TERTIARY_TDM_RX_3:
  423. return AFE_PORT_ID_TERTIARY_TDM_RX_3;
  424. case AFE_PORT_ID_TERTIARY_TDM_TX_3:
  425. return AFE_PORT_ID_TERTIARY_TDM_TX_3;
  426. case AFE_PORT_ID_TERTIARY_TDM_RX_4:
  427. return AFE_PORT_ID_TERTIARY_TDM_RX_4;
  428. case AFE_PORT_ID_TERTIARY_TDM_TX_4:
  429. return AFE_PORT_ID_TERTIARY_TDM_TX_4;
  430. case AFE_PORT_ID_TERTIARY_TDM_RX_5:
  431. return AFE_PORT_ID_TERTIARY_TDM_RX_5;
  432. case AFE_PORT_ID_TERTIARY_TDM_TX_5:
  433. return AFE_PORT_ID_TERTIARY_TDM_TX_5;
  434. case AFE_PORT_ID_TERTIARY_TDM_RX_6:
  435. return AFE_PORT_ID_TERTIARY_TDM_RX_6;
  436. case AFE_PORT_ID_TERTIARY_TDM_TX_6:
  437. return AFE_PORT_ID_TERTIARY_TDM_TX_6;
  438. case AFE_PORT_ID_TERTIARY_TDM_RX_7:
  439. return AFE_PORT_ID_TERTIARY_TDM_RX_7;
  440. case AFE_PORT_ID_TERTIARY_TDM_TX_7:
  441. return AFE_PORT_ID_TERTIARY_TDM_TX_7;
  442. case AFE_PORT_ID_QUATERNARY_TDM_RX:
  443. return AFE_PORT_ID_QUATERNARY_TDM_RX;
  444. case AFE_PORT_ID_QUATERNARY_TDM_TX:
  445. return AFE_PORT_ID_QUATERNARY_TDM_TX;
  446. case AFE_PORT_ID_QUATERNARY_TDM_RX_1:
  447. return AFE_PORT_ID_QUATERNARY_TDM_RX_1;
  448. case AFE_PORT_ID_QUATERNARY_TDM_TX_1:
  449. return AFE_PORT_ID_QUATERNARY_TDM_TX_1;
  450. case AFE_PORT_ID_QUATERNARY_TDM_RX_2:
  451. return AFE_PORT_ID_QUATERNARY_TDM_RX_2;
  452. case AFE_PORT_ID_QUATERNARY_TDM_TX_2:
  453. return AFE_PORT_ID_QUATERNARY_TDM_TX_2;
  454. case AFE_PORT_ID_QUATERNARY_TDM_RX_3:
  455. return AFE_PORT_ID_QUATERNARY_TDM_RX_3;
  456. case AFE_PORT_ID_QUATERNARY_TDM_TX_3:
  457. return AFE_PORT_ID_QUATERNARY_TDM_TX_3;
  458. case AFE_PORT_ID_QUATERNARY_TDM_RX_4:
  459. return AFE_PORT_ID_QUATERNARY_TDM_RX_4;
  460. case AFE_PORT_ID_QUATERNARY_TDM_TX_4:
  461. return AFE_PORT_ID_QUATERNARY_TDM_TX_4;
  462. case AFE_PORT_ID_QUATERNARY_TDM_RX_5:
  463. return AFE_PORT_ID_QUATERNARY_TDM_RX_5;
  464. case AFE_PORT_ID_QUATERNARY_TDM_TX_5:
  465. return AFE_PORT_ID_QUATERNARY_TDM_TX_5;
  466. case AFE_PORT_ID_QUATERNARY_TDM_RX_6:
  467. return AFE_PORT_ID_QUATERNARY_TDM_RX_6;
  468. case AFE_PORT_ID_QUATERNARY_TDM_TX_6:
  469. return AFE_PORT_ID_QUATERNARY_TDM_TX_6;
  470. case AFE_PORT_ID_QUATERNARY_TDM_RX_7:
  471. return AFE_PORT_ID_QUATERNARY_TDM_RX_7;
  472. case AFE_PORT_ID_QUATERNARY_TDM_TX_7:
  473. return AFE_PORT_ID_QUATERNARY_TDM_TX_7;
  474. case AFE_PORT_ID_SENARY_MI2S_TX:
  475. return AFE_PORT_ID_SENARY_MI2S_TX;
  476. case AFE_PORT_ID_USB_RX:
  477. return AFE_PORT_ID_USB_RX;
  478. case AFE_PORT_ID_USB_TX:
  479. return AFE_PORT_ID_USB_TX;
  480. case AFE_PORT_ID_INT0_MI2S_RX:
  481. return AFE_PORT_ID_INT0_MI2S_RX;
  482. case AFE_PORT_ID_INT0_MI2S_TX:
  483. return AFE_PORT_ID_INT0_MI2S_TX;
  484. case AFE_PORT_ID_INT1_MI2S_RX:
  485. return AFE_PORT_ID_INT1_MI2S_RX;
  486. case AFE_PORT_ID_INT1_MI2S_TX:
  487. return AFE_PORT_ID_INT1_MI2S_TX;
  488. case AFE_PORT_ID_INT2_MI2S_RX:
  489. return AFE_PORT_ID_INT2_MI2S_RX;
  490. case AFE_PORT_ID_INT2_MI2S_TX:
  491. return AFE_PORT_ID_INT2_MI2S_TX;
  492. case AFE_PORT_ID_INT3_MI2S_RX:
  493. return AFE_PORT_ID_INT3_MI2S_RX;
  494. case AFE_PORT_ID_INT3_MI2S_TX:
  495. return AFE_PORT_ID_INT3_MI2S_TX;
  496. case AFE_PORT_ID_INT4_MI2S_RX:
  497. return AFE_PORT_ID_INT4_MI2S_RX;
  498. case AFE_PORT_ID_INT4_MI2S_TX:
  499. return AFE_PORT_ID_INT4_MI2S_TX;
  500. case AFE_PORT_ID_INT5_MI2S_RX:
  501. return AFE_PORT_ID_INT5_MI2S_RX;
  502. case AFE_PORT_ID_INT5_MI2S_TX:
  503. return AFE_PORT_ID_INT5_MI2S_TX;
  504. case AFE_PORT_ID_INT6_MI2S_RX:
  505. return AFE_PORT_ID_INT6_MI2S_RX;
  506. case AFE_PORT_ID_INT6_MI2S_TX:
  507. return AFE_PORT_ID_INT6_MI2S_TX;
  508. default:
  509. pr_warn("%s: Invalid port_id %d\n", __func__, port_id);
  510. return -EINVAL;
  511. }
  512. }
  513. int q6audio_convert_virtual_to_portid(u16 port_id)
  514. {
  515. int ret;
  516. /* if port_id is virtual, convert to physical..
  517. * if port_id is already physical, return physical
  518. */
  519. if (q6audio_validate_port(port_id) < 0) {
  520. if (port_id == RT_PROXY_DAI_001_RX ||
  521. port_id == RT_PROXY_DAI_001_TX ||
  522. port_id == RT_PROXY_DAI_002_RX ||
  523. port_id == RT_PROXY_DAI_002_TX)
  524. ret = VIRTUAL_ID_TO_PORTID(port_id);
  525. else
  526. ret = -EINVAL;
  527. } else
  528. ret = port_id;
  529. return ret;
  530. }
  531. int q6audio_is_digital_pcm_interface(u16 port_id)
  532. {
  533. int ret = 0;
  534. switch (port_id) {
  535. case PRIMARY_I2S_RX:
  536. case PRIMARY_I2S_TX:
  537. case AFE_PORT_ID_PRIMARY_PCM_RX:
  538. case AFE_PORT_ID_PRIMARY_PCM_TX:
  539. case AFE_PORT_ID_SECONDARY_PCM_RX:
  540. case AFE_PORT_ID_SECONDARY_PCM_TX:
  541. case AFE_PORT_ID_TERTIARY_PCM_RX:
  542. case AFE_PORT_ID_TERTIARY_PCM_TX:
  543. case AFE_PORT_ID_QUATERNARY_PCM_RX:
  544. case AFE_PORT_ID_QUATERNARY_PCM_TX:
  545. case SECONDARY_I2S_RX:
  546. case SECONDARY_I2S_TX:
  547. case MI2S_RX:
  548. case MI2S_TX:
  549. case AFE_PORT_ID_TERTIARY_MI2S_TX:
  550. case AFE_PORT_ID_TERTIARY_MI2S_RX:
  551. case AFE_PORT_ID_QUATERNARY_MI2S_RX:
  552. case AFE_PORT_ID_QUATERNARY_MI2S_TX:
  553. case AFE_PORT_ID_PRIMARY_MI2S_RX:
  554. case AFE_PORT_ID_PRIMARY_MI2S_TX:
  555. case AFE_PORT_ID_SECONDARY_MI2S_RX:
  556. case AFE_PORT_ID_SECONDARY_MI2S_TX:
  557. case AUDIO_PORT_ID_I2S_RX:
  558. case AFE_PORT_ID_SECONDARY_MI2S_RX_SD1:
  559. case AFE_PORT_ID_PRIMARY_TDM_RX:
  560. case AFE_PORT_ID_PRIMARY_TDM_TX:
  561. case AFE_PORT_ID_PRIMARY_TDM_RX_1:
  562. case AFE_PORT_ID_PRIMARY_TDM_TX_1:
  563. case AFE_PORT_ID_PRIMARY_TDM_RX_2:
  564. case AFE_PORT_ID_PRIMARY_TDM_TX_2:
  565. case AFE_PORT_ID_PRIMARY_TDM_RX_3:
  566. case AFE_PORT_ID_PRIMARY_TDM_TX_3:
  567. case AFE_PORT_ID_PRIMARY_TDM_RX_4:
  568. case AFE_PORT_ID_PRIMARY_TDM_TX_4:
  569. case AFE_PORT_ID_PRIMARY_TDM_RX_5:
  570. case AFE_PORT_ID_PRIMARY_TDM_TX_5:
  571. case AFE_PORT_ID_PRIMARY_TDM_RX_6:
  572. case AFE_PORT_ID_PRIMARY_TDM_TX_6:
  573. case AFE_PORT_ID_PRIMARY_TDM_RX_7:
  574. case AFE_PORT_ID_PRIMARY_TDM_TX_7:
  575. case AFE_PORT_ID_SECONDARY_TDM_RX:
  576. case AFE_PORT_ID_SECONDARY_TDM_TX:
  577. case AFE_PORT_ID_SECONDARY_TDM_RX_1:
  578. case AFE_PORT_ID_SECONDARY_TDM_TX_1:
  579. case AFE_PORT_ID_SECONDARY_TDM_RX_2:
  580. case AFE_PORT_ID_SECONDARY_TDM_TX_2:
  581. case AFE_PORT_ID_SECONDARY_TDM_RX_3:
  582. case AFE_PORT_ID_SECONDARY_TDM_TX_3:
  583. case AFE_PORT_ID_SECONDARY_TDM_RX_4:
  584. case AFE_PORT_ID_SECONDARY_TDM_TX_4:
  585. case AFE_PORT_ID_SECONDARY_TDM_RX_5:
  586. case AFE_PORT_ID_SECONDARY_TDM_TX_5:
  587. case AFE_PORT_ID_SECONDARY_TDM_RX_6:
  588. case AFE_PORT_ID_SECONDARY_TDM_TX_6:
  589. case AFE_PORT_ID_SECONDARY_TDM_RX_7:
  590. case AFE_PORT_ID_SECONDARY_TDM_TX_7:
  591. case AFE_PORT_ID_TERTIARY_TDM_RX:
  592. case AFE_PORT_ID_TERTIARY_TDM_TX:
  593. case AFE_PORT_ID_TERTIARY_TDM_RX_1:
  594. case AFE_PORT_ID_TERTIARY_TDM_TX_1:
  595. case AFE_PORT_ID_TERTIARY_TDM_RX_2:
  596. case AFE_PORT_ID_TERTIARY_TDM_TX_2:
  597. case AFE_PORT_ID_TERTIARY_TDM_RX_3:
  598. case AFE_PORT_ID_TERTIARY_TDM_TX_3:
  599. case AFE_PORT_ID_TERTIARY_TDM_RX_4:
  600. case AFE_PORT_ID_TERTIARY_TDM_TX_4:
  601. case AFE_PORT_ID_TERTIARY_TDM_RX_5:
  602. case AFE_PORT_ID_TERTIARY_TDM_TX_5:
  603. case AFE_PORT_ID_TERTIARY_TDM_RX_6:
  604. case AFE_PORT_ID_TERTIARY_TDM_TX_6:
  605. case AFE_PORT_ID_TERTIARY_TDM_RX_7:
  606. case AFE_PORT_ID_TERTIARY_TDM_TX_7:
  607. case AFE_PORT_ID_QUATERNARY_TDM_RX:
  608. case AFE_PORT_ID_QUATERNARY_TDM_TX:
  609. case AFE_PORT_ID_QUATERNARY_TDM_RX_1:
  610. case AFE_PORT_ID_QUATERNARY_TDM_TX_1:
  611. case AFE_PORT_ID_QUATERNARY_TDM_RX_2:
  612. case AFE_PORT_ID_QUATERNARY_TDM_TX_2:
  613. case AFE_PORT_ID_QUATERNARY_TDM_RX_3:
  614. case AFE_PORT_ID_QUATERNARY_TDM_TX_3:
  615. case AFE_PORT_ID_QUATERNARY_TDM_RX_4:
  616. case AFE_PORT_ID_QUATERNARY_TDM_TX_4:
  617. case AFE_PORT_ID_QUATERNARY_TDM_RX_5:
  618. case AFE_PORT_ID_QUATERNARY_TDM_TX_5:
  619. case AFE_PORT_ID_QUATERNARY_TDM_RX_6:
  620. case AFE_PORT_ID_QUATERNARY_TDM_TX_6:
  621. case AFE_PORT_ID_QUATERNARY_TDM_RX_7:
  622. case AFE_PORT_ID_QUATERNARY_TDM_TX_7:
  623. case AFE_PORT_ID_SENARY_MI2S_TX:
  624. case AFE_PORT_ID_INT0_MI2S_RX:
  625. case AFE_PORT_ID_INT0_MI2S_TX:
  626. case AFE_PORT_ID_INT1_MI2S_RX:
  627. case AFE_PORT_ID_INT1_MI2S_TX:
  628. case AFE_PORT_ID_INT2_MI2S_RX:
  629. case AFE_PORT_ID_INT2_MI2S_TX:
  630. case AFE_PORT_ID_INT3_MI2S_RX:
  631. case AFE_PORT_ID_INT3_MI2S_TX:
  632. case AFE_PORT_ID_INT4_MI2S_RX:
  633. case AFE_PORT_ID_INT4_MI2S_TX:
  634. case AFE_PORT_ID_INT5_MI2S_RX:
  635. case AFE_PORT_ID_INT5_MI2S_TX:
  636. case AFE_PORT_ID_INT6_MI2S_RX:
  637. case AFE_PORT_ID_INT6_MI2S_TX:
  638. break;
  639. default:
  640. ret = -EINVAL;
  641. }
  642. return ret;
  643. }
  644. int q6audio_validate_port(u16 port_id)
  645. {
  646. int ret;
  647. switch (port_id) {
  648. case PRIMARY_I2S_RX:
  649. case PRIMARY_I2S_TX:
  650. case AFE_PORT_ID_PRIMARY_PCM_RX:
  651. case AFE_PORT_ID_PRIMARY_PCM_TX:
  652. case AFE_PORT_ID_SECONDARY_PCM_RX:
  653. case AFE_PORT_ID_SECONDARY_PCM_TX:
  654. case AFE_PORT_ID_TERTIARY_PCM_RX:
  655. case AFE_PORT_ID_TERTIARY_PCM_TX:
  656. case AFE_PORT_ID_QUATERNARY_PCM_RX:
  657. case AFE_PORT_ID_QUATERNARY_PCM_TX:
  658. case SECONDARY_I2S_RX:
  659. case SECONDARY_I2S_TX:
  660. case MI2S_RX:
  661. case MI2S_TX:
  662. case HDMI_RX:
  663. case DISPLAY_PORT_RX:
  664. case RSVD_2:
  665. case RSVD_3:
  666. case DIGI_MIC_TX:
  667. case VOICE_RECORD_RX:
  668. case VOICE_RECORD_TX:
  669. case VOICE_PLAYBACK_TX:
  670. case VOICE2_PLAYBACK_TX:
  671. case SLIMBUS_0_RX:
  672. case SLIMBUS_0_TX:
  673. case SLIMBUS_1_RX:
  674. case SLIMBUS_1_TX:
  675. case SLIMBUS_2_RX:
  676. case SLIMBUS_2_TX:
  677. case SLIMBUS_3_RX:
  678. case SLIMBUS_3_TX:
  679. case SLIMBUS_4_RX:
  680. case SLIMBUS_4_TX:
  681. case SLIMBUS_5_RX:
  682. case SLIMBUS_5_TX:
  683. case SLIMBUS_6_RX:
  684. case SLIMBUS_6_TX:
  685. case SLIMBUS_7_RX:
  686. case SLIMBUS_7_TX:
  687. case SLIMBUS_8_RX:
  688. case SLIMBUS_8_TX:
  689. case INT_BT_SCO_RX:
  690. case INT_BT_SCO_TX:
  691. case INT_BT_A2DP_RX:
  692. case INT_FM_RX:
  693. case INT_FM_TX:
  694. case RT_PROXY_PORT_001_RX:
  695. case RT_PROXY_PORT_001_TX:
  696. case AFE_PORT_ID_PRIMARY_MI2S_RX:
  697. case AFE_PORT_ID_PRIMARY_MI2S_TX:
  698. case AFE_PORT_ID_QUATERNARY_MI2S_RX:
  699. case AFE_PORT_ID_QUATERNARY_MI2S_TX:
  700. case AFE_PORT_ID_SECONDARY_MI2S_RX:
  701. case AFE_PORT_ID_SECONDARY_MI2S_TX:
  702. case AFE_PORT_ID_SPDIF_RX:
  703. case AFE_PORT_ID_TERTIARY_MI2S_RX:
  704. case AFE_PORT_ID_TERTIARY_MI2S_TX:
  705. case AFE_PORT_ID_SECONDARY_MI2S_RX_SD1:
  706. case AFE_PORT_ID_PRIMARY_TDM_RX:
  707. case AFE_PORT_ID_PRIMARY_TDM_TX:
  708. case AFE_PORT_ID_PRIMARY_TDM_RX_1:
  709. case AFE_PORT_ID_PRIMARY_TDM_TX_1:
  710. case AFE_PORT_ID_PRIMARY_TDM_RX_2:
  711. case AFE_PORT_ID_PRIMARY_TDM_TX_2:
  712. case AFE_PORT_ID_PRIMARY_TDM_RX_3:
  713. case AFE_PORT_ID_PRIMARY_TDM_TX_3:
  714. case AFE_PORT_ID_PRIMARY_TDM_RX_4:
  715. case AFE_PORT_ID_PRIMARY_TDM_TX_4:
  716. case AFE_PORT_ID_PRIMARY_TDM_RX_5:
  717. case AFE_PORT_ID_PRIMARY_TDM_TX_5:
  718. case AFE_PORT_ID_PRIMARY_TDM_RX_6:
  719. case AFE_PORT_ID_PRIMARY_TDM_TX_6:
  720. case AFE_PORT_ID_PRIMARY_TDM_RX_7:
  721. case AFE_PORT_ID_PRIMARY_TDM_TX_7:
  722. case AFE_PORT_ID_SECONDARY_TDM_RX:
  723. case AFE_PORT_ID_SECONDARY_TDM_TX:
  724. case AFE_PORT_ID_SECONDARY_TDM_RX_1:
  725. case AFE_PORT_ID_SECONDARY_TDM_TX_1:
  726. case AFE_PORT_ID_SECONDARY_TDM_RX_2:
  727. case AFE_PORT_ID_SECONDARY_TDM_TX_2:
  728. case AFE_PORT_ID_SECONDARY_TDM_RX_3:
  729. case AFE_PORT_ID_SECONDARY_TDM_TX_3:
  730. case AFE_PORT_ID_SECONDARY_TDM_RX_4:
  731. case AFE_PORT_ID_SECONDARY_TDM_TX_4:
  732. case AFE_PORT_ID_SECONDARY_TDM_RX_5:
  733. case AFE_PORT_ID_SECONDARY_TDM_TX_5:
  734. case AFE_PORT_ID_SECONDARY_TDM_RX_6:
  735. case AFE_PORT_ID_SECONDARY_TDM_TX_6:
  736. case AFE_PORT_ID_SECONDARY_TDM_RX_7:
  737. case AFE_PORT_ID_SECONDARY_TDM_TX_7:
  738. case AFE_PORT_ID_TERTIARY_TDM_RX:
  739. case AFE_PORT_ID_TERTIARY_TDM_TX:
  740. case AFE_PORT_ID_TERTIARY_TDM_RX_1:
  741. case AFE_PORT_ID_TERTIARY_TDM_TX_1:
  742. case AFE_PORT_ID_TERTIARY_TDM_RX_2:
  743. case AFE_PORT_ID_TERTIARY_TDM_TX_2:
  744. case AFE_PORT_ID_TERTIARY_TDM_RX_3:
  745. case AFE_PORT_ID_TERTIARY_TDM_TX_3:
  746. case AFE_PORT_ID_TERTIARY_TDM_RX_4:
  747. case AFE_PORT_ID_TERTIARY_TDM_TX_4:
  748. case AFE_PORT_ID_TERTIARY_TDM_RX_5:
  749. case AFE_PORT_ID_TERTIARY_TDM_TX_5:
  750. case AFE_PORT_ID_TERTIARY_TDM_RX_6:
  751. case AFE_PORT_ID_TERTIARY_TDM_TX_6:
  752. case AFE_PORT_ID_TERTIARY_TDM_RX_7:
  753. case AFE_PORT_ID_TERTIARY_TDM_TX_7:
  754. case AFE_PORT_ID_QUATERNARY_TDM_RX:
  755. case AFE_PORT_ID_QUATERNARY_TDM_TX:
  756. case AFE_PORT_ID_QUATERNARY_TDM_RX_1:
  757. case AFE_PORT_ID_QUATERNARY_TDM_TX_1:
  758. case AFE_PORT_ID_QUATERNARY_TDM_RX_2:
  759. case AFE_PORT_ID_QUATERNARY_TDM_TX_2:
  760. case AFE_PORT_ID_QUATERNARY_TDM_RX_3:
  761. case AFE_PORT_ID_QUATERNARY_TDM_TX_3:
  762. case AFE_PORT_ID_QUATERNARY_TDM_RX_4:
  763. case AFE_PORT_ID_QUATERNARY_TDM_TX_4:
  764. case AFE_PORT_ID_QUATERNARY_TDM_RX_5:
  765. case AFE_PORT_ID_QUATERNARY_TDM_TX_5:
  766. case AFE_PORT_ID_QUATERNARY_TDM_RX_6:
  767. case AFE_PORT_ID_QUATERNARY_TDM_TX_6:
  768. case AFE_PORT_ID_QUATERNARY_TDM_RX_7:
  769. case AFE_PORT_ID_QUATERNARY_TDM_TX_7:
  770. case AFE_PORT_ID_SENARY_MI2S_TX:
  771. case AFE_PORT_ID_USB_RX:
  772. case AFE_PORT_ID_USB_TX:
  773. case AFE_PORT_ID_INT0_MI2S_RX:
  774. case AFE_PORT_ID_INT0_MI2S_TX:
  775. case AFE_PORT_ID_INT1_MI2S_RX:
  776. case AFE_PORT_ID_INT1_MI2S_TX:
  777. case AFE_PORT_ID_INT2_MI2S_RX:
  778. case AFE_PORT_ID_INT2_MI2S_TX:
  779. case AFE_PORT_ID_INT3_MI2S_RX:
  780. case AFE_PORT_ID_INT3_MI2S_TX:
  781. case AFE_PORT_ID_INT4_MI2S_RX:
  782. case AFE_PORT_ID_INT4_MI2S_TX:
  783. case AFE_PORT_ID_INT5_MI2S_RX:
  784. case AFE_PORT_ID_INT5_MI2S_TX:
  785. case AFE_PORT_ID_INT6_MI2S_RX:
  786. case AFE_PORT_ID_INT6_MI2S_TX:
  787. {
  788. ret = 0;
  789. break;
  790. }
  791. default:
  792. ret = -EINVAL;
  793. }
  794. return ret;
  795. }