ddp_dsi.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. #ifndef __DSI_DRV_H__
  2. #define __DSI_DRV_H__
  3. #include <linux/types.h>
  4. #include "lcm_drv.h"
  5. #include "ddp_hal.h"
  6. #include "fbconfig_kdebug.h"
  7. #include "ddp_info.h"
  8. #include "ddp_manager.h"
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. extern const LCM_UTIL_FUNCS PM_lcm_utils_dsi0;
  13. extern void DSI_manual_enter_HS(cmdqRecHandle cmdq);
  14. extern void DSI_sw_clk_trail_cmdq(int module_idx, cmdqRecHandle cmdq);
  15. void DSI_ForceConfig(int forceconfig);
  16. int DSI_set_roi(int x, int y);
  17. int DSI_check_roi(void);
  18. /* --------------------------------------------------------------------------- */
  19. #define DSI_CHECK_RET(expr) \
  20. do { \
  21. DSI_STATUS ret = (expr); \
  22. ASSERT(DSI_STATUS_OK == ret); \
  23. } while (0)
  24. /* --------------------------------------------------------------------------- */
  25. #define DSI_DCS_SHORT_PACKET_ID_0 0x05
  26. #define DSI_DCS_SHORT_PACKET_ID_1 0x15
  27. #define DSI_DCS_LONG_PACKET_ID 0x39
  28. #define DSI_DCS_READ_PACKET_ID 0x06
  29. #define DSI_GERNERIC_SHORT_PACKET_ID_1 0x13
  30. #define DSI_GERNERIC_SHORT_PACKET_ID_2 0x23
  31. #define DSI_GERNERIC_LONG_PACKET_ID 0x29
  32. #define DSI_GERNERIC_READ_LONG_PACKET_ID 0x14
  33. #define DSI_NULL_PACKET_ID 0x09
  34. #define DSI_WMEM_CONTI (0x3C)
  35. #define DSI_RMEM_CONTI (0x3E)
  36. /* ESD recovery method for video mode LCM */
  37. #define METHOD_NONCONTINUOUS_CLK (0x1)
  38. #define METHOD_BUS_TURN_AROUND (0x2)
  39. /* State of DSI engine */
  40. #define DSI_VDO_VSA_VS_STATE (0x008)
  41. #define DSI_VDO_VSA_HS_STATE (0x010)
  42. #define DSI_VDO_VSA_VE_STATE (0x020)
  43. #define DSI_VDO_VBP_STATE (0x040)
  44. #define DSI_VDO_VACT_STATE (0x080)
  45. #define DSI_VDO_VFP_STATE (0x100)
  46. /* --------------------------------------------------------------------------- */
  47. typedef enum {
  48. DSI_STATUS_OK = 0,
  49. DSI_STATUS_ERROR,
  50. } DSI_STATUS;
  51. typedef enum {
  52. SHORT_PACKET_RW = 0,
  53. FB_WRITE = 1,
  54. LONG_PACKET_W = 2,
  55. FB_READ = 3,
  56. } DSI_INS_TYPE;
  57. typedef enum {
  58. DISABLE_BTA = 0,
  59. ENABLE_BTA = 1,
  60. } DSI_CMDQ_BTA;
  61. typedef enum {
  62. LOW_POWER = 0,
  63. HIGH_SPEED = 1,
  64. } DSI_CMDQ_HS;
  65. typedef enum {
  66. CL_8BITS = 0,
  67. CL_16BITS = 1,
  68. } DSI_CMDQ_CL;
  69. typedef enum {
  70. DISABLE_TE = 0,
  71. ENABLE_TE = 1,
  72. } DSI_CMDQ_TE;
  73. typedef enum {
  74. DISABLE_RPT = 0,
  75. ENABLE_RPT = 1,
  76. } DSI_CMDQ_RPT;
  77. typedef struct {
  78. unsigned type:2;
  79. unsigned BTA:1;
  80. unsigned HS:1;
  81. unsigned CL:1;
  82. unsigned TE:1;
  83. unsigned Rsv:1;
  84. unsigned RPT:1;
  85. } DSI_CMDQ_CONFG, *PDSI_CMDQ_CONFIG;
  86. typedef struct {
  87. unsigned CONFG:8;
  88. unsigned Data_ID:8;
  89. unsigned Data0:8;
  90. unsigned Data1:8;
  91. } DSI_T0_INS, *PDSI_T0_INS;
  92. typedef struct {
  93. unsigned CONFG:8;
  94. unsigned Data_ID:8;
  95. unsigned mem_start0:8;
  96. unsigned mem_start1:8;
  97. } DSI_T1_INS, *PDSI_T1_INS;
  98. typedef struct {
  99. unsigned CONFG:8;
  100. unsigned Data_ID:8;
  101. unsigned WC16:16;
  102. unsigned int *pdata;
  103. } DSI_T2_INS, *PDSI_T2_INS;
  104. typedef struct {
  105. unsigned CONFG:8;
  106. unsigned Data_ID:8;
  107. unsigned mem_start0:8;
  108. unsigned mem_start1:8;
  109. } DSI_T3_INS, *PDSI_T3_INS;
  110. typedef struct {
  111. uint8_t TXDIV0;
  112. uint8_t TXDIV1;
  113. uint32_t SDM_PCW;
  114. uint8_t SSC_PH_INIT;
  115. uint16_t SSC_PRD;
  116. uint16_t SSC_DELTA1;
  117. uint16_t SSC_DELTA;
  118. } DSI_PLL_CONFIG;
  119. typedef enum {
  120. DSI_INTERFACE_0 = 0,
  121. DSI_INTERFACE_1,
  122. DSI_INTERFACE_DUAL,
  123. DSI_INTERFACE_NUM,
  124. } DSI_INTERFACE_ID;
  125. void DSI_ChangeClk(DISP_MODULE_ENUM module, uint32_t clk);
  126. int32_t DSI_ssc_enable(uint32_t dsi_idx, uint32_t en);
  127. uint32_t PanelMaster_get_CC(uint32_t dsi_idx);
  128. void PanelMaster_set_CC(uint32_t dsi_index, uint32_t enable);
  129. uint32_t PanelMaster_get_dsi_timing(uint32_t dsi_index, MIPI_SETTING_TYPE type);
  130. uint32_t PanelMaster_get_TE_status(uint32_t dsi_idx);
  131. void PanelMaster_DSI_set_timing(uint32_t dsi_index, MIPI_TIMING timing);
  132. unsigned int PanelMaster_set_PM_enable(unsigned int value);
  133. uint32_t DSI_dcs_read_lcm_reg_v2(DISP_MODULE_ENUM module, cmdqRecHandle cmdq, uint8_t cmd,
  134. uint8_t *buffer, uint8_t buffer_size);
  135. void *get_dsi_params_handle(uint32_t dsi_idx);
  136. DSI_STATUS DSI_BIST_Pattern_Test(DISP_MODULE_ENUM module, cmdqRecHandle cmdq, bool enable,
  137. unsigned int color);
  138. extern DDP_MODULE_DRIVER ddp_driver_dsi0;
  139. extern DDP_MODULE_DRIVER ddp_driver_dsi1;
  140. extern DDP_MODULE_DRIVER ddp_driver_dsidual;
  141. #ifdef __cplusplus
  142. }
  143. #endif
  144. #endif /* __DPI_DRV_H__ */