wm8737.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. #ifndef _WM8737_H
  2. #define _WM8737_H
  3. /*
  4. * wm8737.c -- WM8523 ALSA SoC Audio driver
  5. *
  6. * Copyright 2010 Wolfson Microelectronics plc
  7. *
  8. * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. /*
  15. * Register values.
  16. */
  17. #define WM8737_LEFT_PGA_VOLUME 0x00
  18. #define WM8737_RIGHT_PGA_VOLUME 0x01
  19. #define WM8737_AUDIO_PATH_L 0x02
  20. #define WM8737_AUDIO_PATH_R 0x03
  21. #define WM8737_3D_ENHANCE 0x04
  22. #define WM8737_ADC_CONTROL 0x05
  23. #define WM8737_POWER_MANAGEMENT 0x06
  24. #define WM8737_AUDIO_FORMAT 0x07
  25. #define WM8737_CLOCKING 0x08
  26. #define WM8737_MIC_PREAMP_CONTROL 0x09
  27. #define WM8737_MISC_BIAS_CONTROL 0x0A
  28. #define WM8737_NOISE_GATE 0x0B
  29. #define WM8737_ALC1 0x0C
  30. #define WM8737_ALC2 0x0D
  31. #define WM8737_ALC3 0x0E
  32. #define WM8737_RESET 0x0F
  33. #define WM8737_REGISTER_COUNT 16
  34. #define WM8737_MAX_REGISTER 0x0F
  35. /*
  36. * Field Definitions.
  37. */
  38. /*
  39. * R0 (0x00) - Left PGA volume
  40. */
  41. #define WM8737_LVU 0x0100 /* LVU */
  42. #define WM8737_LVU_MASK 0x0100 /* LVU */
  43. #define WM8737_LVU_SHIFT 8 /* LVU */
  44. #define WM8737_LVU_WIDTH 1 /* LVU */
  45. #define WM8737_LINVOL_MASK 0x00FF /* LINVOL - [7:0] */
  46. #define WM8737_LINVOL_SHIFT 0 /* LINVOL - [7:0] */
  47. #define WM8737_LINVOL_WIDTH 8 /* LINVOL - [7:0] */
  48. /*
  49. * R1 (0x01) - Right PGA volume
  50. */
  51. #define WM8737_RVU 0x0100 /* RVU */
  52. #define WM8737_RVU_MASK 0x0100 /* RVU */
  53. #define WM8737_RVU_SHIFT 8 /* RVU */
  54. #define WM8737_RVU_WIDTH 1 /* RVU */
  55. #define WM8737_RINVOL_MASK 0x00FF /* RINVOL - [7:0] */
  56. #define WM8737_RINVOL_SHIFT 0 /* RINVOL - [7:0] */
  57. #define WM8737_RINVOL_WIDTH 8 /* RINVOL - [7:0] */
  58. /*
  59. * R2 (0x02) - AUDIO path L
  60. */
  61. #define WM8737_LINSEL_MASK 0x0180 /* LINSEL - [8:7] */
  62. #define WM8737_LINSEL_SHIFT 7 /* LINSEL - [8:7] */
  63. #define WM8737_LINSEL_WIDTH 2 /* LINSEL - [8:7] */
  64. #define WM8737_LMICBOOST_MASK 0x0060 /* LMICBOOST - [6:5] */
  65. #define WM8737_LMICBOOST_SHIFT 5 /* LMICBOOST - [6:5] */
  66. #define WM8737_LMICBOOST_WIDTH 2 /* LMICBOOST - [6:5] */
  67. #define WM8737_LMBE 0x0010 /* LMBE */
  68. #define WM8737_LMBE_MASK 0x0010 /* LMBE */
  69. #define WM8737_LMBE_SHIFT 4 /* LMBE */
  70. #define WM8737_LMBE_WIDTH 1 /* LMBE */
  71. #define WM8737_LMZC 0x0008 /* LMZC */
  72. #define WM8737_LMZC_MASK 0x0008 /* LMZC */
  73. #define WM8737_LMZC_SHIFT 3 /* LMZC */
  74. #define WM8737_LMZC_WIDTH 1 /* LMZC */
  75. #define WM8737_LPZC 0x0004 /* LPZC */
  76. #define WM8737_LPZC_MASK 0x0004 /* LPZC */
  77. #define WM8737_LPZC_SHIFT 2 /* LPZC */
  78. #define WM8737_LPZC_WIDTH 1 /* LPZC */
  79. #define WM8737_LZCTO_MASK 0x0003 /* LZCTO - [1:0] */
  80. #define WM8737_LZCTO_SHIFT 0 /* LZCTO - [1:0] */
  81. #define WM8737_LZCTO_WIDTH 2 /* LZCTO - [1:0] */
  82. /*
  83. * R3 (0x03) - AUDIO path R
  84. */
  85. #define WM8737_RINSEL_MASK 0x0180 /* RINSEL - [8:7] */
  86. #define WM8737_RINSEL_SHIFT 7 /* RINSEL - [8:7] */
  87. #define WM8737_RINSEL_WIDTH 2 /* RINSEL - [8:7] */
  88. #define WM8737_RMICBOOST_MASK 0x0060 /* RMICBOOST - [6:5] */
  89. #define WM8737_RMICBOOST_SHIFT 5 /* RMICBOOST - [6:5] */
  90. #define WM8737_RMICBOOST_WIDTH 2 /* RMICBOOST - [6:5] */
  91. #define WM8737_RMBE 0x0010 /* RMBE */
  92. #define WM8737_RMBE_MASK 0x0010 /* RMBE */
  93. #define WM8737_RMBE_SHIFT 4 /* RMBE */
  94. #define WM8737_RMBE_WIDTH 1 /* RMBE */
  95. #define WM8737_RMZC 0x0008 /* RMZC */
  96. #define WM8737_RMZC_MASK 0x0008 /* RMZC */
  97. #define WM8737_RMZC_SHIFT 3 /* RMZC */
  98. #define WM8737_RMZC_WIDTH 1 /* RMZC */
  99. #define WM8737_RPZC 0x0004 /* RPZC */
  100. #define WM8737_RPZC_MASK 0x0004 /* RPZC */
  101. #define WM8737_RPZC_SHIFT 2 /* RPZC */
  102. #define WM8737_RPZC_WIDTH 1 /* RPZC */
  103. #define WM8737_RZCTO_MASK 0x0003 /* RZCTO - [1:0] */
  104. #define WM8737_RZCTO_SHIFT 0 /* RZCTO - [1:0] */
  105. #define WM8737_RZCTO_WIDTH 2 /* RZCTO - [1:0] */
  106. /*
  107. * R4 (0x04) - 3D Enhance
  108. */
  109. #define WM8737_DIV2 0x0080 /* DIV2 */
  110. #define WM8737_DIV2_MASK 0x0080 /* DIV2 */
  111. #define WM8737_DIV2_SHIFT 7 /* DIV2 */
  112. #define WM8737_DIV2_WIDTH 1 /* DIV2 */
  113. #define WM8737_3DLC 0x0040 /* 3DLC */
  114. #define WM8737_3DLC_MASK 0x0040 /* 3DLC */
  115. #define WM8737_3DLC_SHIFT 6 /* 3DLC */
  116. #define WM8737_3DLC_WIDTH 1 /* 3DLC */
  117. #define WM8737_3DUC 0x0020 /* 3DUC */
  118. #define WM8737_3DUC_MASK 0x0020 /* 3DUC */
  119. #define WM8737_3DUC_SHIFT 5 /* 3DUC */
  120. #define WM8737_3DUC_WIDTH 1 /* 3DUC */
  121. #define WM8737_3DDEPTH_MASK 0x001E /* 3DDEPTH - [4:1] */
  122. #define WM8737_3DDEPTH_SHIFT 1 /* 3DDEPTH - [4:1] */
  123. #define WM8737_3DDEPTH_WIDTH 4 /* 3DDEPTH - [4:1] */
  124. #define WM8737_3DE 0x0001 /* 3DE */
  125. #define WM8737_3DE_MASK 0x0001 /* 3DE */
  126. #define WM8737_3DE_SHIFT 0 /* 3DE */
  127. #define WM8737_3DE_WIDTH 1 /* 3DE */
  128. /*
  129. * R5 (0x05) - ADC Control
  130. */
  131. #define WM8737_MONOMIX_MASK 0x0180 /* MONOMIX - [8:7] */
  132. #define WM8737_MONOMIX_SHIFT 7 /* MONOMIX - [8:7] */
  133. #define WM8737_MONOMIX_WIDTH 2 /* MONOMIX - [8:7] */
  134. #define WM8737_POLARITY_MASK 0x0060 /* POLARITY - [6:5] */
  135. #define WM8737_POLARITY_SHIFT 5 /* POLARITY - [6:5] */
  136. #define WM8737_POLARITY_WIDTH 2 /* POLARITY - [6:5] */
  137. #define WM8737_HPOR 0x0010 /* HPOR */
  138. #define WM8737_HPOR_MASK 0x0010 /* HPOR */
  139. #define WM8737_HPOR_SHIFT 4 /* HPOR */
  140. #define WM8737_HPOR_WIDTH 1 /* HPOR */
  141. #define WM8737_LP 0x0004 /* LP */
  142. #define WM8737_LP_MASK 0x0004 /* LP */
  143. #define WM8737_LP_SHIFT 2 /* LP */
  144. #define WM8737_LP_WIDTH 1 /* LP */
  145. #define WM8737_MONOUT 0x0002 /* MONOUT */
  146. #define WM8737_MONOUT_MASK 0x0002 /* MONOUT */
  147. #define WM8737_MONOUT_SHIFT 1 /* MONOUT */
  148. #define WM8737_MONOUT_WIDTH 1 /* MONOUT */
  149. #define WM8737_ADCHPD 0x0001 /* ADCHPD */
  150. #define WM8737_ADCHPD_MASK 0x0001 /* ADCHPD */
  151. #define WM8737_ADCHPD_SHIFT 0 /* ADCHPD */
  152. #define WM8737_ADCHPD_WIDTH 1 /* ADCHPD */
  153. /*
  154. * R6 (0x06) - Power Management
  155. */
  156. #define WM8737_VMID 0x0100 /* VMID */
  157. #define WM8737_VMID_MASK 0x0100 /* VMID */
  158. #define WM8737_VMID_SHIFT 8 /* VMID */
  159. #define WM8737_VMID_WIDTH 1 /* VMID */
  160. #define WM8737_VREF 0x0080 /* VREF */
  161. #define WM8737_VREF_MASK 0x0080 /* VREF */
  162. #define WM8737_VREF_SHIFT 7 /* VREF */
  163. #define WM8737_VREF_WIDTH 1 /* VREF */
  164. #define WM8737_AI 0x0040 /* AI */
  165. #define WM8737_AI_MASK 0x0040 /* AI */
  166. #define WM8737_AI_SHIFT 6 /* AI */
  167. #define WM8737_AI_WIDTH 1 /* AI */
  168. #define WM8737_PGL 0x0020 /* PGL */
  169. #define WM8737_PGL_MASK 0x0020 /* PGL */
  170. #define WM8737_PGL_SHIFT 5 /* PGL */
  171. #define WM8737_PGL_WIDTH 1 /* PGL */
  172. #define WM8737_PGR 0x0010 /* PGR */
  173. #define WM8737_PGR_MASK 0x0010 /* PGR */
  174. #define WM8737_PGR_SHIFT 4 /* PGR */
  175. #define WM8737_PGR_WIDTH 1 /* PGR */
  176. #define WM8737_ADL 0x0008 /* ADL */
  177. #define WM8737_ADL_MASK 0x0008 /* ADL */
  178. #define WM8737_ADL_SHIFT 3 /* ADL */
  179. #define WM8737_ADL_WIDTH 1 /* ADL */
  180. #define WM8737_ADR 0x0004 /* ADR */
  181. #define WM8737_ADR_MASK 0x0004 /* ADR */
  182. #define WM8737_ADR_SHIFT 2 /* ADR */
  183. #define WM8737_ADR_WIDTH 1 /* ADR */
  184. #define WM8737_MICBIAS_MASK 0x0003 /* MICBIAS - [1:0] */
  185. #define WM8737_MICBIAS_SHIFT 0 /* MICBIAS - [1:0] */
  186. #define WM8737_MICBIAS_WIDTH 2 /* MICBIAS - [1:0] */
  187. /*
  188. * R7 (0x07) - Audio Format
  189. */
  190. #define WM8737_SDODIS 0x0080 /* SDODIS */
  191. #define WM8737_SDODIS_MASK 0x0080 /* SDODIS */
  192. #define WM8737_SDODIS_SHIFT 7 /* SDODIS */
  193. #define WM8737_SDODIS_WIDTH 1 /* SDODIS */
  194. #define WM8737_MS 0x0040 /* MS */
  195. #define WM8737_MS_MASK 0x0040 /* MS */
  196. #define WM8737_MS_SHIFT 6 /* MS */
  197. #define WM8737_MS_WIDTH 1 /* MS */
  198. #define WM8737_LRP 0x0010 /* LRP */
  199. #define WM8737_LRP_MASK 0x0010 /* LRP */
  200. #define WM8737_LRP_SHIFT 4 /* LRP */
  201. #define WM8737_LRP_WIDTH 1 /* LRP */
  202. #define WM8737_WL_MASK 0x000C /* WL - [3:2] */
  203. #define WM8737_WL_SHIFT 2 /* WL - [3:2] */
  204. #define WM8737_WL_WIDTH 2 /* WL - [3:2] */
  205. #define WM8737_FORMAT_MASK 0x0003 /* FORMAT - [1:0] */
  206. #define WM8737_FORMAT_SHIFT 0 /* FORMAT - [1:0] */
  207. #define WM8737_FORMAT_WIDTH 2 /* FORMAT - [1:0] */
  208. /*
  209. * R8 (0x08) - Clocking
  210. */
  211. #define WM8737_AUTODETECT 0x0080 /* AUTODETECT */
  212. #define WM8737_AUTODETECT_MASK 0x0080 /* AUTODETECT */
  213. #define WM8737_AUTODETECT_SHIFT 7 /* AUTODETECT */
  214. #define WM8737_AUTODETECT_WIDTH 1 /* AUTODETECT */
  215. #define WM8737_CLKDIV2 0x0040 /* CLKDIV2 */
  216. #define WM8737_CLKDIV2_MASK 0x0040 /* CLKDIV2 */
  217. #define WM8737_CLKDIV2_SHIFT 6 /* CLKDIV2 */
  218. #define WM8737_CLKDIV2_WIDTH 1 /* CLKDIV2 */
  219. #define WM8737_SR_MASK 0x003E /* SR - [5:1] */
  220. #define WM8737_SR_SHIFT 1 /* SR - [5:1] */
  221. #define WM8737_SR_WIDTH 5 /* SR - [5:1] */
  222. #define WM8737_USB_MODE 0x0001 /* USB MODE */
  223. #define WM8737_USB_MODE_MASK 0x0001 /* USB MODE */
  224. #define WM8737_USB_MODE_SHIFT 0 /* USB MODE */
  225. #define WM8737_USB_MODE_WIDTH 1 /* USB MODE */
  226. /*
  227. * R9 (0x09) - MIC Preamp Control
  228. */
  229. #define WM8737_RBYPEN 0x0008 /* RBYPEN */
  230. #define WM8737_RBYPEN_MASK 0x0008 /* RBYPEN */
  231. #define WM8737_RBYPEN_SHIFT 3 /* RBYPEN */
  232. #define WM8737_RBYPEN_WIDTH 1 /* RBYPEN */
  233. #define WM8737_LBYPEN 0x0004 /* LBYPEN */
  234. #define WM8737_LBYPEN_MASK 0x0004 /* LBYPEN */
  235. #define WM8737_LBYPEN_SHIFT 2 /* LBYPEN */
  236. #define WM8737_LBYPEN_WIDTH 1 /* LBYPEN */
  237. #define WM8737_MBCTRL_MASK 0x0003 /* MBCTRL - [1:0] */
  238. #define WM8737_MBCTRL_SHIFT 0 /* MBCTRL - [1:0] */
  239. #define WM8737_MBCTRL_WIDTH 2 /* MBCTRL - [1:0] */
  240. /*
  241. * R10 (0x0A) - Misc Bias Control
  242. */
  243. #define WM8737_VMIDSEL_MASK 0x000C /* VMIDSEL - [3:2] */
  244. #define WM8737_VMIDSEL_SHIFT 2 /* VMIDSEL - [3:2] */
  245. #define WM8737_VMIDSEL_WIDTH 2 /* VMIDSEL - [3:2] */
  246. #define WM8737_LINPUT1_DC_BIAS_ENABLE 0x0002 /* LINPUT1 DC BIAS ENABLE */
  247. #define WM8737_LINPUT1_DC_BIAS_ENABLE_MASK 0x0002 /* LINPUT1 DC BIAS ENABLE */
  248. #define WM8737_LINPUT1_DC_BIAS_ENABLE_SHIFT 1 /* LINPUT1 DC BIAS ENABLE */
  249. #define WM8737_LINPUT1_DC_BIAS_ENABLE_WIDTH 1 /* LINPUT1 DC BIAS ENABLE */
  250. #define WM8737_RINPUT1_DC_BIAS_ENABLE 0x0001 /* RINPUT1 DC BIAS ENABLE */
  251. #define WM8737_RINPUT1_DC_BIAS_ENABLE_MASK 0x0001 /* RINPUT1 DC BIAS ENABLE */
  252. #define WM8737_RINPUT1_DC_BIAS_ENABLE_SHIFT 0 /* RINPUT1 DC BIAS ENABLE */
  253. #define WM8737_RINPUT1_DC_BIAS_ENABLE_WIDTH 1 /* RINPUT1 DC BIAS ENABLE */
  254. /*
  255. * R11 (0x0B) - Noise Gate
  256. */
  257. #define WM8737_NGTH_MASK 0x001C /* NGTH - [4:2] */
  258. #define WM8737_NGTH_SHIFT 2 /* NGTH - [4:2] */
  259. #define WM8737_NGTH_WIDTH 3 /* NGTH - [4:2] */
  260. #define WM8737_NGAT 0x0001 /* NGAT */
  261. #define WM8737_NGAT_MASK 0x0001 /* NGAT */
  262. #define WM8737_NGAT_SHIFT 0 /* NGAT */
  263. #define WM8737_NGAT_WIDTH 1 /* NGAT */
  264. /*
  265. * R12 (0x0C) - ALC1
  266. */
  267. #define WM8737_ALCSEL_MASK 0x0180 /* ALCSEL - [8:7] */
  268. #define WM8737_ALCSEL_SHIFT 7 /* ALCSEL - [8:7] */
  269. #define WM8737_ALCSEL_WIDTH 2 /* ALCSEL - [8:7] */
  270. #define WM8737_MAX_GAIN_MASK 0x0070 /* MAX GAIN - [6:4] */
  271. #define WM8737_MAX_GAIN_SHIFT 4 /* MAX GAIN - [6:4] */
  272. #define WM8737_MAX_GAIN_WIDTH 3 /* MAX GAIN - [6:4] */
  273. #define WM8737_ALCL_MASK 0x000F /* ALCL - [3:0] */
  274. #define WM8737_ALCL_SHIFT 0 /* ALCL - [3:0] */
  275. #define WM8737_ALCL_WIDTH 4 /* ALCL - [3:0] */
  276. /*
  277. * R13 (0x0D) - ALC2
  278. */
  279. #define WM8737_ALCZCE 0x0010 /* ALCZCE */
  280. #define WM8737_ALCZCE_MASK 0x0010 /* ALCZCE */
  281. #define WM8737_ALCZCE_SHIFT 4 /* ALCZCE */
  282. #define WM8737_ALCZCE_WIDTH 1 /* ALCZCE */
  283. #define WM8737_HLD_MASK 0x000F /* HLD - [3:0] */
  284. #define WM8737_HLD_SHIFT 0 /* HLD - [3:0] */
  285. #define WM8737_HLD_WIDTH 4 /* HLD - [3:0] */
  286. /*
  287. * R14 (0x0E) - ALC3
  288. */
  289. #define WM8737_DCY_MASK 0x00F0 /* DCY - [7:4] */
  290. #define WM8737_DCY_SHIFT 4 /* DCY - [7:4] */
  291. #define WM8737_DCY_WIDTH 4 /* DCY - [7:4] */
  292. #define WM8737_ATK_MASK 0x000F /* ATK - [3:0] */
  293. #define WM8737_ATK_SHIFT 0 /* ATK - [3:0] */
  294. #define WM8737_ATK_WIDTH 4 /* ATK - [3:0] */
  295. /*
  296. * R15 (0x0F) - Reset
  297. */
  298. #define WM8737_RESET_MASK 0x01FF /* RESET - [8:0] */
  299. #define WM8737_RESET_SHIFT 0 /* RESET - [8:0] */
  300. #define WM8737_RESET_WIDTH 9 /* RESET - [8:0] */
  301. #endif