summaryrefslogtreecommitdiff
path: root/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c')
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c
index f78b642644..5ace2a61f6 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c
@@ -66,7 +66,7 @@ inline void delay_cycles(volatile int delay)
66 while(delay>0) delay--; 66 while(delay>0) delay--;
67} 67}
68 68
69void LCD_CTRL_setup(void) 69static void LCD_CTRL_setup(void)
70{ 70{
71 /* ENVID = 0, BPPMODE = 16 bpp, PNRMODE = TFT, MMODE = Each Frame, CLKVAL = 8 */ 71 /* ENVID = 0, BPPMODE = 16 bpp, PNRMODE = TFT, MMODE = Each Frame, CLKVAL = 8 */
72 LCDCON1 = 0x878; 72 LCDCON1 = 0x878;
@@ -88,7 +88,7 @@ void LCD_CTRL_setup(void)
88 LCDSADDR3 = 0x000000F0; 88 LCDSADDR3 = 0x000000F0;
89} 89}
90 90
91void LCD_CTRL_clock(bool onoff) 91static void LCD_CTRL_clock(bool onoff)
92{ 92{
93 if(onoff) 93 if(onoff)
94 { 94 {
@@ -117,7 +117,7 @@ void LCD_CTRL_clock(bool onoff)
117 } 117 }
118} 118}
119 119
120void reset_LCD(bool reset) 120static void reset_LCD(bool reset)
121{ 121{
122 GPBCON&=~0xC000; 122 GPBCON&=~0xC000;
123 GPBCON|=0x4000; 123 GPBCON|=0x4000;
@@ -127,7 +127,7 @@ void reset_LCD(bool reset)
127 GPBDAT&=~0x80; 127 GPBDAT&=~0x80;
128} 128}
129 129
130void LCD_SPI_send(const unsigned char *array, int count) 130static void LCD_SPI_send(const unsigned char *array, int count)
131{ 131{
132 while (count--) 132 while (count--)
133 { 133 {
@@ -145,7 +145,7 @@ void LCD_SPI_setreg(unsigned char reg, unsigned char value)
145 LCD_SPI_send(regval, sizeof(regval)); 145 LCD_SPI_send(regval, sizeof(regval));
146} 146}
147 147
148void LCD_SPI_SS(bool select) 148static void LCD_SPI_SS(bool select)
149{ 149{
150 delay_cycles(0x4FFF); 150 delay_cycles(0x4FFF);
151 151
@@ -177,7 +177,7 @@ void LCD_SPI_stop(void)
177 s3c_regclr(&CLKCON, 0x40000); /* disable SPI clock */ 177 s3c_regclr(&CLKCON, 0x40000); /* disable SPI clock */
178} 178}
179 179
180void LCD_SPI_powerdown(void) 180static void LCD_SPI_powerdown(void)
181{ 181{
182 lcd_powered = false; 182 lcd_powered = false;
183 183
@@ -189,7 +189,7 @@ void LCD_SPI_powerdown(void)
189 LCD_CTRL_clock(false); 189 LCD_CTRL_clock(false);
190} 190}
191 191
192void LCD_SPI_powerup(void) 192static void LCD_SPI_powerup(void)
193{ 193{
194 LCD_CTRL_clock(true); 194 LCD_CTRL_clock(true);
195 195
@@ -200,13 +200,12 @@ void LCD_SPI_powerup(void)
200 lcd_powered = true; 200 lcd_powered = true;
201} 201}
202 202
203void LCD_SPI_init(void) 203static void LCD_SPI_init(void)
204{ 204{
205 /* SPI data - Right now we are not sure what each of these SPI writes is 205 /*
206 * actually telling the lcd. Many thanks to Alex Gerchanovsky for 206 * SPI setup - Some of these registers are known; they are documented in
207 * discovering them. 207 * the wiki. Many thanks to Alex Gerchanovsky for discovering this
208 * 208 * sequence.
209 * Addr 0x04 is used more than once is an enable.
210 */ 209 */
211 210
212 LCD_CTRL_clock(true); 211 LCD_CTRL_clock(true);
@@ -299,13 +298,6 @@ void lcd_set_flip(bool yesno) {
299 if (!lcd_on) 298 if (!lcd_on)
300 return; 299 return;
301 300
302 /* Register 0x06 sets the screen orientation:
303 *
304 * Known Values:
305 * 0x04: Right side up portrait
306 * 0x02: Upside down protrait
307 */
308
309 LCD_SPI_start(); 301 LCD_SPI_start();
310 if(yesno) 302 if(yesno)
311 { 303 {
@@ -318,6 +310,22 @@ void lcd_set_flip(bool yesno) {
318 LCD_SPI_stop(); 310 LCD_SPI_stop();
319} 311}
320 312
313void lcd_set_invert_display(bool yesno) {
314 if (!lcd_on)
315 return;
316
317 LCD_SPI_start();
318 if(yesno)
319 {
320 LCD_SPI_setreg(0x27, 0x10);
321 }
322 else
323 {
324 LCD_SPI_setreg(0x27, 0x00);
325 }
326 LCD_SPI_stop();
327}
328
321/* Update a fraction of the display. */ 329/* Update a fraction of the display. */
322void lcd_update_rect(int x, int y, int width, int height) 330void lcd_update_rect(int x, int y, int width, int height)
323{ 331{
@@ -495,8 +503,3 @@ void lcd_set_contrast(int val) {
495 // TODO: 503 // TODO:
496} 504}
497 505
498void lcd_set_invert_display(bool yesno) {
499 (void) yesno;
500 // TODO:
501}
502