tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / drivers / video / sprdfb / sprdfb.h
1 /*
2  * Copyright (C) 2012 Spreadtrum Communications Inc.
3  *
4  */
5
6 #ifndef _SPRDFB_H_
7 #define _SPRDFB_H_
8
9 #define printk printf
10 //#define  FB_DEBUG
11 #ifdef FB_DEBUG
12 #define FB_PRINT printk
13 #else
14 #define FB_PRINT(...)
15 #endif
16
17 #define mdelay(t)       ({unsigned long msec=(t); while (msec--) { udelay(1000);}})
18
19 enum{
20         SPRDFB_PANEL_IF_DBI = 0,
21         SPRDFB_PANEL_IF_DPI,
22         SPRDFB_PANEL_IF_EDPI,
23         SPRDFB_PANEL_IF_LIMIT
24 };
25
26
27 enum{
28         MCU_LCD_REGISTER_TIMING = 0,
29         MCU_LCD_GRAM_TIMING,
30         MCU_LCD_TIMING_KIND_MAX
31 };
32
33 enum{
34         RGB_LCD_H_TIMING = 0,
35         RGB_LCD_V_TIMING,
36         RGB_LCD_TIMING_KIND_MAX
37 };
38
39 struct sprdfb_device;
40
41
42 struct panel_if_ctrl{
43         const char *if_name;
44
45         int32_t (*panel_if_check)(struct panel_spec *self);
46         void (*panel_if_mount)(struct sprdfb_device *dev);
47         void (*panel_if_init)(struct sprdfb_device *dev);
48         void (*panel_if_ready)(struct sprdfb_device *dev);
49         void (*panel_if_uninit)(struct sprdfb_device *dev);
50         void (*panel_if_before_refresh)(struct sprdfb_device *dev);
51         void (*panel_if_after_refresh)(struct sprdfb_device *dev);
52         void (*panel_if_before_panel_reset)(struct sprdfb_device *dev);
53         void (*panel_if_suspend)(struct sprdfb_device *dev);
54         void (*panel_if_resume)(struct sprdfb_device *dev);
55 };
56
57
58 struct sprdfb_device {
59         uint32_t smem_start;
60
61         union{
62                 uint32_t        mcu_timing[MCU_LCD_TIMING_KIND_MAX];
63                 uint32_t        rgb_timing[RGB_LCD_TIMING_KIND_MAX];
64         }panel_timing;
65
66         uint16_t                panel_if_type; /*panel IF*/
67
68 #ifdef CONFIG_FB_LOW_RES_SIMU
69         uint16_t display_width;
70         uint16_t display_height;
71 #endif
72
73         struct panel_spec       *panel;
74         struct panel_if_ctrl *if_ctrl;
75         struct display_ctrl     *ctrl;
76         uint32_t dpi_clock;
77 };
78
79 struct display_ctrl {
80         const char      *name;
81
82         int32_t (*early_init)     (struct sprdfb_device *dev);
83         int32_t (*init)           (struct sprdfb_device *dev);
84         int32_t (*uninit)                 (struct sprdfb_device *dev);
85
86         int32_t         (*refresh)        (struct sprdfb_device *dev);
87         void            (*update_clk)     (struct sprdfb_device *dev);
88 };
89
90 #if defined(CONFIG_FPGA)
91          int sprdchip_lvds_init(void);
92
93 #else
94 #define sprdchip_lvds_init NULL
95 #endif
96
97 #endif