summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-09-05 03:50:04 +0000
committerThomas Martitz <kugel@rockbox.org>2009-09-05 03:50:04 +0000
commit46c719aac8c8f8aa76a75bffbe8aa62411343d0e (patch)
tree6ea0cb56abcd3337ce8698b0b9b345f7ee3495dc /firmware
parentbcb3d5258224945d9dca6880b1be7318b62a50d4 (diff)
downloadrockbox-46c719aac8c8f8aa76a75bffbe8aa62411343d0e.tar.gz
rockbox-46c719aac8c8f8aa76a75bffbe8aa62411343d0e.tar.bz2
rockbox-46c719aac8c8f8aa76a75bffbe8aa62411343d0e.zip
Make the Fuze usable again by inserting a few delays in the lcd functions, core rockbox should be fine now. NOTE: *After exiting* plugins (e.g. doom, plasma, pictureflow) which do heavy lcd updates, the Fuze still fails (backlight goes off) -- I have no idea how that happens yet, Unless I find a fix for that within the next few days, I'm probably going to revert one/both of the lcd speedup commits.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22627 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c
index b99621b3ac..a1a2be25d7 100644
--- a/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c
+++ b/firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c
@@ -48,6 +48,13 @@ static int xoffset = 20; /* needed for flip */
* so block lcd_button_support the during updates */
static bool lcd_busy = false;
+static inline void lcd_delay(int x)
+{
+ do {
+ asm volatile ("nop\n");
+ } while (x--);
+}
+
static void as3525_dbop_init(void)
{
CGU_DBOP = (1<<3) | AS3525_DBOP_DIV;
@@ -70,29 +77,25 @@ static void as3525_dbop_init(void)
/* TODO: The OF calls some other functions here, but maybe not important */
}
-#define lcd_write_single_data16(value) do {\
- DBOP_CTRL &= ~(1<<14|1<<13); \
- DBOP_DOUT16 = (fb_data)(value); \
- } while(0)
-
+static void lcd_write_value16(unsigned short value)
+{
+ DBOP_CTRL &= ~(1<<14|1<<13);
+ lcd_delay(10);
+ DBOP_DOUT16 = value;
+ while ((DBOP_STAT & (1<<10)) == 0);
+}
static void lcd_write_cmd(int cmd)
{
- int x;
-
/* Write register */
DBOP_TIMPOL_23 = 0xa167006e;
- lcd_write_single_data16(cmd);
+ lcd_write_value16(cmd);
/* Wait for fifo to empty */
while ((DBOP_STAT & (1<<10)) == 0);
/* This loop is unique to the Fuze */
- x = 0;
- do {
- asm volatile ("nop\n");
- } while (x++ < 4);
-
+ lcd_delay(4);
DBOP_TIMPOL_23 = 0xa167e06f;
}
@@ -103,13 +106,14 @@ void lcd_write_data(const fb_data* p_bytes, int count)
if ((int)p_bytes & 0x3)
{ /* need to do a single 16bit write beforehand if the address is
* not word aligned*/
- lcd_write_single_data16(*p_bytes);
+ lcd_write_value16(*p_bytes);
count--;p_bytes++;
}
/* from here, 32bit transfers are save */
/* set it to transfer 4*(outputwidth) units at a time,
* if bit 12 is set it only does 2 halfwords though */
DBOP_CTRL |= (1<<13|1<<14);
+ lcd_delay(10);
data = (long*)p_bytes;
while (count > 1)
{
@@ -125,7 +129,7 @@ void lcd_write_data(const fb_data* p_bytes, int count)
/* due to the 32bit alignment requirement or uneven count,
* we possibly need to do a 16bit transfer at the end also */
if (count > 0)
- lcd_write_single_data16(*(fb_data*)data);
+ lcd_write_value16(*(unsigned short*)data);
}
static void lcd_write_reg(int reg, int value)
@@ -133,7 +137,7 @@ static void lcd_write_reg(int reg, int value)
unsigned short data = value;
lcd_write_cmd(reg);
- lcd_write_single_data16(data);
+ lcd_write_value16(data);
}
/* turn the display upside down (call lcd_update() afterwards) */
@@ -420,7 +424,7 @@ bool lcd_button_support(void)
lcd_window_y(-1, 0);
lcd_write_cmd(R_WRITE_DATA_2_GRAM);
- lcd_write_single_data16(data);
+ lcd_write_value16(data);
return true;
}