alc5632.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. /*
  2. * alc5632.h -- ALC5632 ALSA SoC Audio Codec
  3. *
  4. * Copyright (C) 2011 The AC100 Kernel Team <ac100@lists.lauchpad.net>
  5. *
  6. * Authors: Leon Romanovsky <leon@leon.nu>
  7. * Andrey Danin <danindrey@mail.ru>
  8. * Ilya Petrov <ilya.muromec@gmail.com>
  9. * Marc Dietrich <marvin24@gmx.de>
  10. *
  11. * Based on alc5623.h by Arnaud Patard
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License version 2 as
  15. * published by the Free Software Foundation.
  16. */
  17. #ifndef _ALC5632_H
  18. #define _ALC5632_H
  19. #define ALC5632_RESET 0x00
  20. /* speaker output vol 2 2 */
  21. /* line output vol 4 2 */
  22. /* HP output vol 4 0 4 */
  23. #define ALC5632_SPK_OUT_VOL 0x02 /* spe out vol */
  24. #define ALC5632_SPK_OUT_VOL_STEP 1.5
  25. #define ALC5632_HP_OUT_VOL 0x04 /* hp out vol */
  26. #define ALC5632_AUX_OUT_VOL 0x06 /* aux out vol */
  27. #define ALC5632_PHONE_IN_VOL 0x08 /* phone in vol */
  28. #define ALC5632_LINE_IN_VOL 0x0A /* line in vol */
  29. #define ALC5632_STEREO_DAC_IN_VOL 0x0C /* stereo dac in vol */
  30. #define ALC5632_MIC_VOL 0x0E /* mic in vol */
  31. /* stero dac/mic routing */
  32. #define ALC5632_MIC_ROUTING_CTRL 0x10
  33. #define ALC5632_MIC_ROUTE_MONOMIX (1 << 0)
  34. #define ALC5632_MIC_ROUTE_SPK (1 << 1)
  35. #define ALC5632_MIC_ROUTE_HP (1 << 2)
  36. #define ALC5632_ADC_REC_GAIN 0x12 /* rec gain */
  37. #define ALC5632_ADC_REC_GAIN_RANGE 0x1F1F
  38. #define ALC5632_ADC_REC_GAIN_BASE (-16.5)
  39. #define ALC5632_ADC_REC_GAIN_STEP 1.5
  40. #define ALC5632_ADC_REC_MIXER 0x14 /* mixer control */
  41. #define ALC5632_ADC_REC_MIC1 (1 << 6)
  42. #define ALC5632_ADC_REC_MIC2 (1 << 5)
  43. #define ALC5632_ADC_REC_LINE_IN (1 << 4)
  44. #define ALC5632_ADC_REC_AUX (1 << 3)
  45. #define ALC5632_ADC_REC_HP (1 << 2)
  46. #define ALC5632_ADC_REC_SPK (1 << 1)
  47. #define ALC5632_ADC_REC_MONOMIX (1 << 0)
  48. #define ALC5632_VOICE_DAC_VOL 0x18 /* voice dac vol */
  49. #define ALC5632_I2S_OUT_CTL 0x1A /* undocumented reg. found in path scheme */
  50. /* ALC5632_OUTPUT_MIXER_CTRL : */
  51. /* same remark as for reg 2 line vs speaker */
  52. #define ALC5632_OUTPUT_MIXER_CTRL 0x1C /* out mix ctrl */
  53. #define ALC5632_OUTPUT_MIXER_RP (1 << 14)
  54. #define ALC5632_OUTPUT_MIXER_WEEK (1 << 12)
  55. #define ALC5632_OUTPUT_MIXER_HP (1 << 10)
  56. #define ALC5632_OUTPUT_MIXER_AUX_SPK (2 << 6)
  57. #define ALC5632_OUTPUT_MIXER_AUX_HP_LR (1 << 6)
  58. #define ALC5632_OUTPUT_MIXER_HP_R (1 << 8)
  59. #define ALC5632_OUTPUT_MIXER_HP_L (1 << 9)
  60. #define ALC5632_MIC_CTRL 0x22 /* mic phone ctrl */
  61. #define ALC5632_MIC_BOOST_BYPASS 0
  62. #define ALC5632_MIC_BOOST_20DB 1
  63. #define ALC5632_MIC_BOOST_30DB 2
  64. #define ALC5632_MIC_BOOST_40DB 3
  65. #define ALC5632_DIGI_BOOST_CTRL 0x24 /* digi mic / bost ctl */
  66. #define ALC5632_MIC_BOOST_RANGE 7
  67. #define ALC5632_MIC_BOOST_STEP 6
  68. #define ALC5632_PWR_DOWN_CTRL_STATUS 0x26
  69. #define ALC5632_PWR_DOWN_CTRL_STATUS_MASK 0xEF00
  70. #define ALC5632_PWR_VREF_PR3 (1 << 11)
  71. #define ALC5632_PWR_VREF_PR2 (1 << 10)
  72. #define ALC5632_PWR_VREF_STATUS (1 << 3)
  73. #define ALC5632_PWR_AMIX_STATUS (1 << 2)
  74. #define ALC5632_PWR_DAC_STATUS (1 << 1)
  75. #define ALC5632_PWR_ADC_STATUS (1 << 0)
  76. /* stereo/voice DAC / stereo adc func ctrl */
  77. #define ALC5632_DAC_FUNC_SELECT 0x2E
  78. /* Main serial data port ctrl (i2s) */
  79. #define ALC5632_DAI_CONTROL 0x34
  80. #define ALC5632_DAI_SDP_MASTER_MODE (0 << 15)
  81. #define ALC5632_DAI_SDP_SLAVE_MODE (1 << 15)
  82. #define ALC5632_DAI_SADLRCK_MODE (1 << 14)
  83. /* 0:voice, 1:main */
  84. #define ALC5632_DAI_MAIN_I2S_SYSCLK_SEL (1 << 8)
  85. #define ALC5632_DAI_MAIN_I2S_BCLK_POL_CTRL (1 << 7)
  86. /* 0:normal, 1:invert */
  87. #define ALC5632_DAI_MAIN_I2S_LRCK_INV (1 << 6)
  88. #define ALC5632_DAI_I2S_DL_MASK (3 << 2)
  89. #define ALC5632_DAI_I2S_DL_8 (3 << 2)
  90. #define ALC5632_DAI_I2S_DL_24 (2 << 2)
  91. #define ALC5632_DAI_I2S_DL_20 (1 << 2)
  92. #define ALC5632_DAI_I2S_DL_16 (0 << 2)
  93. #define ALC5632_DAI_I2S_DF_MASK (3 << 0)
  94. #define ALC5632_DAI_I2S_DF_PCM_B (3 << 0)
  95. #define ALC5632_DAI_I2S_DF_PCM_A (2 << 0)
  96. #define ALC5632_DAI_I2S_DF_LEFT (1 << 0)
  97. #define ALC5632_DAI_I2S_DF_I2S (0 << 0)
  98. /* extend serial data port control (VoDAC_i2c/pcm) */
  99. #define ALC5632_DAI_CONTROL2 0x36
  100. /* 0:gpio func, 1:voice pcm */
  101. #define ALC5632_DAI_VOICE_PCM_ENABLE (1 << 15)
  102. /* 0:master, 1:slave */
  103. #define ALC5632_DAI_VOICE_MODE_SEL (1 << 14)
  104. /* 0:disable, 1:enable */
  105. #define ALC5632_DAI_HPF_CLK_CTRL (1 << 13)
  106. /* 0:main, 1:voice */
  107. #define ALC5632_DAI_VOICE_I2S_SYSCLK_SEL (1 << 8)
  108. /* 0:normal, 1:invert */
  109. #define ALC5632_DAI_VOICE_VBCLK_SYSCLK_SEL (1 << 7)
  110. /* 0:normal, 1:invert */
  111. #define ALC5632_DAI_VOICE_I2S_LR_INV (1 << 6)
  112. #define ALC5632_DAI_VOICE_DL_MASK (3 << 2)
  113. #define ALC5632_DAI_VOICE_DL_16 (0 << 2)
  114. #define ALC5632_DAI_VOICE_DL_20 (1 << 2)
  115. #define ALC5632_DAI_VOICE_DL_24 (2 << 2)
  116. #define ALC5632_DAI_VOICE_DL_8 (3 << 2)
  117. #define ALC5632_DAI_VOICE_DF_MASK (3 << 0)
  118. #define ALC5632_DAI_VOICE_DF_I2S (0 << 0)
  119. #define ALC5632_DAI_VOICE_DF_LEFT (1 << 0)
  120. #define ALC5632_DAI_VOICE_DF_PCM_A (2 << 0)
  121. #define ALC5632_DAI_VOICE_DF_PCM_B (3 << 0)
  122. #define ALC5632_PWR_MANAG_ADD1 0x3A
  123. #define ALC5632_PWR_MANAG_ADD1_MASK 0xEFFF
  124. #define ALC5632_PWR_ADD1_DAC_L_EN (1 << 15)
  125. #define ALC5632_PWR_ADD1_DAC_R_EN (1 << 14)
  126. #define ALC5632_PWR_ADD1_ZERO_CROSS (1 << 13)
  127. #define ALC5632_PWR_ADD1_MAIN_I2S_EN (1 << 11)
  128. #define ALC5632_PWR_ADD1_SPK_AMP_EN (1 << 10)
  129. #define ALC5632_PWR_ADD1_HP_OUT_AMP (1 << 9)
  130. #define ALC5632_PWR_ADD1_HP_OUT_ENH_AMP (1 << 8)
  131. #define ALC5632_PWR_ADD1_VOICE_DAC_MIX (1 << 7)
  132. #define ALC5632_PWR_ADD1_SOFTGEN_EN (1 << 6)
  133. #define ALC5632_PWR_ADD1_MIC1_SHORT_CURR (1 << 5)
  134. #define ALC5632_PWR_ADD1_MIC2_SHORT_CURR (1 << 4)
  135. #define ALC5632_PWR_ADD1_MIC1_EN (1 << 3)
  136. #define ALC5632_PWR_ADD1_MIC2_EN (1 << 2)
  137. #define ALC5632_PWR_ADD1_MAIN_BIAS (1 << 1)
  138. #define ALC5632_PWR_ADD1_DAC_REF (1 << 0)
  139. #define ALC5632_PWR_MANAG_ADD2 0x3C
  140. #define ALC5632_PWR_MANAG_ADD2_MASK 0x7FFF
  141. #define ALC5632_PWR_ADD2_PLL1 (1 << 15)
  142. #define ALC5632_PWR_ADD2_PLL2 (1 << 14)
  143. #define ALC5632_PWR_ADD2_VREF (1 << 13)
  144. #define ALC5632_PWR_ADD2_OVT_DET (1 << 12)
  145. #define ALC5632_PWR_ADD2_VOICE_DAC (1 << 10)
  146. #define ALC5632_PWR_ADD2_L_DAC_CLK (1 << 9)
  147. #define ALC5632_PWR_ADD2_R_DAC_CLK (1 << 8)
  148. #define ALC5632_PWR_ADD2_L_ADC_CLK_GAIN (1 << 7)
  149. #define ALC5632_PWR_ADD2_R_ADC_CLK_GAIN (1 << 6)
  150. #define ALC5632_PWR_ADD2_L_HP_MIXER (1 << 5)
  151. #define ALC5632_PWR_ADD2_R_HP_MIXER (1 << 4)
  152. #define ALC5632_PWR_ADD2_SPK_MIXER (1 << 3)
  153. #define ALC5632_PWR_ADD2_MONO_MIXER (1 << 2)
  154. #define ALC5632_PWR_ADD2_L_ADC_REC_MIXER (1 << 1)
  155. #define ALC5632_PWR_ADD2_R_ADC_REC_MIXER (1 << 0)
  156. #define ALC5632_PWR_MANAG_ADD3 0x3E
  157. #define ALC5632_PWR_MANAG_ADD3_MASK 0x7CFF
  158. #define ALC5632_PWR_ADD3_AUXOUT_VOL (1 << 14)
  159. #define ALC5632_PWR_ADD3_SPK_L_OUT (1 << 13)
  160. #define ALC5632_PWR_ADD3_SPK_R_OUT (1 << 12)
  161. #define ALC5632_PWR_ADD3_HP_L_OUT_VOL (1 << 11)
  162. #define ALC5632_PWR_ADD3_HP_R_OUT_VOL (1 << 10)
  163. #define ALC5632_PWR_ADD3_LINEIN_L_VOL (1 << 7)
  164. #define ALC5632_PWR_ADD3_LINEIN_R_VOL (1 << 6)
  165. #define ALC5632_PWR_ADD3_AUXIN_VOL (1 << 5)
  166. #define ALC5632_PWR_ADD3_AUXIN_MIX (1 << 4)
  167. #define ALC5632_PWR_ADD3_MIC1_VOL (1 << 3)
  168. #define ALC5632_PWR_ADD3_MIC2_VOL (1 << 2)
  169. #define ALC5632_PWR_ADD3_MIC1_BOOST_AD (1 << 1)
  170. #define ALC5632_PWR_ADD3_MIC2_BOOST_AD (1 << 0)
  171. #define ALC5632_GPCR1 0x40
  172. #define ALC5632_GPCR1_CLK_SYS_SRC_SEL_PLL1 (1 << 15)
  173. #define ALC5632_GPCR1_CLK_SYS_SRC_SEL_MCLK (0 << 15)
  174. #define ALC5632_GPCR1_DAC_HI_FLT_EN (1 << 10)
  175. #define ALC5632_GPCR1_SPK_AMP_CTRL (7 << 1)
  176. #define ALC5632_GPCR1_VDD_100 (5 << 1)
  177. #define ALC5632_GPCR1_VDD_125 (4 << 1)
  178. #define ALC5632_GPCR1_VDD_150 (3 << 1)
  179. #define ALC5632_GPCR1_VDD_175 (2 << 1)
  180. #define ALC5632_GPCR1_VDD_200 (1 << 1)
  181. #define ALC5632_GPCR1_VDD_225 (0 << 1)
  182. #define ALC5632_GPCR2 0x42
  183. #define ALC5632_GPCR2_PLL1_SOUR_SEL (3 << 12)
  184. #define ALC5632_PLL_FR_MCLK (0 << 12)
  185. #define ALC5632_PLL_FR_BCLK (2 << 12)
  186. #define ALC5632_PLL_FR_VBCLK (3 << 12)
  187. #define ALC5632_GPCR2_CLK_PLL_PRE_DIV1 (0 << 0)
  188. #define ALC5632_PLL1_CTRL 0x44
  189. #define ALC5632_PLL1_CTRL_N_VAL(n) (((n) & 0x0f) << 8)
  190. #define ALC5632_PLL1_M_BYPASS (1 << 7)
  191. #define ALC5632_PLL1_CTRL_K_VAL(k) (((k) & 0x07) << 4)
  192. #define ALC5632_PLL1_CTRL_M_VAL(m) (((m) & 0x0f) << 0)
  193. #define ALC5632_PLL2_CTRL 0x46
  194. #define ALC5632_PLL2_EN (1 << 15)
  195. #define ALC5632_PLL2_RATIO (0 << 15)
  196. #define ALC5632_GPIO_PIN_CONFIG 0x4C
  197. #define ALC5632_GPIO_PIN_POLARITY 0x4E
  198. #define ALC5632_GPIO_PIN_STICKY 0x50
  199. #define ALC5632_GPIO_PIN_WAKEUP 0x52
  200. #define ALC5632_GPIO_PIN_STATUS 0x54
  201. #define ALC5632_GPIO_PIN_SHARING 0x56
  202. #define ALC5632_OVER_CURR_STATUS 0x58
  203. #define ALC5632_SOFTVOL_CTRL 0x5A
  204. #define ALC5632_GPIO_OUPUT_PIN_CTRL 0x5C
  205. #define ALC5632_MISC_CTRL 0x5E
  206. #define ALC5632_MISC_DISABLE_FAST_VREG (1 << 15)
  207. #define ALC5632_MISC_AVC_TRGT_SEL (3 << 12)
  208. #define ALC5632_MISC_AVC_TRGT_RIGHT (1 << 12)
  209. #define ALC5632_MISC_AVC_TRGT_LEFT (2 << 12)
  210. #define ALC5632_MISC_AVC_TRGT_BOTH (3 << 12)
  211. #define ALC5632_MISC_HP_DEPOP_MODE1_EN (1 << 9)
  212. #define ALC5632_MISC_HP_DEPOP_MODE2_EN (1 << 8)
  213. #define ALC5632_MISC_HP_DEPOP_MUTE_L (1 << 7)
  214. #define ALC5632_MISC_HP_DEPOP_MUTE_R (1 << 6)
  215. #define ALC5632_MISC_HP_DEPOP_MUTE (1 << 5)
  216. #define ALC5632_MISC_GPIO_WAKEUP_CTRL (1 << 1)
  217. #define ALC5632_MISC_IRQOUT_INV_CTRL (1 << 0)
  218. #define ALC5632_DAC_CLK_CTRL1 0x60
  219. #define ALC5632_DAC_CLK_CTRL2 0x62
  220. #define ALC5632_DAC_CLK_CTRL2_DIV1_2 (1 << 0)
  221. #define ALC5632_VOICE_DAC_PCM_CLK_CTRL1 0x64
  222. #define ALC5632_PSEUDO_SPATIAL_CTRL 0x68
  223. #define ALC5632_HID_CTRL_INDEX 0x6A
  224. #define ALC5632_HID_CTRL_DATA 0x6C
  225. #define ALC5632_EQ_CTRL 0x6E
  226. /* undocumented */
  227. #define ALC5632_VENDOR_ID1 0x7C
  228. #define ALC5632_VENDOR_ID2 0x7E
  229. #define ALC5632_MAX_REGISTER 0x7E
  230. #endif