em28xx-reg.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. #define EM_GPIO_0 (1 << 0)
  2. #define EM_GPIO_1 (1 << 1)
  3. #define EM_GPIO_2 (1 << 2)
  4. #define EM_GPIO_3 (1 << 3)
  5. #define EM_GPIO_4 (1 << 4)
  6. #define EM_GPIO_5 (1 << 5)
  7. #define EM_GPIO_6 (1 << 6)
  8. #define EM_GPIO_7 (1 << 7)
  9. #define EM_GPO_0 (1 << 0)
  10. #define EM_GPO_1 (1 << 1)
  11. #define EM_GPO_2 (1 << 2)
  12. #define EM_GPO_3 (1 << 3)
  13. /* em28xx endpoints */
  14. #define EM28XX_EP_ANALOG 0x82
  15. #define EM28XX_EP_AUDIO 0x83
  16. #define EM28XX_EP_DIGITAL 0x84
  17. /* em2800 registers */
  18. #define EM2800_R08_AUDIOSRC 0x08
  19. /* em28xx registers */
  20. #define EM28XX_R00_CHIPCFG 0x00
  21. /* em28xx Chip Configuration 0x00 */
  22. #define EM28XX_CHIPCFG_VENDOR_AUDIO 0x80
  23. #define EM28XX_CHIPCFG_I2S_VOLUME_CAPABLE 0x40
  24. #define EM28XX_CHIPCFG_I2S_5_SAMPRATES 0x30
  25. #define EM28XX_CHIPCFG_I2S_3_SAMPRATES 0x20
  26. #define EM28XX_CHIPCFG_AC97 0x10
  27. #define EM28XX_CHIPCFG_AUDIOMASK 0x30
  28. #define EM28XX_R01_CHIPCFG2 0x01
  29. /* em28xx Chip Configuration 2 0x01 */
  30. #define EM28XX_CHIPCFG2_TS_PRESENT 0x10
  31. #define EM28XX_CHIPCFG2_TS_REQ_INTERVAL_MASK 0x0c /* bits 3-2 */
  32. #define EM28XX_CHIPCFG2_TS_REQ_INTERVAL_1MF 0x00
  33. #define EM28XX_CHIPCFG2_TS_REQ_INTERVAL_2MF 0x04
  34. #define EM28XX_CHIPCFG2_TS_REQ_INTERVAL_4MF 0x08
  35. #define EM28XX_CHIPCFG2_TS_REQ_INTERVAL_8MF 0x0c
  36. #define EM28XX_CHIPCFG2_TS_PACKETSIZE_MASK 0x03 /* bits 0-1 */
  37. #define EM28XX_CHIPCFG2_TS_PACKETSIZE_188 0x00
  38. #define EM28XX_CHIPCFG2_TS_PACKETSIZE_376 0x01
  39. #define EM28XX_CHIPCFG2_TS_PACKETSIZE_564 0x02
  40. #define EM28XX_CHIPCFG2_TS_PACKETSIZE_752 0x03
  41. /* GPIO/GPO registers */
  42. #define EM2880_R04_GPO 0x04 /* em2880-em2883 only */
  43. #define EM28XX_R08_GPIO 0x08 /* em2820 or upper */
  44. #define EM28XX_R06_I2C_CLK 0x06
  45. /* em28xx I2C Clock Register (0x06) */
  46. #define EM28XX_I2C_CLK_ACK_LAST_READ 0x80
  47. #define EM28XX_I2C_CLK_WAIT_ENABLE 0x40
  48. #define EM28XX_I2C_EEPROM_ON_BOARD 0x08
  49. #define EM28XX_I2C_EEPROM_KEY_VALID 0x04
  50. #define EM2874_I2C_SECONDARY_BUS_SELECT 0x04 /* em2874 has two i2c busses */
  51. #define EM28XX_I2C_FREQ_1_5_MHZ 0x03 /* bus frequency (bits [1-0]) */
  52. #define EM28XX_I2C_FREQ_25_KHZ 0x02
  53. #define EM28XX_I2C_FREQ_400_KHZ 0x01
  54. #define EM28XX_I2C_FREQ_100_KHZ 0x00
  55. #define EM28XX_R0A_CHIPID 0x0a
  56. #define EM28XX_R0C_USBSUSP 0x0c /* */
  57. #define EM28XX_R0E_AUDIOSRC 0x0e
  58. #define EM28XX_R0F_XCLK 0x0f
  59. /* em28xx XCLK Register (0x0f) */
  60. #define EM28XX_XCLK_AUDIO_UNMUTE 0x80 /* otherwise audio muted */
  61. #define EM28XX_XCLK_I2S_MSB_TIMING 0x40 /* otherwise standard timing */
  62. #define EM28XX_XCLK_IR_RC5_MODE 0x20 /* otherwise NEC mode */
  63. #define EM28XX_XCLK_IR_NEC_CHK_PARITY 0x10
  64. #define EM28XX_XCLK_FREQUENCY_30MHZ 0x00 /* Freq. select (bits [3-0]) */
  65. #define EM28XX_XCLK_FREQUENCY_15MHZ 0x01
  66. #define EM28XX_XCLK_FREQUENCY_10MHZ 0x02
  67. #define EM28XX_XCLK_FREQUENCY_7_5MHZ 0x03
  68. #define EM28XX_XCLK_FREQUENCY_6MHZ 0x04
  69. #define EM28XX_XCLK_FREQUENCY_5MHZ 0x05
  70. #define EM28XX_XCLK_FREQUENCY_4_3MHZ 0x06
  71. #define EM28XX_XCLK_FREQUENCY_12MHZ 0x07
  72. #define EM28XX_XCLK_FREQUENCY_20MHZ 0x08
  73. #define EM28XX_XCLK_FREQUENCY_20MHZ_2 0x09
  74. #define EM28XX_XCLK_FREQUENCY_48MHZ 0x0a
  75. #define EM28XX_XCLK_FREQUENCY_24MHZ 0x0b
  76. #define EM28XX_R10_VINMODE 0x10
  77. #define EM28XX_R11_VINCTRL 0x11
  78. /* em28xx Video Input Control Register 0x11 */
  79. #define EM28XX_VINCTRL_VBI_SLICED 0x80
  80. #define EM28XX_VINCTRL_VBI_RAW 0x40
  81. #define EM28XX_VINCTRL_VOUT_MODE_IN 0x20 /* HREF,VREF,VACT in output */
  82. #define EM28XX_VINCTRL_CCIR656_ENABLE 0x10
  83. #define EM28XX_VINCTRL_VBI_16BIT_RAW 0x08 /* otherwise 8-bit raw */
  84. #define EM28XX_VINCTRL_FID_ON_HREF 0x04
  85. #define EM28XX_VINCTRL_DUAL_EDGE_STROBE 0x02
  86. #define EM28XX_VINCTRL_INTERLACED 0x01
  87. #define EM28XX_R12_VINENABLE 0x12 /* */
  88. #define EM28XX_R14_GAMMA 0x14
  89. #define EM28XX_R15_RGAIN 0x15
  90. #define EM28XX_R16_GGAIN 0x16
  91. #define EM28XX_R17_BGAIN 0x17
  92. #define EM28XX_R18_ROFFSET 0x18
  93. #define EM28XX_R19_GOFFSET 0x19
  94. #define EM28XX_R1A_BOFFSET 0x1a
  95. #define EM28XX_R1B_OFLOW 0x1b
  96. #define EM28XX_R1C_HSTART 0x1c
  97. #define EM28XX_R1D_VSTART 0x1d
  98. #define EM28XX_R1E_CWIDTH 0x1e
  99. #define EM28XX_R1F_CHEIGHT 0x1f
  100. #define EM28XX_R20_YGAIN 0x20
  101. #define EM28XX_R21_YOFFSET 0x21
  102. #define EM28XX_R22_UVGAIN 0x22
  103. #define EM28XX_R23_UOFFSET 0x23
  104. #define EM28XX_R24_VOFFSET 0x24
  105. #define EM28XX_R25_SHARPNESS 0x25
  106. #define EM28XX_R26_COMPR 0x26
  107. #define EM28XX_R27_OUTFMT 0x27
  108. /* em28xx Output Format Register (0x27) */
  109. #define EM28XX_OUTFMT_RGB_8_RGRG 0x00
  110. #define EM28XX_OUTFMT_RGB_8_GRGR 0x01
  111. #define EM28XX_OUTFMT_RGB_8_GBGB 0x02
  112. #define EM28XX_OUTFMT_RGB_8_BGBG 0x03
  113. #define EM28XX_OUTFMT_RGB_16_656 0x04
  114. #define EM28XX_OUTFMT_RGB_8_BAYER 0x08 /* Pattern in Reg 0x10[1-0] */
  115. #define EM28XX_OUTFMT_YUV211 0x10
  116. #define EM28XX_OUTFMT_YUV422_Y0UY1V 0x14
  117. #define EM28XX_OUTFMT_YUV422_Y1UY0V 0x15
  118. #define EM28XX_OUTFMT_YUV411 0x18
  119. #define EM28XX_R28_XMIN 0x28
  120. #define EM28XX_R29_XMAX 0x29
  121. #define EM28XX_R2A_YMIN 0x2a
  122. #define EM28XX_R2B_YMAX 0x2b
  123. #define EM28XX_R30_HSCALELOW 0x30
  124. #define EM28XX_R31_HSCALEHIGH 0x31
  125. #define EM28XX_R32_VSCALELOW 0x32
  126. #define EM28XX_R33_VSCALEHIGH 0x33
  127. #define EM28XX_R34_VBI_START_H 0x34
  128. #define EM28XX_R35_VBI_START_V 0x35
  129. #define EM28XX_R36_VBI_WIDTH 0x36
  130. #define EM28XX_R37_VBI_HEIGHT 0x37
  131. #define EM28XX_R40_AC97LSB 0x40
  132. #define EM28XX_R41_AC97MSB 0x41
  133. #define EM28XX_R42_AC97ADDR 0x42
  134. #define EM28XX_R43_AC97BUSY 0x43
  135. #define EM28XX_R45_IR 0x45
  136. /* 0x45 bit 7 - parity bit
  137. bits 6-0 - count
  138. 0x46 IR brand
  139. 0x47 IR data
  140. */
  141. /* em2874 registers */
  142. #define EM2874_R50_IR_CONFIG 0x50
  143. #define EM2874_R51_IR 0x51
  144. #define EM2874_R5F_TS_ENABLE 0x5f
  145. #define EM2874_R80_GPIO 0x80
  146. /* em2874 IR config register (0x50) */
  147. #define EM2874_IR_NEC 0x00
  148. #define EM2874_IR_RC5 0x04
  149. #define EM2874_IR_RC6_MODE_0 0x08
  150. #define EM2874_IR_RC6_MODE_6A 0x0b
  151. /* em2874 Transport Stream Enable Register (0x5f) */
  152. #define EM2874_TS1_CAPTURE_ENABLE (1 << 0)
  153. #define EM2874_TS1_FILTER_ENABLE (1 << 1)
  154. #define EM2874_TS1_NULL_DISCARD (1 << 2)
  155. #define EM2874_TS2_CAPTURE_ENABLE (1 << 4)
  156. #define EM2874_TS2_FILTER_ENABLE (1 << 5)
  157. #define EM2874_TS2_NULL_DISCARD (1 << 6)
  158. /* register settings */
  159. #define EM2800_AUDIO_SRC_TUNER 0x0d
  160. #define EM2800_AUDIO_SRC_LINE 0x0c
  161. #define EM28XX_AUDIO_SRC_TUNER 0xc0
  162. #define EM28XX_AUDIO_SRC_LINE 0x80
  163. /* FIXME: Need to be populated with the other chip ID's */
  164. enum em28xx_chip_id {
  165. CHIP_ID_EM2800 = 7,
  166. CHIP_ID_EM2710 = 17,
  167. CHIP_ID_EM2820 = 18, /* Also used by some em2710 */
  168. CHIP_ID_EM2840 = 20,
  169. CHIP_ID_EM2750 = 33,
  170. CHIP_ID_EM2860 = 34,
  171. CHIP_ID_EM2870 = 35,
  172. CHIP_ID_EM2883 = 36,
  173. CHIP_ID_EM2874 = 65,
  174. CHIP_ID_EM2884 = 68,
  175. CHIP_ID_EM28174 = 113,
  176. };
  177. /*
  178. * Registers used by em202 and other AC97 chips
  179. */
  180. /* Standard AC97 registers */
  181. #define AC97_RESET 0x00
  182. /* Output volumes */
  183. #define AC97_MASTER_VOL 0x02
  184. #define AC97_LINE_LEVEL_VOL 0x04 /* Some devices use for headphones */
  185. #define AC97_MASTER_MONO_VOL 0x06
  186. /* Input volumes */
  187. #define AC97_PC_BEEP_VOL 0x0a
  188. #define AC97_PHONE_VOL 0x0c
  189. #define AC97_MIC_VOL 0x0e
  190. #define AC97_LINEIN_VOL 0x10
  191. #define AC97_CD_VOL 0x12
  192. #define AC97_VIDEO_VOL 0x14
  193. #define AC97_AUX_VOL 0x16
  194. #define AC97_PCM_OUT_VOL 0x18
  195. /* capture registers */
  196. #define AC97_RECORD_SELECT 0x1a
  197. #define AC97_RECORD_GAIN 0x1c
  198. /* control registers */
  199. #define AC97_GENERAL_PURPOSE 0x20
  200. #define AC97_3D_CTRL 0x22
  201. #define AC97_AUD_INT_AND_PAG 0x24
  202. #define AC97_POWER_DOWN_CTRL 0x26
  203. #define AC97_EXT_AUD_ID 0x28
  204. #define AC97_EXT_AUD_CTRL 0x2a
  205. /* Supported rate varies for each AC97 device
  206. if write an unsupported value, it will return the closest one
  207. */
  208. #define AC97_PCM_OUT_FRONT_SRATE 0x2c
  209. #define AC97_PCM_OUT_SURR_SRATE 0x2e
  210. #define AC97_PCM_OUT_LFE_SRATE 0x30
  211. #define AC97_PCM_IN_SRATE 0x32
  212. /* For devices with more than 2 channels, extra output volumes */
  213. #define AC97_LFE_MASTER_VOL 0x36
  214. #define AC97_SURR_MASTER_VOL 0x38
  215. /* Digital SPDIF output control */
  216. #define AC97_SPDIF_OUT_CTRL 0x3a
  217. /* Vendor ID identifier */
  218. #define AC97_VENDOR_ID1 0x7c
  219. #define AC97_VENDOR_ID2 0x7e
  220. /* EMP202 vendor registers */
  221. #define EM202_EXT_MODEM_CTRL 0x3e
  222. #define EM202_GPIO_CONF 0x4c
  223. #define EM202_GPIO_POLARITY 0x4e
  224. #define EM202_GPIO_STICKY 0x50
  225. #define EM202_GPIO_MASK 0x52
  226. #define EM202_GPIO_STATUS 0x54
  227. #define EM202_SPDIF_OUT_SEL 0x6a
  228. #define EM202_ANTIPOP 0x72
  229. #define EM202_EAPD_GPIO_ACCESS 0x74