1 /* drivers/video/sc8810/sc8810_lcd.h
3 * Spreadtrum LCD abstraction
5 * Copyright (C) 2010 Spreadtrum.com
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.
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.
17 #ifndef _SC8810_LCD_H_
18 #define _SC8810_LCD_H_
20 #include <linux/types.h>
23 #define LCD_DelayMS(ms) udelay(1000*(ms))
25 #define LCD_REGISTER_TIMING 0
26 #define LCD_GRAM_TIMING 1
29 #define LCD_MODE_RGB 0
30 #define LCD_MODE_MCU 1
33 #define LCD_BUS_8080 0
34 #define LCD_BUS_6800 1
38 #define LCD_DIRECT_NORMAL 0
39 #define LCD_DIRECT_ROT_90 1
40 #define LCD_DIRECT_ROT_180 2
41 #define LCD_DIRECT_ROT_270 3
42 #define LCD_DIRECT_MIR_H 4
43 #define LCD_DIRECT_MIR_V 5
44 #define LCD_DIRECT_MIR_HV 6
46 #define PIN_PWM0_MOD_VALUE 0x20
48 #define SPRD_PWM_BASE 0x88000000
49 #define SPRD_PWM_REG(off) (SPRD_PWM_BASE + (off))
50 #define SPRD_PWM0_PRESCALE SPRD_PWM_REG(0x0000)
51 #define SPRD_PWM0_CNT SPRD_PWM_REG(0x0004)
52 #define SPRD_PWM0_TONE_DIV SPRD_PWM_REG(0x0008)
53 #define SPRD_PWM0_PAT_LOW SPRD_PWM_REG(0x000C)
54 #define SPRD_PWM0_PAT_HIG SPRD_PWM_REG(0x0010)
56 #define LCD_PWM_PRESCALE_VALUE 0x01
57 #define LCD_PWM_MOD_VALUE 0xFF
58 #define PWM_REG_MSK_VALUE 0xFFFF
60 #define LCD_PWM0_EN BIT_8
65 struct lcd_operations {
66 int32_t (*lcd_init)(struct lcd_spec *self);
67 int32_t (*lcd_close)(struct lcd_spec *self);
68 int32_t (*lcd_reset)(struct lcd_spec *self);
69 int32_t (*lcd_enter_sleep)(struct lcd_spec *self, uint8_t is_sleep);
70 int32_t (*lcd_set_contrast)(struct lcd_spec *self, uint16_t contrast);
71 int32_t (*lcd_set_brightness)(struct lcd_spec *self,
73 int32_t (*lcd_set_window)(struct lcd_spec *self,
74 uint16_t left, uint16_t top,
75 uint16_t right, uint16_t bottom);
76 int32_t (*lcd_invalidate)(struct lcd_spec *self);
77 int32_t (*lcd_invalidate_rect)(struct lcd_spec *self,
78 uint16_t left, uint16_t top,
79 uint16_t right, uint16_t bottom);
80 int32_t (*lcd_rotate_invalidate_rect)(struct lcd_spec *self,
81 uint16_t left, uint16_t top,
82 uint16_t right, uint16_t bottom,
84 int32_t (*lcd_set_direction)(struct lcd_spec *self, uint16_t direction);
85 uint32_t (*lcd_readid)(struct lcd_spec *self);
88 /* RGB LCD specific properties */
99 int32_t (*send_cmd)(uint32_t cmd);
100 int32_t (*send_cmd_data)(uint32_t cmd, uint32_t data);
104 /* under construction... */
105 struct timing_rgb timing;
109 /* MCU LCD specific properties */
119 typedef int32_t (*Send_cmd)(uint32_t data);
120 typedef int32_t (*Send_data)(uint32_t data);
121 typedef int32_t (*Send_cmd_data)(uint32_t cmd, uint32_t data);
122 typedef uint32_t (*Read_data)(void);
125 int32_t (*send_cmd)(uint32_t cmd);
126 int32_t (*send_cmd_data)(uint32_t cmd, uint32_t data);
127 int32_t (*send_data)(uint32_t data);
128 uint32_t (*read_data)(void);
134 struct timing_mcu *timing;
138 /* LCD abstraction */
145 struct info_rgb *rgb;
146 struct info_mcu *mcu;
148 struct lcd_operations *ops;
151 extern void LCD_SetBackLightBrightness( unsigned long value);