AudDrv_Afe.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788
  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. * MT6583 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 (0x1000629cL)
  314. #define AUDIO_INFRA_BASE (0x10001000L)
  315. #define AUDIO_HW_VIRTUAL_BASE (0xF1220000L)
  316. #ifdef AUDIO_MEM_IOREMAP
  317. #define AFE_BASE (0L)
  318. #else
  319. #define AFE_BASE (AUDIO_HW_VIRTUAL_BASE)
  320. #endif
  321. /* Internal sram: 0x1200000 (48K) */
  322. #define AFE_INTERNAL_SRAM_PHY_BASE (0x11221000L)
  323. #define AFE_INTERNAL_SRAM_VIR_BASE (AUDIO_HW_VIRTUAL_BASE - 0x70000+0x8000)
  324. #define AFE_INTERNAL_SRAM_SIZE (0xC000)
  325. /* Dram */
  326. #define AFE_EXTERNAL_DRAM_SIZE (0xC000)
  327. /*****************************************************************************
  328. * M A C R O
  329. *****************************************************************************/
  330. /*****************************************************************************
  331. * R E G I S T E R D E F I N I T I O N
  332. *****************************************************************************/
  333. #define AUD_GPIO_BASE (0xF0005000L)
  334. #define AUD_GPIO_MODE39 (0x860)
  335. #define AUD_DRV_SEL4 (0xB40)
  336. #define APLL_PHYSICAL_BASE (0x10209000L)
  337. #define AP_PLL_CON5 (0x0014)
  338. #define AUDIO_CLK_CFG_4 (0x0080)
  339. #define AUDIO_CLK_CFG_6 (0x00A0)
  340. #define AUDIO_CLK_CFG_7 (0x00B0)
  341. #define AUDIO_CG_SET (0x88)
  342. #define AUDIO_CG_CLR (0x8c)
  343. #define AUDIO_CG_STATUS (0x94)
  344. #ifdef AUDIO_TOP_CON0
  345. #undef AUDIO_TOP_CON0
  346. #define AUDIO_TOP_CON0 (AFE_BASE + 0x0000)
  347. #endif
  348. #define AUDIO_TOP_CON0 (AFE_BASE + 0x0000)
  349. #define AUDIO_TOP_CON1 (AFE_BASE + 0x0004)
  350. #define AUDIO_TOP_CON2 (AFE_BASE + 0x0008)
  351. #define AUDIO_TOP_CON3 (AFE_BASE + 0x000C)
  352. #define AFE_DAC_CON0 (AFE_BASE + 0x0010)
  353. #define AFE_DAC_CON1 (AFE_BASE + 0x0014)
  354. #define AFE_I2S_CON (AFE_BASE + 0x0018)
  355. #define AFE_DAIBT_CON0 (AFE_BASE + 0x001c)
  356. #define AFE_CONN0 (AFE_BASE + 0x0020)
  357. #define AFE_CONN1 (AFE_BASE + 0x0024)
  358. #define AFE_CONN2 (AFE_BASE + 0x0028)
  359. #define AFE_CONN3 (AFE_BASE + 0x002C)
  360. #define AFE_CONN4 (AFE_BASE + 0x0030)
  361. #define AFE_I2S_CON1 (AFE_BASE + 0x0034)
  362. #define AFE_I2S_CON2 (AFE_BASE + 0x0038)
  363. #define AFE_MRGIF_CON (AFE_BASE + 0x003C)
  364. /* Memory interface */
  365. #define AFE_DL1_BASE (AFE_BASE + 0x0040)
  366. #define AFE_DL1_CUR (AFE_BASE + 0x0044)
  367. #define AFE_DL1_END (AFE_BASE + 0x0048)
  368. #define AFE_DL1_D2_BASE (AFE_BASE + 0x0340)
  369. #define AFE_DL1_D2_CUR (AFE_BASE + 0x0344)
  370. #define AFE_DL1_D2_END (AFE_BASE + 0x0348)
  371. #define AFE_VUL_D2_BASE (AFE_BASE + 0x0350)
  372. #define AFE_VUL_D2_END (AFE_BASE + 0x0358)
  373. #define AFE_VUL_D2_CUR (AFE_BASE + 0x035C)
  374. #define AFE_I2S_CON3 (AFE_BASE + 0x004C)
  375. #define AFE_DL2_BASE (AFE_BASE + 0x0050)
  376. #define AFE_DL2_CUR (AFE_BASE + 0x0054)
  377. #define AFE_DL2_END (AFE_BASE + 0x0058)
  378. #define AFE_CONN5 (AFE_BASE + 0x005C)
  379. #define AFE_CONN_24BIT (AFE_BASE + 0x006C)
  380. #define AFE_AWB_BASE (AFE_BASE + 0x0070)
  381. #define AFE_AWB_END (AFE_BASE + 0x0078)
  382. #define AFE_AWB_CUR (AFE_BASE + 0x007C)
  383. #define AFE_VUL_BASE (AFE_BASE + 0x0080)
  384. #define AFE_VUL_END (AFE_BASE + 0x0088)
  385. #define AFE_VUL_CUR (AFE_BASE + 0x008C)
  386. #define AFE_DAI_BASE (AFE_BASE + 0x0090)
  387. #define AFE_DAI_END (AFE_BASE + 0x0098)
  388. #define AFE_DAI_CUR (AFE_BASE + 0x009C)
  389. #define AFE_CONN6 (AFE_BASE + 0x00BC)
  390. #define AFE_MEMIF_MSB (AFE_BASE + 0x00CC)
  391. /* Memory interface monitor */
  392. #define AFE_MEMIF_MON0 (AFE_BASE + 0x00D0)
  393. #define AFE_MEMIF_MON1 (AFE_BASE + 0x00D4)
  394. #define AFE_MEMIF_MON2 (AFE_BASE + 0x00D8)
  395. /* #define AFE_MEMIF_MON3 (AFE_BASE + 0x00DC) //93 w/o */
  396. #define AFE_MEMIF_MON4 (AFE_BASE + 0x00E0)
  397. /* 6582 Add */
  398. #define AFE_ADDA_DL_SRC2_CON0 (AFE_BASE+0x00108)
  399. #define AFE_ADDA_DL_SRC2_CON1 (AFE_BASE+0x0010C)
  400. #define AFE_ADDA_UL_SRC_CON0 (AFE_BASE+0x00114)
  401. #define AFE_ADDA_UL_SRC_CON1 (AFE_BASE+0x00118)
  402. #define AFE_ADDA_TOP_CON0 (AFE_BASE+0x00120)
  403. #define AFE_ADDA_UL_DL_CON0 (AFE_BASE+0x00124)
  404. #define AFE_ADDA_SRC_DEBUG (AFE_BASE+0x0012C)
  405. #define AFE_ADDA_SRC_DEBUG_MON0 (AFE_BASE+0x00130)
  406. #define AFE_ADDA_SRC_DEBUG_MON1 (AFE_BASE+0x00134)
  407. #define AFE_ADDA_NEWIF_CFG0 (AFE_BASE+0x00138)
  408. #define AFE_ADDA_NEWIF_CFG1 (AFE_BASE+0x0013C)
  409. /* #define AFE_DL_SRC1_1 (AFE_BASE + 0x0100) */
  410. /* #define AFE_DL_SRC1_2 (AFE_BASE + 0x0104) */
  411. /* #define AFE_DL_SRC2_1 (AFE_BASE + 0x0108) */
  412. /* #define AFE_DL_SRC2_2 (AFE_BASE + 0x010C) */
  413. /* #define AFE_DL_SDM_CON0 (AFE_BASE + 0x0110) */
  414. /* #define AFE_UL_SRC_0 (AFE_BASE + 0x0114) */
  415. /* #define AFE_UL_SRC_1 (AFE_BASE + 0x0118) */
  416. /* #define AFE_VAGC_CON1 (AFE_BASE + 0x0120) */
  417. /* #define AFE_VAGC_CON2 (AFE_BASE + 0x0124) */
  418. /* #define AFE_VAGC_CON3 (AFE_BASE + 0x0128) */
  419. /* #define AFE_VAGC_CON4 (AFE_BASE + 0x012C) */
  420. /* #define AFE_VAGC_CON5 (AFE_BASE + 0x0130) */
  421. /* #define AFE_VAGC_CON6 (AFE_BASE + 0x0134) */
  422. /* #define AFE_VAGC_CON7 (AFE_BASE + 0x0138) */
  423. /* #define AFE_VAGC_CON8 (AFE_BASE + 0x013C) */
  424. /* #define AFE_VAGC_CON9 (AFE_BASE + 0x0140) */
  425. /* #define AFE_VAGC_CON10 (AFE_BASE + 0x0144) */
  426. /* #define AFE_VAGC_CON11 (AFE_BASE + 0x0148) */
  427. /* #define AFE_VAGC_CON12 (AFE_BASE + 0x014C) */
  428. /* #define AFE_VAGC_CON13 (AFE_BASE + 0x0150) */
  429. /* #define AFE_VAGC_CON14 (AFE_BASE + 0x0154) */
  430. /* #define AFE_VAGC_CON15 (AFE_BASE + 0x0158) */
  431. /* #define AFE_VAGC_CON16 (AFE_BASE + 0x015C) */
  432. /* #define AFE_VAGC_CON17 (AFE_BASE + 0x0160) */
  433. /* #define AFE_VAGC_CON18 (AFE_BASE + 0x0164) */
  434. /* #define AFE_VAGC_CON19 (AFE_BASE + 0x0168) */
  435. /* #define AFE_FOC_CON (AFE_BASE + 0x0170) */
  436. /* #define AFE_FOC_CON1 (AFE_BASE + 0x0174) */
  437. /* #define AFE_FOC_CON2 (AFE_BASE + 0x0178) */
  438. /* #define AFE_FOC_CON3 (AFE_BASE + 0x017C) */
  439. /* #define AFE_FOC_CON4 (AFE_BASE + 0x0180) */
  440. /* #define AFE_FOC_CON5 (AFE_BASE + 0x0184) */
  441. /* #define AFE_MON_STEP (AFE_BASE + 0x0188) */
  442. #define AFE_SIDETONE_DEBUG (AFE_BASE + 0x01D0)
  443. #define AFE_SIDETONE_MON (AFE_BASE + 0x01D4)
  444. #define AFE_SIDETONE_CON0 (AFE_BASE + 0x01E0)
  445. #define AFE_SIDETONE_COEFF (AFE_BASE + 0x01E4)
  446. #define AFE_SIDETONE_CON1 (AFE_BASE + 0x01E8)
  447. #define AFE_SIDETONE_GAIN (AFE_BASE + 0x01EC)
  448. #define AFE_SGEN_CON0 (AFE_BASE + 0x01F0)
  449. #define AFE_TOP_CON0 (AFE_BASE + 0x0200)
  450. #define AFE_ADDA_PREDIS_CON0 (AFE_BASE+0x00260)
  451. #define AFE_ADDA_PREDIS_CON1 (AFE_BASE+0x00264)
  452. #define AFE_MRGIF_MON0 (AFE_BASE+0x00270)
  453. #define AFE_MRGIF_MON1 (AFE_BASE+0x00274)
  454. #define AFE_MRGIF_MON2 (AFE_BASE+0x00278)
  455. /* 93 w/o */
  456. /* #define AFE_AGC_MON0 (AFE_BASE + 0x0290) */
  457. /* #define AFE_AGC_MON1 (AFE_BASE + 0x0294) */
  458. /* #define AFE_AGC_MON2 (AFE_BASE + 0x0298) */
  459. /* #define AFE_AGC_MON3 (AFE_BASE + 0x029C) */
  460. /* #define AFE_AGC_MON4 (AFE_BASE + 0x02A0) */
  461. /* #define AFE_AGC_MON5 (AFE_BASE + 0x0318) */
  462. /* #define AFE_VAD_MON0 (AFE_BASE + 0x02A4) */
  463. /* #define AFE_VAD_MON1 (AFE_BASE + 0x02A8) */
  464. /* #define AFE_VAD_MON2 (AFE_BASE + 0x02AC) */
  465. /* #define AFE_VAD_MON3 (AFE_BASE + 0x02B0) */
  466. /* #define AFE_VAD_MON4 (AFE_BASE + 0x02B4) */
  467. /* #define AFE_VAD_MON5 (AFE_BASE + 0x02B8) */
  468. /* #define AFE_VAD_MON6 (AFE_BASE + 0x02BC) */
  469. /* #define AFE_VAD_MON7 (AFE_BASE + 0x02C0) */
  470. /* #define AFE_VAD_MON8 (AFE_BASE + 0x02C4) */
  471. /* #define AFE_VAD_MON9 (AFE_BASE + 0x02C8) */
  472. /* #define AFE_VAD_MON10 (AFE_BASE + 0x02CC) */
  473. /* #define AFE_VAD_MON11 (AFE_BASE + 0x02D0) */
  474. /* #define AFE_MOD_PCM_BASE (AFE_BASE + 0x0330) //93 rename */
  475. #define AFE_MOD_DAI_BASE (AFE_BASE + 0x0330)
  476. /* #define AFE_MOD_PCM_END (AFE_BASE + 0x0338) //93 rename */
  477. #define AFE_MOD_DAI_END (AFE_BASE + 0x0338)
  478. /* #define AFE_MOD_PCM_CUR (AFE_BASE + 0x033C) //93 rename */
  479. #define AFE_MOD_DAI_CUR (AFE_BASE + 0x033C)
  480. /* #define AFE_SPDIF_OUT_CON0 (AFE_BASE + 0x0380) */
  481. /* #define AFE_SPDIF_BASE (AFE_BASE + 0x0384) */
  482. /* #define AFE_SPDIF_CUR (AFE_BASE + 0x0388) */
  483. /* #define AFE_SPDIF_END (AFE_BASE + 0x038C) */
  484. /* #define AFE_8CH_I2S_OUT_CON (AFE_BASE + 0x0394) */
  485. /* 93 rename */
  486. /* #define AFE_IRQ_CON (AFE_BASE + 0x03A0) */
  487. #define AFE_IRQ_MCU_CON (AFE_BASE + 0x03A0)
  488. /* #define AFE_IRQ_STATUS (AFE_BASE + 0x03A4) */
  489. #define AFE_IRQ_MCU_STATUS (AFE_BASE + 0x03A4)
  490. /* #define AFE_IRQ_CLR (AFE_BASE + 0x03A8) */
  491. #define AFE_IRQ_MCU_CLR (AFE_BASE + 0x03A8)
  492. /* #define AFE_IRQ_CNT1 (AFE_BASE + 0x03AC) */
  493. #define AFE_IRQ_MCU_CNT1 (AFE_BASE + 0x03AC)
  494. /* #define AFE_IRQ_CNT2 (AFE_BASE + 0x03B0) */
  495. #define AFE_IRQ_MCU_CNT2 (AFE_BASE + 0x03B0)
  496. #define AFE_IRQ_MCU_EN (AFE_BASE + 0x03B4)
  497. /* #define AFE_IRQ_MON2 (AFE_BASE + 0x03B8) */
  498. #define AFE_IRQ_MCU_MON2 (AFE_BASE + 0x03B8)
  499. #define AFE_IRQ_CNT5 (AFE_BASE + 0x03BC) /* 93 w/o */
  500. /* #define AFE_IRQ1_CNT_MON (AFE_BASE + 0x03C0) */
  501. #define AFE_IRQ1_MCU_CNT_MON (AFE_BASE + 0x03C0)
  502. /* #define AFE_IRQ2_CNT_MON (AFE_BASE + 0x03C4) */
  503. #define AFE_IRQ2_MCU_CNT_MON (AFE_BASE + 0x03C4)
  504. /* #define AFE_IRQ1_EN_CNT_MON (AFE_BASE + 0x03C8) */
  505. #define AFE_IRQ1_MCU_EN_CNT_MON (AFE_BASE + 0x03C8)
  506. #define AFE_IRQ_DEBUG (AFE_BASE + 0x03CC) /* 93 w/o */
  507. /* #define AFE_MEMIF_MINLEN (AFE_BASE + 0x03D0) //93 w/o */
  508. #define AFE_MEMIF_MAXLEN (AFE_BASE + 0x03D4)
  509. /* #define AFE_IEC_PREFETCH_SIZE (AFE_BASE + 0x03D8) */
  510. #define AFE_MEMIF_PBUF_SIZE (AFE_BASE + 0x03D8)
  511. #define AFE_IRQ_MCU_CNT7 (AFE_BASE + 0x03DC)
  512. #define AFE_APLL1_TUNER_CFG (AFE_BASE + 0x03f0)
  513. #define AFE_APLL2_TUNER_CFG (AFE_BASE + 0x03f4)
  514. /* AFE GAIN CONTROL REGISTER */
  515. #define AFE_GAIN1_CON0 (AFE_BASE + 0x0410)
  516. #define AFE_GAIN1_CON1 (AFE_BASE + 0x0414)
  517. #define AFE_GAIN1_CON2 (AFE_BASE + 0x0418)
  518. #define AFE_GAIN1_CON3 (AFE_BASE + 0x041C)
  519. #define AFE_GAIN1_CONN (AFE_BASE + 0x0420)
  520. #define AFE_GAIN1_CUR (AFE_BASE + 0x0424)
  521. #define AFE_GAIN2_CON0 (AFE_BASE + 0x0428)
  522. #define AFE_GAIN2_CON1 (AFE_BASE + 0x042C)
  523. #define AFE_GAIN2_CON2 (AFE_BASE + 0x0430)
  524. #define AFE_GAIN2_CON3 (AFE_BASE + 0x0434)
  525. #define AFE_GAIN2_CONN (AFE_BASE + 0x0438)
  526. #define AFE_GAIN2_CUR (AFE_BASE + 0x043C)
  527. #define AFE_GAIN2_CONN2 (AFE_BASE + 0x0440)
  528. #define AFE_GAIN2_CONN3 (AFE_BASE + 0x0444)
  529. #define AFE_GAIN1_CONN2 (AFE_BASE + 0x0448)
  530. #define AFE_GAIN1_CONN3 (AFE_BASE + 0x044C)
  531. #define AFE_CONN7 (AFE_BASE + 0x0460)
  532. #define AFE_CONN8 (AFE_BASE + 0x0464)
  533. #define AFE_CONN9 (AFE_BASE + 0x0468)
  534. #define AFE_CONN10 (AFE_BASE + 0x046C)
  535. /* 93 w/o */
  536. /* #define AFE_IEC_CFG (AFE_BASE + 0x0480) */
  537. /* #define AFE_IEC_NSNUM (AFE_BASE + 0x0484) */
  538. /* #define AFE_IEC_BURST_INFO (AFE_BASE + 0x0488) */
  539. /* #define AFE_IEC_BURST_LEN (AFE_BASE + 0x048C) */
  540. /* #define AFE_IEC_NSADR (AFE_BASE + 0x0490) */
  541. /* #define AFE_IEC_CHL_STAT0 (AFE_BASE + 0x04A0) */
  542. /* #define AFE_IEC_CHL_STAT1 (AFE_BASE + 0x04A4) */
  543. /* #define AFE_IEC_CHR_STAT0 (AFE_BASE + 0x04A8) */
  544. /* #define AFE_IEC_CHR_STAT1 (AFE_BASE + 0x04AC) */
  545. #define FPGA_CFG2 (AFE_BASE + 0x4B8)
  546. #define FPGA_CFG3 (AFE_BASE + 0x4BC)
  547. #define FPGA_CFG0 (AFE_BASE + 0x4C0)
  548. #define FPGA_CFG1 (AFE_BASE + 0x4C4)
  549. #define FPGA_VER (AFE_BASE + 0x4C8)
  550. #define FPGA_STC (AFE_BASE + 0x4CC)
  551. #define AFE_ASRC_CON0 (AFE_BASE + 0x500)
  552. #define AFE_ASRC_CON1 (AFE_BASE + 0x504)
  553. #define AFE_ASRC_CON2 (AFE_BASE + 0x508)
  554. #define AFE_ASRC_CON3 (AFE_BASE + 0x50C)
  555. #define AFE_ASRC_CON4 (AFE_BASE + 0x510)
  556. #define AFE_ASRC_CON5 (AFE_BASE + 0x514)
  557. #define AFE_ASRC_CON6 (AFE_BASE + 0x518)
  558. #define AFE_ASRC_CON7 (AFE_BASE + 0x51C)
  559. #define AFE_ASRC_CON8 (AFE_BASE + 0x520)
  560. #define AFE_ASRC_CON9 (AFE_BASE + 0x524)
  561. #define AFE_ASRC_CON10 (AFE_BASE + 0x528)
  562. #define AFE_ASRC_CON11 (AFE_BASE + 0x52C)
  563. #define PCM_INTF_CON (AFE_BASE + 0x530)
  564. #define PCM_INTF_CON2 (AFE_BASE + 0x538)
  565. #define PCM2_INTF_CON (AFE_BASE + 0x53C)
  566. /* 6582 Add */
  567. #define AFE_ASRC_CON13 (AFE_BASE+0x00550)
  568. #define AFE_ASRC_CON14 (AFE_BASE+0x00554)
  569. #define AFE_ASRC_CON15 (AFE_BASE+0x00558)
  570. #define AFE_ASRC_CON16 (AFE_BASE+0x0055C)
  571. #define AFE_ASRC_CON17 (AFE_BASE+0x00560)
  572. #define AFE_ASRC_CON18 (AFE_BASE+0x00564)
  573. #define AFE_ASRC_CON19 (AFE_BASE+0x00568)
  574. #define AFE_ASRC_CON20 (AFE_BASE+0x0056C)
  575. #define AFE_ASRC_CON21 (AFE_BASE+0x00570)
  576. #define AUDIO_CLK_AUDDIV_0 (AFE_BASE+0x005A0)
  577. #define AUDIO_CLK_AUDDIV_1 (AFE_BASE+0x005A4)
  578. #define AFE_ASRC4_CON0 (AFE_BASE+0x06C0)
  579. #define AFE_ASRC4_CON1 (AFE_BASE+0x06C4)
  580. #define AFE_ASRC4_CON2 (AFE_BASE+0x06C8)
  581. #define AFE_ASRC4_CON3 (AFE_BASE+0x06CC)
  582. #define AFE_ASRC4_CON4 (AFE_BASE+0x06D0)
  583. #define AFE_ASRC4_CON5 (AFE_BASE+0x06D4)
  584. #define AFE_ASRC4_CON6 (AFE_BASE+0x06D8)
  585. #define AFE_ASRC4_CON7 (AFE_BASE+0x06DC)
  586. #define AFE_ASRC4_CON8 (AFE_BASE+0x06E0)
  587. #define AFE_ASRC4_CON9 (AFE_BASE+0x06E4)
  588. #define AFE_ASRC4_CON10 (AFE_BASE+0x06E8)
  589. #define AFE_ASRC4_CON11 (AFE_BASE+0x06EC)
  590. #define AFE_ASRC4_CON12 (AFE_BASE+0x06F0)
  591. #define AFE_ASRC4_CON13 (AFE_BASE+0x06F4)
  592. #define AFE_ASRC4_CON14 (AFE_BASE+0x06F8)
  593. #define AFE_ASRC2_CON0 (AFE_BASE+0x0700)
  594. #define AFE_ASRC2_CON1 (AFE_BASE+0x0704)
  595. #define AFE_ASRC2_CON2 (AFE_BASE+0x0708)
  596. #define AFE_ASRC2_CON3 (AFE_BASE+0x070C)
  597. #define AFE_ASRC2_CON4 (AFE_BASE+0x0710)
  598. #define AFE_ASRC2_CON5 (AFE_BASE+0x0714)
  599. #define AFE_ASRC2_CON6 (AFE_BASE+0x0718)
  600. #define AFE_ASRC2_CON7 (AFE_BASE+0x071C)
  601. #define AFE_ASRC2_CON8 (AFE_BASE+0x0720)
  602. #define AFE_ASRC2_CON9 (AFE_BASE+0x0724)
  603. #define AFE_ASRC2_CON10 (AFE_BASE+0x0728)
  604. #define AFE_ASRC2_CON11 (AFE_BASE+0x072C)
  605. #define AFE_ASRC2_CON12 (AFE_BASE+0x0730)
  606. #define AFE_ASRC2_CON13 (AFE_BASE+0x0734)
  607. #define AFE_ASRC2_CON14 (AFE_BASE+0x0738)
  608. #define AFE_ASRC3_CON0 (AFE_BASE+0x0740)
  609. #define AFE_ASRC3_CON1 (AFE_BASE+0x0744)
  610. #define AFE_ASRC3_CON2 (AFE_BASE+0x0748)
  611. #define AFE_ASRC3_CON3 (AFE_BASE+0x074C)
  612. #define AFE_ASRC3_CON4 (AFE_BASE+0x0750)
  613. #define AFE_ASRC3_CON5 (AFE_BASE+0x0754)
  614. #define AFE_ASRC3_CON6 (AFE_BASE+0x0758)
  615. #define AFE_ASRC3_CON7 (AFE_BASE+0x075C)
  616. #define AFE_ASRC3_CON8 (AFE_BASE+0x0760)
  617. #define AFE_ASRC3_CON9 (AFE_BASE+0x0764)
  618. #define AFE_ASRC3_CON10 (AFE_BASE+0x0768)
  619. #define AFE_ASRC3_CON11 (AFE_BASE+0x076C)
  620. #define AFE_ASRC3_CON12 (AFE_BASE+0x0770)
  621. #define AFE_ASRC3_CON13 (AFE_BASE+0x0774)
  622. #define AFE_ASRC3_CON14 (AFE_BASE+0x0778)
  623. /* 6752 add */
  624. #define AFE_ADDA4_TOP_CON0 (AFE_BASE+0x0780)
  625. #define AFE_ADDA4_UL_SRC_CON0 (AFE_BASE+0x0784)
  626. #define AFE_ADDA4_UL_SRC_CON1 (AFE_BASE+0x0788)
  627. #define AFE_ADDA4_SRC_DEBUG (AFE_BASE+0x078C)
  628. #define AFE_ADDA4_SRC_DEBUG_MON0 (AFE_BASE+0x0790)
  629. #define AFE_ADDA4_SRC_DEBUG_MON1 (AFE_BASE+0x0794)
  630. #define AFE_ADDA4_NEWIF_CFG0 (AFE_BASE+0x0798)
  631. #define AFE_ADDA4_NEWIF_CFG1 (AFE_BASE+0x079C)
  632. #define AFE_ADDA4_ULCF_CFG_02_01 (AFE_BASE+0x07A0)
  633. #define AFE_ADDA4_ULCF_CFG_04_03 (AFE_BASE+0x07A4)
  634. #define AFE_ADDA4_ULCF_CFG_06_05 (AFE_BASE+0x07A8)
  635. #define AFE_ADDA4_ULCF_CFG_08_07 (AFE_BASE+0x07AC)
  636. #define AFE_ADDA4_ULCF_CFG_10_09 (AFE_BASE+0x07B0)
  637. #define AFE_ADDA4_ULCF_CFG_12_11 (AFE_BASE+0x07B4)
  638. #define AFE_ADDA4_ULCF_CFG_14_13 (AFE_BASE+0x07B8)
  639. #define AFE_ADDA4_ULCF_CFG_16_15 (AFE_BASE+0x07BC)
  640. #define AFE_ADDA4_ULCF_CFG_18_17 (AFE_BASE+0x07C0)
  641. #define AFE_ADDA4_ULCF_CFG_20_19 (AFE_BASE+0x07C4)
  642. #define AFE_ADDA4_ULCF_CFG_22_21 (AFE_BASE+0x07C8)
  643. #define AFE_ADDA4_ULCF_CFG_24_23 (AFE_BASE+0x07CC)
  644. #define AFE_ADDA4_ULCF_CFG_26_25 (AFE_BASE+0x07D0)
  645. #define AFE_ADDA4_ULCF_CFG_28_27 (AFE_BASE+0x07D4)
  646. #define AFE_ADDA4_ULCF_CFG_30_29 (AFE_BASE+0x07D8)
  647. #define AFE_MAXLENGTH (AFE_BASE+0x07D8)
  648. /* do afe register ioremap */
  649. void Auddrv_Reg_map(void);
  650. void Afe_Set_Reg(uint32 offset, uint32 value, uint32 mask);
  651. uint32 Afe_Get_Reg(uint32 offset);
  652. /* function to Set Cfg */
  653. uint32 GetClkCfg(uint32 offset);
  654. void SetClkCfg(uint32 offset, uint32 value, uint32 mask);
  655. /* function to Set Infra Cfg */
  656. uint32 GetInfraCfg(uint32 offset);
  657. void SetInfraCfg(uint32 offset, uint32 value, uint32 mask);
  658. /* function to Set pll */
  659. uint32 GetpllCfg(uint32 offset);
  660. void SetpllCfg(uint32 offset, uint32 value, uint32 mask);
  661. /* for debug usage */
  662. void Afe_Log_Print(void);
  663. /* function to get pointer */
  664. dma_addr_t Get_Afe_Sram_Phys_Addr(void);
  665. dma_addr_t Get_Afe_Sram_Capture_Phys_Addr(void);
  666. void *Get_Afe_SramBase_Pointer(void);
  667. void *Get_Afe_SramCaptureBase_Pointer(void);
  668. void *Get_Afe_Powertop_Pointer(void);
  669. void *Get_AudClk_Pointer(void);
  670. void *Get_Afe_Infra_Pointer(void);
  671. #endif