AudDrv_Afe.h 25 KB

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