dc.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2010
  4. * NVIDIA Corporation <www.nvidia.com>
  5. */
  6. #ifndef __ASM_ARCH_TEGRA_DC_H
  7. #define __ASM_ARCH_TEGRA_DC_H
  8. /* Register definitions for the Tegra display controller */
  9. /* CMD register 0x000 ~ 0x43 */
  10. struct dc_cmd_reg {
  11. /* Address 0x000 ~ 0x002 */
  12. uint gen_incr_syncpt; /* _CMD_GENERAL_INCR_SYNCPT_0 */
  13. uint gen_incr_syncpt_ctrl; /* _CMD_GENERAL_INCR_SYNCPT_CNTRL_0 */
  14. uint gen_incr_syncpt_err; /* _CMD_GENERAL_INCR_SYNCPT_ERROR_0 */
  15. uint reserved0[5]; /* reserved_0[5] */
  16. /* Address 0x008 ~ 0x00a */
  17. uint win_a_incr_syncpt; /* _CMD_WIN_A_INCR_SYNCPT_0 */
  18. uint win_a_incr_syncpt_ctrl; /* _CMD_WIN_A_INCR_SYNCPT_CNTRL_0 */
  19. uint win_a_incr_syncpt_err; /* _CMD_WIN_A_INCR_SYNCPT_ERROR_0 */
  20. uint reserved1[5]; /* reserved_1[5] */
  21. /* Address 0x010 ~ 0x012 */
  22. uint win_b_incr_syncpt; /* _CMD_WIN_B_INCR_SYNCPT_0 */
  23. uint win_b_incr_syncpt_ctrl; /* _CMD_WIN_B_INCR_SYNCPT_CNTRL_0 */
  24. uint win_b_incr_syncpt_err; /* _CMD_WIN_B_INCR_SYNCPT_ERROR_0 */
  25. uint reserved2[5]; /* reserved_2[5] */
  26. /* Address 0x018 ~ 0x01a */
  27. uint win_c_incr_syncpt; /* _CMD_WIN_C_INCR_SYNCPT_0 */
  28. uint win_c_incr_syncpt_ctrl; /* _CMD_WIN_C_INCR_SYNCPT_CNTRL_0 */
  29. uint win_c_incr_syncpt_err; /* _CMD_WIN_C_INCR_SYNCPT_ERROR_0 */
  30. uint reserved3[13]; /* reserved_3[13] */
  31. /* Address 0x028 */
  32. uint cont_syncpt_vsync; /* _CMD_CONT_SYNCPT_VSYNC_0 */
  33. uint reserved4[7]; /* reserved_4[7] */
  34. /* Address 0x030 ~ 0x033 */
  35. uint ctxsw; /* _CMD_CTXSW_0 */
  36. uint disp_cmd_opt0; /* _CMD_DISPLAY_COMMAND_OPTION0_0 */
  37. uint disp_cmd; /* _CMD_DISPLAY_COMMAND_0 */
  38. uint sig_raise; /* _CMD_SIGNAL_RAISE_0 */
  39. uint reserved5[2]; /* reserved_0[2] */
  40. /* Address 0x036 ~ 0x03e */
  41. uint disp_pow_ctrl; /* _CMD_DISPLAY_POWER_CONTROL_0 */
  42. uint int_stat; /* _CMD_INT_STATUS_0 */
  43. uint int_mask; /* _CMD_INT_MASK_0 */
  44. uint int_enb; /* _CMD_INT_ENABLE_0 */
  45. uint int_type; /* _CMD_INT_TYPE_0 */
  46. uint int_polarity; /* _CMD_INT_POLARITY_0 */
  47. uint sig_raise1; /* _CMD_SIGNAL_RAISE1_0 */
  48. uint sig_raise2; /* _CMD_SIGNAL_RAISE2_0 */
  49. uint sig_raise3; /* _CMD_SIGNAL_RAISE3_0 */
  50. uint reserved6; /* reserved_6 */
  51. /* Address 0x040 ~ 0x043 */
  52. uint state_access; /* _CMD_STATE_ACCESS_0 */
  53. uint state_ctrl; /* _CMD_STATE_CONTROL_0 */
  54. uint disp_win_header; /* _CMD_DISPLAY_WINDOW_HEADER_0 */
  55. uint reg_act_ctrl; /* _CMD_REG_ACT_CONTROL_0 */
  56. };
  57. enum {
  58. PIN_REG_COUNT = 4,
  59. PIN_OUTPUT_SEL_COUNT = 7,
  60. };
  61. /* COM register 0x300 ~ 0x329 */
  62. struct dc_com_reg {
  63. /* Address 0x300 ~ 0x301 */
  64. uint crc_ctrl; /* _COM_CRC_CONTROL_0 */
  65. uint crc_checksum; /* _COM_CRC_CHECKSUM_0 */
  66. /* _COM_PIN_OUTPUT_ENABLE0/1/2/3_0: Address 0x302 ~ 0x305 */
  67. uint pin_output_enb[PIN_REG_COUNT];
  68. /* _COM_PIN_OUTPUT_POLARITY0/1/2/3_0: Address 0x306 ~ 0x309 */
  69. uint pin_output_polarity[PIN_REG_COUNT];
  70. /* _COM_PIN_OUTPUT_DATA0/1/2/3_0: Address 0x30a ~ 0x30d */
  71. uint pin_output_data[PIN_REG_COUNT];
  72. /* _COM_PIN_INPUT_ENABLE0_0: Address 0x30e ~ 0x311 */
  73. uint pin_input_enb[PIN_REG_COUNT];
  74. /* Address 0x312 ~ 0x313 */
  75. uint pin_input_data0; /* _COM_PIN_INPUT_DATA0_0 */
  76. uint pin_input_data1; /* _COM_PIN_INPUT_DATA1_0 */
  77. /* _COM_PIN_OUTPUT_SELECT0/1/2/3/4/5/6_0: Address 0x314 ~ 0x31a */
  78. uint pin_output_sel[PIN_OUTPUT_SEL_COUNT];
  79. /* Address 0x31b ~ 0x329 */
  80. uint pin_misc_ctrl; /* _COM_PIN_MISC_CONTROL_0 */
  81. uint pm0_ctrl; /* _COM_PM0_CONTROL_0 */
  82. uint pm0_duty_cycle; /* _COM_PM0_DUTY_CYCLE_0 */
  83. uint pm1_ctrl; /* _COM_PM1_CONTROL_0 */
  84. uint pm1_duty_cycle; /* _COM_PM1_DUTY_CYCLE_0 */
  85. uint spi_ctrl; /* _COM_SPI_CONTROL_0 */
  86. uint spi_start_byte; /* _COM_SPI_START_BYTE_0 */
  87. uint hspi_wr_data_ab; /* _COM_HSPI_WRITE_DATA_AB_0 */
  88. uint hspi_wr_data_cd; /* _COM_HSPI_WRITE_DATA_CD */
  89. uint hspi_cs_dc; /* _COM_HSPI_CS_DC_0 */
  90. uint scratch_reg_a; /* _COM_SCRATCH_REGISTER_A_0 */
  91. uint scratch_reg_b; /* _COM_SCRATCH_REGISTER_B_0 */
  92. uint gpio_ctrl; /* _COM_GPIO_CTRL_0 */
  93. uint gpio_debounce_cnt; /* _COM_GPIO_DEBOUNCE_COUNTER_0 */
  94. uint crc_checksum_latched; /* _COM_CRC_CHECKSUM_LATCHED_0 */
  95. };
  96. enum dc_disp_h_pulse_pos {
  97. H_PULSE0_POSITION_A,
  98. H_PULSE0_POSITION_B,
  99. H_PULSE0_POSITION_C,
  100. H_PULSE0_POSITION_D,
  101. H_PULSE0_POSITION_COUNT,
  102. };
  103. struct _disp_h_pulse {
  104. /* _DISP_H_PULSE0/1/2_CONTROL_0 */
  105. uint h_pulse_ctrl;
  106. /* _DISP_H_PULSE0/1/2_POSITION_A/B/C/D_0 */
  107. uint h_pulse_pos[H_PULSE0_POSITION_COUNT];
  108. };
  109. enum dc_disp_v_pulse_pos {
  110. V_PULSE0_POSITION_A,
  111. V_PULSE0_POSITION_B,
  112. V_PULSE0_POSITION_C,
  113. V_PULSE0_POSITION_COUNT,
  114. };
  115. struct _disp_v_pulse0 {
  116. /* _DISP_H_PULSE0/1_CONTROL_0 */
  117. uint v_pulse_ctrl;
  118. /* _DISP_H_PULSE0/1_POSITION_A/B/C_0 */
  119. uint v_pulse_pos[V_PULSE0_POSITION_COUNT];
  120. };
  121. struct _disp_v_pulse2 {
  122. /* _DISP_H_PULSE2/3_CONTROL_0 */
  123. uint v_pulse_ctrl;
  124. /* _DISP_H_PULSE2/3_POSITION_A_0 */
  125. uint v_pulse_pos_a;
  126. };
  127. enum dc_disp_h_pulse_reg {
  128. H_PULSE0,
  129. H_PULSE1,
  130. H_PULSE2,
  131. H_PULSE_COUNT,
  132. };
  133. enum dc_disp_pp_select {
  134. PP_SELECT_A,
  135. PP_SELECT_B,
  136. PP_SELECT_C,
  137. PP_SELECT_D,
  138. PP_SELECT_COUNT,
  139. };
  140. /* DISP register 0x400 ~ 0x4c1 */
  141. struct dc_disp_reg {
  142. /* Address 0x400 ~ 0x40a */
  143. uint disp_signal_opt0; /* _DISP_DISP_SIGNAL_OPTIONS0_0 */
  144. uint disp_signal_opt1; /* _DISP_DISP_SIGNAL_OPTIONS1_0 */
  145. uint disp_win_opt; /* _DISP_DISP_WIN_OPTIONS_0 */
  146. uint mem_high_pri; /* _DISP_MEM_HIGH_PRIORITY_0 */
  147. uint mem_high_pri_timer; /* _DISP_MEM_HIGH_PRIORITY_TIMER_0 */
  148. uint disp_timing_opt; /* _DISP_DISP_TIMING_OPTIONS_0 */
  149. uint ref_to_sync; /* _DISP_REF_TO_SYNC_0 */
  150. uint sync_width; /* _DISP_SYNC_WIDTH_0 */
  151. uint back_porch; /* _DISP_BACK_PORCH_0 */
  152. uint disp_active; /* _DISP_DISP_ACTIVE_0 */
  153. uint front_porch; /* _DISP_FRONT_PORCH_0 */
  154. /* Address 0x40b ~ 0x419: _DISP_H_PULSE0/1/2_ */
  155. struct _disp_h_pulse h_pulse[H_PULSE_COUNT];
  156. /* Address 0x41a ~ 0x421 */
  157. struct _disp_v_pulse0 v_pulse0; /* _DISP_V_PULSE0_ */
  158. struct _disp_v_pulse0 v_pulse1; /* _DISP_V_PULSE1_ */
  159. /* Address 0x422 ~ 0x425 */
  160. struct _disp_v_pulse2 v_pulse3; /* _DISP_V_PULSE2_ */
  161. struct _disp_v_pulse2 v_pulse4; /* _DISP_V_PULSE3_ */
  162. /* Address 0x426 ~ 0x429 */
  163. uint m0_ctrl; /* _DISP_M0_CONTROL_0 */
  164. uint m1_ctrl; /* _DISP_M1_CONTROL_0 */
  165. uint di_ctrl; /* _DISP_DI_CONTROL_0 */
  166. uint pp_ctrl; /* _DISP_PP_CONTROL_0 */
  167. /* Address 0x42a ~ 0x42d: _DISP_PP_SELECT_A/B/C/D_0 */
  168. uint pp_select[PP_SELECT_COUNT];
  169. /* Address 0x42e ~ 0x435 */
  170. uint disp_clk_ctrl; /* _DISP_DISP_CLOCK_CONTROL_0 */
  171. uint disp_interface_ctrl; /* _DISP_DISP_INTERFACE_CONTROL_0 */
  172. uint disp_color_ctrl; /* _DISP_DISP_COLOR_CONTROL_0 */
  173. uint shift_clk_opt; /* _DISP_SHIFT_CLOCK_OPTIONS_0 */
  174. uint data_enable_opt; /* _DISP_DATA_ENABLE_OPTIONS_0 */
  175. uint serial_interface_opt; /* _DISP_SERIAL_INTERFACE_OPTIONS_0 */
  176. uint lcd_spi_opt; /* _DISP_LCD_SPI_OPTIONS_0 */
  177. uint border_color; /* _DISP_BORDER_COLOR_0 */
  178. /* Address 0x436 ~ 0x439 */
  179. uint color_key0_lower; /* _DISP_COLOR_KEY0_LOWER_0 */
  180. uint color_key0_upper; /* _DISP_COLOR_KEY0_UPPER_0 */
  181. uint color_key1_lower; /* _DISP_COLOR_KEY1_LOWER_0 */
  182. uint color_key1_upper; /* _DISP_COLOR_KEY1_UPPER_0 */
  183. uint reserved0[2]; /* reserved_0[2] */
  184. /* Address 0x43c ~ 0x442 */
  185. uint cursor_foreground; /* _DISP_CURSOR_FOREGROUND_0 */
  186. uint cursor_background; /* _DISP_CURSOR_BACKGROUND_0 */
  187. uint cursor_start_addr; /* _DISP_CURSOR_START_ADDR_0 */
  188. uint cursor_start_addr_ns; /* _DISP_CURSOR_START_ADDR_NS_0 */
  189. uint cursor_pos; /* _DISP_CURSOR_POSITION_0 */
  190. uint cursor_pos_ns; /* _DISP_CURSOR_POSITION_NS_0 */
  191. uint seq_ctrl; /* _DISP_INIT_SEQ_CONTROL_0 */
  192. /* Address 0x443 ~ 0x446 */
  193. uint spi_init_seq_data_a; /* _DISP_SPI_INIT_SEQ_DATA_A_0 */
  194. uint spi_init_seq_data_b; /* _DISP_SPI_INIT_SEQ_DATA_B_0 */
  195. uint spi_init_seq_data_c; /* _DISP_SPI_INIT_SEQ_DATA_C_0 */
  196. uint spi_init_seq_data_d; /* _DISP_SPI_INIT_SEQ_DATA_D_0 */
  197. uint reserved1[0x39]; /* reserved1[0x39], */
  198. /* Address 0x480 ~ 0x484 */
  199. uint dc_mccif_fifoctrl; /* _DISP_DC_MCCIF_FIFOCTRL_0 */
  200. uint mccif_disp0a_hyst; /* _DISP_MCCIF_DISPLAY0A_HYST_0 */
  201. uint mccif_disp0b_hyst; /* _DISP_MCCIF_DISPLAY0B_HYST_0 */
  202. uint mccif_disp0c_hyst; /* _DISP_MCCIF_DISPLAY0C_HYST_0 */
  203. uint mccif_disp1b_hyst; /* _DISP_MCCIF_DISPLAY1B_HYST_0 */
  204. uint reserved2[0x3b]; /* reserved2[0x3b] */
  205. /* Address 0x4c0 ~ 0x4c1 */
  206. uint dac_crt_ctrl; /* _DISP_DAC_CRT_CTRL_0 */
  207. uint disp_misc_ctrl; /* _DISP_DISP_MISC_CONTROL_0 */
  208. u32 rsvd_4c2[34]; /* 4c2 - 4e3 */
  209. /* Address 0x4e4 */
  210. u32 blend_background_color; /* _DISP_BLEND_BACKGROUND_COLOR_0 */
  211. };
  212. enum dc_winc_filter_p {
  213. WINC_FILTER_COUNT = 0x10,
  214. };
  215. /* Window A/B/C register 0x500 ~ 0x628 */
  216. struct dc_winc_reg {
  217. /* Address 0x500 */
  218. uint color_palette; /* _WINC_COLOR_PALETTE_0 */
  219. uint reserved0[0xff]; /* reserved_0[0xff] */
  220. /* Address 0x600 */
  221. uint palette_color_ext; /* _WINC_PALETTE_COLOR_EXT_0 */
  222. /* _WINC_H_FILTER_P00~0F_0 */
  223. /* Address 0x601 ~ 0x610 */
  224. uint h_filter_p[WINC_FILTER_COUNT];
  225. /* Address 0x611 ~ 0x618 */
  226. uint csc_yof; /* _WINC_CSC_YOF_0 */
  227. uint csc_kyrgb; /* _WINC_CSC_KYRGB_0 */
  228. uint csc_kur; /* _WINC_CSC_KUR_0 */
  229. uint csc_kvr; /* _WINC_CSC_KVR_0 */
  230. uint csc_kug; /* _WINC_CSC_KUG_0 */
  231. uint csc_kvg; /* _WINC_CSC_KVG_0 */
  232. uint csc_kub; /* _WINC_CSC_KUB_0 */
  233. uint csc_kvb; /* _WINC_CSC_KVB_0 */
  234. /* Address 0x619 ~ 0x628: _WINC_V_FILTER_P00~0F_0 */
  235. uint v_filter_p[WINC_FILTER_COUNT];
  236. };
  237. /* WIN A/B/C Register 0x700 ~ 0x719*/
  238. struct dc_win_reg {
  239. /* Address 0x700 ~ 0x719 */
  240. uint win_opt; /* _WIN_WIN_OPTIONS_0 */
  241. uint byte_swap; /* _WIN_BYTE_SWAP_0 */
  242. uint buffer_ctrl; /* _WIN_BUFFER_CONTROL_0 */
  243. uint color_depth; /* _WIN_COLOR_DEPTH_0 */
  244. uint pos; /* _WIN_POSITION_0 */
  245. uint size; /* _WIN_SIZE_0 */
  246. uint prescaled_size; /* _WIN_PRESCALED_SIZE_0 */
  247. uint h_initial_dda; /* _WIN_H_INITIAL_DDA_0 */
  248. uint v_initial_dda; /* _WIN_V_INITIAL_DDA_0 */
  249. uint dda_increment; /* _WIN_DDA_INCREMENT_0 */
  250. uint line_stride; /* _WIN_LINE_STRIDE_0 */
  251. uint buf_stride; /* _WIN_BUF_STRIDE_0 */
  252. uint uv_buf_stride; /* _WIN_UV_BUF_STRIDE_0 */
  253. uint buffer_addr_mode; /* _WIN_BUFFER_ADDR_MODE_0 */
  254. uint dv_ctrl; /* _WIN_DV_CONTROL_0 */
  255. uint blend_nokey; /* _WIN_BLEND_NOKEY_0 */
  256. uint blend_1win; /* _WIN_BLEND_1WIN_0 */
  257. uint blend_2win_x; /* _WIN_BLEND_2WIN_X_0 */
  258. uint blend_2win_y; /* _WIN_BLEND_2WIN_Y_0 */
  259. uint blend_3win_xy; /* _WIN_BLEND_3WIN_XY_0 */
  260. uint hp_fetch_ctrl; /* _WIN_HP_FETCH_CONTROL_0 */
  261. uint global_alpha; /* _WIN_GLOBAL_ALPHA */
  262. uint blend_layer_ctrl; /* _WINBUF_BLEND_LAYER_CONTROL_0 */
  263. uint blend_match_select; /* _WINBUF_BLEND_MATCH_SELECT_0 */
  264. uint blend_nomatch_select; /* _WINBUF_BLEND_NOMATCH_SELECT_0 */
  265. uint blend_alpha_1bit; /* _WINBUF_BLEND_ALPHA_1BIT_0 */
  266. };
  267. /* WINBUF A/B/C Register 0x800 ~ 0x80d */
  268. struct dc_winbuf_reg {
  269. /* Address 0x800 ~ 0x80d */
  270. uint start_addr; /* _WINBUF_START_ADDR_0 */
  271. uint start_addr_ns; /* _WINBUF_START_ADDR_NS_0 */
  272. uint start_addr_u; /* _WINBUF_START_ADDR_U_0 */
  273. uint start_addr_u_ns; /* _WINBUF_START_ADDR_U_NS_0 */
  274. uint start_addr_v; /* _WINBUF_START_ADDR_V_0 */
  275. uint start_addr_v_ns; /* _WINBUF_START_ADDR_V_NS_0 */
  276. uint addr_h_offset; /* _WINBUF_ADDR_H_OFFSET_0 */
  277. uint addr_h_offset_ns; /* _WINBUF_ADDR_H_OFFSET_NS_0 */
  278. uint addr_v_offset; /* _WINBUF_ADDR_V_OFFSET_0 */
  279. uint addr_v_offset_ns; /* _WINBUF_ADDR_V_OFFSET_NS_0 */
  280. uint uflow_status; /* _WINBUF_UFLOW_STATUS_0 */
  281. uint buffer_surface_kind; /* DC_WIN_BUFFER_SURFACE_KIND */
  282. uint rsvd_80c;
  283. uint start_addr_hi; /* DC_WINBUF_START_ADDR_HI_0 */
  284. };
  285. /* Display Controller (DC_) regs */
  286. struct dc_ctlr {
  287. struct dc_cmd_reg cmd; /* CMD register 0x000 ~ 0x43 */
  288. uint reserved0[0x2bc];
  289. struct dc_com_reg com; /* COM register 0x300 ~ 0x329 */
  290. uint reserved1[0xd6];
  291. struct dc_disp_reg disp; /* DISP register 0x400 ~ 0x4e4 */
  292. uint reserved2[0x1b];
  293. struct dc_winc_reg winc; /* Window A/B/C 0x500 ~ 0x628 */
  294. uint reserved3[0xd7];
  295. struct dc_win_reg win; /* WIN A/B/C 0x700 ~ 0x719*/
  296. uint reserved4[0xe6];
  297. struct dc_winbuf_reg winbuf; /* WINBUF A/B/C 0x800 ~ 0x80d */
  298. };
  299. /* DC_CMD_DISPLAY_COMMAND 0x032 */
  300. #define CTRL_MODE_SHIFT 5
  301. #define CTRL_MODE_MASK (0x3 << CTRL_MODE_SHIFT)
  302. enum {
  303. CTRL_MODE_STOP,
  304. CTRL_MODE_C_DISPLAY,
  305. CTRL_MODE_NC_DISPLAY,
  306. };
  307. /* _WIN_COLOR_DEPTH_0 */
  308. enum win_color_depth_id {
  309. COLOR_DEPTH_P1,
  310. COLOR_DEPTH_P2,
  311. COLOR_DEPTH_P4,
  312. COLOR_DEPTH_P8,
  313. COLOR_DEPTH_B4G4R4A4,
  314. COLOR_DEPTH_B5G5R5A,
  315. COLOR_DEPTH_B5G6R5,
  316. COLOR_DEPTH_AB5G5R5,
  317. COLOR_DEPTH_B8G8R8A8 = 12,
  318. COLOR_DEPTH_R8G8B8A8,
  319. COLOR_DEPTH_B6x2G6x2R6x2A8,
  320. COLOR_DEPTH_R6x2G6x2B6x2A8,
  321. COLOR_DEPTH_YCbCr422,
  322. COLOR_DEPTH_YUV422,
  323. COLOR_DEPTH_YCbCr420P,
  324. COLOR_DEPTH_YUV420P,
  325. COLOR_DEPTH_YCbCr422P,
  326. COLOR_DEPTH_YUV422P,
  327. COLOR_DEPTH_YCbCr422R,
  328. COLOR_DEPTH_YUV422R,
  329. COLOR_DEPTH_YCbCr422RA,
  330. COLOR_DEPTH_YUV422RA,
  331. };
  332. /* DC_CMD_DISPLAY_POWER_CONTROL 0x036 */
  333. #define PW0_ENABLE BIT(0)
  334. #define PW1_ENABLE BIT(2)
  335. #define PW2_ENABLE BIT(4)
  336. #define PW3_ENABLE BIT(6)
  337. #define PW4_ENABLE BIT(8)
  338. #define PM0_ENABLE BIT(16)
  339. #define PM1_ENABLE BIT(18)
  340. #define SPI_ENABLE BIT(24)
  341. #define HSPI_ENABLE BIT(25)
  342. /* DC_CMD_STATE_ACCESS 0x040 */
  343. #define READ_MUX_ASSEMBLY (0 << 0)
  344. #define READ_MUX_ACTIVE (1 << 0)
  345. #define WRITE_MUX_ASSEMBLY (0 << 2)
  346. #define WRITE_MUX_ACTIVE (1 << 2)
  347. /* DC_CMD_STATE_CONTROL 0x041 */
  348. #define GENERAL_ACT_REQ BIT(0)
  349. #define WIN_A_ACT_REQ BIT(1)
  350. #define WIN_B_ACT_REQ BIT(2)
  351. #define WIN_C_ACT_REQ BIT(3)
  352. #define WIN_D_ACT_REQ BIT(4)
  353. #define WIN_H_ACT_REQ BIT(5)
  354. #define CURSOR_ACT_REQ BIT(7)
  355. #define GENERAL_UPDATE BIT(8)
  356. #define WIN_A_UPDATE BIT(9)
  357. #define WIN_B_UPDATE BIT(10)
  358. #define WIN_C_UPDATE BIT(11)
  359. #define WIN_D_UPDATE BIT(12)
  360. #define WIN_H_UPDATE BIT(13)
  361. #define CURSOR_UPDATE BIT(15)
  362. #define NC_HOST_TRIG BIT(24)
  363. /* DC_CMD_DISPLAY_WINDOW_HEADER 0x042 */
  364. #define WINDOW_A_SELECT BIT(4)
  365. #define WINDOW_B_SELECT BIT(5)
  366. #define WINDOW_C_SELECT BIT(6)
  367. #define WINDOW_D_SELECT BIT(7)
  368. #define WINDOW_H_SELECT BIT(8)
  369. /* DC_DISP_DISP_WIN_OPTIONS 0x402 */
  370. #define CURSOR_ENABLE BIT(16)
  371. #define SOR_ENABLE BIT(25)
  372. #define TVO_ENABLE BIT(28)
  373. #define DSI_ENABLE BIT(29)
  374. #define HDMI_ENABLE BIT(30)
  375. /* DC_DISP_DISP_TIMING_OPTIONS 0x405 */
  376. #define VSYNC_H_POSITION(x) ((x) & 0xfff)
  377. /* DC_DISP_DISP_CLOCK_CONTROL 0x42e */
  378. #define SHIFT_CLK_DIVIDER_SHIFT 0
  379. #define SHIFT_CLK_DIVIDER_MASK (0xff << SHIFT_CLK_DIVIDER_SHIFT)
  380. #define PIXEL_CLK_DIVIDER_SHIFT 8
  381. #define PIXEL_CLK_DIVIDER_MSK (0xf << PIXEL_CLK_DIVIDER_SHIFT)
  382. enum {
  383. PIXEL_CLK_DIVIDER_PCD1,
  384. PIXEL_CLK_DIVIDER_PCD1H,
  385. PIXEL_CLK_DIVIDER_PCD2,
  386. PIXEL_CLK_DIVIDER_PCD3,
  387. PIXEL_CLK_DIVIDER_PCD4,
  388. PIXEL_CLK_DIVIDER_PCD6,
  389. PIXEL_CLK_DIVIDER_PCD8,
  390. PIXEL_CLK_DIVIDER_PCD9,
  391. PIXEL_CLK_DIVIDER_PCD12,
  392. PIXEL_CLK_DIVIDER_PCD16,
  393. PIXEL_CLK_DIVIDER_PCD18,
  394. PIXEL_CLK_DIVIDER_PCD24,
  395. PIXEL_CLK_DIVIDER_PCD13,
  396. };
  397. /* DC_DISP_DISP_INTERFACE_CONTROL 0x42f */
  398. #define DATA_FORMAT_SHIFT 0
  399. #define DATA_FORMAT_MASK (0xf << DATA_FORMAT_SHIFT)
  400. enum {
  401. DATA_FORMAT_DF1P1C,
  402. DATA_FORMAT_DF1P2C24B,
  403. DATA_FORMAT_DF1P2C18B,
  404. DATA_FORMAT_DF1P2C16B,
  405. DATA_FORMAT_DF2S,
  406. DATA_FORMAT_DF3S,
  407. DATA_FORMAT_DFSPI,
  408. DATA_FORMAT_DF1P3C24B,
  409. DATA_FORMAT_DF1P3C18B,
  410. };
  411. #define DATA_ALIGNMENT_SHIFT 8
  412. enum {
  413. DATA_ALIGNMENT_MSB,
  414. DATA_ALIGNMENT_LSB,
  415. };
  416. #define DATA_ORDER_SHIFT 9
  417. enum {
  418. DATA_ORDER_RED_BLUE,
  419. DATA_ORDER_BLUE_RED,
  420. };
  421. /* DC_DISP_DATA_ENABLE_OPTIONS 0x432 */
  422. #define DE_SELECT_SHIFT 0
  423. #define DE_SELECT_MASK (0x3 << DE_SELECT_SHIFT)
  424. #define DE_SELECT_ACTIVE_BLANK 0x0
  425. #define DE_SELECT_ACTIVE 0x1
  426. #define DE_SELECT_ACTIVE_IS 0x2
  427. #define DE_CONTROL_SHIFT 2
  428. #define DE_CONTROL_MASK (0x7 << DE_CONTROL_SHIFT)
  429. enum {
  430. DE_CONTROL_ONECLK,
  431. DE_CONTROL_NORMAL,
  432. DE_CONTROL_EARLY_EXT,
  433. DE_CONTROL_EARLY,
  434. DE_CONTROL_ACTIVE_BLANK,
  435. };
  436. /* DC_WIN_WIN_OPTIONS 0x700 */
  437. #define H_DIRECTION BIT(0)
  438. enum {
  439. H_DIRECTION_INCREMENT,
  440. H_DIRECTION_DECREMENT,
  441. };
  442. #define V_DIRECTION BIT(2)
  443. enum {
  444. V_DIRECTION_INCREMENT,
  445. V_DIRECTION_DECREMENT,
  446. };
  447. #define COLOR_EXPAND BIT(6)
  448. #define CP_ENABLE BIT(16)
  449. #define DV_ENABLE BIT(20)
  450. #define WIN_ENABLE BIT(30)
  451. /* DC_WIN_BYTE_SWAP 0x701 */
  452. #define BYTE_SWAP_SHIFT 0
  453. #define BYTE_SWAP_MASK (3 << BYTE_SWAP_SHIFT)
  454. enum {
  455. BYTE_SWAP_NOSWAP,
  456. BYTE_SWAP_SWAP2,
  457. BYTE_SWAP_SWAP4,
  458. BYTE_SWAP_SWAP4HW
  459. };
  460. /* DC_WIN_POSITION 0x704 */
  461. #define H_POSITION_SHIFT 0
  462. #define H_POSITION_MASK (0x1FFF << H_POSITION_SHIFT)
  463. #define V_POSITION_SHIFT 16
  464. #define V_POSITION_MASK (0x1FFF << V_POSITION_SHIFT)
  465. /* DC_WIN_SIZE 0x705 */
  466. #define H_SIZE_SHIFT 0
  467. #define H_SIZE_MASK (0x1FFF << H_SIZE_SHIFT)
  468. #define V_SIZE_SHIFT 16
  469. #define V_SIZE_MASK (0x1FFF << V_SIZE_SHIFT)
  470. /* DC_WIN_PRESCALED_SIZE 0x706 */
  471. #define H_PRESCALED_SIZE_SHIFT 0
  472. #define H_PRESCALED_SIZE_MASK (0x7FFF << H_PRESCALED_SIZE)
  473. #define V_PRESCALED_SIZE_SHIFT 16
  474. #define V_PRESCALED_SIZE_MASK (0x1FFF << V_PRESCALED_SIZE)
  475. /* DC_WIN_DDA_INCREMENT 0x709 */
  476. #define H_DDA_INC_SHIFT 0
  477. #define H_DDA_INC_MASK (0xFFFF << H_DDA_INC_SHIFT)
  478. #define V_DDA_INC_SHIFT 16
  479. #define V_DDA_INC_MASK (0xFFFF << V_DDA_INC_SHIFT)
  480. #define DC_POLL_TIMEOUT_MS 50
  481. #define DC_N_WINDOWS 5
  482. #define DC_REG_SAVE_SPACE (DC_N_WINDOWS + 5)
  483. #endif /* __ASM_ARCH_TEGRA_DC_H */