rt5660.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848
  1. /*
  2. * rt5660.h -- RT5660 ALSA SoC audio driver
  3. *
  4. * Copyright 2016 Realtek Semiconductor Corp.
  5. * Author: Oder Chiou <oder_chiou@realtek.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef _RT5660_H
  12. #define _RT5660_H
  13. #include <linux/clk.h>
  14. #include <sound/rt5660.h>
  15. /* Info */
  16. #define RT5660_RESET 0x00
  17. #define RT5660_VENDOR_ID 0xfd
  18. #define RT5660_VENDOR_ID1 0xfe
  19. #define RT5660_VENDOR_ID2 0xff
  20. /* I/O - Output */
  21. #define RT5660_SPK_VOL 0x01
  22. #define RT5660_LOUT_VOL 0x02
  23. /* I/O - Input */
  24. #define RT5660_IN1_IN2 0x0d
  25. #define RT5660_IN3_IN4 0x0e
  26. /* I/O - ADC/DAC/DMIC */
  27. #define RT5660_DAC1_DIG_VOL 0x19
  28. #define RT5660_STO1_ADC_DIG_VOL 0x1c
  29. #define RT5660_ADC_BST_VOL1 0x1e
  30. /* Mixer - D-D */
  31. #define RT5660_STO1_ADC_MIXER 0x27
  32. #define RT5660_AD_DA_MIXER 0x29
  33. #define RT5660_STO_DAC_MIXER 0x2a
  34. #define RT5660_DIG_INF1_DATA 0x2f
  35. /* Mixer - ADC */
  36. #define RT5660_REC_L1_MIXER 0x3b
  37. #define RT5660_REC_L2_MIXER 0x3c
  38. #define RT5660_REC_R1_MIXER 0x3d
  39. #define RT5660_REC_R2_MIXER 0x3e
  40. /* Mixer - DAC */
  41. #define RT5660_LOUT_MIXER 0x45
  42. #define RT5660_SPK_MIXER 0x46
  43. #define RT5660_SPO_MIXER 0x48
  44. #define RT5660_SPO_CLSD_RATIO 0x4a
  45. #define RT5660_OUT_L_GAIN1 0x4d
  46. #define RT5660_OUT_L_GAIN2 0x4e
  47. #define RT5660_OUT_L1_MIXER 0x4f
  48. #define RT5660_OUT_R_GAIN1 0x50
  49. #define RT5660_OUT_R_GAIN2 0x51
  50. #define RT5660_OUT_R1_MIXER 0x52
  51. /* Power */
  52. #define RT5660_PWR_DIG1 0x61
  53. #define RT5660_PWR_DIG2 0x62
  54. #define RT5660_PWR_ANLG1 0x63
  55. #define RT5660_PWR_ANLG2 0x64
  56. #define RT5660_PWR_MIXER 0x65
  57. #define RT5660_PWR_VOL 0x66
  58. /* Private Register Control */
  59. #define RT5660_PRIV_INDEX 0x6a
  60. #define RT5660_PRIV_DATA 0x6c
  61. /* Format - ADC/DAC */
  62. #define RT5660_I2S1_SDP 0x70
  63. #define RT5660_ADDA_CLK1 0x73
  64. #define RT5660_ADDA_CLK2 0x74
  65. #define RT5660_DMIC_CTRL1 0x75
  66. /* Function - Analog */
  67. #define RT5660_GLB_CLK 0x80
  68. #define RT5660_PLL_CTRL1 0x81
  69. #define RT5660_PLL_CTRL2 0x82
  70. #define RT5660_CLSD_AMP_OC_CTRL 0x8c
  71. #define RT5660_CLSD_AMP_CTRL 0x8d
  72. #define RT5660_LOUT_AMP_CTRL 0x8e
  73. #define RT5660_SPK_AMP_SPKVDD 0x92
  74. #define RT5660_MICBIAS 0x93
  75. #define RT5660_CLSD_OUT_CTRL1 0xa1
  76. #define RT5660_CLSD_OUT_CTRL2 0xa2
  77. #define RT5660_DIPOLE_MIC_CTRL1 0xa3
  78. #define RT5660_DIPOLE_MIC_CTRL2 0xa4
  79. #define RT5660_DIPOLE_MIC_CTRL3 0xa5
  80. #define RT5660_DIPOLE_MIC_CTRL4 0xa6
  81. #define RT5660_DIPOLE_MIC_CTRL5 0xa7
  82. #define RT5660_DIPOLE_MIC_CTRL6 0xa8
  83. #define RT5660_DIPOLE_MIC_CTRL7 0xa9
  84. #define RT5660_DIPOLE_MIC_CTRL8 0xaa
  85. #define RT5660_DIPOLE_MIC_CTRL9 0xab
  86. #define RT5660_DIPOLE_MIC_CTRL10 0xac
  87. #define RT5660_DIPOLE_MIC_CTRL11 0xad
  88. #define RT5660_DIPOLE_MIC_CTRL12 0xae
  89. /* Function - Digital */
  90. #define RT5660_EQ_CTRL1 0xb0
  91. #define RT5660_EQ_CTRL2 0xb1
  92. #define RT5660_DRC_AGC_CTRL1 0xb3
  93. #define RT5660_DRC_AGC_CTRL2 0xb4
  94. #define RT5660_DRC_AGC_CTRL3 0xb5
  95. #define RT5660_DRC_AGC_CTRL4 0xb6
  96. #define RT5660_DRC_AGC_CTRL5 0xb7
  97. #define RT5660_JD_CTRL 0xbb
  98. #define RT5660_IRQ_CTRL1 0xbd
  99. #define RT5660_IRQ_CTRL2 0xbe
  100. #define RT5660_INT_IRQ_ST 0xbf
  101. #define RT5660_GPIO_CTRL1 0xc0
  102. #define RT5660_GPIO_CTRL2 0xc2
  103. #define RT5660_WIND_FILTER_CTRL1 0xd3
  104. #define RT5660_SV_ZCD1 0xd9
  105. #define RT5660_SV_ZCD2 0xda
  106. #define RT5660_DRC1_LM_CTRL1 0xe0
  107. #define RT5660_DRC1_LM_CTRL2 0xe1
  108. #define RT5660_DRC2_LM_CTRL1 0xe2
  109. #define RT5660_DRC2_LM_CTRL2 0xe3
  110. #define RT5660_MULTI_DRC_CTRL 0xe4
  111. #define RT5660_DRC2_CTRL1 0xe5
  112. #define RT5660_DRC2_CTRL2 0xe6
  113. #define RT5660_DRC2_CTRL3 0xe7
  114. #define RT5660_DRC2_CTRL4 0xe8
  115. #define RT5660_DRC2_CTRL5 0xe9
  116. #define RT5660_ALC_PGA_CTRL1 0xea
  117. #define RT5660_ALC_PGA_CTRL2 0xeb
  118. #define RT5660_ALC_PGA_CTRL3 0xec
  119. #define RT5660_ALC_PGA_CTRL4 0xed
  120. #define RT5660_ALC_PGA_CTRL5 0xee
  121. #define RT5660_ALC_PGA_CTRL6 0xef
  122. #define RT5660_ALC_PGA_CTRL7 0xf0
  123. /* General Control */
  124. #define RT5660_GEN_CTRL1 0xfa
  125. #define RT5660_GEN_CTRL2 0xfb
  126. #define RT5660_GEN_CTRL3 0xfc
  127. /* Index of Codec Private Register definition */
  128. #define RT5660_CHOP_DAC_ADC 0x3d
  129. /* Global Definition */
  130. #define RT5660_L_MUTE (0x1 << 15)
  131. #define RT5660_L_MUTE_SFT 15
  132. #define RT5660_VOL_L_MUTE (0x1 << 14)
  133. #define RT5660_VOL_L_SFT 14
  134. #define RT5660_R_MUTE (0x1 << 7)
  135. #define RT5660_R_MUTE_SFT 7
  136. #define RT5660_VOL_R_MUTE (0x1 << 6)
  137. #define RT5660_VOL_R_SFT 6
  138. #define RT5660_L_VOL_MASK (0x3f << 8)
  139. #define RT5660_L_VOL_SFT 8
  140. #define RT5660_R_VOL_MASK (0x3f)
  141. #define RT5660_R_VOL_SFT 0
  142. /* IN1 and IN2 Control (0x0d) */
  143. #define RT5660_IN_DF1 (0x1 << 15)
  144. #define RT5660_IN_SFT1 15
  145. #define RT5660_BST_MASK1 (0x7f << 8)
  146. #define RT5660_BST_SFT1 8
  147. #define RT5660_IN_DF2 (0x1 << 7)
  148. #define RT5660_IN_SFT2 7
  149. #define RT5660_BST_MASK2 (0x7f << 0)
  150. #define RT5660_BST_SFT2 0
  151. /* IN3 and IN4 Control (0x0e) */
  152. #define RT5660_IN_DF3 (0x1 << 15)
  153. #define RT5660_IN_SFT3 15
  154. #define RT5660_BST_MASK3 (0x7f << 8)
  155. #define RT5660_BST_SFT3 8
  156. #define RT5660_IN_DF4 (0x1 << 7)
  157. #define RT5660_IN_SFT4 7
  158. #define RT5660_BST_MASK4 (0x7f << 0)
  159. #define RT5660_BST_SFT4 0
  160. /* DAC1 Digital Volume (0x19) */
  161. #define RT5660_DAC_L1_VOL_MASK (0x7f << 9)
  162. #define RT5660_DAC_L1_VOL_SFT 9
  163. #define RT5660_DAC_R1_VOL_MASK (0x7f << 1)
  164. #define RT5660_DAC_R1_VOL_SFT 1
  165. /* ADC Digital Volume Control (0x1c) */
  166. #define RT5660_ADC_L_VOL_MASK (0x3f << 9)
  167. #define RT5660_ADC_L_VOL_SFT 9
  168. #define RT5660_ADC_R_VOL_MASK (0x3f << 1)
  169. #define RT5660_ADC_R_VOL_SFT 1
  170. /* ADC Boost Volume Control (0x1e) */
  171. #define RT5660_STO1_ADC_L_BST_MASK (0x3 << 14)
  172. #define RT5660_STO1_ADC_L_BST_SFT 14
  173. #define RT5660_STO1_ADC_R_BST_MASK (0x3 << 12)
  174. #define RT5660_STO1_ADC_R_BST_SFT 12
  175. /* Stereo ADC Mixer Control (0x27) */
  176. #define RT5660_M_ADC_L1 (0x1 << 14)
  177. #define RT5660_M_ADC_L1_SFT 14
  178. #define RT5660_M_ADC_L2 (0x1 << 13)
  179. #define RT5660_M_ADC_L2_SFT 13
  180. #define RT5660_M_ADC_R1 (0x1 << 6)
  181. #define RT5660_M_ADC_R1_SFT 6
  182. #define RT5660_M_ADC_R2 (0x1 << 5)
  183. #define RT5660_M_ADC_R2_SFT 5
  184. /* ADC Mixer to DAC Mixer Control (0x29) */
  185. #define RT5660_M_ADCMIX_L (0x1 << 15)
  186. #define RT5660_M_ADCMIX_L_SFT 15
  187. #define RT5660_M_DAC1_L (0x1 << 14)
  188. #define RT5660_M_DAC1_L_SFT 14
  189. #define RT5660_M_ADCMIX_R (0x1 << 7)
  190. #define RT5660_M_ADCMIX_R_SFT 7
  191. #define RT5660_M_DAC1_R (0x1 << 6)
  192. #define RT5660_M_DAC1_R_SFT 6
  193. /* Stereo DAC Mixer Control (0x2a) */
  194. #define RT5660_M_DAC_L1 (0x1 << 14)
  195. #define RT5660_M_DAC_L1_SFT 14
  196. #define RT5660_DAC_L1_STO_L_VOL_MASK (0x1 << 13)
  197. #define RT5660_DAC_L1_STO_L_VOL_SFT 13
  198. #define RT5660_M_DAC_R1_STO_L (0x1 << 9)
  199. #define RT5660_M_DAC_R1_STO_L_SFT 9
  200. #define RT5660_DAC_R1_STO_L_VOL_MASK (0x1 << 8)
  201. #define RT5660_DAC_R1_STO_L_VOL_SFT 8
  202. #define RT5660_M_DAC_R1 (0x1 << 6)
  203. #define RT5660_M_DAC_R1_SFT 6
  204. #define RT5660_DAC_R1_STO_R_VOL_MASK (0x1 << 5)
  205. #define RT5660_DAC_R1_STO_R_VOL_SFT 5
  206. #define RT5660_M_DAC_L1_STO_R (0x1 << 1)
  207. #define RT5660_M_DAC_L1_STO_R_SFT 1
  208. #define RT5660_DAC_L1_STO_R_VOL_MASK (0x1)
  209. #define RT5660_DAC_L1_STO_R_VOL_SFT 0
  210. /* Digital Interface Data Control (0x2f) */
  211. #define RT5660_IF1_DAC_IN_SEL (0x3 << 14)
  212. #define RT5660_IF1_DAC_IN_SFT 14
  213. #define RT5660_IF1_ADC_IN_SEL (0x3 << 12)
  214. #define RT5660_IF1_ADC_IN_SFT 12
  215. /* REC Left Mixer Control 1 (0x3b) */
  216. #define RT5660_G_BST3_RM_L_MASK (0x7 << 4)
  217. #define RT5660_G_BST3_RM_L_SFT 4
  218. #define RT5660_G_BST2_RM_L_MASK (0x7 << 1)
  219. #define RT5660_G_BST2_RM_L_SFT 1
  220. /* REC Left Mixer Control 2 (0x3c) */
  221. #define RT5660_G_BST1_RM_L_MASK (0x7 << 13)
  222. #define RT5660_G_BST1_RM_L_SFT 13
  223. #define RT5660_G_OM_L_RM_L_MASK (0x7 << 10)
  224. #define RT5660_G_OM_L_RM_L_SFT 10
  225. #define RT5660_M_BST3_RM_L (0x1 << 3)
  226. #define RT5660_M_BST3_RM_L_SFT 3
  227. #define RT5660_M_BST2_RM_L (0x1 << 2)
  228. #define RT5660_M_BST2_RM_L_SFT 2
  229. #define RT5660_M_BST1_RM_L (0x1 << 1)
  230. #define RT5660_M_BST1_RM_L_SFT 1
  231. #define RT5660_M_OM_L_RM_L (0x1)
  232. #define RT5660_M_OM_L_RM_L_SFT 0
  233. /* REC Right Mixer Control 1 (0x3d) */
  234. #define RT5660_G_BST3_RM_R_MASK (0x7 << 4)
  235. #define RT5660_G_BST3_RM_R_SFT 4
  236. #define RT5660_G_BST2_RM_R_MASK (0x7 << 1)
  237. #define RT5660_G_BST2_RM_R_SFT 1
  238. /* REC Right Mixer Control 2 (0x3e) */
  239. #define RT5660_G_BST1_RM_R_MASK (0x7 << 13)
  240. #define RT5660_G_BST1_RM_R_SFT 13
  241. #define RT5660_G_OM_R_RM_R_MASK (0x7 << 10)
  242. #define RT5660_G_OM_R_RM_R_SFT 10
  243. #define RT5660_M_BST3_RM_R (0x1 << 3)
  244. #define RT5660_M_BST3_RM_R_SFT 3
  245. #define RT5660_M_BST2_RM_R (0x1 << 2)
  246. #define RT5660_M_BST2_RM_R_SFT 2
  247. #define RT5660_M_BST1_RM_R (0x1 << 1)
  248. #define RT5660_M_BST1_RM_R_SFT 1
  249. #define RT5660_M_OM_R_RM_R (0x1)
  250. #define RT5660_M_OM_R_RM_R_SFT 0
  251. /* LOUTMIX Control (0x45) */
  252. #define RT5660_M_DAC1_LM (0x1 << 14)
  253. #define RT5660_M_DAC1_LM_SFT 14
  254. #define RT5660_M_LOVOL_M (0x1 << 13)
  255. #define RT5660_M_LOVOL_LM_SFT 13
  256. /* SPK Mixer Control (0x46) */
  257. #define RT5660_G_BST3_SM_MASK (0x3 << 14)
  258. #define RT5660_G_BST3_SM_SFT 14
  259. #define RT5660_G_BST1_SM_MASK (0x3 << 12)
  260. #define RT5660_G_BST1_SM_SFT 12
  261. #define RT5660_G_DACl_SM_MASK (0x3 << 10)
  262. #define RT5660_G_DACl_SM_SFT 10
  263. #define RT5660_G_DACR_SM_MASK (0x3 << 8)
  264. #define RT5660_G_DACR_SM_SFT 8
  265. #define RT5660_G_OM_L_SM_MASK (0x3 << 6)
  266. #define RT5660_G_OM_L_SM_SFT 6
  267. #define RT5660_M_DACR_SM (0x1 << 5)
  268. #define RT5660_M_DACR_SM_SFT 5
  269. #define RT5660_M_BST1_SM (0x1 << 4)
  270. #define RT5660_M_BST1_SM_SFT 4
  271. #define RT5660_M_BST3_SM (0x1 << 3)
  272. #define RT5660_M_BST3_SM_SFT 3
  273. #define RT5660_M_DACL_SM (0x1 << 2)
  274. #define RT5660_M_DACL_SM_SFT 2
  275. #define RT5660_M_OM_L_SM (0x1 << 1)
  276. #define RT5660_M_OM_L_SM_SFT 1
  277. /* SPOMIX Control (0x48) */
  278. #define RT5660_M_DAC_R_SPM (0x1 << 14)
  279. #define RT5660_M_DAC_R_SPM_SFT 14
  280. #define RT5660_M_DAC_L_SPM (0x1 << 13)
  281. #define RT5660_M_DAC_L_SPM_SFT 13
  282. #define RT5660_M_SV_SPM (0x1 << 12)
  283. #define RT5660_M_SV_SPM_SFT 12
  284. #define RT5660_M_BST1_SPM (0x1 << 11)
  285. #define RT5660_M_BST1_SPM_SFT 11
  286. /* Output Left Mixer Control 1 (0x4d) */
  287. #define RT5660_G_BST3_OM_L_MASK (0x7 << 13)
  288. #define RT5660_G_BST3_OM_L_SFT 13
  289. #define RT5660_G_BST2_OM_L_MASK (0x7 << 10)
  290. #define RT5660_G_BST2_OM_L_SFT 10
  291. #define RT5660_G_BST1_OM_L_MASK (0x7 << 7)
  292. #define RT5660_G_BST1_OM_L_SFT 7
  293. #define RT5660_G_RM_L_OM_L_MASK (0x7 << 1)
  294. #define RT5660_G_RM_L_OM_L_SFT 1
  295. /* Output Left Mixer Control 2 (0x4e) */
  296. #define RT5660_G_DAC_R1_OM_L_MASK (0x7 << 10)
  297. #define RT5660_G_DAC_R1_OM_L_SFT 10
  298. #define RT5660_G_DAC_L1_OM_L_MASK (0x7 << 7)
  299. #define RT5660_G_DAC_L1_OM_L_SFT 7
  300. /* Output Left Mixer Control 3 (0x4f) */
  301. #define RT5660_M_BST3_OM_L (0x1 << 5)
  302. #define RT5660_M_BST3_OM_L_SFT 5
  303. #define RT5660_M_BST2_OM_L (0x1 << 4)
  304. #define RT5660_M_BST2_OM_L_SFT 4
  305. #define RT5660_M_BST1_OM_L (0x1 << 3)
  306. #define RT5660_M_BST1_OM_L_SFT 3
  307. #define RT5660_M_RM_L_OM_L (0x1 << 2)
  308. #define RT5660_M_RM_L_OM_L_SFT 2
  309. #define RT5660_M_DAC_R_OM_L (0x1 << 1)
  310. #define RT5660_M_DAC_R_OM_L_SFT 1
  311. #define RT5660_M_DAC_L_OM_L (0x1)
  312. #define RT5660_M_DAC_L_OM_L_SFT 0
  313. /* Output Right Mixer Control 1 (0x50) */
  314. #define RT5660_G_BST2_OM_R_MASK (0x7 << 10)
  315. #define RT5660_G_BST2_OM_R_SFT 10
  316. #define RT5660_G_BST1_OM_R_MASK (0x7 << 7)
  317. #define RT5660_G_BST1_OM_R_SFT 7
  318. #define RT5660_G_RM_R_OM_R_MASK (0x7 << 1)
  319. #define RT5660_G_RM_R_OM_R_SFT 1
  320. /* Output Right Mixer Control 2 (0x51) */
  321. #define RT5660_G_DAC_L_OM_R_MASK (0x7 << 10)
  322. #define RT5660_G_DAC_L_OM_R_SFT 10
  323. #define RT5660_G_DAC_R_OM_R_MASK (0x7 << 7)
  324. #define RT5660_G_DAC_R_OM_R_SFT 7
  325. /* Output Right Mixer Control 3 (0x52) */
  326. #define RT5660_M_BST2_OM_R (0x1 << 4)
  327. #define RT5660_M_BST2_OM_R_SFT 4
  328. #define RT5660_M_BST1_OM_R (0x1 << 3)
  329. #define RT5660_M_BST1_OM_R_SFT 3
  330. #define RT5660_M_RM_R_OM_R (0x1 << 2)
  331. #define RT5660_M_RM_R_OM_R_SFT 2
  332. #define RT5660_M_DAC_L_OM_R (0x1 << 1)
  333. #define RT5660_M_DAC_L_OM_R_SFT 1
  334. #define RT5660_M_DAC_R_OM_R (0x1)
  335. #define RT5660_M_DAC_R_OM_R_SFT 0
  336. /* Power Management for Digital 1 (0x61) */
  337. #define RT5660_PWR_I2S1 (0x1 << 15)
  338. #define RT5660_PWR_I2S1_BIT 15
  339. #define RT5660_PWR_DAC_L1 (0x1 << 12)
  340. #define RT5660_PWR_DAC_L1_BIT 12
  341. #define RT5660_PWR_DAC_R1 (0x1 << 11)
  342. #define RT5660_PWR_DAC_R1_BIT 11
  343. #define RT5660_PWR_ADC_L (0x1 << 2)
  344. #define RT5660_PWR_ADC_L_BIT 2
  345. #define RT5660_PWR_ADC_R (0x1 << 1)
  346. #define RT5660_PWR_ADC_R_BIT 1
  347. #define RT5660_PWR_CLS_D (0x1)
  348. #define RT5660_PWR_CLS_D_BIT 0
  349. /* Power Management for Digital 2 (0x62) */
  350. #define RT5660_PWR_ADC_S1F (0x1 << 15)
  351. #define RT5660_PWR_ADC_S1F_BIT 15
  352. #define RT5660_PWR_DAC_S1F (0x1 << 11)
  353. #define RT5660_PWR_DAC_S1F_BIT 11
  354. /* Power Management for Analog 1 (0x63) */
  355. #define RT5660_PWR_VREF1 (0x1 << 15)
  356. #define RT5660_PWR_VREF1_BIT 15
  357. #define RT5660_PWR_FV1 (0x1 << 14)
  358. #define RT5660_PWR_FV1_BIT 14
  359. #define RT5660_PWR_MB (0x1 << 13)
  360. #define RT5660_PWR_MB_BIT 13
  361. #define RT5660_PWR_BG (0x1 << 11)
  362. #define RT5660_PWR_BG_BIT 11
  363. #define RT5660_PWR_HP_L (0x1 << 7)
  364. #define RT5660_PWR_HP_L_BIT 7
  365. #define RT5660_PWR_HP_R (0x1 << 6)
  366. #define RT5660_PWR_HP_R_BIT 6
  367. #define RT5660_PWR_HA (0x1 << 5)
  368. #define RT5660_PWR_HA_BIT 5
  369. #define RT5660_PWR_VREF2 (0x1 << 4)
  370. #define RT5660_PWR_VREF2_BIT 4
  371. #define RT5660_PWR_FV2 (0x1 << 3)
  372. #define RT5660_PWR_FV2_BIT 3
  373. #define RT5660_PWR_LDO2 (0x1 << 2)
  374. #define RT5660_PWR_LDO2_BIT 2
  375. /* Power Management for Analog 2 (0x64) */
  376. #define RT5660_PWR_BST1 (0x1 << 15)
  377. #define RT5660_PWR_BST1_BIT 15
  378. #define RT5660_PWR_BST2 (0x1 << 14)
  379. #define RT5660_PWR_BST2_BIT 14
  380. #define RT5660_PWR_BST3 (0x1 << 13)
  381. #define RT5660_PWR_BST3_BIT 13
  382. #define RT5660_PWR_MB1 (0x1 << 11)
  383. #define RT5660_PWR_MB1_BIT 11
  384. #define RT5660_PWR_MB2 (0x1 << 10)
  385. #define RT5660_PWR_MB2_BIT 10
  386. #define RT5660_PWR_PLL (0x1 << 9)
  387. #define RT5660_PWR_PLL_BIT 9
  388. /* Power Management for Mixer (0x65) */
  389. #define RT5660_PWR_OM_L (0x1 << 15)
  390. #define RT5660_PWR_OM_L_BIT 15
  391. #define RT5660_PWR_OM_R (0x1 << 14)
  392. #define RT5660_PWR_OM_R_BIT 14
  393. #define RT5660_PWR_SM (0x1 << 13)
  394. #define RT5660_PWR_SM_BIT 13
  395. #define RT5660_PWR_RM_L (0x1 << 11)
  396. #define RT5660_PWR_RM_L_BIT 11
  397. #define RT5660_PWR_RM_R (0x1 << 10)
  398. #define RT5660_PWR_RM_R_BIT 10
  399. /* Power Management for Volume (0x66) */
  400. #define RT5660_PWR_SV (0x1 << 15)
  401. #define RT5660_PWR_SV_BIT 15
  402. #define RT5660_PWR_LV_L (0x1 << 11)
  403. #define RT5660_PWR_LV_L_BIT 11
  404. #define RT5660_PWR_LV_R (0x1 << 10)
  405. #define RT5660_PWR_LV_R_BIT 10
  406. /* I2S1 Audio Serial Data Port Control (0x70) */
  407. #define RT5660_I2S_MS_MASK (0x1 << 15)
  408. #define RT5660_I2S_MS_SFT 15
  409. #define RT5660_I2S_MS_M (0x0 << 15)
  410. #define RT5660_I2S_MS_S (0x1 << 15)
  411. #define RT5660_I2S_O_CP_MASK (0x3 << 10)
  412. #define RT5660_I2S_O_CP_SFT 10
  413. #define RT5660_I2S_O_CP_OFF (0x0 << 10)
  414. #define RT5660_I2S_O_CP_U_LAW (0x1 << 10)
  415. #define RT5660_I2S_O_CP_A_LAW (0x2 << 10)
  416. #define RT5660_I2S_I_CP_MASK (0x3 << 8)
  417. #define RT5660_I2S_I_CP_SFT 8
  418. #define RT5660_I2S_I_CP_OFF (0x0 << 8)
  419. #define RT5660_I2S_I_CP_U_LAW (0x1 << 8)
  420. #define RT5660_I2S_I_CP_A_LAW (0x2 << 8)
  421. #define RT5660_I2S_BP_MASK (0x1 << 7)
  422. #define RT5660_I2S_BP_SFT 7
  423. #define RT5660_I2S_BP_NOR (0x0 << 7)
  424. #define RT5660_I2S_BP_INV (0x1 << 7)
  425. #define RT5660_I2S_DL_MASK (0x3 << 2)
  426. #define RT5660_I2S_DL_SFT 2
  427. #define RT5660_I2S_DL_16 (0x0 << 2)
  428. #define RT5660_I2S_DL_20 (0x1 << 2)
  429. #define RT5660_I2S_DL_24 (0x2 << 2)
  430. #define RT5660_I2S_DL_8 (0x3 << 2)
  431. #define RT5660_I2S_DF_MASK (0x3)
  432. #define RT5660_I2S_DF_SFT 0
  433. #define RT5660_I2S_DF_I2S (0x0)
  434. #define RT5660_I2S_DF_LEFT (0x1)
  435. #define RT5660_I2S_DF_PCM_A (0x2)
  436. #define RT5660_I2S_DF_PCM_B (0x3)
  437. /* ADC/DAC Clock Control 1 (0x73) */
  438. #define RT5660_I2S_BCLK_MS1_MASK (0x1 << 15)
  439. #define RT5660_I2S_BCLK_MS1_SFT 15
  440. #define RT5660_I2S_BCLK_MS1_32 (0x0 << 15)
  441. #define RT5660_I2S_BCLK_MS1_64 (0x1 << 15)
  442. #define RT5660_I2S_PD1_MASK (0x7 << 12)
  443. #define RT5660_I2S_PD1_SFT 12
  444. #define RT5660_I2S_PD1_1 (0x0 << 12)
  445. #define RT5660_I2S_PD1_2 (0x1 << 12)
  446. #define RT5660_I2S_PD1_3 (0x2 << 12)
  447. #define RT5660_I2S_PD1_4 (0x3 << 12)
  448. #define RT5660_I2S_PD1_6 (0x4 << 12)
  449. #define RT5660_I2S_PD1_8 (0x5 << 12)
  450. #define RT5660_I2S_PD1_12 (0x6 << 12)
  451. #define RT5660_I2S_PD1_16 (0x7 << 12)
  452. #define RT5660_DAC_OSR_MASK (0x3 << 2)
  453. #define RT5660_DAC_OSR_SFT 2
  454. #define RT5660_DAC_OSR_128 (0x0 << 2)
  455. #define RT5660_DAC_OSR_64 (0x1 << 2)
  456. #define RT5660_DAC_OSR_32 (0x2 << 2)
  457. #define RT5660_DAC_OSR_16 (0x3 << 2)
  458. #define RT5660_ADC_OSR_MASK (0x3)
  459. #define RT5660_ADC_OSR_SFT 0
  460. #define RT5660_ADC_OSR_128 (0x0)
  461. #define RT5660_ADC_OSR_64 (0x1)
  462. #define RT5660_ADC_OSR_32 (0x2)
  463. #define RT5660_ADC_OSR_16 (0x3)
  464. /* ADC/DAC Clock Control 2 (0x74) */
  465. #define RT5660_RESET_ADF (0x1 << 13)
  466. #define RT5660_RESET_ADF_SFT 13
  467. #define RT5660_RESET_DAF (0x1 << 12)
  468. #define RT5660_RESET_DAF_SFT 12
  469. #define RT5660_DAHPF_EN (0x1 << 11)
  470. #define RT5660_DAHPF_EN_SFT 11
  471. #define RT5660_ADHPF_EN (0x1 << 10)
  472. #define RT5660_ADHPF_EN_SFT 10
  473. /* Digital Microphone Control (0x75) */
  474. #define RT5660_DMIC_1_EN_MASK (0x1 << 15)
  475. #define RT5660_DMIC_1_EN_SFT 15
  476. #define RT5660_DMIC_1_DIS (0x0 << 15)
  477. #define RT5660_DMIC_1_EN (0x1 << 15)
  478. #define RT5660_DMIC_1L_LH_MASK (0x1 << 13)
  479. #define RT5660_DMIC_1L_LH_SFT 13
  480. #define RT5660_DMIC_1L_LH_RISING (0x0 << 13)
  481. #define RT5660_DMIC_1L_LH_FALLING (0x1 << 13)
  482. #define RT5660_DMIC_1R_LH_MASK (0x1 << 12)
  483. #define RT5660_DMIC_1R_LH_SFT 12
  484. #define RT5660_DMIC_1R_LH_RISING (0x0 << 12)
  485. #define RT5660_DMIC_1R_LH_FALLING (0x1 << 12)
  486. #define RT5660_SEL_DMIC_DATA_MASK (0x1 << 11)
  487. #define RT5660_SEL_DMIC_DATA_SFT 11
  488. #define RT5660_SEL_DMIC_DATA_GPIO2 (0x0 << 11)
  489. #define RT5660_SEL_DMIC_DATA_IN1P (0x1 << 11)
  490. #define RT5660_DMIC_CLK_MASK (0x7 << 5)
  491. #define RT5660_DMIC_CLK_SFT 5
  492. /* Global Clock Control (0x80) */
  493. #define RT5660_SCLK_SRC_MASK (0x3 << 14)
  494. #define RT5660_SCLK_SRC_SFT 14
  495. #define RT5660_SCLK_SRC_MCLK (0x0 << 14)
  496. #define RT5660_SCLK_SRC_PLL1 (0x1 << 14)
  497. #define RT5660_SCLK_SRC_RCCLK (0x2 << 14)
  498. #define RT5660_PLL1_SRC_MASK (0x3 << 12)
  499. #define RT5660_PLL1_SRC_SFT 12
  500. #define RT5660_PLL1_SRC_MCLK (0x0 << 12)
  501. #define RT5660_PLL1_SRC_BCLK1 (0x1 << 12)
  502. #define RT5660_PLL1_SRC_RCCLK (0x2 << 12)
  503. #define RT5660_PLL1_PD_MASK (0x1 << 3)
  504. #define RT5660_PLL1_PD_SFT 3
  505. #define RT5660_PLL1_PD_1 (0x0 << 3)
  506. #define RT5660_PLL1_PD_2 (0x1 << 3)
  507. #define RT5660_PLL_INP_MAX 40000000
  508. #define RT5660_PLL_INP_MIN 256000
  509. /* PLL M/N/K Code Control 1 (0x81) */
  510. #define RT5660_PLL_N_MAX 0x1ff
  511. #define RT5660_PLL_N_MASK (RT5660_PLL_N_MAX << 7)
  512. #define RT5660_PLL_N_SFT 7
  513. #define RT5660_PLL_K_MAX 0x1f
  514. #define RT5660_PLL_K_MASK (RT5660_PLL_K_MAX)
  515. #define RT5660_PLL_K_SFT 0
  516. /* PLL M/N/K Code Control 2 (0x82) */
  517. #define RT5660_PLL_M_MAX 0xf
  518. #define RT5660_PLL_M_MASK (RT5660_PLL_M_MAX << 12)
  519. #define RT5660_PLL_M_SFT 12
  520. #define RT5660_PLL_M_BP (0x1 << 11)
  521. #define RT5660_PLL_M_BP_SFT 11
  522. /* Class D Over Current Control (0x8c) */
  523. #define RT5660_CLSD_OC_MASK (0x1 << 9)
  524. #define RT5660_CLSD_OC_SFT 9
  525. #define RT5660_CLSD_OC_PU (0x0 << 9)
  526. #define RT5660_CLSD_OC_PD (0x1 << 9)
  527. #define RT5660_AUTO_PD_MASK (0x1 << 8)
  528. #define RT5660_AUTO_PD_SFT 8
  529. #define RT5660_AUTO_PD_DIS (0x0 << 8)
  530. #define RT5660_AUTO_PD_EN (0x1 << 8)
  531. #define RT5660_CLSD_OC_TH_MASK (0x3f)
  532. #define RT5660_CLSD_OC_TH_SFT 0
  533. /* Class D Output Control (0x8d) */
  534. #define RT5660_CLSD_RATIO_MASK (0xf << 12)
  535. #define RT5660_CLSD_RATIO_SFT 12
  536. /* Lout Amp Control 1 (0x8e) */
  537. #define RT5660_LOUT_CO_MASK (0x1 << 4)
  538. #define RT5660_LOUT_CO_SFT 4
  539. #define RT5660_LOUT_CO_DIS (0x0 << 4)
  540. #define RT5660_LOUT_CO_EN (0x1 << 4)
  541. #define RT5660_LOUT_CB_MASK (0x1)
  542. #define RT5660_LOUT_CB_SFT 0
  543. #define RT5660_LOUT_CB_PD (0x0)
  544. #define RT5660_LOUT_CB_PU (0x1)
  545. /* SPKVDD detection control (0x92) */
  546. #define RT5660_SPKVDD_DET_MASK (0x1 << 15)
  547. #define RT5660_SPKVDD_DET_SFT 15
  548. #define RT5660_SPKVDD_DET_DIS (0x0 << 15)
  549. #define RT5660_SPKVDD_DET_EN (0x1 << 15)
  550. #define RT5660_SPK_AG_MASK (0x1 << 14)
  551. #define RT5660_SPK_AG_SFT 14
  552. #define RT5660_SPK_AG_DIS (0x0 << 14)
  553. #define RT5660_SPK_AG_EN (0x1 << 14)
  554. /* Micbias Control (0x93) */
  555. #define RT5660_MIC1_BS_MASK (0x1 << 15)
  556. #define RT5660_MIC1_BS_SFT 15
  557. #define RT5660_MIC1_BS_9AV (0x0 << 15)
  558. #define RT5660_MIC1_BS_75AV (0x1 << 15)
  559. #define RT5660_MIC2_BS_MASK (0x1 << 14)
  560. #define RT5660_MIC2_BS_SFT 14
  561. #define RT5660_MIC2_BS_9AV (0x0 << 14)
  562. #define RT5660_MIC2_BS_75AV (0x1 << 14)
  563. #define RT5660_MIC1_OVCD_MASK (0x1 << 11)
  564. #define RT5660_MIC1_OVCD_SFT 11
  565. #define RT5660_MIC1_OVCD_DIS (0x0 << 11)
  566. #define RT5660_MIC1_OVCD_EN (0x1 << 11)
  567. #define RT5660_MIC1_OVTH_MASK (0x3 << 9)
  568. #define RT5660_MIC1_OVTH_SFT 9
  569. #define RT5660_MIC1_OVTH_600UA (0x0 << 9)
  570. #define RT5660_MIC1_OVTH_1500UA (0x1 << 9)
  571. #define RT5660_MIC1_OVTH_2000UA (0x2 << 9)
  572. #define RT5660_MIC2_OVCD_MASK (0x1 << 8)
  573. #define RT5660_MIC2_OVCD_SFT 8
  574. #define RT5660_MIC2_OVCD_DIS (0x0 << 8)
  575. #define RT5660_MIC2_OVCD_EN (0x1 << 8)
  576. #define RT5660_MIC2_OVTH_MASK (0x3 << 6)
  577. #define RT5660_MIC2_OVTH_SFT 6
  578. #define RT5660_MIC2_OVTH_600UA (0x0 << 6)
  579. #define RT5660_MIC2_OVTH_1500UA (0x1 << 6)
  580. #define RT5660_MIC2_OVTH_2000UA (0x2 << 6)
  581. #define RT5660_PWR_CLK25M_MASK (0x1 << 4)
  582. #define RT5660_PWR_CLK25M_SFT 4
  583. #define RT5660_PWR_CLK25M_PD (0x0 << 4)
  584. #define RT5660_PWR_CLK25M_PU (0x1 << 4)
  585. /* EQ Control 1 (0xb0) */
  586. #define RT5660_EQ_SRC_MASK (0x1 << 15)
  587. #define RT5660_EQ_SRC_SFT 15
  588. #define RT5660_EQ_SRC_DAC (0x0 << 15)
  589. #define RT5660_EQ_SRC_ADC (0x1 << 15)
  590. #define RT5660_EQ_UPD (0x1 << 14)
  591. #define RT5660_EQ_UPD_BIT 14
  592. /* Jack Detect Control (0xbb) */
  593. #define RT5660_JD_MASK (0x3 << 14)
  594. #define RT5660_JD_SFT 14
  595. #define RT5660_JD_DIS (0x0 << 14)
  596. #define RT5660_JD_GPIO1 (0x1 << 14)
  597. #define RT5660_JD_GPIO2 (0x2 << 14)
  598. #define RT5660_JD_LOUT_MASK (0x1 << 11)
  599. #define RT5660_JD_LOUT_SFT 11
  600. #define RT5660_JD_LOUT_DIS (0x0 << 11)
  601. #define RT5660_JD_LOUT_EN (0x1 << 11)
  602. #define RT5660_JD_LOUT_TRG_MASK (0x1 << 10)
  603. #define RT5660_JD_LOUT_TRG_SFT 10
  604. #define RT5660_JD_LOUT_TRG_LO (0x0 << 10)
  605. #define RT5660_JD_LOUT_TRG_HI (0x1 << 10)
  606. #define RT5660_JD_SPO_MASK (0x1 << 9)
  607. #define RT5660_JD_SPO_SFT 9
  608. #define RT5660_JD_SPO_DIS (0x0 << 9)
  609. #define RT5660_JD_SPO_EN (0x1 << 9)
  610. #define RT5660_JD_SPO_TRG_MASK (0x1 << 8)
  611. #define RT5660_JD_SPO_TRG_SFT 8
  612. #define RT5660_JD_SPO_TRG_LO (0x0 << 8)
  613. #define RT5660_JD_SPO_TRG_HI (0x1 << 8)
  614. /* IRQ Control 1 (0xbd) */
  615. #define RT5660_IRQ_JD_MASK (0x1 << 15)
  616. #define RT5660_IRQ_JD_SFT 15
  617. #define RT5660_IRQ_JD_BP (0x0 << 15)
  618. #define RT5660_IRQ_JD_NOR (0x1 << 15)
  619. #define RT5660_IRQ_OT_MASK (0x1 << 14)
  620. #define RT5660_IRQ_OT_SFT 14
  621. #define RT5660_IRQ_OT_BP (0x0 << 14)
  622. #define RT5660_IRQ_OT_NOR (0x1 << 14)
  623. #define RT5660_JD_STKY_MASK (0x1 << 13)
  624. #define RT5660_JD_STKY_SFT 13
  625. #define RT5660_JD_STKY_DIS (0x0 << 13)
  626. #define RT5660_JD_STKY_EN (0x1 << 13)
  627. #define RT5660_OT_STKY_MASK (0x1 << 12)
  628. #define RT5660_OT_STKY_SFT 12
  629. #define RT5660_OT_STKY_DIS (0x0 << 12)
  630. #define RT5660_OT_STKY_EN (0x1 << 12)
  631. #define RT5660_JD_P_MASK (0x1 << 11)
  632. #define RT5660_JD_P_SFT 11
  633. #define RT5660_JD_P_NOR (0x0 << 11)
  634. #define RT5660_JD_P_INV (0x1 << 11)
  635. #define RT5660_OT_P_MASK (0x1 << 10)
  636. #define RT5660_OT_P_SFT 10
  637. #define RT5660_OT_P_NOR (0x0 << 10)
  638. #define RT5660_OT_P_INV (0x1 << 10)
  639. /* IRQ Control 2 (0xbe) */
  640. #define RT5660_IRQ_MB1_OC_MASK (0x1 << 15)
  641. #define RT5660_IRQ_MB1_OC_SFT 15
  642. #define RT5660_IRQ_MB1_OC_BP (0x0 << 15)
  643. #define RT5660_IRQ_MB1_OC_NOR (0x1 << 15)
  644. #define RT5660_IRQ_MB2_OC_MASK (0x1 << 14)
  645. #define RT5660_IRQ_MB2_OC_SFT 14
  646. #define RT5660_IRQ_MB2_OC_BP (0x0 << 14)
  647. #define RT5660_IRQ_MB2_OC_NOR (0x1 << 14)
  648. #define RT5660_MB1_OC_STKY_MASK (0x1 << 11)
  649. #define RT5660_MB1_OC_STKY_SFT 11
  650. #define RT5660_MB1_OC_STKY_DIS (0x0 << 11)
  651. #define RT5660_MB1_OC_STKY_EN (0x1 << 11)
  652. #define RT5660_MB2_OC_STKY_MASK (0x1 << 10)
  653. #define RT5660_MB2_OC_STKY_SFT 10
  654. #define RT5660_MB2_OC_STKY_DIS (0x0 << 10)
  655. #define RT5660_MB2_OC_STKY_EN (0x1 << 10)
  656. #define RT5660_MB1_OC_P_MASK (0x1 << 7)
  657. #define RT5660_MB1_OC_P_SFT 7
  658. #define RT5660_MB1_OC_P_NOR (0x0 << 7)
  659. #define RT5660_MB1_OC_P_INV (0x1 << 7)
  660. #define RT5660_MB2_OC_P_MASK (0x1 << 6)
  661. #define RT5660_MB2_OC_P_SFT 6
  662. #define RT5660_MB2_OC_P_NOR (0x0 << 6)
  663. #define RT5660_MB2_OC_P_INV (0x1 << 6)
  664. #define RT5660_MB1_OC_CLR (0x1 << 3)
  665. #define RT5660_MB1_OC_CLR_SFT 3
  666. #define RT5660_MB2_OC_CLR (0x1 << 2)
  667. #define RT5660_MB2_OC_CLR_SFT 2
  668. /* GPIO Control 1 (0xc0) */
  669. #define RT5660_GP2_PIN_MASK (0x1 << 14)
  670. #define RT5660_GP2_PIN_SFT 14
  671. #define RT5660_GP2_PIN_GPIO2 (0x0 << 14)
  672. #define RT5660_GP2_PIN_DMIC1_SDA (0x1 << 14)
  673. #define RT5660_GP1_PIN_MASK (0x3 << 12)
  674. #define RT5660_GP1_PIN_SFT 12
  675. #define RT5660_GP1_PIN_GPIO1 (0x0 << 12)
  676. #define RT5660_GP1_PIN_DMIC1_SCL (0x1 << 12)
  677. #define RT5660_GP1_PIN_IRQ (0x2 << 12)
  678. #define RT5660_GPIO_M_MASK (0x1 << 9)
  679. #define RT5660_GPIO_M_SFT 9
  680. #define RT5660_GPIO_M_FLT (0x0 << 9)
  681. #define RT5660_GPIO_M_PH (0x1 << 9)
  682. /* GPIO Control 3 (0xc2) */
  683. #define RT5660_GP2_PF_MASK (0x1 << 5)
  684. #define RT5660_GP2_PF_SFT 5
  685. #define RT5660_GP2_PF_IN (0x0 << 5)
  686. #define RT5660_GP2_PF_OUT (0x1 << 5)
  687. #define RT5660_GP2_OUT_MASK (0x1 << 4)
  688. #define RT5660_GP2_OUT_SFT 4
  689. #define RT5660_GP2_OUT_LO (0x0 << 4)
  690. #define RT5660_GP2_OUT_HI (0x1 << 4)
  691. #define RT5660_GP2_P_MASK (0x1 << 3)
  692. #define RT5660_GP2_P_SFT 3
  693. #define RT5660_GP2_P_NOR (0x0 << 3)
  694. #define RT5660_GP2_P_INV (0x1 << 3)
  695. #define RT5660_GP1_PF_MASK (0x1 << 2)
  696. #define RT5660_GP1_PF_SFT 2
  697. #define RT5660_GP1_PF_IN (0x0 << 2)
  698. #define RT5660_GP1_PF_OUT (0x1 << 2)
  699. #define RT5660_GP1_OUT_MASK (0x1 << 1)
  700. #define RT5660_GP1_OUT_SFT 1
  701. #define RT5660_GP1_OUT_LO (0x0 << 1)
  702. #define RT5660_GP1_OUT_HI (0x1 << 1)
  703. #define RT5660_GP1_P_MASK (0x1)
  704. #define RT5660_GP1_P_SFT 0
  705. #define RT5660_GP1_P_NOR (0x0)
  706. #define RT5660_GP1_P_INV (0x1)
  707. /* Soft volume and zero cross control 1 (0xd9) */
  708. #define RT5660_SV_MASK (0x1 << 15)
  709. #define RT5660_SV_SFT 15
  710. #define RT5660_SV_DIS (0x0 << 15)
  711. #define RT5660_SV_EN (0x1 << 15)
  712. #define RT5660_SPO_SV_MASK (0x1 << 14)
  713. #define RT5660_SPO_SV_SFT 14
  714. #define RT5660_SPO_SV_DIS (0x0 << 14)
  715. #define RT5660_SPO_SV_EN (0x1 << 14)
  716. #define RT5660_OUT_SV_MASK (0x1 << 12)
  717. #define RT5660_OUT_SV_SFT 12
  718. #define RT5660_OUT_SV_DIS (0x0 << 12)
  719. #define RT5660_OUT_SV_EN (0x1 << 12)
  720. #define RT5660_ZCD_DIG_MASK (0x1 << 11)
  721. #define RT5660_ZCD_DIG_SFT 11
  722. #define RT5660_ZCD_DIG_DIS (0x0 << 11)
  723. #define RT5660_ZCD_DIG_EN (0x1 << 11)
  724. #define RT5660_ZCD_MASK (0x1 << 10)
  725. #define RT5660_ZCD_SFT 10
  726. #define RT5660_ZCD_PD (0x0 << 10)
  727. #define RT5660_ZCD_PU (0x1 << 10)
  728. #define RT5660_SV_DLY_MASK (0xf)
  729. #define RT5660_SV_DLY_SFT 0
  730. /* Soft volume and zero cross control 2 (0xda) */
  731. #define RT5660_ZCD_SPO_MASK (0x1 << 15)
  732. #define RT5660_ZCD_SPO_SFT 15
  733. #define RT5660_ZCD_SPO_DIS (0x0 << 15)
  734. #define RT5660_ZCD_SPO_EN (0x1 << 15)
  735. #define RT5660_ZCD_OMR_MASK (0x1 << 8)
  736. #define RT5660_ZCD_OMR_SFT 8
  737. #define RT5660_ZCD_OMR_DIS (0x0 << 8)
  738. #define RT5660_ZCD_OMR_EN (0x1 << 8)
  739. #define RT5660_ZCD_OML_MASK (0x1 << 7)
  740. #define RT5660_ZCD_OML_SFT 7
  741. #define RT5660_ZCD_OML_DIS (0x0 << 7)
  742. #define RT5660_ZCD_OML_EN (0x1 << 7)
  743. #define RT5660_ZCD_SPM_MASK (0x1 << 6)
  744. #define RT5660_ZCD_SPM_SFT 6
  745. #define RT5660_ZCD_SPM_DIS (0x0 << 6)
  746. #define RT5660_ZCD_SPM_EN (0x1 << 6)
  747. #define RT5660_ZCD_RMR_MASK (0x1 << 5)
  748. #define RT5660_ZCD_RMR_SFT 5
  749. #define RT5660_ZCD_RMR_DIS (0x0 << 5)
  750. #define RT5660_ZCD_RMR_EN (0x1 << 5)
  751. #define RT5660_ZCD_RML_MASK (0x1 << 4)
  752. #define RT5660_ZCD_RML_SFT 4
  753. #define RT5660_ZCD_RML_DIS (0x0 << 4)
  754. #define RT5660_ZCD_RML_EN (0x1 << 4)
  755. /* General Control 1 (0xfa) */
  756. #define RT5660_PWR_VREF_HP (0x1 << 11)
  757. #define RT5660_PWR_VREF_HP_SFT 11
  758. #define RT5660_DIG_GATE_CTRL (0x1)
  759. #define RT5660_DIG_GATE_CTRL_SFT 0
  760. /* System Clock Source */
  761. #define RT5660_SCLK_S_MCLK 0
  762. #define RT5660_SCLK_S_PLL1 1
  763. #define RT5660_SCLK_S_RCCLK 2
  764. /* PLL1 Source */
  765. #define RT5660_PLL1_S_MCLK 0
  766. #define RT5660_PLL1_S_BCLK 1
  767. enum {
  768. RT5660_AIF1,
  769. RT5660_AIFS,
  770. };
  771. struct rt5660_priv {
  772. struct snd_soc_codec *codec;
  773. struct rt5660_platform_data pdata;
  774. struct regmap *regmap;
  775. struct clk *mclk;
  776. int sysclk;
  777. int sysclk_src;
  778. int lrck[RT5660_AIFS];
  779. int bclk[RT5660_AIFS];
  780. int master[RT5660_AIFS];
  781. int pll_src;
  782. int pll_in;
  783. int pll_out;
  784. };
  785. #endif