diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-09-05 03:50:04 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-09-05 03:50:04 +0000 |
commit | 46c719aac8c8f8aa76a75bffbe8aa62411343d0e (patch) | |
tree | 6ea0cb56abcd3337ce8698b0b9b345f7ee3495dc /firmware/target | |
parent | bcb3d5258224945d9dca6880b1be7318b62a50d4 (diff) | |
download | rockbox-46c719aac8c8f8aa76a75bffbe8aa62411343d0e.tar.gz 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/target')
-rw-r--r-- | firmware/target/arm/as3525/sansa-fuze/lcd-fuze.c | 38 |
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 */ | |||
48 | * so block lcd_button_support the during updates */ | 48 | * so block lcd_button_support the during updates */ |
49 | static bool lcd_busy = false; | 49 | static bool lcd_busy = false; |
50 | 50 | ||
51 | static inline void lcd_delay(int x) | ||
52 | { | ||
53 | do { | ||
54 | asm volatile ("nop\n"); | ||
55 | } while (x--); | ||
56 | } | ||
57 | |||
51 | static void as3525_dbop_init(void) | 58 | static void as3525_dbop_init(void) |
52 | { | 59 | { |
53 | CGU_DBOP = (1<<3) | AS3525_DBOP_DIV; | 60 | CGU_DBOP = (1<<3) | AS3525_DBOP_DIV; |
@@ -70,29 +77,25 @@ static void as3525_dbop_init(void) | |||
70 | /* TODO: The OF calls some other functions here, but maybe not important */ | 77 | /* TODO: The OF calls some other functions here, but maybe not important */ |
71 | } | 78 | } |
72 | 79 | ||
73 | #define lcd_write_single_data16(value) do {\ | 80 | static void lcd_write_value16(unsigned short value) |
74 | DBOP_CTRL &= ~(1<<14|1<<13); \ | 81 | { |
75 | DBOP_DOUT16 = (fb_data)(value); \ | 82 | DBOP_CTRL &= ~(1<<14|1<<13); |
76 | } while(0) | 83 | lcd_delay(10); |
77 | 84 | DBOP_DOUT16 = value; | |
85 | while ((DBOP_STAT & (1<<10)) == 0); | ||
86 | } | ||
78 | 87 | ||
79 | static void lcd_write_cmd(int cmd) | 88 | static void lcd_write_cmd(int cmd) |
80 | { | 89 | { |
81 | int x; | ||
82 | |||
83 | /* Write register */ | 90 | /* Write register */ |
84 | DBOP_TIMPOL_23 = 0xa167006e; | 91 | DBOP_TIMPOL_23 = 0xa167006e; |
85 | lcd_write_single_data16(cmd); | 92 | lcd_write_value16(cmd); |
86 | 93 | ||
87 | /* Wait for fifo to empty */ | 94 | /* Wait for fifo to empty */ |
88 | while ((DBOP_STAT & (1<<10)) == 0); | 95 | while ((DBOP_STAT & (1<<10)) == 0); |
89 | 96 | ||
90 | /* This loop is unique to the Fuze */ | 97 | /* This loop is unique to the Fuze */ |
91 | x = 0; | 98 | lcd_delay(4); |
92 | do { | ||
93 | asm volatile ("nop\n"); | ||
94 | } while (x++ < 4); | ||
95 | |||
96 | 99 | ||
97 | DBOP_TIMPOL_23 = 0xa167e06f; | 100 | DBOP_TIMPOL_23 = 0xa167e06f; |
98 | } | 101 | } |
@@ -103,13 +106,14 @@ void lcd_write_data(const fb_data* p_bytes, int count) | |||
103 | if ((int)p_bytes & 0x3) | 106 | if ((int)p_bytes & 0x3) |
104 | { /* need to do a single 16bit write beforehand if the address is | 107 | { /* need to do a single 16bit write beforehand if the address is |
105 | * not word aligned*/ | 108 | * not word aligned*/ |
106 | lcd_write_single_data16(*p_bytes); | 109 | lcd_write_value16(*p_bytes); |
107 | count--;p_bytes++; | 110 | count--;p_bytes++; |
108 | } | 111 | } |
109 | /* from here, 32bit transfers are save */ | 112 | /* from here, 32bit transfers are save */ |
110 | /* set it to transfer 4*(outputwidth) units at a time, | 113 | /* set it to transfer 4*(outputwidth) units at a time, |
111 | * if bit 12 is set it only does 2 halfwords though */ | 114 | * if bit 12 is set it only does 2 halfwords though */ |
112 | DBOP_CTRL |= (1<<13|1<<14); | 115 | DBOP_CTRL |= (1<<13|1<<14); |
116 | lcd_delay(10); | ||
113 | data = (long*)p_bytes; | 117 | data = (long*)p_bytes; |
114 | while (count > 1) | 118 | while (count > 1) |
115 | { | 119 | { |
@@ -125,7 +129,7 @@ void lcd_write_data(const fb_data* p_bytes, int count) | |||
125 | /* due to the 32bit alignment requirement or uneven count, | 129 | /* due to the 32bit alignment requirement or uneven count, |
126 | * we possibly need to do a 16bit transfer at the end also */ | 130 | * we possibly need to do a 16bit transfer at the end also */ |
127 | if (count > 0) | 131 | if (count > 0) |
128 | lcd_write_single_data16(*(fb_data*)data); | 132 | lcd_write_value16(*(unsigned short*)data); |
129 | } | 133 | } |
130 | 134 | ||
131 | static void lcd_write_reg(int reg, int value) | 135 | static void lcd_write_reg(int reg, int value) |
@@ -133,7 +137,7 @@ static void lcd_write_reg(int reg, int value) | |||
133 | unsigned short data = value; | 137 | unsigned short data = value; |
134 | 138 | ||
135 | lcd_write_cmd(reg); | 139 | lcd_write_cmd(reg); |
136 | lcd_write_single_data16(data); | 140 | lcd_write_value16(data); |
137 | } | 141 | } |
138 | 142 | ||
139 | /* turn the display upside down (call lcd_update() afterwards) */ | 143 | /* turn the display upside down (call lcd_update() afterwards) */ |
@@ -420,7 +424,7 @@ bool lcd_button_support(void) | |||
420 | lcd_window_y(-1, 0); | 424 | lcd_window_y(-1, 0); |
421 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); | 425 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); |
422 | 426 | ||
423 | lcd_write_single_data16(data); | 427 | lcd_write_value16(data); |
424 | 428 | ||
425 | return true; | 429 | return true; |
426 | } | 430 | } |