diff options
Diffstat (limited to 'firmware/target/arm/tms320dm320')
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/backlight-mr500.c | 10 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/lcd-mr500.c | 59 |
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 | ||
31 | void _backlight_on(void) | 31 | void _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 | ||
36 | void _backlight_off(void) | 42 | void _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 @@ | |||
38 | extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src, | 38 | extern 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 | static volatile bool lcd_on = true; | 41 | static bool lcd_on = true; |
42 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
43 | static bool lcd_powered = true; | ||
44 | #endif | ||
45 | |||
42 | volatile bool lcd_poweroff = false; | 46 | volatile 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; | |||
46 | extern unsigned fg_pattern; | 50 | extern unsigned fg_pattern; |
47 | extern unsigned bg_pattern; | 51 | extern unsigned bg_pattern; |
48 | 52 | ||
53 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | ||
49 | bool lcd_active(void) | 54 | bool lcd_active(void) |
50 | { | 55 | { |
51 | return lcd_on; | 56 | return lcd_on; |
52 | } | 57 | } |
58 | #endif | ||
59 | |||
60 | #if defined(HAVE_LCD_SLEEP) | ||
61 | void 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) | ||
75 | void 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 | ||
141 | void 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. */ |
148 | void lcd_update(void) | 195 | void lcd_update(void) |