AudDrv_Def.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. /******************************************************************************
  2. *
  3. *
  4. * Filename:
  5. * ---------
  6. * AudDrv_Common.h
  7. *
  8. * Project:
  9. * --------
  10. * MT6583 FPGA LDVT Audio Driver
  11. *
  12. * Description:
  13. * ------------
  14. * Audio register
  15. *
  16. * Author:
  17. * -------
  18. * Chipeng Chang (MTK02308)
  19. *
  20. *---------------------------------------------------------------------------
  21. *
  22. *
  23. *******************************************************************************/
  24. #ifndef AUDIO_DEF_H
  25. #define AUDIO_DEF_H
  26. #include "AudDrv_Type_Def.h"
  27. #ifdef CONFIG_MTK_CLKMGR
  28. #define PM_MANAGER_API
  29. #endif
  30. #define AUDIO_MEMORY_SRAM
  31. #define AUDIO_MEM_IOREMAP
  32. /* below for audio debugging */
  33. #define DEBUG_AUDDRV
  34. /* #define DEBUG_AFE_REG */
  35. /* #define DEBUG_ANA_REG */
  36. /* #define DEBUG_AUD_CLK */
  37. /* #define DEBUG_AUD_HDMI */
  38. /* #define DEBUG_AUD_FMTX */
  39. /* #define DEBUG_AUD_UL2 */
  40. /* #define DEBUG_AUD_UL1 */
  41. /* #define DEBUG_AUD_DL1 */
  42. /* #define DEBUG_AUD_DAI */
  43. #ifdef DEBUG_AUDDRV
  44. #define PRINTK_AUDDRV(format, args...) pr_debug(format, ##args)
  45. #else
  46. #define PRINTK_AUDDRV(format, args...)
  47. #endif
  48. #ifdef DEBUG_AFE_REG
  49. #define PRINTK_AFE_REG(format, args...) pr_debug(format, ##args)
  50. #else
  51. #define PRINTK_AFE_REG(format, args...)
  52. #endif
  53. #ifdef DEBUG_ANA_REG
  54. #define PRINTK_ANA_REG(format, args...) pr_debug(format, ##args)
  55. #else
  56. #define PRINTK_ANA_REG(format, args...)
  57. #endif
  58. #ifdef DEBUG_AUD_CLK
  59. #define PRINTK_AUD_CLK(format, args...) pr_debug(format, ##args)
  60. #else
  61. #define PRINTK_AUD_CLK(format, args...)
  62. #endif
  63. #ifdef DEBUG_AUD_DL1
  64. #define PRINTK_AUD_DL1(format, args...) pr_debug(format, ##args)
  65. #else
  66. #define PRINTK_AUD_DL1(format, args...)
  67. #endif
  68. #ifdef DEBUG_AUD_DL2
  69. #define PRINTK_AUD_DL2(format, args...) pr_debug(format, ##args)
  70. #else
  71. #define PRINTK_AUD_DL2(format, args...)
  72. #endif
  73. #ifdef DEBUG_AUD_FMTX
  74. #define PRINTK_AUD_FMTX(format, args...) pr_debug(format, ##args)
  75. #else
  76. #define PRINTK_AUD_FMTX(format, args...)
  77. #endif
  78. #ifdef DEBUG_AUD_HDMI
  79. #define PRINTK_AUD_HDMI(format, args...) pr_debug(format, ##args)
  80. #else
  81. #define PRINTK_AUD_HDMI(format, args...)
  82. #endif
  83. #ifdef DEBUG_AUD_HDMI2
  84. #define PRINTK_AUD_HDMI2(format, args...) pr_debug(format, ##args)
  85. #else
  86. #define PRINTK_AUD_HDMI2(format, args...)
  87. #endif
  88. #ifdef DEBUG_AUD_UL1
  89. #define PRINTK_AUD_UL1(format, args...) pr_debug(format, ##args)
  90. #else
  91. #define PRINTK_AUD_UL1(format, args...)
  92. #endif
  93. #ifdef DEBUG_AUD_UL2
  94. #define PRINTK_AUD_UL2(format, args...) pr_debug(format, ##args)
  95. #else
  96. #define PRINTK_AUD_UL2(format, args...)
  97. #endif
  98. #ifdef DEBUG_AUD_UL3
  99. #define PRINTK_AUD_UL3(format, args...) pr_debug(format, ##args)
  100. #else
  101. #define PRINTK_AUD_UL3(format, args...)
  102. #endif
  103. #ifdef DEBUG_AUD_AWB
  104. #define PRINTK_AUD_AWB(format, args...) pr_debug(format, ##args)
  105. #else
  106. #define PRINTK_AUD_AWB(format, args...)
  107. #endif
  108. #ifdef DEBUG_AUD_DAI
  109. #define PRINTK_AUD_DAI(format, args...) pr_debug(format, ##args)
  110. #else
  111. #define PRINTK_AUD_DAI(format, args...)
  112. #endif
  113. #ifdef DEBUG_AUD_MODDAI
  114. #define PRINTK_AUD_MODDAI(format, args...) pr_debug(format, ##args)
  115. #else
  116. #define PRINTK_AUD_MODDAI(format, args...)
  117. #endif
  118. #ifdef DEBUG_AUD_DAI
  119. #define PRINTK_AUD_DAI(format, args...) pr_debug(format, ##args)
  120. #else
  121. #define PRINTK_AUD_DAI(format, args...)
  122. #endif
  123. #define PRINTK_AUD_ERROR(format, args...) pr_debug(format, ##args)
  124. /* if need assert , use AUDIO_ASSERT(true) */
  125. #define AUDIO_ASSERT(value) BUG_ON(false)
  126. /**********************************
  127. * Other Definitions *
  128. **********************************/
  129. #define BIT_00 0x00000001 /* ---- ---- ---- ---- ---- ---- ---- ---1 */
  130. #define BIT_01 0x00000002 /* ---- ---- ---- ---- ---- ---- ---- --1- */
  131. #define BIT_02 0x00000004 /* ---- ---- ---- ---- ---- ---- ---- -1-- */
  132. #define BIT_03 0x00000008 /* ---- ---- ---- ---- ---- ---- ---- 1--- */
  133. #define BIT_04 0x00000010 /* ---- ---- ---- ---- ---- ---- ---1 ---- */
  134. #define BIT_05 0x00000020 /* ---- ---- ---- ---- ---- ---- --1- ---- */
  135. #define BIT_06 0x00000040 /* ---- ---- ---- ---- ---- ---- -1-- ---- */
  136. #define BIT_07 0x00000080 /* ---- ---- ---- ---- ---- ---- 1--- ---- */
  137. #define BIT_08 0x00000100 /* ---- ---- ---- ---- ---- ---1 ---- ---- */
  138. #define BIT_09 0x00000200 /* ---- ---- ---- ---- ---- --1- ---- ---- */
  139. #define BIT_10 0x00000400 /* ---- ---- ---- ---- ---- -1-- ---- ---- */
  140. #define BIT_11 0x00000800 /* ---- ---- ---- ---- ---- 1--- ---- ---- */
  141. #define BIT_12 0x00001000 /* ---- ---- ---- ---- ---1 ---- ---- ---- */
  142. #define BIT_13 0x00002000 /* ---- ---- ---- ---- --1- ---- ---- ---- */
  143. #define BIT_14 0x00004000 /* ---- ---- ---- ---- -1-- ---- ---- ---- */
  144. #define BIT_15 0x00008000 /* ---- ---- ---- ---- 1--- ---- ---- ---- */
  145. #define BIT_16 0x00010000 /* ---- ---- ---- ---1 ---- ---- ---- ---- */
  146. #define BIT_17 0x00020000 /* ---- ---- ---- --1- ---- ---- ---- ---- */
  147. #define BIT_18 0x00040000 /* ---- ---- ---- -1-- ---- ---- ---- ---- */
  148. #define BIT_19 0x00080000 /* ---- ---- ---- 1--- ---- ---- ---- ---- */
  149. #define BIT_20 0x00100000 /* ---- ---- ---1 ---- ---- ---- ---- ---- */
  150. #define BIT_21 0x00200000 /* ---- ---- --1- ---- ---- ---- ---- ---- */
  151. #define BIT_22 0x00400000 /* ---- ---- -1-- ---- ---- ---- ---- ---- */
  152. #define BIT_23 0x00800000 /* ---- ---- 1--- ---- ---- ---- ---- ---- */
  153. #define BIT_24 0x01000000 /* ---- ---1 ---- ---- ---- ---- ---- ---- */
  154. #define BIT_25 0x02000000 /* ---- --1- ---- ---- ---- ---- ---- ---- */
  155. #define BIT_26 0x04000000 /* ---- -1-- ---- ---- ---- ---- ---- ---- */
  156. #define BIT_27 0x08000000 /* ---- 1--- ---- ---- ---- ---- ---- ---- */
  157. #define BIT_28 0x10000000 /* ---1 ---- ---- ---- ---- ---- ---- ---- */
  158. #define BIT_29 0x20000000 /* --1- ---- ---- ---- ---- ---- ---- ---- */
  159. #define BIT_30 0x40000000 /* -1-- ---- ---- ---- ---- ---- ---- ---- */
  160. #define BIT_31 0x80000000 /* 1--- ---- ---- ---- ---- ---- ---- ---- */
  161. #define MASK_ALL (0xFFFFFFFF)
  162. /* cpu dai name */
  163. #define MT_SOC_DAI_NAME "mt-soc-dai-driver"
  164. #define MT_SOC_DL1DAI_NAME "mt-soc-dl1dai-driver"
  165. #define MT_SOC_DL1DATA2DAI_NAME "mt-soc-dl1data2dai-driver"
  166. #define MT_SOC_UL1DAI_NAME "mt-soc-ul1dai-driver"
  167. #define MT_SOC_UL1DATA2_NAME "mt-soc-ul1data2dai-driver"
  168. #define MT_SOC_UL2DAI_NAME "mt-soc-ul2dai-driver"
  169. #define MT_SOC_I2S0AWBDAI_NAME "mt-soc-i2s0awbdai-driver"
  170. #define MT_SOC_VOICE_MD1_NAME "mt-soc-voicemd1dai-driver"
  171. #define MT_SOC_VOICE_MD1_BT_NAME "mt-soc-voicemd1-btdai-driver"
  172. #define MT_SOC_VOICE_MD2_NAME "mt-soc-voicemd2dai-driver"
  173. #define MT_SOC_VOICE_MD2_BT_NAME "mt-soc-voicemd2-btdai-driver"
  174. #define MT_SOC_VOIP_CALL_BT_OUT_NAME "mt-soc-voipcall-btdai-out-driver"
  175. #define MT_SOC_VOIP_CALL_BT_IN_NAME "mt-soc-voipcall-btdai-in-driver"
  176. #define MT_SOC_ULDLLOOPBACK_NAME "mt-soc-uldlloopbackdai-driver"
  177. #define MT_SOC_HDMI_NAME "mt-soc-hdmidai-driver"
  178. #define MT_SOC_I2S0_NAME "mt-soc-i2s0dai-driver"
  179. #define MT_SOC_I2S0DL1_NAME "mt-soc-i2s0dl1dai-driver"
  180. #define MT_SOC_MRGRX_NAME "mt-soc-mrgrxdai-driver"
  181. #define MT_SOC_MRGRXCAPTURE_NAME "mt-soc-mrgrxcapturedai-driver"
  182. #define MT_SOC_DL1AWB_NAME "mt-soc-dl1awbdai-driver"
  183. #define MT_SOC_FM_MRGTX_NAME "mt-soc-fmmrgtxdai-driver"
  184. #define MT_SOC_TDMRX_NAME "mt-soc-tdmrxdai-driver"
  185. #define MT_SOC_MODADCI2SDAI_NAME "mt-soc-mod2adci2s-driver"
  186. #define MT_SOC_ADC2AWBDAI_NAME "mt-soc-adc2awb-driver"
  187. #define MT_SOC_IO2DAIDAI_NAME "mt-soc-io2dai-driver"
  188. #define MT_SOC_HP_IMPEDANCE_NAME "mt-soc-hpimpedancedai-driver"
  189. #define MT_SOC_FM_I2S_NAME "mt-soc-fmi2S-driver"
  190. #define MT_SOC_FM_I2S_CAPTURE_NAME "mt-soc-fmi2Scapturedai-driver"
  191. #define MT_SOC_OFFLOAD_GDMA_NAME "mt-soc-offload-gdma-driver"
  192. /* platform name */
  193. #define MT_SOC_DL1_PCM "mt-soc-dl1-pcm"
  194. #define MT_SOC_HP_IMPEDANCE_PCM "mt-soc-hp-impedence-pcm"
  195. #define MT_SOC_DL1DATA2_PCM "mt-soc-dl1_data2-pcm"
  196. #define MT_SOC_DL2_PCM "mt-soc-dl2-pcm"
  197. #define MT_SOC_UL1_PCM "mt-soc-ul1-pcm"
  198. #define MT_SOC_UL2_PCM "mt-soc-ul2-pcm"
  199. #define MT_SOC_I2S0_AWB_PCM "mt-soc-i2s0awb-pcm"
  200. #define MT_SOC_AWB_PCM "mt-soc-awb-pcm"
  201. #define MT_SOC_MRGRX_AWB_PCM "mt-soc-mrgrx-awb-pcm"
  202. #define MT_SOC_DL1_AWB_PCM "mt-soc-dl1-awb-pcm"
  203. #define MT_SOC_DAI_PCM "mt-soc-DAI-pcm"
  204. #define MT_SOC_HDMI_PCM "mt-soc-hdmi-pcm"
  205. #define MT_SOC_I2S0_PCM "mt-soc-i2s0-pcm"
  206. #define MT_SOC_MRGRX_PCM "mt-soc-mrgrx-pcm"
  207. #define MT_SOC_I2S0DL1_PCM "mt-soc-i2s0dl1-pcm"
  208. #define MT_SOC_MODDAI_PCM "mt-soc-MODDAI-pcm"
  209. #define MT_SOC_VOICE_MD1 "mt-soc-voicemd1"
  210. #define MT_SOC_VOICE_MD2 "mt-soc-voicemd2"
  211. #define MT_SOC_VOICE_MD1_BT "mt-soc-voicemd1-bt"
  212. #define MT_SOC_VOICE_MD2_BT "mt-soc-voicemd2-bt"
  213. #define MT_SOC_VOIP_BT_OUT "mt-soc-voip-bt-out"
  214. #define MT_SOC_VOIP_BT_IN "mt-soc-voip-bt-in"
  215. #define MT_SOC_IFMI2S2 "mt-soc-fm-i2s2"
  216. #define MT_SOC_DUMMY_PCM "mt-soc-dummy-pcm"
  217. #define MT_SOC_ULDLLOOPBACK_PCM "mt-soc-uldlloopback-pcm"
  218. #define MT_SOC_ROUTING_PCM "mt-soc-routing-pcm"
  219. #define MT_SOC_FM_MRGTX_PCM "mt-soc-fmmrgtx-pcm"
  220. #define MT_SOC_TDMRX_PCM "mt-soc-tdmrx-pcm"
  221. #define MT_SOC_MOD_ADCI2S_PCM "mt-soc-mod2adci2s-pcm"
  222. #define MT_SOC_ADC2_AWB_PCM "mt-soc-adc2awb-pcm"
  223. #define MT_SOC_IO2_DAI_PCM "mt-soc-io2dai-pcm"
  224. #define MT_SOC_FM_I2S_PCM "mt-soc-fm-i2s-pcm"
  225. #define MT_SOC_FM_I2S_AWB_PCM "mt-soc-fm-i2s-awb-pcm"
  226. #define MT_SOC_OFFLOAD_GDMA_PCM "mt-soc-offload-gdma-pcm"
  227. /* codec dai name */
  228. #define MT_SOC_CODEC_TXDAI_NAME "mt-soc-codec-tx-dai"
  229. #define MT_SOC_CODEC_RXDAI_NAME "mt-soc-codec-rx-dai"
  230. #define MT_SOC_CODEC_RXDAI2_NAME "mt-soc-codec-rx-dai2"
  231. #define MT_SOC_CODEC_I2S0AWB_NAME "mt-soc-codec-i2s0awb-dai"
  232. #define MT_SOC_CODEC_I2S0TXDAI_NAME "mt-soc-codec-I2s0tx-dai"
  233. #define MT_SOC_CODEC_DL1AWBDAI_NAME "mt-soc-codec-dl1awb-dai"
  234. #define MT_SOC_CODEC_VOICE_MD1DAI_NAME "mt-soc-codec-voicemd1-dai"
  235. #define MT_SOC_CODEC_VOICE_MD2DAI_NAME "mt-soc-codec-voicemd2-dai"
  236. #define MT_SOC_CODEC_VOICE_MD1_BTDAI_NAME "mt-soc-codec-voicemd1-bt-dai"
  237. #define MT_SOC_CODEC_VOICE_MD2_BTDAI_NAME "mt-soc-codec-voicemd2-bt-dai"
  238. #define MT_SOC_CODEC_VOIPCALLBTOUTDAI_NAME "mt-soc-codec-voipcall-btout-dai"
  239. #define MT_SOC_CODEC_VOIPCALLBTINDAI_NAME "mt-soc-codec-voipcall-btin-dai"
  240. #define MT_SOC_CODEC_TDMRX_DAI_NAME "mt-soc-tdmrx-dai-codec"
  241. #define MT_SOC_CODEC_HP_IMPEDANCE_NAME "mt-soc-codec-hp-impedance-dai"
  242. #define MT_SOC_CODEC_FMI2S2TXDAI_NAME "mt-soc-codec-fmi2s2tx-dai"
  243. #define MT_SOC_CODEC_FMI2S2RXDAI_NAME "mt-soc-codec-fmi2s2rx-dai"
  244. #define MT_SOC_CODEC_ULDLLOOPBACK_NAME "mt-soc-codec-uldlloopback-dai"
  245. #define MT_SOC_ROUTING_DAI_NAME "Routing-Control"
  246. #define MT_SOC_CODEC_STUB_NAME "mt-soc-codec-stub"
  247. #define MT_SOC_CODEC_NAME "mt-soc-codec"
  248. #define MT_SOC_CODEC_DUMMY_NAME "mt-soc-dummy-codec"
  249. #define MT_SOC_CODEC_DUMMY_DAI_NAME "mt-soc-dummy-dai-codec"
  250. #define MT_SOC_CODEC_HDMI_DUMMY_DAI_NAME "mt-soc-hdmi-dummy-dai-codec"
  251. #define MT_SOC_CODEC_I2S0_DUMMY_DAI_NAME "mt-soc-i2s0-dummy-dai-codec"
  252. #define MT_SOC_CODEC_MRGRX_DUMMY_DAI_NAME "mt-soc-mrgrx-dummy-dai-codec"
  253. #define MT_SOC_CODEC_MRGRX_DAI_NAME "mt-soc-mrgrx-dai-codec"
  254. #define MT_SOC_CODEC_FMMRGTXDAI_DUMMY_DAI_NAME "mt-soc-fmmrg2tx-dummy-dai-codec"
  255. #define MT_SOC_CODEC_MODADCI2S_DUMMY_DAI_NAME "mt-soc-mod2adci2s-dummy-dai-codec"
  256. #define MT_SOC_CODEC_ADC2AWB_DUMMY_DAI_NAME "mt-soc-adc2awb-dummy-dai-codec"
  257. #define MT_SOC_CODEC_IO2DAI_DUMMY_DAI_NAME "mt-soc-io2dai-dummy-dai-codec"
  258. #define MT_SOC_CODEC_FM_I2S_DUMMY_DAI_NAME "mt-soc-fm-i2s-dummy-dai-codec"
  259. #define MT_SOC_CODEC_FM_I2S_DAI_NAME "mt-soc-fm-i2s-dai-codec"
  260. #define MT_SOC_CODEC_OFFLOAD_GDMA_DAI_NAME "mt-soc-offload-gdma-dai-codec"
  261. /* stream name */
  262. #define MT_SOC_DL1_STREAM_NAME "MultiMedia1_PLayback"
  263. #define MT_SOC_DL1DATA2_STREAM_NAME "MultiMedia1data2_PLayback"
  264. #define MT_SOC_DL2_STREAM_NAME "MultiMedia2_PLayback"
  265. #define MT_SOC_VOICE_MD1_STREAM_NAME "Voice_MD1_PLayback"
  266. #define MT_SOC_VOICE_MD2_STREAM_NAME "Voice_MD2_PLayback"
  267. #define MT_SOC_VOICE_MD1_BT_STREAM_NAME "Voice_MD1_BT_Playback"
  268. #define MT_SOC_VOICE_MD2_BT_STREAM_NAME "Voice_MD2_BT_Playback"
  269. #define MT_SOC_VOIP_BT_OUT_STREAM_NAME "VOIP_Call_BT_Playback"
  270. #define MT_SOC_VOIP_BT_IN_STREAM_NAME "VOIP_Call_BT_Capture"
  271. #define MT_SOC_HDMI_STREAM_NAME "HMDI_PLayback"
  272. #define MT_SOC_I2S0_STREAM_NAME "I2S0_PLayback"
  273. #define MT_SOC_I2SDL1_STREAM_NAME "I2S0DL1_PLayback"
  274. #define MT_SOC_MRGRX_STREAM_NAME "MRGRX_PLayback"
  275. #define MT_SOC_MRGRX_CAPTURE_STREAM_NAME "MRGRX_CAPTURE"
  276. #define MT_SOC_FM_I2S2_STREAM_NAME "FM_I2S2_PLayback"
  277. #define MT_SOC_ULDLLOOPBACK_STREAM_NAME "ULDL_Loopback"
  278. #define MT_SOC_FM_I2S2_RECORD_STREAM_NAME "FM_I2S2_Record"
  279. #define MT_SOC_DL1_AWB_RECORD_STREAM_NAME "DL1_AWB_Record"
  280. #define MT_SOC_UL1_STREAM_NAME "MultiMedia1_Capture"
  281. #define MT_SOC_UL1DATA2_STREAM_NAME "MultiMediaData2_Capture"
  282. #define MT_SOC_I2S0AWB_STREAM_NAME "I2S0AWB_Capture"
  283. #define MT_SOC_AWB_STREAM_NAME "MultiMedia_awb_Capture"
  284. #define MT_SOC_DAI_STREAM_NAME "MultiMedia_dai_Capture"
  285. #define MT_SOC_MODDAI_STREAM_NAME "MultiMedia_Moddai_Capture"
  286. #define MT_SOC_ROUTING_STREAM_NAME "MultiMedia_Routing"
  287. #define MT_SOC_HP_IMPEDANCE_STREAM_NAME "HP_IMPEDANCE_Playback"
  288. #define MT_SOC_FM_MRGTX_STREAM_NAME "FM_MRGTX_Playback"
  289. #define MT_SOC_TDM_CAPTURE_STREAM_NAME "TDM_Debug_Record"
  290. #define MT_SOC_MODADCI2S_STREAM_NAME "ANC_Debug_Record_MOD"
  291. #define MT_SOC_ADC2AWB_STREAM_NAME "ANC_Debug_Record_ADC2"
  292. #define MT_SOC_IO2DAI_STREAM_NAME "ANC_Debug_Record_IO2"
  293. #define MT_SOC_FM_I2S_PLAYBACK_STREAM_NAME "FM_I2S_Playback"
  294. #define MT_SOC_FM_I2S_CAPTURE_STREAM_NAME "FM_I2S_Capture"
  295. #define MT_SOC_OFFLOAD_GDMA_STREAM_NAME "OFFLOAD_GDMA_Playback"
  296. #endif