wm8350-regmap.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. /*
  2. * wm8350-regmap.c -- Wolfson Microelectronics WM8350 register map
  3. *
  4. * This file splits out the tables describing the defaults and access
  5. * status of the WM8350 registers since they are rather large.
  6. *
  7. * Copyright 2007, 2008 Wolfson Microelectronics PLC.
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. */
  14. #include <linux/mfd/wm8350/core.h>
  15. /*
  16. * Access masks.
  17. */
  18. static const struct wm8350_reg_access {
  19. u16 readable; /* Mask of readable bits */
  20. u16 writable; /* Mask of writable bits */
  21. u16 vol; /* Mask of volatile bits */
  22. } wm8350_reg_io_map[] = {
  23. /* read write volatile */
  24. { 0xFFFF, 0xFFFF, 0x0000 }, /* R0 - Reset/ID */
  25. { 0x7CFF, 0x0C00, 0x0000 }, /* R1 - ID */
  26. { 0x007F, 0x0000, 0x0000 }, /* R2 - ROM Mask ID */
  27. { 0xBE3B, 0xBE3B, 0x8000 }, /* R3 - System Control 1 */
  28. { 0xFEF7, 0xFEF7, 0xF800 }, /* R4 - System Control 2 */
  29. { 0x80FF, 0x80FF, 0x8000 }, /* R5 - System Hibernate */
  30. { 0xFB0E, 0xFB0E, 0x0000 }, /* R6 - Interface Control */
  31. { 0x0000, 0x0000, 0x0000 }, /* R7 */
  32. { 0xE537, 0xE537, 0xFFFF }, /* R8 - Power mgmt (1) */
  33. { 0x0FF3, 0x0FF3, 0xFFFF }, /* R9 - Power mgmt (2) */
  34. { 0x008F, 0x008F, 0xFFFF }, /* R10 - Power mgmt (3) */
  35. { 0x6D3C, 0x6D3C, 0xFFFF }, /* R11 - Power mgmt (4) */
  36. { 0x1F8F, 0x1F8F, 0xFFFF }, /* R12 - Power mgmt (5) */
  37. { 0x8F3F, 0x8F3F, 0xFFFF }, /* R13 - Power mgmt (6) */
  38. { 0x0003, 0x0003, 0xFFFF }, /* R14 - Power mgmt (7) */
  39. { 0x0000, 0x0000, 0x0000 }, /* R15 */
  40. { 0x7F7F, 0x7F7F, 0xFFFF }, /* R16 - RTC Seconds/Minutes */
  41. { 0x073F, 0x073F, 0xFFFF }, /* R17 - RTC Hours/Day */
  42. { 0x1F3F, 0x1F3F, 0xFFFF }, /* R18 - RTC Date/Month */
  43. { 0x3FFF, 0x00FF, 0xFFFF }, /* R19 - RTC Year */
  44. { 0x7F7F, 0x7F7F, 0x0000 }, /* R20 - Alarm Seconds/Minutes */
  45. { 0x0F3F, 0x0F3F, 0x0000 }, /* R21 - Alarm Hours/Day */
  46. { 0x1F3F, 0x1F3F, 0x0000 }, /* R22 - Alarm Date/Month */
  47. { 0xEF7F, 0xEA7F, 0xFFFF }, /* R23 - RTC Time Control */
  48. { 0x3BFF, 0x0000, 0xFFFF }, /* R24 - System Interrupts */
  49. { 0xFEE7, 0x0000, 0xFFFF }, /* R25 - Interrupt Status 1 */
  50. { 0x35FF, 0x0000, 0xFFFF }, /* R26 - Interrupt Status 2 */
  51. { 0x0F3F, 0x0000, 0xFFFF }, /* R27 - Power Up Interrupt Status */
  52. { 0x0F3F, 0x0000, 0xFFFF }, /* R28 - Under Voltage Interrupt status */
  53. { 0x8000, 0x0000, 0xFFFF }, /* R29 - Over Current Interrupt status */
  54. { 0x1FFF, 0x0000, 0xFFFF }, /* R30 - GPIO Interrupt Status */
  55. { 0xEF7F, 0x0000, 0xFFFF }, /* R31 - Comparator Interrupt Status */
  56. { 0x3FFF, 0x3FFF, 0x0000 }, /* R32 - System Interrupts Mask */
  57. { 0xFEE7, 0xFEE7, 0x0000 }, /* R33 - Interrupt Status 1 Mask */
  58. { 0xF5FF, 0xF5FF, 0x0000 }, /* R34 - Interrupt Status 2 Mask */
  59. { 0x0F3F, 0x0F3F, 0x0000 }, /* R35 - Power Up Interrupt Status Mask */
  60. { 0x0F3F, 0x0F3F, 0x0000 }, /* R36 - Under Voltage Int status Mask */
  61. { 0x8000, 0x8000, 0x0000 }, /* R37 - Over Current Int status Mask */
  62. { 0x1FFF, 0x1FFF, 0x0000 }, /* R38 - GPIO Interrupt Status Mask */
  63. { 0xEF7F, 0xEF7F, 0x0000 }, /* R39 - Comparator IntStatus Mask */
  64. { 0xC9F7, 0xC9F7, 0xFFFF }, /* R40 - Clock Control 1 */
  65. { 0x8001, 0x8001, 0x0000 }, /* R41 - Clock Control 2 */
  66. { 0xFFF7, 0xFFF7, 0xFFFF }, /* R42 - FLL Control 1 */
  67. { 0xFBFF, 0xFBFF, 0x0000 }, /* R43 - FLL Control 2 */
  68. { 0xFFFF, 0xFFFF, 0x0000 }, /* R44 - FLL Control 3 */
  69. { 0x0033, 0x0033, 0x0000 }, /* R45 - FLL Control 4 */
  70. { 0x0000, 0x0000, 0x0000 }, /* R46 */
  71. { 0x0000, 0x0000, 0x0000 }, /* R47 */
  72. { 0x3033, 0x3033, 0x0000 }, /* R48 - DAC Control */
  73. { 0x0000, 0x0000, 0x0000 }, /* R49 */
  74. { 0x81FF, 0x81FF, 0xFFFF }, /* R50 - DAC Digital Volume L */
  75. { 0x81FF, 0x81FF, 0xFFFF }, /* R51 - DAC Digital Volume R */
  76. { 0x0000, 0x0000, 0x0000 }, /* R52 */
  77. { 0x0FFF, 0x0FFF, 0xFFFF }, /* R53 - DAC LR Rate */
  78. { 0x0017, 0x0017, 0x0000 }, /* R54 - DAC Clock Control */
  79. { 0x0000, 0x0000, 0x0000 }, /* R55 */
  80. { 0x0000, 0x0000, 0x0000 }, /* R56 */
  81. { 0x0000, 0x0000, 0x0000 }, /* R57 */
  82. { 0x4000, 0x4000, 0x0000 }, /* R58 - DAC Mute */
  83. { 0x7000, 0x7000, 0x0000 }, /* R59 - DAC Mute Volume */
  84. { 0x3C00, 0x3C00, 0x0000 }, /* R60 - DAC Side */
  85. { 0x0000, 0x0000, 0x0000 }, /* R61 */
  86. { 0x0000, 0x0000, 0x0000 }, /* R62 */
  87. { 0x0000, 0x0000, 0x0000 }, /* R63 */
  88. { 0x8303, 0x8303, 0xFFFF }, /* R64 - ADC Control */
  89. { 0x0000, 0x0000, 0x0000 }, /* R65 */
  90. { 0x81FF, 0x81FF, 0xFFFF }, /* R66 - ADC Digital Volume L */
  91. { 0x81FF, 0x81FF, 0xFFFF }, /* R67 - ADC Digital Volume R */
  92. { 0x0FFF, 0x0FFF, 0x0000 }, /* R68 - ADC Divider */
  93. { 0x0000, 0x0000, 0x0000 }, /* R69 */
  94. { 0x0FFF, 0x0FFF, 0xFFFF }, /* R70 - ADC LR Rate */
  95. { 0x0000, 0x0000, 0x0000 }, /* R71 */
  96. { 0x0707, 0x0707, 0xFFFF }, /* R72 - Input Control */
  97. { 0xC0C0, 0xC0C0, 0xFFFF }, /* R73 - IN3 Input Control */
  98. { 0xC09F, 0xC09F, 0xFFFF }, /* R74 - Mic Bias Control */
  99. { 0x0000, 0x0000, 0x0000 }, /* R75 */
  100. { 0x0F15, 0x0F15, 0xFFFF }, /* R76 - Output Control */
  101. { 0xC000, 0xC000, 0xFFFF }, /* R77 - Jack Detect */
  102. { 0x03FF, 0x03FF, 0x0000 }, /* R78 - Anti Pop Control */
  103. { 0x0000, 0x0000, 0x0000 }, /* R79 */
  104. { 0xE1FC, 0xE1FC, 0x8000 }, /* R80 - Left Input Volume */
  105. { 0xE1FC, 0xE1FC, 0x8000 }, /* R81 - Right Input Volume */
  106. { 0x0000, 0x0000, 0x0000 }, /* R82 */
  107. { 0x0000, 0x0000, 0x0000 }, /* R83 */
  108. { 0x0000, 0x0000, 0x0000 }, /* R84 */
  109. { 0x0000, 0x0000, 0x0000 }, /* R85 */
  110. { 0x0000, 0x0000, 0x0000 }, /* R86 */
  111. { 0x0000, 0x0000, 0x0000 }, /* R87 */
  112. { 0x9807, 0x9807, 0xFFFF }, /* R88 - Left Mixer Control */
  113. { 0x980B, 0x980B, 0xFFFF }, /* R89 - Right Mixer Control */
  114. { 0x0000, 0x0000, 0x0000 }, /* R90 */
  115. { 0x0000, 0x0000, 0x0000 }, /* R91 */
  116. { 0x8909, 0x8909, 0xFFFF }, /* R92 - OUT3 Mixer Control */
  117. { 0x9E07, 0x9E07, 0xFFFF }, /* R93 - OUT4 Mixer Control */
  118. { 0x0000, 0x0000, 0x0000 }, /* R94 */
  119. { 0x0000, 0x0000, 0x0000 }, /* R95 */
  120. { 0x0EEE, 0x0EEE, 0x0000 }, /* R96 - Output Left Mixer Volume */
  121. { 0xE0EE, 0xE0EE, 0x0000 }, /* R97 - Output Right Mixer Volume */
  122. { 0x0E0F, 0x0E0F, 0x0000 }, /* R98 - Input Mixer Volume L */
  123. { 0xE0E1, 0xE0E1, 0x0000 }, /* R99 - Input Mixer Volume R */
  124. { 0x800E, 0x800E, 0x0000 }, /* R100 - Input Mixer Volume */
  125. { 0x0000, 0x0000, 0x0000 }, /* R101 */
  126. { 0x0000, 0x0000, 0x0000 }, /* R102 */
  127. { 0x0000, 0x0000, 0x0000 }, /* R103 */
  128. { 0xE1FC, 0xE1FC, 0xFFFF }, /* R104 - LOUT1 Volume */
  129. { 0xE1FC, 0xE1FC, 0xFFFF }, /* R105 - ROUT1 Volume */
  130. { 0xE1FC, 0xE1FC, 0xFFFF }, /* R106 - LOUT2 Volume */
  131. { 0xE7FC, 0xE7FC, 0xFFFF }, /* R107 - ROUT2 Volume */
  132. { 0x0000, 0x0000, 0x0000 }, /* R108 */
  133. { 0x0000, 0x0000, 0x0000 }, /* R109 */
  134. { 0x0000, 0x0000, 0x0000 }, /* R110 */
  135. { 0x80E0, 0x80E0, 0xFFFF }, /* R111 - BEEP Volume */
  136. { 0xBF00, 0xBF00, 0x0000 }, /* R112 - AI Formating */
  137. { 0x00F1, 0x00F1, 0x0000 }, /* R113 - ADC DAC COMP */
  138. { 0x00F8, 0x00F8, 0x0000 }, /* R114 - AI ADC Control */
  139. { 0x40FB, 0x40FB, 0x0000 }, /* R115 - AI DAC Control */
  140. { 0x7C30, 0x7C30, 0x0000 }, /* R116 - AIF Test */
  141. { 0x0000, 0x0000, 0x0000 }, /* R117 */
  142. { 0x0000, 0x0000, 0x0000 }, /* R118 */
  143. { 0x0000, 0x0000, 0x0000 }, /* R119 */
  144. { 0x0000, 0x0000, 0x0000 }, /* R120 */
  145. { 0x0000, 0x0000, 0x0000 }, /* R121 */
  146. { 0x0000, 0x0000, 0x0000 }, /* R122 */
  147. { 0x0000, 0x0000, 0x0000 }, /* R123 */
  148. { 0x0000, 0x0000, 0x0000 }, /* R124 */
  149. { 0x0000, 0x0000, 0x0000 }, /* R125 */
  150. { 0x0000, 0x0000, 0x0000 }, /* R126 */
  151. { 0x0000, 0x0000, 0x0000 }, /* R127 */
  152. { 0x1FFF, 0x1FFF, 0x0000 }, /* R128 - GPIO Debounce */
  153. { 0x1FFF, 0x1FFF, 0x0000 }, /* R129 - GPIO Pin pull up Control */
  154. { 0x1FFF, 0x1FFF, 0x0000 }, /* R130 - GPIO Pull down Control */
  155. { 0x1FFF, 0x1FFF, 0x0000 }, /* R131 - GPIO Interrupt Mode */
  156. { 0x0000, 0x0000, 0x0000 }, /* R132 */
  157. { 0x00C0, 0x00C0, 0x0000 }, /* R133 - GPIO Control */
  158. { 0x1FFF, 0x1FFF, 0x0000 }, /* R134 - GPIO Configuration (i/o) */
  159. { 0x1FFF, 0x1FFF, 0x0000 }, /* R135 - GPIO Pin Polarity / Type */
  160. { 0x0000, 0x0000, 0x0000 }, /* R136 */
  161. { 0x0000, 0x0000, 0x0000 }, /* R137 */
  162. { 0x0000, 0x0000, 0x0000 }, /* R138 */
  163. { 0x0000, 0x0000, 0x0000 }, /* R139 */
  164. { 0xFFFF, 0xFFFF, 0x0000 }, /* R140 - GPIO Function Select 1 */
  165. { 0xFFFF, 0xFFFF, 0x0000 }, /* R141 - GPIO Function Select 2 */
  166. { 0xFFFF, 0xFFFF, 0x0000 }, /* R142 - GPIO Function Select 3 */
  167. { 0x000F, 0x000F, 0x0000 }, /* R143 - GPIO Function Select 4 */
  168. { 0xF0FF, 0xF0FF, 0xA000 }, /* R144 - Digitiser Control (1) */
  169. { 0x3707, 0x3707, 0x0000 }, /* R145 - Digitiser Control (2) */
  170. { 0x0000, 0x0000, 0x0000 }, /* R146 */
  171. { 0x0000, 0x0000, 0x0000 }, /* R147 */
  172. { 0x0000, 0x0000, 0x0000 }, /* R148 */
  173. { 0x0000, 0x0000, 0x0000 }, /* R149 */
  174. { 0x0000, 0x0000, 0x0000 }, /* R150 */
  175. { 0x0000, 0x0000, 0x0000 }, /* R151 */
  176. { 0x7FFF, 0x7000, 0xFFFF }, /* R152 - AUX1 Readback */
  177. { 0x7FFF, 0x7000, 0xFFFF }, /* R153 - AUX2 Readback */
  178. { 0x7FFF, 0x7000, 0xFFFF }, /* R154 - AUX3 Readback */
  179. { 0x7FFF, 0x7000, 0xFFFF }, /* R155 - AUX4 Readback */
  180. { 0x0FFF, 0x0000, 0xFFFF }, /* R156 - USB Voltage Readback */
  181. { 0x0FFF, 0x0000, 0xFFFF }, /* R157 - LINE Voltage Readback */
  182. { 0x0FFF, 0x0000, 0xFFFF }, /* R158 - BATT Voltage Readback */
  183. { 0x0FFF, 0x0000, 0xFFFF }, /* R159 - Chip Temp Readback */
  184. { 0x0000, 0x0000, 0x0000 }, /* R160 */
  185. { 0x0000, 0x0000, 0x0000 }, /* R161 */
  186. { 0x0000, 0x0000, 0x0000 }, /* R162 */
  187. { 0x000F, 0x000F, 0x0000 }, /* R163 - Generic Comparator Control */
  188. { 0xFFFF, 0xFFFF, 0x0000 }, /* R164 - Generic comparator 1 */
  189. { 0xFFFF, 0xFFFF, 0x0000 }, /* R165 - Generic comparator 2 */
  190. { 0xFFFF, 0xFFFF, 0x0000 }, /* R166 - Generic comparator 3 */
  191. { 0xFFFF, 0xFFFF, 0x0000 }, /* R167 - Generic comparator 4 */
  192. { 0xBFFF, 0xBFFF, 0x8000 }, /* R168 - Battery Charger Control 1 */
  193. { 0xFFFF, 0x4FFF, 0xB000 }, /* R169 - Battery Charger Control 2 */
  194. { 0x007F, 0x007F, 0x0000 }, /* R170 - Battery Charger Control 3 */
  195. { 0x0000, 0x0000, 0x0000 }, /* R171 */
  196. { 0x903F, 0x903F, 0xFFFF }, /* R172 - Current Sink Driver A */
  197. { 0xE333, 0xE333, 0xFFFF }, /* R173 - CSA Flash control */
  198. { 0x903F, 0x903F, 0xFFFF }, /* R174 - Current Sink Driver B */
  199. { 0xE333, 0xE333, 0xFFFF }, /* R175 - CSB Flash control */
  200. { 0x8F3F, 0x8F3F, 0xFFFF }, /* R176 - DCDC/LDO requested */
  201. { 0x332D, 0x332D, 0x0000 }, /* R177 - DCDC Active options */
  202. { 0x002D, 0x002D, 0x0000 }, /* R178 - DCDC Sleep options */
  203. { 0x5177, 0x5177, 0x8000 }, /* R179 - Power-check comparator */
  204. { 0x047F, 0x047F, 0x0000 }, /* R180 - DCDC1 Control */
  205. { 0xFFC0, 0xFFC0, 0x0000 }, /* R181 - DCDC1 Timeouts */
  206. { 0x737F, 0x737F, 0x0000 }, /* R182 - DCDC1 Low Power */
  207. { 0x535B, 0x535B, 0x0000 }, /* R183 - DCDC2 Control */
  208. { 0xFFC0, 0xFFC0, 0x0000 }, /* R184 - DCDC2 Timeouts */
  209. { 0x0000, 0x0000, 0x0000 }, /* R185 */
  210. { 0x047F, 0x047F, 0x0000 }, /* R186 - DCDC3 Control */
  211. { 0xFFC0, 0xFFC0, 0x0000 }, /* R187 - DCDC3 Timeouts */
  212. { 0x737F, 0x737F, 0x0000 }, /* R188 - DCDC3 Low Power */
  213. { 0x047F, 0x047F, 0x0000 }, /* R189 - DCDC4 Control */
  214. { 0xFFC0, 0xFFC0, 0x0000 }, /* R190 - DCDC4 Timeouts */
  215. { 0x737F, 0x737F, 0x0000 }, /* R191 - DCDC4 Low Power */
  216. { 0x535B, 0x535B, 0x0000 }, /* R192 - DCDC5 Control */
  217. { 0xFFC0, 0xFFC0, 0x0000 }, /* R193 - DCDC5 Timeouts */
  218. { 0x0000, 0x0000, 0x0000 }, /* R194 */
  219. { 0x047F, 0x047F, 0x0000 }, /* R195 - DCDC6 Control */
  220. { 0xFFC0, 0xFFC0, 0x0000 }, /* R196 - DCDC6 Timeouts */
  221. { 0x737F, 0x737F, 0x0000 }, /* R197 - DCDC6 Low Power */
  222. { 0x0000, 0x0000, 0x0000 }, /* R198 */
  223. { 0xFFD3, 0xFFD3, 0x0000 }, /* R199 - Limit Switch Control */
  224. { 0x441F, 0x441F, 0x0000 }, /* R200 - LDO1 Control */
  225. { 0xFFC0, 0xFFC0, 0x0000 }, /* R201 - LDO1 Timeouts */
  226. { 0x331F, 0x331F, 0x0000 }, /* R202 - LDO1 Low Power */
  227. { 0x441F, 0x441F, 0x0000 }, /* R203 - LDO2 Control */
  228. { 0xFFC0, 0xFFC0, 0x0000 }, /* R204 - LDO2 Timeouts */
  229. { 0x331F, 0x331F, 0x0000 }, /* R205 - LDO2 Low Power */
  230. { 0x441F, 0x441F, 0x0000 }, /* R206 - LDO3 Control */
  231. { 0xFFC0, 0xFFC0, 0x0000 }, /* R207 - LDO3 Timeouts */
  232. { 0x331F, 0x331F, 0x0000 }, /* R208 - LDO3 Low Power */
  233. { 0x441F, 0x441F, 0x0000 }, /* R209 - LDO4 Control */
  234. { 0xFFC0, 0xFFC0, 0x0000 }, /* R210 - LDO4 Timeouts */
  235. { 0x331F, 0x331F, 0x0000 }, /* R211 - LDO4 Low Power */
  236. { 0x0000, 0x0000, 0x0000 }, /* R212 */
  237. { 0x0000, 0x0000, 0x0000 }, /* R213 */
  238. { 0x0000, 0x0000, 0x0000 }, /* R214 */
  239. { 0x8F3F, 0x8F3F, 0x0000 }, /* R215 - VCC_FAULT Masks */
  240. { 0xFF3F, 0xE03F, 0x0000 }, /* R216 - Main Bandgap Control */
  241. { 0xEF2F, 0xE02F, 0x0000 }, /* R217 - OSC Control */
  242. { 0xF3FF, 0xB3FF, 0xc000 }, /* R218 - RTC Tick Control */
  243. { 0xFFFF, 0xFFFF, 0x0000 }, /* R219 - Security */
  244. { 0x09FF, 0x01FF, 0x0000 }, /* R220 - RAM BIST 1 */
  245. { 0x0000, 0x0000, 0x0000 }, /* R221 */
  246. { 0xFFFF, 0xFFFF, 0xFFFF }, /* R222 */
  247. { 0xFFFF, 0xFFFF, 0xFFFF }, /* R223 */
  248. { 0x0000, 0x0000, 0x0000 }, /* R224 */
  249. { 0x8F3F, 0x0000, 0xFFFF }, /* R225 - DCDC/LDO status */
  250. { 0x0000, 0x0000, 0xFFFF }, /* R226 - Charger status */
  251. { 0x34FE, 0x0000, 0xFFFF }, /* R227 */
  252. { 0x0000, 0x0000, 0x0000 }, /* R228 */
  253. { 0x0000, 0x0000, 0x0000 }, /* R229 */
  254. { 0xFFFF, 0x1FFF, 0xFFFF }, /* R230 - GPIO Pin Status */
  255. { 0xFFFF, 0x1FFF, 0xFFFF }, /* R231 */
  256. { 0xFFFF, 0x1FFF, 0xFFFF }, /* R232 */
  257. { 0xFFFF, 0x1FFF, 0xFFFF }, /* R233 */
  258. { 0x0000, 0x0000, 0x0000 }, /* R234 */
  259. { 0x0000, 0x0000, 0x0000 }, /* R235 */
  260. { 0x0000, 0x0000, 0x0000 }, /* R236 */
  261. { 0x0000, 0x0000, 0x0000 }, /* R237 */
  262. { 0x0000, 0x0000, 0x0000 }, /* R238 */
  263. { 0x0000, 0x0000, 0x0000 }, /* R239 */
  264. { 0x0000, 0x0000, 0x0000 }, /* R240 */
  265. { 0x0000, 0x0000, 0x0000 }, /* R241 */
  266. { 0x0000, 0x0000, 0x0000 }, /* R242 */
  267. { 0x0000, 0x0000, 0x0000 }, /* R243 */
  268. { 0x0000, 0x0000, 0x0000 }, /* R244 */
  269. { 0x0000, 0x0000, 0x0000 }, /* R245 */
  270. { 0x0000, 0x0000, 0x0000 }, /* R246 */
  271. { 0x0000, 0x0000, 0x0000 }, /* R247 */
  272. { 0xFFFF, 0x0010, 0xFFFF }, /* R248 */
  273. { 0x0000, 0x0000, 0x0000 }, /* R249 */
  274. { 0xFFFF, 0x0010, 0xFFFF }, /* R250 */
  275. { 0xFFFF, 0x0010, 0xFFFF }, /* R251 */
  276. { 0x0000, 0x0000, 0x0000 }, /* R252 */
  277. { 0xFFFF, 0x0010, 0xFFFF }, /* R253 */
  278. { 0x0000, 0x0000, 0x0000 }, /* R254 */
  279. { 0x0000, 0x0000, 0x0000 }, /* R255 */
  280. };
  281. static bool wm8350_readable(struct device *dev, unsigned int reg)
  282. {
  283. return wm8350_reg_io_map[reg].readable;
  284. }
  285. static bool wm8350_writeable(struct device *dev, unsigned int reg)
  286. {
  287. struct wm8350 *wm8350 = dev_get_drvdata(dev);
  288. if (!wm8350->unlocked) {
  289. if ((reg >= WM8350_GPIO_FUNCTION_SELECT_1 &&
  290. reg <= WM8350_GPIO_FUNCTION_SELECT_4) ||
  291. (reg >= WM8350_BATTERY_CHARGER_CONTROL_1 &&
  292. reg <= WM8350_BATTERY_CHARGER_CONTROL_3))
  293. return false;
  294. }
  295. return wm8350_reg_io_map[reg].writable;
  296. }
  297. static bool wm8350_volatile(struct device *dev, unsigned int reg)
  298. {
  299. return wm8350_reg_io_map[reg].vol;
  300. }
  301. static bool wm8350_precious(struct device *dev, unsigned int reg)
  302. {
  303. switch (reg) {
  304. case WM8350_SYSTEM_INTERRUPTS:
  305. case WM8350_INT_STATUS_1:
  306. case WM8350_INT_STATUS_2:
  307. case WM8350_POWER_UP_INT_STATUS:
  308. case WM8350_UNDER_VOLTAGE_INT_STATUS:
  309. case WM8350_OVER_CURRENT_INT_STATUS:
  310. case WM8350_GPIO_INT_STATUS:
  311. case WM8350_COMPARATOR_INT_STATUS:
  312. return true;
  313. default:
  314. return false;
  315. }
  316. }
  317. const struct regmap_config wm8350_regmap = {
  318. .reg_bits = 8,
  319. .val_bits = 16,
  320. .cache_type = REGCACHE_RBTREE,
  321. .max_register = WM8350_MAX_REGISTER,
  322. .readable_reg = wm8350_readable,
  323. .writeable_reg = wm8350_writeable,
  324. .volatile_reg = wm8350_volatile,
  325. .precious_reg = wm8350_precious,
  326. };