diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-09-24 00:18:09 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-09-24 00:18:09 +0000 |
commit | 361cdac3652a6e4a7a30b31171def0c2e7d301f3 (patch) | |
tree | 4fc83093bfc27179f5d69350770ba9422fcb3b34 /firmware | |
parent | edc6d6330999c615e750de4a8b214ca21c75062a (diff) | |
download | rockbox-361cdac3652a6e4a7a30b31171def0c2e7d301f3.tar.gz rockbox-361cdac3652a6e4a7a30b31171def0c2e7d301f3.zip |
The C200 LCD controller is a Samsung S6B33B2. Define appropriate register names, and implement display flip.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14838 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/export/config-c200.h | 2 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-c200/lcd-c200.c | 83 |
2 files changed, 61 insertions, 24 deletions
diff --git a/firmware/export/config-c200.h b/firmware/export/config-c200.h index acc9969cf5..745ac546fd 100644 --- a/firmware/export/config-c200.h +++ b/firmware/export/config-c200.h | |||
@@ -52,7 +52,7 @@ | |||
52 | /* TODO: #define HAVE_LCD_SLEEP */ | 52 | /* TODO: #define HAVE_LCD_SLEEP */ |
53 | 53 | ||
54 | /* define this if you can flip your LCD */ | 54 | /* define this if you can flip your LCD */ |
55 | /* TODO: #define HAVE_LCD_FLIP */ | 55 | #define HAVE_LCD_FLIP |
56 | 56 | ||
57 | /* define this if you can invert the colours on your LCD */ | 57 | /* define this if you can invert the colours on your LCD */ |
58 | /* TODO: #define HAVE_LCD_INVERT */ | 58 | /* TODO: #define HAVE_LCD_INVERT */ |
diff --git a/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c index 511456bf47..6513b7cc72 100644 --- a/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c +++ b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c | |||
@@ -28,6 +28,43 @@ | |||
28 | 28 | ||
29 | #define LCD_BUSY 0x8000 | 29 | #define LCD_BUSY 0x8000 |
30 | 30 | ||
31 | /* LCD command set for Samsung S6B33B2 */ | ||
32 | |||
33 | #define R_OSCILLATION_MODE 0x02 | ||
34 | #define R_DRIVER_OUTPUT_MODE 0x10 | ||
35 | #define R_DCDC_SET 0x20 | ||
36 | #define R_BIAS_SET 0x22 | ||
37 | #define R_DCDC_CLOCK_DIV 0x24 | ||
38 | #define R_DCDC_AMP_ONOFF 0x26 | ||
39 | #define R_TEMP_COMPENSATION 0x28 | ||
40 | #define R_CONTRAST_CONTROL1 0x2a | ||
41 | #define R_CONTRAST_CONTROL2 0x2b | ||
42 | #define R_STANDBY_OFF 0x2c | ||
43 | #define R_STANDBY_ON 0x2d | ||
44 | #define R_DDRAM_BURST_OFF 0x2e | ||
45 | #define R_DDRAM_BURST_ON 0x2f | ||
46 | #define R_ADDRESSING_MODE 0x30 | ||
47 | #define R_ROW_VECTOR_MODE 0x32 | ||
48 | #define R_N_LINE_INVERSION 0x34 | ||
49 | #define R_FRAME_FREQ_CONTROL 0x36 | ||
50 | #define R_RED_PALETTE 0x38 | ||
51 | #define R_GREEN_PALETTE 0x3a | ||
52 | #define R_BLUE_PALETTE 0x3c | ||
53 | #define R_ENTRY_MODE 0x40 | ||
54 | #define R_X_ADDR_AREA 0x42 | ||
55 | #define R_Y_ADDR_AREA 0x43 | ||
56 | #define R_RAM_SKIP_AREA 0x45 | ||
57 | #define R_DISPLAY_OFF 0x50 | ||
58 | #define R_DISPLAY_ON 0x51 | ||
59 | #define R_SPEC_DISPLAY_PATTERN 0x53 | ||
60 | #define R_PARTIAL_DISPLAY_MODE 0x55 | ||
61 | #define R_PARTIAL_START_LINE 0x56 | ||
62 | #define R_PARTIAL_END_LINE 0x57 | ||
63 | #define R_AREA_SCROLL_MODE 0x59 | ||
64 | #define R_SCROLL_START_LINE 0x5a | ||
65 | #define R_DATA_FORMAT_SELECT 0x60 | ||
66 | |||
67 | |||
31 | /* wait for LCD */ | 68 | /* wait for LCD */ |
32 | static inline void lcd_wait_write(void) | 69 | static inline void lcd_wait_write(void) |
33 | { | 70 | { |
@@ -70,69 +107,69 @@ void lcd_init_device(void) | |||
70 | LCD_BASE = 0x4687; | 107 | LCD_BASE = 0x4687; |
71 | udelay(10000); | 108 | udelay(10000); |
72 | 109 | ||
73 | lcd_send_command(0x2c); | 110 | lcd_send_command(R_STANDBY_OFF); |
74 | udelay(20000); | 111 | udelay(20000); |
75 | 112 | ||
76 | lcd_send_command(0x02); | 113 | lcd_send_command(R_OSCILLATION_MODE); |
77 | lcd_send_command(0x01); | 114 | lcd_send_command(0x01); |
78 | udelay(20000); | 115 | udelay(20000); |
79 | 116 | ||
80 | lcd_send_command(0x26); | 117 | lcd_send_command(R_DCDC_AMP_ONOFF); |
81 | lcd_send_command(0x01); | 118 | lcd_send_command(0x01); |
82 | udelay(20000); | 119 | udelay(20000); |
83 | 120 | ||
84 | lcd_send_command(0x26); | 121 | lcd_send_command(R_DCDC_AMP_ONOFF); |
85 | lcd_send_command(0x09); | 122 | lcd_send_command(0x09); |
86 | udelay(20000); | 123 | udelay(20000); |
87 | 124 | ||
88 | lcd_send_command(0x26); | 125 | lcd_send_command(R_DCDC_AMP_ONOFF); |
89 | lcd_send_command(0x0b); | 126 | lcd_send_command(0x0b); |
90 | udelay(20000); | 127 | udelay(20000); |
91 | 128 | ||
92 | lcd_send_command(0x26); | 129 | lcd_send_command(R_DCDC_AMP_ONOFF); |
93 | lcd_send_command(0x0f); | 130 | lcd_send_command(0x0f); |
94 | udelay(20000); | 131 | udelay(20000); |
95 | 132 | ||
96 | lcd_send_command(0x10); | 133 | lcd_send_command(R_DRIVER_OUTPUT_MODE); |
97 | lcd_send_command(0x07); | 134 | lcd_send_command(0x07); |
98 | 135 | ||
99 | lcd_send_command(0x20); | 136 | lcd_send_command(R_DCDC_SET); |
100 | lcd_send_command(0x03); | 137 | lcd_send_command(0x03); |
101 | 138 | ||
102 | lcd_send_command(0x24); | 139 | lcd_send_command(R_DCDC_CLOCK_DIV); |
103 | lcd_send_command(0x03); | 140 | lcd_send_command(0x03); |
104 | 141 | ||
105 | lcd_send_command(0x28); | 142 | lcd_send_command(R_TEMP_COMPENSATION); |
106 | lcd_send_command(0x01); | 143 | lcd_send_command(0x01); |
107 | 144 | ||
108 | lcd_send_command(0x2a); | 145 | lcd_send_command(R_CONTRAST_CONTROL1); |
109 | lcd_send_command(0x55); | 146 | lcd_send_command(0x55); |
110 | 147 | ||
111 | lcd_send_command(0x30); | 148 | lcd_send_command(R_ADDRESSING_MODE); |
112 | lcd_send_command(0x10); | 149 | lcd_send_command(0x10); |
113 | 150 | ||
114 | lcd_send_command(0x32); | 151 | lcd_send_command(R_ROW_VECTOR_MODE); |
115 | lcd_send_command(0x0e); | 152 | lcd_send_command(0x0e); |
116 | 153 | ||
117 | lcd_send_command(0x34); | 154 | lcd_send_command(R_N_LINE_INVERSION); |
118 | lcd_send_command(0x0d); | 155 | lcd_send_command(0x0d); |
119 | 156 | ||
120 | lcd_send_command(0x36); | 157 | lcd_send_command(R_FRAME_FREQ_CONTROL); |
121 | lcd_send_command(0); | 158 | lcd_send_command(0); |
122 | 159 | ||
123 | lcd_send_command(0x40); | 160 | lcd_send_command(R_ENTRY_MODE); |
124 | lcd_send_command(0x82); | 161 | lcd_send_command(0x82); |
125 | 162 | ||
126 | lcd_send_command(0x43); /* vertical dimensions */ | 163 | lcd_send_command(R_Y_ADDR_AREA); /* vertical dimensions */ |
127 | lcd_send_command(0x1a); /* y1 + 0x1a */ | 164 | lcd_send_command(0x1a); /* y1 + 0x1a */ |
128 | lcd_send_command(LCD_HEIGHT - 1 + 0x1a); /* y2 + 0x1a */ | 165 | lcd_send_command(LCD_HEIGHT - 1 + 0x1a); /* y2 + 0x1a */ |
129 | 166 | ||
130 | lcd_send_command(0x42); /* horizontal dimensions */ | 167 | lcd_send_command(R_X_ADDR_AREA); /* horizontal dimensions */ |
131 | lcd_send_command(0); /* x1 */ | 168 | lcd_send_command(0); /* x1 */ |
132 | lcd_send_command(LCD_WIDTH - 1); /* x2 */ | 169 | lcd_send_command(LCD_WIDTH - 1); /* x2 */ |
133 | udelay(100000); | 170 | udelay(100000); |
134 | 171 | ||
135 | lcd_send_command(0x51); | 172 | lcd_send_command(R_DISPLAY_ON); |
136 | } | 173 | } |
137 | 174 | ||
138 | /*** hardware configuration ***/ | 175 | /*** hardware configuration ***/ |
@@ -156,8 +193,8 @@ void lcd_set_invert_display(bool yesno) | |||
156 | /* turn the display upside down (call lcd_update() afterwards) */ | 193 | /* turn the display upside down (call lcd_update() afterwards) */ |
157 | void lcd_set_flip(bool yesno) | 194 | void lcd_set_flip(bool yesno) |
158 | { | 195 | { |
159 | /* TODO: Implement lcd_set_flip() */ | 196 | lcd_send_command(R_DRIVER_OUTPUT_MODE); |
160 | (void)yesno; | 197 | lcd_send_command(yesno ? 0x02 : 0x07); |
161 | } | 198 | } |
162 | 199 | ||
163 | /*** update functions ***/ | 200 | /*** update functions ***/ |
@@ -212,14 +249,14 @@ void lcd_update_rect(int x0, int y0, int width, int height) | |||
212 | if(y1 >= LCD_HEIGHT) | 249 | if(y1 >= LCD_HEIGHT) |
213 | y1 = LCD_HEIGHT - 1; | 250 | y1 = LCD_HEIGHT - 1; |
214 | 251 | ||
215 | lcd_send_command(0x43); | 252 | lcd_send_command(R_Y_ADDR_AREA); |
216 | lcd_send_command(y0 + 0x1a); | 253 | lcd_send_command(y0 + 0x1a); |
217 | lcd_send_command(y1 + 0x1a); | 254 | lcd_send_command(y1 + 0x1a); |
218 | 255 | ||
219 | if(x1 >= LCD_WIDTH) | 256 | if(x1 >= LCD_WIDTH) |
220 | x1 = LCD_WIDTH - 1; | 257 | x1 = LCD_WIDTH - 1; |
221 | 258 | ||
222 | lcd_send_command(0x42); | 259 | lcd_send_command(R_X_ADDR_AREA); |
223 | lcd_send_command(x0); | 260 | lcd_send_command(x0); |
224 | lcd_send_command(x1); | 261 | lcd_send_command(x1); |
225 | 262 | ||