acodec_nau88l25.h 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096
  1. /**************************************************************************//**
  2. *
  3. * @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0
  6. *
  7. * Change Logs:
  8. * Date Author Notes
  9. * 2020-1-16 Wayne First version
  10. *
  11. ******************************************************************************/
  12. #ifndef __ACODEC_NAU88L25_H__
  13. #define __ACODEC_NAU88L25_H__
  14. #include <rtdevice.h>
  15. enum
  16. {
  17. REG_SOFTWARE_RST,
  18. REG_ENA_CTRL,
  19. REG_I2C_ADDR_SET,
  20. REG_CLK_DIVIDER,
  21. REG_FLL1,
  22. REG_FLL2,
  23. REG_FLL3,
  24. REG_FLL4,
  25. REG_FLL5,
  26. REG_FLL6,
  27. REG_FLL_VCO_RSV,
  28. REG_HSD_CTRL = 0xC, //0xC
  29. REG_JACK_DET_CTRL,
  30. REG_INTERRUPT_MASK = 0xF, //0xF
  31. REG_IRQ_STATUS,
  32. REG_INT_LCR_KEY_STATUS,
  33. REG_INTERRUPT_DIS_CTRL,
  34. REG_SAR_CTRL,
  35. REG_KEYDET_CTRL,
  36. REG_VDET_THRESHOLD_1,
  37. REG_VDET_THRESHOLD_2,
  38. REG_VDET_THRESHOLD_3,
  39. REG_VDET_THRESHOLD_4,
  40. REG_GPIO34_CTRL,
  41. REG_GPIO12_CTRL,
  42. REG_TDM_CTRL,
  43. REG_I2S_PCM_CTRL1,
  44. REG_I2S_PCM_CTRL2,
  45. REG_LEFT_TIME_SLOT,
  46. REG_RIGHT_TIME_SLOT,
  47. REG_BIQ_CTRL,
  48. REG_BIQ_COF1,
  49. REG_BIQ_COF2,
  50. REG_BIQ_COF3,
  51. REG_BIQ_COF4,
  52. REG_BIQ_COF5,
  53. REG_BIQ_COF6,
  54. REG_BIQ_COF7,
  55. REG_BIQ_COF8,
  56. REG_BIQ_COF9, //29
  57. REG_BIQ_COF10,
  58. REG_ADC_RATE,
  59. REG_DAC_CTRL1,
  60. REG_DAC_CTRL2,
  61. REG_DAC_DGAIN_CTRL = 0x2F,
  62. REG_ADC_DGAIN_CTRL,
  63. REG_MUTE_CTRL,
  64. REG_HSVOL_CTRL,
  65. REG_DACL_CTRL,
  66. REG_DACR_CTRL,
  67. REG_ADC_DRC_KNEE_IP12 = 0x38,
  68. REG_ADC_DRC_KNEE_IP34,
  69. REG_ADC_DRC_SLOPES,
  70. REG_ADC_DRC_ATKDCY,
  71. REG_DAC_DRC_KNEE_IP12 = 0x45, //0x45
  72. REG_DAC_DRC_KNEE_IP34,
  73. REG_DAC_DRC_SLOPES,
  74. REG_DAC_DRC_ATKDCY = 0x48, //0x48
  75. REG_MODE_CTRL = 0x4C, //0x4C
  76. REG_CLASSG_CTRL = 0x50, //0x50
  77. REG_OPT_EFUSE_CTRL,
  78. REG_MISC_CTRL = 0x55, //0x55
  79. REG_I2C_DEVICE_ID = 0x58, //0x58
  80. REG_SARDOUT_RAM_STATUS,
  81. REG_BIAS_ADJ = 0x66, //0x66
  82. REG_TRIM_SETTINGS = 0x68, //0x68
  83. REG_ANALOG_CONTROL_1,
  84. REG_ANALOG_CONTROL_2,
  85. REG_ANALOG_ADC_1 = 0x71, //0x71
  86. REG_ANALOG_ADC_2,
  87. REG_RDAC,
  88. REG_MIC_BIAS, //0x74
  89. REG_BOOST = 0x76,
  90. REG_FEPGA,
  91. REG_POWER_UP_CONTROL = 0x7F, //0x7F
  92. REG_CHARGE_PUMP_AND_DOWN_CONTROL, //0x80
  93. REG_CHARGE_PUMP_INPUT_READ,
  94. REG_GENERAL_STATUS
  95. };
  96. // R1 REG_ENA_CTRL
  97. #define CLK_DRC_EN (1)
  98. #define CLK_SAR_EN (1 << 1)
  99. #define CLK_BIST_EN (1 << 3)
  100. #define CLK_I2S_EN (1 << 4)
  101. #define CLK_MODE_EN (1 << 5)
  102. #define DCLK_DAC_EN (1 << 6)
  103. #define DCLK_ADC_EN (1 << 7)
  104. #define ADC_EN (1 << 8)
  105. #define LDAC_EN (1 << 9)
  106. #define RDAC_EN (1 << 10)
  107. #define CLK_DAC_INV (1 << 14)
  108. #define CMLCK_ENB (1 << 15)
  109. // R2 REG_I2C_ADDR_SET
  110. #define I2C_ADDDR_SEL
  111. #define I2C_LSB_VAL_IO
  112. // R3 REG_CLK_DIVIDER
  113. #define MCLK_SRC_DIV1 (0)
  114. #define MCLK_SRC_INVERTED (1)
  115. #define MCLK_SRC_DIV2 (2)
  116. #define MCLK_SRC_DIV4 (3)
  117. #define MCLK_SRC_DIV8 (4)
  118. #define MCLK_SRC_DIV16 (5)
  119. #define MCLK_SRC_DIV32 (6)
  120. #define MCLK_SRC_DIV3 (7)
  121. #define MCLK_SRC_DIV6 (10)
  122. #define MCLK_SRC_DIV12 (11)
  123. #define MCLK_SRC_DIV24 (12)
  124. #define MCLK_SRC_DIV48 (13)
  125. #define MCLK_SRC_DIV96 (14)
  126. #define MCLK_SRC_DIV5 (15)
  127. #define CLK_DAC_SRC_DIV1 (0)
  128. #define CLK_DAC_SRC_DIV2 (1 << 4)
  129. #define CLK_DAC_SRC_DIV4 (2 << 4)
  130. #define CLK_DAC_SRC_DIV8 (3 << 4)
  131. #define CLK_ADC_SRC_DIV1 (0)
  132. #define CLK_ADC_SRC_DIV2 (1 << 6)
  133. #define CLK_ADC_SRC_DIV4 (2 << 6)
  134. #define CLK_ADC_SRC_DIV8 (3 << 6)
  135. #define CLK_ADC_PL_INVERT (1 << 10)
  136. #define CLK_DAC_PL_INVERT (1 << 11)
  137. #define CLK_CODEC_SRC_IMCLK (0)
  138. #define CLK_CODEC_SRC_PIN (1 << 13)
  139. #define CLK_SYSCLK_SRC_VCO (1 << 15)
  140. #define CLK_SYSCLK_SRC_PIN (0)
  141. // R4 REG_FLL1
  142. #define FLL_RATIO_512K (1)
  143. #define FLL_RATIO_256K (1 << 1)
  144. #define FLL_RATIO_128K (1 << 2)
  145. #define FLL_RATIO_64K (1 << 3)
  146. #define FLL_RATIO_32K (1 << 4)
  147. #define FLL_RATIO_8K (1 << 5)
  148. #define FLL_RATIO_4K (1 << 6)
  149. #define FLL_LCOK_BP (1 << 7)
  150. #define ICTRL_V2I_AMP2X (1 << 8)
  151. #define ICTRL_V2I_AMP (1 << 9)
  152. #define ICTRL_V2I_BOTHAMP (3 << 8)
  153. #define ICTRL_LATCH_1X (1 << 10)
  154. #define ICTRL_LATCH_2X (3 << 10)
  155. #define ICTRL_LATCH_3X (7 << 10)
  156. #define FLL1SELDAC_POS (13)
  157. #define FLL1SELDAC_MSK (0x7 << FLL1SELDAC_POS)
  158. // R5 REG_FLL2
  159. #define FLLFRAC_POS (0)
  160. #define FLLFRAC_MSK (0xFFFF << FLLFRAC_POS)
  161. // R6 REG_FLL3
  162. #define FLL_INTEGER(x) (x << 0)
  163. #define FLL_CLK_REF_SRC_MCLKPIN (0)
  164. #define FLL_CLK_REF_SRC_BCLKPIN (1 << 11)
  165. #define FLL_CLK_REF_SRC_FSPIN (0x3 << 10)
  166. #define GAIN_ERR_x1 (0x0)
  167. #define GAIN_ERR_x2 (0x1 << 12)
  168. #define GAIN_ERR_x4 (0x2 << 12)
  169. #define GAIN_ERR_x8 (0x3 << 12)
  170. #define GAIN_ERR_x16 (0x4 << 12)
  171. #define GAIN_ERR_x32 (0x5 << 12)
  172. #define GAIN_ERR_x64 (0x6 << 12)
  173. // R7 REG_FLL4
  174. #define FLL_N2(x) (x << 0)
  175. #define FLL_CLK_REF_DIV1 (0x0 << 10)
  176. #define FLL_CLK_REF_DIV2 (0x1 << 10)
  177. #define FLL_CLK_REF_DIV4 (0x2 << 10)
  178. #define FLL_CLK_REF_DIV8 (0x3 << 10)
  179. #define FLL_CLK_REF_DIV_4CHK_1 (0x0 << 12)
  180. #define FLL_CLK_REF_DIV_4CHK_1_2 (0x1 << 12)
  181. #define FLL_CLK_REF_DIV_4CHK_1_4 (0x2 << 12)
  182. #define FLL_CLK_REF_DIV_4CHK_1_8 (0x3 << 12)
  183. #define FLL_CLK_REF_DIV_4CHK_1_16 (0x4 << 12)
  184. #define FLL_CLK_REF_DIV_4CHK_1_32 (0x5 << 12)
  185. // R8 REG_FLL5
  186. #define FLL_LOCK_LENGTH(x) (x << 0)
  187. #define FILTER_SW (0x1 << 12)
  188. #define CLK_FILTER_SW (0x1 << 13)
  189. #define CHB_FILTER_EN (0x1 << 14)
  190. #define PDB_DACICTRL (0x1 << 15)
  191. // R9 REG_FLL6
  192. #define FLL_SD_DITHER_SEL_1LSB (0x1 << 4)
  193. #define FLL_SD_DITHER_SEL_2LSBs (0x2 << 4)
  194. #define FLL_SD_DITHER_SEL_3LSBs (0x3 << 4)
  195. #define FLL_FLTR_DITHER_SEL_1LSB (0x1 << 6)
  196. #define FLL_FLTR_DITHER_SEL_2LSBs (0x2 << 6)
  197. #define FLL_FLTR_DITHER_SEL_3LSBs (0x3 << 6)
  198. #define CUTOFF600 (0x1 << 12)
  199. #define CUTOFF500 (0x1 << 13)
  200. #define SDM_EN (0x1 << 14)
  201. #define DCO_EN (0x1 << 15)
  202. // R A REG_FLL_VCO_RSV
  203. #define DOUT2VCO_RSV_POS (0)
  204. #define DOUT2VCO_RSV_Msk (0xFFFF << FLLFRAC_POS)
  205. // R C REG_HSD_CTRL
  206. #define MANU_SPKR_DWN1L_OPEN (0)
  207. #define MANU_SPKR_DWN1L_GND (1)
  208. #define MANU_SPKR_DWN1R_OPEN (0)
  209. #define MANU_SPKR_DWN1R_GND (1 << 1)
  210. #define MANU_ENGND2_OPEN (0)
  211. #define MANU_ENGND2_GND (1 << 2)
  212. #define MANU_ENGND1_OPEN (0)
  213. #define MANU_ENGND1_GND (1 << 3)
  214. #define MANUAL_START (1 << 4)
  215. #define HSD_AUTO_MODE (1 << 6)
  216. #define RESET_HSD (1 << 15)
  217. // R D REG_JACK_DET_CTRL
  218. #define JKDET_LOGIC_AND_GATE (1)
  219. #define JKDET_LOGIC_OR_GATE (0)
  220. #define JKDET_PL_N_INVERT (1)
  221. #define JKDET_PL_INVERT (0)
  222. #define EJECT_DT(x) (x << 2)
  223. #define INSERT_DT(x) (x << 5)
  224. #define DB_BP_MODE_BYBASS_DEBOUNCE (1 << 8)
  225. #define DB_BP_MODE_NORMAL (0)
  226. #define JD_RESTART (1)
  227. #define JK_1_PL_GPIO2JD1 (0)
  228. #define JK_1_PL_GPIO2JD1_INV (1 << 10)
  229. #define JK_1_PL_IGNORE_0 (2 << 10)
  230. #define JK_1_PL_IGNORE_1 (3 << 10)
  231. #define JK_2_PL_JKDETL (0)
  232. #define JK_2_PL_JKDETL_INV (1 << 12)
  233. #define JK_2_PL_IGNORE_0 (2 << 12)
  234. #define JK_2_PL_IGNORE_1 (3 << 12)
  235. #define JK_3_PL_GPIO3JD2 (0)
  236. #define JK_3_PL_GPIO3JD2_INV (1 << 14)
  237. #define JK_3_PL_IGNORE_0 (2 << 14)
  238. #define JK_3_PL_IGNORE_1 (3 << 14)
  239. // R F REG_INTERRUPT_MASK
  240. #define JK_DET_INTP_MASK (1)
  241. #define JK_EJECT_INTP_MASK (1 << 2)
  242. #define MIC_DET_INTP_MASK (1 << 4)
  243. #define SHORT_KEY_INTP_MASK (1 << 5)
  244. #define LONG_KEYINTP_MASK (1 << 6)
  245. #define KEY_RELEASE_INTP_MASK (1 << 7)
  246. #define RMS_INTP_MASK (1 << 8)
  247. #define APR_EMRGENCY_SHTDWN1_INTP_MASK (1 << 9)
  248. #define HSD_COMPLETE_INTP_MASK (1 << 10)
  249. #define IRQ_OE (1 << 11)
  250. #define IRQ_DS (1 << 12)
  251. #define IRQ_PE (1 << 13)
  252. #define IRQ_PS (1 << 14)
  253. #define IRQ_PL (1 << 15)
  254. // R 10
  255. #define JACK_DET_IRQ_JACK_INSERT (1)
  256. #define JACK_DET_IRQ_JACK_INSERT_REMOVED (2)
  257. #define JACK_EJCT_IRQ_JACK_INSERT (1 << 2)
  258. #define JACK_EJCT_IRQ_JACK_INSERT_REMOVED (2 << 2)
  259. #define MIC_DET_INT (1 << 4)
  260. #define SHORT_KEY_INT (1 << 5)
  261. #define LONG_KEY_INT (1 << 6)
  262. #define KEY_RELEASE_INT (1 << 7)
  263. #define RMS_INT (1 << 8)
  264. #define APR_EMRG_SHTDWN (1 << 9)
  265. #define HSD_COMPL_ETE_INT (1 << 10)
  266. // R 11
  267. #define NT_CLR_KEY_STATUS_LK0 (1)
  268. #define NT_CLR_KEY_STATUS_LK1 (1 << 1)
  269. #define NT_CLR_KEY_STATUS_LK2 (1 << 2)
  270. #define NT_CLR_KEY_STATUS_LK3 (1 << 3)
  271. #define NT_CLR_KEY_STATUS_LK4 (1 << 4)
  272. #define NT_CLR_KEY_STATUS_LK5 (1 << 5)
  273. #define NT_CLR_KEY_STATUS_LK6 (1 << 6)
  274. #define NT_CLR_KEY_STATUS_LK7 (1 << 7)
  275. #define NT_CLR_KEY_STATUS_SK0 (1 << 8)
  276. #define NT_CLR_KEY_STATUS_SK1 (1 << 9)
  277. #define NT_CLR_KEY_STATUS_SK2 (1 << 10)
  278. #define NT_CLR_KEY_STATUS_SK3 (1 << 11)
  279. #define NT_CLR_KEY_STATUS_SK4 (1 << 12)
  280. #define NT_CLR_KEY_STATUS_SK5 (1 << 13)
  281. #define NT_CLR_KEY_STATUS_SK6 (1 << 14)
  282. #define NT_CLR_KEY_STATUS_SK7 (1 << 15)
  283. // R 12
  284. #define JACK_DET_INT_DIS (1)
  285. #define JACK_EJCT_INT_DIS (1 << 2)
  286. #define MIC_DET_INT_DIS (1 << 4)
  287. #define SHORT_KEY_INT_DIS (1 << 5)
  288. #define LONG_KEY_INT_DIS (1 << 6)
  289. #define KEY_RELEASE_INT_DIS (1 << 7)
  290. #define RMS_INT_DIS (1 << 8)
  291. #define SHRT_SHTD_MIN_INT_DIS (1 << 9)
  292. #define HSD_COMPL_ETE_INT_DIS (1 << 10)
  293. #define LONG_KEY0_INT_DIS (1 << 11)
  294. #define KEY0_RELEASE_INT_DIS (1 << 12)
  295. #define KEY_RELEASE_CLR_INTR (1 << 13)
  296. // R 13 SAR_CTRL
  297. #define SAMPLE_SPEED_500NS (0)
  298. #define SAMPLE_SPEED_4US (1 << 0)
  299. #define SAMPLE_SPEED_8US (2 << 0)
  300. #define SAMPLE_SPEED_16US (3 << 0)
  301. #define COMP_SPEED_500NS (0 << 2)
  302. #define COMP_SPEED_1US (1 << 2)
  303. #define COMP_SPEED_2US (2 << 2)
  304. #define COMP_SPEED_4US (3 << 2)
  305. #define RES_SEL_35K_OHMS (0)
  306. #define RES_SEL_70K_OHMS (1 << 4)
  307. #define RES_SEL_170K_OHMS (2 << 4)
  308. #define RES_SEL_360K_OHMS (3 << 4)
  309. #define HV_SEL_VDDMIC (1 << 7)
  310. #define HV_SEL_NCIBIAS (0)
  311. #define SAR_TRACKGAIN_POS (8)
  312. #define SAR_TRACKGAIN_MSK (0x7 << SAR_TRACKGAIN_POS)
  313. #define INPUT_SEL_JKSLV (1 << 11)
  314. #define INPUT_JKR2 (0)
  315. #define SAR_ENA (1 << 12)
  316. #define SAR_OUT_INV (1 << 13)
  317. // R 14
  318. #define HY_COEFF(x) (x << 0)
  319. #define SARADC_VDET_COEFF(x) (x << 4)
  320. #define ENABLE_LEVEL_KEY0 (0)
  321. #define ENABLE_LEVEL_KEY1 (1 << 8)
  322. #define ENABLE_LEVEL_KEY2 (2 << 8)
  323. #define ENABLE_LEVEL_KEY3 (3 << 8)
  324. #define ENABLE_LEVEL_KEY4 (4 << 8)
  325. #define ENABLE_LEVEL_KEY5 (5 << 8)
  326. #define ENABLE_LEVEL_KEY6 (6 << 8)
  327. #define ENABLE_LEVEL_KEY7 (7 << 8)
  328. #define SHORTKEY_DT_30MS (0)
  329. #define SHORTKEY_DT_50MS (1 << 12)
  330. #define SHORTKEY_DT_100MS (2 << 13)
  331. #define LONGKEY_DT_500MS (0)
  332. #define LONGKEY_DT_1S (1 << 14)
  333. // R 15/16/17/18
  334. #define SARADC_VDET_THR_1357_POS (0)
  335. #define SARADC_VDET_THR_1357_MSK (0xFF << SARADC_VDET_THR_1357_POS)
  336. #define SARADC_VDET_THR_0246_POS (8)
  337. #define SARADC_VDET_THR_0246_MSK (0xFF << SARADC_VDET_THR_0246_POS)
  338. // R 19 REG_GPIO34_CTRL
  339. #define GPIO3_OE (1 << 0)
  340. #define GPIO3_DS (1 << 1)
  341. #define GPIO3_PS (1 << 2)
  342. #define GPIO3_PE (1 << 3)
  343. #define GPIO3O (1 << 4)
  344. #define GPIO4_OE (1 << 7)
  345. #define GPIO4_DS (1 << 8)
  346. #define GPIO4_PS (1 << 9)
  347. #define GPIO4_PE (1 << 10)
  348. // R 1A REG_GPIO12_CTRL
  349. #define GPIO1_OE (1 << 0)
  350. #define GPIO1_PE (1 << 1)
  351. #define GPIO1_DS (1 << 2)
  352. #define GPIO1_PS (1 << 3)
  353. #define GPIO1SEL(x) (x << 4)
  354. #define GPIO1POL (1 << 7)
  355. #define GPIO2_OE (1 << 8)
  356. #define GPIO2_PE (1 << 9)
  357. #define GPIO2_DS (1 << 10)
  358. #define GPIO2_PS (1 << 11)
  359. // R 1B REG_TDM_CTRL
  360. #define ADC_TX_SEL_SLOT(x) (x << 0)
  361. #define DAC_RIGHT_SEL_SLOT(x) (x << 4)
  362. #define DAC_LEFT_SEL_SLOT(x) (x << 6)
  363. #define PCM_OFFSET_MODE_CTRL (1 << 14)
  364. #define TDM (1 << 15)
  365. // R 1C REG_I2S_PCM_CTRL1
  366. #define AIFMT0_RIGHTJUST (0)
  367. #define AIFMT0_LEFTJUST (1 << 0)
  368. #define AIFMT0_STANDI2S (2 << 0)
  369. #define AIFMT0_PCMA_B (3 << 0)
  370. #define WLEN0_16BIT (0)
  371. #define WLEN0_20BIT (1 << 2)
  372. #define WLEN0_24BIT (2 << 2)
  373. #define WLEN0_32BIT (3 << 2)
  374. #define ADCPHS0_LEFT (0)
  375. #define ADCPHS0_RIGHT (1 << 4)
  376. #define DACPHS0_LEFT (0)
  377. #define DACPHS0_RIGHT (1 << 5)
  378. #define LRP0 (1 << 6)
  379. #define BCP0 (1 << 7)
  380. #define UA_OFFSET_1S (0)
  381. #define UA_OFFSET_2S (1)
  382. #define CMB8_0_NORMAL (0)
  383. #define CNB8_0_8BIT (1 << 10)
  384. #define ADDAP0 (1 << 11)
  385. #define ADCCM0_ULAW (2 << 12)
  386. #define ADCCM0_ALAW (3 << 12)
  387. #define DACCM0_ULAW (2 << 14)
  388. #define DACCM0_ALAW (3 << 14)
  389. // R 1D REG_2S_PCM_CTRL2
  390. #define BLCKDIV_DIV2 (0)
  391. #define BLCKDIV_DIV4 (1)
  392. #define BLCKDIV_DIV8 (2)
  393. #define BLCKDIV_DIV16 (3)
  394. #define BLCKDIV_DIV32 (4)
  395. #define BLCKDIV_DIV64 (5)
  396. #define MS0_SLAVE (0)
  397. #define MS0_MASTER (1 << 3)
  398. #define ADCDAT0_OE (1 << 4)
  399. #define ADCDAT0_PS_PULLUP (1 << 5)
  400. #define ADCDAT0_PS_PULLDOWN (0)
  401. #define ADCDAT0_PE (1 << 6)
  402. #define PCM8BIT0 (1 << 8)
  403. #define TRI0 (1 << 9)
  404. #define PCM_TS_EN0 (1 << 10)
  405. #define LRC_DIV_DIV256 (0)
  406. #define LRC_DIV_DIV128 (1 << 12)
  407. #define LRC_DIV_DIV64 (2 << 12)
  408. #define LRC_DIV_DIV32 (3 << 12)
  409. #define I2S_DRV (1 << 14)
  410. #define I2S_TRI (1 << 15)
  411. // R 1E REG_LEFT_TIME_SLOT
  412. #define TSLOT_L0_POS (0)
  413. #define TSLOT_L0_MSK (0x3FF << TSLOT_L0_POS)
  414. #define DIS_FS_SHORT_DET (1 << 13)
  415. #define FS_ERR_CMP_SEL_252MCLK (0)
  416. #define FS_ERR_CMP_SEL_253MCLK (1 << 14)
  417. #define FS_ERR_CMP_SEL_254MCLK (2 << 14)
  418. #define FS_ERR_CMP_SEL_255MCLK (3 << 15)
  419. // R 1F REG_RIGHT_TIME_SLOT
  420. #define TSLOT_R0_POS (0)
  421. #define TSLOT_R0_MSK (0x3FF << TSLOT_R0_POS)
  422. // R 20 REG_BIQ_CTRL
  423. #define BIQ_PATH_SE_ADC (0)
  424. #define BIQ_PATH_SE_DAC (1)
  425. #define BIQ_COF_SE_SYNC_FS (0)
  426. #define BIQ_COF_SE_NO_SYNC (1 << 1)
  427. #define ADC_PATH_EN (1 << 2)
  428. #define DAC_PATH_EN (1 << 3)
  429. #define BIQ_WRT_EN (1 << 4)
  430. // R 21 REG_BIQ_COF1
  431. #define BIQ_A1_L_POS (0)
  432. #define BIQ_A1_L_MSK (0xFFFF << BIQ_A1_L_POS)
  433. // R 22 REG_BIQ_COF2
  434. #define BIQ_A1_H_POS (0)
  435. #define BIQ_A1_H_MSK (0x7 << BIQ_A1_H_POS)
  436. // R 23 REG_BIQ_COF3
  437. #define BIQ_A2_L_POS (0)
  438. #define BIQ_A2_L_MSK (0xFFFF << BIQ_A2_L_POS)
  439. // R 24 REG_BIQ_COF4
  440. #define BIQ_A2_H_POS (0)
  441. #define BIQ_A2_H_MSK (0x7 << BIQ_A2_H_POS)
  442. // R 25 REG_BIQ_COF5
  443. #define BIQ_B0_L_POS (0)
  444. #define BIQ_B0_L_MSK (0xFFFF << BIQ_B0_L_POS)
  445. // R 26 REG_BIQ_COF6
  446. #define BIQ_B0_H_POS (0)
  447. #define BIQ_B0_H_MSK (0x7 << BIQ_B0_H_POS)
  448. // R 27 REG_BIQ_COF7
  449. #define BIQ_B1_L_POS (0)
  450. #define BIQ_B1_L_MSK (0xFFFF << BIQ_B1_L_POS)
  451. // R 28 REG_BIQ_COF8
  452. #define BIQ_B1_H_POS (0)
  453. #define BIQ_B1_H_MSK (0x7 << BIQ_B1_H_POS)
  454. // R 29 REG_BIQ_COF9
  455. #define BIQ_B2_L_POS (0)
  456. #define BIQ_B2_L_MSK (0xFFFF << BIQ_B2_L_POS)
  457. // R 2A REG_BIQ_COF10
  458. #define BIQ_B2_H_POS (0)
  459. #define BIQ_B2_H_MSK (0x7 << BIQ_B2_H_POS)
  460. // R 2B REG_ADC_RATE
  461. #define ADC_RATE_32 (0)
  462. #define ADC_RATE_64 (1)
  463. #define ADC_RATE_128 (2)
  464. #define ADC_RATE_256 (3)
  465. #define SMPL_RATE_48K (0)
  466. #define SMPL_RATE_32K (1 << 5)
  467. #define SMPL_RATE_96K (3 << 5)
  468. #define SMPL_RATE_192K (7 << 5)
  469. // R 2C REG_DAC_CTRL1
  470. #define DAC_RATE_64 (0)
  471. #define DAC_RATE_256 (1)
  472. #define DAC_RATE_128 (2)
  473. #define DAC_RATE_32 (4)
  474. #define CUC_GAIN_ADJ(x) (x << 4)
  475. #define DEM_DLY_N (1 << 14)
  476. #define DISABLE_DEM (1 << 15)
  477. // R 2D REG_DAC_CTRL2
  478. #define DACPR_INVERT (1)
  479. #define DAC_PL_INVERT (1 << 1)
  480. #define DAC_STEP_SEL_DACCLK (4 << 4)
  481. #define DAC_STEP_SEL_DLY1_MCLK (5 << 4)
  482. #define DAC_STEP_SEL_DLY2_MCLK (6 << 4)
  483. #define DAC_STEP_SEL_DLY3_MCLK (7 << 4)
  484. #define DSMOD_DITHER(x) (x << 7)
  485. #define DEM_DITHER(x) (x << 12)
  486. // R 2F REG_DAC_DGAIN_CTRL
  487. #define DAC0_TO_DAC1_ST(x) (x << 0)
  488. #define DAC1_TO_DAC0_ST(x) (x << 8)
  489. // R 30 REG_ADC_DGAIN_CTRL
  490. #define DGAINL_ADC0(x) (x)
  491. #define ADC_TO_DAC_ST1(x) (x << 8)
  492. #define ADC_TO_DAC_ST0(x) (x << 12)
  493. // R 31 REG_MUTE_CTRL
  494. #define ADC_SMUTE_EN (1 << 1)
  495. #define ADC_ZC_UP_EN (1 << 2)
  496. #define SMUTE_CTRL (1 << 8)
  497. #define SMUTE_EN (1 << 9)
  498. #define AMUTE_CTRL (1 << 10)
  499. #define AMUTE_EN (1 << 11)
  500. #define DAC_ZC_UP_EN (1 << 12)
  501. #define PGA_SMUTE_STEP_128 (0 << 14)
  502. #define PGA_SMUTE_STEP_32 (1 << 14)
  503. #define PGA_SMUTE_STEP_16 (2 << 14)
  504. #define PGA_SMUTE_STEP_1 (3 << 14)
  505. // R 32 REG_HSVOL_CTRL
  506. #define HSPGA1_VOL(x) (x << 0)
  507. #define HSPGA0_VOL(x) (x << 6)
  508. #define MUTE_HSPGA1 (1 << 12)
  509. #define MUTE_HSPGA0 (1 << 13)
  510. #define HSPGA_MUTE_AUTO_MODE (1 << 14)
  511. #define HSPGA_MUTE_EN (1 << 15)
  512. // R 33 REG_DACL_CTRL
  513. #define DGAINL_DAC(x) (x << 0)
  514. #define DAC_CH_SEL0_LEFT (0)
  515. #define DAC_CH_SEL0_RIGHT (1 << 9)
  516. #define DAC_MIXER_L (1 << 14)
  517. #define DAC_MIXER_R (1 << 15)
  518. // R 34 REG_DACR_CTRL
  519. #define DGAINR_DAC(x) (x << 0)
  520. #define DAC_CH_SEL1_LEFT (0)
  521. #define DAC_CH_SEL1_RIGHT (1 << 9)
  522. // R 38 REG_ADC_DRC_KNEE_IP12
  523. #define DRC_KNEE1_IP_ADC1(x) (x << 0)
  524. #define DRC_SMTH_ENA_ADC1 (1 << 7)
  525. #define DRC_KNEE2_IP_ADC1(x) (x << 8)
  526. #define DRC_ENA_ADC1 (1 << 15)
  527. // R 39 REG_ADC_DRC_KNEE_IP34
  528. #define DRC_KNEE3_IP_ADC1(x) (x << 0)
  529. #define DRC_KNEE4_IP_ADC1(x) (x << 8)
  530. // R 3A REG_ADC_DRC_SLOPES
  531. #define DRC_LMT_SLP_ADC1_0 (0)
  532. #define DRC_LMT_SLP_ADC1_1_2 (1)
  533. #define DRC_LMT_SLP_ADC1_1_4 (2)
  534. #define DRC_LMT_SLP_ADC1_1_8 (3)
  535. #define DRC_LMT_SLP_ADC1_1_16 (4)
  536. #define DRC_LMT_SLP_ADC1_1_32 (5)
  537. #define DRC_LMT_SLP_ADC1_1_64 (6)
  538. #define DRC_LMT_SLP_ADC1_1 (7)
  539. #define DRC_CMP1_SLP_ADC1_0 (0)
  540. #define DRC_CMP1_SLP_ADC1_1_2 (1 << 3)
  541. #define DRC_CMP1_SLP_ADC1_1_4 (2 << 3)
  542. #define DRC_CMP1_SLP_ADC1_1_8 (3 << 3)
  543. #define DRC_CMP1_SLP_ADC1_1_16 (4 << 3)
  544. #define DRC_CMP1_SLP_ADC1_1 (7 << 3)
  545. #define DRC_CMP2_SLP_ADC1_0 (0)
  546. #define DRC_CMP2_SLP_ADC1_1_2 (1 << 6)
  547. #define DRC_CMP2_SLP_ADC1_1_4 (2 << 6)
  548. #define DRC_CMP2_SLP_ADC1_1_8 (3 << 6)
  549. #define DRC_CMP2_SLP_ADC1_1_16 (4 << 6)
  550. #define DRC_CMP2_SLP_ADC1_1 (7 << 6)
  551. #define DRC_EXP_SLP_ADC1_1_1 (0)
  552. #define DRC_EXP_SLP_ADC1_2_1 (1 << 9)
  553. #define DRC_EXP_SLP_ADC1_4_1 (2 << 9)
  554. #define DRC_NG_SLP_ADC1_1_1 (0)
  555. #define DRC_NG_SLP_ADC1_2_1 (1 << 12)
  556. #define DRC_NG_SLP_ADC1_4_1 (2 << 12)
  557. #define DRC_NG_SLP_ADC1_8_1 (3 << 12)
  558. // R 3B REG_ADC_DRC_ATKDCY
  559. #define DRC_DCY_ADC1_63 (0)
  560. #define DRC_DCY_ADC1_127 (1)
  561. #define DRC_DCY_ADC1_255 (2)
  562. #define DRC_DCY_ADC1_511 (3)
  563. #define DRC_DCY_ADC1_1023 (4)
  564. #define DRC_DCY_ADC1_2047 (5)
  565. #define DRC_DCY_ADC1_4095 (6)
  566. #define DRC_DCY_ADC1_8191 (7)
  567. #define DRC_DCY_ADC1_16383 (8)
  568. #define DRC_DCY_ADC1_32757 (9)
  569. #define DRC_DCY_ADC1_65535 (10)
  570. #define DRC_ATK_ADC1_x1 (0)
  571. #define DRC_ATK_ADC1_x3 (1 << 4)
  572. #define DRC_ATK_ADC1_x7 (2 << 4)
  573. #define DRC_ATK_ADC1_x15 (3 << 4)
  574. #define DRC_ATK_ADC1_x31 (4 << 4)
  575. #define DRC_ATK_ADC1_x63 (5 << 4)
  576. #define DRC_ATK_ADC1_x127 (6 << 4)
  577. #define DRC_ATK_ADC1_x255 (7 << 4)
  578. #define DRC_ATK_ADC1_x511 (8 << 4)
  579. #define DRC_ATK_ADC1_x1023 (9 << 4)
  580. #define DRC_ATK_ADC1_x2047 (10 << 4)
  581. #define DRC_ATK_ADC1_x4095 (11 << 4)
  582. #define DRC_ATK_ADC1_x8191 (12 << 4)
  583. #define DRC_PK_COEF2_ADC1_63 (0)
  584. #define DRC_PK_COEF2_ADC1_127 (1 << 8)
  585. #define DRC_PK_COEF2_ADC1_255 (2 << 8)
  586. #define DRC_PK_COEF2_ADC1_511 (3 << 8)
  587. #define DRC_PK_COEF2_ADC1_1023 (4 << 8)
  588. #define DRC_PK_COEF2_ADC1_2047 (5 << 8)
  589. #define DRC_PK_COEF2_ADC1_4095 (6 << 8)
  590. #define DRC_PK_COEF2_ADC1_8191 (7 << 8)
  591. #define DRC_PK_COEF1_ADC1_x1 (0)
  592. #define DRC_PK_COEF1_ADC1_x3 (1 << 12)
  593. #define DRC_PK_COEF1_ADC1_x7 (2 << 12)
  594. #define DRC_PK_COEF1_ADC1_x15 (3 << 12)
  595. #define DRC_PK_COEF1_ADC1_x31 (4 << 12)
  596. #define DRC_PK_COEF1_ADC1_x63 (5 << 12)
  597. #define DRC_PK_COEF1_ADC1_x127 (6 << 12)
  598. #define DRC_PK_COEF1_ADC1_x255 (7 << 12)
  599. // R 45 REG_DAC_DRC_KNEE_IP12
  600. #define DRC_KNEE1_IP_DAC(x) (x)
  601. #define DRC_SMTH_ENA_DAC (1 << 7)
  602. #define DRC_KNEE2_IP_DAC(x) (x << 8)
  603. #define DRC_ENA_DAC (1 << 15)
  604. // R 46 REG_DAC_DRC_KNEE_IP34
  605. #define DRC_KNEE3_IP_DAC(x) (x)
  606. #define DRC_KNEE4_IP_DAC(x) (x << 8)
  607. // R 47 REG_DAC_DRC_SLOPES
  608. #define DRC_LMT_SLP_DAC_0 (0)
  609. #define DRC_LMT_SLP_DAC_1_2 (1)
  610. #define DRC_LMT_SLP_DAC_1_4 (2)
  611. #define DRC_LMT_SLP_DAC_1_8 (3)
  612. #define DRC_LMT_SLP_DAC_1_16 (4)
  613. #define DRC_LMT_SLP_DAC_1_32 (5)
  614. #define DRC_LMT_SLP_DAC_1_64 (6)
  615. #define DRC_LMT_SLP_DAC_1_1 (7)
  616. #define DRC_CMP1_SLP_DAC_0 (0)
  617. #define DRC_CMP1_SLP_DAC_1_2 (1 << 3)
  618. #define DRC_CMP1_SLP_DAC_1_4 (2 << 3)
  619. #define DRC_CMP1_SLP_DAC_1_8 (3 << 3)
  620. #define DRC_CMP1_SLP_DAC_1_16 (4 << 3)
  621. #define DRC_CMP1_SLP_DAC_1 (7 << 3)
  622. #define DRC_CMP2_SLP_DAC_0 (0)
  623. #define DRC_CMP2_SLP_DAC_1_2 (1 << 6)
  624. #define DRC_CMP2_SLP_DAC_1_4 (2 << 6)
  625. #define DRC_CMP2_SLP_DAC_1_8 (3 << 6)
  626. #define DRC_CMP2_SLP_DAC_1_16 (4 << 6)
  627. #define DRC_CMP2_SLP_DAC_1 (7 << 6)
  628. #define DRC_EXP_SLP_DAC_1_1 (0)
  629. #define DRC_EXP_SLP_DAC_2_1 (1 << 9)
  630. #define DRC_EXP_SLP_DAC_4_1 (2 << 9)
  631. #define DRC_EXP_SLP_DAC_8_1 (3 << 9)
  632. #define DRC_NG_SLP_DAC_1_1 (0)
  633. #define DRC_NG_SLP_DAC_2_1 (1 << 12)
  634. #define DRC_NG_SLP_DAC_4_1 (2 << 12)
  635. #define DRC_NG_SLP_DAC_8_1 (3 << 12)
  636. // R 48 REG_DAC_DRC_ATKDCY
  637. #define DRC_DCY_DAC_63 (0)
  638. #define DRC_DCY_DAC_127 (1)
  639. #define DRC_DCY_DAC_255 (2)
  640. #define DRC_DCY_DAC_511 (3)
  641. #define DRC_DCY_DAC_1023 (4)
  642. #define DRC_DCY_DAC_2047 (5)
  643. #define DRC_DCY_DAC_4095 (6)
  644. #define DRC_DCY_DAC_8191 (7)
  645. #define DRC_DCY_DAC_16383 (8)
  646. #define DRC_DCY_DAC_32757 (9)
  647. #define DRC_DCY_DAC_65535 (10)
  648. #define DRC_ATK_DAC_x1 (0)
  649. #define DRC_ATK_DAC_x3 (1 << 4)
  650. #define DRC_ATK_DAC_x7 (2 << 4)
  651. #define DRC_ATK_DAC_x15 (3 << 4)
  652. #define DRC_ATK_DAC_x31 (4 << 4)
  653. #define DRC_ATK_DAC_x63 (5 << 4)
  654. #define DRC_ATK_DAC_x127 (6 << 4)
  655. #define DRC_ATK_DAC_x255 (7 << 4)
  656. #define DRC_ATK_DAC_x511 (8 << 4)
  657. #define DRC_ATK_DAC_x1023 (9 << 4)
  658. #define DRC_ATK_DAC_x2047 (10 << 4)
  659. #define DRC_ATK_DAC_x4095 (11 << 4)
  660. #define DRC_ATK_DAC_x8191 (12 << 4)
  661. #define DRC_PK_COEF2_DAC_63 (0)
  662. #define DRC_PK_COEF2_DAC_127 (1 << 8)
  663. #define DRC_PK_COEF2_DAC_255 (2 << 8)
  664. #define DRC_PK_COEF2_DAC_511 (3 << 8)
  665. #define DRC_PK_COEF2_DAC_1023 (4 << 8)
  666. #define DRC_PK_COEF2_DAC_2047 (5 << 8)
  667. #define DRC_PK_COEF2_DAC_4095 (6 << 8)
  668. #define DRC_PK_COEF2_DAC_8191 (7 << 8)
  669. #define DRC_PK_COEF1_DAC_x1 (0)
  670. #define DRC_PK_COEF1_DAC_x3 (1 << 12)
  671. #define DRC_PK_COEF1_DAC_x7 (2 << 12)
  672. #define DRC_PK_COEF1_DAC_x15 (3 << 12)
  673. #define DRC_PK_COEF1_DAC_x31 (4 << 12)
  674. #define DRC_PK_COEF1_DAC_x63 (5 << 12)
  675. #define DRC_PK_COEF1_DAC_x127 (6 << 12)
  676. #define DRC_PK_COEF1_DAC_x255 (7 << 12)
  677. // R 4C REG_MODE_CTRL
  678. #define DACIN_SRC_DAC_BIQUAD (0)
  679. #define DACIN_SRC_DRC_DAC (1)
  680. #define DACIN_SRC_DAC_MIXER (2)
  681. #define DACIN_SRC_BUILDIN_SINE (3)
  682. #define DACIN_SRC_DRC_LAW_DECODE (4)
  683. // R 50 REG_CLASSG_CTRL
  684. #define CLASSG_EN (1)
  685. #define CLASSG_CMP_EN_L_DAC (1 << 1)
  686. #define CLASSG_CMP_EN_R_DAC (1 << 2)
  687. #define CLASSG_THRSLD_1_16 (0)
  688. #define CLASSG_THRSLD_1_8 (1 << 4)
  689. #define CLASSG_THRSLD_3_16 (2 << 4)
  690. #define CLASSG_THRSLD_1_4 (3 << 4)
  691. #define CLASSG_TIMER_1MS (1 << 8)
  692. #define CLASSG_TIMER_2MS (2 << 8)
  693. #define CLASSG_TIMER_8MS (4 << 8)
  694. #define CLASSG_TIMER_16MS (8 << 8)
  695. #define CLASSG_TIMER_32MS (16 << 8)
  696. #define CLASSG_TIMER_64MS (32 << 8)
  697. #define CLASSG_CLK_SRC_2M (0)
  698. #define CLASSG_CLK_SRC_1_3MCLK (1 << 14)
  699. #define CLASSG_CLK_SRC_MCLK (2 << 14)
  700. #define CLASSG_CLK_SRC_DISABLE_CLK (3 << 14)
  701. // R 51 REG_OPT_EFU
  702. #define WL_BIN_POS (0)
  703. #define WL_BIN_MSK (0x3F << WL_BIN_POS)
  704. #define STROBE_IN (1 << 6)
  705. #define PGEN_IN (1 << 7)
  706. #define NR_IN (1 << 8)
  707. #define STANDBY_IN (1 << 15)
  708. // R 55 REG_MISC_CTRL
  709. #define D2A_LOOP (1 << 1)
  710. #define RAM_TEST_START (1 << 3)
  711. #define SPIEN (1 << 15)
  712. #define I2CEN (0)
  713. // R 58 REG_I2C_DEVICE_ID
  714. #define Software_ID (0x3)
  715. #define Silicon_Revision_ID (0x7 << 2)
  716. #define JKDETL (0x1 << 5)
  717. #define GPIO3JD2 (0x1 << 6)
  718. #define GPIO2JD1 (0x1 << 7)
  719. #define I2C_DEVICE_ID (0x3F << 9)
  720. // R 59 REG_SARDOUT_RAM_STATUS
  721. #define SARADC_DOUT (0xff)
  722. #define ANALOG_MUTE (0x1 << 10)
  723. #define RAM_TEST_FAIL (0x3 << 11)
  724. #define RATM_TEST_FINISH (0x1 << 13)
  725. // R 66 REG_BIAS_ADJ
  726. #define BIASADJ_NORMAL (0x0)
  727. #define BIASADJ_9 (0x1 << 0)
  728. #define BIASADJ_17 (0x2 << 0)
  729. #define BIASADJ_11 (0x3 << 0)
  730. #define VMIDSEL_OPEN (0x0 << 4)
  731. #define VMIDSEL_25K_OHM (0x1 << 4)
  732. #define VMIDSEL_125K_OHM (0x2 << 4)
  733. #define VMIDSEL_2P5K_OHM (0x3 << 4)
  734. #define VMIDEN (0x1 << 6)
  735. #define MUTEL (0x1 << 13)
  736. // R 68 REG_TRIM_SETTINGS
  737. #define DIS_OC_RIGHT (0x2)
  738. #define DIS_OC_LEFT (0x4)
  739. #define INTEG_ICUTHS (0x1 << 8)
  740. #define INTEG_IBCTRHS (0x1 << 9)
  741. #define DRV_ICUTHS (0x1 << 14)
  742. #define DRV_IBCTRHS (0x1 << 15)
  743. // R 69 REG_ANALOG_CONTROL_1
  744. #define ENJKDETL (0x1 << 0)
  745. #define JKDETLPOL (0x1 << 1)
  746. #define JD1POL (0x1 << 2)
  747. #define GPIO2THH_P85x (0x0)
  748. #define GPIO2THH_P78x (0x2 << 4)
  749. #define GPIO2THH_P6x (0x3 << 4)
  750. #define GPIO2THL_P22x (0x0)
  751. #define GPIO2THL_P4x (0x2 << 6)
  752. #define GPIO2THL_P5x (0x3 << 6)
  753. #define Pullup_GPIO2_1M (0x0)
  754. #define Pullup_GPIO2_100K (0x1 << 8)
  755. #define GPIO3THH_P85x (0x0)
  756. #define GPIO3THH_P78x (0x2 << 9)
  757. #define GPIO3THH_P6x (0x3 << 9)
  758. #define GPIO3THL_P22x (0x0)
  759. #define GPIO3THL_P4x (0x2 << 11)
  760. #define GPIO3THL_P5x (0x3 << 11)
  761. #define Pullup_GPIO3_1M (0x0)
  762. #define Pullup_GPIO3_100K (0x1 << 13)
  763. // R 6A REG_ANALOG_CONTROL_2
  764. #define CAP_0 (0x1)
  765. #define CAP_1 (0x1 << 1)
  766. #define MUTEMICN (0x1 << 2)
  767. #define MUTEMICP (0x1 << 3)
  768. #define AB_ADJ (0x1 << 7)
  769. // R 71 REG_ANALOG_ADC_1
  770. #define CHOPF0_DIV2 (0)
  771. #define CHOPF0_DIV4 (0x1 << 0)
  772. #define CHOPF0_DIV8 (0x2 << 0)
  773. #define CHOPF0_DIV16 (0x3 << 0)
  774. #define CHOPORDER (0x1 << 2)
  775. #define CHOPFIXED (0x1 << 3)
  776. #define CHOPRESETN (0x1 << 4)
  777. #define CHOPPHASE (0x1 << 5)
  778. #define CHOPENABLE (0x1 << 6)
  779. #define RESETL (0x1 << 8)
  780. // R 72 REG_ANALOG_ADC_2
  781. #define MON4TH (0x1 << 0)
  782. #define MON3RD (0x1 << 1)
  783. #define MON2ND (0x1 << 2)
  784. #define MON1ST (0x1 << 3)
  785. #define MONADD (0x1 << 4)
  786. #define LFSRRESETN (0x1 << 5)
  787. #define PDNOTL (0x1 << 6)
  788. #define VREFSEL_ANALOG (0x0 << 8)
  789. #define VREFSEL_VMIDE (0x1 << 8)
  790. #define VREFSEL_VMIDE_P5DB (0x2 << 8)
  791. #define VREFSEL_ANALOG_1DB (0x3 << 8)
  792. #define BIAS_NORMAL (0x0 << 10)
  793. #define BIAS_BOUBLE (0x1 << 10)
  794. #define BIAS_HALF (0x2 << 10)
  795. #define BIAS_QUARTER (0x3 << 10)
  796. #define ADC_UPL (0x1 << 13)
  797. // R 73 REG_RDAC
  798. #define DACVREFSEL(x) (x << 2)
  799. #define CLK_DAC_DELAY_0NSEC (0)
  800. #define CLK_DAC_DELAY_1NSEC (0x1 << 4)
  801. #define CLK_DAC_DELAY_2NSEC (0x2 << 4)
  802. #define CLK_DAC_DELAY_3NSEC (0x3 << 4)
  803. #define CLK_DAC_DELAY_4NSEC (0x4 << 4)
  804. #define CLK_DAC_DELAY_N3NSEC (0x5 << 4)
  805. #define CLK_DAC_DELAY_N2NSEC (0x6 << 4)
  806. #define CLK_DAC_DELAY_N1NSEC (0x7 << 4)
  807. #define FC_CTR (0x1 << 7)
  808. #define CLK_DAC_EN_R (0x1 << 9)
  809. #define CLK_DAC_EN_L (0x1 << 8)
  810. #define DAC_EN_R (0x1 << 13)
  811. #define DAC_EN_L (0x1 << 12)
  812. #define FS_BCLK_ENB (0x1 << 15)
  813. // R 74 REG_MIC_BIAS
  814. #define MICBIASLVL1_VDDA (0)
  815. #define MICBIASLVL1_1x (0x1 << 0)
  816. #define MICBIASLVL1_1P1x (0x2 << 0)
  817. #define MICBIASLVL1_1P2x (0x3 << 0)
  818. #define MICBIASLVL1_1P3x (0x4 << 0)
  819. #define MICBIASLVL1_1P4x (0x5 << 0)
  820. #define MICBIASLVL1_1P53x (0x6 << 0)
  821. #define NOCAP (0x1 << 6)
  822. #define POWERUP (0x1 << 8)
  823. #define LOWNOISE (0x1 << 10)
  824. #define INT2KA (0x1 << 12)
  825. #define INT2KB (0x1 << 14)
  826. // R 76 REG_BOOST
  827. #define NAMP_THRSHLD(x) (x << 0)
  828. #define PAMP_THRSHLD(x) (x << 2)
  829. #define HS_SHRT_THRESHLD(x) (x << 4)
  830. #define EN_SHRT_SHTDWN (0x1 << 6)
  831. #define SHRT_SHTDWN_DIG_EN (0x1 << 7)
  832. #define BOOSTGDIS (0x1 << 8)
  833. #define BOOSTDIS (0x1 << 9)
  834. #define BYPS_IBCTR (0x1 << 10)
  835. #define DISCHRG (0x1 << 11)
  836. #define BIASEN (0x1 << 12)
  837. #define PDVMDFST (0x1 << 13)
  838. #define STG2_SEL (0x1 << 14)
  839. #define CLR_APR_EMRGENCY_SHTDWN (0x1 << 15)
  840. // R 77 REG_FEPGA
  841. #define FEPGA_MODEL_ANIT_ALIASING (0x1 << 0)
  842. #define FEPGA_MODEL_DISCONNECT_MICPN (0x1 << 1)
  843. #define FEPGA_MODEL_12KOHM_SHORT (0x1 << 3)
  844. #define IBCTR_CODE(x) (x << 8)
  845. #define IB_LOOP_CTR (0x1 << 11)
  846. #define CMLCK_ADJ(x) (x << 12)
  847. #define ACDC_CTRL_MICP_VREF (0x1 << 14)
  848. #define ACDC_CTRL_MICN_VREF (0x1 << 15)
  849. // R 7F REG_POWER_UP_CONTROL
  850. #define PUP_MAIN_DRV_LEFT_HP (0x1 << 0)
  851. #define PUP_MAIN_DRV_RIGHT_HP (0x1 << 1)
  852. #define PUP_DRV_INSTG_LEFT_HP (0x1 << 2)
  853. #define PUP_DRV_INSTG_RIGHT_HP (0x1 << 3)
  854. #define PUP_INTEG_LEFT_HP (0x1 << 4)
  855. #define PUP_INTEG_RIGHT_HP (0x1 << 5)
  856. #define FEPGA_GAIN(x) (x << 8)
  857. #define PUFEPGA (0x1 << 14)
  858. // R 80 REG_CHARGE_PUMP_AND_POWER_DOWN_CONTROL
  859. #define SHCIRSEL1_HIGH (0x1)
  860. #define SHCIRSEL1_LOW (0)
  861. #define SHCIRSEL2_HIGH (0x1 << 1)
  862. #define SHCIRSEL2_LOW (0)
  863. #define DISCHARGEVPOS (0x1 << 2)
  864. #define DISCHARGEVEE (0x1 << 3)
  865. #define PRECHARGE (0x1 << 4)
  866. #define RNIN (0x1 << 5)
  867. #define JAMFORCE1 (0x1 << 6)
  868. #define JAMFORCE2 (0x1 << 7)
  869. #define PD_DAC_ENABLE (0x3 << 8)
  870. #define JAMNODCLOW (0x1 << 10)
  871. #define ADCDAT_DS (0x1 << 12)
  872. #define FS_DS (0x1 << 13)
  873. #define BCLK_DS (0x1 << 14)
  874. // R 81 REG_CHARGE_PUMP_INPUT_READ
  875. #define FORCE1BUF (0x1 << 0)
  876. #define VCOMPBUF (0x1 << 1)
  877. #define VPOSOK (0x1 << 2)
  878. #define RN2BUF (0x1 << 3)
  879. #define NODCBUF (0x1 << 4)
  880. #define MODE1BUF (0x1 << 5)
  881. #define APR_EMRGNCY_SHTDWN (0x1 << 15)
  882. // R 82 REG_GENERAL_STATUS
  883. #define GPIO1_IN (0x1 << 0)
  884. #define GPIO2_IN (0x1 << 1)
  885. #define GPIO3_IN (0x1 << 2)
  886. #define GPIO4_IN (0x1 << 3)
  887. #define JKDETL1 (0x1 << 4)
  888. #define JKDET_ON (0x1 << 5)
  889. #define JK_INSERT_INTR (0x1 << 6)
  890. #define JK_EJECT_INTR (0x1 << 7)
  891. #define OUT1 (0x1 << 8)
  892. #define OUT2 (0x1 << 9)
  893. #define OUT1_OUT (0x1 << 10)
  894. #define OUT2_OUT (0x1 << 11)
  895. typedef struct
  896. {
  897. char *i2c_bus_name;
  898. char *i2s_bus_name;
  899. rt_int32_t pin_phonejack_en;
  900. rt_int32_t pin_phonejack_det;
  901. } S_NU_NAU88L25_CONFIG;
  902. int nu_hw_nau88l25_init(S_NU_NAU88L25_CONFIG *psCodecConfig);
  903. #endif /* __ACODEC_NAU88L25_H__ */