tizen 2.4 release
[kernel/u-boot-tm1.git] / drivers / video / sc8825fb / sprdfb.h
1 /*
2  * Copyright (C) 2012 Spreadtrum Communications Inc.
3  *
4  * This software is licensed under the terms of the GNU General Public
5  * License version 2, as published by the Free Software Foundation, and
6  * may be copied, distributed, and modified under those terms.
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
14 #ifndef _SPRDFB_H_
15 #define _SPRDFB_H_
16
17 #define printk printf
18 #define  FB_DEBUG
19 #ifdef FB_DEBUG
20 #define FB_PRINT printk
21 #else
22 #define FB_PRINT(...)
23 #endif
24
25 #define mdelay(a) udelay(a * 1000)
26
27
28 enum{
29         SPRDFB_PANEL_IF_DBI = 0,
30         SPRDFB_PANEL_IF_DPI,
31         SPRDFB_PANEL_IF_EDPI,
32         SPRDFB_PANEL_IF_LIMIT
33 };
34
35
36 enum{
37         MCU_LCD_REGISTER_TIMING = 0,
38         MCU_LCD_GRAM_TIMING,
39         MCU_LCD_TIMING_KIND_MAX
40 };
41
42 enum{
43         RGB_LCD_H_TIMING = 0,
44         RGB_LCD_V_TIMING,
45         RGB_LCD_TIMING_KIND_MAX
46 };
47
48 struct sprdfb_device;
49
50
51 struct panel_if_ctrl{
52         const char *if_name;
53
54         int32_t (*panel_if_check)(struct panel_spec *self);
55         void (*panel_if_mount)(struct sprdfb_device *dev);
56         void (*panel_if_init)(struct sprdfb_device *dev);
57         void (*panel_if_ready)(struct sprdfb_device *dev);
58         void (*panel_if_uninit)(struct sprdfb_device *dev);
59         void (*panel_if_before_refresh)(struct sprdfb_device *dev);
60         void (*panel_if_after_refresh)(struct sprdfb_device *dev);
61         void (*panel_if_suspend)(struct sprdfb_device *dev);
62         void (*panel_if_resume)(struct sprdfb_device *dev);
63 };
64
65
66 struct sprdfb_device {
67         uint32_t smem_start;
68
69         union{
70                 uint32_t        mcu_timing[MCU_LCD_TIMING_KIND_MAX];
71                 uint32_t        rgb_timing[RGB_LCD_TIMING_KIND_MAX];
72         }panel_timing;
73
74         uint16_t                panel_if_type; /*panel IF*/
75         struct panel_spec       *panel;
76         struct panel_if_ctrl *if_ctrl;
77         struct display_ctrl     *ctrl;
78 };
79
80 struct display_ctrl {
81         const char      *name;
82
83         int32_t (*early_init)     (struct sprdfb_device *dev);
84         int32_t (*init)           (struct sprdfb_device *dev);
85         int32_t (*uninit)                 (struct sprdfb_device *dev);
86
87         int32_t         (*refresh)        (struct sprdfb_device *dev);
88 };
89
90 #endif