max98505.h 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  1. /*
  2. * max98505.h -- MAX98505 ALSA SoC Audio driver
  3. *
  4. * Copyright 2011-2012 Maxim Integrated Products
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef _MAX98505_H
  11. #define _MAX98505_H
  12. //#include <linux/version.h>
  13. /* One can override the Linux version here with an explicit version number */
  14. /* #define MAX98505_LINUX_VERSION LINUX_VERSION_CODE */
  15. /* #define MAX98505_LINUX_VERSION KERNEL_VERSION(3,4,0) */
  16. /* Maximum number of MAX98505 devices in the system this driver can support */
  17. #define MAX_NUM_MAX98505 2
  18. #define MAX98505_VERSION 0x51
  19. #define MAX98505_VERSION1 0x80
  20. #define MAX98505_VERSION2 0x8A
  21. #define RIVER
  22. /*
  23. * Driver revision
  24. */
  25. #define MAX98505_REVISION "0.00.0320"
  26. /*
  27. * MAX98505 Register Definitions
  28. */
  29. //#define MAX98505_WATCHDOG_ENABLE
  30. #define MAX98505_R000_VBAT_DATA 0x00
  31. #define MAX98505_R001_VBST_DATA 0x01
  32. #define MAX98505_R002_LIVE_STATUS0 0x02
  33. #define MAX98505_R003_LIVE_STATUS1 0x03
  34. #define MAX98505_R004_LIVE_STATUS2 0x04
  35. #define MAX98505_R005_STATE0 0x05
  36. #define MAX98505_R006_STATE1 0x06
  37. #define MAX98505_R007_STATE2 0x07
  38. #define MAX98505_R008_FLAG0 0x08
  39. #define MAX98505_R009_FLAG1 0x09
  40. #define MAX98505_R00A_FLAG2 0x0A
  41. #define MAX98505_R00B_IRQ_ENABLE0 0x0B
  42. #define MAX98505_R00C_IRQ_ENABLE1 0x0C
  43. #define MAX98505_R00D_IRQ_ENABLE2 0x0D
  44. #define MAX98505_R00E_IRQ_CLEAR0 0x0E
  45. #define MAX98505_R00F_IRQ_CLEAR1 0x0F
  46. #define MAX98505_R010_IRQ_CLEAR2 0x10
  47. #define MAX98505_R011_MAP0 0x11
  48. #define MAX98505_R012_MAP1 0x12
  49. #define MAX98505_R013_MAP2 0x13
  50. #define MAX98505_R014_MAP3 0x14
  51. #define MAX98505_R015_MAP4 0x15
  52. #define MAX98505_R016_MAP5 0x16
  53. #define MAX98505_R017_MAP6 0x17
  54. #define MAX98505_R018_MAP7 0x18
  55. #define MAX98505_R019_MAP8 0x19
  56. #define MAX98505_R01A_DAI_CLK_MODE1 0x1A
  57. #define MAX98505_R01B_DAI_CLK_MODE2 0x1B
  58. #define MAX98505_R01C_DAI_CLK_DIV_M_MSBS 0x1C
  59. #define MAX98505_R01D_DAI_CLK_DIV_M_LSBS 0x1D
  60. #define MAX98505_R01E_DAI_CLK_DIV_N_MSBS 0x1E
  61. #define MAX98505_R01F_DAI_CLK_DIV_N_LSBS 0x1F
  62. #define MAX98505_R020_FORMAT 0x20
  63. #define MAX98505_R021_TDM_SLOT_SELECT 0x21
  64. #define MAX98505_R022_DOUT_CFG_VMON 0x22
  65. #define MAX98505_R023_DOUT_CFG_IMON 0x23
  66. #define MAX98505_R024_DOUT_CFG_VBAT 0x24
  67. #define MAX98505_R025_DOUT_CFG_VBST 0x25
  68. #define MAX98505_R026_DOUT_CFG_FLAG 0x26
  69. #define MAX98505_R027_DOUT_HIZ_CFG1 0x27
  70. #define MAX98505_R028_DOUT_HIZ_CFG2 0x28
  71. #define MAX98505_R029_DOUT_HIZ_CFG3 0x29
  72. #define MAX98505_R02A_DOUT_HIZ_CFG4 0x2A
  73. #define MAX98505_R02B_DOUT_DRV_STRENGTH 0x2B
  74. #define MAX98505_R02C_FILTERS 0x2C
  75. #define MAX98505_R02D_GAIN 0x2D
  76. #define MAX98505_R02E_GAIN_RAMPING 0x2E
  77. #define MAX98505_R02F_SPK_AMP 0x2F
  78. #define MAX98505_R030_THRESHOLD 0x30
  79. #define MAX98505_R031_ALC_ATTACK 0x31
  80. #define MAX98505_R032_ALC_ATTEN_RLS 0x32
  81. #define MAX98505_R033_ALC_HOLD_RLS 0x33
  82. #define MAX98505_R034_ALC_CONFIGURATION 0x34
  83. #define MAX98505_R035_BOOST_CONVERTER 0x35
  84. #define MAX98505_R036_BLOCK_ENABLE 0x36
  85. #define MAX98505_R037_CONFIGURATION 0x37
  86. #define MAX98505_R038_GLOBAL_ENABLE 0x38
  87. #define MAX98505_R03A_BOOST_LIMITER 0x3A
  88. #define MAX98505_R0FF_VERSION 0xFF
  89. #define MAX98505_REG_CNT (MAX98505_R03A_BOOST_LIMITER+1)
  90. /* MAX98505 Register Bit Fields */
  91. /* MAX98505_R002_LIVE_STATUS0 */
  92. #define M98505_THERMWARN_STATUS_MASK (1<<3)
  93. #define M98505_THERMWARN_STATUS_SHIFT 3
  94. #define M98505_THERMWARN_STATUS_WIDTH 1
  95. #define M98505_THERMSHDN_STATUS_MASK (1<<1)
  96. #define M98505_THERMSHDN_STATUS_SHIFT 1
  97. #define M98505_THERMSHDN_STATUS_WIDTH 1
  98. /* MAX98505_R003_LIVE_STATUS1 */
  99. #define M98505_SPKCURNT_STATUS_MASK (1<<5)
  100. #define M98505_SPKCURNT_STATUS_SHIFT 5
  101. #define M98505_SPKCURNT_STATUS_WIDTH 1
  102. #define M98505_WATCHFAIL_STATUS_MASK (1<<4)
  103. #define M98505_WATCHFAIL_STATUS_SHIFT 4
  104. #define M98505_WATCHFAIL_STATUS_WIDTH 1
  105. #define M98505_ALCINFH_STATUS_MASK (1<<3)
  106. #define M98505_ALCINFH_STATUS_SHIFT 3
  107. #define M98505_ALCINFH_STATUS_WIDTH 1
  108. #define M98505_ALCACT_STATUS_MASK (1<<2)
  109. #define M98505_ALCACT_STATUS_SHIFT 2
  110. #define M98505_ALCACT_STATUS_WIDTH 1
  111. #define M98505_ALCMUT_STATUS_MASK (1<<1)
  112. #define M98505_ALCMUT_STATUS_SHIFT 1
  113. #define M98505_ALCMUT_STATUS_WIDTH 1
  114. #define M98505_ACLP_STATUS_MASK (1<<0)
  115. #define M98505_ACLP_STATUS_SHIFT 0
  116. #define M98505_ACLP_STATUS_WIDTH 1
  117. /* MAX98505_R004_LIVE_STATUS2 */
  118. #define M98505_SLOTOVRN_STATUS_MASK (1<<6)
  119. #define M98505_SLOTOVRN_STATUS_SHIFT 6
  120. #define M98505_SLOTOVRN_STATUS_WIDTH 1
  121. #define M98505_INVALSLOT_STATUS_MASK (1<<5)
  122. #define M98505_INVALSLOT_STATUS_SHIFT 5
  123. #define M98505_INVALSLOT_STATUS_WIDTH 1
  124. #define M98505_SLOTCNFLT_STATUS_MASK (1<<4)
  125. #define M98505_SLOTCNFLT_STATUS_SHIFT 4
  126. #define M98505_SLOTCNFLT_STATUS_WIDTH 1
  127. #define M98505_VBSTOVFL_STATUS_MASK (1<<3)
  128. #define M98505_VBSTOVFL_STATUS_SHIFT 3
  129. #define M98505_VBSTOVFL_STATUS_WIDTH 1
  130. #define M98505_VBATOVFL_STATUS_MASK (1<<2)
  131. #define M98505_VBATOVFL_STATUS_SHIFT 2
  132. #define M98505_VBATOVFL_STATUS_WIDTH 1
  133. #define M98505_IMONOVFL_STATUS_MASK (1<<1)
  134. #define M98505_IMONOVFL_STATUS_SHIFT 1
  135. #define M98505_IMONOVFL_STATUS_WIDTH 1
  136. #define M98505_VMONOVFL_STATUS_MASK (1<<0)
  137. #define M98505_VMONOVFL_STATUS_SHIFT 0
  138. #define M98505_VMONOVFL_STATUS_WIDTH 1
  139. /* MAX98505_R005_STATE0 */
  140. #define M98505_THERMWARN_END_STATE_MASK (1<<3)
  141. #define M98505_THERMWARN_END_STATE_SHIFT 3
  142. #define M98505_THERMWARN_END_STATE_WIDTH 1
  143. #define M98505_THERMWARN_BGN_STATE_MASK (1<<2)
  144. #define M98505_THERMWARN_BGN_STATE_SHIFT 1
  145. #define M98505_THERMWARN_BGN_STATE_WIDTH 1
  146. #define M98505_THERMSHDN_END_STATE_MASK (1<<1)
  147. #define M98505_THERMSHDN_END_STATE_SHIFT 1
  148. #define M98505_THERMSHDN_END_STATE_WIDTH 1
  149. #define M98505_THERMSHDN_BGN_STATE_MASK (1<<0)
  150. #define M98505_THERMSHDN_BGN_STATE_SHIFT 0
  151. #define M98505_THERMSHDN_BGN_STATE_WIDTH 1
  152. /* MAX98505_R006_STATE1 */
  153. #define M98505_SPRCURNT_STATE_MASK (1<<5)
  154. #define M98505_SPRCURNT_STATE_SHIFT 5
  155. #define M98505_SPRCURNT_STATE_WIDTH 1
  156. #define M98505_WATCHFAIL_STATE_MASK (1<<4)
  157. #define M98505_WATCHFAIL_STATE_SHIFT 4
  158. #define M98505_WATCHFAIL_STATE_WIDTH 1
  159. #define M98505_ALCINFH_STATE_MASK (1<<3)
  160. #define M98505_ALCINFH_STATE_SHIFT 3
  161. #define M98505_ALCINFH_STATE_WIDTH 1
  162. #define M98505_ALCACT_STATE_MASK (1<<2)
  163. #define M98505_ALCACT_STATE_SHIFT 2
  164. #define M98505_ALCACT_STATE_WIDTH 1
  165. #define M98505_ALCMUT_STATE_MASK (1<<1)
  166. #define M98505_ALCMUT_STATE_SHIFT 1
  167. #define M98505_ALCMUT_STATE_WIDTH 1
  168. #define M98505_ALCP_STATE_MASK (1<<0)
  169. #define M98505_ALCP_STATE_SHIFT 0
  170. #define M98505_ALCP_STATE_WIDTH 1
  171. /* MAX98505_R007_STATE2 */
  172. #define M98505_SLOTOVRN_STATE_MASK (1<<6)
  173. #define M98505_SLOTOVRN_STATE_SHIFT 6
  174. #define M98505_SLOTOVRN_STATE_WIDTH 1
  175. #define M98505_INVALSLOT_STATE_MASK (1<<5)
  176. #define M98505_INVALSLOT_STATE_SHIFT 5
  177. #define M98505_INVALSLOT_STATE_WIDTH 1
  178. #define M98505_SLOTCNFLT_STATE_MASK (1<<4)
  179. #define M98505_SLOTCNFLT_STATE_SHIFT 4
  180. #define M98505_SLOTCNFLT_STATE_WIDTH 1
  181. #define M98505_VBSTOVFL_STATE_MASK (1<<3)
  182. #define M98505_VBSTOVFL_STATE_SHIFT 3
  183. #define M98505_VBSTOVFL_STATE_WIDTH 1
  184. #define M98505_VBATOVFL_STATE_MASK (1<<2)
  185. #define M98505_VBATOVFL_STATE_SHIFT 2
  186. #define M98505_VBATOVFL_STATE_WIDTH 1
  187. #define M98505_IMONOVFL_STATE_MASK (1<<1)
  188. #define M98505_IMONOVFL_STATE_SHIFT 1
  189. #define M98505_IMONOVFL_STATE_WIDTH 1
  190. #define M98505_VMONOVFL_STATE_MASK (1<<0)
  191. #define M98505_VMONOVFL_STATE_SHIFT 0
  192. #define M98505_VMONOVFL_STATE_WIDTH 1
  193. /* MAX98505_R008_FLAG0 */
  194. #define M98505_THERMWARN_END_FLAG_MASK (1<<3)
  195. #define M98505_THERMWARN_END_FLAG_SHIFT 3
  196. #define M98505_THERMWARN_END_FLAG_WIDTH 1
  197. #define M98505_THERMWARN_BGN_FLAG_MASK (1<<2)
  198. #define M98505_THERMWARN_BGN_FLAG_SHIFT 2
  199. #define M98505_THERMWARN_BGN_FLAG_WIDTH 1
  200. #define M98505_THERMSHDN_END_FLAG_MASK (1<<1)
  201. #define M98505_THERMSHDN_END_FLAG_SHIFT 1
  202. #define M98505_THERMSHDN_END_FLAG_WIDTH 1
  203. #define M98505_THERMSHDN_BGN_FLAG_MASK (1<<0)
  204. #define M98505_THERMSHDN_BGN_FLAG_SHIFT 0
  205. #define M98505_THERMSHDN_BGN_FLAG_WIDTH 1
  206. /* MAX98505_R009_FLAG1 */
  207. #define M98505_SPKCURNT_FLAG_MASK (1<<5)
  208. #define M98505_SPKCURNT_FLAG_SHIFT 5
  209. #define M98505_SPKCURNT_FLAG_WIDTH 1
  210. #define M98505_WATCHFAIL_FLAG_MASK (1<<4)
  211. #define M98505_WATCHFAIL_FLAG_SHIFT 4
  212. #define M98505_WATCHFAIL_FLAG_WIDTH 1
  213. #define M98505_ALCINFH_FLAG_MASK (1<<3)
  214. #define M98505_ALCINFH_FLAG_SHIFT 3
  215. #define M98505_ALCINFH_FLAG_WIDTH 1
  216. #define M98505_ALCACT_FLAG_MASK (1<<2)
  217. #define M98505_ALCACT_FLAG_SHIFT 2
  218. #define M98505_ALCACT_FLAG_WIDTH 1
  219. #define M98505_ALCMUT_FLAG_MASK (1<<1)
  220. #define M98505_ALCMUT_FLAG_SHIFT 1
  221. #define M98505_ALCMUT_FLAG_WIDTH 1
  222. #define M98505_ALCP_FLAG_MASK (1<<0)
  223. #define M98505_ALCP_FLAG_SHIFT 0
  224. #define M98505_ALCP_FLAG_WIDTH 1
  225. /* MAX98505_R00A_FLAG2 */
  226. #define M98505_SLOTOVRN_FLAG_MASK (1<<6)
  227. #define M98505_SLOTOVRN_FLAG_SHIFT 6
  228. #define M98505_SLOTOVRN_FLAG_WIDTH 1
  229. #define M98505_INVALSLOT_FLAG_MASK (1<<5)
  230. #define M98505_INVALSLOT_FLAG_SHIFT 5
  231. #define M98505_INVALSLOT_FLAG_WIDTH 1
  232. #define M98505_SLOTCNFLT_FLAG_MASK (1<<4)
  233. #define M98505_SLOTCNFLT_FLAG_SHIFT 4
  234. #define M98505_SLOTCNFLT_FLAG_WIDTH 1
  235. #define M98505_VBSTOVFL_FLAG_MASK (1<<3)
  236. #define M98505_VBSTOVFL_FLAG_SHIFT 3
  237. #define M98505_VBSTOVFL_FLAG_WIDTH 1
  238. #define M98505_VBATOVFL_FLAG_MASK (1<<2)
  239. #define M98505_VBATOVFL_FLAG_SHIFT 2
  240. #define M98505_VBATOVFL_FLAG_WIDTH 1
  241. #define M98505_IMONOVFL_FLAG_MASK (1<<1)
  242. #define M98505_IMONOVFL_FLAG_SHIFT 1
  243. #define M98505_IMONOVFL_FLAG_WIDTH 1
  244. #define M98505_VMONOVFL_FLAG_MASK (1<<0)
  245. #define M98505_VMONOVFL_FLAG_SHIFT 0
  246. #define M98505_VMONOVFL_FLAG_WIDTH 1
  247. /* MAX98505_R00B_IRQ_ENABLE0 */
  248. #define M98505_THERMWARN_END_EN_MASK (1<<3)
  249. #define M98505_THERMWARN_END_EN_SHIFT 3
  250. #define M98505_THERMWARN_END_EN_WIDTH 1
  251. #define M98505_THERMWARN_BGN_EN_MASK (1<<2)
  252. #define M98505_THERMWARN_BGN_EN_SHIFT 2
  253. #define M98505_THERMWARN_BGN_EN_WIDTH 1
  254. #define M98505_THERMSHDN_END_EN_MASK (1<<1)
  255. #define M98505_THERMSHDN_END_EN_SHIFT 1
  256. #define M98505_THERMSHDN_END_EN_WIDTH 1
  257. #define M98505_THERMSHDN_BGN_EN_MASK (1<<0)
  258. #define M98505_THERMSHDN_BGN_EN_SHIFT 0
  259. #define M98505_THERMSHDN_BGN_EN_WIDTH 1
  260. /* MAX98505_R00C_IRQ_ENABLE1 */
  261. #define M98505_SPKCURNT_EN_MASK (1<<5)
  262. #define M98505_SPKCURNT_EN_SHIFT 5
  263. #define M98505_SPKCURNT_EN_WIDTH 1
  264. #define M98505_WATCHFAIL_EN_MASK (1<<4)
  265. #define M98505_WATCHFAIL_EN_SHIFT 4
  266. #define M98505_WATCHFAIL_EN_WIDTH 1
  267. #define M98505_ALCINFH_EN_MASK (1<<3)
  268. #define M98505_ALCINFH_EN_SHIFT 3
  269. #define M98505_ALCINFH_EN_WIDTH 1
  270. #define M98505_ALCACT_EN_MASK (1<<2)
  271. #define M98505_ALCACT_EN_SHIFT 2
  272. #define M98505_ALCACT_EN_WIDTH 1
  273. #define M98505_ALCMUT_EN_MASK (1<<1)
  274. #define M98505_ALCMUT_EN_SHIFT 1
  275. #define M98505_ALCMUT_EN_WIDTH 1
  276. #define M98505_ALCP_EN_MASK (1<<0)
  277. #define M98505_ALCP_EN_SHIFT 0
  278. #define M98505_ALCP_EN_WIDTH 1
  279. /* MAX98505_R00D_IRQ_ENABLE2 */
  280. #define M98505_SLOTOVRN_EN_MASK (1<<6)
  281. #define M98505_SLOTOVRN_EN_SHIFT 6
  282. #define M98505_SLOTOVRN_EN_WIDTH 1
  283. #define M98505_INVALSLOT_EN_MASK (1<<5)
  284. #define M98505_INVALSLOT_EN_SHIFT 5
  285. #define M98505_INVALSLOT_EN_WIDTH 1
  286. #define M98505_SLOTCNFLT_EN_MASK (1<<4)
  287. #define M98505_SLOTCNFLT_EN_SHIFT 4
  288. #define M98505_SLOTCNFLT_EN_WIDTH 1
  289. #define M98505_VBSTOVFL_EN_MASK (1<<3)
  290. #define M98505_VBSTOVFL_EN_SHIFT 3
  291. #define M98505_VBSTOVFL_EN_WIDTH 1
  292. #define M98505_VBATOVFL_EN_MASK (1<<2)
  293. #define M98505_VBATOVFL_EN_SHIFT 2
  294. #define M98505_VBATOVFL_EN_WIDTH 1
  295. #define M98505_IMONOVFL_EN_MASK (1<<1)
  296. #define M98505_IMONOVFL_EN_SHIFT 1
  297. #define M98505_IMONOVFL_EN_WIDTH 1
  298. #define M98505_VMONOVFL_EN_MASK (1<<0)
  299. #define M98505_VMONOVFL_EN_SHIFT 0
  300. #define M98505_VMONOVFL_EN_WIDTH 1
  301. /* MAX98505_R00E_IRQ_CLEAR0 */
  302. #define M98505_THERMWARN_END_CLR_MASK (1<<3)
  303. #define M98505_THERMWARN_END_CLR_SHIFT 3
  304. #define M98505_THERMWARN_END_CLR_WIDTH 1
  305. #define M98505_THERMWARN_BGN_CLR_MASK (1<<2)
  306. #define M98505_THERMWARN_BGN_CLR_SHIFT 2
  307. #define M98505_THERMWARN_BGN_CLR_WIDTH 1
  308. #define M98505_THERMSHDN_END_CLR_MASK (1<<1)
  309. #define M98505_THERMSHDN_END_CLR_SHIFT 1
  310. #define M98505_THERMSHDN_END_CLR_WIDTH 1
  311. #define M98505_THERMSHDN_BGN_CLR_MASK (1<<0)
  312. #define M98505_THERMSHDN_BGN_CLR_SHIFT 0
  313. #define M98505_THERMSHDN_BGN_CLR_WIDTH 1
  314. /* MAX98505_R00F_IRQ_CLEAR1 */
  315. #define M98505_SPKCURNT_CLR_MASK (1<<5)
  316. #define M98505_SPKCURNT_CLR_SHIFT 5
  317. #define M98505_SPKCURNT_CLR_WIDTH 1
  318. #define M98505_WATCHFAIL_CLR_MASK (1<<4)
  319. #define M98505_WATCHFAIL_CLR_SHIFT 4
  320. #define M98505_WATCHFAIL_CLR_WIDTH 1
  321. #define M98505_ALCINFH_CLR_MASK (1<<3)
  322. #define M98505_ALCINFH_CLR_SHIFT 3
  323. #define M98505_ALCINFH_CLR_WIDTH 1
  324. #define M98505_ALCACT_CLR_MASK (1<<2)
  325. #define M98505_ALCACT_CLR_SHIFT 2
  326. #define M98505_ALCACT_CLR_WIDTH 1
  327. #define M98505_ALCMUT_CLR_MASK (1<<1)
  328. #define M98505_ALCMUT_CLR_SHIFT 1
  329. #define M98505_ALCMUT_CLR_WIDTH 1
  330. #define M98505_ALCP_CLR_MASK (1<<0)
  331. #define M98505_ALCP_CLR_SHIFT 0
  332. #define M98505_ALCP_CLR_WIDTH 1
  333. /* MAX98505_R010_IRQ_CLEAR2 */
  334. #define M98505_SLOTOVRN_CLR_MASK (1<<6)
  335. #define M98505_SLOTOVRN_CLR_SHIFT 6
  336. #define M98505_SLOTOVRN_CLR_WIDTH 1
  337. #define M98505_INVALSLOT_CLR_MASK (1<<5)
  338. #define M98505_INVALSLOT_CLR_SHIFT 5
  339. #define M98505_INVALSLOT_CLR_WIDTH 1
  340. #define M98505_SLOTCNFLT_CLR_MASK (1<<4)
  341. #define M98505_SLOTCNFLT_CLR_SHIFT 4
  342. #define M98505_SLOTCNFLT_CLR_WIDTH 1
  343. #define M98505_VBSTOVFL_CLR_MASK (1<<3)
  344. #define M98505_VBSTOVFL_CLR_SHIFT 3
  345. #define M98505_VBSTOVFL_CLR_WIDTH 1
  346. #define M98505_VBATOVFL_CLR_MASK (1<<2)
  347. #define M98505_VBATOVFL_CLR_SHIFT 2
  348. #define M98505_VBATOVFL_CLR_WIDTH 1
  349. #define M98505_IMONOVFL_CLR_MASK (1<<1)
  350. #define M98505_IMONOVFL_CLR_SHIFT 1
  351. #define M98505_IMONOVFL_CLR_WIDTH 1
  352. #define M98505_VMONOVFL_CLR_MASK (1<<0)
  353. #define M98505_VMONOVFL_CLR_SHIFT 0
  354. #define M98505_VMONOVFL_CLR_WIDTH 1
  355. /* MAX98505_R011_MAP0 */
  356. #define M98505_ER_THERMWARN_EN_MASK (1<<7)
  357. #define M98505_ER_THERMWARN_EN_SHIFT 7
  358. #define M98505_ER_THERMWARN_EN_WIDTH 1
  359. #define M98505_ER_THERMWARN_MAP_MASK (0x07<<4)
  360. #define M98505_ER_THERMWARN_MAP_SHIFT 4
  361. #define M98505_ER_THERMWARN_MAP_WIDTH 3
  362. /* MAX98505_R012_MAP1 */
  363. #define M98505_ER_ALCMUT_EN_MASK (1<<7)
  364. #define M98505_ER_ALCMUT_EN_SHIFT 7
  365. #define M98505_ER_ALCMUT_EN_WIDTH 1
  366. #define M98505_ER_ALCMUT_MAP_MASK (0x07<<4)
  367. #define M98505_ER_ALCMUT_MAP_SHIFT 4
  368. #define M98505_ER_ALCMUT_MAP_WIDTH 3
  369. #define M98505_ER_ALCP_EN_MASK (1<<3)
  370. #define M98505_ER_ALCP_EN_SHIFT 3
  371. #define M98505_ER_ALCP_EN_WIDTH 1
  372. #define M98505_ER_ALCP_MAP_MASK (0x07<<0)
  373. #define M98505_ER_ALCP_MAP_SHIFT 0
  374. #define M98505_ER_ALCP_MAP_WIDTH 3
  375. /* MAX98505_R013_MAP2 */
  376. #define M98505_ER_ALCINFH_EN_MASK (1<<7)
  377. #define M98505_ER_ALCINFH_EN_SHIFT 7
  378. #define M98505_ER_ALCINFH_EN_WIDTH 1
  379. #define M98505_ER_ALCINFH_MAP_MASK (0x07<<4)
  380. #define M98505_ER_ALCINFH_MAP_SHIFT 4
  381. #define M98505_ER_ALCINFH_MAP_WIDTH 3
  382. #define M98505_ER_ALCACT_EN_MASK (1<<3)
  383. #define M98505_ER_ALCACT_EN_SHIFT 3
  384. #define M98505_ER_ALCACT_EN_WIDTH 1
  385. #define M98505_ER_ALCACT_MAP_MASK (0x07<<0)
  386. #define M98505_ER_ALCACT_MAP_SHIFT 0
  387. #define M98505_ER_ALCACT_MAP_WIDTH 3
  388. /* MAX98505_R014_MAP3 */
  389. #define M98505_ER_SPKCURNT_EN_MASK (1<<7)
  390. #define M98505_ER_SPKCURNT_EN_SHIFT 7
  391. #define M98505_ER_SPKCURNT_EN_WIDTH 1
  392. #define M98505_ER_SPKCURNT_MAP_MASK (0x07<<4)
  393. #define M98505_ER_SPKCURNT_MAP_SHIFT 4
  394. #define M98505_ER_SPKCURNT_MAP_WIDTH 3
  395. /* MAX98505_R015_MAP4 */
  396. /* RESERVED */
  397. /* MAX98505_R016_MAP5 */
  398. #define M98505_ER_IMONOVFL_EN_MASK (1<<7)
  399. #define M98505_ER_IMONOVFL_EN_SHIFT 7
  400. #define M98505_ER_IMONOVFL_EN_WIDTH 1
  401. #define M98505_ER_IMONOVFL_MAP_MASK (0x07<<4)
  402. #define M98505_ER_IMONOVFL_MAP_SHIFT 4
  403. #define M98505_ER_IMONOVFL_MAP_WIDTH 3
  404. #define M98505_ER_VMONOVFL_EN_MASK (1<<3)
  405. #define M98505_ER_VMONOVFL_EN_SHIFT 3
  406. #define M98505_ER_VMONOVFL_EN_WIDTH 1
  407. #define M98505_ER_VMONOVFL_MAP_MASK (0x07<<0)
  408. #define M98505_ER_VMONOVFL_MAP_SHIFT 0
  409. #define M98505_ER_VMONOVFL_MAP_WIDTH 3
  410. /* MAX98505_R017_MAP6 */
  411. #define M98505_ER_VBSTOVFL_EN_MASK (1<<7)
  412. #define M98505_ER_VBSTOVFL_EN_SHIFT 7
  413. #define M98505_ER_VBSTOVFL_EN_WIDTH 1
  414. #define M98505_ER_VBSTOVFL_MAP_MASK (0x07<<4)
  415. #define M98505_ER_VBSTOVFL_MAP_SHIFT 4
  416. #define M98505_ER_VBSTOVFL_MAP_WIDTH 3
  417. #define M98505_ER_VBATOVFL_EN_MASK (1<<3)
  418. #define M98505_ER_VBATOVFL_EN_SHIFT 3
  419. #define M98505_ER_VBATOVFL_EN_WIDTH 1
  420. #define M98505_ER_VBATOVFL_MAP_MASK (0x07<<0)
  421. #define M98505_ER_VBATOVFL_MAP_SHIFT 0
  422. #define M98505_ER_VBATOVFL_MAP_WIDTH 3
  423. /* MAX98505_R018_MAP7 */
  424. #define M98505_ER_INVALSLOT_EN_MASK (1<<7)
  425. #define M98505_ER_INVALSLOT_EN_SHIFT 7
  426. #define M98505_ER_INVALSLOT_EN_WIDTH 1
  427. #define M98505_ER_INVALSLOT_MAP_MASK (0x07<<4)
  428. #define M98505_ER_INVALSLOT_MAP_SHIFT 4
  429. #define M98505_ER_INVALSLOT_MAP_WIDTH 3
  430. #define M98505_ER_SLOTCNFLT_EN_MASK (1<<3)
  431. #define M98505_ER_SLOTCNFLT_EN_SHIFT 3
  432. #define M98505_ER_SLOTCNFLT_EN_WIDTH 1
  433. #define M98505_ER_SLOTCNFLT_MAP_MASK (0x07<<0)
  434. #define M98505_ER_SLOTCNFLT_MAP_SHIFT 0
  435. #define M98505_ER_SLOTCNFLT_MAP_WIDTH 3
  436. /* MAX98505_R019_MAP8 */
  437. #define M98505_ER_SLOTOVRN_EN_MASK (1<<3)
  438. #define M98505_ER_SLOTOVRN_EN_SHIFT 3
  439. #define M98505_ER_SLOTOVRN_EN_WIDTH 1
  440. #define M98505_ER_SLOTOVRN_MAP_MASK (0x07<<0)
  441. #define M98505_ER_SLOTOVRN_MAP_SHIFT 0
  442. #define M98505_ER_SLOTOVRN_MAP_WIDTH 3
  443. /* MAX98505_R01A_DAI_CLK_MODE1 */
  444. #define M98505_DAI_CLK_SOURCE_MASK (1<<6)
  445. #define M98505_DAI_CLK_SOURCE_SHIFT 6
  446. #define M98505_DAI_CLK_SOURCE_WIDTH 1
  447. #define M98505_MDLL_MULT_MASK (0x0F<<0)
  448. #define M98505_MDLL_MULT_SHIFT 0
  449. #define M98505_MDLL_MULT_WIDTH 4
  450. #define M98505_MDLL_MULT_MCLKx8 6
  451. #define M98505_MDLL_MULT_MCLKx16 8
  452. /* MAX98505_R01B_DAI_CLK_MODE2 */
  453. #define M98505_DAI_SR_MASK (0x0F<<4)
  454. #define M98505_DAI_SR_SHIFT 4
  455. #define M98505_DAI_SR_WIDTH 4
  456. #define M98505_DAI_MAS_MASK (1<<3)
  457. #define M98505_DAI_MAS_SHIFT 3
  458. #define M98505_DAI_MAS_WIDTH 1
  459. #define M98505_DAI_BSEL_MASK (0x07<<0)
  460. #define M98505_DAI_BSEL_SHIFT 0
  461. #define M98505_DAI_BSEL_WIDTH 3
  462. #define M98505_DAI_BSEL_32 (0 << M98505_DAI_BSEL_SHIFT)
  463. #define M98505_DAI_BSEL_48 (1 << M98505_DAI_BSEL_SHIFT)
  464. #define M98505_DAI_BSEL_64 (2 << M98505_DAI_BSEL_SHIFT)
  465. #define M98505_DAI_BSEL_256 (6 << M98505_DAI_BSEL_SHIFT)
  466. /* MAX98505_R01C_DAI_CLK_DIV_M_MSBS */
  467. #define M98505_DAI_M_MSBS_MASK (0xFF<<0)
  468. #define M98505_DAI_M_MSBS_SHIFT 0
  469. #define M98505_DAI_M_MSBS_WIDTH 8
  470. /* MAX98505_R01D_DAI_CLK_DIV_M_LSBS */
  471. #define M98505_DAI_M_LSBS_MASK (0xFF<<0)
  472. #define M98505_DAI_M_LSBS_SHIFT 0
  473. #define M98505_DAI_M_LSBS_WIDTH 8
  474. /* MAX98505_R01E_DAI_CLK_DIV_N_MSBS */
  475. #define M98505_DAI_N_MSBS_MASK (0x7F<<0)
  476. #define M98505_DAI_N_MSBS_SHIFT 0
  477. #define M98505_DAI_N_MSBS_WIDTH 7
  478. /* MAX98505_R01F_DAI_CLK_DIV_N_LSBS */
  479. #define M98505_DAI_N_LSBS_MASK (0xFF<<0)
  480. #define M98505_DAI_N_LSBS_SHIFT 0
  481. #define M98505_DAI_N_LSBS_WIDTH 8
  482. /* MAX98505_R020_FORMAT */
  483. #define M98505_DAI_CHANSZ_MASK (0x03<<6)
  484. #define M98505_DAI_CHANSZ_SHIFT 6
  485. #define M98505_DAI_CHANSZ_WIDTH 2
  486. #define M98505_DAI_EXTBCLK_HIZ_MASK (1<<4)
  487. #define M98505_DAI_EXTBCLK_HIZ_SHIFT 4
  488. #define M98505_DAI_EXTBCLK_HIZ_WIDTH 1
  489. #define M98505_DAI_WCI_MASK (1<<3)
  490. #define M98505_DAI_WCI_SHIFT 3
  491. #define M98505_DAI_WCI_WIDTH 1
  492. #define M98505_DAI_BCI_MASK (1<<2)
  493. #define M98505_DAI_BCI_SHIFT 2
  494. #define M98505_DAI_BCI_WIDTH 1
  495. #define M98505_DAI_DLY_MASK (1<<1)
  496. #define M98505_DAI_DLY_SHIFT 1
  497. #define M98505_DAI_DLY_WIDTH 1
  498. #define M98505_DAI_TDM_MASK (1<<0)
  499. #define M98505_DAI_TDM_SHIFT 0
  500. #define M98505_DAI_TDM_WIDTH 1
  501. #define M98505_DAI_CHANSZ_16 (1 << M98505_DAI_CHANSZ_SHIFT)
  502. #define M98505_DAI_CHANSZ_24 (2 << M98505_DAI_CHANSZ_SHIFT)
  503. #define M98505_DAI_CHANSZ_32 (3 << M98505_DAI_CHANSZ_SHIFT)
  504. /* MAX98505_R021_TDM_SLOT_SELECT */
  505. #define M98505_DAI_DO_EN_MASK (1<<7)
  506. #define M98505_DAI_DO_EN_SHIFT 7
  507. #define M98505_DAI_DO_EN_WIDTH 1
  508. #define M98505_DAI_DIN_EN_MASK (1<<6)
  509. #define M98505_DAI_DIN_EN_SHIFT 6
  510. #define M98505_DAI_DIN_EN_WIDTH 1
  511. #define M98505_DAI_INR_SOURCE_MASK (0x07<<3)
  512. #define M98505_DAI_INR_SOURCE_SHIFT 3
  513. #define M98505_DAI_INR_SOURCE_WIDTH 3
  514. #define M98505_DAI_INL_SOURCE_MASK (0x07<<0)
  515. #define M98505_DAI_INL_SOURCE_SHIFT 0
  516. #define M98505_DAI_INL_SOURCE_WIDTH 3
  517. /* MAX98505_R022_DOUT_CFG_VMON */
  518. #define M98505_DAI_VMON_EN_MASK (1<<5)
  519. #define M98505_DAI_VMON_EN_SHIFT 5
  520. #define M98505_DAI_VMON_EN_WIDTH 1
  521. #define M98505_DAI_VMON_SLOT_MASK (0x1F<<0)
  522. #define M98505_DAI_VMON_SLOT_SHIFT 0
  523. #define M98505_DAI_VMON_SLOT_WIDTH 5
  524. #define M98505_DAI_VMON_SLOT_00_01 (0 << M98505_DAI_VMON_SLOT_SHIFT)
  525. #define M98505_DAI_VMON_SLOT_01_02 (1 << M98505_DAI_VMON_SLOT_SHIFT)
  526. #define M98505_DAI_VMON_SLOT_02_03 (2 << M98505_DAI_VMON_SLOT_SHIFT)
  527. #define M98505_DAI_VMON_SLOT_03_04 (3 << M98505_DAI_VMON_SLOT_SHIFT)
  528. #define M98505_DAI_VMON_SLOT_04_05 (4 << M98505_DAI_VMON_SLOT_SHIFT)
  529. #define M98505_DAI_VMON_SLOT_05_06 (5 << M98505_DAI_VMON_SLOT_SHIFT)
  530. #define M98505_DAI_VMON_SLOT_06_07 (6 << M98505_DAI_VMON_SLOT_SHIFT)
  531. #define M98505_DAI_VMON_SLOT_07_08 (7 << M98505_DAI_VMON_SLOT_SHIFT)
  532. #define M98505_DAI_VMON_SLOT_08_09 (8 << M98505_DAI_VMON_SLOT_SHIFT)
  533. #define M98505_DAI_VMON_SLOT_09_0A (9 << M98505_DAI_VMON_SLOT_SHIFT)
  534. #define M98505_DAI_VMON_SLOT_0A_0B (10 << M98505_DAI_VMON_SLOT_SHIFT)
  535. #define M98505_DAI_VMON_SLOT_0B_0C (11 << M98505_DAI_VMON_SLOT_SHIFT)
  536. #define M98505_DAI_VMON_SLOT_0C_0D (12 << M98505_DAI_VMON_SLOT_SHIFT)
  537. #define M98505_DAI_VMON_SLOT_0D_0E (13 << M98505_DAI_VMON_SLOT_SHIFT)
  538. #define M98505_DAI_VMON_SLOT_0E_0F (14 << M98505_DAI_VMON_SLOT_SHIFT)
  539. #define M98505_DAI_VMON_SLOT_0F_10 (15 << M98505_DAI_VMON_SLOT_SHIFT)
  540. #define M98505_DAI_VMON_SLOT_10_11 (16 << M98505_DAI_VMON_SLOT_SHIFT)
  541. #define M98505_DAI_VMON_SLOT_11_12 (17 << M98505_DAI_VMON_SLOT_SHIFT)
  542. #define M98505_DAI_VMON_SLOT_12_13 (18 << M98505_DAI_VMON_SLOT_SHIFT)
  543. #define M98505_DAI_VMON_SLOT_13_14 (19 << M98505_DAI_VMON_SLOT_SHIFT)
  544. #define M98505_DAI_VMON_SLOT_14_15 (20 << M98505_DAI_VMON_SLOT_SHIFT)
  545. #define M98505_DAI_VMON_SLOT_15_16 (21 << M98505_DAI_VMON_SLOT_SHIFT)
  546. #define M98505_DAI_VMON_SLOT_16_17 (22 << M98505_DAI_VMON_SLOT_SHIFT)
  547. #define M98505_DAI_VMON_SLOT_17_18 (23 << M98505_DAI_VMON_SLOT_SHIFT)
  548. #define M98505_DAI_VMON_SLOT_18_19 (24 << M98505_DAI_VMON_SLOT_SHIFT)
  549. #define M98505_DAI_VMON_SLOT_19_1A (25 << M98505_DAI_VMON_SLOT_SHIFT)
  550. #define M98505_DAI_VMON_SLOT_1A_1B (26 << M98505_DAI_VMON_SLOT_SHIFT)
  551. #define M98505_DAI_VMON_SLOT_1B_1C (27 << M98505_DAI_VMON_SLOT_SHIFT)
  552. #define M98505_DAI_VMON_SLOT_1C_1D (28 << M98505_DAI_VMON_SLOT_SHIFT)
  553. #define M98505_DAI_VMON_SLOT_1D_1E (29 << M98505_DAI_VMON_SLOT_SHIFT)
  554. #define M98505_DAI_VMON_SLOT_1E_1F (30 << M98505_DAI_VMON_SLOT_SHIFT)
  555. /* MAX98505_R023_DOUT_CFG_IMON */
  556. #define M98505_DAI_IMON_EN_MASK (1<<5)
  557. #define M98505_DAI_IMON_EN_SHIFT 5
  558. #define M98505_DAI_IMON_EN_WIDTH 1
  559. #define M98505_DAI_IMON_SLOT_MASK (0x1F<<0)
  560. #define M98505_DAI_IMON_SLOT_SHIFT 0
  561. #define M98505_DAI_IMON_SLOT_WIDTH 5
  562. #define M98505_DAI_IMON_SLOT_00_01 (0 << M98505_DAI_IMON_SLOT_SHIFT)
  563. #define M98505_DAI_IMON_SLOT_01_02 (1 << M98505_DAI_IMON_SLOT_SHIFT)
  564. #define M98505_DAI_IMON_SLOT_02_03 (2 << M98505_DAI_IMON_SLOT_SHIFT)
  565. #define M98505_DAI_IMON_SLOT_03_04 (3 << M98505_DAI_IMON_SLOT_SHIFT)
  566. #define M98505_DAI_IMON_SLOT_04_05 (4 << M98505_DAI_IMON_SLOT_SHIFT)
  567. #define M98505_DAI_IMON_SLOT_05_06 (5 << M98505_DAI_IMON_SLOT_SHIFT)
  568. #define M98505_DAI_IMON_SLOT_06_07 (6 << M98505_DAI_IMON_SLOT_SHIFT)
  569. #define M98505_DAI_IMON_SLOT_07_08 (7 << M98505_DAI_IMON_SLOT_SHIFT)
  570. #define M98505_DAI_IMON_SLOT_08_09 (8 << M98505_DAI_IMON_SLOT_SHIFT)
  571. #define M98505_DAI_IMON_SLOT_09_0A (9 << M98505_DAI_IMON_SLOT_SHIFT)
  572. #define M98505_DAI_IMON_SLOT_0A_0B (10 << M98505_DAI_IMON_SLOT_SHIFT)
  573. #define M98505_DAI_IMON_SLOT_0B_0C (11 << M98505_DAI_IMON_SLOT_SHIFT)
  574. #define M98505_DAI_IMON_SLOT_0C_0D (12 << M98505_DAI_IMON_SLOT_SHIFT)
  575. #define M98505_DAI_IMON_SLOT_0D_0E (13 << M98505_DAI_IMON_SLOT_SHIFT)
  576. #define M98505_DAI_IMON_SLOT_0E_0F (14 << M98505_DAI_IMON_SLOT_SHIFT)
  577. #define M98505_DAI_IMON_SLOT_0F_10 (15 << M98505_DAI_IMON_SLOT_SHIFT)
  578. #define M98505_DAI_IMON_SLOT_10_11 (16 << M98505_DAI_IMON_SLOT_SHIFT)
  579. #define M98505_DAI_IMON_SLOT_11_12 (17 << M98505_DAI_IMON_SLOT_SHIFT)
  580. #define M98505_DAI_IMON_SLOT_12_13 (18 << M98505_DAI_IMON_SLOT_SHIFT)
  581. #define M98505_DAI_IMON_SLOT_13_14 (19 << M98505_DAI_IMON_SLOT_SHIFT)
  582. #define M98505_DAI_IMON_SLOT_14_15 (20 << M98505_DAI_IMON_SLOT_SHIFT)
  583. #define M98505_DAI_IMON_SLOT_15_16 (21 << M98505_DAI_IMON_SLOT_SHIFT)
  584. #define M98505_DAI_IMON_SLOT_16_17 (22 << M98505_DAI_IMON_SLOT_SHIFT)
  585. #define M98505_DAI_IMON_SLOT_17_18 (23 << M98505_DAI_IMON_SLOT_SHIFT)
  586. #define M98505_DAI_IMON_SLOT_18_19 (24 << M98505_DAI_IMON_SLOT_SHIFT)
  587. #define M98505_DAI_IMON_SLOT_19_1A (25 << M98505_DAI_IMON_SLOT_SHIFT)
  588. #define M98505_DAI_IMON_SLOT_1A_1B (26 << M98505_DAI_IMON_SLOT_SHIFT)
  589. #define M98505_DAI_IMON_SLOT_1B_1C (27 << M98505_DAI_IMON_SLOT_SHIFT)
  590. #define M98505_DAI_IMON_SLOT_1C_1D (28 << M98505_DAI_IMON_SLOT_SHIFT)
  591. #define M98505_DAI_IMON_SLOT_1D_1E (29 << M98505_DAI_IMON_SLOT_SHIFT)
  592. #define M98505_DAI_IMON_SLOT_1E_1F (30 << M98505_DAI_IMON_SLOT_SHIFT)
  593. /* MAX98505_R024_DOUT_CFG_VBAT */
  594. #define M98505_DAI_VBAT_EN_MASK (1<<5)
  595. #define M98505_DAI_VBAT_EN_SHIFT 5
  596. #define M98505_DAI_VBAT_EN_WIDTH 1
  597. #define M98505_DAI_VBAT_SLOT_MASK (0x1F<<0)
  598. #define M98505_DAI_VBAT_SLOT_SHIFT 0
  599. #define M98505_DAI_VBAT_SLOT_WIDTH 5
  600. /* MAX98505_R025_DOUT_CFG_VBST */
  601. #define M98505_DAI_VBST_EN_MASK (1<<5)
  602. #define M98505_DAI_VBST_EN_SHIFT 5
  603. #define M98505_DAI_VBST_EN_WIDTH 1
  604. #define M98505_DAI_VBST_SLOT_MASK (0x1F<<0)
  605. #define M98505_DAI_VBST_SLOT_SHIFT 0
  606. #define M98505_DAI_VBST_SLOT_WIDTH 5
  607. /* MAX98505_R026_DOUT_CFG_FLAG */
  608. #define M98505_DAI_FLAG_EN_MASK (1<<5)
  609. #define M98505_DAI_FLAG_EN_SHIFT 5
  610. #define M98505_DAI_FLAG_EN_WIDTH 1
  611. #define M98505_DAI_FLAG_SLOT_MASK (0x1F<<0)
  612. #define M98505_DAI_FLAG_SLOT_SHIFT 0
  613. #define M98505_DAI_FLAG_SLOT_WIDTH 5
  614. /* MAX98505_R027_DOUT_HIZ_CFG1 */
  615. #define M98505_DAI_SLOT_HIZ_CFG1_MASK (0xFF<<0)
  616. #define M98505_DAI_SLOT_HIZ_CFG1_SHIFT 0
  617. #define M98505_DAI_SLOT_HIZ_CFG1_WIDTH 8
  618. /* MAX98505_R028_DOUT_HIZ_CFG2 */
  619. #define M98505_DAI_SLOT_HIZ_CFG2_MASK (0xFF<<0)
  620. #define M98505_DAI_SLOT_HIZ_CFG2_SHIFT 0
  621. #define M98505_DAI_SLOT_HIZ_CFG2_WIDTH 8
  622. /* MAX98505_R029_DOUT_HIZ_CFG3 */
  623. #define M98505_DAI_SLOT_HIZ_CFG3_MASK (0xFF<<0)
  624. #define M98505_DAI_SLOT_HIZ_CFG3_SHIFT 0
  625. #define M98505_DAI_SLOT_HIZ_CFG3_WIDTH 8
  626. /* MAX98505_R02A_DOUT_HIZ_CFG4 */
  627. #define M98505_DAI_SLOT_HIZ_CFG4_MASK (0xFF<<0)
  628. #define M98505_DAI_SLOT_HIZ_CFG4_SHIFT 0
  629. #define M98505_DAI_SLOT_HIZ_CFG4_WIDTH 8
  630. /* MAX98505_R02B_DOUT_DRV_STRENGTH */
  631. #define M98505_DAI_OUT_DRIVE_MASK (0x03<<0)
  632. #define M98505_DAI_OUT_DRIVE_SHIFT 0
  633. #define M98505_DAI_OUT_DRIVE_WIDTH 2
  634. /* MAX98505_R02C_FILTERS */
  635. #define M98505_ADC_DITHER_EN_MASK (1<<7)
  636. #define M98505_ADC_DITHER_EN_SHIFT 7
  637. #define M98505_ADC_DITHER_EN_WIDTH 1
  638. #define M98505_IV_DCB_EN_MASK (1<<6)
  639. #define M98505_IV_DCB_EN_SHIFT 6
  640. #define M98505_IV_DCB_EN_WIDTH 1
  641. #define M98505_DAC_DITHER_EN_MASK (1<<4)
  642. #define M98505_DAC_DITHER_EN_SHIFT 4
  643. #define M98505_DAC_DITHER_EN_WIDTH 1
  644. #define M98505_DAC_FILTER_MODE_MASK (1<<3)
  645. #define M98505_DAC_FILTER_MODE_SHIFT 3
  646. #define M98505_DAC_FILTER_MODE_WIDTH 1
  647. #define M98505_DAC_HPF_MASK (0x07<<0)
  648. #define M98505_DAC_HPF_SHIFT 0
  649. #define M98505_DAC_HPF_WIDTH 3
  650. /* MAX98505_R02D_GAIN */
  651. #define M98505_DAC_IN_SEL_MASK (0x03<<5)
  652. #define M98505_DAC_IN_SEL_SHIFT 5
  653. #define M98505_DAC_IN_SEL_WIDTH 2
  654. #define M98505_SPK_GAIN_MASK (0x1F<<0)
  655. #define M98505_SPK_GAIN_SHIFT 0
  656. #define M98505_SPK_GAIN_WIDTH 5
  657. #define M98505_DAC_IN_SEL_LEFT_DAI (0 << M98505_DAC_IN_SEL_SHIFT)
  658. #define M98505_DAC_IN_SEL_RIGHT_DAI (1 << M98505_DAC_IN_SEL_SHIFT)
  659. #define M98505_DAC_IN_SEL_SUMMED_DAI (2 << M98505_DAC_IN_SEL_SHIFT)
  660. #define M98505_DAC_IN_SEL_DIV2_SUMMED_DAI (3 << M98505_DAC_IN_SEL_SHIFT)
  661. /* MAX98505_R02E_GAIN_RAMPING */
  662. #define M98505_SPK_RMP_EN_MASK (1<<1)
  663. #define M98505_SPK_RMP_EN_SHIFT 1
  664. #define M98505_SPK_RMP_EN_WIDTH 1
  665. #define M98505_SPK_ZCD_EN_MASK (1<<0)
  666. #define M98505_SPK_ZCD_EN_SHIFT 0
  667. #define M98505_SPK_ZCD_EN_WIDTH 1
  668. /* MAX98505_R02F_SPK_AMP */
  669. #define M98505_SPK_MODE_MASK (1<<0)
  670. #define M98505_SPK_MODE_SHIFT 0
  671. #define M98505_SPK_MODE_WIDTH 1
  672. /* MAX98505_R030_THRESHOLD */
  673. #define M98505_ALC_EN_MASK (1<<5)
  674. #define M98505_ALC_EN_SHIFT 5
  675. #define M98505_ALC_EN_WIDTH 1
  676. #define M98505_ALC_TH_MASK (0x1F<<0)
  677. #define M98505_ALC_TH_SHIFT 0
  678. #define M98505_ALC_TH_WIDTH 5
  679. /* MAX98505_R031_ALC_ATTACK */
  680. #define M98505_ALC_ATK_STEP_MASK (0x0F<<4)
  681. #define M98505_ALC_ATK_STEP_SHIFT 4
  682. #define M98505_ALC_ATK_STEP_WIDTH 4
  683. #define M98505_ALC_ATK_RATE_MASK (0x7<<0)
  684. #define M98505_ALC_ATK_RATE_SHIFT 0
  685. #define M98505_ALC_ATK_RATE_WIDTH 3
  686. /* MAX98505_R032_ALC_ATTEN_RLS */
  687. #define M98505_ALC_MAX_ATTEN_MASK (0x0F<<4)
  688. #define M98505_ALC_MAX_ATTEN_SHIFT 4
  689. #define M98505_ALC_MAX_ATTEN_WIDTH 4
  690. #define M98505_ALC_RLS_RATE_MASK (0x7<<0)
  691. #define M98505_ALC_RLS_RATE_SHIFT 0
  692. #define M98505_ALC_RLS_RATE_WIDTH 3
  693. /* MAX98505_R033_ALC_HOLD_RLS */
  694. #define M98505_ALC_RLS_TGR_MASK (1<<0)
  695. #define M98505_ALC_RLS_TGR_SHIFT 0
  696. #define M98505_ALC_RLS_TGR_WIDTH 1
  697. /* MAX98505_R034_ALC_CONFIGURATION */
  698. #define M98505_ALC_MUTE_EN_MASK (1<<7)
  699. #define M98505_ALC_MUTE_EN_SHIFT 7
  700. #define M98505_ALC_MUTE_EN_WIDTH 1
  701. #define M98505_ALC_MUTE_DLY_MASK (0x07<<4)
  702. #define M98505_ALC_MUTE_DLY_SHIFT 4
  703. #define M98505_ALC_MUTE_DLY_WIDTH 3
  704. #define M98505_ALC_RLS_DBT_MASK (0x07<<0)
  705. #define M98505_ALC_RLS_DBT_SHIFT 0
  706. #define M98505_ALC_RLS_DBT_WIDTH 3
  707. /* MAX98505_R035_BOOST_CONVERTER */
  708. #define M98505_BST_SYNC_MASK (1<<7)
  709. #define M98505_BST_SYNC_SHIFT 7
  710. #define M98505_BST_SYNC_WIDTH 1
  711. #define M98505_BST_PHASE_MASK (0x03<<4)
  712. #define M98505_BST_PHASE_SHIFT 4
  713. #define M98505_BST_PHASE_WIDTH 2
  714. #define M98505_BST_SKIP_MODE_MASK (0x03<<0)
  715. #define M98505_BST_SKIP_MODE_SHIFT 0
  716. #define M98505_BST_SKIP_MODE_WIDTH 2
  717. /* MAX98505_R036_BLOCK_ENABLE */
  718. #define M98505_BST_EN_MASK (1<<7)
  719. #define M98505_BST_EN_SHIFT 7
  720. #define M98505_BST_EN_WIDTH 1
  721. #define M98505_WATCH_EN_MASK (1<<6)
  722. #define M98505_WATCH_EN_SHIFT 6
  723. #define M98505_WATCH_EN_WIDTH 1
  724. #define M98505_CLKMON_EN_MASK (1<<5)
  725. #define M98505_CLKMON_EN_SHIFT 5
  726. #define M98505_CLKMON_EN_WIDTH 1
  727. #define M98505_SPK_EN_MASK (1<<4)
  728. #define M98505_SPK_EN_SHIFT 4
  729. #define M98505_SPK_EN_WIDTH 1
  730. #define M98505_ADC_VBST_EN_MASK (1<<3)
  731. #define M98505_ADC_VBST_EN_SHIFT 3
  732. #define M98505_ADC_VBST_EN_WIDTH 1
  733. #define M98505_ADC_VBAT_EN_MASK (1<<2)
  734. #define M98505_ADC_VBAT_EN_SHIFT 2
  735. #define M98505_ADC_VBAT_EN_WIDTH 1
  736. #define M98505_ADC_IMON_EN_MASK (1<<1)
  737. #define M98505_ADC_IMON_EN_SHIFT 1
  738. #define M98505_ADC_IMON_EN_WIDTH 1
  739. #define M98505_ADC_VMON_EN_MASK (1<<0)
  740. #define M98505_ADC_VMON_EN_SHIFT 0
  741. #define M98505_ADC_VMON_EN_WIDTH 1
  742. /* MAX98505_R037_CONFIGURATION */
  743. #define M98505_BST_VOUT_MASK (0x0F<<4)
  744. #define M98505_BST_VOUT_SHIFT 4
  745. #define M98505_BST_VOUT_WIDTH 4
  746. #define M98505_THERMWARN_LEVEL_MASK (0x03<<2)
  747. #define M98505_THERMWARN_LEVEL_SHIFT 2
  748. #define M98505_THERMWARN_LEVEL_WIDTH 2
  749. #define M98505_WATCH_TIME_MASK (0x03<<0)
  750. #define M98505_WATCH_TIME_SHIFT 0
  751. #define M98505_WATCH_TIME_WIDTH 2
  752. /* MAX98505_R038_GLOBAL_ENABLE */
  753. #define M98505_EN_MASK (1<<7)
  754. #define M98505_EN_SHIFT 7
  755. #define M98505_EN_WIDTH 1
  756. /* MAX98505_R03A_BOOST_LIMITER */
  757. #define M98505_BST_ILIM_MASK (0x1F<<3)
  758. #define M98505_BST_ILIM_SHIFT 3
  759. #define M98505_BST_ILIM_WIDTH 5
  760. /* MAX98505_R0FF_VERSION */
  761. #define M98505_REV_ID_MASK (0xFF<<0)
  762. #define M98505_REV_ID_SHIFT 0
  763. #define M98505_REV_ID_WIDTH 8
  764. enum max98505_type {
  765. MAX98505,
  766. };
  767. struct max98505_cdata {
  768. unsigned int rate;
  769. unsigned int fmt;
  770. };
  771. struct max98505_priv {
  772. struct regmap *regmap;
  773. struct snd_soc_codec *codec;
  774. enum max98505_type devtype;
  775. void *control_data;
  776. struct max98505_pdata *pdata;
  777. unsigned int volume;
  778. unsigned int sysclk;
  779. unsigned int iv_status;
  780. struct max98505_cdata dai[1];
  781. };
  782. #endif