display2.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Sunxi platform display controller register and constant defines
  4. *
  5. * (C) Copyright 2017 Jernej Skrabec <jernej.skrabec@siol.net>
  6. *
  7. * Based on out of tree Linux DRM driver defines:
  8. * Copyright (C) 2016 Jean-Francois Moine <moinejf@free.fr>
  9. * Copyright (c) 2016 Allwinnertech Co., Ltd.
  10. */
  11. #ifndef _SUNXI_DISPLAY2_H
  12. #define _SUNXI_DISPLAY2_H
  13. /* internal clock settings */
  14. struct de_clk {
  15. u32 gate_cfg;
  16. u32 bus_cfg;
  17. u32 rst_cfg;
  18. u32 div_cfg;
  19. u32 sel_cfg;
  20. };
  21. /* global control */
  22. struct de_glb {
  23. u32 ctl;
  24. u32 status;
  25. u32 dbuff;
  26. u32 size;
  27. };
  28. /* alpha blending */
  29. struct de_bld {
  30. u32 fcolor_ctl;
  31. struct {
  32. u32 fcolor;
  33. u32 insize;
  34. u32 offset;
  35. u32 dum;
  36. } attr[4];
  37. u32 dum0[15];
  38. u32 route;
  39. u32 premultiply;
  40. u32 bkcolor;
  41. u32 output_size;
  42. u32 bld_mode[4];
  43. u32 dum1[4];
  44. u32 ck_ctl;
  45. u32 ck_cfg;
  46. u32 dum2[2];
  47. u32 ck_max[4];
  48. u32 dum3[4];
  49. u32 ck_min[4];
  50. u32 dum4[3];
  51. u32 out_ctl;
  52. };
  53. /* VI channel */
  54. struct de_vi {
  55. struct {
  56. u32 attr;
  57. u32 size;
  58. u32 coord;
  59. u32 pitch[3];
  60. u32 top_laddr[3];
  61. u32 bot_laddr[3];
  62. } cfg[4];
  63. u32 fcolor[4];
  64. u32 top_haddr[3];
  65. u32 bot_haddr[3];
  66. u32 ovl_size[2];
  67. u32 hori[2];
  68. u32 vert[2];
  69. };
  70. struct de_ui {
  71. struct {
  72. u32 attr;
  73. u32 size;
  74. u32 coord;
  75. u32 pitch;
  76. u32 top_laddr;
  77. u32 bot_laddr;
  78. u32 fcolor;
  79. u32 dum;
  80. } cfg[4];
  81. u32 top_haddr;
  82. u32 bot_haddr;
  83. u32 ovl_size;
  84. };
  85. struct de_csc {
  86. u32 csc_ctl;
  87. u8 res[0xc];
  88. u32 coef11;
  89. u32 coef12;
  90. u32 coef13;
  91. u32 coef14;
  92. u32 coef21;
  93. u32 coef22;
  94. u32 coef23;
  95. u32 coef24;
  96. u32 coef31;
  97. u32 coef32;
  98. u32 coef33;
  99. u32 coef34;
  100. };
  101. /*
  102. * DE register constants.
  103. */
  104. #define SUNXI_DE2_MUX0_BASE (SUNXI_DE2_BASE + 0x100000)
  105. #define SUNXI_DE2_MUX1_BASE (SUNXI_DE2_BASE + 0x200000)
  106. #define SUNXI_DE2_MUX_GLB_REGS 0x00000
  107. #define SUNXI_DE2_MUX_BLD_REGS 0x01000
  108. #define SUNXI_DE2_MUX_CHAN_REGS 0x02000
  109. #define SUNXI_DE2_MUX_CHAN_SZ 0x1000
  110. #define SUNXI_DE2_MUX_VSU_REGS 0x20000
  111. #define SUNXI_DE2_MUX_GSU1_REGS 0x30000
  112. #define SUNXI_DE2_MUX_GSU2_REGS 0x40000
  113. #define SUNXI_DE2_MUX_GSU3_REGS 0x50000
  114. #define SUNXI_DE2_MUX_FCE_REGS 0xa0000
  115. #define SUNXI_DE2_MUX_BWS_REGS 0xa2000
  116. #define SUNXI_DE2_MUX_LTI_REGS 0xa4000
  117. #define SUNXI_DE2_MUX_PEAK_REGS 0xa6000
  118. #define SUNXI_DE2_MUX_ASE_REGS 0xa8000
  119. #define SUNXI_DE2_MUX_FCC_REGS 0xaa000
  120. #define SUNXI_DE2_MUX_DCSC_REGS 0xb0000
  121. #define SUNXI_DE2_FORMAT_XRGB_8888 4
  122. #define SUNXI_DE2_FORMAT_RGB_565 10
  123. #define SUNXI_DE2_MUX_GLB_CTL_EN (1 << 0)
  124. #define SUNXI_DE2_UI_CFG_ATTR_EN (1 << 0)
  125. #define SUNXI_DE2_UI_CFG_ATTR_FMT(f) ((f & 0xf) << 8)
  126. #define SUNXI_DE2_WH(w, h) (((h - 1) << 16) | (w - 1))
  127. #endif /* _SUNXI_DISPLAY2_H */