codec.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  1. #ifndef __CODEC_H__
  2. #define __CODEC_H__
  3. #include <stdint.h>
  4. #define REG_SOFTWARE_RESET ((uint16_t)0)
  5. #define REG_POWER_MANAGEMENT1 ((uint16_t)(1 << 9))
  6. #define REG_POWER_MANAGEMENT2 ((uint16_t)(2 << 9))
  7. #define REG_POWER_MANAGEMENT3 ((uint16_t)(3 << 9))
  8. #define REG_AUDIO_INTERFACE ((uint16_t)(4 << 9))
  9. #define REG_COMPANDING ((uint16_t)(5 << 9))
  10. #define REG_CLOCK_GEN ((uint16_t)(6 << 9))
  11. #define REG_ADDITIONAL ((uint16_t)(7 << 9))
  12. #define REG_GPIO ((uint16_t)(8 << 9))
  13. #define REG_JACK_DETECT1 ((uint16_t)(9 << 9))
  14. #define REG_DAC ((uint16_t)(10 << 9))
  15. #define REG_LEFT_DAC_VOL ((uint16_t)(11 << 9))
  16. #define REG_RIGHT_DAC_VOL ((uint16_t)(12 << 9))
  17. #define REG_JACK_DETECT2 ((uint16_t)(13 << 9))
  18. #define REG_ADC ((uint16_t)(14 << 9))
  19. #define REG_LEFT_ADC_VOL ((uint16_t)(15 << 9))
  20. #define REG_RIGHT_ADC_VOL ((uint16_t)(16 << 9))
  21. #define REG_EQ1 ((uint16_t)(18 << 9))
  22. #define REG_EQ2 ((uint16_t)(19 << 9))
  23. #define REG_EQ3 ((uint16_t)(20 << 9))
  24. #define REG_EQ4 ((uint16_t)(21 << 9))
  25. #define REG_EQ5 ((uint16_t)(22 << 9))
  26. #define REG_DAC_LIMITER1 ((uint16_t)(24 << 9))
  27. #define REG_DAC_LIMITER2 ((uint16_t)(25 << 9))
  28. #define REG_NOTCH_FILTER1 ((uint16_t)(27 << 9))
  29. #define REG_NOTCH_FILTER2 ((uint16_t)(28 << 9))
  30. #define REG_NOTCH_FILTER3 ((uint16_t)(29 << 9))
  31. #define REG_NOTCH_FILTER4 ((uint16_t)(30 << 9))
  32. #define REG_ALC1 ((uint16_t)(32 << 9))
  33. #define REG_ALC2 ((uint16_t)(33 << 9))
  34. #define REG_ALC3 ((uint16_t)(34 << 9))
  35. #define REG_NOISE_GATE ((uint16_t)(35 << 9))
  36. #define REG_PLL_N ((uint16_t)(36 << 9))
  37. #define REG_PLL_K1 ((uint16_t)(37 << 9))
  38. #define REG_PLL_K2 ((uint16_t)(38 << 9))
  39. #define REG_PLL_K3 ((uint16_t)(39 << 9))
  40. #define REG_3D ((uint16_t)(41 << 9))
  41. #define REG_BEEP ((uint16_t)(43 << 9))
  42. #define REG_INPUT ((uint16_t)(44 << 9))
  43. #define REG_LEFT_PGA_GAIN ((uint16_t)(45 << 9))
  44. #define REG_RIGHT_PGA_GAIN ((uint16_t)(46 << 9))
  45. #define REG_LEFT_ADC_BOOST ((uint16_t)(47 << 9))
  46. #define REG_RIGHT_ADC_BOOST ((uint16_t)(48 << 9))
  47. #define REG_OUTPUT ((uint16_t)(49 << 9))
  48. #define REG_LEFT_MIXER ((uint16_t)(50 << 9))
  49. #define REG_RIGHT_MIXER ((uint16_t)(51 << 9))
  50. #define REG_LOUT1_VOL ((uint16_t)(52 << 9))
  51. #define REG_ROUT1_VOL ((uint16_t)(53 << 9))
  52. #define REG_LOUT2_VOL ((uint16_t)(54 << 9))
  53. #define REG_ROUT2_VOL ((uint16_t)(55 << 9))
  54. #define REG_OUT3_MIXER ((uint16_t)(56 << 9))
  55. #define REG_OUT4_MIXER ((uint16_t)(57 << 9))
  56. // R01 REG_POWER_MANAGEMENT1
  57. #define BUFDCOPEN (1 << 8)
  58. #define OUT4MIXEN (1 << 7)
  59. #define OUT3MIXEN (1 << 6)
  60. #define PLLEN (1 << 5)
  61. #define MICBEN (1 << 4)
  62. #define BIASEN (1 << 3)
  63. #define BUFIOEN (1 << 2)
  64. #define VMIDSEL_OFF (0)
  65. #define VMIDSEL_75K (1)
  66. #define VMIDSEL_300K (2)
  67. #define VMIDSEL_5K (3)
  68. // R02 REG_POWER_MANAGEMENT2
  69. #define ROUT1EN (1 << 8)
  70. #define LOUT1EN (1 << 7)
  71. #define SLEEP (1 << 6)
  72. #define BOOSTENR (1 << 5)
  73. #define BOOSTENL (1 << 4)
  74. #define INPPGAENR (1 << 3)
  75. #define INPPGAENL (1 << 2)
  76. #define ADCENR (1 << 1)
  77. #define ADCENL (1)
  78. // R03 REG_POWER_MANAGEMENT3
  79. #define OUT4EN (1 << 8)
  80. #define OUT3EN (1 << 7)
  81. #define LOUT2EN (1 << 6)
  82. #define ROUT2EN (1 << 5)
  83. #define RMIXEN (1 << 3)
  84. #define LMIXEN (1 << 2)
  85. #define DACENR (1 << 1)
  86. #define DACENL (1)
  87. // R04 REG_AUDIO_INTERFACE
  88. #define BCP_NORMAL (0)
  89. #define BCP_INVERTED (1 << 8)
  90. #define LRP_NORMAL (0)
  91. #define LRP_INVERTED (1 << 7)
  92. #define WL_16BITS (0)
  93. #define WL_20BITS (1 << 5)
  94. #define WL_24BITS (2 << 5) // Default value
  95. #define WL_32BITS (3 << 5)
  96. #define FMT_RIGHT_JUSTIFIED (0)
  97. #define FMT_LEFT_JUSTIFIED (1 << 3)
  98. #define FMT_I2S (2 << 3) // Default value
  99. #define FMT_PCM (3 << 3)
  100. #define DACLRSWAP (1 << 2)
  101. #define ADCLRSWAP (1 << 1)
  102. #define MONO (1)
  103. // R05 REG_COMPANDING
  104. #define WL8 (1 << 5)
  105. #define DAC_COMP_OFF (0) // Default value
  106. #define DAC_COMP_ULAW (2 << 3)
  107. #define DAC_COMP_ALAW (3 << 3)
  108. #define ADC_COMP_OFF (0) // Default value
  109. #define ADC_COMP_ULAW (2 << 1)
  110. #define ADC_COMP_ALAW (3 << 1)
  111. #define LOOPBACK (1)
  112. // R06 REG_CLOCK_GEN
  113. #define CLKSEL_MCLK (0)
  114. #define CLKSEL_PLL (1 << 8) // Default value
  115. #define MCLK_DIV1 (0)
  116. #define MCLK_DIV1_5 (1 << 5)
  117. #define MCLK_DIV2 (2 << 5) // Default value
  118. #define MCLK_DIV3 (3 << 5)
  119. #define MCLK_DIV4 (4 << 5)
  120. #define MCLK_DIV6 (5 << 5)
  121. #define MCLK_DIV8 (6 << 5)
  122. #define MCLK_DIV12 (7 << 5)
  123. #define BCLK_DIV1 (0) // Default value
  124. #define BCLK_DIV2 (1 << 2)
  125. #define BCLK_DIV4 (2 << 2)
  126. #define BCLK_DIV8 (3 << 2)
  127. #define BCLK_DIV16 (4 << 2)
  128. #define BCLK_DIV32 (5 << 2)
  129. #define MS (1)
  130. // R07 REG_ADDITIONAL
  131. #define SR_48KHZ (0) // Default value
  132. #define SR_32KHZ (1 << 1)
  133. #define SR_24KHZ (2 << 1)
  134. #define SR_16KHZ (3 << 1)
  135. #define SR_12KHZ (4 << 1)
  136. #define SR_8KHZ (5 << 1)
  137. #define SLOWCLKEN (1)
  138. // R08 REG_GPIO
  139. #define OPCLK_DIV1 (0) // Default value
  140. #define OPCLK_DIV2 (1 << 4)
  141. #define OPCLK_DIV3 (2 << 4)
  142. #define OPCLK_DIV4 (3 << 4)
  143. #define GPIO1POL_NONINVERTED (0) // Default value
  144. #define GPIO1POL_INVERTED (1 << 3)
  145. #define GPIO1SEL_INPUT (0) // Default value
  146. #define GPIO1SEL_TEMP_OK (2)
  147. #define GPIO1SEL_AMUTE_ACTIVE (3)
  148. #define GPIO1SEL_PLL_CLK_OP (4)
  149. #define GPIO1SEL_PLL_LOCK (5)
  150. #define GPIO1SEL_LOGIC1 (6)
  151. #define GPIO1SEL_LOGIC0 (7)
  152. // R09 REG_JACK_DETECT1
  153. #define JD_VMID_EN1 (1 << 8)
  154. #define JD_VMID_EN0 (1 << 7)
  155. #define JD_EN (1 << 6)
  156. #define JD_SEL_GPIO1 (0 << 4) // Default value
  157. #define JD_SEL_GPIO2 (1 << 4)
  158. #define JD_SEL_GPIO3 (2 << 4)
  159. // R10 REG_DAC
  160. #define SOFTMUTE (1 << 6)
  161. #define DACOSR128 (1 << 3)
  162. #define AMUTE (1 << 2)
  163. #define DACPOLR (1 << 1)
  164. #define DACPOLL (1)
  165. // R11 & R12 REG_LEFT_DAC_VOL & REG_RIGHT_DAC_VOL
  166. #define DACVU (1 << 8)
  167. #define DACVOL_POS (0)
  168. #define DACVOL_MASK (0xFF)
  169. // R13 REG_JACK_DETECT2
  170. #define JD_OUT4_EN1 (1 << 7)
  171. #define JD_OUT3_EN1 (1 << 6)
  172. #define JD_OUT2_EN1 (1 << 5)
  173. #define JD_OUT1_EN1 (1 << 4)
  174. #define JD_OUT4_EN0 (1 << 3)
  175. #define JD_OUT3_EN0 (1 << 2)
  176. #define JD_OUT2_EN0 (1 << 1)
  177. #define JD_OUT1_EN0 (1)
  178. // R14 REG_ADC
  179. #define HPFEN (1 << 8)
  180. #define HPFAPP (1 << 7)
  181. #define HPFCUT_POS (4)
  182. #define HPFCUT_MASK (7)
  183. #define HPFCUT_0 (0)
  184. #define HPFCUT_1 (1 << 4)
  185. #define HPFCUT_2 (2 << 4)
  186. #define HPFCUT_3 (3 << 4)
  187. #define HPFCUT_4 (4 << 4)
  188. #define HPFCUT_5 (5 << 4)
  189. #define HPFCUT_6 (6 << 4)
  190. #define HPFCUT_7 (7 << 4)
  191. #define ADCOSR128 (1 << 3)
  192. #define ADCRPOL (1 << 1)
  193. #define ADCLPOL (1)
  194. // R15 & R16 REG_LEFT_ADC_VOL & REG_RIGHT_ADC_VOL
  195. #define ADCVU (1 << 8)
  196. #define ADCVOL_POS (0)
  197. #define ADCVOL_MASK (0xFF)
  198. // R18 REG_EQ1
  199. #define EQ3DMODE_ADC (0)
  200. #define EQ3DMODE_DAC (1 << 8) // Default value
  201. #define EQ1C_80HZ (0)
  202. #define EQ1C_105HZ (1 << 5) // Default value
  203. #define EQ1C_135HZ (2 << 5)
  204. #define EQ1C_175HZ (3 << 5)
  205. // R19 REG_EQ2
  206. #define EQ2BW_NARROW (0) // Default value
  207. #define EQ2BW_WIDE (1 << 8)
  208. #define EQ2C_230HZ (0)
  209. #define EQ2C_300HZ (1 << 5) // Default value
  210. #define EQ2C_385HZ (2 << 5)
  211. #define EQ2C_500HZ (3 << 5)
  212. // R20 REG_EQ3
  213. #define EQ3BW_NARROW (0) // Default value
  214. #define EQ3BW_WIDE (1 << 8)
  215. #define EQ3C_650HZ (0)
  216. #define EQ3C_850HZ (1 << 5) // Default value
  217. #define EQ3C_1_1KHZ (2 << 5)
  218. #define EQ3C_1_4KHZ (3 << 5)
  219. // R21 REG_EQ4
  220. #define EQ4BW_NARROW (0) // Default value
  221. #define EQ4BW_WIDE (1 << 8)
  222. #define EQ4C_1_8KHZ (0)
  223. #define EQ4C_2_4KHZ (1 << 5) // Default value
  224. #define EQ4C_3_2KHZ (2 << 5)
  225. #define EQ4C_4_1KHZ (3 << 5)
  226. // R22 REG_EQ5
  227. #define EQ5C_5_3KHZ (0)
  228. #define EQ5C_6_9KHZ (1 << 5) // Default value
  229. #define EQ5C_9KHZ (2 << 5)
  230. #define EQ5C_11_7KHZ (3 << 5)
  231. // R18 - R22
  232. #define EQC_POS (5)
  233. #define EQC_MASK (3)
  234. #define EQG_POS (0)
  235. #define EQG_MASK (31)
  236. // R24 REG_DAC_LIMITER1
  237. #define LIMEN (1 << 8)
  238. #define LIMDCY_POS (4)
  239. #define LIMDCY_MASK (15)
  240. #define LIMDCY_750US (0)
  241. #define LIMDCY_1_5MS (1 << 4)
  242. #define LIMDCY_3MS (2 << 4)
  243. #define LIMDCY_6MS (3 << 4) // Default value
  244. #define LIMDCY_12MS (4 << 4)
  245. #define LIMDCY_24MS (5 << 4)
  246. #define LIMDCY_48MS (6 << 4)
  247. #define LIMDCY_96MS (7 << 4)
  248. #define LIMDCY_192MS (8 << 4)
  249. #define LIMDCY_384MS (9 << 4)
  250. #define LIMDCY_768MS (10 << 4)
  251. #define LIMATK_POS (0)
  252. #define LIMATK_MASK (15)
  253. #define LIMATK_94US (0)
  254. #define LIMATK_188US (1)
  255. #define LIMATK_375US (2) // Default value
  256. #define LIMATK_750US (3)
  257. #define LIMATK_1_5MS (4)
  258. #define LIMATK_3MS (5)
  259. #define LIMATK_6MS (6)
  260. #define LIMATK_12MS (7)
  261. #define LIMATK_24MS (8)
  262. #define LIMATK_48MS (9)
  263. #define LIMATK_96MS (10)
  264. #define LIMATK_192MS (11)
  265. // R25 REG_DAC_LIMITER2
  266. #define LIMLVL_POS (4)
  267. #define LIMLVL_MASK (7)
  268. #define LIMLVL_N1DB (0) // Default value
  269. #define LIMLVL_N2DB (1 << 4)
  270. #define LIMLVL_N3DB (2 << 4)
  271. #define LIMLVL_N4DB (3 << 4)
  272. #define LIMLVL_N5DB (4 << 4)
  273. #define LIMLVL_N6DB (5 << 4)
  274. #define LIMBOOST_POS (0)
  275. #define LIMBOOST_MASK (15)
  276. #define LIMBOOST_0DB (0)
  277. #define LIMBOOST_1DB (1)
  278. #define LIMBOOST_2DB (2)
  279. #define LIMBOOST_3DB (3)
  280. #define LIMBOOST_4DB (4)
  281. #define LIMBOOST_5DB (5)
  282. #define LIMBOOST_6DB (6)
  283. #define LIMBOOST_7DB (7)
  284. #define LIMBOOST_8DB (8)
  285. #define LIMBOOST_9DB (9)
  286. #define LIMBOOST_10DB (10)
  287. #define LIMBOOST_11DB (11)
  288. #define LIMBOOST_12DB (12)
  289. // R27 - R30 REG_NOTCH_FILTER1 - REG_NOTCH_FILTER4
  290. #define NFU (1 << 8)
  291. #define NFEN (1 << 7)
  292. #define NFA_POS (0)
  293. #define NFA_MASK (127)
  294. // R32 REG_ALC1
  295. #define ALCSEL_OFF (0) // Default value
  296. #define ALCSEL_RIGHT_ONLY (1 << 7)
  297. #define ALCSEL_LEFT_ONLY (2 << 7)
  298. #define ALCSEL_BOTH_ON (3 << 7)
  299. #define ALCMAXGAIN_POS (3)
  300. #define ALCMAXGAIN_MASK (7)
  301. #define ALCMAXGAIN_N6_75DB (0)
  302. #define ALCMAXGAIN_N0_75DB (1 << 3)
  303. #define ALCMAXGAIN_5_25DB (2 << 3)
  304. #define ALCMAXGAIN_11_25DB (3 << 3)
  305. #define ALCMAXGAIN_17_25DB (4 << 3)
  306. #define ALCMAXGAIN_23_25DB (5 << 3)
  307. #define ALCMAXGAIN_29_25DB (6 << 3)
  308. #define ALCMAXGAIN_35_25DB (7 << 3) // Default value
  309. #define ALCMINGAIN_POS (0)
  310. #define ALCMINGAIN_MASK (7)
  311. #define ALCMINGAIN_N12DB (0) // Default value
  312. #define ALCMINGAIN_N6DB (1)
  313. #define ALCMINGAIN_0DB (2)
  314. #define ALCMINGAIN_6DB (3)
  315. #define ALCMINGAIN_12DB (4)
  316. #define ALCMINGAIN_18DB (5)
  317. #define ALCMINGAIN_24DB (6)
  318. #define ALCMINGAIN_30DB (7)
  319. // R33 REG_ALC2
  320. #define ALCHLD_POS (4)
  321. #define ALCHLD_MASK (15)
  322. #define ALCHLD_0MS (0) // Default value
  323. #define ALCHLD_2_67MS (1 << 4)
  324. #define ALCHLD_5_33MS (2 << 4)
  325. #define ALCHLD_10_67MS (3 << 4)
  326. #define ALCHLD_21_33MS (4 << 4)
  327. #define ALCHLD_42_67MS (5 << 4)
  328. #define ALCHLD_85_33MS (6 << 4)
  329. #define ALCHLD_170_67MS (7 << 4)
  330. #define ALCHLD_341_33MS (8 << 4)
  331. #define ALCHLD_682_67MS (9 << 4)
  332. #define ALCHLD_1_36S (10 << 4)
  333. #define ALCLVL_POS (0)
  334. #define ALCLVL_MASK (15)
  335. #define ALCLVL_N22_5DBFS (0)
  336. #define ALCLVL_N21DBFS (1)
  337. #define ALCLVL_N19_5DBFS (2)
  338. #define ALCLVL_N18DBFS (3)
  339. #define ALCLVL_N16_5DBFS (4)
  340. #define ALCLVL_N15DBFS (5)
  341. #define ALCLVL_N13_5DBFS (6)
  342. #define ALCLVL_N12DBFS (7)
  343. #define ALCLVL_N10_5DBFS (8)
  344. #define ALCLVL_N9DBFS (9)
  345. #define ALCLVL_N7_5DBFS (10)
  346. #define ALCLVL_N6DBFS (11) // Default value
  347. #define ALCLVL_N4_5DBFS (12)
  348. #define ALCLVL_N3DBFS (13)
  349. #define ALCLVL_N1_5DBFS (14)
  350. // R34 REG_ALC3
  351. #define ALCMODE_ALC (0) // Default value
  352. #define ALCMODE_LIMITER (1 << 8)
  353. #define ALCDCY_POS (4)
  354. #define ALCDCY_MASK (15)
  355. #define ALCDCY_0 (0)
  356. #define ALCDCY_1 (1 << 4)
  357. #define ALCDCY_2 (2 << 4)
  358. #define ALCDCY_3 (3 << 4) // Default value
  359. #define ALCDCY_4 (4 << 4)
  360. #define ALCDCY_5 (5 << 4)
  361. #define ALCDCY_6 (6 << 4)
  362. #define ALCDCY_7 (7 << 4)
  363. #define ALCDCY_8 (8 << 4)
  364. #define ALCDCY_9 (9 << 4)
  365. #define ALCDCY_10 (10 << 4)
  366. #define ALCATK_POS (0)
  367. #define ALCATK_MASK (15)
  368. #define ALCATK_0 (0)
  369. #define ALCATK_1 (1)
  370. #define ALCATK_2 (2) // Default value
  371. #define ALCATK_3 (3)
  372. #define ALCATK_4 (4)
  373. #define ALCATK_5 (5)
  374. #define ALCATK_6 (6)
  375. #define ALCATK_7 (7)
  376. #define ALCATK_8 (8)
  377. #define ALCATK_9 (9)
  378. #define ALCATK_10 (10)
  379. // R35 REG_NOISE_GATE
  380. #define NGEN (1 << 3)
  381. #define NGTH_POS (0)
  382. #define NGTH_MASK (7)
  383. #define NGTH_N39DB (0) // Default value
  384. #define NGTH_N45DB (1)
  385. #define NGTH_N51DB (2)
  386. #define NGTH_N57DB (3)
  387. #define NGTH_N63DB (4)
  388. #define NGTH_N69DB (5)
  389. #define NGTH_N75DB (6)
  390. #define NGTH_N81DB (7)
  391. // R36 REG_PLL_N
  392. #define PLLPRESCALE (1 << 4)
  393. #define PLLN_POS (0)
  394. #define PLLN_MASK (15)
  395. // R37 - R39 REG_PLL_K1 - REG_PLL_K3
  396. #define PLLK1_POS (0)
  397. #define PLLK1_MASK (63)
  398. #define PLLK2_POS (0)
  399. #define PLLK2_MASK (511)
  400. #define PLLK3_POS (0)
  401. #define PLLK3_MASK (511)
  402. // R41 REG_3D
  403. #define DEPTH3D_POS (0)
  404. #define DEPTH3D_MASK (15)
  405. #define DEPTH3D_0 (0) // Default value
  406. #define DEPTH3D_6_67 (1)
  407. #define DEPTH3D_13_33 (2)
  408. #define DEPTH3D_20 (3)
  409. #define DEPTH3D_26_67 (4)
  410. #define DEPTH3D_33_33 (5)
  411. #define DEPTH3D_40 (6)
  412. #define DEPTH3D_46_67 (7)
  413. #define DEPTH3D_53_33 (8)
  414. #define DEPTH3D_60 (9)
  415. #define DEPTH3D_66_67 (10)
  416. #define DEPTH3D_73_33 (11)
  417. #define DEPTH3D_80 (12)
  418. #define DEPTH3D_86_67 (13)
  419. #define DEPTH3D_93_33 (14)
  420. #define DEPTH3D_100 (15)
  421. // R43 REG_BEEP
  422. #define MUTERPGA2INV (1 << 5)
  423. #define INVROUT2 (1 << 4)
  424. #define BEEPVOL_POS (1)
  425. #define BEEPVOL_MASK (7)
  426. #define BEEPVOL_N15DB (0)
  427. #define BEEPVOL_N12DB (1 << 1)
  428. #define BEEPVOL_N9DB (2 << 1)
  429. #define BEEPVOL_N6DB (3 << 1)
  430. #define BEEPVOL_N3DB (4 << 1)
  431. #define BEEPVOL_0DB (5 << 1)
  432. #define BEEPVOL_3DB (6 << 1)
  433. #define BEEPVOL_6DB (7 << 1)
  434. #define BEEPEN (1)
  435. // R44 REG_INPUT
  436. #define MBVSEL_0_9AVDD (0) // Default value
  437. #define MBVSEL_0_65AVDD (1 << 8)
  438. #define R2_2INPVGA (1 << 6)
  439. #define RIN2INPVGA (1 << 5) // Default value
  440. #define RIP2INPVGA (1 << 4) // Default value
  441. #define L2_2INPVGA (1 << 2)
  442. #define LIN2INPVGA (1 << 1) // Default value
  443. #define LIP2INPVGA (1) // Default value
  444. // R45 REG_LEFT_PGA_GAIN
  445. #define INPPGAUPDATE (1 << 8)
  446. #define INPPGAZCL (1 << 7)
  447. #define INPPGAMUTEL (1 << 6)
  448. // R46 REG_RIGHT_PGA_GAIN
  449. #define INPPGAZCR (1 << 7)
  450. #define INPPGAMUTER (1 << 6)
  451. // R45 - R46
  452. #define INPPGAVOL_POS (0)
  453. #define INPPGAVOL_MASK (63)
  454. // R47 REG_LEFT_ADC_BOOST
  455. #define PGABOOSTL (1 << 8) // Default value
  456. #define L2_2BOOSTVOL_POS (4)
  457. #define L2_2BOOSTVOL_MASK (7)
  458. #define L2_2BOOSTVOL_DISABLED (0) // Default value
  459. #define L2_2BOOSTVOL_N12DB (1 << 4)
  460. #define L2_2BOOSTVOL_N9DB (2 << 4)
  461. #define L2_2BOOSTVOL_N6DB (3 << 4)
  462. #define L2_2BOOSTVOL_N3DB (4 << 4)
  463. #define L2_2BOOSTVOL_0DB (5 << 4)
  464. #define L2_2BOOSTVOL_3DB (6 << 4)
  465. #define L2_2BOOSTVOL_6DB (7 << 4)
  466. #define AUXL2BOOSTVOL_POS (0)
  467. #define AUXL2BOOSTVOL_MASK (7)
  468. #define AUXL2BOOSTVOL_DISABLED (0) // Default value
  469. #define AUXL2BOOSTVOL_N12DB (1)
  470. #define AUXL2BOOSTVOL_N9DB (2)
  471. #define AUXL2BOOSTVOL_N6DB (3)
  472. #define AUXL2BOOSTVOL_N3DB (4)
  473. #define AUXL2BOOSTVOL_0DB (5)
  474. #define AUXL2BOOSTVOL_3DB (6)
  475. #define AUXL2BOOSTVOL_6DB (7)
  476. // R48 REG_RIGHT_ADC_BOOST
  477. #define PGABOOSTR (1 << 8) // Default value
  478. #define R2_2BOOSTVOL_POS (4)
  479. #define R2_2BOOSTVOL_MASK (7)
  480. #define R2_2BOOSTVOL_DISABLED (0) // Default value
  481. #define R2_2BOOSTVOL_N12DB (1 << 4)
  482. #define R2_2BOOSTVOL_N9DB (2 << 4)
  483. #define R2_2BOOSTVOL_N6DB (3 << 4)
  484. #define R2_2BOOSTVOL_N3DB (4 << 4)
  485. #define R2_2BOOSTVOL_0DB (5 << 4)
  486. #define R2_2BOOSTVOL_3DB (6 << 4)
  487. #define R2_2BOOSTVOL_6DB (7 << 4)
  488. #define AUXR2BOOSTVOL_POS (0)
  489. #define AUXR2BOOSTVOL_MASK (7)
  490. #define AUXR2BOOSTVOL_DISABLED (0) // Default value
  491. #define AUXR2BOOSTVOL_N12DB (1)
  492. #define AUXR2BOOSTVOL_N9DB (2)
  493. #define AUXR2BOOSTVOL_N6DB (3)
  494. #define AUXR2BOOSTVOL_N3DB (4)
  495. #define AUXR2BOOSTVOL_0DB (5)
  496. #define AUXR2BOOSTVOL_3DB (6)
  497. #define AUXR2BOOSTVOL_6DB (7)
  498. // R49 REG_OUTPUT
  499. #define DACL2RMIX (1 << 6)
  500. #define DACR2LMIX (1 << 5)
  501. #define OUT4BOOST (1 << 4)
  502. #define OUT3BOOST (1 << 3)
  503. #define SPKBOOST (1 << 2)
  504. #define TSDEN (1 << 1)
  505. #define VROI (1)
  506. // R50 REG_LEFT_MIXER
  507. #define AUXLMIXVOL_POS (6)
  508. #define AUXLMIXVOL_MASK (7)
  509. #define AUXLMIXVOL_N15DB (0) // Default value
  510. #define AUXLMIXVOL_N12DB (1 << 6)
  511. #define AUXLMIXVOL_N9DB (2 << 6)
  512. #define AUXLMIXVOL_N6DB (3 << 6)
  513. #define AUXLMIXVOL_N3DB (4 << 6)
  514. #define AUXLMIXVOL_0DB (5 << 6)
  515. #define AUXLMIXVOL_3DB (6 << 6)
  516. #define AUXLMIXVOL_6DB (7 << 6)
  517. #define AUXL2LMIX (1 << 5)
  518. #define BYPLMIXVOL_POS (2)
  519. #define BYPLMIXVOL_MASK (7)
  520. #define BYPLMIXVOL_N15DB (0) // Default value
  521. #define BYPLMIXVOL_N12DB (1 << 2)
  522. #define BYPLMIXVOL_N9DB (2 << 2)
  523. #define BYPLMIXVOL_N6DB (3 << 2)
  524. #define BYPLMIXVOL_N3DB (4 << 2)
  525. #define BYPLMIXVOL_0DB (5 << 2)
  526. #define BYPLMIXVOL_3DB (6 << 2)
  527. #define BYPLMIXVOL_6DB (7 << 2)
  528. #define BYPL2LMIX (1 << 1)
  529. #define DACL2LMIX (1)
  530. // R51 REG_RIGHT_MIXER
  531. #define AUXRMIXVOL_POS (6)
  532. #define AUXRMIXVOL_MASK (7)
  533. #define AUXRMIXVOL_N15DB (0) // Default value
  534. #define AUXRMIXVOL_N12DB (1 << 6)
  535. #define AUXRMIXVOL_N9DB (2 << 6)
  536. #define AUXRMIXVOL_N6DB (3 << 6)
  537. #define AUXRMIXVOL_N3DB (4 << 6)
  538. #define AUXRMIXVOL_0DB (5 << 6)
  539. #define AUXRMIXVOL_3DB (6 << 6)
  540. #define AUXRMIXVOL_6DB (7 << 6)
  541. #define AUXR2RMIX (1 << 5)
  542. #define BYPRMIXVOL_POS (2)
  543. #define BYPRMIXVOL_MASK (7)
  544. #define BYPRMIXVOL_N15DB (0) // Default value
  545. #define BYPRMIXVOL_N12DB (1 << 2)
  546. #define BYPRMIXVOL_N9DB (2 << 2)
  547. #define BYPRMIXVOL_N6DB (3 << 2)
  548. #define BYPRMIXVOL_N3DB (4 << 2)
  549. #define BYPRMIXVOL_0DB (5 << 2)
  550. #define BYPRMIXVOL_3DB (6 << 2)
  551. #define BYPRMIXVOL_6DB (7 << 2)
  552. #define BYPR2RMIX (1 << 1)
  553. #define DACR2RMIX (1)
  554. // R52 - R55 REG_LOUT1_VOL - REG_ROUT2_VOL
  555. #define HPVU (1 << 8)
  556. #define SPKVU (1 << 8)
  557. #define LOUT1ZC (1 << 7)
  558. #define LOUT1MUTE (1 << 6)
  559. #define ROUT1ZC (1 << 7)
  560. #define ROUT1MUTE (1 << 6)
  561. #define LOUT2ZC (1 << 7)
  562. #define LOUT2MUTE (1 << 6)
  563. #define ROUT2ZC (1 << 7)
  564. #define ROUT2MUTE (1 << 6)
  565. #define VOL_POS (0)
  566. #define VOL_MASK (63)
  567. // R56 REG_OUT3_MIXER
  568. #define OUT3MUTE (1 << 6)
  569. #define OUT4_2OUT3 (1 << 3)
  570. #define BYPL2OUT3 (1 << 2)
  571. #define LMIX2OUT3 (1 << 1)
  572. #define LDAC2OUT3 (1)
  573. // R57 REG_OUT4_MIXER
  574. #define OUT4MUTE (1 << 6)
  575. #define HALFSIG (1 << 5)
  576. #define LMIX2OUT4 (1 << 4)
  577. #define LDAC2OUT4 (1 << 3)
  578. #define BYPR2OUT4 (1 << 2)
  579. #define RMIX2OUT4 (1 << 1)
  580. #define RDAC2OUT4 (1)
  581. #endif // #ifndef __CODEC_H__