diff options
Diffstat (limited to 'firmware/target/hosted/samsungypr/lcd-ypr.c')
-rw-r--r-- | firmware/target/hosted/samsungypr/lcd-ypr.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/firmware/target/hosted/samsungypr/lcd-ypr.c b/firmware/target/hosted/samsungypr/lcd-ypr.c index 40528c298a..8d9bfefbec 100644 --- a/firmware/target/hosted/samsungypr/lcd-ypr.c +++ b/firmware/target/hosted/samsungypr/lcd-ypr.c | |||
@@ -8,6 +8,7 @@ | |||
8 | * $Id: lcd-bitmap.c 29248 2011-02-08 20:05:25Z thomasjfox $ | 8 | * $Id: lcd-bitmap.c 29248 2011-02-08 20:05:25Z thomasjfox $ |
9 | * | 9 | * |
10 | * Copyright (C) 2011 Lorenzo Miori, Thomas Martitz | 10 | * Copyright (C) 2011 Lorenzo Miori, Thomas Martitz |
11 | * Copyright (C) 2013 Lorenzo Miori | ||
11 | * | 12 | * |
12 | * This program is free software; you can redistribute it and/or | 13 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 14 | * modify it under the terms of the GNU General Public License |
@@ -22,26 +23,28 @@ | |||
22 | #include <stdlib.h> | 23 | #include <stdlib.h> |
23 | #include <unistd.h> | 24 | #include <unistd.h> |
24 | #include <stdio.h> | 25 | #include <stdio.h> |
25 | #include "string.h" | ||
26 | #include <linux/fb.h> | 26 | #include <linux/fb.h> |
27 | #include <sys/mman.h> | 27 | #include <sys/mman.h> |
28 | #include <sys/ioctl.h> | 28 | #include <sys/ioctl.h> |
29 | 29 | #include "config.h" | |
30 | #include "file.h" | 30 | #include "file.h" |
31 | #include "debug.h" | 31 | #include "debug.h" |
32 | #include "system.h" | 32 | #include "system.h" |
33 | #include "screendump.h" | 33 | #include "screendump.h" |
34 | #include "lcd.h" | 34 | #include "lcd.h" |
35 | #include "lcd-target.h" | ||
35 | 36 | ||
36 | static int dev_fd = 0; | 37 | static int dev_fd = 0; |
37 | fb_data *dev_fb = 0; | 38 | fb_data *dev_fb = 0; |
38 | 39 | ||
40 | #ifdef HAVE_LCD_SHUTDOWN | ||
39 | void lcd_shutdown(void) | 41 | void lcd_shutdown(void) |
40 | { | 42 | { |
41 | printf("FB closed."); | 43 | printf("FB closed."); |
42 | munmap(dev_fb, FRAMEBUFFER_SIZE); | 44 | munmap(dev_fb, FRAMEBUFFER_SIZE); |
43 | close(dev_fd); | 45 | close(dev_fd); |
44 | } | 46 | } |
47 | #endif | ||
45 | 48 | ||
46 | void lcd_init_device(void) | 49 | void lcd_init_device(void) |
47 | { | 50 | { |
@@ -69,7 +72,7 @@ void lcd_init_device(void) | |||
69 | exit(3); | 72 | exit(3); |
70 | } | 73 | } |
71 | 74 | ||
72 | vinfo.bits_per_pixel = 16; | 75 | vinfo.bits_per_pixel = LCD_DEPTH; |
73 | 76 | ||
74 | if (ioctl(dev_fd, FBIOPUT_VSCREENINFO, &vinfo)) { | 77 | if (ioctl(dev_fd, FBIOPUT_VSCREENINFO, &vinfo)) { |
75 | perror("fbset(ioctl)"); | 78 | perror("fbset(ioctl)"); |
@@ -80,8 +83,7 @@ void lcd_init_device(void) | |||
80 | 83 | ||
81 | /* Figure out the size of the screen in bytes */ | 84 | /* Figure out the size of the screen in bytes */ |
82 | screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8; | 85 | screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8; |
83 | if (screensize != FRAMEBUFFER_SIZE) | 86 | if (screensize != FRAMEBUFFER_SIZE) { |
84 | { | ||
85 | exit(4); | 87 | exit(4); |
86 | perror("Display and framebuffer mismatch!\n"); | 88 | perror("Display and framebuffer mismatch!\n"); |
87 | } | 89 | } |
@@ -93,4 +95,26 @@ void lcd_init_device(void) | |||
93 | exit(4); | 95 | exit(4); |
94 | } | 96 | } |
95 | printf("The framebuffer device was mapped to memory successfully.\n"); | 97 | printf("The framebuffer device was mapped to memory successfully.\n"); |
98 | |||
99 | /* Be sure to turn on display at startup */ | ||
100 | ioctl(dev_fd, FBIOBLANK, VESA_NO_BLANKING); | ||
101 | #ifdef HAVE_LCD_ENABLE | ||
102 | lcd_set_active(true); | ||
103 | #endif | ||
104 | } | ||
105 | |||
106 | #ifdef HAVE_LCD_ENABLE | ||
107 | void lcd_enable(bool enable) | ||
108 | { | ||
109 | if (lcd_active() == enable) | ||
110 | return; | ||
111 | |||
112 | lcd_set_active(enable); | ||
113 | |||
114 | /* Turn on or off the display using Linux interface */ | ||
115 | ioctl(dev_fd, FBIOBLANK, enable ? VESA_NO_BLANKING : VESA_POWERDOWN); | ||
116 | |||
117 | if (enable) | ||
118 | send_event(LCD_EVENT_ACTIVATION, NULL); | ||
96 | } | 119 | } |
120 | #endif \ No newline at end of file | ||