summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c')
-rw-r--r--firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c52
1 files changed, 17 insertions, 35 deletions
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
index e26a88704d..20b830b02d 100644
--- a/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
+++ b/firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c
@@ -38,9 +38,8 @@
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
41#if defined(HAVE_LCD_SLEEP)
41static bool lcd_on = true; 42static bool lcd_on = true;
42#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
43static bool lcd_powered = true;
44#endif 43#endif
45 44
46/* 45/*
@@ -49,7 +48,7 @@ static bool lcd_powered = true;
49extern unsigned fg_pattern; 48extern unsigned fg_pattern;
50extern unsigned bg_pattern; 49extern unsigned bg_pattern;
51 50
52#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 51#if defined(HAVE_LCD_SLEEP)
53bool lcd_active(void) 52bool lcd_active(void)
54{ 53{
55 return lcd_on; 54 return lcd_on;
@@ -59,12 +58,8 @@ bool lcd_active(void)
59#if defined(HAVE_LCD_SLEEP) 58#if defined(HAVE_LCD_SLEEP)
60void lcd_sleep() 59void lcd_sleep()
61{ 60{
62 if (lcd_powered) 61 if (lcd_on)
63 { 62 {
64 /* "not powered" implies "disabled" */
65 if (lcd_on)
66 lcd_enable(false);
67
68 /* Disabling these saves another ~15mA */ 63 /* Disabling these saves another ~15mA */
69 IO_OSD_OSDWINMD0&=~(0x01); 64 IO_OSD_OSDWINMD0&=~(0x01);
70 IO_VID_ENC_VMOD&=~(0x01); 65 IO_VID_ENC_VMOD&=~(0x01);
@@ -73,42 +68,29 @@ void lcd_sleep()
73 68
74 /* Disabling the LCD saves ~50mA */ 69 /* Disabling the LCD saves ~50mA */
75 IO_GIO_BITCLR2=1<<4; 70 IO_GIO_BITCLR2=1<<4;
76 lcd_powered=false; 71 lcd_on = false;
77 } 72 }
78} 73}
79#endif
80 74
81#if defined(HAVE_LCD_ENABLE) 75void lcd_awake(void)
82void lcd_enable(bool state)
83{ 76{
84 if (state == lcd_on) 77 /* "enabled" implies "powered" */
85 return; 78 if (!lcd_on)
86
87 if(state)
88 { 79 {
89 /* "enabled" implies "powered" */ 80 lcd_on=true;
90 if (!lcd_powered)
91 {
92 lcd_powered=true;
93
94 IO_OSD_OSDWINMD0|=0x01;
95 IO_VID_ENC_VMOD|=0x01;
96 81
97 sleep(2); 82 IO_OSD_OSDWINMD0|=0x01;
98 IO_GIO_BITSET2=1<<4; 83 IO_VID_ENC_VMOD|=0x01;
99 /* Wait long enough for a frame to be written - yes, it 84
100 * takes awhile. */ 85 sleep(2);
101 sleep(HZ/5); 86 IO_GIO_BITSET2=1<<4;
102 } 87 /* Wait long enough for a frame to be written - yes, it
103 88 * takes awhile. */
104 lcd_on = true; 89 sleep(HZ/5);
90
105 lcd_update(); 91 lcd_update();
106 lcd_activation_call_hook(); 92 lcd_activation_call_hook();
107 } 93 }
108 else
109 {
110 lcd_on = false;
111 }
112} 94}
113#endif 95#endif
114 96