FreeCalypso > hg > fc-tourmaline
comparison src/cs/drivers/drv_app/r2d/lcds/luna/r2d_onoff_i.c @ 277:0196b6bf633c
R2D: LCD hardware suspend implemented for Luna
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 07 Sep 2021 22:18:20 +0000 |
parents | 6541e43f88e5 |
children | 75758d7a9be3 |
comparison
equal
deleted
inserted
replaced
276:4221c724c664 | 277:0196b6bf633c |
---|---|
1 #include "r2d/lcds/luna/r2d_luna_lcd.h" | 1 #include "r2d/lcds/luna/r2d_luna_lcd.h" |
2 #include "main/sys_types.h" | 2 #include "main/sys_types.h" |
3 #include "armio.h" | 3 #include "armio.h" |
4 | |
5 static void lcd_suspend(void) | |
6 { | |
7 if (r2d_lcd_hw_suspend) | |
8 return; /* already in suspend */ | |
9 r2d_lcd_hw_suspend = 1; | |
10 LCD_REG_WR(0x0007, 0); /* display off */ | |
11 rvf_delay(RVF_MS_TO_TICKS(50)); | |
12 LCD_REG_WR(0x0010, 1); /* suspend mode */ | |
13 } | |
14 | |
15 static void lcd_resume(void) | |
16 { | |
17 if (!r2d_lcd_hw_suspend) | |
18 return; /* already on */ | |
19 LCD_REG_WR(0x0010, 0); /* out of suspend */ | |
20 rvf_delay(RVF_MS_TO_TICKS(50)); | |
21 LCD_REG_WR(0x0007, 0x1017); /* display on */ | |
22 r2d_lcd_hw_suspend = 0; | |
23 r2d_refresh(); | |
24 } | |
4 | 25 |
5 static void r2d_onoff_action(enum blrr_display_state set_state) | 26 static void r2d_onoff_action(enum blrr_display_state set_state) |
6 { | 27 { |
7 UBYTE on_off; | 28 UBYTE on_off; |
8 | 29 |
9 /* | 30 /* |
10 * PWL control: on our current Luna setups (Caramel2 or iWOW DSK) | 31 * PWL control: on our current Luna setups (Caramel2 or iWOW DSK) |
11 * PWL is only an indicator LED for developers, but the Mother's | 32 * PWL is only an indicator LED for developers. We use this PWL |
12 * plan for the dream FreeCalypso handset includes having PWL | 33 * indicator to show the state of "virtual dimming", as there is |
13 * regulate the backlight intensity. | 34 * no physical LCD backlight dimming control on Luna. |
14 */ | 35 */ |
15 switch (set_state) { | 36 switch (set_state) { |
16 case BLRR_DISPLAY_OFF: | 37 case BLRR_DISPLAY_OFF: |
17 *(volatile SYS_UWORD8 *)0xFFFE8000 = 0; | 38 *(volatile SYS_UWORD8 *)0xFFFE8000 = 0; |
18 *(volatile SYS_UWORD8 *)0xFFFE8001 = 0; | 39 *(volatile SYS_UWORD8 *)0xFFFE8001 = 0; |
34 on_off = 1; | 55 on_off = 1; |
35 break; | 56 break; |
36 default: | 57 default: |
37 return; /* error, but we are a void function */ | 58 return; /* error, but we are a void function */ |
38 } | 59 } |
39 /* physical backlight on/off */ | 60 /* physical LCD and backlight on/off */ |
40 if (on_off) | 61 if (on_off) { |
62 lcd_resume(); | |
41 AI_SetBit(9); | 63 AI_SetBit(9); |
42 else | 64 } else { |
43 AI_ResetBit(9); | 65 AI_ResetBit(9); |
44 /* TFT on/off control remains to be implemented */ | 66 lcd_suspend(); |
67 } | |
45 } | 68 } |