diff options
Diffstat (limited to 'firmware/target/hosted/backlight-unix.c')
-rw-r--r-- | firmware/target/hosted/backlight-unix.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/firmware/target/hosted/backlight-unix.c b/firmware/target/hosted/backlight-unix.c index 28bda52b20..06da05e487 100644 --- a/firmware/target/hosted/backlight-unix.c +++ b/firmware/target/hosted/backlight-unix.c | |||
@@ -44,20 +44,28 @@ bool backlight_hw_init(void) | |||
44 | return true; | 44 | return true; |
45 | } | 45 | } |
46 | 46 | ||
47 | static int last_bl = -1; | ||
48 | |||
47 | void backlight_hw_on(void) | 49 | void backlight_hw_on(void) |
48 | { | 50 | { |
51 | if (last_bl != 1) { | ||
49 | #ifdef HAVE_LCD_ENABLE | 52 | #ifdef HAVE_LCD_ENABLE |
50 | lcd_enable(true); | 53 | lcd_enable(true); |
51 | #endif | 54 | #endif |
52 | sysfs_set_int(sysfs_bl_power, 0); | 55 | sysfs_set_int(sysfs_bl_power, 0); |
56 | last_bl = 1; | ||
57 | } | ||
53 | } | 58 | } |
54 | 59 | ||
55 | void backlight_hw_off(void) | 60 | void backlight_hw_off(void) |
56 | { | 61 | { |
57 | sysfs_set_int(sysfs_bl_power, 1); | 62 | if (last_bl != 0) { |
63 | sysfs_set_int(sysfs_bl_power, 1); | ||
58 | #ifdef HAVE_LCD_ENABLE | 64 | #ifdef HAVE_LCD_ENABLE |
59 | lcd_enable(false); | 65 | lcd_enable(false); |
60 | #endif | 66 | #endif |
67 | last_bl = 0; | ||
68 | } | ||
61 | } | 69 | } |
62 | 70 | ||
63 | void backlight_hw_brightness(int brightness) | 71 | void backlight_hw_brightness(int brightness) |