msm_fb.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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_H
  14. #define MSM_FB_H
  15. #include <linux/module.h>
  16. #include <linux/kernel.h>
  17. #include <linux/sched.h>
  18. #include <linux/time.h>
  19. #include <linux/init.h>
  20. #include <linux/interrupt.h>
  21. #include "linux/proc_fs.h"
  22. #include <mach/hardware.h>
  23. #include <linux/io.h>
  24. #include <mach/board.h>
  25. #include <asm/system.h>
  26. #include <asm/mach-types.h>
  27. #include <mach/memory.h>
  28. #include <linux/semaphore.h>
  29. #include <linux/spinlock.h>
  30. #include <linux/workqueue.h>
  31. #include <linux/hrtimer.h>
  32. #include <linux/fb.h>
  33. #include <linux/list.h>
  34. #include <linux/types.h>
  35. #include <linux/switch.h>
  36. #include <linux/msm_mdp.h>
  37. #ifdef CONFIG_HAS_EARLYSUSPEND
  38. #include <linux/earlysuspend.h>
  39. #endif
  40. #include "msm_fb_panel.h"
  41. #include "mdp.h"
  42. #define MSM_FB_DEFAULT_PAGE_SIZE 2
  43. #define MFD_KEY 0x11161126
  44. #define MSM_FB_MAX_DEV_LIST 32
  45. struct disp_info_type_suspend {
  46. boolean op_enable;
  47. boolean sw_refreshing_enable;
  48. boolean panel_power_on;
  49. boolean op_suspend;
  50. };
  51. struct msmfb_writeback_data_list {
  52. struct list_head registered_entry;
  53. struct list_head active_entry;
  54. void *addr;
  55. struct ion_handle *ihdl;
  56. struct file *pmem_file;
  57. struct msmfb_data buf_info;
  58. struct msmfb_img img;
  59. int state;
  60. };
  61. struct msm_fb_data_type {
  62. __u32 key;
  63. __u32 index;
  64. __u32 ref_cnt;
  65. __u32 fb_page;
  66. panel_id_type panel;
  67. struct msm_panel_info panel_info;
  68. DISP_TARGET dest;
  69. struct fb_info *fbi;
  70. struct delayed_work backlight_worker;
  71. boolean op_enable;
  72. uint32 fb_imgType;
  73. boolean sw_currently_refreshing;
  74. boolean sw_refreshing_enable;
  75. boolean hw_refresh;
  76. #ifdef CONFIG_FB_MSM_OVERLAY
  77. int overlay_play_enable;
  78. #endif
  79. MDPIBUF ibuf;
  80. boolean ibuf_flushed;
  81. struct timer_list refresh_timer;
  82. struct completion refresher_comp;
  83. boolean pan_waiting;
  84. struct completion pan_comp;
  85. /* vsync */
  86. boolean use_mdp_vsync;
  87. __u32 vsync_gpio;
  88. __u32 total_lcd_lines;
  89. __u32 total_porch_lines;
  90. __u32 lcd_ref_usec_time;
  91. __u32 refresh_timer_duration;
  92. struct hrtimer dma_hrtimer;
  93. boolean panel_power_on;
  94. struct work_struct dma_update_worker;
  95. struct semaphore sem;
  96. struct timer_list vsync_resync_timer;
  97. boolean vsync_handler_pending;
  98. struct work_struct vsync_resync_worker;
  99. ktime_t last_vsync_timetick;
  100. __u32 *vsync_width_boundary;
  101. unsigned int pmem_id;
  102. struct disp_info_type_suspend suspend;
  103. __u32 channel_irq;
  104. struct mdp_dma_data *dma;
  105. struct device_attribute dev_attr;
  106. void (*dma_fnc) (struct msm_fb_data_type *mfd);
  107. int (*cursor_update) (struct fb_info *info,
  108. struct fb_cursor *cursor);
  109. int (*lut_update) (struct fb_info *info,
  110. struct fb_cmap *cmap);
  111. int (*do_histogram) (struct fb_info *info,
  112. struct mdp_histogram_data *hist);
  113. int (*start_histogram) (struct mdp_histogram_start_req *req);
  114. int (*stop_histogram) (struct fb_info *info, uint32_t block);
  115. void (*vsync_ctrl) (int enable);
  116. void (*vsync_init) (int cndx);
  117. void (*update_panel_info)(struct msm_fb_data_type *mfd);
  118. bool (*is_panel_ready)(void);
  119. void *vsync_show;
  120. void *cursor_buf;
  121. void *cursor_buf_phys;
  122. void *cmd_port;
  123. void *data_port;
  124. void *data_port_phys;
  125. __u32 bl_level;
  126. struct platform_device *pdev;
  127. __u32 var_xres;
  128. __u32 var_yres;
  129. __u32 var_pixclock;
  130. __u32 var_frame_rate;
  131. #ifdef MSM_FB_ENABLE_DBGFS
  132. struct dentry *sub_dir;
  133. #endif
  134. #ifdef CONFIG_HAS_EARLYSUSPEND
  135. struct early_suspend early_suspend;
  136. #ifdef CONFIG_FB_MSM_MDDI
  137. struct early_suspend mddi_early_suspend;
  138. struct early_suspend mddi_ext_early_suspend;
  139. #endif
  140. #endif
  141. u32 mdp_fb_page_protection;
  142. struct clk *ebi1_clk;
  143. boolean dma_update_flag;
  144. struct timer_list msmfb_no_update_notify_timer;
  145. struct completion msmfb_update_notify;
  146. struct completion msmfb_no_update_notify;
  147. struct mutex writeback_mutex;
  148. struct mutex unregister_mutex;
  149. struct list_head writeback_busy_queue;
  150. struct list_head writeback_free_queue;
  151. struct list_head writeback_register_queue;
  152. struct switch_dev writeback_sdev;
  153. wait_queue_head_t wait_q;
  154. struct ion_client *iclient;
  155. unsigned long display_iova;
  156. unsigned long rotator_iova;
  157. struct mdp_buf_type *ov0_wb_buf;
  158. struct mdp_buf_type *ov1_wb_buf;
  159. u32 ov_start;
  160. u32 mem_hid;
  161. u32 mdp_rev;
  162. u32 writeback_state;
  163. bool writeback_active_cnt;
  164. int cont_splash_done;
  165. void *copy_splash_buf;
  166. unsigned char *copy_splash_phys;
  167. void *cpu_pm_hdl;
  168. u32 avtimer_phy;
  169. int vsync_sysfs_created;
  170. u32 acq_fen_cnt;
  171. struct sync_fence *acq_fen[MDP_MAX_FENCE_FD];
  172. int cur_rel_fen_fd;
  173. struct sync_pt *cur_rel_sync_pt;
  174. struct sync_fence *cur_rel_fence;
  175. struct sync_fence *last_rel_fence;
  176. struct sw_sync_timeline *timeline;
  177. int timeline_value;
  178. u32 last_acq_fen_cnt;
  179. struct sync_fence *last_acq_fen[MDP_MAX_FENCE_FD];
  180. struct mutex sync_mutex;
  181. struct completion commit_comp;
  182. u32 is_committing;
  183. struct work_struct commit_work;
  184. void *msm_fb_backup;
  185. };
  186. struct msm_fb_backup_type {
  187. struct fb_info info;
  188. struct fb_var_screeninfo var;
  189. struct msm_fb_data_type mfd;
  190. };
  191. struct dentry *msm_fb_get_debugfs_root(void);
  192. void msm_fb_debugfs_file_create(struct dentry *root, const char *name,
  193. u32 *var);
  194. void msm_fb_set_backlight(struct msm_fb_data_type *mfd, __u32 bkl_lvl);
  195. struct platform_device *msm_fb_add_device(struct platform_device *pdev);
  196. struct fb_info *msm_fb_get_writeback_fb(void);
  197. int msm_fb_writeback_init(struct fb_info *info);
  198. int msm_fb_writeback_start(struct fb_info *info);
  199. int msm_fb_writeback_queue_buffer(struct fb_info *info,
  200. struct msmfb_data *data);
  201. int msm_fb_writeback_dequeue_buffer(struct fb_info *info,
  202. struct msmfb_data *data);
  203. int msm_fb_writeback_stop(struct fb_info *info);
  204. int msm_fb_writeback_terminate(struct fb_info *info);
  205. int msm_fb_detect_client(const char *name);
  206. int calc_fb_offset(struct msm_fb_data_type *mfd, struct fb_info *fbi, int bpp);
  207. int msm_fb_wait_for_fence(struct msm_fb_data_type *mfd);
  208. int msm_fb_signal_timeline(struct msm_fb_data_type *mfd);
  209. #ifdef CONFIG_FB_BACKLIGHT
  210. void msm_fb_config_backlight(struct msm_fb_data_type *mfd);
  211. #endif
  212. void fill_black_screen(bool on, uint8 pipe_num, uint8 mixer_num);
  213. int msm_fb_check_frame_rate(struct msm_fb_data_type *mfd,
  214. struct fb_info *info);
  215. #ifdef CONFIG_FB_MSM_LOGO
  216. #define INIT_IMAGE_FILE "/logo.rle"
  217. int load_565rle_image(char *filename, bool bf_supported);
  218. #endif
  219. void mdp_restore_rgb(void);
  220. #endif /* MSM_FB_H */