4 #include "mtkfb_info.h"
8 * Must be consistent with bionic/libc/kernel/linux/common/mtkfb.h
10 #define MTK_FB_NO_ION_FD ((int)(~0U>>1))
11 #define MTK_FB_NO_USE_LAEYR_ID ((int)(~0U>>1))
12 #define FBCAPS_GENERIC_MASK (0x00000fff)
13 #define FBCAPS_LCDC_MASK (0x00fff000)
14 #define FBCAPS_PANEL_MASK (0xff000000)
15 #define FBCAPS_MANUAL_UPDATE (0x00001000)
16 #define FBCAPS_SET_BACKLIGHT (0x01000000)
17 #define MTKFB_ERROR_IS_EARLY_SUSPEND (0x12000000)
18 /* --------------------------------------------------------------------------- */
20 #define MTK_IOW(num, dtype) _IOW('O', num, dtype)
21 #define MTK_IOR(num, dtype) _IOR('O', num, dtype)
22 #define MTK_IOWR(num, dtype) _IOWR('O', num, dtype)
23 #define MTK_IO(num) _IO('O', num)
24 #define MTKFB_QUEUE_OVERLAY_CONFIG MTK_IOW(137, struct fb_overlay_config)
25 /* -------------------------------------------------------------------------- */
26 #define MTKFB_SET_OVERLAY_LAYER MTK_IOW(0, struct fb_overlay_layer)
27 #define MTKFB_TRIG_OVERLAY_OUT MTK_IO(1)
28 #define MTKFB_SET_VIDEO_LAYERS MTK_IOW(2, struct fb_overlay_layer)
29 #define MTKFB_CAPTURE_FRAMEBUFFER MTK_IOW(3, unsigned long)
30 #define MTKFB_CONFIG_IMMEDIATE_UPDATE MTK_IOW(4, unsigned long)
31 #define MTKFB_SET_MULTIPLE_LAYERS MTK_IOW(5, struct fb_overlay_layer)
32 #define MTKFB_REGISTER_OVERLAYBUFFER MTK_IOW(6, struct fb_overlay_buffer_info)
33 #define MTKFB_UNREGISTER_OVERLAYBUFFER MTK_IOW(7, unsigned int)
34 #define MTKFB_SET_ORIENTATION MTK_IOW(8, unsigned long)
35 #define MTKFB_FBLAYER_ENABLE MTK_IOW(9, unsigned int)
36 #define MTKFB_LOCK_FRONT_BUFFER MTK_IO(10)
37 #define MTKFB_UNLOCK_FRONT_BUFFER MTK_IO(11)
38 #define MTKFB_POWERON MTK_IO(12)
39 #define MTKFB_POWEROFF MTK_IO(13)
41 /* Fence/Ion, OVL decoupling */
42 #define MTKFB_PREPARE_OVERLAY_BUFFER MTK_IOW(14, struct fb_overlay_buffer)
45 #define MTKFB_SET_COMPOSING3D MTK_IOW(15, unsigned long)
46 #define MTKFB_SET_S3D_FTM MTK_IOW(16, unsigned long)
48 /* FM De-sense for EM and Normal mode */
49 #define MTKFB_GET_DEFAULT_UPDATESPEED MTK_IOR(17, unsigned long)
50 #define MTKFB_GET_CURR_UPDATESPEED MTK_IOR(18, unsigned long)
51 #define MTKFB_CHANGE_UPDATESPEED MTK_IOW(19, unsigned long) /* for EM, not called change writecycle because DPI change pll ckl */
52 #define MTKFB_GET_INTERFACE_TYPE MTK_IOR(20, unsigned long) /* /0 DBI, 1 DPI, 2 MIPI */
53 #define MTKFB_GET_POWERSTATE MTK_IOR(21, unsigned long) /* /0: power off 1: power on */
54 #define MTKFB_GET_DISPLAY_IF_INFORMATION MTK_IOR(22, mtk_dispif_info_t)
55 #define MTKFB_AEE_LAYER_EXIST MTK_IOR(23, unsigned long) //called before SET_OVERLAY each time, if true, hwc will not use FB_LAYER again
56 #define MTKFB_GET_OVERLAY_LAYER_INFO MTK_IOR(24, struct fb_overlay_layer_info)
57 #define MTKFB_FACTORY_AUTO_TEST MTK_IOR(25, unsigned long)
58 #define MTKFB_GET_FRAMEBUFFER_MVA MTK_IOR(26, unsigned int)
59 #define MTKFB_SLT_AUTO_CAPTURE MTK_IOWR(27, struct fb_slt_catpure)
62 #define MTKFB_META_RESTORE_SCREEN MTK_IOW(101, unsigned long)
63 #define MTKFB_ERROR_INDEX_UPDATE_TIMEOUT MTK_IO(103)
64 #define MTKFB_ERROR_INDEX_UPDATE_TIMEOUT_AEE MTK_IO(104)
66 /*restore bootlogo and charater in meta mode*/
67 #define MTKFB_META_SHOW_BOOTLOGO MTK_IO(105)
69 //Extension FB active option
70 #define FB_ACTIVATE_NO_UPDATE 512 /* Skip frame update */
72 //----------------------------------------------------------------------
74 // --------------------------------------------------------------------------
77 * Just for mt6589 Platform
80 #define MTKFB_GETVFRAMEPHYSICAL MTK_IOW(41, unsigned long)
81 #define MTKFB_WAIT_OVERLAY_READY MTK_IO(42)
82 #define MTKFB_GET_OVERLAY_LAYER_COUNT MTK_IOR(43, unsigned long)
83 #define MTKFB_GET_VIDEOLAYER_SIZE MTK_IOR(44, struct fb_overlay_layer)
84 #define MTKFB_CAPTURE_VIDEOBUFFER MTK_IOW(45, unsigned long)
86 /* -------------------------------------------------------------------------- */
87 /* Video Playback Mode */
88 #define MTKFB_TV_POST_VIDEO_BUFFER MTK_IOW(46, unsigned long)
89 #define MTKFB_TV_LEAVE_VIDEO_PLAYBACK_MODE MTK_IOW(47, unsigned long)
90 /* For Factory Mode */
91 #define MTKFB_IS_TV_CABLE_PLUG_IN MTK_IOW(48, unsigned long)
93 /* -------------------------------------------------------------------------- */
94 #define MTKFB_BOOTANIMATION MTK_IO(49)
95 #define MTKFB_GETFPS MTK_IOW(50, unsigned long)
96 #define MTKFB_VSYNC MTK_IO(51)
98 /* ----------------------------------------------------------------------FM De-sense for EM and Normal mode */
99 #define MTKFB_FM_NOTIFY_FREQ MTK_IOW(52, unsigned long) /* for Normal mode */
100 #define MTKFB_RESET_UPDATESPEED MTK_IO(53)
101 #define MTKFB_SET_UI_LAYER_ALPHA MTK_IOW(54, unsigned long)
102 #define MTKFB_SET_UI_LAYER_SRCKEY MTK_IOW(55, unsigned long)
104 #define MTKFB_GET_MAX_DISPLAY_COUNT MTK_IOR(56, unsigned int)
105 #define MTKFB_SET_FB_LAYER_SECURE MTK_IOW(57, int)
109 /* ---------------------------------------------------------------------- */
111 /* -------------------------------------------------------------------------- */
114 MTK_FB_ORIENTATION_0
= 0,
115 MTK_FB_ORIENTATION_90
= 1,
116 MTK_FB_ORIENTATION_180
= 2,
117 MTK_FB_ORIENTATION_270
= 3,
118 } MTK_FB_ORIENTATION
;
122 MTK_FB_TV_SYSTEM_NTSC
= 0,
123 MTK_FB_TV_SYSTEM_PAL
= 1,
128 MTK_FB_TV_FMT_RGB565
= 0,
129 MTK_FB_TV_FMT_YUV420_SEQ
= 1,
130 MTK_FB_TV_FMT_UYUV422
= 2,
131 MTK_FB_TV_FMT_YUV420_BLK
= 3,
132 } MTK_FB_TV_SRC_FORMAT
;
135 LAYER_NORMAL_BUFFER
= 0,
136 LAYER_SECURE_BUFFER
= 1,
137 LAYER_PROTECTED_BUFFER
= 2,
138 LAYER_SECURE_BUFFER_WITH_ALIGN
= 0x10001, /* the higher 16 bits =1 for adding 64 bytes alignment */
139 } MTK_FB_OVL_LAYER_SECURE_MODE
;
141 typedef struct _disp_dfo_item
{
146 /* -------------------------------------------------------------------------- */
147 struct fb_slt_catpure
{
148 MTK_FB_FORMAT format
;
149 volatile char *outputBuffer
;
150 unsigned int wdma_width
;
151 unsigned int wdma_height
;
155 unsigned int xscale
, yscale
;
158 struct fb_frame_offset
{
160 unsigned long offset
;
163 struct fb_update_window
{
165 unsigned int width
, height
;
170 LAYER_3D_SBS_0
= 0x1,
171 LAYER_3D_SBS_90
= 0x2,
172 LAYER_3D_SBS_180
= 0x3,
173 LAYER_3D_SBS_270
= 0x4,
174 LAYER_3D_TAB_0
= 0x10,
175 LAYER_3D_TAB_90
= 0x20,
176 LAYER_3D_TAB_180
= 0x30,
177 LAYER_3D_TAB_270
= 0x40,
181 DISP_DIRECT_LINK_MODE
,
184 struct fb_overlay_mode
{
188 typedef enum { /* map sessions to scenairos in kernel driver */
189 DISP_SESSION_LCM
= 1 << 0, /* DSI0 */
190 DISP_SESSION_MEM
= 1 << 1, /* OVL0->WDMA0 */
191 DISP_SESSION_WFD
= 1 << 2, /* Extention mode, Dst buf is provided by user, for Wifi Display or other purpose */
192 DISP_SESSION_MHL
= 1 << 3, /* DPI */
193 DISP_SESSION_LCM1
= 1 << 4, /* DSI1 */
194 DISP_SESSION_MEM1
= 1 << 5, /* OVL1->WDMA1 */
195 /* TODO:can be extended with other Session Id */
196 SESSION_MASK
= 0xff & ~(1 << 6)
199 struct fb_overlay_session
{
200 unsigned int session
; /* one or more @MTK_DISP_SESSION combined */
203 struct fb_overlay_decouple
{
205 unsigned int session
;
207 struct fb_overlay_buffer
{
209 unsigned int layer_id
;
210 unsigned int layer_en
;
212 unsigned int cache_sync
;
218 struct fb_overlay_layer
{
219 unsigned int layer_id
;
220 unsigned int layer_enable
;
224 unsigned int src_direct_link
;
225 MTK_FB_FORMAT src_fmt
;
226 unsigned int src_use_color_key
;
227 unsigned int src_color_key
;
228 unsigned int src_pitch
;
229 unsigned int src_offset_x
, src_offset_y
;
230 unsigned int src_width
, src_height
;
232 unsigned int tgt_offset_x
, tgt_offset_y
;
233 unsigned int tgt_width
, tgt_height
;
234 MTK_FB_ORIENTATION layer_rotation
;
235 MTK_FB_LAYER_TYPE layer_type
;
236 MTK_FB_ORIENTATION video_rotation
;
238 unsigned int isTdshp
; /* set to 1, will go through tdshp first, then layer blending, then to color */
243 unsigned int security
;
244 unsigned int alpha_enable
;
246 int fence_fd
; /* 8135 */
247 int ion_fd
; /* 8135 CL 2340210 */
250 struct fb_overlay_config
{
253 struct fb_overlay_layer layers
[4];
256 struct fb_overlay_buffer_info
{
257 unsigned int src_vir_addr
;
261 struct fb_overlay_layer_info
{
262 unsigned int layer_id
;
263 unsigned int layer_enabled
; /* TO BE DEL */
264 unsigned int curr_en
;
265 unsigned int next_en
;
276 MTK_FB_ORIENTATION layer_rotation
;
278 /* -------------------------------------------------------------------------- */
280 struct fb_post_video_buffer
{
283 MTK_FB_TV_SRC_FORMAT format
;
284 unsigned int width
, height
;
289 #include <linux/completion.h>
290 #include <linux/interrupt.h>
291 #include <linux/workqueue.h>
293 #include <linux/version.h>
294 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0))
295 #include <linux/sw_sync.h>
297 #include <../drivers/staging/android/sw_sync.h>
301 #define MTKFB_DRIVER "mtkfb"
305 MTKFB_SUSPENDED
= 99,
310 MTKFB_LAYER_ENABLE_DIRTY
= (1 << 0),
311 MTKFB_LAYER_FORMAT_DIRTY
= (1 << 1),
312 MTKFB_LAYER_SET_DIRTY
= (1 << 2),
313 } MTKFB_LAYER_CONFIG_DIRTY
;
316 struct work_struct work
;
317 struct list_head list
;
318 struct fb_overlay_config config
;
319 struct sync_fence
*fences
[4];
320 struct ion_handle
*ion_handles
[4];
322 } update_ovls_work_t
;
324 struct mtkfb_device
{
326 void *fb_va_base
; /* MPU virtual address */
327 dma_addr_t fb_pa_base
; /* Bus physical address */
328 unsigned long fb_size_in_byte
;
329 void *ovl_va_base
; /* MPU virtual address */
330 dma_addr_t ovl_pa_base
; /* Bus physical address */
331 unsigned long ovl_size_in_byte
;
333 unsigned long layer_enable
;
334 MTK_FB_FORMAT
*layer_format
;
335 unsigned int layer_config_dirty
;
337 int xscale
, yscale
, mirror
; /* transformations.
338 rotate is stored in fb_info->var */
339 u32 pseudo_palette
[17];
341 struct fb_info
*fb_info
; /* Linux fbdev framework data */
344 /* Android native fence support */
345 struct workqueue_struct
*update_ovls_wq
;
346 struct mutex timeline_lock
;
347 struct sw_sync_timeline
*timeline
;
349 struct list_head pending_configs
; /* CL2340210 */
350 struct ion_client
*ion_client
;
353 #endif /* __KERNEL__ */
355 extern long hdmi_handle_cmd(unsigned int cmd
, unsigned long arg
);
358 #endif /* __MTKFB_H */