This source file includes following definitions.
- picolcd_debug_out_report
- picolcd_debug_raw_event
- picolcd_init_devfs
- picolcd_exit_devfs
- picolcd_fb_reset
- picolcd_init_framebuffer
- picolcd_exit_framebuffer
- picolcd_fb_refresh
- picolcd_init_backlight
- picolcd_exit_backlight
- picolcd_resume_backlight
- picolcd_suspend_backlight
- picolcd_init_lcd
- picolcd_exit_lcd
- picolcd_resume_lcd
- picolcd_init_leds
- picolcd_exit_leds
- picolcd_leds_set
- picolcd_raw_cir
- picolcd_init_cir
- picolcd_exit_cir
1
2
3
4
5
6
7
8
9
10 #define PICOLCD_NAME "PicoLCD (graphic)"
11
12
13 #define REPORT_ERROR_CODE 0x10
14 #define ERR_SUCCESS 0x00
15 #define ERR_PARAMETER_MISSING 0x01
16 #define ERR_DATA_MISSING 0x02
17 #define ERR_BLOCK_READ_ONLY 0x03
18 #define ERR_BLOCK_NOT_ERASABLE 0x04
19 #define ERR_BLOCK_TOO_BIG 0x05
20 #define ERR_SECTION_OVERFLOW 0x06
21 #define ERR_INVALID_CMD_LEN 0x07
22 #define ERR_INVALID_DATA_LEN 0x08
23 #define REPORT_KEY_STATE 0x11
24 #define REPORT_IR_DATA 0x21
25 #define REPORT_EE_DATA 0x32
26 #define REPORT_MEMORY 0x41
27 #define REPORT_LED_STATE 0x81
28 #define REPORT_BRIGHTNESS 0x91
29 #define REPORT_CONTRAST 0x92
30 #define REPORT_RESET 0x93
31 #define REPORT_LCD_CMD 0x94
32 #define REPORT_LCD_DATA 0x95
33 #define REPORT_LCD_CMD_DATA 0x96
34 #define REPORT_EE_READ 0xa3
35 #define REPORT_EE_WRITE 0xa4
36 #define REPORT_ERASE_MEMORY 0xb2
37 #define REPORT_READ_MEMORY 0xb3
38 #define REPORT_WRITE_MEMORY 0xb4
39 #define REPORT_SPLASH_RESTART 0xc1
40 #define REPORT_EXIT_KEYBOARD 0xef
41 #define REPORT_VERSION 0xf1
42 #define REPORT_BL_ERASE_MEMORY 0xf2
43 #define REPORT_BL_READ_MEMORY 0xf3
44 #define REPORT_BL_WRITE_MEMORY 0xf4
45 #define REPORT_DEVID 0xf5
46 #define REPORT_SPLASH_SIZE 0xf6
47 #define REPORT_HOOK_VERSION 0xf7
48 #define REPORT_EXIT_FLASHER 0xff
49
50
51
52 struct picolcd_pending {
53 struct hid_report *out_report;
54 struct hid_report *in_report;
55 struct completion ready;
56 int raw_size;
57 u8 raw_data[64];
58 };
59
60
61 #define PICOLCD_KEYS 17
62
63
64 struct picolcd_data {
65 struct hid_device *hdev;
66 #ifdef CONFIG_DEBUG_FS
67 struct dentry *debug_reset;
68 struct dentry *debug_eeprom;
69 struct dentry *debug_flash;
70 struct mutex mutex_flash;
71 int addr_sz;
72 #endif
73 u8 version[2];
74 unsigned short opmode_delay;
75
76 u8 pressed_keys[2];
77 struct input_dev *input_keys;
78 #ifdef CONFIG_HID_PICOLCD_CIR
79 struct rc_dev *rc_dev;
80 #endif
81 unsigned short keycode[PICOLCD_KEYS];
82
83 #ifdef CONFIG_HID_PICOLCD_FB
84
85 struct fb_info *fb_info;
86 #endif
87 #ifdef CONFIG_HID_PICOLCD_LCD
88 struct lcd_device *lcd;
89 u8 lcd_contrast;
90 #endif
91 #ifdef CONFIG_HID_PICOLCD_BACKLIGHT
92 struct backlight_device *backlight;
93 u8 lcd_brightness;
94 u8 lcd_power;
95 #endif
96 #ifdef CONFIG_HID_PICOLCD_LEDS
97
98 u8 led_state;
99 struct led_classdev *led[8];
100 #endif
101
102
103 spinlock_t lock;
104 struct mutex mutex;
105 struct picolcd_pending *pending;
106 int status;
107 #define PICOLCD_BOOTLOADER 1
108 #define PICOLCD_FAILED 2
109 #define PICOLCD_CIR_SHUN 4
110 };
111
112 #ifdef CONFIG_HID_PICOLCD_FB
113 struct picolcd_fb_data {
114
115 spinlock_t lock;
116 struct picolcd_data *picolcd;
117 u8 update_rate;
118 u8 bpp;
119 u8 force;
120 u8 ready;
121 u8 *vbitmap;
122 u8 *bitmap;
123 };
124 #endif
125
126
127 #define picolcd_in_report(id, dev) picolcd_report(id, dev, HID_INPUT_REPORT)
128 #define picolcd_out_report(id, dev) picolcd_report(id, dev, HID_OUTPUT_REPORT)
129
130 struct hid_report *picolcd_report(int id, struct hid_device *hdev, int dir);
131
132 #ifdef CONFIG_DEBUG_FS
133 void picolcd_debug_out_report(struct picolcd_data *data,
134 struct hid_device *hdev, struct hid_report *report);
135 #define hid_hw_request(a, b, c) \
136 do { \
137 picolcd_debug_out_report(hid_get_drvdata(a), a, b); \
138 hid_hw_request(a, b, c); \
139 } while (0)
140
141 void picolcd_debug_raw_event(struct picolcd_data *data,
142 struct hid_device *hdev, struct hid_report *report,
143 u8 *raw_data, int size);
144
145 void picolcd_init_devfs(struct picolcd_data *data,
146 struct hid_report *eeprom_r, struct hid_report *eeprom_w,
147 struct hid_report *flash_r, struct hid_report *flash_w,
148 struct hid_report *reset);
149
150 void picolcd_exit_devfs(struct picolcd_data *data);
151 #else
152 static inline void picolcd_debug_out_report(struct picolcd_data *data,
153 struct hid_device *hdev, struct hid_report *report)
154 {
155 }
156 static inline void picolcd_debug_raw_event(struct picolcd_data *data,
157 struct hid_device *hdev, struct hid_report *report,
158 u8 *raw_data, int size)
159 {
160 }
161 static inline void picolcd_init_devfs(struct picolcd_data *data,
162 struct hid_report *eeprom_r, struct hid_report *eeprom_w,
163 struct hid_report *flash_r, struct hid_report *flash_w,
164 struct hid_report *reset)
165 {
166 }
167 static inline void picolcd_exit_devfs(struct picolcd_data *data)
168 {
169 }
170 #endif
171
172
173 #ifdef CONFIG_HID_PICOLCD_FB
174 int picolcd_fb_reset(struct picolcd_data *data, int clear);
175
176 int picolcd_init_framebuffer(struct picolcd_data *data);
177
178 void picolcd_exit_framebuffer(struct picolcd_data *data);
179
180 void picolcd_fb_refresh(struct picolcd_data *data);
181 #define picolcd_fbinfo(d) ((d)->fb_info)
182 #else
183 static inline int picolcd_fb_reset(struct picolcd_data *data, int clear)
184 {
185 return 0;
186 }
187 static inline int picolcd_init_framebuffer(struct picolcd_data *data)
188 {
189 return 0;
190 }
191 static inline void picolcd_exit_framebuffer(struct picolcd_data *data)
192 {
193 }
194 static inline void picolcd_fb_refresh(struct picolcd_data *data)
195 {
196 }
197 #define picolcd_fbinfo(d) NULL
198 #endif
199
200
201 #ifdef CONFIG_HID_PICOLCD_BACKLIGHT
202 int picolcd_init_backlight(struct picolcd_data *data,
203 struct hid_report *report);
204
205 void picolcd_exit_backlight(struct picolcd_data *data);
206
207 int picolcd_resume_backlight(struct picolcd_data *data);
208
209 void picolcd_suspend_backlight(struct picolcd_data *data);
210 #else
211 static inline int picolcd_init_backlight(struct picolcd_data *data,
212 struct hid_report *report)
213 {
214 return 0;
215 }
216 static inline void picolcd_exit_backlight(struct picolcd_data *data)
217 {
218 }
219 static inline int picolcd_resume_backlight(struct picolcd_data *data)
220 {
221 return 0;
222 }
223 static inline void picolcd_suspend_backlight(struct picolcd_data *data)
224 {
225 }
226
227 #endif
228
229
230 #ifdef CONFIG_HID_PICOLCD_LCD
231 int picolcd_init_lcd(struct picolcd_data *data,
232 struct hid_report *report);
233
234 void picolcd_exit_lcd(struct picolcd_data *data);
235
236 int picolcd_resume_lcd(struct picolcd_data *data);
237 #else
238 static inline int picolcd_init_lcd(struct picolcd_data *data,
239 struct hid_report *report)
240 {
241 return 0;
242 }
243 static inline void picolcd_exit_lcd(struct picolcd_data *data)
244 {
245 }
246 static inline int picolcd_resume_lcd(struct picolcd_data *data)
247 {
248 return 0;
249 }
250 #endif
251
252
253 #ifdef CONFIG_HID_PICOLCD_LEDS
254 int picolcd_init_leds(struct picolcd_data *data,
255 struct hid_report *report);
256
257 void picolcd_exit_leds(struct picolcd_data *data);
258
259 void picolcd_leds_set(struct picolcd_data *data);
260 #else
261 static inline int picolcd_init_leds(struct picolcd_data *data,
262 struct hid_report *report)
263 {
264 return 0;
265 }
266 static inline void picolcd_exit_leds(struct picolcd_data *data)
267 {
268 }
269 static inline void picolcd_leds_set(struct picolcd_data *data)
270 {
271 }
272 #endif
273
274
275 #ifdef CONFIG_HID_PICOLCD_CIR
276 int picolcd_raw_cir(struct picolcd_data *data,
277 struct hid_report *report, u8 *raw_data, int size);
278
279 int picolcd_init_cir(struct picolcd_data *data, struct hid_report *report);
280
281 void picolcd_exit_cir(struct picolcd_data *data);
282 #else
283 static inline int picolcd_raw_cir(struct picolcd_data *data,
284 struct hid_report *report, u8 *raw_data, int size)
285 {
286 return 1;
287 }
288 static inline int picolcd_init_cir(struct picolcd_data *data, struct hid_report *report)
289 {
290 return 0;
291 }
292 static inline void picolcd_exit_cir(struct picolcd_data *data)
293 {
294 }
295 #endif
296
297 int picolcd_reset(struct hid_device *hdev);
298 struct picolcd_pending *picolcd_send_and_wait(struct hid_device *hdev,
299 int report_id, const u8 *raw_data, int size);