1 /******************************************************************************
2 ** File Name: sc8810_lcd.h *
5 ** Copyright: 2005 Spreatrum, Incoporated. All Rights Reserved. *
6 ** Description: Spreadtrum LCD abstraction *
7 ******************************************************************************/
8 /******************************************************************************
10 **---------------------------------------------------------------------------*
11 ** DATE NAME DESCRIPTION *
13 ******************************************************************************/
14 #ifndef _SC8810_LCD_H_
15 #define _SC8810_LCD_H_
17 #include <linux/types.h>
20 #define LCD_DelayMS(ms) udelay(1000*(ms))
22 #define LCD_REGISTER_TIMING 0
23 #define LCD_GRAM_TIMING 1
26 #define LCD_MODE_RGB 0
27 #define LCD_MODE_MCU 1
30 #define LCD_BUS_8080 0
31 #define LCD_BUS_6800 1
35 #define LCD_DIRECT_NORMAL 0
36 #define LCD_DIRECT_ROT_90 1
37 #define LCD_DIRECT_ROT_180 2
38 #define LCD_DIRECT_ROT_270 3
39 #define LCD_DIRECT_MIR_H 4
40 #define LCD_DIRECT_MIR_V 5
41 #define LCD_DIRECT_MIR_HV 6
43 #define PIN_PWM0_MOD_VALUE 0x20
45 #define SPRD_PWM_BASE 0x88000000
46 #define SPRD_PWM_REG(off) (SPRD_PWM_BASE + (off))
47 #define SPRD_PWM0_PRESCALE SPRD_PWM_REG(0x0000)
48 #define SPRD_PWM0_CNT SPRD_PWM_REG(0x0004)
49 #define SPRD_PWM0_TONE_DIV SPRD_PWM_REG(0x0008)
50 #define SPRD_PWM0_PAT_LOW SPRD_PWM_REG(0x000C)
51 #define SPRD_PWM0_PAT_HIG SPRD_PWM_REG(0x0010)
53 #define LCD_PWM_PRESCALE_VALUE 0x01
54 #define LCD_PWM_MOD_VALUE 0xFF
55 #define PWM_REG_MSK_VALUE 0xFFFF
57 #define LCD_PWM0_EN BIT_8
62 struct lcd_operations {
63 int32_t (*lcd_init)(struct lcd_spec *self);
64 int32_t (*lcd_close)(struct lcd_spec *self);
65 int32_t (*lcd_reset)(struct lcd_spec *self);
66 int32_t (*lcd_enter_sleep)(struct lcd_spec *self, uint8_t is_sleep);
67 int32_t (*lcd_set_contrast)(struct lcd_spec *self, uint16_t contrast);
68 int32_t (*lcd_set_brightness)(struct lcd_spec *self,
70 int32_t (*lcd_set_window)(struct lcd_spec *self,
71 uint16_t left, uint16_t top,
72 uint16_t right, uint16_t bottom);
73 int32_t (*lcd_invalidate)(struct lcd_spec *self);
74 int32_t (*lcd_invalidate_rect)(struct lcd_spec *self,
75 uint16_t left, uint16_t top,
76 uint16_t right, uint16_t bottom);
77 int32_t (*lcd_rotate_invalidate_rect)(struct lcd_spec *self,
78 uint16_t left, uint16_t top,
79 uint16_t right, uint16_t bottom,
81 int32_t (*lcd_set_direction)(struct lcd_spec *self, uint16_t direction);
82 uint32_t (*lcd_readid)(struct lcd_spec *self);
85 /* RGB LCD specific properties */
96 int32_t (*send_cmd)(uint32_t cmd);
97 int32_t (*send_cmd_data)(uint32_t cmd, uint32_t data);
101 /* under construction... */
102 struct timing_rgb timing;
106 /* MCU LCD specific properties */
116 typedef int32_t (*Send_cmd)(uint32_t data);
117 typedef int32_t (*Send_data)(uint32_t data);
118 typedef int32_t (*Send_cmd_data)(uint32_t cmd, uint32_t data);
119 typedef uint32_t (*Read_data)(void);
122 int32_t (*send_cmd)(uint32_t cmd);
123 int32_t (*send_cmd_data)(uint32_t cmd, uint32_t data);
124 int32_t (*send_data)(uint32_t data);
125 uint32_t (*read_data)(void);
131 struct timing_mcu *timing;
135 /* LCD abstraction */
142 struct info_rgb *rgb;
143 struct info_mcu *mcu;
145 struct lcd_operations *ops;
148 extern void LCD_SetBackLightBrightness( unsigned long value);