mtk_fbconfig_kdebug.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /*
  2. * Copyright (C) 2015 MediaTek Inc.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef __MTK_FBCONFIG_KDEBUG_H
  14. #define __MTK_FBCONFIG_KDEBUG_H
  15. #include <linux/types.h>
  16. #include <drm/drmP.h>
  17. #include <drm/drm_mipi_dsi.h>
  18. #include "mtk_drm_ddp_comp.h"
  19. void PanelMaster_probe(void);
  20. void PanelMaster_Init(struct drm_device *dev);
  21. void PanelMaster_Deinit(void);
  22. int fb_config_execute_cmd(void);
  23. int fbconfig_get_esd_check_exec(void);
  24. #define MAX_INSTRUCTION 35
  25. #define NUM_OF_DSI 1
  26. enum RECORD_TYPE {
  27. RECORD_CMD = 0,
  28. RECORD_MS = 1,
  29. RECORD_PIN_SET = 2,
  30. };
  31. enum DSI_INDEX {
  32. PM_DSI0 = 0,
  33. PM_DSI1 = 1,
  34. PM_DSI_MAX = 0XFF,
  35. };
  36. struct CONFIG_RECORD {
  37. enum RECORD_TYPE type; /* msleep;cmd;setpin;resetpin. */
  38. int ins_num;
  39. int ins_array[MAX_INSTRUCTION];
  40. };
  41. struct CONFIG_RECORD_LIST {
  42. struct CONFIG_RECORD record;
  43. struct list_head list;
  44. };
  45. enum MIPI_SETTING_TYPE {
  46. MIPI_HS_PRPR = 0,
  47. MIPI_HS_ZERO = 1,
  48. MIPI_HS_TRAIL = 2,
  49. MIPI_TA_GO = 3,
  50. MIPI_TA_SURE = 4,
  51. MIPI_TA_GET = 5,
  52. MIPI_DA_HS_EXIT = 6,
  53. MIPI_CLK_ZERO = 7,
  54. MIPI_CLK_TRAIL = 8,
  55. MIPI_CONT_DET = 9,
  56. MIPI_CLK_HS_PRPR = 10,
  57. MIPI_CLK_HS_POST = 11,
  58. MIPI_CLK_HS_EXIT = 12,
  59. MIPI_HPW = 13,
  60. MIPI_HFP = 14,
  61. MIPI_HBP = 15,
  62. MIPI_VPW = 16,
  63. MIPI_VFP = 17,
  64. MIPI_VBP = 18,
  65. MIPI_LPX = 19,
  66. MIPI_SSC_EN = 0xFE,
  67. MIPI_MAX = 0XFF,
  68. };
  69. struct MIPI_TIMING {
  70. enum MIPI_SETTING_TYPE type;
  71. unsigned int value;
  72. };
  73. struct SETTING_VALUE {
  74. enum DSI_INDEX dsi_index;
  75. unsigned int value[NUM_OF_DSI];
  76. };
  77. struct PM_LAYER_INFO {
  78. int index;
  79. int height;
  80. int width;
  81. int fmt;
  82. unsigned int layer_size;
  83. };
  84. struct ESD_PARA {
  85. int addr;
  86. int type;
  87. int para_num;
  88. char *esd_ret_buffer;
  89. };
  90. #if 0
  91. struct LAYER_H_SIZE {
  92. int layer_size;
  93. int height;
  94. int fmt;
  95. };
  96. #endif
  97. struct MIPI_CLK_V2 {
  98. unsigned char div1;
  99. unsigned char div2;
  100. unsigned short fbk_div;
  101. };
  102. struct LCM_TYPE_FB {
  103. int clock;
  104. int lcm_type;
  105. };
  106. struct DSI_RET {
  107. int dsi[NUM_OF_DSI]; /* for there are totally 2 dsi. */
  108. };
  109. struct LCM_REG_READ {
  110. int check_addr;
  111. int check_para_num;
  112. int check_type;
  113. char *check_buffer;
  114. };
  115. struct FBCONFIG_DISP_IF {
  116. void (*set_cmd_mode)(void);
  117. int (*set_mipi_clk)(unsigned int clk);
  118. void (*set_dsi_post)(void);
  119. void (*set_lane_num)(unsigned int lane_num);
  120. void (*set_mipi_timing)(struct MIPI_TIMING timing);
  121. void (*set_te_enable)(char enable);
  122. void (*set_continuous_clock)(int enable);
  123. int (*set_spread_frequency)(unsigned int clk);
  124. int (*set_get_misc)(const char *name, void *parameter);
  125. };
  126. struct misc_property {
  127. unsigned int dual_port:1;
  128. unsigned int overall_layer_num:5;
  129. unsigned int reserved:26;
  130. };
  131. void Panel_Master_DDIC_config(void);
  132. #include <linux/uaccess.h>
  133. #include <linux/compat.h>
  134. #ifdef CONFIG_COMPAT
  135. struct compat_lcm_type_fb {
  136. compat_int_t clock;
  137. compat_int_t lcm_type;
  138. };
  139. struct compat_config_record {
  140. compat_int_t type; /* msleep;cmd;setpin;resetpin. */
  141. compat_int_t ins_num;
  142. compat_int_t ins_array[MAX_INSTRUCTION];
  143. };
  144. struct compat_dsi_ret {
  145. compat_int_t dsi[NUM_OF_DSI]; /* for there are totally 2 dsi. */
  146. };
  147. struct compat_mipi_timing {
  148. compat_int_t type;
  149. compat_uint_t value;
  150. };
  151. /*
  152. * struct compat_pm_layer_en {
  153. * compat_int_t layer_en[TOTAL_OVL_LAYER_NUM];
  154. * };
  155. */
  156. struct compat_pm_layer_info {
  157. compat_int_t index;
  158. compat_int_t height;
  159. compat_int_t width;
  160. compat_int_t fmt;
  161. compat_uint_t layer_size;
  162. };
  163. struct compat_esd_para {
  164. compat_int_t addr;
  165. compat_int_t type;
  166. compat_int_t para_num;
  167. compat_uint_t esd_ret_buffer;
  168. };
  169. #endif
  170. /* end CONFIG_COMPAT */
  171. int Panel_Master_dsi_config_entry(struct drm_crtc *crtc,
  172. const char *name, int config_value);
  173. u32 fbconfig_mtk_dsi_get_lanes_num(struct mtk_ddp_comp *comp);
  174. int fbconfig_mtk_dsi_get_mode_type(struct mtk_ddp_comp *comp);
  175. int fbconfig_get_esd_check_test(struct drm_crtc *crtc,
  176. uint32_t cmd, uint8_t *buffer, uint32_t num);
  177. int Panel_Master_lcm_get_dsi_timing_entry(struct drm_crtc *crtc,
  178. int type);
  179. int Panel_Master_mipi_set_timing_entry(struct drm_crtc *crtc,
  180. struct MIPI_TIMING timing);
  181. int Panel_Master_mipi_set_cc_entry(struct drm_crtc *crtc,
  182. int enable);
  183. int Panel_Master_mipi_get_cc_entry(struct drm_crtc *crtc);
  184. #endif
  185. /* __MTK_FBCONFIG_KDEBUG_H */