wm8741.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /*
  2. * wm8741.h -- WM8423 ASoC driver
  3. *
  4. * Copyright 2010 Wolfson Microelectronics, plc
  5. *
  6. * Author: Ian Lartey <ian@opensource.wolfsonmicro.com>
  7. *
  8. * Based on wm8753.h
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #ifndef _WM8741_H
  15. #define _WM8741_H
  16. /*
  17. * Register values.
  18. */
  19. #define WM8741_DACLLSB_ATTENUATION 0x00
  20. #define WM8741_DACLMSB_ATTENUATION 0x01
  21. #define WM8741_DACRLSB_ATTENUATION 0x02
  22. #define WM8741_DACRMSB_ATTENUATION 0x03
  23. #define WM8741_VOLUME_CONTROL 0x04
  24. #define WM8741_FORMAT_CONTROL 0x05
  25. #define WM8741_FILTER_CONTROL 0x06
  26. #define WM8741_MODE_CONTROL_1 0x07
  27. #define WM8741_MODE_CONTROL_2 0x08
  28. #define WM8741_RESET 0x09
  29. #define WM8741_ADDITIONAL_CONTROL_1 0x20
  30. #define WM8741_REGISTER_COUNT 11
  31. #define WM8741_MAX_REGISTER 0x20
  32. /*
  33. * Field Definitions.
  34. */
  35. /*
  36. * R0 (0x00) - DACLLSB_ATTENUATION
  37. */
  38. #define WM8741_UPDATELL 0x0020 /* UPDATELL */
  39. #define WM8741_UPDATELL_MASK 0x0020 /* UPDATELL */
  40. #define WM8741_UPDATELL_SHIFT 5 /* UPDATELL */
  41. #define WM8741_UPDATELL_WIDTH 1 /* UPDATELL */
  42. #define WM8741_LAT_4_0_MASK 0x001F /* LAT[4:0] - [4:0] */
  43. #define WM8741_LAT_4_0_SHIFT 0 /* LAT[4:0] - [4:0] */
  44. #define WM8741_LAT_4_0_WIDTH 5 /* LAT[4:0] - [4:0] */
  45. /*
  46. * R1 (0x01) - DACLMSB_ATTENUATION
  47. */
  48. #define WM8741_UPDATELM 0x0020 /* UPDATELM */
  49. #define WM8741_UPDATELM_MASK 0x0020 /* UPDATELM */
  50. #define WM8741_UPDATELM_SHIFT 5 /* UPDATELM */
  51. #define WM8741_UPDATELM_WIDTH 1 /* UPDATELM */
  52. #define WM8741_LAT_9_5_0_MASK 0x001F /* LAT[9:5] - [4:0] */
  53. #define WM8741_LAT_9_5_0_SHIFT 0 /* LAT[9:5] - [4:0] */
  54. #define WM8741_LAT_9_5_0_WIDTH 5 /* LAT[9:5] - [4:0] */
  55. /*
  56. * R2 (0x02) - DACRLSB_ATTENUATION
  57. */
  58. #define WM8741_UPDATERL 0x0020 /* UPDATERL */
  59. #define WM8741_UPDATERL_MASK 0x0020 /* UPDATERL */
  60. #define WM8741_UPDATERL_SHIFT 5 /* UPDATERL */
  61. #define WM8741_UPDATERL_WIDTH 1 /* UPDATERL */
  62. #define WM8741_RAT_4_0_MASK 0x001F /* RAT[4:0] - [4:0] */
  63. #define WM8741_RAT_4_0_SHIFT 0 /* RAT[4:0] - [4:0] */
  64. #define WM8741_RAT_4_0_WIDTH 5 /* RAT[4:0] - [4:0] */
  65. /*
  66. * R3 (0x03) - DACRMSB_ATTENUATION
  67. */
  68. #define WM8741_UPDATERM 0x0020 /* UPDATERM */
  69. #define WM8741_UPDATERM_MASK 0x0020 /* UPDATERM */
  70. #define WM8741_UPDATERM_SHIFT 5 /* UPDATERM */
  71. #define WM8741_UPDATERM_WIDTH 1 /* UPDATERM */
  72. #define WM8741_RAT_9_5_0_MASK 0x001F /* RAT[9:5] - [4:0] */
  73. #define WM8741_RAT_9_5_0_SHIFT 0 /* RAT[9:5] - [4:0] */
  74. #define WM8741_RAT_9_5_0_WIDTH 5 /* RAT[9:5] - [4:0] */
  75. /*
  76. * R4 (0x04) - VOLUME_CONTROL
  77. */
  78. #define WM8741_AMUTE 0x0080 /* AMUTE */
  79. #define WM8741_AMUTE_MASK 0x0080 /* AMUTE */
  80. #define WM8741_AMUTE_SHIFT 7 /* AMUTE */
  81. #define WM8741_AMUTE_WIDTH 1 /* AMUTE */
  82. #define WM8741_ZFLAG_MASK 0x0060 /* ZFLAG - [6:5] */
  83. #define WM8741_ZFLAG_SHIFT 5 /* ZFLAG - [6:5] */
  84. #define WM8741_ZFLAG_WIDTH 2 /* ZFLAG - [6:5] */
  85. #define WM8741_IZD 0x0010 /* IZD */
  86. #define WM8741_IZD_MASK 0x0010 /* IZD */
  87. #define WM8741_IZD_SHIFT 4 /* IZD */
  88. #define WM8741_IZD_WIDTH 1 /* IZD */
  89. #define WM8741_SOFT 0x0008 /* SOFT MUTE */
  90. #define WM8741_SOFT_MASK 0x0008 /* SOFT MUTE */
  91. #define WM8741_SOFT_SHIFT 3 /* SOFT MUTE */
  92. #define WM8741_SOFT_WIDTH 1 /* SOFT MUTE */
  93. #define WM8741_ATC 0x0004 /* ATC */
  94. #define WM8741_ATC_MASK 0x0004 /* ATC */
  95. #define WM8741_ATC_SHIFT 2 /* ATC */
  96. #define WM8741_ATC_WIDTH 1 /* ATC */
  97. #define WM8741_ATT2DB 0x0002 /* ATT2DB */
  98. #define WM8741_ATT2DB_MASK 0x0002 /* ATT2DB */
  99. #define WM8741_ATT2DB_SHIFT 1 /* ATT2DB */
  100. #define WM8741_ATT2DB_WIDTH 1 /* ATT2DB */
  101. #define WM8741_VOL_RAMP 0x0001 /* VOL_RAMP */
  102. #define WM8741_VOL_RAMP_MASK 0x0001 /* VOL_RAMP */
  103. #define WM8741_VOL_RAMP_SHIFT 0 /* VOL_RAMP */
  104. #define WM8741_VOL_RAMP_WIDTH 1 /* VOL_RAMP */
  105. /*
  106. * R5 (0x05) - FORMAT_CONTROL
  107. */
  108. #define WM8741_PWDN 0x0080 /* PWDN */
  109. #define WM8741_PWDN_MASK 0x0080 /* PWDN */
  110. #define WM8741_PWDN_SHIFT 7 /* PWDN */
  111. #define WM8741_PWDN_WIDTH 1 /* PWDN */
  112. #define WM8741_REV 0x0040 /* REV */
  113. #define WM8741_REV_MASK 0x0040 /* REV */
  114. #define WM8741_REV_SHIFT 6 /* REV */
  115. #define WM8741_REV_WIDTH 1 /* REV */
  116. #define WM8741_BCP 0x0020 /* BCP */
  117. #define WM8741_BCP_MASK 0x0020 /* BCP */
  118. #define WM8741_BCP_SHIFT 5 /* BCP */
  119. #define WM8741_BCP_WIDTH 1 /* BCP */
  120. #define WM8741_LRP 0x0010 /* LRP */
  121. #define WM8741_LRP_MASK 0x0010 /* LRP */
  122. #define WM8741_LRP_SHIFT 4 /* LRP */
  123. #define WM8741_LRP_WIDTH 1 /* LRP */
  124. #define WM8741_FMT_MASK 0x000C /* FMT - [3:2] */
  125. #define WM8741_FMT_SHIFT 2 /* FMT - [3:2] */
  126. #define WM8741_FMT_WIDTH 2 /* FMT - [3:2] */
  127. #define WM8741_IWL_MASK 0x0003 /* IWL - [1:0] */
  128. #define WM8741_IWL_SHIFT 0 /* IWL - [1:0] */
  129. #define WM8741_IWL_WIDTH 2 /* IWL - [1:0] */
  130. /*
  131. * R6 (0x06) - FILTER_CONTROL
  132. */
  133. #define WM8741_ZFLAG_HI 0x0080 /* ZFLAG_HI */
  134. #define WM8741_ZFLAG_HI_MASK 0x0080 /* ZFLAG_HI */
  135. #define WM8741_ZFLAG_HI_SHIFT 7 /* ZFLAG_HI */
  136. #define WM8741_ZFLAG_HI_WIDTH 1 /* ZFLAG_HI */
  137. #define WM8741_DEEMPH_MASK 0x0060 /* DEEMPH - [6:5] */
  138. #define WM8741_DEEMPH_SHIFT 5 /* DEEMPH - [6:5] */
  139. #define WM8741_DEEMPH_WIDTH 2 /* DEEMPH - [6:5] */
  140. #define WM8741_DSDFILT_MASK 0x0018 /* DSDFILT - [4:3] */
  141. #define WM8741_DSDFILT_SHIFT 3 /* DSDFILT - [4:3] */
  142. #define WM8741_DSDFILT_WIDTH 2 /* DSDFILT - [4:3] */
  143. #define WM8741_FIRSEL_MASK 0x0007 /* FIRSEL - [2:0] */
  144. #define WM8741_FIRSEL_SHIFT 0 /* FIRSEL - [2:0] */
  145. #define WM8741_FIRSEL_WIDTH 3 /* FIRSEL - [2:0] */
  146. /*
  147. * R7 (0x07) - MODE_CONTROL_1
  148. */
  149. #define WM8741_MODE8X 0x0080 /* MODE8X */
  150. #define WM8741_MODE8X_MASK 0x0080 /* MODE8X */
  151. #define WM8741_MODE8X_SHIFT 7 /* MODE8X */
  152. #define WM8741_MODE8X_WIDTH 1 /* MODE8X */
  153. #define WM8741_OSR_MASK 0x0060 /* OSR - [6:5] */
  154. #define WM8741_OSR_SHIFT 5 /* OSR - [6:5] */
  155. #define WM8741_OSR_WIDTH 2 /* OSR - [6:5] */
  156. #define WM8741_SR_MASK 0x001C /* SR - [4:2] */
  157. #define WM8741_SR_SHIFT 2 /* SR - [4:2] */
  158. #define WM8741_SR_WIDTH 3 /* SR - [4:2] */
  159. #define WM8741_MODESEL_MASK 0x0003 /* MODESEL - [1:0] */
  160. #define WM8741_MODESEL_SHIFT 0 /* MODESEL - [1:0] */
  161. #define WM8741_MODESEL_WIDTH 2 /* MODESEL - [1:0] */
  162. /*
  163. * R8 (0x08) - MODE_CONTROL_2
  164. */
  165. #define WM8741_DSD_GAIN 0x0040 /* DSD_GAIN */
  166. #define WM8741_DSD_GAIN_MASK 0x0040 /* DSD_GAIN */
  167. #define WM8741_DSD_GAIN_SHIFT 6 /* DSD_GAIN */
  168. #define WM8741_DSD_GAIN_WIDTH 1 /* DSD_GAIN */
  169. #define WM8741_SDOUT 0x0020 /* SDOUT */
  170. #define WM8741_SDOUT_MASK 0x0020 /* SDOUT */
  171. #define WM8741_SDOUT_SHIFT 5 /* SDOUT */
  172. #define WM8741_SDOUT_WIDTH 1 /* SDOUT */
  173. #define WM8741_DOUT 0x0010 /* DOUT */
  174. #define WM8741_DOUT_MASK 0x0010 /* DOUT */
  175. #define WM8741_DOUT_SHIFT 4 /* DOUT */
  176. #define WM8741_DOUT_WIDTH 1 /* DOUT */
  177. #define WM8741_DIFF_MASK 0x000C /* DIFF - [3:2] */
  178. #define WM8741_DIFF_SHIFT 2 /* DIFF - [3:2] */
  179. #define WM8741_DIFF_WIDTH 2 /* DIFF - [3:2] */
  180. #define WM8741_DITHER_MASK 0x0003 /* DITHER - [1:0] */
  181. #define WM8741_DITHER_SHIFT 0 /* DITHER - [1:0] */
  182. #define WM8741_DITHER_WIDTH 2 /* DITHER - [1:0] */
  183. /*
  184. * R32 (0x20) - ADDITONAL_CONTROL_1
  185. */
  186. #define WM8741_DSD_LEVEL 0x0002 /* DSD_LEVEL */
  187. #define WM8741_DSD_LEVEL_MASK 0x0002 /* DSD_LEVEL */
  188. #define WM8741_DSD_LEVEL_SHIFT 1 /* DSD_LEVEL */
  189. #define WM8741_DSD_LEVEL_WIDTH 1 /* DSD_LEVEL */
  190. #define WM8741_DSD_NO_NOTCH 0x0001 /* DSD_NO_NOTCH */
  191. #define WM8741_DSD_NO_NOTCH_MASK 0x0001 /* DSD_NO_NOTCH */
  192. #define WM8741_DSD_NO_NOTCH_SHIFT 0 /* DSD_NO_NOTCH */
  193. #define WM8741_DSD_NO_NOTCH_WIDTH 1 /* DSD_NO_NOTCH */
  194. #define WM8741_SYSCLK 0
  195. #endif