tvp514x_regs.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. /*
  2. * drivers/media/i2c/tvp514x_regs.h
  3. *
  4. * Copyright (C) 2008 Texas Instruments Inc
  5. * Author: Vaibhav Hiremath <hvaibhav@ti.com>
  6. *
  7. * Contributors:
  8. * Sivaraj R <sivaraj@ti.com>
  9. * Brijesh R Jadav <brijesh.j@ti.com>
  10. * Hardik Shah <hardik.shah@ti.com>
  11. * Manjunath Hadli <mrh@ti.com>
  12. * Karicheri Muralidharan <m-karicheri2@ti.com>
  13. *
  14. * This package is free software; you can redistribute it and/or modify
  15. * it under the terms of the GNU General Public License version 2 as
  16. * published by the Free Software Foundation.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  26. *
  27. */
  28. #ifndef _TVP514X_REGS_H
  29. #define _TVP514X_REGS_H
  30. /*
  31. * TVP5146/47 registers
  32. */
  33. #define REG_INPUT_SEL (0x00)
  34. #define REG_AFE_GAIN_CTRL (0x01)
  35. #define REG_VIDEO_STD (0x02)
  36. #define REG_OPERATION_MODE (0x03)
  37. #define REG_AUTOSWITCH_MASK (0x04)
  38. #define REG_COLOR_KILLER (0x05)
  39. #define REG_LUMA_CONTROL1 (0x06)
  40. #define REG_LUMA_CONTROL2 (0x07)
  41. #define REG_LUMA_CONTROL3 (0x08)
  42. #define REG_BRIGHTNESS (0x09)
  43. #define REG_CONTRAST (0x0A)
  44. #define REG_SATURATION (0x0B)
  45. #define REG_HUE (0x0C)
  46. #define REG_CHROMA_CONTROL1 (0x0D)
  47. #define REG_CHROMA_CONTROL2 (0x0E)
  48. /* 0x0F Reserved */
  49. #define REG_COMP_PR_SATURATION (0x10)
  50. #define REG_COMP_Y_CONTRAST (0x11)
  51. #define REG_COMP_PB_SATURATION (0x12)
  52. /* 0x13 Reserved */
  53. #define REG_COMP_Y_BRIGHTNESS (0x14)
  54. /* 0x15 Reserved */
  55. #define REG_AVID_START_PIXEL_LSB (0x16)
  56. #define REG_AVID_START_PIXEL_MSB (0x17)
  57. #define REG_AVID_STOP_PIXEL_LSB (0x18)
  58. #define REG_AVID_STOP_PIXEL_MSB (0x19)
  59. #define REG_HSYNC_START_PIXEL_LSB (0x1A)
  60. #define REG_HSYNC_START_PIXEL_MSB (0x1B)
  61. #define REG_HSYNC_STOP_PIXEL_LSB (0x1C)
  62. #define REG_HSYNC_STOP_PIXEL_MSB (0x1D)
  63. #define REG_VSYNC_START_LINE_LSB (0x1E)
  64. #define REG_VSYNC_START_LINE_MSB (0x1F)
  65. #define REG_VSYNC_STOP_LINE_LSB (0x20)
  66. #define REG_VSYNC_STOP_LINE_MSB (0x21)
  67. #define REG_VBLK_START_LINE_LSB (0x22)
  68. #define REG_VBLK_START_LINE_MSB (0x23)
  69. #define REG_VBLK_STOP_LINE_LSB (0x24)
  70. #define REG_VBLK_STOP_LINE_MSB (0x25)
  71. /* 0x26 - 0x27 Reserved */
  72. #define REG_FAST_SWTICH_CONTROL (0x28)
  73. /* 0x29 Reserved */
  74. #define REG_FAST_SWTICH_SCART_DELAY (0x2A)
  75. /* 0x2B Reserved */
  76. #define REG_SCART_DELAY (0x2C)
  77. #define REG_CTI_DELAY (0x2D)
  78. #define REG_CTI_CONTROL (0x2E)
  79. /* 0x2F - 0x31 Reserved */
  80. #define REG_SYNC_CONTROL (0x32)
  81. #define REG_OUTPUT_FORMATTER1 (0x33)
  82. #define REG_OUTPUT_FORMATTER2 (0x34)
  83. #define REG_OUTPUT_FORMATTER3 (0x35)
  84. #define REG_OUTPUT_FORMATTER4 (0x36)
  85. #define REG_OUTPUT_FORMATTER5 (0x37)
  86. #define REG_OUTPUT_FORMATTER6 (0x38)
  87. #define REG_CLEAR_LOST_LOCK (0x39)
  88. #define REG_STATUS1 (0x3A)
  89. #define REG_STATUS2 (0x3B)
  90. #define REG_AGC_GAIN_STATUS_LSB (0x3C)
  91. #define REG_AGC_GAIN_STATUS_MSB (0x3D)
  92. /* 0x3E Reserved */
  93. #define REG_VIDEO_STD_STATUS (0x3F)
  94. #define REG_GPIO_INPUT1 (0x40)
  95. #define REG_GPIO_INPUT2 (0x41)
  96. /* 0x42 - 0x45 Reserved */
  97. #define REG_AFE_COARSE_GAIN_CH1 (0x46)
  98. #define REG_AFE_COARSE_GAIN_CH2 (0x47)
  99. #define REG_AFE_COARSE_GAIN_CH3 (0x48)
  100. #define REG_AFE_COARSE_GAIN_CH4 (0x49)
  101. #define REG_AFE_FINE_GAIN_PB_B_LSB (0x4A)
  102. #define REG_AFE_FINE_GAIN_PB_B_MSB (0x4B)
  103. #define REG_AFE_FINE_GAIN_Y_G_CHROMA_LSB (0x4C)
  104. #define REG_AFE_FINE_GAIN_Y_G_CHROMA_MSB (0x4D)
  105. #define REG_AFE_FINE_GAIN_PR_R_LSB (0x4E)
  106. #define REG_AFE_FINE_GAIN_PR_R_MSB (0x4F)
  107. #define REG_AFE_FINE_GAIN_CVBS_LUMA_LSB (0x50)
  108. #define REG_AFE_FINE_GAIN_CVBS_LUMA_MSB (0x51)
  109. /* 0x52 - 0x68 Reserved */
  110. #define REG_FBIT_VBIT_CONTROL1 (0x69)
  111. /* 0x6A - 0x6B Reserved */
  112. #define REG_BACKEND_AGC_CONTROL (0x6C)
  113. /* 0x6D - 0x6E Reserved */
  114. #define REG_AGC_DECREMENT_SPEED_CONTROL (0x6F)
  115. #define REG_ROM_VERSION (0x70)
  116. /* 0x71 - 0x73 Reserved */
  117. #define REG_AGC_WHITE_PEAK_PROCESSING (0x74)
  118. #define REG_FBIT_VBIT_CONTROL2 (0x75)
  119. #define REG_VCR_TRICK_MODE_CONTROL (0x76)
  120. #define REG_HORIZONTAL_SHAKE_INCREMENT (0x77)
  121. #define REG_AGC_INCREMENT_SPEED (0x78)
  122. #define REG_AGC_INCREMENT_DELAY (0x79)
  123. /* 0x7A - 0x7F Reserved */
  124. #define REG_CHIP_ID_MSB (0x80)
  125. #define REG_CHIP_ID_LSB (0x81)
  126. /* 0x82 Reserved */
  127. #define REG_CPLL_SPEED_CONTROL (0x83)
  128. /* 0x84 - 0x96 Reserved */
  129. #define REG_STATUS_REQUEST (0x97)
  130. /* 0x98 - 0x99 Reserved */
  131. #define REG_VERTICAL_LINE_COUNT_LSB (0x9A)
  132. #define REG_VERTICAL_LINE_COUNT_MSB (0x9B)
  133. /* 0x9C - 0x9D Reserved */
  134. #define REG_AGC_DECREMENT_DELAY (0x9E)
  135. /* 0x9F - 0xB0 Reserved */
  136. #define REG_VDP_TTX_FILTER_1_MASK1 (0xB1)
  137. #define REG_VDP_TTX_FILTER_1_MASK2 (0xB2)
  138. #define REG_VDP_TTX_FILTER_1_MASK3 (0xB3)
  139. #define REG_VDP_TTX_FILTER_1_MASK4 (0xB4)
  140. #define REG_VDP_TTX_FILTER_1_MASK5 (0xB5)
  141. #define REG_VDP_TTX_FILTER_2_MASK1 (0xB6)
  142. #define REG_VDP_TTX_FILTER_2_MASK2 (0xB7)
  143. #define REG_VDP_TTX_FILTER_2_MASK3 (0xB8)
  144. #define REG_VDP_TTX_FILTER_2_MASK4 (0xB9)
  145. #define REG_VDP_TTX_FILTER_2_MASK5 (0xBA)
  146. #define REG_VDP_TTX_FILTER_CONTROL (0xBB)
  147. #define REG_VDP_FIFO_WORD_COUNT (0xBC)
  148. #define REG_VDP_FIFO_INTERRUPT_THRLD (0xBD)
  149. /* 0xBE Reserved */
  150. #define REG_VDP_FIFO_RESET (0xBF)
  151. #define REG_VDP_FIFO_OUTPUT_CONTROL (0xC0)
  152. #define REG_VDP_LINE_NUMBER_INTERRUPT (0xC1)
  153. #define REG_VDP_PIXEL_ALIGNMENT_LSB (0xC2)
  154. #define REG_VDP_PIXEL_ALIGNMENT_MSB (0xC3)
  155. /* 0xC4 - 0xD5 Reserved */
  156. #define REG_VDP_LINE_START (0xD6)
  157. #define REG_VDP_LINE_STOP (0xD7)
  158. #define REG_VDP_GLOBAL_LINE_MODE (0xD8)
  159. #define REG_VDP_FULL_FIELD_ENABLE (0xD9)
  160. #define REG_VDP_FULL_FIELD_MODE (0xDA)
  161. /* 0xDB - 0xDF Reserved */
  162. #define REG_VBUS_DATA_ACCESS_NO_VBUS_ADDR_INCR (0xE0)
  163. #define REG_VBUS_DATA_ACCESS_VBUS_ADDR_INCR (0xE1)
  164. #define REG_FIFO_READ_DATA (0xE2)
  165. /* 0xE3 - 0xE7 Reserved */
  166. #define REG_VBUS_ADDRESS_ACCESS1 (0xE8)
  167. #define REG_VBUS_ADDRESS_ACCESS2 (0xE9)
  168. #define REG_VBUS_ADDRESS_ACCESS3 (0xEA)
  169. /* 0xEB - 0xEF Reserved */
  170. #define REG_INTERRUPT_RAW_STATUS0 (0xF0)
  171. #define REG_INTERRUPT_RAW_STATUS1 (0xF1)
  172. #define REG_INTERRUPT_STATUS0 (0xF2)
  173. #define REG_INTERRUPT_STATUS1 (0xF3)
  174. #define REG_INTERRUPT_MASK0 (0xF4)
  175. #define REG_INTERRUPT_MASK1 (0xF5)
  176. #define REG_INTERRUPT_CLEAR0 (0xF6)
  177. #define REG_INTERRUPT_CLEAR1 (0xF7)
  178. /* 0xF8 - 0xFF Reserved */
  179. /*
  180. * Mask and bit definitions of TVP5146/47 registers
  181. */
  182. /* The ID values we are looking for */
  183. #define TVP514X_CHIP_ID_MSB (0x51)
  184. #define TVP5146_CHIP_ID_LSB (0x46)
  185. #define TVP5147_CHIP_ID_LSB (0x47)
  186. #define VIDEO_STD_MASK (0x07)
  187. #define VIDEO_STD_AUTO_SWITCH_BIT (0x00)
  188. #define VIDEO_STD_NTSC_MJ_BIT (0x01)
  189. #define VIDEO_STD_PAL_BDGHIN_BIT (0x02)
  190. #define VIDEO_STD_PAL_M_BIT (0x03)
  191. #define VIDEO_STD_PAL_COMBINATION_N_BIT (0x04)
  192. #define VIDEO_STD_NTSC_4_43_BIT (0x05)
  193. #define VIDEO_STD_SECAM_BIT (0x06)
  194. #define VIDEO_STD_PAL_60_BIT (0x07)
  195. /*
  196. * Status bit
  197. */
  198. #define STATUS_TV_VCR_BIT (1<<0)
  199. #define STATUS_HORZ_SYNC_LOCK_BIT (1<<1)
  200. #define STATUS_VIRT_SYNC_LOCK_BIT (1<<2)
  201. #define STATUS_CLR_SUBCAR_LOCK_BIT (1<<3)
  202. #define STATUS_LOST_LOCK_DETECT_BIT (1<<4)
  203. #define STATUS_FEILD_RATE_BIT (1<<5)
  204. #define STATUS_LINE_ALTERNATING_BIT (1<<6)
  205. #define STATUS_PEAK_WHITE_DETECT_BIT (1<<7)
  206. /* Tokens for register write */
  207. #define TOK_WRITE (0) /* token for write operation */
  208. #define TOK_TERM (1) /* terminating token */
  209. #define TOK_DELAY (2) /* delay token for reg list */
  210. #define TOK_SKIP (3) /* token to skip a register */
  211. /**
  212. * struct tvp514x_reg - Structure for TVP5146/47 register initialization values
  213. * @token - Token: TOK_WRITE, TOK_TERM etc..
  214. * @reg - Register offset
  215. * @val - Register Value for TOK_WRITE or delay in ms for TOK_DELAY
  216. */
  217. struct tvp514x_reg {
  218. u8 token;
  219. u8 reg;
  220. u32 val;
  221. };
  222. #endif /* ifndef _TVP514X_REGS_H */