codec.h 19 KB

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