da7219.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820
  1. /*
  2. * da7219.h - DA7219 ALSA SoC Codec Driver
  3. *
  4. * Copyright (c) 2015 Dialog Semiconductor
  5. *
  6. * Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. */
  13. #ifndef __DA7219_H
  14. #define __DA7219_H
  15. #include <linux/regmap.h>
  16. #include <linux/regulator/consumer.h>
  17. #include <sound/da7219.h>
  18. /*
  19. * Registers
  20. */
  21. #define DA7219_MIC_1_GAIN_STATUS 0x6
  22. #define DA7219_MIXIN_L_GAIN_STATUS 0x8
  23. #define DA7219_ADC_L_GAIN_STATUS 0xA
  24. #define DA7219_DAC_L_GAIN_STATUS 0xC
  25. #define DA7219_DAC_R_GAIN_STATUS 0xD
  26. #define DA7219_HP_L_GAIN_STATUS 0xE
  27. #define DA7219_HP_R_GAIN_STATUS 0xF
  28. #define DA7219_MIC_1_SELECT 0x10
  29. #define DA7219_CIF_TIMEOUT_CTRL 0x12
  30. #define DA7219_CIF_CTRL 0x13
  31. #define DA7219_SR_24_48 0x16
  32. #define DA7219_SR 0x17
  33. #define DA7219_CIF_I2C_ADDR_CFG 0x1B
  34. #define DA7219_PLL_CTRL 0x20
  35. #define DA7219_PLL_FRAC_TOP 0x22
  36. #define DA7219_PLL_FRAC_BOT 0x23
  37. #define DA7219_PLL_INTEGER 0x24
  38. #define DA7219_PLL_SRM_STS 0x25
  39. #define DA7219_DIG_ROUTING_DAI 0x2A
  40. #define DA7219_DAI_CLK_MODE 0x2B
  41. #define DA7219_DAI_CTRL 0x2C
  42. #define DA7219_DAI_TDM_CTRL 0x2D
  43. #define DA7219_DIG_ROUTING_DAC 0x2E
  44. #define DA7219_ALC_CTRL1 0x2F
  45. #define DA7219_DAI_OFFSET_LOWER 0x30
  46. #define DA7219_DAI_OFFSET_UPPER 0x31
  47. #define DA7219_REFERENCES 0x32
  48. #define DA7219_MIXIN_L_SELECT 0x33
  49. #define DA7219_MIXIN_L_GAIN 0x34
  50. #define DA7219_ADC_L_GAIN 0x36
  51. #define DA7219_ADC_FILTERS1 0x38
  52. #define DA7219_MIC_1_GAIN 0x39
  53. #define DA7219_SIDETONE_CTRL 0x3A
  54. #define DA7219_SIDETONE_GAIN 0x3B
  55. #define DA7219_DROUTING_ST_OUTFILT_1L 0x3C
  56. #define DA7219_DROUTING_ST_OUTFILT_1R 0x3D
  57. #define DA7219_DAC_FILTERS5 0x40
  58. #define DA7219_DAC_FILTERS2 0x41
  59. #define DA7219_DAC_FILTERS3 0x42
  60. #define DA7219_DAC_FILTERS4 0x43
  61. #define DA7219_DAC_FILTERS1 0x44
  62. #define DA7219_DAC_L_GAIN 0x45
  63. #define DA7219_DAC_R_GAIN 0x46
  64. #define DA7219_CP_CTRL 0x47
  65. #define DA7219_HP_L_GAIN 0x48
  66. #define DA7219_HP_R_GAIN 0x49
  67. #define DA7219_MIXOUT_L_SELECT 0x4B
  68. #define DA7219_MIXOUT_R_SELECT 0x4C
  69. #define DA7219_SYSTEM_MODES_INPUT 0x50
  70. #define DA7219_SYSTEM_MODES_OUTPUT 0x51
  71. #define DA7219_MICBIAS_CTRL 0x62
  72. #define DA7219_MIC_1_CTRL 0x63
  73. #define DA7219_MIXIN_L_CTRL 0x65
  74. #define DA7219_ADC_L_CTRL 0x67
  75. #define DA7219_DAC_L_CTRL 0x69
  76. #define DA7219_DAC_R_CTRL 0x6A
  77. #define DA7219_HP_L_CTRL 0x6B
  78. #define DA7219_HP_R_CTRL 0x6C
  79. #define DA7219_MIXOUT_L_CTRL 0x6E
  80. #define DA7219_MIXOUT_R_CTRL 0x6F
  81. #define DA7219_CHIP_ID1 0x81
  82. #define DA7219_CHIP_ID2 0x82
  83. #define DA7219_CHIP_REVISION 0x83
  84. #define DA7219_IO_CTRL 0x91
  85. #define DA7219_GAIN_RAMP_CTRL 0x92
  86. #define DA7219_PC_COUNT 0x94
  87. #define DA7219_CP_VOL_THRESHOLD1 0x95
  88. #define DA7219_CP_DELAY 0x96
  89. #define DA7219_DIG_CTRL 0x99
  90. #define DA7219_ALC_CTRL2 0x9A
  91. #define DA7219_ALC_CTRL3 0x9B
  92. #define DA7219_ALC_NOISE 0x9C
  93. #define DA7219_ALC_TARGET_MIN 0x9D
  94. #define DA7219_ALC_TARGET_MAX 0x9E
  95. #define DA7219_ALC_GAIN_LIMITS 0x9F
  96. #define DA7219_ALC_ANA_GAIN_LIMITS 0xA0
  97. #define DA7219_ALC_ANTICLIP_CTRL 0xA1
  98. #define DA7219_ALC_ANTICLIP_LEVEL 0xA2
  99. #define DA7219_ALC_OFFSET_AUTO_M_L 0xA3
  100. #define DA7219_ALC_OFFSET_AUTO_U_L 0xA4
  101. #define DA7219_DAC_NG_SETUP_TIME 0xAF
  102. #define DA7219_DAC_NG_OFF_THRESH 0xB0
  103. #define DA7219_DAC_NG_ON_THRESH 0xB1
  104. #define DA7219_DAC_NG_CTRL 0xB2
  105. #define DA7219_TONE_GEN_CFG1 0xB4
  106. #define DA7219_TONE_GEN_CFG2 0xB5
  107. #define DA7219_TONE_GEN_CYCLES 0xB6
  108. #define DA7219_TONE_GEN_FREQ1_L 0xB7
  109. #define DA7219_TONE_GEN_FREQ1_U 0xB8
  110. #define DA7219_TONE_GEN_FREQ2_L 0xB9
  111. #define DA7219_TONE_GEN_FREQ2_U 0xBA
  112. #define DA7219_TONE_GEN_ON_PER 0xBB
  113. #define DA7219_TONE_GEN_OFF_PER 0xBC
  114. #define DA7219_SYSTEM_STATUS 0xE0
  115. #define DA7219_SYSTEM_ACTIVE 0xFD
  116. /*
  117. * Bit Fields
  118. */
  119. #define DA7219_SWITCH_EN_MAX 0x1
  120. /* DA7219_MIC_1_GAIN_STATUS = 0x6 */
  121. #define DA7219_MIC_1_AMP_GAIN_STATUS_SHIFT 0
  122. #define DA7219_MIC_1_AMP_GAIN_STATUS_MASK (0x7 << 0)
  123. #define DA7219_MIC_1_AMP_GAIN_MAX 0x7
  124. /* DA7219_MIXIN_L_GAIN_STATUS = 0x8 */
  125. #define DA7219_MIXIN_L_AMP_GAIN_STATUS_SHIFT 0
  126. #define DA7219_MIXIN_L_AMP_GAIN_STATUS_MASK (0xF << 0)
  127. /* DA7219_ADC_L_GAIN_STATUS = 0xA */
  128. #define DA7219_ADC_L_DIGITAL_GAIN_STATUS_SHIFT 0
  129. #define DA7219_ADC_L_DIGITAL_GAIN_STATUS_MASK (0x7F << 0)
  130. /* DA7219_DAC_L_GAIN_STATUS = 0xC */
  131. #define DA7219_DAC_L_DIGITAL_GAIN_STATUS_SHIFT 0
  132. #define DA7219_DAC_L_DIGITAL_GAIN_STATUS_MASK (0x7F << 0)
  133. /* DA7219_DAC_R_GAIN_STATUS = 0xD */
  134. #define DA7219_DAC_R_DIGITAL_GAIN_STATUS_SHIFT 0
  135. #define DA7219_DAC_R_DIGITAL_GAIN_STATUS_MASK (0x7F << 0)
  136. /* DA7219_HP_L_GAIN_STATUS = 0xE */
  137. #define DA7219_HP_L_AMP_GAIN_STATUS_SHIFT 0
  138. #define DA7219_HP_L_AMP_GAIN_STATUS_MASK (0x3F << 0)
  139. /* DA7219_HP_R_GAIN_STATUS = 0xF */
  140. #define DA7219_HP_R_AMP_GAIN_STATUS_SHIFT 0
  141. #define DA7219_HP_R_AMP_GAIN_STATUS_MASK (0x3F << 0)
  142. /* DA7219_MIC_1_SELECT = 0x10 */
  143. #define DA7219_MIC_1_AMP_IN_SEL_SHIFT 0
  144. #define DA7219_MIC_1_AMP_IN_SEL_MASK (0x3 << 0)
  145. /* DA7219_CIF_TIMEOUT_CTRL = 0x12 */
  146. #define DA7219_I2C_TIMEOUT_EN_SHIFT 0
  147. #define DA7219_I2C_TIMEOUT_EN_MASK (0x1 << 0)
  148. /* DA7219_CIF_CTRL = 0x13 */
  149. #define DA7219_CIF_I2C_WRITE_MODE_SHIFT 0
  150. #define DA7219_CIF_I2C_WRITE_MODE_MASK (0x1 << 0)
  151. #define DA7219_CIF_REG_SOFT_RESET_SHIFT 7
  152. #define DA7219_CIF_REG_SOFT_RESET_MASK (0x1 << 7)
  153. /* DA7219_SR_24_48 = 0x16 */
  154. #define DA7219_SR_24_48_SHIFT 0
  155. #define DA7219_SR_24_48_MASK (0x1 << 0)
  156. /* DA7219_SR = 0x17 */
  157. #define DA7219_SR_SHIFT 0
  158. #define DA7219_SR_MASK (0xF << 0)
  159. #define DA7219_SR_8000 (0x01 << 0)
  160. #define DA7219_SR_11025 (0x02 << 0)
  161. #define DA7219_SR_12000 (0x03 << 0)
  162. #define DA7219_SR_16000 (0x05 << 0)
  163. #define DA7219_SR_22050 (0x06 << 0)
  164. #define DA7219_SR_24000 (0x07 << 0)
  165. #define DA7219_SR_32000 (0x09 << 0)
  166. #define DA7219_SR_44100 (0x0A << 0)
  167. #define DA7219_SR_48000 (0x0B << 0)
  168. #define DA7219_SR_88200 (0x0E << 0)
  169. #define DA7219_SR_96000 (0x0F << 0)
  170. /* DA7219_CIF_I2C_ADDR_CFG = 0x1B */
  171. #define DA7219_CIF_I2C_ADDR_CFG_SHIFT 0
  172. #define DA7219_CIF_I2C_ADDR_CFG_MASK (0x3 << 0)
  173. /* DA7219_PLL_CTRL = 0x20 */
  174. #define DA7219_PLL_INDIV_SHIFT 2
  175. #define DA7219_PLL_INDIV_MASK (0x7 << 2)
  176. #define DA7219_PLL_INDIV_2_TO_4_5_MHZ (0x0 << 2)
  177. #define DA7219_PLL_INDIV_4_5_TO_9_MHZ (0x1 << 2)
  178. #define DA7219_PLL_INDIV_9_TO_18_MHZ (0x2 << 2)
  179. #define DA7219_PLL_INDIV_18_TO_36_MHZ (0x3 << 2)
  180. #define DA7219_PLL_INDIV_36_TO_54_MHZ (0x4 << 2)
  181. #define DA7219_PLL_MCLK_SQR_EN_SHIFT 5
  182. #define DA7219_PLL_MCLK_SQR_EN_MASK (0x1 << 5)
  183. #define DA7219_PLL_MODE_SHIFT 6
  184. #define DA7219_PLL_MODE_MASK (0x3 << 6)
  185. #define DA7219_PLL_MODE_BYPASS (0x0 << 6)
  186. #define DA7219_PLL_MODE_NORMAL (0x1 << 6)
  187. #define DA7219_PLL_MODE_SRM (0x2 << 6)
  188. /* DA7219_PLL_FRAC_TOP = 0x22 */
  189. #define DA7219_PLL_FBDIV_FRAC_TOP_SHIFT 0
  190. #define DA7219_PLL_FBDIV_FRAC_TOP_MASK (0x1F << 0)
  191. /* DA7219_PLL_FRAC_BOT = 0x23 */
  192. #define DA7219_PLL_FBDIV_FRAC_BOT_SHIFT 0
  193. #define DA7219_PLL_FBDIV_FRAC_BOT_MASK (0xFF << 0)
  194. /* DA7219_PLL_INTEGER = 0x24 */
  195. #define DA7219_PLL_FBDIV_INTEGER_SHIFT 0
  196. #define DA7219_PLL_FBDIV_INTEGER_MASK (0x7F << 0)
  197. /* DA7219_PLL_SRM_STS = 0x25 */
  198. #define DA7219_PLL_SRM_STATE_SHIFT 0
  199. #define DA7219_PLL_SRM_STATE_MASK (0xF << 0)
  200. #define DA7219_PLL_SRM_STATUS_SHIFT 4
  201. #define DA7219_PLL_SRM_STATUS_MASK (0xF << 4)
  202. #define DA7219_PLL_SRM_STS_MCLK (0x1 << 4)
  203. #define DA7219_PLL_SRM_STS_SRM_LOCK (0x1 << 7)
  204. /* DA7219_DIG_ROUTING_DAI = 0x2A */
  205. #define DA7219_DAI_L_SRC_SHIFT 0
  206. #define DA7219_DAI_L_SRC_MASK (0x3 << 0)
  207. #define DA7219_DAI_R_SRC_SHIFT 4
  208. #define DA7219_DAI_R_SRC_MASK (0x3 << 4)
  209. #define DA7219_OUT_SRC_MAX 4
  210. /* DA7219_DAI_CLK_MODE = 0x2B */
  211. #define DA7219_DAI_BCLKS_PER_WCLK_SHIFT 0
  212. #define DA7219_DAI_BCLKS_PER_WCLK_MASK (0x3 << 0)
  213. #define DA7219_DAI_BCLKS_PER_WCLK_32 (0x0 << 0)
  214. #define DA7219_DAI_BCLKS_PER_WCLK_64 (0x1 << 0)
  215. #define DA7219_DAI_BCLKS_PER_WCLK_128 (0x2 << 0)
  216. #define DA7219_DAI_BCLKS_PER_WCLK_256 (0x3 << 0)
  217. #define DA7219_DAI_CLK_POL_SHIFT 2
  218. #define DA7219_DAI_CLK_POL_MASK (0x1 << 2)
  219. #define DA7219_DAI_CLK_POL_INV (0x1 << 2)
  220. #define DA7219_DAI_WCLK_POL_SHIFT 3
  221. #define DA7219_DAI_WCLK_POL_MASK (0x1 << 3)
  222. #define DA7219_DAI_WCLK_POL_INV (0x1 << 3)
  223. #define DA7219_DAI_WCLK_TRI_STATE_SHIFT 4
  224. #define DA7219_DAI_WCLK_TRI_STATE_MASK (0x1 << 4)
  225. #define DA7219_DAI_CLK_EN_SHIFT 7
  226. #define DA7219_DAI_CLK_EN_MASK (0x1 << 7)
  227. /* DA7219_DAI_CTRL = 0x2C */
  228. #define DA7219_DAI_FORMAT_SHIFT 0
  229. #define DA7219_DAI_FORMAT_MASK (0x3 << 0)
  230. #define DA7219_DAI_FORMAT_I2S (0x0 << 0)
  231. #define DA7219_DAI_FORMAT_LEFT_J (0x1 << 0)
  232. #define DA7219_DAI_FORMAT_RIGHT_J (0x2 << 0)
  233. #define DA7219_DAI_FORMAT_DSP (0x3 << 0)
  234. #define DA7219_DAI_WORD_LENGTH_SHIFT 2
  235. #define DA7219_DAI_WORD_LENGTH_MASK (0x3 << 2)
  236. #define DA7219_DAI_WORD_LENGTH_S16_LE (0x0 << 2)
  237. #define DA7219_DAI_WORD_LENGTH_S20_LE (0x1 << 2)
  238. #define DA7219_DAI_WORD_LENGTH_S24_LE (0x2 << 2)
  239. #define DA7219_DAI_WORD_LENGTH_S32_LE (0x3 << 2)
  240. #define DA7219_DAI_CH_NUM_SHIFT 4
  241. #define DA7219_DAI_CH_NUM_MASK (0x3 << 4)
  242. #define DA7219_DAI_CH_NUM_MAX 2
  243. #define DA7219_DAI_EN_SHIFT 7
  244. #define DA7219_DAI_EN_MASK (0x1 << 7)
  245. /* DA7219_DAI_TDM_CTRL = 0x2D */
  246. #define DA7219_DAI_TDM_CH_EN_SHIFT 0
  247. #define DA7219_DAI_TDM_CH_EN_MASK (0x3 << 0)
  248. #define DA7219_DAI_OE_SHIFT 6
  249. #define DA7219_DAI_OE_MASK (0x1 << 6)
  250. #define DA7219_DAI_TDM_MODE_EN_SHIFT 7
  251. #define DA7219_DAI_TDM_MODE_EN_MASK (0x1 << 7)
  252. #define DA7219_DAI_TDM_MAX_SLOTS 2
  253. /* DA7219_DIG_ROUTING_DAC = 0x2E */
  254. #define DA7219_DAC_L_SRC_SHIFT 0
  255. #define DA7219_DAC_L_SRC_MASK (0x3 << 0)
  256. #define DA7219_DAC_L_SRC_TONEGEN (0x1 << 0)
  257. #define DA7219_DAC_L_MONO_SHIFT 3
  258. #define DA7219_DAC_L_MONO_MASK (0x1 << 3)
  259. #define DA7219_DAC_R_SRC_SHIFT 4
  260. #define DA7219_DAC_R_SRC_MASK (0x3 << 4)
  261. #define DA7219_DAC_R_SRC_TONEGEN (0x1 << 4)
  262. #define DA7219_DAC_R_MONO_SHIFT 7
  263. #define DA7219_DAC_R_MONO_MASK (0x1 << 7)
  264. /* DA7219_ALC_CTRL1 = 0x2F */
  265. #define DA7219_ALC_OFFSET_EN_SHIFT 0
  266. #define DA7219_ALC_OFFSET_EN_MASK (0x1 << 0)
  267. #define DA7219_ALC_SYNC_MODE_SHIFT 1
  268. #define DA7219_ALC_SYNC_MODE_MASK (0x1 << 1)
  269. #define DA7219_ALC_EN_SHIFT 3
  270. #define DA7219_ALC_EN_MASK (0x1 << 3)
  271. #define DA7219_ALC_AUTO_CALIB_EN_SHIFT 4
  272. #define DA7219_ALC_AUTO_CALIB_EN_MASK (0x1 << 4)
  273. #define DA7219_ALC_CALIB_OVERFLOW_SHIFT 5
  274. #define DA7219_ALC_CALIB_OVERFLOW_MASK (0x1 << 5)
  275. /* DA7219_DAI_OFFSET_LOWER = 0x30 */
  276. #define DA7219_DAI_OFFSET_LOWER_SHIFT 0
  277. #define DA7219_DAI_OFFSET_LOWER_MASK (0xFF << 0)
  278. /* DA7219_DAI_OFFSET_UPPER = 0x31 */
  279. #define DA7219_DAI_OFFSET_UPPER_SHIFT 0
  280. #define DA7219_DAI_OFFSET_UPPER_MASK (0x7 << 0)
  281. #define DA7219_DAI_OFFSET_MAX 0x2FF
  282. /* DA7219_REFERENCES = 0x32 */
  283. #define DA7219_BIAS_EN_SHIFT 3
  284. #define DA7219_BIAS_EN_MASK (0x1 << 3)
  285. #define DA7219_VMID_FAST_CHARGE_SHIFT 4
  286. #define DA7219_VMID_FAST_CHARGE_MASK (0x1 << 4)
  287. /* DA7219_MIXIN_L_SELECT = 0x33 */
  288. #define DA7219_MIXIN_L_MIX_SELECT_SHIFT 0
  289. #define DA7219_MIXIN_L_MIX_SELECT_MASK (0x1 << 0)
  290. /* DA7219_MIXIN_L_GAIN = 0x34 */
  291. #define DA7219_MIXIN_L_AMP_GAIN_SHIFT 0
  292. #define DA7219_MIXIN_L_AMP_GAIN_MASK (0xF << 0)
  293. #define DA7219_MIXIN_L_AMP_GAIN_MAX 0xF
  294. /* DA7219_ADC_L_GAIN = 0x36 */
  295. #define DA7219_ADC_L_DIGITAL_GAIN_SHIFT 0
  296. #define DA7219_ADC_L_DIGITAL_GAIN_MASK (0x7F << 0)
  297. #define DA7219_ADC_L_DIGITAL_GAIN_MAX 0x7F
  298. /* DA7219_ADC_FILTERS1 = 0x38 */
  299. #define DA7219_ADC_VOICE_HPF_CORNER_SHIFT 0
  300. #define DA7219_ADC_VOICE_HPF_CORNER_MASK (0x7 << 0)
  301. #define DA7219_VOICE_HPF_CORNER_MAX 8
  302. #define DA7219_ADC_VOICE_EN_SHIFT 3
  303. #define DA7219_ADC_VOICE_EN_MASK (0x1 << 3)
  304. #define DA7219_ADC_AUDIO_HPF_CORNER_SHIFT 4
  305. #define DA7219_ADC_AUDIO_HPF_CORNER_MASK (0x3 << 4)
  306. #define DA7219_AUDIO_HPF_CORNER_MAX 4
  307. #define DA7219_ADC_HPF_EN_SHIFT 7
  308. #define DA7219_ADC_HPF_EN_MASK (0x1 << 7)
  309. #define DA7219_HPF_MODE_SHIFT 0
  310. #define DA7219_HPF_DISABLED ((0x0 << 3) | (0x0 << 7))
  311. #define DA7219_HPF_AUDIO_EN ((0x0 << 3) | (0x1 << 7))
  312. #define DA7219_HPF_VOICE_EN ((0x1 << 3) | (0x1 << 7))
  313. #define DA7219_HPF_MODE_MASK ((0x1 << 3) | (0x1 << 7))
  314. #define DA7219_HPF_MODE_MAX 3
  315. /* DA7219_MIC_1_GAIN = 0x39 */
  316. #define DA7219_MIC_1_AMP_GAIN_SHIFT 0
  317. #define DA7219_MIC_1_AMP_GAIN_MASK (0x7 << 0)
  318. /* DA7219_SIDETONE_CTRL = 0x3A */
  319. #define DA7219_SIDETONE_MUTE_EN_SHIFT 6
  320. #define DA7219_SIDETONE_MUTE_EN_MASK (0x1 << 6)
  321. #define DA7219_SIDETONE_EN_SHIFT 7
  322. #define DA7219_SIDETONE_EN_MASK (0x1 << 7)
  323. /* DA7219_SIDETONE_GAIN = 0x3B */
  324. #define DA7219_SIDETONE_GAIN_SHIFT 0
  325. #define DA7219_SIDETONE_GAIN_MASK (0xF << 0)
  326. #define DA7219_SIDETONE_GAIN_MAX 0xE
  327. /* DA7219_DROUTING_ST_OUTFILT_1L = 0x3C */
  328. #define DA7219_OUTFILT_ST_1L_SRC_SHIFT 0
  329. #define DA7219_OUTFILT_ST_1L_SRC_MASK (0x7 << 0)
  330. #define DA7219_DMIX_ST_SRC_OUTFILT1L_SHIFT 0
  331. #define DA7219_DMIX_ST_SRC_OUTFILT1R_SHIFT 1
  332. #define DA7219_DMIX_ST_SRC_SIDETONE_SHIFT 2
  333. #define DA7219_DMIX_ST_SRC_OUTFILT1L (0x1 << 0)
  334. #define DA7219_DMIX_ST_SRC_OUTFILT1R (0x1 << 1)
  335. /* DA7219_DROUTING_ST_OUTFILT_1R = 0x3D */
  336. #define DA7219_OUTFILT_ST_1R_SRC_SHIFT 0
  337. #define DA7219_OUTFILT_ST_1R_SRC_MASK (0x7 << 0)
  338. /* DA7219_DAC_FILTERS5 = 0x40 */
  339. #define DA7219_DAC_SOFTMUTE_RATE_SHIFT 4
  340. #define DA7219_DAC_SOFTMUTE_RATE_MASK (0x7 << 4)
  341. #define DA7219_DAC_SOFTMUTE_RATE_MAX 7
  342. #define DA7219_DAC_SOFTMUTE_EN_SHIFT 7
  343. #define DA7219_DAC_SOFTMUTE_EN_MASK (0x1 << 7)
  344. /* DA7219_DAC_FILTERS2 = 0x41 */
  345. #define DA7219_DAC_EQ_BAND1_SHIFT 0
  346. #define DA7219_DAC_EQ_BAND1_MASK (0xF << 0)
  347. #define DA7219_DAC_EQ_BAND2_SHIFT 4
  348. #define DA7219_DAC_EQ_BAND2_MASK (0xF << 4)
  349. #define DA7219_DAC_EQ_BAND_MAX 0xF
  350. /* DA7219_DAC_FILTERS3 = 0x42 */
  351. #define DA7219_DAC_EQ_BAND3_SHIFT 0
  352. #define DA7219_DAC_EQ_BAND3_MASK (0xF << 0)
  353. #define DA7219_DAC_EQ_BAND4_SHIFT 4
  354. #define DA7219_DAC_EQ_BAND4_MASK (0xF << 4)
  355. /* DA7219_DAC_FILTERS4 = 0x43 */
  356. #define DA7219_DAC_EQ_BAND5_SHIFT 0
  357. #define DA7219_DAC_EQ_BAND5_MASK (0xF << 0)
  358. #define DA7219_DAC_EQ_EN_SHIFT 7
  359. #define DA7219_DAC_EQ_EN_MASK (0x1 << 7)
  360. /* DA7219_DAC_FILTERS1 = 0x44 */
  361. #define DA7219_DAC_VOICE_HPF_CORNER_SHIFT 0
  362. #define DA7219_DAC_VOICE_HPF_CORNER_MASK (0x7 << 0)
  363. #define DA7219_DAC_VOICE_EN_SHIFT 3
  364. #define DA7219_DAC_VOICE_EN_MASK (0x1 << 3)
  365. #define DA7219_DAC_AUDIO_HPF_CORNER_SHIFT 4
  366. #define DA7219_DAC_AUDIO_HPF_CORNER_MASK (0x3 << 4)
  367. #define DA7219_DAC_HPF_EN_SHIFT 7
  368. #define DA7219_DAC_HPF_EN_MASK (0x1 << 7)
  369. /* DA7219_DAC_L_GAIN = 0x45 */
  370. #define DA7219_DAC_L_DIGITAL_GAIN_SHIFT 0
  371. #define DA7219_DAC_L_DIGITAL_GAIN_MASK (0x7F << 0)
  372. #define DA7219_DAC_DIGITAL_GAIN_MAX 0x7F
  373. #define DA7219_DAC_DIGITAL_GAIN_0DB (0x6F << 0)
  374. /* DA7219_DAC_R_GAIN = 0x46 */
  375. #define DA7219_DAC_R_DIGITAL_GAIN_SHIFT 0
  376. #define DA7219_DAC_R_DIGITAL_GAIN_MASK (0x7F << 0)
  377. /* DA7219_CP_CTRL = 0x47 */
  378. #define DA7219_CP_MCHANGE_SHIFT 4
  379. #define DA7219_CP_MCHANGE_MASK (0x3 << 4)
  380. #define DA7219_CP_MCHANGE_REL_MASK 0x3
  381. #define DA7219_CP_MCHANGE_MAX 3
  382. #define DA7219_CP_MCHANGE_LARGEST_VOL 0x1
  383. #define DA7219_CP_MCHANGE_DAC_VOL 0x2
  384. #define DA7219_CP_MCHANGE_SIG_MAG 0x3
  385. #define DA7219_CP_EN_SHIFT 7
  386. #define DA7219_CP_EN_MASK (0x1 << 7)
  387. /* DA7219_HP_L_GAIN = 0x48 */
  388. #define DA7219_HP_L_AMP_GAIN_SHIFT 0
  389. #define DA7219_HP_L_AMP_GAIN_MASK (0x3F << 0)
  390. #define DA7219_HP_AMP_GAIN_MAX 0x3F
  391. #define DA7219_HP_AMP_GAIN_0DB (0x39 << 0)
  392. /* DA7219_HP_R_GAIN = 0x49 */
  393. #define DA7219_HP_R_AMP_GAIN_SHIFT 0
  394. #define DA7219_HP_R_AMP_GAIN_MASK (0x3F << 0)
  395. /* DA7219_MIXOUT_L_SELECT = 0x4B */
  396. #define DA7219_MIXOUT_L_MIX_SELECT_SHIFT 0
  397. #define DA7219_MIXOUT_L_MIX_SELECT_MASK (0x1 << 0)
  398. /* DA7219_MIXOUT_R_SELECT = 0x4C */
  399. #define DA7219_MIXOUT_R_MIX_SELECT_SHIFT 0
  400. #define DA7219_MIXOUT_R_MIX_SELECT_MASK (0x1 << 0)
  401. /* DA7219_SYSTEM_MODES_INPUT = 0x50 */
  402. #define DA7219_MODE_SUBMIT_SHIFT 0
  403. #define DA7219_MODE_SUBMIT_MASK (0x1 << 0)
  404. #define DA7219_ADC_MODE_SHIFT 1
  405. #define DA7219_ADC_MODE_MASK (0x7F << 1)
  406. /* DA7219_SYSTEM_MODES_OUTPUT = 0x51 */
  407. #define DA7219_MODE_SUBMIT_SHIFT 0
  408. #define DA7219_MODE_SUBMIT_MASK (0x1 << 0)
  409. #define DA7219_DAC_MODE_SHIFT 1
  410. #define DA7219_DAC_MODE_MASK (0x7F << 1)
  411. /* DA7219_MICBIAS_CTRL = 0x62 */
  412. #define DA7219_MICBIAS1_LEVEL_SHIFT 0
  413. #define DA7219_MICBIAS1_LEVEL_MASK (0x7 << 0)
  414. #define DA7219_MICBIAS1_EN_SHIFT 3
  415. #define DA7219_MICBIAS1_EN_MASK (0x1 << 3)
  416. /* DA7219_MIC_1_CTRL = 0x63 */
  417. #define DA7219_MIC_1_AMP_RAMP_EN_SHIFT 5
  418. #define DA7219_MIC_1_AMP_RAMP_EN_MASK (0x1 << 5)
  419. #define DA7219_MIC_1_AMP_MUTE_EN_SHIFT 6
  420. #define DA7219_MIC_1_AMP_MUTE_EN_MASK (0x1 << 6)
  421. #define DA7219_MIC_1_AMP_EN_SHIFT 7
  422. #define DA7219_MIC_1_AMP_EN_MASK (0x1 << 7)
  423. /* DA7219_MIXIN_L_CTRL = 0x65 */
  424. #define DA7219_MIXIN_L_MIX_EN_SHIFT 3
  425. #define DA7219_MIXIN_L_MIX_EN_MASK (0x1 << 3)
  426. #define DA7219_MIXIN_L_AMP_ZC_EN_SHIFT 4
  427. #define DA7219_MIXIN_L_AMP_ZC_EN_MASK (0x1 << 4)
  428. #define DA7219_MIXIN_L_AMP_RAMP_EN_SHIFT 5
  429. #define DA7219_MIXIN_L_AMP_RAMP_EN_MASK (0x1 << 5)
  430. #define DA7219_MIXIN_L_AMP_MUTE_EN_SHIFT 6
  431. #define DA7219_MIXIN_L_AMP_MUTE_EN_MASK (0x1 << 6)
  432. #define DA7219_MIXIN_L_AMP_EN_SHIFT 7
  433. #define DA7219_MIXIN_L_AMP_EN_MASK (0x1 << 7)
  434. /* DA7219_ADC_L_CTRL = 0x67 */
  435. #define DA7219_ADC_L_BIAS_SHIFT 0
  436. #define DA7219_ADC_L_BIAS_MASK (0x3 << 0)
  437. #define DA7219_ADC_L_RAMP_EN_SHIFT 5
  438. #define DA7219_ADC_L_RAMP_EN_MASK (0x1 << 5)
  439. #define DA7219_ADC_L_MUTE_EN_SHIFT 6
  440. #define DA7219_ADC_L_MUTE_EN_MASK (0x1 << 6)
  441. #define DA7219_ADC_L_EN_SHIFT 7
  442. #define DA7219_ADC_L_EN_MASK (0x1 << 7)
  443. /* DA7219_DAC_L_CTRL = 0x69 */
  444. #define DA7219_DAC_L_RAMP_EN_SHIFT 5
  445. #define DA7219_DAC_L_RAMP_EN_MASK (0x1 << 5)
  446. #define DA7219_DAC_L_MUTE_EN_SHIFT 6
  447. #define DA7219_DAC_L_MUTE_EN_MASK (0x1 << 6)
  448. #define DA7219_DAC_L_EN_SHIFT 7
  449. #define DA7219_DAC_L_EN_MASK (0x1 << 7)
  450. /* DA7219_DAC_R_CTRL = 0x6A */
  451. #define DA7219_DAC_R_RAMP_EN_SHIFT 5
  452. #define DA7219_DAC_R_RAMP_EN_MASK (0x1 << 5)
  453. #define DA7219_DAC_R_MUTE_EN_SHIFT 6
  454. #define DA7219_DAC_R_MUTE_EN_MASK (0x1 << 6)
  455. #define DA7219_DAC_R_EN_SHIFT 7
  456. #define DA7219_DAC_R_EN_MASK (0x1 << 7)
  457. /* DA7219_HP_L_CTRL = 0x6B */
  458. #define DA7219_HP_L_AMP_MIN_GAIN_EN_SHIFT 2
  459. #define DA7219_HP_L_AMP_MIN_GAIN_EN_MASK (0x1 << 2)
  460. #define DA7219_HP_L_AMP_OE_SHIFT 3
  461. #define DA7219_HP_L_AMP_OE_MASK (0x1 << 3)
  462. #define DA7219_HP_L_AMP_ZC_EN_SHIFT 4
  463. #define DA7219_HP_L_AMP_ZC_EN_MASK (0x1 << 4)
  464. #define DA7219_HP_L_AMP_RAMP_EN_SHIFT 5
  465. #define DA7219_HP_L_AMP_RAMP_EN_MASK (0x1 << 5)
  466. #define DA7219_HP_L_AMP_MUTE_EN_SHIFT 6
  467. #define DA7219_HP_L_AMP_MUTE_EN_MASK (0x1 << 6)
  468. #define DA7219_HP_L_AMP_EN_SHIFT 7
  469. #define DA7219_HP_L_AMP_EN_MASK (0x1 << 7)
  470. /* DA7219_HP_R_CTRL = 0x6C */
  471. #define DA7219_HP_R_AMP_MIN_GAIN_EN_SHIFT 2
  472. #define DA7219_HP_R_AMP_MIN_GAIN_EN_MASK (0x1 << 2)
  473. #define DA7219_HP_R_AMP_OE_SHIFT 3
  474. #define DA7219_HP_R_AMP_OE_MASK (0x1 << 3)
  475. #define DA7219_HP_R_AMP_ZC_EN_SHIFT 4
  476. #define DA7219_HP_R_AMP_ZC_EN_MASK (0x1 << 4)
  477. #define DA7219_HP_R_AMP_RAMP_EN_SHIFT 5
  478. #define DA7219_HP_R_AMP_RAMP_EN_MASK (0x1 << 5)
  479. #define DA7219_HP_R_AMP_MUTE_EN_SHIFT 6
  480. #define DA7219_HP_R_AMP_MUTE_EN_MASK (0x1 << 6)
  481. #define DA7219_HP_R_AMP_EN_SHIFT 7
  482. #define DA7219_HP_R_AMP_EN_MASK (0x1 << 7)
  483. /* DA7219_MIXOUT_L_CTRL = 0x6E */
  484. #define DA7219_MIXOUT_L_AMP_EN_SHIFT 7
  485. #define DA7219_MIXOUT_L_AMP_EN_MASK (0x1 << 7)
  486. /* DA7219_MIXOUT_R_CTRL = 0x6F */
  487. #define DA7219_MIXOUT_R_AMP_EN_SHIFT 7
  488. #define DA7219_MIXOUT_R_AMP_EN_MASK (0x1 << 7)
  489. /* DA7219_CHIP_ID1 = 0x81 */
  490. #define DA7219_CHIP_ID1_SHIFT 0
  491. #define DA7219_CHIP_ID1_MASK (0xFF << 0)
  492. /* DA7219_CHIP_ID2 = 0x82 */
  493. #define DA7219_CHIP_ID2_SHIFT 0
  494. #define DA7219_CHIP_ID2_MASK (0xFF << 0)
  495. /* DA7219_CHIP_REVISION = 0x83 */
  496. #define DA7219_CHIP_MINOR_SHIFT 0
  497. #define DA7219_CHIP_MINOR_MASK (0xF << 0)
  498. #define DA7219_CHIP_MAJOR_SHIFT 4
  499. #define DA7219_CHIP_MAJOR_MASK (0xF << 4)
  500. /* DA7219_IO_CTRL = 0x91 */
  501. #define DA7219_IO_VOLTAGE_LEVEL_SHIFT 0
  502. #define DA7219_IO_VOLTAGE_LEVEL_MASK (0x1 << 0)
  503. #define DA7219_IO_VOLTAGE_LEVEL_2_5V_3_6V 0
  504. #define DA7219_IO_VOLTAGE_LEVEL_1_2V_2_8V 1
  505. /* DA7219_GAIN_RAMP_CTRL = 0x92 */
  506. #define DA7219_GAIN_RAMP_RATE_SHIFT 0
  507. #define DA7219_GAIN_RAMP_RATE_MASK (0x3 << 0)
  508. #define DA7219_GAIN_RAMP_RATE_X8 (0x0 << 0)
  509. #define DA7219_GAIN_RAMP_RATE_NOMINAL (0x1 << 0)
  510. #define DA7219_GAIN_RAMP_RATE_MAX 4
  511. /* DA7219_PC_COUNT = 0x94 */
  512. #define DA7219_PC_FREERUN_SHIFT 0
  513. #define DA7219_PC_FREERUN_MASK (0x1 << 0)
  514. #define DA7219_PC_RESYNC_AUTO_SHIFT 1
  515. #define DA7219_PC_RESYNC_AUTO_MASK (0x1 << 1)
  516. /* DA7219_CP_VOL_THRESHOLD1 = 0x95 */
  517. #define DA7219_CP_THRESH_VDD2_SHIFT 0
  518. #define DA7219_CP_THRESH_VDD2_MASK (0x3F << 0)
  519. #define DA7219_CP_THRESH_VDD2_MAX 0x3F
  520. /* DA7219_DIG_CTRL = 0x99 */
  521. #define DA7219_DAC_L_INV_SHIFT 3
  522. #define DA7219_DAC_L_INV_MASK (0x1 << 3)
  523. #define DA7219_DAC_R_INV_SHIFT 7
  524. #define DA7219_DAC_R_INV_MASK (0x1 << 7)
  525. /* DA7219_ALC_CTRL2 = 0x9A */
  526. #define DA7219_ALC_ATTACK_SHIFT 0
  527. #define DA7219_ALC_ATTACK_MASK (0xF << 0)
  528. #define DA7219_ALC_ATTACK_MAX 13
  529. #define DA7219_ALC_RELEASE_SHIFT 4
  530. #define DA7219_ALC_RELEASE_MASK (0xF << 4)
  531. #define DA7219_ALC_RELEASE_MAX 11
  532. /* DA7219_ALC_CTRL3 = 0x9B */
  533. #define DA7219_ALC_HOLD_SHIFT 0
  534. #define DA7219_ALC_HOLD_MASK (0xF << 0)
  535. #define DA7219_ALC_HOLD_MAX 16
  536. #define DA7219_ALC_INTEG_ATTACK_SHIFT 4
  537. #define DA7219_ALC_INTEG_ATTACK_MASK (0x3 << 4)
  538. #define DA7219_ALC_INTEG_RELEASE_SHIFT 6
  539. #define DA7219_ALC_INTEG_RELEASE_MASK (0x3 << 6)
  540. #define DA7219_ALC_INTEG_MAX 4
  541. /* DA7219_ALC_NOISE = 0x9C */
  542. #define DA7219_ALC_NOISE_SHIFT 0
  543. #define DA7219_ALC_NOISE_MASK (0x3F << 0)
  544. #define DA7219_ALC_THRESHOLD_MAX 0x3F
  545. /* DA7219_ALC_TARGET_MIN = 0x9D */
  546. #define DA7219_ALC_THRESHOLD_MIN_SHIFT 0
  547. #define DA7219_ALC_THRESHOLD_MIN_MASK (0x3F << 0)
  548. /* DA7219_ALC_TARGET_MAX = 0x9E */
  549. #define DA7219_ALC_THRESHOLD_MAX_SHIFT 0
  550. #define DA7219_ALC_THRESHOLD_MAX_MASK (0x3F << 0)
  551. /* DA7219_ALC_GAIN_LIMITS = 0x9F */
  552. #define DA7219_ALC_ATTEN_MAX_SHIFT 0
  553. #define DA7219_ALC_ATTEN_MAX_MASK (0xF << 0)
  554. #define DA7219_ALC_GAIN_MAX_SHIFT 4
  555. #define DA7219_ALC_GAIN_MAX_MASK (0xF << 4)
  556. #define DA7219_ALC_ATTEN_GAIN_MAX 0xF
  557. /* DA7219_ALC_ANA_GAIN_LIMITS = 0xA0 */
  558. #define DA7219_ALC_ANA_GAIN_MIN_SHIFT 0
  559. #define DA7219_ALC_ANA_GAIN_MIN_MASK (0x7 << 0)
  560. #define DA7219_ALC_ANA_GAIN_MIN 0x1
  561. #define DA7219_ALC_ANA_GAIN_MAX_SHIFT 4
  562. #define DA7219_ALC_ANA_GAIN_MAX_MASK (0x7 << 4)
  563. #define DA7219_ALC_ANA_GAIN_MAX 0x7
  564. /* DA7219_ALC_ANTICLIP_CTRL = 0xA1 */
  565. #define DA7219_ALC_ANTICLIP_STEP_SHIFT 0
  566. #define DA7219_ALC_ANTICLIP_STEP_MASK (0x3 << 0)
  567. #define DA7219_ALC_ANTICLIP_STEP_MAX 4
  568. #define DA7219_ALC_ANTIPCLIP_EN_SHIFT 7
  569. #define DA7219_ALC_ANTIPCLIP_EN_MASK (0x1 << 7)
  570. /* DA7219_ALC_ANTICLIP_LEVEL = 0xA2 */
  571. #define DA7219_ALC_ANTICLIP_LEVEL_SHIFT 0
  572. #define DA7219_ALC_ANTICLIP_LEVEL_MASK (0x7F << 0)
  573. /* DA7219_ALC_OFFSET_AUTO_M_L = 0xA3 */
  574. #define DA7219_ALC_OFFSET_AUTO_M_L_SHIFT 0
  575. #define DA7219_ALC_OFFSET_AUTO_M_L_MASK (0xFF << 0)
  576. /* DA7219_ALC_OFFSET_AUTO_U_L = 0xA4 */
  577. #define DA7219_ALC_OFFSET_AUTO_U_L_SHIFT 0
  578. #define DA7219_ALC_OFFSET_AUTO_U_L_MASK (0xF << 0)
  579. /* DA7219_DAC_NG_SETUP_TIME = 0xAF */
  580. #define DA7219_DAC_NG_SETUP_TIME_SHIFT 0
  581. #define DA7219_DAC_NG_SETUP_TIME_MASK (0x3 << 0)
  582. #define DA7219_DAC_NG_SETUP_TIME_MAX 4
  583. #define DA7219_DAC_NG_RAMPUP_RATE_SHIFT 2
  584. #define DA7219_DAC_NG_RAMPUP_RATE_MASK (0x1 << 2)
  585. #define DA7219_DAC_NG_RAMPDN_RATE_SHIFT 3
  586. #define DA7219_DAC_NG_RAMPDN_RATE_MASK (0x1 << 3)
  587. #define DA7219_DAC_NG_RAMP_RATE_MAX 2
  588. /* DA7219_DAC_NG_OFF_THRESH = 0xB0 */
  589. #define DA7219_DAC_NG_OFF_THRESHOLD_SHIFT 0
  590. #define DA7219_DAC_NG_OFF_THRESHOLD_MASK (0x7 << 0)
  591. #define DA7219_DAC_NG_THRESHOLD_MAX 0x7
  592. /* DA7219_DAC_NG_ON_THRESH = 0xB1 */
  593. #define DA7219_DAC_NG_ON_THRESHOLD_SHIFT 0
  594. #define DA7219_DAC_NG_ON_THRESHOLD_MASK (0x7 << 0)
  595. /* DA7219_DAC_NG_CTRL = 0xB2 */
  596. #define DA7219_DAC_NG_EN_SHIFT 7
  597. #define DA7219_DAC_NG_EN_MASK (0x1 << 7)
  598. /* DA7219_TONE_GEN_CFG1 = 0xB4 */
  599. #define DA7219_DTMF_REG_SHIFT 0
  600. #define DA7219_DTMF_REG_MASK (0xF << 0)
  601. #define DA7219_DTMF_REG_MAX 16
  602. #define DA7219_DTMF_EN_SHIFT 4
  603. #define DA7219_DTMF_EN_MASK (0x1 << 4)
  604. #define DA7219_START_STOPN_SHIFT 7
  605. #define DA7219_START_STOPN_MASK (0x1 << 7)
  606. /* DA7219_TONE_GEN_CFG2 = 0xB5 */
  607. #define DA7219_SWG_SEL_SHIFT 0
  608. #define DA7219_SWG_SEL_MASK (0x3 << 0)
  609. #define DA7219_SWG_SEL_MAX 4
  610. #define DA7219_SWG_SEL_SRAMP (0x3 << 0)
  611. #define DA7219_TONE_GEN_GAIN_SHIFT 4
  612. #define DA7219_TONE_GEN_GAIN_MASK (0xF << 4)
  613. #define DA7219_TONE_GEN_GAIN_MAX 0xF
  614. #define DA7219_TONE_GEN_GAIN_MINUS_9DB (0x3 << 4)
  615. #define DA7219_TONE_GEN_GAIN_MINUS_15DB (0x5 << 4)
  616. /* DA7219_TONE_GEN_CYCLES = 0xB6 */
  617. #define DA7219_BEEP_CYCLES_SHIFT 0
  618. #define DA7219_BEEP_CYCLES_MASK (0x7 << 0)
  619. /* DA7219_TONE_GEN_FREQ1_L = 0xB7 */
  620. #define DA7219_FREQ1_L_SHIFT 0
  621. #define DA7219_FREQ1_L_MASK (0xFF << 0)
  622. #define DA7219_FREQ_MAX 0xFFFF
  623. /* DA7219_TONE_GEN_FREQ1_U = 0xB8 */
  624. #define DA7219_FREQ1_U_SHIFT 0
  625. #define DA7219_FREQ1_U_MASK (0xFF << 0)
  626. /* DA7219_TONE_GEN_FREQ2_L = 0xB9 */
  627. #define DA7219_FREQ2_L_SHIFT 0
  628. #define DA7219_FREQ2_L_MASK (0xFF << 0)
  629. /* DA7219_TONE_GEN_FREQ2_U = 0xBA */
  630. #define DA7219_FREQ2_U_SHIFT 0
  631. #define DA7219_FREQ2_U_MASK (0xFF << 0)
  632. /* DA7219_TONE_GEN_ON_PER = 0xBB */
  633. #define DA7219_BEEP_ON_PER_SHIFT 0
  634. #define DA7219_BEEP_ON_PER_MASK (0x3F << 0)
  635. #define DA7219_BEEP_ON_OFF_MAX 0x3F
  636. /* DA7219_TONE_GEN_OFF_PER = 0xBC */
  637. #define DA7219_BEEP_OFF_PER_SHIFT 0
  638. #define DA7219_BEEP_OFF_PER_MASK (0x3F << 0)
  639. /* DA7219_SYSTEM_STATUS = 0xE0 */
  640. #define DA7219_SC1_BUSY_SHIFT 0
  641. #define DA7219_SC1_BUSY_MASK (0x1 << 0)
  642. #define DA7219_SC2_BUSY_SHIFT 1
  643. #define DA7219_SC2_BUSY_MASK (0x1 << 1)
  644. /* DA7219_SYSTEM_ACTIVE = 0xFD */
  645. #define DA7219_SYSTEM_ACTIVE_SHIFT 0
  646. #define DA7219_SYSTEM_ACTIVE_MASK (0x1 << 0)
  647. /*
  648. * General defines & data
  649. */
  650. /* Register inversion */
  651. #define DA7219_NO_INVERT 0
  652. #define DA7219_INVERT 1
  653. /* Byte related defines */
  654. #define DA7219_BYTE_SHIFT 8
  655. #define DA7219_BYTE_MASK 0xFF
  656. /* PLL Output Frequencies */
  657. #define DA7219_PLL_FREQ_OUT_90316 90316800
  658. #define DA7219_PLL_FREQ_OUT_98304 98304000
  659. /* PLL Frequency Dividers */
  660. #define DA7219_PLL_INDIV_2_TO_4_5_MHZ_VAL 1
  661. #define DA7219_PLL_INDIV_4_5_TO_9_MHZ_VAL 2
  662. #define DA7219_PLL_INDIV_9_TO_18_MHZ_VAL 4
  663. #define DA7219_PLL_INDIV_18_TO_36_MHZ_VAL 8
  664. #define DA7219_PLL_INDIV_36_TO_54_MHZ_VAL 16
  665. /* SRM */
  666. #define DA7219_SRM_CHECK_RETRIES 8
  667. /* System Controller */
  668. #define DA7219_SYS_STAT_CHECK_RETRIES 6
  669. #define DA7219_SYS_STAT_CHECK_DELAY 50
  670. enum da7219_clk_src {
  671. DA7219_CLKSRC_MCLK = 0,
  672. DA7219_CLKSRC_MCLK_SQR,
  673. };
  674. enum da7219_sys_clk {
  675. DA7219_SYSCLK_MCLK = 0,
  676. DA7219_SYSCLK_PLL,
  677. DA7219_SYSCLK_PLL_SRM,
  678. };
  679. /* Regulators */
  680. enum da7219_supplies {
  681. DA7219_SUPPLY_VDD = 0,
  682. DA7219_SUPPLY_VDDMIC,
  683. DA7219_SUPPLY_VDDIO,
  684. DA7219_NUM_SUPPLIES,
  685. };
  686. struct da7219_aad_priv;
  687. /* Private data */
  688. struct da7219_priv {
  689. struct da7219_aad_priv *aad;
  690. struct da7219_pdata *pdata;
  691. bool wakeup_source;
  692. struct regulator_bulk_data supplies[DA7219_NUM_SUPPLIES];
  693. struct regmap *regmap;
  694. struct mutex lock;
  695. struct clk *mclk;
  696. unsigned int mclk_rate;
  697. int clk_src;
  698. bool master;
  699. bool alc_en;
  700. };
  701. #endif /* __DA7219_H */