msm_fb_panel.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. /* Copyright (c) 2008-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. #ifndef MSM_FB_PANEL_H
  14. #define MSM_FB_PANEL_H
  15. #include "msm_fb_def.h"
  16. struct msm_fb_data_type;
  17. typedef void (*msm_fb_vsync_handler_type) (void *arg);
  18. /* panel id type */
  19. typedef struct panel_id_s {
  20. uint16 id;
  21. uint16 type;
  22. } panel_id_type;
  23. /* panel type list */
  24. #define NO_PANEL 0xffff /* No Panel */
  25. #define MDDI_PANEL 1 /* MDDI */
  26. #define EBI2_PANEL 2 /* EBI2 */
  27. #define LCDC_PANEL 3 /* internal LCDC type */
  28. #define EXT_MDDI_PANEL 4 /* Ext.MDDI */
  29. #define TV_PANEL 5 /* TV */
  30. #define HDMI_PANEL 6 /* HDMI TV */
  31. #define DTV_PANEL 7 /* DTV */
  32. #define MIPI_VIDEO_PANEL 8 /* MIPI */
  33. #define MIPI_CMD_PANEL 9 /* MIPI */
  34. #define WRITEBACK_PANEL 10 /* Wifi display */
  35. #define LVDS_PANEL 11 /* LVDS */
  36. /* panel class */
  37. typedef enum {
  38. DISPLAY_LCD = 0, /* lcd = ebi2/mddi */
  39. DISPLAY_LCDC, /* lcdc */
  40. DISPLAY_TV, /* TV Out */
  41. DISPLAY_EXT_MDDI, /* External MDDI */
  42. } DISP_TARGET;
  43. /* panel device locaiton */
  44. typedef enum {
  45. DISPLAY_1 = 0, /* attached as first device */
  46. DISPLAY_2, /* attached on second device */
  47. DISPLAY_3, /* attached on third writeback device */
  48. MAX_PHYS_TARGET_NUM,
  49. } DISP_TARGET_PHYS;
  50. enum {
  51. BLT_SWITCH_TG_OFF,
  52. BLT_SWITCH_TG_ON
  53. };
  54. /* panel info type */
  55. struct lcd_panel_info {
  56. __u32 vsync_enable;
  57. __u32 refx100;
  58. __u32 v_back_porch;
  59. __u32 v_front_porch;
  60. __u32 v_pulse_width;
  61. __u32 hw_vsync_mode;
  62. __u32 vsync_notifier_period;
  63. __u32 blt_ctrl;
  64. __u32 blt_mode;
  65. __u32 rev;
  66. };
  67. struct lcdc_panel_info {
  68. __u32 h_back_porch;
  69. __u32 h_front_porch;
  70. __u32 h_pulse_width;
  71. __u32 v_back_porch;
  72. __u32 v_front_porch;
  73. __u32 v_pulse_width;
  74. __u32 border_clr;
  75. __u32 underflow_clr;
  76. __u32 hsync_skew;
  77. /* Pad width */
  78. uint32 xres_pad;
  79. /* Pad height */
  80. uint32 yres_pad;
  81. boolean is_sync_active_high;
  82. };
  83. struct mddi_panel_info {
  84. __u32 vdopkt;
  85. boolean is_type1;
  86. };
  87. struct mipi_panel_info {
  88. char mode; /* video/cmd */
  89. char interleave_mode;
  90. char crc_check;
  91. char ecc_check;
  92. char dst_format; /* shared by video and command */
  93. char data_lane0;
  94. char data_lane1;
  95. char data_lane2;
  96. char data_lane3;
  97. char dlane_swap; /* data lane swap */
  98. char rgb_swap;
  99. char b_sel;
  100. char g_sel;
  101. char r_sel;
  102. char rx_eot_ignore;
  103. char tx_eot_append;
  104. char t_clk_post; /* 0xc0, DSI_CLKOUT_TIMING_CTRL */
  105. char t_clk_pre; /* 0xc0, DSI_CLKOUT_TIMING_CTRL */
  106. char vc; /* virtual channel */
  107. struct mipi_dsi_phy_ctrl *dsi_phy_db;
  108. /* video mode */
  109. char pulse_mode_hsa_he;
  110. char hfp_power_stop;
  111. char hbp_power_stop;
  112. char hsa_power_stop;
  113. char eof_bllp_power_stop;
  114. char bllp_power_stop;
  115. char traffic_mode;
  116. char frame_rate;
  117. /* command mode */
  118. char interleave_max;
  119. char insert_dcs_cmd;
  120. char wr_mem_continue;
  121. char wr_mem_start;
  122. char te_sel;
  123. char stream; /* 0 or 1 */
  124. char mdp_trigger;
  125. char dma_trigger;
  126. uint32 dsi_pclk_rate;
  127. /* byte to esc clk ratio */
  128. uint32 esc_byte_ratio;
  129. /* The packet-size should not bet changed */
  130. char no_max_pkt_size;
  131. /* Clock required during LP commands */
  132. char force_clk_lane_hs;
  133. };
  134. enum lvds_mode {
  135. LVDS_SINGLE_CHANNEL_MODE,
  136. LVDS_DUAL_CHANNEL_MODE,
  137. };
  138. struct lvds_panel_info {
  139. enum lvds_mode channel_mode;
  140. /* Channel swap in dual mode */
  141. char channel_swap;
  142. };
  143. struct msm_panel_info {
  144. __u32 xres;
  145. __u32 yres;
  146. __u32 bpp;
  147. __u32 mode2_xres;
  148. __u32 mode2_yres;
  149. __u32 mode2_bpp;
  150. __u32 type;
  151. __u32 wait_cycle;
  152. DISP_TARGET_PHYS pdest;
  153. __u32 bl_max;
  154. __u32 bl_min;
  155. __u32 fb_num;
  156. __u32 clk_rate;
  157. __u32 clk_min;
  158. __u32 clk_max;
  159. __u32 frame_count;
  160. __u32 is_3d_panel;
  161. __u32 frame_rate;
  162. __u32 frame_interval;
  163. struct mddi_panel_info mddi;
  164. struct lcd_panel_info lcd;
  165. struct lcdc_panel_info lcdc;
  166. struct mipi_panel_info mipi;
  167. struct lvds_panel_info lvds;
  168. };
  169. #define MSM_FB_SINGLE_MODE_PANEL(pinfo) \
  170. do { \
  171. (pinfo)->mode2_xres = 0; \
  172. (pinfo)->mode2_yres = 0; \
  173. (pinfo)->mode2_bpp = 0; \
  174. } while (0)
  175. struct msm_fb_panel_data {
  176. struct msm_panel_info panel_info;
  177. void (*set_rect) (int x, int y, int xres, int yres);
  178. void (*set_vsync_notifier) (msm_fb_vsync_handler_type, void *arg);
  179. void (*set_backlight) (struct msm_fb_data_type *);
  180. /* function entry chain */
  181. int (*on) (struct platform_device *pdev);
  182. int (*off) (struct platform_device *pdev);
  183. int (*late_init) (struct platform_device *pdev);
  184. int (*power_ctrl) (boolean enable);
  185. struct platform_device *next;
  186. int (*clk_func) (int enable);
  187. int (*fps_level_change) (struct platform_device *pdev,
  188. u32 fps_level);
  189. };
  190. enum {
  191. MDP4_OVERLAY_BLT_SWITCH_TG_OFF,
  192. MDP4_OVERLAY_BLT_SWITCH_TG_ON,
  193. MDP4_OVERLAY_BLT_SWITCH_POLL
  194. };
  195. enum {
  196. MDP4_OVERLAY_MODE_BLT_CTRL,
  197. MDP4_OVERLAY_MODE_BLT_ALWAYS_ON,
  198. MDP4_OVERLAY_MODE_BLT_ALWAYS_OFF
  199. };
  200. /*===========================================================================
  201. FUNCTIONS PROTOTYPES
  202. ============================================================================*/
  203. struct platform_device *msm_fb_device_alloc(struct msm_fb_panel_data *pdata,
  204. u32 type, u32 id);
  205. int panel_next_on(struct platform_device *pdev);
  206. int panel_next_off(struct platform_device *pdev);
  207. int panel_next_fps_level_change(struct platform_device *pdev,
  208. u32 fps_level);
  209. int panel_next_late_init(struct platform_device *pdev);
  210. int lcdc_device_register(struct msm_panel_info *pinfo);
  211. int mddi_toshiba_device_register(struct msm_panel_info *pinfo,
  212. u32 channel, u32 panel);
  213. #endif /* MSM_FB_PANEL_H */