tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-sc8800g / sc8800g_lcd.h
1 /* drivers/video/sc8800g/sc8800g_lcd.h
2  *
3  * Spreadtrum LCD abstraction
4  *
5  * Copyright (C) 2010 Spreadtrum.com
6  *
7  * This software is licensed under the terms of the GNU General Public
8  * License version 2, as published by the Free Software Foundation, and
9  * may be copied, distributed, and modified under those terms.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  */
16
17 #ifndef _SC8800G_LCD_H_
18 #define _SC8800G_LCD_H_
19
20 #include <linux/types.h>
21
22 /* LCD mode */
23 #define LCD_MODE_RGB 0
24 #define LCD_MODE_MCU 1
25
26 /* bus mode */
27 #define LCD_BUS_8080 0
28 #define LCD_BUS_6800 1
29 #define LCD_BUS_SPI  2
30
31 /* lcd directions */
32 #define LCD_DIRECT_NORMAL  0
33 #define LCD_DIRECT_ROT_90  1
34 #define LCD_DIRECT_ROT_180 2
35 #define LCD_DIRECT_ROT_270 3
36 #define LCD_DIRECT_MIR_H   4
37 #define LCD_DIRECT_MIR_V   5
38 #define LCD_DIRECT_MIR_HV  6
39
40 struct lcd_spec;
41
42 /* LCD operations */
43 struct lcd_operations {
44         int32_t (*lcd_init)(struct lcd_spec *self);
45         int32_t (*lcd_close)(struct lcd_spec *self);
46         int32_t (*lcd_reset)(struct lcd_spec *self);
47         int32_t (*lcd_enter_sleep)(struct lcd_spec *self, uint8_t is_sleep);
48         int32_t (*lcd_set_contrast)(struct lcd_spec *self, uint16_t contrast);
49         int32_t (*lcd_set_brightness)(struct lcd_spec *self,
50                                 uint16_t brightness);
51         int32_t (*lcd_set_window)(struct lcd_spec *self,
52                                 uint16_t left, uint16_t top,
53                                 uint16_t right, uint16_t bottom);
54         int32_t (*lcd_invalidate)(struct lcd_spec *self);
55         int32_t (*lcd_invalidate_rect)(struct lcd_spec *self,
56                                 uint16_t left, uint16_t top,
57                                 uint16_t right, uint16_t bottom);
58         int32_t (*lcd_rotate_invalidate_rect)(struct lcd_spec *self,
59                                 uint16_t left, uint16_t top,
60                                 uint16_t right, uint16_t bottom,
61                                 uint16_t angle);
62         int32_t (*lcd_set_direction)(struct lcd_spec *self, uint16_t direction);
63         uint32_t (*lcd_readid)(struct lcd_spec *self);
64 };
65
66 /* RGB LCD specific properties */
67 struct timing_rgb {
68         uint16_t bfw;
69         uint16_t efw;
70         uint16_t vsw;
71         uint16_t blw;
72         uint16_t elw;
73         uint16_t hsw;
74 };
75
76 struct ops_rgb {
77         int32_t (*send_cmd)(uint32_t cmd);
78         int32_t (*send_cmd_data)(uint32_t cmd, uint32_t data);
79 };
80
81 struct info_rgb {
82         /* under construction... */
83         struct timing_rgb timing;
84         struct ops_rgb *ops;
85 };
86
87 /* MCU LCD specific properties */
88 struct timing_mcu {
89         uint16_t rcss;
90         uint16_t rlpw;
91         uint16_t rhpw;
92         uint16_t wcss;
93         uint16_t wlpw;
94         uint16_t whpw;
95 };
96
97 struct ops_mcu {
98         int32_t (*send_cmd)(uint32_t cmd);
99         int32_t (*send_cmd_data)(uint32_t cmd, uint32_t data);
100         int32_t (*send_data)(uint32_t data);
101         uint32_t (*read_data)(void);
102 };
103
104 struct info_mcu {
105         uint16_t bus_mode;
106         uint16_t bus_width;
107         struct timing_mcu *timing;
108         struct ops_mcu *ops;
109 };
110
111 /* LCD abstraction */
112 struct lcd_spec {
113         uint16_t width;
114         uint16_t height;
115         uint16_t mode;
116         uint16_t direction;
117         union {
118                 struct info_rgb *rgb;
119                 struct info_mcu *mcu;
120         } info;
121         struct lcd_operations *ops;
122 };
123
124 extern struct lcd_spec lcd_panel_hx8357;
125 extern struct lcd_spec lcd_panel_ili9328;
126 extern struct lcd_spec lcd_panel_r61581;
127 extern struct lcd_spec lcd_panel_rm68040;
128 #endif