summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-06-07 06:11:03 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-06-07 06:11:03 +0000
commit7a16069507a290a1aab84165aa0fb6f8ee4f1b59 (patch)
tree8258e42933fac463e9b6eba54d6a8203ca6e6df4 /firmware
parent66f42ac12dbfdaa70f5440c16567c53205aed059 (diff)
downloadrockbox-7a16069507a290a1aab84165aa0fb6f8ee4f1b59.tar.gz
rockbox-7a16069507a290a1aab84165aa0fb6f8ee4f1b59.zip
e200: Better sync of display enabling and display update. The display would be remain stale after being turned back on with no screen activity. Block out the fiddling with DMA when writing to driver framebuffer. Melts seem too rare to catch now. There seems to be no significant advantage from an appearance point of view to be meddling around with the transfer anyway.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13582 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/backlight-e200.c15
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/lcd-e200.c79
2 files changed, 51 insertions, 43 deletions
diff --git a/firmware/target/arm/sandisk/sansa-e200/backlight-e200.c b/firmware/target/arm/sandisk/sansa-e200/backlight-e200.c
index b608c1b9e6..29c6ab4b45 100644
--- a/firmware/target/arm/sandisk/sansa-e200/backlight-e200.c
+++ b/firmware/target/arm/sandisk/sansa-e200/backlight-e200.c
@@ -23,32 +23,27 @@
#include "i2c-pp.h"
static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING;
-static bool backlight_is_on = true;
-
-int __backlight_is_on(void)
-{
- return (int)backlight_is_on;
-}
void __backlight_set_brightness(int brightness)
{
backlight_brightness = brightness;
- pp_i2c_send( 0x46, 0x23, backlight_brightness);
- backlight_is_on = true;
+
+ if (brightness > 0)
+ __backlight_on();
+ else
+ __backlight_off();
}
void __backlight_on(void)
{
lcd_enable(true); /* power on lcd */
pp_i2c_send( 0x46, 0x23, backlight_brightness);
- backlight_is_on = true;
}
void __backlight_off(void)
{
pp_i2c_send( 0x46, 0x23, 0x0);
lcd_enable(false); /* power off lcd */
- backlight_is_on = false;
}
diff --git a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
index 8dc8ad95e9..86f12567b4 100644
--- a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
+++ b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
@@ -294,14 +294,20 @@ inline void lcd_init_device(void)
lcd_write_reg(R_DISP_CONTROL1, 0x0077);
lcd_send_msg(0x70, R_RAM_WRITE_DATA);
+
+ LCD_REG_6 |= 1; /* Start DMA */
}
void lcd_enable(bool on)
{
if(on)
{
- DEV_EN |= DEV_LCD; /* Enable LCD controller */
- LCD_REG_6 |= 1; /* Enable DMA */
+ if(!(DEV_EN & DEV_LCD))
+ {
+ DEV_EN |= DEV_LCD; /* Enable LCD controller */
+ lcd_update(); /* Resync display */
+ LCD_REG_6 |= 1; /* Restart DMA */
+ }
}
else
{
@@ -314,47 +320,51 @@ void lcd_enable(bool on)
}
}
-inline void lcd_update_rect(int x, int y, int width, int height)
+void lcd_update_rect(int x, int y, int width, int height)
{
(void)x;
(void)width;
- if(__backlight_is_on())
+ if(DEV_EN & DEV_LCD)
{
+#if 0
/* Turn off DMA and wait for the transfer to complete */
/* TODO: Work out the proper delay */
LCD_REG_6 &= ~1;
udelay(1000);
-
+#endif
/* Copy the Rockbox framebuffer to the second framebuffer */
/* TODO: Move the second framebuffer into uncached SDRAM */
memcpy(((char*)&lcd_driver_framebuffer)+(y * sizeof(fb_data) * LCD_WIDTH),
((char *)&lcd_framebuffer)+(y * sizeof(fb_data) * LCD_WIDTH),
((height * sizeof(fb_data) * LCD_WIDTH)));
flush_icache();
-
+#if 0
/* Restart DMA */
LCD_REG_6 |= 1;
+#endif
}
}
-inline void lcd_update(void)
+void lcd_update(void)
{
- if(__backlight_is_on())
+ if(DEV_EN & DEV_LCD)
{
/* TODO: It may be faster to swap the addresses of lcd_driver_framebuffer
* and lcd_framebuffer */
+#if 0
/* Turn off DMA and wait for the transfer to complete */
LCD_REG_6 &= ~1;
udelay(1000);
-
+#endif
/* Copy the Rockbox framebuffer to the second framebuffer */
memcpy(lcd_driver_framebuffer, lcd_framebuffer,
sizeof(fb_data) * LCD_WIDTH * LCD_HEIGHT);
flush_icache();
-
+#if 0
/* Restart DMA */
LCD_REG_6 |= 1;
+#endif
}
}
@@ -407,32 +417,35 @@ void lcd_yuv_blit(unsigned char * const src[3],
int src_x, int src_y, int stride,
int x, int y, int width, int height)
{
- /* Caches for chroma data so it only need be recaculated every other
- line */
- static unsigned char chroma_buf[LCD_HEIGHT/2*3]; /* 330 bytes */
- unsigned char const * yuv_src[3];
- off_t z;
+ if(DEV_EN & DEV_LCD)
+ {
+ /* Caches for chroma data so it only need be recaculated every other
+ line */
+ static unsigned char chroma_buf[LCD_HEIGHT/2*3]; /* 330 bytes */
+ unsigned char const * yuv_src[3];
+ off_t z;
- /* Sorry, but width and height must be >= 2 or else */
- width &= ~1;
- height >>= 1;
+ /* Sorry, but width and height must be >= 2 or else */
+ width &= ~1;
+ height >>= 1;
- fb_data *dst = (fb_data*)lcd_driver_framebuffer +
- x * LCD_WIDTH + (LCD_WIDTH - y) - 1;
+ fb_data *dst = (fb_data*)lcd_driver_framebuffer +
+ x * LCD_WIDTH + (LCD_WIDTH - y) - 1;
- z = stride*src_y;
- yuv_src[0] = src[0] + z + src_x;
- yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1);
- yuv_src[2] = src[2] + (yuv_src[1] - src[1]);
+ z = stride*src_y;
+ yuv_src[0] = src[0] + z + src_x;
+ yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1);
+ yuv_src[2] = src[2] + (yuv_src[1] - src[1]);
- do
- {
- lcd_write_yuv420_lines(dst, chroma_buf, yuv_src, width,
- stride);
- yuv_src[0] += stride << 1; /* Skip down two luma lines */
- yuv_src[1] += stride >> 1; /* Skip down one chroma line */
- yuv_src[2] += stride >> 1;
- dst -= 2;
+ do
+ {
+ lcd_write_yuv420_lines(dst, chroma_buf, yuv_src, width,
+ stride);
+ yuv_src[0] += stride << 1; /* Skip down two luma lines */
+ yuv_src[1] += stride >> 1; /* Skip down one chroma line */
+ yuv_src[2] += stride >> 1;
+ dst -= 2;
+ }
+ while (--height > 0);
}
- while (--height > 0);
}