AudDrv_Afe.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. /*
  2. * Copyright (C) 2007 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /*******************************************************************************
  17. *
  18. * Filename:
  19. * ---------
  20. * AudioAfe.h
  21. *
  22. * Project:
  23. * --------
  24. * MT6797 Audio Driver Afe Register setting
  25. *
  26. * Description:
  27. * ------------
  28. * Audio register
  29. *
  30. * Author:
  31. * -------
  32. * Ir Lian (mtk00976)
  33. * Harvey Huang (mtk03996)
  34. * Chipeng Chang (mtk02308)
  35. *
  36. *------------------------------------------------------------------------------
  37. *
  38. *
  39. *******************************************************************************/
  40. #ifndef _AUDDRV_AFE_H_
  41. #define _AUDDRV_AFE_H_
  42. #include "AudDrv_Common.h"
  43. #include "AudDrv_Def.h"
  44. #include <linux/types.h>
  45. /*****************************************************************************
  46. * C O M P I L E R F L A G S
  47. *****************************************************************************/
  48. /*****************************************************************************
  49. * E X T E R N A L R E F E R E N C E S
  50. *****************************************************************************/
  51. /*****************************************************************************
  52. * D A T A T Y P E S
  53. *****************************************************************************/
  54. typedef enum {
  55. AFE_MEM_NONE = 0,
  56. AFE_MEM_DL1,
  57. AFE_MEM_DL1_DATA2,
  58. AFE_MEM_DL2,
  59. AFE_MEM_VUL,
  60. AFE_MEM_DAI,
  61. AFE_MEM_I2S,
  62. AFE_MEM_AWB,
  63. AFE_MEM_MOD_PCM,
  64. } MEM_INTERFACE_T;
  65. typedef enum {
  66. AFE_8000HZ = 0,
  67. AFE_11025HZ = 1,
  68. AFE_12000HZ = 2,
  69. AFE_16000HZ = 3,
  70. AFE_22050HZ = 4,
  71. AFE_24000HZ = 5,
  72. AFE_32000HZ = 6,
  73. AFE_44100HZ = 7,
  74. AFE_48000HZ = 8
  75. } SAMPLINGRATE_T;
  76. typedef enum {
  77. AFE_DAIMOD_8000HZ = 0x0,
  78. AFE_DAIMOD_16000HZ = 0x1,
  79. } DAIMOD_SAMPLINGRATE_T;
  80. typedef enum {
  81. AFE_STEREO = 0x0,
  82. AFE_MONO = 0x1
  83. } MEMIF_CH_CFG_T;
  84. typedef enum {
  85. AFE_MONO_USE_L = 0x0,
  86. AFE_MONO_USE_R = 0x1
  87. } MEMIF_MONO_SEL_T;
  88. typedef enum {
  89. AFE_DUP_WR_DISABLE = 0x0,
  90. AFE_DUP_WR_ENABLE = 0x1
  91. } MEMIF_DUP_WRITE_T;
  92. typedef struct {
  93. uint32 u4AFE_MEMIF_BUF_BASE;
  94. uint32 u4AFE_MEMIF_BUF_END;
  95. uint32 u4AFE_MEMIF_BUF_WP;
  96. uint32 u4AFE_MEMIF_BUF_RP;
  97. } MEMIF_BUF_T;
  98. typedef struct {
  99. MEM_INTERFACE_T eMemInterface;
  100. SAMPLINGRATE_T eSamplingRate;
  101. DAIMOD_SAMPLINGRATE_T eDaiModSamplingRate;
  102. MEMIF_CH_CFG_T eChannelConfig;
  103. MEMIF_MONO_SEL_T eMonoSelect; /* Used when AWB and VUL and data is mono */
  104. MEMIF_DUP_WRITE_T eDupWrite; /* Used when MODPCM and DAI */
  105. MEMIF_BUF_T rBufferSetting;
  106. } MEMIF_CONFIG_T;
  107. /* I2S related */
  108. typedef enum {
  109. I2S_EIAJ = 0x0,
  110. I2S_I2S = 0x1
  111. } I2SFMT_T;
  112. typedef enum {
  113. I2S_16BIT = 0x0,
  114. I2S_32BIT = 0x1
  115. } I2SWLEN_T;
  116. typedef enum {
  117. I2S_NOSWAP = 0x0,
  118. I2S_LRSWAP = 0x1
  119. } I2SSWAP_T;
  120. typedef enum {
  121. I2S_DISABLE = 0x0,
  122. I2S_ENABLE = 0x1
  123. } I2SEN_T;
  124. typedef enum {
  125. I2S_MASTER = 0x0,
  126. I2S_SLAVE = 0x1
  127. } I2SSRC_T;
  128. typedef enum {
  129. I2S_OUT = 0x0,
  130. I2S_IN = 0x1
  131. } I2SDIR_T;
  132. /* PCM related */
  133. typedef enum {
  134. PCM_1 = 0x0, /* (O7, O8, I9) */
  135. PCM_2 = 0x1 /* (O17, O18, I14) */
  136. } PCM_MODULE;
  137. typedef enum {
  138. PCM_DISABLE = 0x0,
  139. PCM_ENABLE = 0x1
  140. } PCMEN_T;
  141. typedef enum {
  142. PCM_I2S = 0x0,
  143. PCM_EIAJ = 0x1,
  144. PCM_MODEA = 0x2,
  145. PCM_MODEB = 0x3
  146. } PCMFMT_T;
  147. typedef enum {
  148. PCM_8K = 0x0,
  149. PCM_16K = 0x1
  150. } PCMMODE_T;
  151. typedef enum {
  152. PCM_16BIT = 0x0,
  153. PCM_32BIT = 0x1
  154. } PCMWLEN_T;
  155. typedef enum {
  156. PCM_MASTER = 0x0,
  157. PCM_SLAVE = 0x1
  158. } PCMCLKSRC_T;
  159. typedef enum {
  160. PCM_GO_ASRC = 0x0, /* (ASRC) Set to 0 when source & destination uses different crystal */
  161. PCM_GO_ASYNC_FIFO = 0x1 /* (Async FIFO) Set to 1 when source & destination uses same crystal */
  162. } PCMBYPASRC_T;
  163. typedef enum {
  164. PCM_DMTX = 0x0, /* dual mic on TX */
  165. PCM_SMTX = 0x1 /* single mic on TX (In BT mode, only L channel data is sent on PCM TX.) */
  166. } PCMBTMODE_T;
  167. typedef enum {
  168. PCM_SYNC_LEN_1_BCK = 0x0,
  169. PCM_SYNC_LEN_N_BCK = 0x1
  170. } PCMSYNCTYPE_T;
  171. typedef enum {
  172. PCM_INT_MD = 0x0,
  173. PCM_EXT_MD = 0x1
  174. } PCMEXTMODEM_T;
  175. typedef enum {
  176. PCM_VBT_16K_MODE_DISABLE = 0x0,
  177. PCM_VBT_16K_MODE_ENABLE = 0x1
  178. } PCMVBT16KMODE_T;
  179. typedef enum {
  180. PCM_NOINV = 0x0,
  181. PCM_INV = 0x1
  182. } PCMCLKINV_T;
  183. typedef enum {
  184. PCM_LB_DISABLE = 0x0,
  185. PCM_LB_ENABLE = 0x1
  186. } PCMLOOPENA_T;
  187. typedef enum {
  188. PCM_TXFIX_OFF = 0x0,
  189. PCM_TXFIX_ON = 0x1
  190. } PCMTXFIXEN_T;
  191. typedef struct {
  192. PCMFMT_T ePcmFmt;
  193. PCMMODE_T ePcm8k16kmode;
  194. PCMWLEN_T ePcmWlen;
  195. PCMCLKSRC_T ePcmClkSrc;
  196. PCMBYPASRC_T ePcmBypassASRC;
  197. PCMEXTMODEM_T ePcmModemSel;
  198. PCMVBT16KMODE_T ePcmVbt16kSel;
  199. } PCM_INFO_T;
  200. /* BT PCM */
  201. typedef enum {
  202. BTPCM_DISABLE = 0x0,
  203. BTPCM_ENABLE = 0x1
  204. } BTPCMEN_T;
  205. typedef enum {
  206. BTPCM_8K = 0x0,
  207. BTPCM_16K = 0x1
  208. } BTPCMMODE_T;
  209. /* Interconnection related */
  210. typedef enum {
  211. I00 = 0,
  212. I01 = 1,
  213. I02 = 2,
  214. I03 = 3,
  215. I04 = 4,
  216. I05 = 5,
  217. I06 = 6,
  218. I07 = 7,
  219. I08 = 8,
  220. I09 = 9,
  221. IN_MAX
  222. } ITRCON_IN_T;
  223. typedef enum {
  224. O00 = 0,
  225. O01 = 1,
  226. O02 = 2,
  227. O03 = 3,
  228. O04 = 4,
  229. O05 = 5,
  230. O06 = 6,
  231. O07 = 7,
  232. O08 = 8,
  233. O09 = 9,
  234. O010 = 10,
  235. O011 = 11,
  236. O012 = 12,
  237. OUT_MAX
  238. } ITRCON_OUT_T;
  239. /* IRQ related */
  240. typedef enum {
  241. IRQ1 = 1,
  242. IRQ2 = 2,
  243. IRQ5 = 3, /* HDMI */
  244. IRQ6 = 4, /* SPDIF */
  245. IRQMAX
  246. } IRQTYPE_T;
  247. /* Side tone filter related */
  248. typedef enum {
  249. I3I4 = 0,
  250. HW_SINE = 1,
  251. I5I6 = 2,
  252. } STF_SRC_T;
  253. /* Sine wave generator related */
  254. typedef enum {
  255. SINE_TONE_CH1 = 0,
  256. SINE_TONE_CH2 = 1,
  257. SINE_TONE_STEREO = 2
  258. } SINE_TONE_CH_T;
  259. typedef enum {
  260. SINE_TONE_128 = 0,
  261. SINE_TONE_64 = 1,
  262. SINE_TONE_32 = 2,
  263. SINE_TONE_16 = 3,
  264. SINE_TONE_8 = 4,
  265. SINE_TONE_4 = 5,
  266. SINE_TONE_2 = 6,
  267. SINE_TONE_1 = 7
  268. } SINE_TONE_AMP_T;
  269. typedef enum {
  270. SINE_TONE_8K = 0,
  271. SINE_TONE_11K = 1,
  272. SINE_TONE_12K = 2,
  273. SINE_TONE_16K = 3,
  274. SINE_TONE_22K = 4,
  275. SINE_TONE_24K = 5,
  276. SINE_TONE_32K = 6,
  277. SINE_TONE_44K = 7,
  278. SINE_TONE_48K = 8,
  279. SINE_TONE_LOOPBACK = 9
  280. } SINE_TONE_SINEMODE_T;
  281. typedef enum {
  282. SINE_TONE_LOOPBACK_I0_I1 = 0,
  283. SINE_TONE_LOOPBACK_I2 = 1,
  284. SINE_TONE_LOOPBACK_I3_I4 = 2,
  285. SINE_TONE_LOOPBACK_I5_I6 = 3,
  286. SINE_TONE_LOOPBACK_I7_I8 = 4,
  287. SINE_TONE_LOOPBACK_I9_I10 = 5,
  288. SINE_TONE_LOOPBACK_I11_I12 = 6,
  289. SINE_TONE_LOOPBACK_O0_O1 = 7,
  290. SINE_TONE_LOOPBACK_O2 = 8,
  291. SINE_TONE_LOOPBACK_O3_O4 = 9,
  292. SINE_TONE_LOOPBACK_O5_O6 = 10,
  293. SINE_TONE_LOOPBACK_O7_O8 = 11,
  294. SINE_TONE_LOOPBACK_O9_O10 = 12,
  295. SINE_TONE_LOOPBACK_O11 = 13,
  296. SINE_TONE_LOOPBACK_O12 = 14
  297. } SINE_TONE_LOOPBACK_T;
  298. typedef struct {
  299. uint32 u4ch1_freq_div; /* 64/n sample/period */
  300. SINE_TONE_AMP_T rch1_amp_div;
  301. SINE_TONE_SINEMODE_T rch1_sine_mode;
  302. uint32 u4ch2_freq_div; /* 64/n sample/period */
  303. SINE_TONE_AMP_T rch2_amp_div;
  304. SINE_TONE_SINEMODE_T rch2_sine_mode;
  305. SINE_TONE_LOOPBACK_T rloopback_mode;
  306. } AFE_SINEGEN_INFO_T;
  307. /*****************************************************************************
  308. * C O N S T A N T S
  309. *****************************************************************************/
  310. #define AUDIO_HW_PHYSICAL_BASE (0x11220000L)
  311. #define AUDIO_CLKCFG_PHYSICAL_BASE (0x10000000L)
  312. /* need enable this register before access all register */
  313. #define AUDIO_POWER_TOP (0x10006314L)
  314. #define AUDIO_INFRA_BASE (0x10001000L)
  315. #define AUDIO_HW_VIRTUAL_BASE (0xF1220000L)
  316. #define APMIXEDSYS_BASE (0x1000C000L)
  317. #ifdef AUDIO_MEM_IOREMAP
  318. #define AFE_BASE (0L)
  319. #else
  320. #define AFE_BASE (AUDIO_HW_VIRTUAL_BASE)
  321. #endif
  322. /* Internal sram */
  323. #define AFE_INTERNAL_SRAM_PHY_BASE (0x11221000L)
  324. #define AFE_INTERNAL_SRAM_VIR_BASE (AUDIO_HW_VIRTUAL_BASE - 0x70000+0x8000) /* TODO: KC: check this */
  325. #define AFE_INTERNAL_SRAM_SIZE (0xC000) /* 48k, for normal mode */
  326. /* Dram */
  327. #define AFE_EXTERNAL_DRAM_SIZE (0x8000) /* 32k */
  328. /*****************************************************************************
  329. * M A C R O
  330. *****************************************************************************/
  331. /*****************************************************************************
  332. * R E G I S T E R D E F I N I T I O N
  333. *****************************************************************************/
  334. #define AUD_GPIO_BASE (0xF0005000L)
  335. #define AUD_GPIO_MODE39 (0x860)
  336. #define AUD_DRV_SEL4 (0xB40)
  337. #define APLL_PHYSICAL_BASE (0x10209000L)
  338. /* #define AP_PLL_CON5 (0x0014) */
  339. #define AUDIO_CLK_CFG_4 (0x0080)
  340. #define AUDIO_CLK_CFG_6 (0x00A0)
  341. #define AUDIO_CLK_CFG_7 (0x00B0)
  342. #define AUDIO_CLK_CFG_8 (0x00C0)
  343. #define AUDIO_CG_SET (0x88)
  344. #define AUDIO_CG_CLR (0x8c)
  345. #define AUDIO_CG_STATUS (0x94)
  346. /* apmixed sys */
  347. #define APLL1_CON0 0x02a0
  348. #define APLL1_CON1 0x02a4
  349. #define APLL1_CON2 0x02a8
  350. #define APLL1_CON3 0x02ac
  351. #define APLL2_CON0 0x02b4
  352. #define APLL2_CON1 0x02b8
  353. #define APLL2_CON2 0x02bc
  354. #define APLL2_CON3 0x02c0
  355. /* 6752 add */
  356. /*#define AUDIO_CLK_AUDDIV_0 (0x00120)*/
  357. /*#define AUDIO_CLK_AUDDIV_1 (0x00124)*/
  358. /* TODO: KC: fixed this, check if the following is necessary */
  359. /*#ifdef AUDIO_TOP_CON0
  360. #undef AUDIO_TOP_CON0
  361. #define AUDIO_TOP_CON0 (AFE_BASE + 0x0000)
  362. #endif
  363. #define AUDIO_TOP_CON0 (AFE_BASE + 0x0000)
  364. */
  365. #define AUDIO_TOP_CON0 (AFE_BASE + 0x0000)
  366. #define AUDIO_TOP_CON1 (AFE_BASE + 0x0004)
  367. #define AUDIO_TOP_CON3 (AFE_BASE + 0x000c)
  368. #define AFE_DAC_CON0 (AFE_BASE + 0x0010)
  369. #define AFE_DAC_CON1 (AFE_BASE + 0x0014)
  370. #define AFE_I2S_CON (AFE_BASE + 0x0018)
  371. #define AFE_DAIBT_CON0 (AFE_BASE + 0x001c)
  372. #define AFE_CONN0 (AFE_BASE + 0x0020)
  373. #define AFE_CONN1 (AFE_BASE + 0x0024)
  374. #define AFE_CONN2 (AFE_BASE + 0x0028)
  375. #define AFE_CONN3 (AFE_BASE + 0x002c)
  376. #define AFE_CONN4 (AFE_BASE + 0x0030)
  377. #define AFE_I2S_CON1 (AFE_BASE + 0x0034)
  378. #define AFE_I2S_CON2 (AFE_BASE + 0x0038)
  379. #define AFE_MRGIF_CON (AFE_BASE + 0x003c)
  380. #define AFE_DL1_BASE (AFE_BASE + 0x0040)
  381. #define AFE_DL1_CUR (AFE_BASE + 0x0044)
  382. #define AFE_DL1_END (AFE_BASE + 0x0048)
  383. #define AFE_I2S_CON3 (AFE_BASE + 0x004c)
  384. #define AFE_DL2_BASE (AFE_BASE + 0x0050)
  385. #define AFE_DL2_CUR (AFE_BASE + 0x0054)
  386. #define AFE_DL2_END (AFE_BASE + 0x0058)
  387. #define AFE_CONN5 (AFE_BASE + 0x005c)
  388. #define AFE_CONN_24BIT (AFE_BASE + 0x006c)
  389. #define AFE_AWB_BASE (AFE_BASE + 0x0070)
  390. #define AFE_AWB_END (AFE_BASE + 0x0078)
  391. #define AFE_AWB_CUR (AFE_BASE + 0x007c)
  392. #define AFE_VUL_BASE (AFE_BASE + 0x0080)
  393. #define AFE_VUL_END (AFE_BASE + 0x0088)
  394. #define AFE_VUL_CUR (AFE_BASE + 0x008c)
  395. #define AFE_DAI_BASE (AFE_BASE + 0x0090)
  396. #define AFE_DAI_END (AFE_BASE + 0x0098)
  397. #define AFE_DAI_CUR (AFE_BASE + 0x009c)
  398. #define AFE_CONN6 (AFE_BASE + 0x00bc)
  399. #define AFE_MEMIF_MSB (AFE_BASE + 0x00cc)
  400. #define AFE_MEMIF_MON0 (AFE_BASE + 0x00d0)
  401. #define AFE_MEMIF_MON1 (AFE_BASE + 0x00d4)
  402. #define AFE_MEMIF_MON2 (AFE_BASE + 0x00d8)
  403. #define AFE_MEMIF_MON4 (AFE_BASE + 0x00e0)
  404. #define AFE_ADDA_DL_SRC2_CON0 (AFE_BASE + 0x0108)
  405. #define AFE_ADDA_DL_SRC2_CON1 (AFE_BASE + 0x010c)
  406. #define AFE_ADDA_UL_SRC_CON0 (AFE_BASE + 0x0114)
  407. #define AFE_ADDA_UL_SRC_CON1 (AFE_BASE + 0x0118)
  408. #define AFE_ADDA_TOP_CON0 (AFE_BASE + 0x0120)
  409. #define AFE_ADDA_UL_DL_CON0 (AFE_BASE + 0x0124)
  410. #define AFE_ADDA_SRC_DEBUG (AFE_BASE + 0x012c)
  411. #define AFE_ADDA_SRC_DEBUG_MON0 (AFE_BASE + 0x0130)
  412. #define AFE_ADDA_SRC_DEBUG_MON1 (AFE_BASE + 0x0134)
  413. #define AFE_ADDA_NEWIF_CFG0 (AFE_BASE + 0x0138)
  414. #define AFE_ADDA_NEWIF_CFG1 (AFE_BASE + 0x013c)
  415. #define AFE_ADDA_NEWIF_CFG2 (AFE_BASE + 0x0140)
  416. #define AFE_DMA_CTL (AFE_BASE + 0x0150)
  417. #define AFE_DMA_MON0 (AFE_BASE + 0x0154)
  418. #define AFE_DMA_MON1 (AFE_BASE + 0x0158)
  419. #define AFE_SIDETONE_DEBUG (AFE_BASE + 0x01d0)
  420. #define AFE_SIDETONE_MON (AFE_BASE + 0x01d4)
  421. #define AFE_SIDETONE_CON0 (AFE_BASE + 0x01e0)
  422. #define AFE_SIDETONE_COEFF (AFE_BASE + 0x01e4)
  423. #define AFE_SIDETONE_CON1 (AFE_BASE + 0x01e8)
  424. #define AFE_SIDETONE_GAIN (AFE_BASE + 0x01ec)
  425. #define AFE_SGEN_CON0 (AFE_BASE + 0x01f0)
  426. #define AFE_SINEGEN_CON_TDM (AFE_BASE + 0x01fc)
  427. #define AFE_TOP_CON0 (AFE_BASE + 0x0200)
  428. #define AFE_ADDA_PREDIS_CON0 (AFE_BASE + 0x0260)
  429. #define AFE_ADDA_PREDIS_CON1 (AFE_BASE + 0x0264)
  430. #define AFE_MRGIF_MON0 (AFE_BASE + 0x0270)
  431. #define AFE_MRGIF_MON1 (AFE_BASE + 0x0274)
  432. #define AFE_MRGIF_MON2 (AFE_BASE + 0x0278)
  433. #define AFE_I2S_MON (AFE_BASE + 0x027c)
  434. #define AFE_MOD_DAI_BASE (AFE_BASE + 0x0330)
  435. #define AFE_MOD_DAI_END (AFE_BASE + 0x0338)
  436. #define AFE_MOD_DAI_CUR (AFE_BASE + 0x033c)
  437. #define AFE_VUL_D2_BASE (AFE_BASE + 0x0350)
  438. #define AFE_VUL_D2_END (AFE_BASE + 0x0358)
  439. #define AFE_VUL_D2_CUR (AFE_BASE + 0x035c)
  440. #define AFE_DL3_BASE (AFE_BASE + 0x0360)
  441. #define AFE_DL3_CUR (AFE_BASE + 0x0364)
  442. #define AFE_DL3_END (AFE_BASE + 0x0368)
  443. #define AFE_HDMI_OUT_CON0 (AFE_BASE + 0x0370)
  444. #define AFE_HDMI_BASE (AFE_BASE + 0x0374)
  445. #define AFE_HDMI_CUR (AFE_BASE + 0x0378)
  446. #define AFE_HDMI_END (AFE_BASE + 0x037c)
  447. #define AFE_HDMI_CONN0 (AFE_BASE + 0x0390)
  448. #define AFE_IRQ3_MCU_CNT_MON (AFE_BASE + 0x0398)
  449. #define AFE_IRQ4_MCU_CNT_MON (AFE_BASE + 0x039c)
  450. #define AFE_IRQ_MCU_CON (AFE_BASE + 0x03a0)
  451. #define AFE_IRQ_MCU_STATUS (AFE_BASE + 0x03a4)
  452. #define AFE_IRQ_MCU_CLR (AFE_BASE + 0x03a8)
  453. #define AFE_IRQ_MCU_CNT1 (AFE_BASE + 0x03ac)
  454. #define AFE_IRQ_MCU_CNT2 (AFE_BASE + 0x03b0)
  455. #define AFE_IRQ_MCU_EN (AFE_BASE + 0x03b4)
  456. #define AFE_IRQ_MCU_MON2 (AFE_BASE + 0x03b8)
  457. #define AFE_IRQ_MCU_CNT5 (AFE_BASE + 0x03bc)
  458. #define AFE_IRQ1_MCU_CNT_MON (AFE_BASE + 0x03c0)
  459. #define AFE_IRQ2_MCU_CNT_MON (AFE_BASE + 0x03c4)
  460. #define AFE_IRQ1_MCU_EN_CNT_MON (AFE_BASE + 0x03c8)
  461. #define AFE_IRQ5_MCU_CNT_MON (AFE_BASE + 0x03cc)
  462. #define AFE_MEMIF_MINLEN (AFE_BASE + 0x03d0)
  463. #define AFE_MEMIF_MAXLEN (AFE_BASE + 0x03d4)
  464. #define AFE_MEMIF_PBUF_SIZE (AFE_BASE + 0x03d8)
  465. #define AFE_IRQ_MCU_CNT7 (AFE_BASE + 0x03dc)
  466. #define AFE_IRQ7_MCU_CNT_MON (AFE_BASE + 0x03e0)
  467. #define AFE_IRQ_MCU_CNT3 (AFE_BASE + 0x03e4)
  468. #define AFE_IRQ_MCU_CNT4 (AFE_BASE + 0x03e8)
  469. #define AFE_APLL1_TUNER_CFG (AFE_BASE + 0x03f0)
  470. #define AFE_APLL2_TUNER_CFG (AFE_BASE + 0x03f4)
  471. #define AFE_MEMIF_HD_MODE (AFE_BASE + 0x03f8)
  472. #define AFE_MEMIF_HDALIGN (AFE_BASE + 0x03fc)
  473. #define AFE_GAIN1_CON0 (AFE_BASE + 0x0410)
  474. #define AFE_GAIN1_CON1 (AFE_BASE + 0x0414)
  475. #define AFE_GAIN1_CON2 (AFE_BASE + 0x0418)
  476. #define AFE_GAIN1_CON3 (AFE_BASE + 0x041c)
  477. #define AFE_CONN7 (AFE_BASE + 0x0420)
  478. #define AFE_GAIN1_CUR (AFE_BASE + 0x0424)
  479. #define AFE_GAIN2_CON0 (AFE_BASE + 0x0428)
  480. #define AFE_GAIN2_CON1 (AFE_BASE + 0x042c)
  481. #define AFE_GAIN2_CON2 (AFE_BASE + 0x0430)
  482. #define AFE_GAIN2_CON3 (AFE_BASE + 0x0434)
  483. #define AFE_CONN8 (AFE_BASE + 0x0438)
  484. #define AFE_GAIN2_CUR (AFE_BASE + 0x043c)
  485. #define AFE_CONN9 (AFE_BASE + 0x0440)
  486. #define AFE_CONN10 (AFE_BASE + 0x0444)
  487. #define AFE_CONN11 (AFE_BASE + 0x0448)
  488. #define AFE_CONN12 (AFE_BASE + 0x044c)
  489. #define AFE_CONN13 (AFE_BASE + 0x0450)
  490. #define AFE_CONN14 (AFE_BASE + 0x0454)
  491. #define AFE_CONN15 (AFE_BASE + 0x0458)
  492. #define AFE_CONN16 (AFE_BASE + 0x045c)
  493. #define AFE_CONN17 (AFE_BASE + 0x0460)
  494. #define AFE_CONN18 (AFE_BASE + 0x0464)
  495. #define AFE_CONN19 (AFE_BASE + 0x0468)
  496. #define AFE_CONN20 (AFE_BASE + 0x046c)
  497. #define AFE_CONN21 (AFE_BASE + 0x0470)
  498. #define AFE_CONN22 (AFE_BASE + 0x0474)
  499. #define AFE_CONN23 (AFE_BASE + 0x0478)
  500. #define AFE_CONN24 (AFE_BASE + 0x047c)
  501. #define AFE_CONN_RS (AFE_BASE + 0x0494)
  502. #define AFE_CONN_DI (AFE_BASE + 0x0498)
  503. #define AFE_CONN25 (AFE_BASE + 0x04b0)
  504. #define AFE_CONN26 (AFE_BASE + 0x04b4)
  505. #define AFE_CONN27 (AFE_BASE + 0x04b8)
  506. #define AFE_CONN28 (AFE_BASE + 0x04bc)
  507. #define AFE_CONN29 (AFE_BASE + 0x04c0)
  508. #define AFE_SRAM_DELSEL_CON0 (AFE_BASE + 0x04f0)
  509. #define AFE_SRAM_DELSEL_CON1 (AFE_BASE + 0x04f4)
  510. #define AFE_ASRC_CON0 (AFE_BASE + 0x0500)
  511. #define AFE_ASRC_CON1 (AFE_BASE + 0x0504)
  512. #define AFE_ASRC_CON2 (AFE_BASE + 0x0508)
  513. #define AFE_ASRC_CON3 (AFE_BASE + 0x050c)
  514. #define AFE_ASRC_CON4 (AFE_BASE + 0x0510)
  515. #define AFE_ASRC_CON5 (AFE_BASE + 0x0514)
  516. #define AFE_ASRC_CON6 (AFE_BASE + 0x0518)
  517. #define AFE_ASRC_CON7 (AFE_BASE + 0x051c)
  518. #define AFE_ASRC_CON8 (AFE_BASE + 0x0520)
  519. #define AFE_ASRC_CON9 (AFE_BASE + 0x0524)
  520. #define AFE_ASRC_CON10 (AFE_BASE + 0x0528)
  521. #define AFE_ASRC_CON11 (AFE_BASE + 0x052c)
  522. #define PCM_INTF_CON1 (AFE_BASE + 0x0530)
  523. #define PCM_INTF_CON2 (AFE_BASE + 0x0538)
  524. #define PCM2_INTF_CON (AFE_BASE + 0x053c)
  525. #define AFE_TDM_CON1 (AFE_BASE + 0x0548)
  526. #define AFE_TDM_CON2 (AFE_BASE + 0x054c)
  527. #define AFE_ASRC_CON13 (AFE_BASE + 0x0550)
  528. #define AFE_ASRC_CON14 (AFE_BASE + 0x0554)
  529. #define AFE_ASRC_CON15 (AFE_BASE + 0x0558)
  530. #define AFE_ASRC_CON16 (AFE_BASE + 0x055c)
  531. #define AFE_ASRC_CON17 (AFE_BASE + 0x0560)
  532. #define AFE_ASRC_CON18 (AFE_BASE + 0x0564)
  533. #define AFE_ASRC_CON19 (AFE_BASE + 0x0568)
  534. #define AFE_ASRC_CON20 (AFE_BASE + 0x056c)
  535. #define AFE_ASRC_CON21 (AFE_BASE + 0x0570)
  536. #define CLK_AUDDIV_0 (AFE_BASE + 0x05a0)
  537. #define CLK_AUDDIV_1 (AFE_BASE + 0x05a4)
  538. #define CLK_AUDDIV_2 (AFE_BASE + 0x05a8)
  539. #define CLK_AUDDIV_3 (AFE_BASE + 0x05ac)
  540. #define AUDIO_TOP_DBG_CON (AFE_BASE + 0x05c8)
  541. #define AUDIO_TOP_DBG_MON0 (AFE_BASE + 0x05cc)
  542. #define AUDIO_TOP_DBG_MON1 (AFE_BASE + 0x05d0)
  543. #define AUDIO_TOP_DBG_MON2 (AFE_BASE + 0x05d4)
  544. #define AFE_ADDA2_TOP_CON0 (AFE_BASE + 0x0600)
  545. #define AFE_ASRC4_CON0 (AFE_BASE + 0x06c0)
  546. #define AFE_ASRC4_CON1 (AFE_BASE + 0x06c4)
  547. #define AFE_ASRC4_CON2 (AFE_BASE + 0x06c8)
  548. #define AFE_ASRC4_CON3 (AFE_BASE + 0x06cc)
  549. #define AFE_ASRC4_CON4 (AFE_BASE + 0x06d0)
  550. #define AFE_ASRC4_CON5 (AFE_BASE + 0x06d4)
  551. #define AFE_ASRC4_CON6 (AFE_BASE + 0x06d8)
  552. #define AFE_ASRC4_CON7 (AFE_BASE + 0x06dc)
  553. #define AFE_ASRC4_CON8 (AFE_BASE + 0x06e0)
  554. #define AFE_ASRC4_CON9 (AFE_BASE + 0x06e4)
  555. #define AFE_ASRC4_CON10 (AFE_BASE + 0x06e8)
  556. #define AFE_ASRC4_CON11 (AFE_BASE + 0x06ec)
  557. #define AFE_ASRC4_CON12 (AFE_BASE + 0x06f0)
  558. #define AFE_ASRC4_CON13 (AFE_BASE + 0x06f4)
  559. #define AFE_ASRC4_CON14 (AFE_BASE + 0x06f8)
  560. #define AFE_ASRC2_CON0 (AFE_BASE + 0x0700)
  561. #define AFE_ASRC2_CON1 (AFE_BASE + 0x0704)
  562. #define AFE_ASRC2_CON2 (AFE_BASE + 0x0708)
  563. #define AFE_ASRC2_CON3 (AFE_BASE + 0x070c)
  564. #define AFE_ASRC2_CON4 (AFE_BASE + 0x0710)
  565. #define AFE_ASRC2_CON5 (AFE_BASE + 0x0714)
  566. #define AFE_ASRC2_CON6 (AFE_BASE + 0x0718)
  567. #define AFE_ASRC2_CON7 (AFE_BASE + 0x071c)
  568. #define AFE_ASRC2_CON8 (AFE_BASE + 0x0720)
  569. #define AFE_ASRC2_CON9 (AFE_BASE + 0x0724)
  570. #define AFE_ASRC2_CON10 (AFE_BASE + 0x0728)
  571. #define AFE_ASRC2_CON11 (AFE_BASE + 0x072c)
  572. #define AFE_ASRC2_CON12 (AFE_BASE + 0x0730)
  573. #define AFE_ASRC2_CON13 (AFE_BASE + 0x0734)
  574. #define AFE_ASRC2_CON14 (AFE_BASE + 0x0738)
  575. #define AFE_ASRC3_CON0 (AFE_BASE + 0x0740)
  576. #define AFE_ASRC3_CON1 (AFE_BASE + 0x0744)
  577. #define AFE_ASRC3_CON2 (AFE_BASE + 0x0748)
  578. #define AFE_ASRC3_CON3 (AFE_BASE + 0x074c)
  579. #define AFE_ASRC3_CON4 (AFE_BASE + 0x0750)
  580. #define AFE_ASRC3_CON5 (AFE_BASE + 0x0754)
  581. #define AFE_ASRC3_CON6 (AFE_BASE + 0x0758)
  582. #define AFE_ASRC3_CON7 (AFE_BASE + 0x075c)
  583. #define AFE_ASRC3_CON8 (AFE_BASE + 0x0760)
  584. #define AFE_ASRC3_CON9 (AFE_BASE + 0x0764)
  585. #define AFE_ASRC3_CON10 (AFE_BASE + 0x0768)
  586. #define AFE_ASRC3_CON11 (AFE_BASE + 0x076c)
  587. #define AFE_ASRC3_CON12 (AFE_BASE + 0x0770)
  588. #define AFE_ASRC3_CON13 (AFE_BASE + 0x0774)
  589. #define AFE_ASRC3_CON14 (AFE_BASE + 0x0778)
  590. #define AFE_GENERAL_REG0 (AFE_BASE + 0x0800)
  591. #define AFE_GENERAL_REG1 (AFE_BASE + 0x0804)
  592. #define AFE_GENERAL_REG2 (AFE_BASE + 0x0808)
  593. #define AFE_GENERAL_REG3 (AFE_BASE + 0x080c)
  594. #define AFE_GENERAL_REG4 (AFE_BASE + 0x0810)
  595. #define AFE_GENERAL_REG5 (AFE_BASE + 0x0814)
  596. #define AFE_GENERAL_REG6 (AFE_BASE + 0x0818)
  597. #define AFE_GENERAL_REG7 (AFE_BASE + 0x081c)
  598. #define AFE_GENERAL_REG8 (AFE_BASE + 0x0820)
  599. #define AFE_GENERAL_REG9 (AFE_BASE + 0x0824)
  600. #define AFE_GENERAL_REG10 (AFE_BASE + 0x0828)
  601. #define AFE_GENERAL_REG11 (AFE_BASE + 0x082c)
  602. #define AFE_GENERAL_REG12 (AFE_BASE + 0x0830)
  603. #define AFE_GENERAL_REG13 (AFE_BASE + 0x0834)
  604. #define AFE_GENERAL_REG14 (AFE_BASE + 0x0838)
  605. #define AFE_GENERAL_REG15 (AFE_BASE + 0x083c)
  606. #define AFE_CBIP_CFG0 (AFE_BASE + 0x0840)
  607. #define AFE_CBIP_MON0 (AFE_BASE + 0x0844)
  608. #define AFE_CBIP_SLV_MUX_MON0 (AFE_BASE + 0x0848)
  609. #define AFE_CBIP_SLV_DECODER_MON0 (AFE_BASE + 0x084c)
  610. #define AFE_MAXLENGTH (AFE_BASE + 0x084c)
  611. #ifdef CONFIG_FPGA_EARLY_PORTING
  612. #define FPGA_CFG0 (AFE_BASE + 0x05b0)
  613. #endif
  614. /* do afe register ioremap */
  615. void Auddrv_Reg_map(void);
  616. void Afe_Set_Reg(uint32 offset, uint32 value, uint32 mask);
  617. uint32 Afe_Get_Reg(uint32 offset);
  618. /* function to Set Cfg */
  619. uint32 GetClkCfg(uint32 offset);
  620. void SetClkCfg(uint32 offset, uint32 value, uint32 mask);
  621. /* function to Set Infra Cfg */
  622. uint32 GetInfraCfg(uint32 offset);
  623. void SetInfraCfg(uint32 offset, uint32 value, uint32 mask);
  624. /* function to Set pll */
  625. uint32 GetpllCfg(uint32 offset);
  626. void SetpllCfg(uint32 offset, uint32 value, uint32 mask);
  627. /* function to apmixed */
  628. uint32 GetApmixedCfg(uint32 offset);
  629. void SetApmixedCfg(uint32 offset, uint32 value, uint32 mask);
  630. /* for debug usage */
  631. void Afe_Log_Print(void);
  632. /* function to get pointer */
  633. dma_addr_t Get_Afe_Sram_Phys_Addr(void);
  634. dma_addr_t Get_Afe_Sram_Capture_Phys_Addr(void);
  635. void *Get_Afe_SramBase_Pointer(void);
  636. void *Get_Afe_SramCaptureBase_Pointer(void);
  637. void *Get_Afe_Powertop_Pointer(void);
  638. void *Get_AudClk_Pointer(void);
  639. void *Get_Afe_Infra_Pointer(void);
  640. #endif