summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tms320dm320/mrobe-500
diff options
context:
space:
mode:
authorKarl Kurbjun <kkurbjun@gmail.com>2009-03-26 22:20:46 +0000
committerKarl Kurbjun <kkurbjun@gmail.com>2009-03-26 22:20:46 +0000
commit9d1b99534e0a3bf6559a4fe06420b0bc9274a688 (patch)
tree06decc501f46fae58171909a0cd1153bf6828a17 /firmware/target/arm/tms320dm320/mrobe-500
parentb084d603562cdf2eb90cdfd0c5c0e1e5fa8776a9 (diff)
downloadrockbox-9d1b99534e0a3bf6559a4fe06420b0bc9274a688.tar.gz
rockbox-9d1b99534e0a3bf6559a4fe06420b0bc9274a688.zip
Add support for powering down the LCD (saves 50 mA when disabled)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20547 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/tms320dm320/mrobe-500')
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c10
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c59
2 files changed, 63 insertions, 6 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c
index 1537e76219..855f10ef35 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c
@@ -30,12 +30,22 @@
30 30
31void _backlight_on(void) 31void _backlight_on(void)
32{ 32{
33#ifdef HAVE_LCD_SLEEP
34 backlight_lcd_sleep_countdown(false); /* stop counter */
35#endif
36#ifdef HAVE_LCD_ENABLE
37 lcd_enable(true); /* power on lcd + visible display */
38#endif
33 _backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING); 39 _backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING);
34} 40}
35 41
36void _backlight_off(void) 42void _backlight_off(void)
37{ 43{
38 _backlight_set_brightness(0); 44 _backlight_set_brightness(0);
45#ifdef HAVE_LCD_SLEEP
46 /* Disable lcd after fade completes (when lcd_sleep timeout expires) */
47 backlight_lcd_sleep_countdown(true); /* start countdown */
48#endif
39} 49}
40 50
41/* Assumes that the backlight has been initialized */ 51/* Assumes that the backlight has been initialized */
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
index cdba4c8118..1126f35149 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
@@ -38,7 +38,11 @@
38extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src, 38extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src,
39 int width, int height); 39 int width, int height);
40 40
41static volatile bool lcd_on = true; 41static bool lcd_on = true;
42#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
43static bool lcd_powered = true;
44#endif
45
42volatile bool lcd_poweroff = false; 46volatile bool lcd_poweroff = false;
43/* 47/*
44** These are imported from lcd-16bit.c 48** These are imported from lcd-16bit.c
@@ -46,10 +50,55 @@ volatile bool lcd_poweroff = false;
46extern unsigned fg_pattern; 50extern unsigned fg_pattern;
47extern unsigned bg_pattern; 51extern unsigned bg_pattern;
48 52
53#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
49bool lcd_active(void) 54bool lcd_active(void)
50{ 55{
51 return lcd_on; 56 return lcd_on;
52} 57}
58#endif
59
60#if defined(HAVE_LCD_SLEEP)
61void lcd_sleep()
62{
63 if (lcd_powered)
64 {
65 /* "not powered" implies "disabled" */
66 if (lcd_on)
67 lcd_enable(false);
68 IO_GIO_BITCLR2=1<<4;
69 lcd_powered=false;
70 }
71}
72#endif
73
74#if defined(HAVE_LCD_ENABLE)
75void lcd_enable(bool state)
76{
77 if (state == lcd_on)
78 return;
79
80 if(state)
81 {
82 /* "enabled" implies "powered" */
83 if (!lcd_powered)
84 {
85 lcd_powered=true;
86 IO_GIO_BITSET2=1<<4;
87 /* Wait long enough for a frame to be written - yes, it
88 * takes awhile. */
89 sleep(HZ/5);
90 }
91
92 lcd_on = true;
93 lcd_update();
94 lcd_activation_call_hook();
95 }
96 else
97 {
98 lcd_on = false;
99 }
100}
101#endif
53 102
54/* LCD init - based on code from ingenient-bsp/bootloader/board/dm320/splash.c 103/* LCD init - based on code from ingenient-bsp/bootloader/board/dm320/splash.c
55 * and code by Catalin Patulea from the M:Robe 500i linux port 104 * and code by Catalin Patulea from the M:Robe 500i linux port
@@ -80,6 +129,9 @@ void lcd_init_device(void)
80 IO_OSD_OSDWIN0YP=0; 129 IO_OSD_OSDWIN0YP=0;
81 IO_OSD_OSDWIN0XL=480; 130 IO_OSD_OSDWIN0XL=480;
82 IO_OSD_OSDWIN0YL=640; 131 IO_OSD_OSDWIN0YL=640;
132
133 /* Set pin 36 to an output */
134 IO_GIO_DIR2&=!(1<<4);
83} 135}
84 136
85/* Update a fraction of the display. */ 137/* Update a fraction of the display. */
@@ -138,11 +190,6 @@ void lcd_update_rect(int x, int y, int width, int height)
138#endif 190#endif
139} 191}
140 192
141void lcd_enable(bool state)
142{
143 (void)state;
144}
145
146/* Update the display. 193/* Update the display.
147 This must be called after all other LCD functions that change the display. */ 194 This must be called after all other LCD functions that change the display. */
148void lcd_update(void) 195void lcd_update(void)