max98504.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. /*
  2. * max98504.h -- MAX98504 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 _MAX98504_H
  11. #define _MAX98504_H
  12. #include <linux/version.h>
  13. #ifdef CONFIG_SND_SOC_MAXIM_DSM
  14. #include <sound/maxim_dsm.h>
  15. #endif
  16. /*
  17. * MAX98504 Register Definitions
  18. */
  19. #define MAX98504_REG_01_INTERRUPT_STATUS 0x01
  20. #define MAX98504_REG_02_INTERRUPT_FLAGS 0x02
  21. #define MAX98504_REG_03_INTERRUPT_ENABLES 0x03
  22. #define MAX98504_REG_04_INTERRUPT_FLAG_CLEARS 0x04
  23. #define MAX98504_REG_10_GPIO_ENABLE 0x10
  24. #define MAX98504_REG_11_GPIO_CONFIG 0x11
  25. #define MAX98504_REG_12_WATCHDOG_ENABLE 0x12
  26. #define MAX98504_REG_13_WATCHDOG_CONFIG 0x13
  27. #define MAX98504_REG_14_WATCHDOG_CLEAR 0x14
  28. #define MAX98504_REG_15_CLOCK_MONITOR_ENABLE 0x15
  29. #define MAX98504_REG_16_PVDD_BROWNOUT_ENABLE 0x16
  30. #define MAX98504_REG_17_PVDD_BROWNOUT_CONFIG_1 0x17
  31. #define MAX98504_REG_18_PVDD_BROWNOUT_CONFIG_2 0x18
  32. #define MAX98504_REG_19_PVDD_BROWNOUT_CONFIG_3 0x19
  33. #define MAX98504_REG_1A_PVDD_BROWNOUT_CONFIG_4 0x1a
  34. #define MAX98504_REG_20_PCM_RX_ENABLES 0x20
  35. #define MAX98504_REG_21_PCM_TX_ENABLES 0x21
  36. #define MAX98504_REG_22_PCM_TX_HIZ_CONTROL 0x22
  37. #define MAX98504_REG_23_PCM_TX_CHANNEL_SOURCES 0x23
  38. #define MAX98504_REG_24_PCM_MODE_CONFIG 0x24
  39. #define MAX98504_REG_25_PCM_DSP_CONFIG 0x25
  40. #define MAX98504_REG_26_PCM_CLOCK_SETUP 0x26
  41. #define MAX98504_REG_27_PCM_SAMPLE_RATE_SETUP 0x27
  42. #define MAX98504_REG_28_PCM_TO_SPEAKER_MONOMIX 0x28
  43. #define MAX98504_REG_30_PDM_TX_ENABLES 0x30
  44. #define MAX98504_REG_31_PDM_TX_HIZ_CONTROL 0x31
  45. #define MAX98504_REG_32_PDM_TX_CONTROL 0x32
  46. #define MAX98504_REG_33_PDM_RX_ENABLE 0x33
  47. #define MAX98504_REG_34_SPEAKER_ENABLE 0x34
  48. #define MAX98504_REG_35_SPEAKER_SOURCE_SELECT 0x35
  49. #define MAX98504_REG_36_MEASUREMENT_ENABLES 0x36
  50. #define MAX98504_REG_37_ANALOGUE_INPUT_GAIN 0x37
  51. #define MAX98504_REG_38_TEMPERATURE_LIMIT_CONFIG 0x38
  52. #define MAX98504_REG_39_ANALOGUE_SPARE 0x39
  53. #define MAX98504_REG_40_GLOBAL_ENABLE 0x40
  54. #define MAX98504_REG_41_SOFTWARE_RESET 0x41
  55. #define MAX98504_REG_7FFF_REV_ID 0x7fff
  56. #define MAX98504_REG_CNT (MAX98504_REG_41_SOFTWARE_RESET+1)
  57. /* MAX98504 Register Bit Fields */
  58. /* MAX98504_REG_01_INTERRUPT_STATUS*/
  59. #define M98504_INT_GENFAIL_STATUS_MASK (1<<7)
  60. #define M98504_INT_GENFAIL_STATUS_SHIFT 7
  61. #define M98504_INT_GENFAIL_STATUS_WIDTH 1
  62. #define M98504_INT_AUTHDONE_STATUS_MASK (1<<6)
  63. #define M98504_INT_AUTHDONE_STATUS_SHIFT 6
  64. #define M98504_INT_AUTHDONE_STATUS_WIDTH 1
  65. #define M98504_INT_VBATBROWN_STATUS_MASK (1<<5)
  66. #define M98504_INT_VBATBROWN_STATUS_SHIFT 5
  67. #define M98504_INT_VBATBROWN_STATUS_WIDTH 1
  68. #define M98504_INT_WATCHFAIL_STATUS_MASK (1<<4)
  69. #define M98504_INT_WATCHFAIL_STATUS_SHIFT 4
  70. #define M98504_INT_WATCHFAIL_STATUS_WIDTH 1
  71. #define M98504_INT_THERMWARN_STATUS_MASK (1<<3)
  72. #define M98504_INT_THERMWARN_STATUS_SHIFT 3
  73. #define M98504_INT_THERMWARN_STATUS_WIDTH 1
  74. #define M98504_INT_THERMSHDN_STATUS_MASK (1<<1)
  75. #define M98504_INT_THERMSHDN_STATUS_SHIFT 1
  76. #define M98504_INT_THERMSHDN_STATUS_WIDTH 1
  77. #define M98504_INT_INTERRUPT_STATUS_MASK (\
  78. M98504_INT_GENFAIL_STATUS_MASK|M98504_INT_AUTHDONE_STATUS_MASK\
  79. |M98504_INT_VBATBROWN_STATUS_MASK|M98504_INT_WATCHFAIL_STATUS_MASK\
  80. |M98504_INT_THERMWARN_STATUS_MASK|M98504_INT_THERMSHDN_STATUS_MASK)
  81. /* MAX98504_REG_02_INTERRUPT_FLAGS*/
  82. #define M98504_INT_GENFAIL_FLAG_MASK (1<<7)
  83. #define M98504_INT_GENFAIL_FLAG_SHIFT 7
  84. #define M98504_INT_GENFAIL_FLAG_WIDTH 1
  85. #define M98504_INT_AUTHDONE_FLAG_MASK (1<<6)
  86. #define M98504_INT_AUTHDONE_FLAG_SHIFT 6
  87. #define M98504_INT_AUTHDONE_FLAG_WIDTH 1
  88. #define M98504_INT_VBATBROWN_FLAG_MASK (1<<5)
  89. #define M98504_INT_VBATBROWN_FLAG_SHIFT 5
  90. #define M98504_INT_VBATBROWN_FLAG_WIDTH 1
  91. #define M98504_INT_WATCHFAIL_FLAG_MASK (1<<4)
  92. #define M98504_INT_WATCHFAIL_FLAG_SHIFT 4
  93. #define M98504_INT_WATCHFAIL_FLAG_WIDTH 1
  94. #define M98504_INT_THERMWARN_END_FLAG_MASK (1<<3)
  95. #define M98504_INT_THERMWARN_END_FLAG_SHIFT 3
  96. #define M98504_INT_THERMWARN_END_FLAG_WIDTH 1
  97. #define M98504_INT_THERMWARN_BGN_FLAG_MASK (1<<2)
  98. #define M98504_INT_THERMWARN_BGN_FLAG_SHIFT 2
  99. #define M98504_INT_THERMWARN_BGN_FLAG_WIDTH 1
  100. #define M98504_INT_THERMSHDN_END_EN_MASK (1<<1)
  101. #define M98504_INT_THERMSHDN_END_FLAG_SHIFT 1
  102. #define M98504_INT_THERMSHDN_END_FLAG_WIDTH 1
  103. #define M98504_INT_THERMSHDN_BGN_FLAG_MASK (1<<0)
  104. #define M98504_INT_THERMSHDN_BGN_FLAG_SHIFT 0
  105. #define M98504_INT_THERMSHDN_BGN_FLAG_WIDTH 1
  106. /* MAX98504_REG_03_INTERRUPT_ENABLES*/
  107. #define M98504_INT_GENFAIL_EN_MASK (1<<7)
  108. #define M98504_INT_GENFAIL_EN_SHIFT 7
  109. #define M98504_INT_GENFAIL_EN_WIDTH 1
  110. #define M98504_INT_AUTHDONE_EN_MASK (1<<6)
  111. #define M98504_INT_AUTHDONE_EN_SHIFT 6
  112. #define M98504_INT_AUTHDONE_EN_WIDTH 1
  113. #define M98504_INT_VBATBROWN_EN_MASK (1<<5)
  114. #define M98504_INT_VBATBROWN_EN_SHIFT 5
  115. #define M98504_INT_VBATBROWN_EN_WIDTH 1
  116. #define M98504_INT_WATCHFAIL_EN_MASK (1<<4)
  117. #define M98504_INT_WATCHFAIL_EN_SHIFT 4
  118. #define M98504_INT_WATCHFAIL_EN_WIDTH 1
  119. #define M98504_INT_THERMWARN_END_EN_MASK (1<<3)
  120. #define M98504_INT_THERMWARN_END_EN_SHIFT 3
  121. #define M98504_INT_THERMWARN_END_EN_WIDTH 1
  122. #define M98504_INT_THERMWARN_BGN_EN_MASK (1<<2)
  123. #define M98504_INT_THERMWARN_BGN_EN_SHIFT 2
  124. #define M98504_INT_THERMWARN_BGN_EN_WIDTH 1
  125. #define M98504_INT_THERMSHDN_END_EN_MASK (1<<1)
  126. #define M98504_INT_THERMSHDN_END_EN_SHIFT 1
  127. #define M98504_INT_THERMSHDN_END_EN_WIDTH 1
  128. #define M98504_INT_THERMSHDN_BGN_EN_MASK (1<<0)
  129. #define M98504_INT_THERMSHDN_BGN_EN_SHIFT 0
  130. #define M98504_INT_THERMSHDN_BGN_EN_WIDTH 1
  131. /* MAX98504_REG_04_INTERRUPT_FLAG_CLEARS*/
  132. #define M98504_INT_FLAG_GENFAIL_CLR_MASK (1<<7)
  133. #define M98504_INT_FLAG_GENFAIL_CLR_SHIFT 7
  134. #define M98504_INT_FLAG_GENFAIL_CLR_WIDTH 1
  135. #define M98504_INT_FLAG_AUTHDONE_CLR_MASK (1<<6)
  136. #define M98504_INT_FLAG_AUTHDONE_CLR_SHIFT 6
  137. #define M98504_INT_FLAG_AUTHDONE_CLR_WIDTH 1
  138. #define M98504_INT_FLAG_VBATBROWN_CLR_MASK (1<<5)
  139. #define M98504_INT_FLAG_VBATBROWN_CLR_SHIFT 5
  140. #define M98504_INT_FLAG_VBATBROWN_CLR_WIDTH 1
  141. #define M98504_INT_FLAG_WATCHFAIL_CLR_MASK (1<<4)
  142. #define M98504_INT_FLAG_WATCHFAIL_CLR_SHIFT 4
  143. #define M98504_INT_FLAG_WATCHFAIL_CLR_WIDTH 1
  144. #define M98504_INT_FLAG_THERMWARN_END_CLR_MASK (1<<3)
  145. #define M98504_INT_FLAG_THERMWARN_END_CLR_SHIFT 3
  146. #define M98504_INT_FLAG_THERMWARN_END_CLR_WIDTH 1
  147. #define M98504_INT_FLAG_THERMWARN_BGN_CLR_MASK (1<<2)
  148. #define M98504_INT_FLAG_THERMWARN_BGN_CLR_SHIFT 2
  149. #define M98504_INT_FLAG_THERMWARN_BGN_CLR_WIDTH 1
  150. #define M98504_INT_FLAG_THERMSHDN_END_CLR_MASK (1<<1)
  151. #define M98504_INT_FLAG_THERMSHDN_END_CLR_SHIFT 1
  152. #define M98504_INT_FLAG_THERMSHDN_END_CLR_WIDTH 1
  153. #define M98504_INT_FLAG_THERMSHDN_BGN_CLR_MASK (1<<0)
  154. #define M98504_INT_FLAG_THERMSHDN_BGN_CLR_SHIFT 0
  155. #define M98504_INT_FLAG_THERMSHDN_BGN_CLR_WIDTH 1
  156. /* MAX98504_REG_10_GPIO_ENABLE*/
  157. #define M98504_GPIO_ENABLE_MASK (1<<0)
  158. #define M98504_GPIO_ENALBE_SHIFT 0
  159. #define M98504_GPIO_ENABLE_WIDTH 1
  160. /* MAX98504_REG_11_GPIO_CONFIG*/
  161. #define M98504_GPIO_OP_MODE_MASK (1<<0)
  162. #define M98504_GPIO_OP_MODE_SHIFT 0
  163. #define M98504_GPIO_OP_MODE_WIDTH 1
  164. /* MAX98504_REG_12_WATCHDOG_ENABLE*/
  165. #define M98504_WDOG_ENABLE_MASK (1<<0)
  166. #define M98504_WDOG_ENABLE_SHIFT 0
  167. #define M98504_WDOG_ENABLE_WIDTH 1
  168. /* MAX98504_REG_13_WATCHDOG_CONFIG*/
  169. #define M98504_WDOG_CONFIG_MASK (0x3<<0)
  170. #define M98504_WDOG_CONFIG_SHIFT 0
  171. #define M98504_WDOG_CONFIG_WIDTH 2
  172. #define M98504_WDOG_CONFIG_100MS 0
  173. #define M98504_WDOG_CONFIG_500MS 1
  174. #define M98504_WDOG_CONFIG_1000MS 2
  175. #define M98504_WDOG_CONFIG_2000MS 3
  176. /* MAX98504_REG_14_WATCHDOG_CLEAR*/
  177. #define M98504_WDOG_CLEAR_MASK (0xff<<0)
  178. #define M98504_WDOG_CLEAR_SHIFT 0
  179. #define M98504_WDOG_CLEAR_WIDTH 8
  180. /* MAX98504_REG_15_CLOCK_MONITOR_ENABLE*/
  181. #define M98504_CMON_ENA_MASK (1<<0)
  182. #define M98504_CMON_ENA_SHIFT 0
  183. #define M98504_CMON_ENA_WIDTH 1
  184. /* MAX98504_REG_16_PVDD_BROWNOUT_ENABLE*/
  185. #define M98504_PVDD_BROWNOUT_ENA_MASK (1<<0)
  186. #define M98504_PVDD_BROWNOUT_ENA_SHIFT 0
  187. #define M98504_PVDD_BROWNOUT_ENA_WIDTH 1
  188. /* MAX98504_REG_17_PVDD_BROWNOUT_CONFIG_1*/
  189. #define M98504_PVDD_BROWNOUT_CFG1_CODE_MASK (0x1f<<3)
  190. #define M98504_PVDD_BROWNOUT_CFG1_CODE_SHIFT 3
  191. #define M98504_PVDD_BROWNOUT_CFG1_CODE_WIDTH 5
  192. #define M98504_PVDD_BROWNOUT_CFG1_MAX_ATTEN_MASK (0x7<<0)
  193. #define M98504_PVDD_BROWNOUT_CFG1_MAX_ATTEN_SHIFT 0
  194. #define M98504_PVDD_BROWNOUT_CFG1_MAX_ATTEN_WIDTH 3
  195. /* MAX98504_REG_18_PVDD_BROWNOUT_CONFIG_2*/
  196. #define M98504_PVDD_BROWNOUT_CFG2_ATTK_HOLD_MASK (0xff<<0)
  197. #define M98504_PVDD_BROWNOUT_CFG2_ATTK_HOLD_SHIFT 0
  198. #define M98504_PVDD_BROWNOUT_CFG2_ATTK_HOLD_WIDTH 8
  199. /* MAX98504_REG_19_PVDD_BROWNOUT_CONFIG_3*/
  200. #define M98504_PVDD_BROWNOUT_CFG3_TIMED_HOLD_MASK (0xff<<0)
  201. #define M98504_PVDD_BROWNOUT_CFG3_TIMED_HOLD_SHIFT 0
  202. #define M98504_PVDD_BROWNOUT_CFG3_TIMED_HOLD_WIDTH 8
  203. /* MAX98504_REG_1A_PVDD_BROWNOUT_CONFIG_4*/
  204. #define M98504_PVDD_BROWNOUT_CFG4_RELEASE_MASK (0xff<<0)
  205. #define M98504_PVDD_BROWNOUT_CFG4_RELEASE_SHIFT 0
  206. #define M98504_PVDD_BROWNOUT_CFG4_RELEASE_WIDTH 8
  207. /* MAX98504_REG_20_PCM_RX_ENABLES*/
  208. #define M98504_PCM_RX_EN_CH7_MASK (1<<7)
  209. #define M98504_PCM_RX_EN_CH7_SHIFT 7
  210. #define M98504_PCM_RX_EN_CH7_WIDTH 1
  211. #define M98504_PCM_RX_EN_CH6_MASK (1<<6)
  212. #define M98504_PCM_RX_EN_CH6_SHIFT 6
  213. #define M98504_PCM_RX_EN_CH6_WIDTH 1
  214. #define M98504_PCM_RX_EN_CH5_MASK (1<<5)
  215. #define M98504_PCM_RX_EN_CH5_SHIFT 5
  216. #define M98504_PCM_RX_EN_CH5_WIDTH 1
  217. #define M98504_PCM_RX_EN_CH4_MASK (1<<4)
  218. #define M98504_PCM_RX_EN_CH4_SHIFT 4
  219. #define M98504_PCM_RX_EN_CH4_WIDTH 1
  220. #define M98504_PCM_RX_EN_CH3_MASK (1<<3)
  221. #define M98504_PCM_RX_EN_CH3_SHIFT 3
  222. #define M98504_PCM_RX_EN_CH3_WIDTH 1
  223. #define M98504_PCM_RX_EN_CH2_MASK (1<<2)
  224. #define M98504_PCM_RX_EN_CH2_SHIFT 2
  225. #define M98504_PCM_RX_EN_CH2_WIDTH 1
  226. #define M98504_PCM_RX_EN_CH1_MASK (1<<1)
  227. #define M98504_PCM_RX_EN_CH1_SHIFT 1
  228. #define M98504_PCM_RX_EN_CH1_WIDTH 1
  229. #define M98504_PCM_RX_EN_CH0_MASK (1<<0)
  230. #define M98504_PCM_RX_EN_CH0_SHIFT 0
  231. #define M98504_PCM_RX_EN_CH0_WIDTH 1
  232. /* MAX98504_REG_21_PCM_TX_ENABLES*/
  233. #define M98504_PCM_TX_EN_CH7_MASK (1<<7)
  234. #define M98504_PCM_TX_EN_CH7_SHIFT 7
  235. #define M98504_PCM_TX_EN_CH7_WIDTH 1
  236. #define M98504_PCM_TX_EN_CH6_MASK (1<<6)
  237. #define M98504_PCM_TX_EN_CH6_SHIFT 6
  238. #define M98504_PCM_TX_EN_CH6_WIDTH 1
  239. #define M98504_PCM_TX_EN_CH5_MASK (1<<5)
  240. #define M98504_PCM_TX_EN_CH5_SHIFT 5
  241. #define M98504_PCM_TX_EN_CH5_WIDTH 1
  242. #define M98504_PCM_TX_EN_CH4_MASK (1<<4)
  243. #define M98504_PCM_TX_EN_CH4_SHIFT 4
  244. #define M98504_PCM_TX_EN_CH4_WIDTH 1
  245. #define M98504_PCM_TX_EN_CH3_MASK (1<<3)
  246. #define M98504_PCM_TX_EN_CH3_SHIFT 3
  247. #define M98504_PCM_TX_EN_CH3_WIDTH 1
  248. #define M98504_PCM_TX_EN_CH2_MASK (1<<2)
  249. #define M98504_PCM_TX_EN_CH2_SHIFT 2
  250. #define M98504_PCM_TX_EN_CH2_WIDTH 1
  251. #define M98504_PCM_TX_EN_CH1_MASK (1<<1)
  252. #define M98504_PCM_TX_EN_CH1_SHIFT 1
  253. #define M98504_PCM_TX_EN_CH1_WIDTH 1
  254. #define M98504_PCM_TX_EN_CH0_MASK (1<<0)
  255. #define M98504_PCM_TX_EN_CH0_SHIFT 0
  256. #define M98504_PCM_TX_EN_CH0_WIDTH 1
  257. /* MAX98504_REG_22_PCM_TX_HIZ_CONTROL*/
  258. #define M98504_PCM_TX_HIZ_CTRL_CH7_MASK (1<<7)
  259. #define M98504_PCM_TX_HIZ_CTRL_CH7_SHIFT 7
  260. #define M98504_PCM_TX_HIZ_CTRL_CH7_WIDTH 1
  261. #define M98504_PCM_TX_HIZ_CTRL_CH6_MASK (1<<6)
  262. #define M98504_PCM_TX_HIZ_CTRL_CH6_SHIFT 6
  263. #define M98504_PCM_TX_HIZ_CTRL_CH6_WIDTH 1
  264. #define M98504_PCM_TX_HIZ_CTRL_CH5_MASK (1<<5)
  265. #define M98504_PCM_TX_HIZ_CTRL_CH5_SHIFT 5
  266. #define M98504_PCM_TX_HIZ_CTRL_CH5_WIDTH 1
  267. #define M98504_PCM_TX_HIZ_CTRL_CH4_MASK (1<<4)
  268. #define M98504_PCM_TX_HIZ_CTRL_CH4_SHIFT 4
  269. #define M98504_PCM_TX_HIZ_CTRL_CH4_WIDTH 1
  270. #define M98504_PCM_TX_HIZ_CTRL_CH3_MASK (1<<3)
  271. #define M98504_PCM_TX_HIZ_CTRL_CH3_SHIFT 3
  272. #define M98504_PCM_TX_HIZ_CTRL_CH3_WIDTH 1
  273. #define M98504_PCM_TX_HIZ_CTRL_CH2_MASK (1<<2)
  274. #define M98504_PCM_TX_HIZ_CTRL_CH2_SHIFT 2
  275. #define M98504_PCM_TX_HIZ_CTRL_CH2_WIDTH 1
  276. #define M98504_PCM_TX_HIZ_CTRL_CH1_MASK (1<<1)
  277. #define M98504_PCM_TX_HIZ_CTRL_CH1_SHIFT 1
  278. #define M98504_PCM_TX_HIZ_CTRL_CH1_WIDTH 1
  279. #define M98504_PCM_TX_HIZ_CTRL_CH0_MASK (1<<0)
  280. #define M98504_PCM_TX_HIZ_CTRL_CH0_SHIFT 0
  281. #define M98504_PCM_TX_HIZ_CTRL_CH0_WIDTH 1
  282. /* MAX98504_REG_23_PCM_TX_CHANNEL_SOURCES*/
  283. #define M98504_PCM_TX_SOURCE_CH7_MASK (1<<7)
  284. #define M98504_PCM_TX_SOURCE_CH7_SHIFT 7
  285. #define M98504_PCM_TX_SOURCE_CH7_WIDTH 1
  286. #define M98504_PCM_TX_SOURCE_CH6_MASK (1<<6)
  287. #define M98504_PCM_TX_SOURCE_CH6_SHIFT 6
  288. #define M98504_PCM_TX_SOURCE_CH6_WIDTH 1
  289. #define M98504_PCM_TX_SOURCE_CH5_MASK (1<<5)
  290. #define M98504_PCM_TX_SOURCE_CH5_SHIFT 5
  291. #define M98504_PCM_TX_SOURCE_CH5_WIDTH 1
  292. #define M98504_PCM_TX_SOURCE_CH4_MASK (1<<4)
  293. #define M98504_PCM_TX_SOURCE_CH4_SHIFT 4
  294. #define M98504_PCM_TX_SOURCE_CH4_WIDTH 1
  295. #define M98504_PCM_TX_SOURCE_CH3_MASK (1<<3)
  296. #define M98504_PCM_TX_SOURCE_CH3_SHIFT 3
  297. #define M98504_PCM_TX_SOURCE_CH3_WIDTH 1
  298. #define M98504_PCM_TX_SOURCE_CH2_MASK (1<<2)
  299. #define M98504_PCM_TX_SOURCE_CH2_SHIFT 2
  300. #define M98504_PCM_TX_SOURCE_CH2_WIDTH 1
  301. #define M98504_PCM_TX_SOURCE_CH1_MASK (1<<1)
  302. #define M98504_PCM_TX_SOURCE_CH1_SHIFT 1
  303. #define M98504_PCM_TX_SOURCE_CH1_WIDTH 1
  304. #define M98504_PCM_TX_SOURCE_CH0_MASK (1<<0)
  305. #define M98504_PCM_TX_SOURCE_CH0_SHIFT 0
  306. #define M98504_PCM_TX_SOURCE_CH0_WIDTH 1
  307. /* MAX98504_REG_24_PCM_MODE_CONFIG*/
  308. #define M98504_PCM_MODE_CFG_CH_SIZE_MASK (0x3<<6)
  309. #define M98504_PCM_MODE_CFG_CH_SIZE_SHIFT 6
  310. #define M98504_PCM_MODE_CFG_CH_SIZE_WIDTH 2
  311. #define M98504_PCM_MODE_CFG_CH_SIZE_8_MASK \
  312. (0<<M98504_PCM_MODE_CFG_CH_SIZE_SHIFT)
  313. #define M98504_PCM_MODE_CFG_CH_SIZE_16_MASK \
  314. (1<<M98504_PCM_MODE_CFG_CH_SIZE_SHIFT)
  315. #define M98504_PCM_MODE_CFG_CH_SIZE_24_MASK \
  316. (2<<M98504_PCM_MODE_CFG_CH_SIZE_SHIFT)
  317. #define M98504_PCM_MODE_CFG_CH_SIZE_32_MASK \
  318. (3<<M98504_PCM_MODE_CFG_CH_SIZE_SHIFT)
  319. #define M98504_PCM_MODE_CFG_FORMAT_MASK (0x7<<3)
  320. #define M98504_PCM_MODE_CFG_FORMAT_SHIFT 3
  321. #define M98504_PCM_MODE_CFG_FORMAT_WIDTH 3
  322. #define M98504_PCM_MODE_CFG_FORMAT_I2S_MASK \
  323. (0<<M98504_PCM_MODE_CFG_FORMAT_SHIFT)
  324. #define M98504_PCM_MODE_CFG_FORMAT_LJ_MASK \
  325. (1<<M98504_PCM_MODE_CFG_FORMAT_SHIFT)
  326. #define M98504_PCM_MODE_CFG_FORMAT_RJ_MASK \
  327. (2<<M98504_PCM_MODE_CFG_FORMAT_SHIFT)
  328. #define M98504_PCM_MODE_CFG_FORMAT_TDM_MODE1_MASK \
  329. (3<<M98504_PCM_MODE_CFG_FORMAT_SHIFT)
  330. #define M98504_PCM_MODE_CFG_FORMAT_TDM_MODE2_MASK \
  331. (4<<M98504_PCM_MODE_CFG_FORMAT_SHIFT)
  332. #define M98504_PCM_MODE_CFG_BCLKEDGE_MASK (1<<2)
  333. #define M98504_PCM_MODE_CFG_BCLKEDGE_SHIFT 2
  334. #define M98504_PCM_MODE_CFG_BCLKEDGE_WIDTH 1
  335. #define M98504_PCM_MODE_CFG_CHSEL_MASK (1<<1)
  336. #define M98504_PCM_MODE_CFG_CHSEL_SHIFT 1
  337. #define M98504_PCM_MODE_CFG_CHSEL_WIDTH 1
  338. #define M98504_PCM_MODE_CFG_TX_EXTRA_HIZ_MASK (1<<0)
  339. #define M98504_PCM_MODE_CFG_TX_EXTRA_HIZ_SHIFT 0
  340. #define M98504_PCM_MODE_CFG_TX_EXTRA_HIZ_WIDTH 1
  341. /* MAX98504_REG_25_PCM_DSP_CONFIG*/
  342. #define M98504_PCM_DSP_CFG_TX_DITH_EN_MASK (1<<7)
  343. #define M98504_PCM_DSP_CFG_TX_DITH_EN_SHIFT 7
  344. #define M98504_PCM_DSP_CFG_TX_DITH_EN_WIDTH 1
  345. #define M98504_PCM_DSP_CFG_MEAS_DCBLK_EN_MASK (1<<6)
  346. #define M98504_PCM_DSP_CFG_MEAS_DCBLK_EN_SHIFT 6
  347. #define M98504_PCM_DSP_CFG_MEAS_DCBLK_EN_WIDTH 1
  348. #define M98504_PCM_DSP_CFG_RX_DITH_EN_MASK (1<<5)
  349. #define M98504_PCM_DSP_CFG_RX_DITH_EN_SHIFT 5
  350. #define M98504_PCM_DSP_CFG_RX_DITH_EN_WIDTH 1
  351. #define M98504_PCM_DSP_CFG_RX_FLT_MODE_MASK (1<<4)
  352. #define M98504_PCM_DSP_CFG_RX_FLT_MODE_SHIFT 4
  353. #define M98504_PCM_DSP_CFG_RX_FLT_MODE_WIDTH 1
  354. #define M98504_PCM_DSP_CFG_FLT_MASK (\
  355. M98504_PCM_DSP_CFG_TX_DITH_EN_MASK|\
  356. M98504_PCM_DSP_CFG_MEAS_DCBLK_EN_MASK|\
  357. M98504_PCM_DSP_CFG_RX_DITH_EN_MASK|\
  358. M98504_PCM_DSP_CFG_RX_FLT_MODE_MASK)
  359. #define M98504_PCM_DSP_CFG_FLT_SHIFT 4
  360. #define M98504_PCM_DSP_CFG_FLT_WIDTH 4
  361. #define M98504_PCM_DSP_CFG_RX_GAIN_MASK (0xf<<0)
  362. #define M98504_PCM_DSP_CFG_RX_GAIN_SHIFT 0
  363. #define M98504_PCM_DSP_CFG_RX_GAIN_WIDTH 4
  364. /* MAX98504_REG_26_PCM_CLOCK_SETUP*/
  365. #define M98504_PCM_CLK_SETUP_BSEL_MASK (0xf<<0)
  366. #define M98504_PCM_CLK_SETUP_BSEL_SHIFT 0
  367. #define M98504_PCM_CLK_SETUP_BSEL_WIDTH 4
  368. #define M98094_PCM_CLK_SETUP_DAI_BSEL64 (1<<2)
  369. /* MAX98504_REG_27_PCM_SAMPLE_RATE_SETUP*/
  370. #define M98504_PCM_SR_SETUP_SPK_SR_MASK (0xf<<4)
  371. #define M98504_PCM_SR_SETUP_SPK_SR_SHIFT 4
  372. #define M98504_PCM_SR_SETUP_SPK_SR_WIDTH 4
  373. #define M98504_PCM_SR_SETUP_MEAS_SR_MASK (0xf<<0)
  374. #define M98504_PCM_SR_SETUP_MEAS_SR_SHIFT 0
  375. #define M98504_PCM_SR_SETUP_MEAS_SR_WIDTH 4
  376. /* MAX98504_REG_28_PCM_TO_SPEAKER_MONOMIX*/
  377. #define M98504_PCM_TO_SPK_MONOMIX_CFG_MASK (0x3<<6)
  378. #define M98504_PCM_TO_SPK_MONOMIX_CFG_SHIFT 6
  379. #define M98504_PCM_TO_SPK_MONOMIX_CFG_WIDTH 2
  380. #define M98504_PCM_TO_SPK_MONOMIX_CH1_SRC_MASK (0x7<<3)
  381. #define M98504_PCM_TO_SPK_MONOMIX_CH1_SRC_SHIFT 3
  382. #define M98504_PCM_TO_SPK_MONOMIX_CH1_SRC_WIDTH 3
  383. #define M98504_PCM_TO_SPK_MONOMIX_CH0_SRC_MASK (0x7<<0)
  384. #define M98504_PCM_TO_SPK_MONOMIX_CH0_SRC_SHIFT 0
  385. #define M98504_PCM_TO_SPK_MONOMIX_CH0_SRC_WIDTH 3
  386. /* MAX98504_REG_30_PDM_TX_ENABLES*/
  387. #define M98504_PDM_EX_EN_CH1_MASK (1<<1)
  388. #define M98504_PDM_EX_EN_CH1_SHIFT 1
  389. #define M98504_PDM_EX_EN_CH1_WIDTH 1
  390. #define M98504_PDM_EX_EN_CH0_MASK (1<<0)
  391. #define M98504_PDM_EX_EN_CH0_SHIFT 0
  392. #define M98504_PDM_EX_EN_CH0_WIDTH 1
  393. /* MAX98504_REG_31_PDM_TX_HIZ_CONTROL*/
  394. #define M98504_PDM_EX_HIZ_CTRL_CH1_MASK (1<<1)
  395. #define M98504_PDM_EX_HIZ_CTRL_CH1_SHIFT 1
  396. #define M98504_PDM_EX_HIZ_CTRL_CH1_WIDTH 1
  397. #define M98504_PDM_EX_HIZ_CTRL_CH0_MASK (1<<0)
  398. #define M98504_PDM_EX_HIZ_CTRL_CH0_SHIFT 0
  399. #define M98504_PDM_EX_HIZ_CTRL_CH0_WIDTH 1
  400. /* MAX98504_REG_32_PDM_TX_CONTROL*/
  401. #define M98504_PDM_EX_CTRL_CH1_SRC_MASK (1<<1)
  402. #define M98504_PDM_EX_CTRL_CH1_SRC_SHIFT 1
  403. #define M98504_PDM_EX_CTRL_CH1_SRC_WIDTH 1
  404. #define M98504_PDM_EX_CTRL_CH0_SRC_MASK (1<<0)
  405. #define M98504_PDM_EX_CTRL_CH0_SRC_SHIFT 0
  406. #define M98504_PDM_EX_CTRL_CH0_SRC_WIDTH 1
  407. /* MAX98504_REG_33_PDM_RX_ENABLE*/
  408. #define M98504_PDM_RX_EN_MASK (1<<0)
  409. #define M98504_PDM_RX_EN_SHIFT 0
  410. #define M98504_PDM_RX_EN_WIDTH 1
  411. /* MAX98504_REG_34_SPEAKER_ENABLE*/
  412. #define M98504_SPK_EN_MASK (1<<0)
  413. #define M98504_SPK_EN_SHIFT 0
  414. #define M98504_SPK_EN_WIDTH 1
  415. /* MAX98504_REG_35_SPEAKER_SOURCE_SELECT*/
  416. #define M98504_SPK_SRC_SEL_MASK (0x3<<0)
  417. #define M98504_SPK_SRC_SEL_SHIFT 0
  418. #define M98504_SPK_SRC_SEL_WIDTH 2
  419. /* MAX98504_REG_36_MEASUREMENT_ENABLES*/
  420. #define M98504_MEAS_I_EN_MASK (1<<1)
  421. #define M98504_MEAS_I_EN_SHIFT 1
  422. #define M98504_MEAS_I_EN_WIDTH 1
  423. #define M98504_MEAS_V_EN_MASK (1<<0)
  424. #define M98504_MEAS_V_EN_SHIFT 0
  425. #define M98504_MEAS_V_EN_WIDTH 1
  426. /* MAX98504_REG_37_ANALOGUE_INPUT_GAIN*/
  427. #define M98504_ANALOG_INPUT_GAIN_MASK (1<<0)
  428. #define M98504_ANALOG_INPUT_GAIN_SHIFT 0
  429. #define M98504_ANALOG_INPUT_GAIN_WIDTH 1
  430. /* MAX98504_REG_38_TEMPERATURE_LIMIT_CONFIG*/
  431. #define M98504_TEMP_LIMIT_CFG_TEMPWARN_SEL_MASK (0x2<<2)
  432. #define M98504_TEMP_LIMIT_CFG_TEMPWARN_SEL_SHIFT 2
  433. #define M98504_TEMP_LIMIT_CFG_TEMPWARN_SEL_WIDTH 2
  434. #define M98504_TEMP_LIMIT_CFG_TEMP_SEL_MASK (0x2<<0)
  435. #define M98504_TEMP_LIMIT_CFG_TEMP_SEL_SHIFT 0
  436. #define M98504_TEMP_LIMIT_CFG_TEMP_SEL_WIDTH 2
  437. /* MAX98504_REG_39_ANALOGUE_SPARE*/
  438. #define M98504_ANALOG_SPARE_MASK (0xff<<0)
  439. #define M98504_ANALOG_SPARE_SHIFT 0
  440. #define M98504_ANALOG_SPARE_WIDTH 8
  441. /* MAX98504_REG_40_GLOBAL_ENABLE*/
  442. #define M98504_GLOBAL_EN_MASK (1<<0)
  443. #define M98504_GLOBAL_EN_SHIFT 0
  444. #define M98504_GLOBAL_EN_WIDTH 1
  445. /* MAX98504_REG_41_SOFTWARE_RESET*/
  446. #define M98504_SOFTWARE_RESET_MASK (1<<0)
  447. #define M98504_SOFTWARE_RESET_SHIFT 0
  448. #define M98504_SOFTWARE_RESET_WIDTH 1
  449. enum max98504_type {
  450. MAX98504,
  451. };
  452. struct max98504_cdata {
  453. unsigned int rate;
  454. unsigned int fmt;
  455. };
  456. struct max98504_priv {
  457. struct snd_soc_codec *codec;
  458. enum max98504_type devtype;
  459. void *control_data;
  460. struct max98504_pdata *pdata;
  461. unsigned int sysclk;
  462. struct max98504_cdata dai[1];
  463. unsigned int status;
  464. #ifdef USE_DSM_LOG
  465. struct class *dev_log_class;
  466. struct device *dev_log;
  467. #endif
  468. };
  469. #endif