]>
Commit | Line | Data |
---|---|---|
2d70b73a GKH |
1 | /* |
2 | * Samsung Laptop driver | |
3 | * | |
4 | * Copyright (C) 2009,2011 Greg Kroah-Hartman (gregkh@suse.de) | |
5 | * Copyright (C) 2009,2011 Novell Inc. | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify it | |
8 | * under the terms of the GNU General Public License version 2 as published by | |
9 | * the Free Software Foundation. | |
10 | * | |
11 | */ | |
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | |
13 | ||
14 | #include <linux/kernel.h> | |
15 | #include <linux/init.h> | |
16 | #include <linux/module.h> | |
17 | #include <linux/delay.h> | |
18 | #include <linux/pci.h> | |
19 | #include <linux/backlight.h> | |
f674ebf1 | 20 | #include <linux/leds.h> |
2d70b73a GKH |
21 | #include <linux/fb.h> |
22 | #include <linux/dmi.h> | |
23 | #include <linux/platform_device.h> | |
24 | #include <linux/rfkill.h> | |
f34cd9ca | 25 | #include <linux/acpi.h> |
5b80fc40 CC |
26 | #include <linux/seq_file.h> |
27 | #include <linux/debugfs.h> | |
82c333aa | 28 | #include <linux/ctype.h> |
a60b2176 | 29 | #ifdef CONFIG_ACPI_VIDEO |
a979e2e2 CC |
30 | #include <acpi/video.h> |
31 | #endif | |
2d70b73a GKH |
32 | |
33 | /* | |
34 | * This driver is needed because a number of Samsung laptops do not hook | |
35 | * their control settings through ACPI. So we have to poke around in the | |
36 | * BIOS to do things like brightness values, and "special" key controls. | |
37 | */ | |
38 | ||
39 | /* | |
40 | * We have 0 - 8 as valid brightness levels. The specs say that level 0 should | |
41 | * be reserved by the BIOS (which really doesn't make much sense), we tell | |
42 | * userspace that the value is 0 - 7 and then just tell the hardware 1 - 8 | |
43 | */ | |
44 | #define MAX_BRIGHT 0x07 | |
45 | ||
46 | ||
47 | #define SABI_IFACE_MAIN 0x00 | |
48 | #define SABI_IFACE_SUB 0x02 | |
49 | #define SABI_IFACE_COMPLETE 0x04 | |
50 | #define SABI_IFACE_DATA 0x05 | |
51 | ||
84d482f2 CC |
52 | #define WL_STATUS_WLAN 0x0 |
53 | #define WL_STATUS_BT 0x2 | |
54 | ||
7e960711 CC |
55 | /* Structure get/set data using sabi */ |
56 | struct sabi_data { | |
57 | union { | |
58 | struct { | |
59 | u32 d0; | |
60 | u32 d1; | |
61 | u16 d2; | |
62 | u8 d3; | |
63 | }; | |
64 | u8 data[11]; | |
65 | }; | |
2d70b73a GKH |
66 | }; |
67 | ||
68 | struct sabi_header_offsets { | |
69 | u8 port; | |
70 | u8 re_mem; | |
71 | u8 iface_func; | |
72 | u8 en_mem; | |
73 | u8 data_offset; | |
74 | u8 data_segment; | |
75 | }; | |
76 | ||
77 | struct sabi_commands { | |
78 | /* | |
79 | * Brightness is 0 - 8, as described above. | |
80 | * Value 0 is for the BIOS to use | |
81 | */ | |
7e960711 CC |
82 | u16 get_brightness; |
83 | u16 set_brightness; | |
2d70b73a GKH |
84 | |
85 | /* | |
86 | * first byte: | |
87 | * 0x00 - wireless is off | |
88 | * 0x01 - wireless is on | |
89 | * second byte: | |
90 | * 0x02 - 3G is off | |
91 | * 0x03 - 3G is on | |
92 | * TODO, verify 3G is correct, that doesn't seem right... | |
93 | */ | |
7e960711 CC |
94 | u16 get_wireless_button; |
95 | u16 set_wireless_button; | |
2d70b73a GKH |
96 | |
97 | /* 0 is off, 1 is on */ | |
7e960711 CC |
98 | u16 get_backlight; |
99 | u16 set_backlight; | |
2d70b73a GKH |
100 | |
101 | /* | |
102 | * 0x80 or 0x00 - no action | |
103 | * 0x81 - recovery key pressed | |
104 | */ | |
7e960711 CC |
105 | u16 get_recovery_mode; |
106 | u16 set_recovery_mode; | |
2d70b73a GKH |
107 | |
108 | /* | |
109 | * on seclinux: 0 is low, 1 is high, | |
110 | * on swsmi: 0 is normal, 1 is silent, 2 is turbo | |
111 | */ | |
7e960711 CC |
112 | u16 get_performance_level; |
113 | u16 set_performance_level; | |
2d70b73a | 114 | |
cb5b5c91 CC |
115 | /* 0x80 is off, 0x81 is on */ |
116 | u16 get_battery_life_extender; | |
117 | u16 set_battery_life_extender; | |
118 | ||
3a75d378 CC |
119 | /* 0x80 is off, 0x81 is on */ |
120 | u16 get_usb_charge; | |
121 | u16 set_usb_charge; | |
122 | ||
84d482f2 CC |
123 | /* the first byte is for bluetooth and the third one is for wlan */ |
124 | u16 get_wireless_status; | |
125 | u16 set_wireless_status; | |
126 | ||
f674ebf1 CC |
127 | /* 0x81 to read, (0x82 | level << 8) to set, 0xaabb to enable */ |
128 | u16 kbd_backlight; | |
129 | ||
2d70b73a GKH |
130 | /* |
131 | * Tell the BIOS that Linux is running on this machine. | |
132 | * 81 is on, 80 is off | |
133 | */ | |
7e960711 | 134 | u16 set_linux; |
2d70b73a GKH |
135 | }; |
136 | ||
137 | struct sabi_performance_level { | |
138 | const char *name; | |
7e960711 | 139 | u16 value; |
2d70b73a GKH |
140 | }; |
141 | ||
142 | struct sabi_config { | |
84d482f2 | 143 | int sabi_version; |
2d70b73a GKH |
144 | const char *test_string; |
145 | u16 main_function; | |
146 | const struct sabi_header_offsets header_offsets; | |
147 | const struct sabi_commands commands; | |
148 | const struct sabi_performance_level performance_levels[4]; | |
149 | u8 min_brightness; | |
150 | u8 max_brightness; | |
151 | }; | |
152 | ||
153 | static const struct sabi_config sabi_configs[] = { | |
154 | { | |
84d482f2 CC |
155 | /* I don't know if it is really 2, but it it is |
156 | * less than 3 anyway */ | |
157 | .sabi_version = 2, | |
158 | ||
2d70b73a GKH |
159 | .test_string = "SECLINUX", |
160 | ||
161 | .main_function = 0x4c49, | |
162 | ||
163 | .header_offsets = { | |
164 | .port = 0x00, | |
165 | .re_mem = 0x02, | |
166 | .iface_func = 0x03, | |
167 | .en_mem = 0x04, | |
168 | .data_offset = 0x05, | |
169 | .data_segment = 0x07, | |
170 | }, | |
171 | ||
172 | .commands = { | |
173 | .get_brightness = 0x00, | |
174 | .set_brightness = 0x01, | |
175 | ||
176 | .get_wireless_button = 0x02, | |
177 | .set_wireless_button = 0x03, | |
178 | ||
179 | .get_backlight = 0x04, | |
180 | .set_backlight = 0x05, | |
181 | ||
182 | .get_recovery_mode = 0x06, | |
183 | .set_recovery_mode = 0x07, | |
184 | ||
185 | .get_performance_level = 0x08, | |
186 | .set_performance_level = 0x09, | |
187 | ||
cb5b5c91 CC |
188 | .get_battery_life_extender = 0xFFFF, |
189 | .set_battery_life_extender = 0xFFFF, | |
190 | ||
3a75d378 CC |
191 | .get_usb_charge = 0xFFFF, |
192 | .set_usb_charge = 0xFFFF, | |
193 | ||
84d482f2 CC |
194 | .get_wireless_status = 0xFFFF, |
195 | .set_wireless_status = 0xFFFF, | |
196 | ||
f674ebf1 CC |
197 | .kbd_backlight = 0xFFFF, |
198 | ||
2d70b73a GKH |
199 | .set_linux = 0x0a, |
200 | }, | |
201 | ||
202 | .performance_levels = { | |
203 | { | |
204 | .name = "silent", | |
205 | .value = 0, | |
206 | }, | |
207 | { | |
208 | .name = "normal", | |
209 | .value = 1, | |
210 | }, | |
211 | { }, | |
212 | }, | |
213 | .min_brightness = 1, | |
214 | .max_brightness = 8, | |
215 | }, | |
216 | { | |
84d482f2 CC |
217 | .sabi_version = 3, |
218 | ||
2d70b73a GKH |
219 | .test_string = "SwSmi@", |
220 | ||
221 | .main_function = 0x5843, | |
222 | ||
223 | .header_offsets = { | |
224 | .port = 0x00, | |
225 | .re_mem = 0x04, | |
226 | .iface_func = 0x02, | |
227 | .en_mem = 0x03, | |
228 | .data_offset = 0x05, | |
229 | .data_segment = 0x07, | |
230 | }, | |
231 | ||
232 | .commands = { | |
233 | .get_brightness = 0x10, | |
234 | .set_brightness = 0x11, | |
235 | ||
236 | .get_wireless_button = 0x12, | |
237 | .set_wireless_button = 0x13, | |
238 | ||
239 | .get_backlight = 0x2d, | |
240 | .set_backlight = 0x2e, | |
241 | ||
242 | .get_recovery_mode = 0xff, | |
243 | .set_recovery_mode = 0xff, | |
244 | ||
245 | .get_performance_level = 0x31, | |
246 | .set_performance_level = 0x32, | |
247 | ||
cb5b5c91 CC |
248 | .get_battery_life_extender = 0x65, |
249 | .set_battery_life_extender = 0x66, | |
250 | ||
3a75d378 CC |
251 | .get_usb_charge = 0x67, |
252 | .set_usb_charge = 0x68, | |
253 | ||
84d482f2 CC |
254 | .get_wireless_status = 0x69, |
255 | .set_wireless_status = 0x6a, | |
256 | ||
f674ebf1 CC |
257 | .kbd_backlight = 0x78, |
258 | ||
2d70b73a GKH |
259 | .set_linux = 0xff, |
260 | }, | |
261 | ||
262 | .performance_levels = { | |
263 | { | |
264 | .name = "normal", | |
265 | .value = 0, | |
266 | }, | |
267 | { | |
268 | .name = "silent", | |
269 | .value = 1, | |
270 | }, | |
271 | { | |
272 | .name = "overclock", | |
273 | .value = 2, | |
274 | }, | |
275 | { }, | |
276 | }, | |
277 | .min_brightness = 0, | |
278 | .max_brightness = 8, | |
279 | }, | |
280 | { }, | |
281 | }; | |
282 | ||
5b80fc40 CC |
283 | /* |
284 | * samsung-laptop/ - debugfs root directory | |
285 | * f0000_segment - dump f0000 segment | |
286 | * command - current command | |
287 | * data - current data | |
288 | * d0, d1, d2, d3 - data fields | |
289 | * call - call SABI using command and data | |
290 | * | |
291 | * This allow to call arbitrary sabi commands wihout | |
292 | * modifying the driver at all. | |
293 | * For example, setting the keyboard backlight brightness to 5 | |
294 | * | |
295 | * echo 0x78 > command | |
296 | * echo 0x0582 > d0 | |
297 | * echo 0 > d1 | |
298 | * echo 0 > d2 | |
299 | * echo 0 > d3 | |
300 | * cat call | |
301 | */ | |
302 | ||
303 | struct samsung_laptop_debug { | |
304 | struct dentry *root; | |
305 | struct sabi_data data; | |
306 | u16 command; | |
307 | ||
308 | struct debugfs_blob_wrapper f0000_wrapper; | |
309 | struct debugfs_blob_wrapper data_wrapper; | |
6f6ae06e | 310 | struct debugfs_blob_wrapper sdiag_wrapper; |
5b80fc40 CC |
311 | }; |
312 | ||
84d482f2 CC |
313 | struct samsung_laptop; |
314 | ||
315 | struct samsung_rfkill { | |
316 | struct samsung_laptop *samsung; | |
317 | struct rfkill *rfkill; | |
318 | enum rfkill_type type; | |
319 | }; | |
320 | ||
a6df4894 CC |
321 | struct samsung_laptop { |
322 | const struct sabi_config *config; | |
2d70b73a | 323 | |
a6df4894 CC |
324 | void __iomem *sabi; |
325 | void __iomem *sabi_iface; | |
326 | void __iomem *f0000_segment; | |
327 | ||
328 | struct mutex sabi_mutex; | |
329 | ||
5dea7a20 | 330 | struct platform_device *platform_device; |
a6df4894 | 331 | struct backlight_device *backlight_device; |
84d482f2 CC |
332 | |
333 | struct samsung_rfkill wlan; | |
334 | struct samsung_rfkill bluetooth; | |
a6df4894 | 335 | |
f674ebf1 CC |
336 | struct led_classdev kbd_led; |
337 | int kbd_led_wk; | |
338 | struct workqueue_struct *led_workqueue; | |
339 | struct work_struct kbd_led_work; | |
340 | ||
5b80fc40 | 341 | struct samsung_laptop_debug debug; |
a979e2e2 | 342 | struct samsung_quirks *quirks; |
5b80fc40 | 343 | |
f34cd9ca | 344 | bool handle_backlight; |
a6df4894 | 345 | bool has_stepping_quirk; |
6f6ae06e CC |
346 | |
347 | char sdiag[64]; | |
a6df4894 CC |
348 | }; |
349 | ||
a979e2e2 CC |
350 | struct samsung_quirks { |
351 | bool broken_acpi_video; | |
352 | }; | |
353 | ||
354 | static struct samsung_quirks samsung_unknown = {}; | |
5dea7a20 | 355 | |
a979e2e2 CC |
356 | static struct samsung_quirks samsung_broken_acpi_video = { |
357 | .broken_acpi_video = true, | |
358 | }; | |
2d70b73a | 359 | |
90ab5ee9 | 360 | static bool force; |
2d70b73a GKH |
361 | module_param(force, bool, 0); |
362 | MODULE_PARM_DESC(force, | |
363 | "Disable the DMI check and forces the driver to be loaded"); | |
364 | ||
90ab5ee9 | 365 | static bool debug; |
2d70b73a GKH |
366 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
367 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | |
368 | ||
7e960711 CC |
369 | static int sabi_command(struct samsung_laptop *samsung, u16 command, |
370 | struct sabi_data *in, | |
371 | struct sabi_data *out) | |
2d70b73a | 372 | { |
a6df4894 | 373 | const struct sabi_config *config = samsung->config; |
7e960711 | 374 | int ret = 0; |
a6df4894 | 375 | u16 port = readw(samsung->sabi + config->header_offsets.port); |
2d70b73a GKH |
376 | u8 complete, iface_data; |
377 | ||
a6df4894 | 378 | mutex_lock(&samsung->sabi_mutex); |
2d70b73a | 379 | |
7e960711 CC |
380 | if (debug) { |
381 | if (in) | |
2e777187 CC |
382 | pr_info("SABI command:0x%04x " |
383 | "data:{0x%08x, 0x%08x, 0x%04x, 0x%02x}", | |
7e960711 CC |
384 | command, in->d0, in->d1, in->d2, in->d3); |
385 | else | |
2e777187 | 386 | pr_info("SABI command:0x%04x", command); |
7e960711 CC |
387 | } |
388 | ||
2d70b73a | 389 | /* enable memory to be able to write to it */ |
a6df4894 | 390 | outb(readb(samsung->sabi + config->header_offsets.en_mem), port); |
2d70b73a GKH |
391 | |
392 | /* write out the command */ | |
a6df4894 CC |
393 | writew(config->main_function, samsung->sabi_iface + SABI_IFACE_MAIN); |
394 | writew(command, samsung->sabi_iface + SABI_IFACE_SUB); | |
395 | writeb(0, samsung->sabi_iface + SABI_IFACE_COMPLETE); | |
7e960711 CC |
396 | if (in) { |
397 | writel(in->d0, samsung->sabi_iface + SABI_IFACE_DATA); | |
398 | writel(in->d1, samsung->sabi_iface + SABI_IFACE_DATA + 4); | |
399 | writew(in->d2, samsung->sabi_iface + SABI_IFACE_DATA + 8); | |
400 | writeb(in->d3, samsung->sabi_iface + SABI_IFACE_DATA + 10); | |
401 | } | |
a6df4894 | 402 | outb(readb(samsung->sabi + config->header_offsets.iface_func), port); |
2d70b73a GKH |
403 | |
404 | /* write protect memory to make it safe */ | |
a6df4894 | 405 | outb(readb(samsung->sabi + config->header_offsets.re_mem), port); |
2d70b73a GKH |
406 | |
407 | /* see if the command actually succeeded */ | |
a6df4894 CC |
408 | complete = readb(samsung->sabi_iface + SABI_IFACE_COMPLETE); |
409 | iface_data = readb(samsung->sabi_iface + SABI_IFACE_DATA); | |
2e777187 CC |
410 | |
411 | /* iface_data = 0xFF happens when a command is not known | |
412 | * so we only add a warning in debug mode since we will | |
413 | * probably issue some unknown command at startup to find | |
414 | * out which features are supported */ | |
415 | if (complete != 0xaa || (iface_data == 0xff && debug)) | |
7e960711 CC |
416 | pr_warn("SABI command 0x%04x failed with" |
417 | " completion flag 0x%02x and interface data 0x%02x", | |
418 | command, complete, iface_data); | |
2e777187 CC |
419 | |
420 | if (complete != 0xaa || iface_data == 0xff) { | |
7e960711 | 421 | ret = -EINVAL; |
2d70b73a GKH |
422 | goto exit; |
423 | } | |
7e960711 CC |
424 | |
425 | if (out) { | |
426 | out->d0 = readl(samsung->sabi_iface + SABI_IFACE_DATA); | |
427 | out->d1 = readl(samsung->sabi_iface + SABI_IFACE_DATA + 4); | |
428 | out->d2 = readw(samsung->sabi_iface + SABI_IFACE_DATA + 2); | |
429 | out->d3 = readb(samsung->sabi_iface + SABI_IFACE_DATA + 1); | |
430 | } | |
431 | ||
432 | if (debug && out) { | |
2e777187 | 433 | pr_info("SABI return data:{0x%08x, 0x%08x, 0x%04x, 0x%02x}", |
7e960711 CC |
434 | out->d0, out->d1, out->d2, out->d3); |
435 | } | |
2d70b73a GKH |
436 | |
437 | exit: | |
a6df4894 | 438 | mutex_unlock(&samsung->sabi_mutex); |
7e960711 | 439 | return ret; |
2d70b73a GKH |
440 | } |
441 | ||
7e960711 CC |
442 | /* simple wrappers usable with most commands */ |
443 | static int sabi_set_commandb(struct samsung_laptop *samsung, | |
444 | u16 command, u8 data) | |
2d70b73a | 445 | { |
85229440 | 446 | struct sabi_data in = { { { .d0 = 0, .d1 = 0, .d2 = 0, .d3 = 0 } } }; |
2d70b73a | 447 | |
7e960711 CC |
448 | in.data[0] = data; |
449 | return sabi_command(samsung, command, &in, NULL); | |
2d70b73a GKH |
450 | } |
451 | ||
5dea7a20 | 452 | static int read_brightness(struct samsung_laptop *samsung) |
2d70b73a | 453 | { |
a6df4894 CC |
454 | const struct sabi_config *config = samsung->config; |
455 | const struct sabi_commands *commands = &samsung->config->commands; | |
7e960711 | 456 | struct sabi_data sretval; |
2d70b73a GKH |
457 | int user_brightness = 0; |
458 | int retval; | |
459 | ||
7e960711 CC |
460 | retval = sabi_command(samsung, commands->get_brightness, |
461 | NULL, &sretval); | |
462 | if (retval) | |
463 | return retval; | |
464 | ||
465 | user_brightness = sretval.data[0]; | |
466 | if (user_brightness > config->min_brightness) | |
467 | user_brightness -= config->min_brightness; | |
468 | else | |
469 | user_brightness = 0; | |
470 | ||
2d70b73a GKH |
471 | return user_brightness; |
472 | } | |
473 | ||
5dea7a20 | 474 | static void set_brightness(struct samsung_laptop *samsung, u8 user_brightness) |
2d70b73a | 475 | { |
a6df4894 CC |
476 | const struct sabi_config *config = samsung->config; |
477 | const struct sabi_commands *commands = &samsung->config->commands; | |
478 | u8 user_level = user_brightness + config->min_brightness; | |
2d70b73a | 479 | |
a6df4894 | 480 | if (samsung->has_stepping_quirk && user_level != 0) { |
ac080523 JS |
481 | /* |
482 | * short circuit if the specified level is what's already set | |
483 | * to prevent the screen from flickering needlessly | |
484 | */ | |
5dea7a20 | 485 | if (user_brightness == read_brightness(samsung)) |
ac080523 JS |
486 | return; |
487 | ||
7e960711 | 488 | sabi_set_commandb(samsung, commands->set_brightness, 0); |
ac080523 JS |
489 | } |
490 | ||
7e960711 | 491 | sabi_set_commandb(samsung, commands->set_brightness, user_level); |
2d70b73a GKH |
492 | } |
493 | ||
494 | static int get_brightness(struct backlight_device *bd) | |
495 | { | |
5dea7a20 CC |
496 | struct samsung_laptop *samsung = bl_get_data(bd); |
497 | ||
498 | return read_brightness(samsung); | |
2d70b73a GKH |
499 | } |
500 | ||
5dea7a20 | 501 | static void check_for_stepping_quirk(struct samsung_laptop *samsung) |
ac080523 | 502 | { |
5dea7a20 CC |
503 | int initial_level; |
504 | int check_level; | |
505 | int orig_level = read_brightness(samsung); | |
ac080523 JS |
506 | |
507 | /* | |
508 | * Some laptops exhibit the strange behaviour of stepping toward | |
509 | * (rather than setting) the brightness except when changing to/from | |
510 | * brightness level 0. This behaviour is checked for here and worked | |
511 | * around in set_brightness. | |
512 | */ | |
513 | ||
ba05b237 | 514 | if (orig_level == 0) |
5dea7a20 | 515 | set_brightness(samsung, 1); |
ba05b237 | 516 | |
5dea7a20 | 517 | initial_level = read_brightness(samsung); |
ba05b237 | 518 | |
ac080523 JS |
519 | if (initial_level <= 2) |
520 | check_level = initial_level + 2; | |
521 | else | |
522 | check_level = initial_level - 2; | |
523 | ||
a6df4894 | 524 | samsung->has_stepping_quirk = false; |
5dea7a20 | 525 | set_brightness(samsung, check_level); |
ac080523 | 526 | |
5dea7a20 | 527 | if (read_brightness(samsung) != check_level) { |
a6df4894 | 528 | samsung->has_stepping_quirk = true; |
ac080523 JS |
529 | pr_info("enabled workaround for brightness stepping quirk\n"); |
530 | } | |
531 | ||
5dea7a20 | 532 | set_brightness(samsung, orig_level); |
ac080523 JS |
533 | } |
534 | ||
2d70b73a GKH |
535 | static int update_status(struct backlight_device *bd) |
536 | { | |
5dea7a20 | 537 | struct samsung_laptop *samsung = bl_get_data(bd); |
a6df4894 CC |
538 | const struct sabi_commands *commands = &samsung->config->commands; |
539 | ||
5dea7a20 | 540 | set_brightness(samsung, bd->props.brightness); |
2d70b73a GKH |
541 | |
542 | if (bd->props.power == FB_BLANK_UNBLANK) | |
7e960711 | 543 | sabi_set_commandb(samsung, commands->set_backlight, 1); |
2d70b73a | 544 | else |
7e960711 | 545 | sabi_set_commandb(samsung, commands->set_backlight, 0); |
5dea7a20 | 546 | |
2d70b73a GKH |
547 | return 0; |
548 | } | |
549 | ||
550 | static const struct backlight_ops backlight_ops = { | |
551 | .get_brightness = get_brightness, | |
552 | .update_status = update_status, | |
553 | }; | |
554 | ||
84d482f2 | 555 | static int seclinux_rfkill_set(void *data, bool blocked) |
2d70b73a | 556 | { |
20db88e3 CC |
557 | struct samsung_rfkill *srfkill = data; |
558 | struct samsung_laptop *samsung = srfkill->samsung; | |
a6df4894 CC |
559 | const struct sabi_commands *commands = &samsung->config->commands; |
560 | ||
84d482f2 CC |
561 | return sabi_set_commandb(samsung, commands->set_wireless_button, |
562 | !blocked); | |
563 | } | |
564 | ||
565 | static struct rfkill_ops seclinux_rfkill_ops = { | |
566 | .set_block = seclinux_rfkill_set, | |
567 | }; | |
568 | ||
569 | static int swsmi_wireless_status(struct samsung_laptop *samsung, | |
570 | struct sabi_data *data) | |
571 | { | |
572 | const struct sabi_commands *commands = &samsung->config->commands; | |
573 | ||
574 | return sabi_command(samsung, commands->get_wireless_status, | |
575 | NULL, data); | |
576 | } | |
577 | ||
578 | static int swsmi_rfkill_set(void *priv, bool blocked) | |
579 | { | |
580 | struct samsung_rfkill *srfkill = priv; | |
581 | struct samsung_laptop *samsung = srfkill->samsung; | |
582 | const struct sabi_commands *commands = &samsung->config->commands; | |
583 | struct sabi_data data; | |
584 | int ret, i; | |
585 | ||
586 | ret = swsmi_wireless_status(samsung, &data); | |
587 | if (ret) | |
588 | return ret; | |
589 | ||
590 | /* Don't set the state for non-present devices */ | |
591 | for (i = 0; i < 4; i++) | |
592 | if (data.data[i] == 0x02) | |
593 | data.data[1] = 0; | |
594 | ||
595 | if (srfkill->type == RFKILL_TYPE_WLAN) | |
596 | data.data[WL_STATUS_WLAN] = !blocked; | |
597 | else if (srfkill->type == RFKILL_TYPE_BLUETOOTH) | |
598 | data.data[WL_STATUS_BT] = !blocked; | |
599 | ||
600 | return sabi_command(samsung, commands->set_wireless_status, | |
601 | &data, &data); | |
602 | } | |
603 | ||
604 | static void swsmi_rfkill_query(struct rfkill *rfkill, void *priv) | |
605 | { | |
606 | struct samsung_rfkill *srfkill = priv; | |
607 | struct samsung_laptop *samsung = srfkill->samsung; | |
608 | struct sabi_data data; | |
609 | int ret; | |
610 | ||
611 | ret = swsmi_wireless_status(samsung, &data); | |
612 | if (ret) | |
613 | return ; | |
614 | ||
615 | if (srfkill->type == RFKILL_TYPE_WLAN) | |
616 | ret = data.data[WL_STATUS_WLAN]; | |
617 | else if (srfkill->type == RFKILL_TYPE_BLUETOOTH) | |
618 | ret = data.data[WL_STATUS_BT]; | |
2d70b73a | 619 | else |
84d482f2 | 620 | return ; |
2d70b73a | 621 | |
84d482f2 | 622 | rfkill_set_sw_state(rfkill, !ret); |
2d70b73a GKH |
623 | } |
624 | ||
84d482f2 CC |
625 | static struct rfkill_ops swsmi_rfkill_ops = { |
626 | .set_block = swsmi_rfkill_set, | |
627 | .query = swsmi_rfkill_query, | |
2d70b73a GKH |
628 | }; |
629 | ||
2d70b73a GKH |
630 | static ssize_t get_performance_level(struct device *dev, |
631 | struct device_attribute *attr, char *buf) | |
632 | { | |
5dea7a20 | 633 | struct samsung_laptop *samsung = dev_get_drvdata(dev); |
a6df4894 | 634 | const struct sabi_config *config = samsung->config; |
5dea7a20 | 635 | const struct sabi_commands *commands = &config->commands; |
7e960711 | 636 | struct sabi_data sretval; |
2d70b73a GKH |
637 | int retval; |
638 | int i; | |
639 | ||
640 | /* Read the state */ | |
7e960711 CC |
641 | retval = sabi_command(samsung, commands->get_performance_level, |
642 | NULL, &sretval); | |
2d70b73a GKH |
643 | if (retval) |
644 | return retval; | |
645 | ||
646 | /* The logic is backwards, yeah, lots of fun... */ | |
a6df4894 | 647 | for (i = 0; config->performance_levels[i].name; ++i) { |
7e960711 | 648 | if (sretval.data[0] == config->performance_levels[i].value) |
a6df4894 | 649 | return sprintf(buf, "%s\n", config->performance_levels[i].name); |
2d70b73a GKH |
650 | } |
651 | return sprintf(buf, "%s\n", "unknown"); | |
652 | } | |
653 | ||
654 | static ssize_t set_performance_level(struct device *dev, | |
655 | struct device_attribute *attr, const char *buf, | |
656 | size_t count) | |
657 | { | |
5dea7a20 | 658 | struct samsung_laptop *samsung = dev_get_drvdata(dev); |
a6df4894 | 659 | const struct sabi_config *config = samsung->config; |
5dea7a20 CC |
660 | const struct sabi_commands *commands = &config->commands; |
661 | int i; | |
a6df4894 | 662 | |
5dea7a20 CC |
663 | if (count < 1) |
664 | return count; | |
665 | ||
666 | for (i = 0; config->performance_levels[i].name; ++i) { | |
667 | const struct sabi_performance_level *level = | |
668 | &config->performance_levels[i]; | |
669 | if (!strncasecmp(level->name, buf, strlen(level->name))) { | |
7e960711 CC |
670 | sabi_set_commandb(samsung, |
671 | commands->set_performance_level, | |
672 | level->value); | |
5dea7a20 | 673 | break; |
2d70b73a | 674 | } |
2d70b73a | 675 | } |
5dea7a20 CC |
676 | |
677 | if (!config->performance_levels[i].name) | |
678 | return -EINVAL; | |
679 | ||
2d70b73a GKH |
680 | return count; |
681 | } | |
5dea7a20 | 682 | |
2d70b73a GKH |
683 | static DEVICE_ATTR(performance_level, S_IWUSR | S_IRUGO, |
684 | get_performance_level, set_performance_level); | |
685 | ||
cb5b5c91 CC |
686 | static int read_battery_life_extender(struct samsung_laptop *samsung) |
687 | { | |
688 | const struct sabi_commands *commands = &samsung->config->commands; | |
689 | struct sabi_data data; | |
690 | int retval; | |
691 | ||
692 | if (commands->get_battery_life_extender == 0xFFFF) | |
693 | return -ENODEV; | |
694 | ||
695 | memset(&data, 0, sizeof(data)); | |
696 | data.data[0] = 0x80; | |
697 | retval = sabi_command(samsung, commands->get_battery_life_extender, | |
698 | &data, &data); | |
699 | ||
700 | if (retval) | |
701 | return retval; | |
702 | ||
703 | if (data.data[0] != 0 && data.data[0] != 1) | |
704 | return -ENODEV; | |
705 | ||
706 | return data.data[0]; | |
707 | } | |
708 | ||
709 | static int write_battery_life_extender(struct samsung_laptop *samsung, | |
710 | int enabled) | |
711 | { | |
712 | const struct sabi_commands *commands = &samsung->config->commands; | |
713 | struct sabi_data data; | |
714 | ||
715 | memset(&data, 0, sizeof(data)); | |
716 | data.data[0] = 0x80 | enabled; | |
717 | return sabi_command(samsung, commands->set_battery_life_extender, | |
718 | &data, NULL); | |
719 | } | |
720 | ||
721 | static ssize_t get_battery_life_extender(struct device *dev, | |
722 | struct device_attribute *attr, | |
723 | char *buf) | |
724 | { | |
725 | struct samsung_laptop *samsung = dev_get_drvdata(dev); | |
726 | int ret; | |
727 | ||
728 | ret = read_battery_life_extender(samsung); | |
729 | if (ret < 0) | |
730 | return ret; | |
731 | ||
732 | return sprintf(buf, "%d\n", ret); | |
733 | } | |
734 | ||
735 | static ssize_t set_battery_life_extender(struct device *dev, | |
736 | struct device_attribute *attr, | |
737 | const char *buf, size_t count) | |
738 | { | |
739 | struct samsung_laptop *samsung = dev_get_drvdata(dev); | |
740 | int ret, value; | |
741 | ||
742 | if (!count || sscanf(buf, "%i", &value) != 1) | |
743 | return -EINVAL; | |
744 | ||
745 | ret = write_battery_life_extender(samsung, !!value); | |
746 | if (ret < 0) | |
747 | return ret; | |
748 | ||
749 | return count; | |
750 | } | |
751 | ||
752 | static DEVICE_ATTR(battery_life_extender, S_IWUSR | S_IRUGO, | |
753 | get_battery_life_extender, set_battery_life_extender); | |
754 | ||
3a75d378 CC |
755 | static int read_usb_charge(struct samsung_laptop *samsung) |
756 | { | |
757 | const struct sabi_commands *commands = &samsung->config->commands; | |
758 | struct sabi_data data; | |
759 | int retval; | |
760 | ||
761 | if (commands->get_usb_charge == 0xFFFF) | |
762 | return -ENODEV; | |
763 | ||
764 | memset(&data, 0, sizeof(data)); | |
765 | data.data[0] = 0x80; | |
766 | retval = sabi_command(samsung, commands->get_usb_charge, | |
767 | &data, &data); | |
768 | ||
769 | if (retval) | |
770 | return retval; | |
771 | ||
772 | if (data.data[0] != 0 && data.data[0] != 1) | |
773 | return -ENODEV; | |
774 | ||
775 | return data.data[0]; | |
776 | } | |
777 | ||
778 | static int write_usb_charge(struct samsung_laptop *samsung, | |
779 | int enabled) | |
780 | { | |
781 | const struct sabi_commands *commands = &samsung->config->commands; | |
782 | struct sabi_data data; | |
783 | ||
784 | memset(&data, 0, sizeof(data)); | |
785 | data.data[0] = 0x80 | enabled; | |
786 | return sabi_command(samsung, commands->set_usb_charge, | |
787 | &data, NULL); | |
788 | } | |
789 | ||
790 | static ssize_t get_usb_charge(struct device *dev, | |
791 | struct device_attribute *attr, | |
792 | char *buf) | |
793 | { | |
794 | struct samsung_laptop *samsung = dev_get_drvdata(dev); | |
795 | int ret; | |
796 | ||
797 | ret = read_usb_charge(samsung); | |
798 | if (ret < 0) | |
799 | return ret; | |
800 | ||
801 | return sprintf(buf, "%d\n", ret); | |
802 | } | |
803 | ||
804 | static ssize_t set_usb_charge(struct device *dev, | |
805 | struct device_attribute *attr, | |
806 | const char *buf, size_t count) | |
807 | { | |
808 | struct samsung_laptop *samsung = dev_get_drvdata(dev); | |
809 | int ret, value; | |
810 | ||
811 | if (!count || sscanf(buf, "%i", &value) != 1) | |
812 | return -EINVAL; | |
813 | ||
814 | ret = write_usb_charge(samsung, !!value); | |
815 | if (ret < 0) | |
816 | return ret; | |
817 | ||
818 | return count; | |
819 | } | |
820 | ||
821 | static DEVICE_ATTR(usb_charge, S_IWUSR | S_IRUGO, | |
822 | get_usb_charge, set_usb_charge); | |
823 | ||
a66c1662 CC |
824 | static struct attribute *platform_attributes[] = { |
825 | &dev_attr_performance_level.attr, | |
cb5b5c91 | 826 | &dev_attr_battery_life_extender.attr, |
3a75d378 | 827 | &dev_attr_usb_charge.attr, |
a66c1662 CC |
828 | NULL |
829 | }; | |
2d70b73a | 830 | |
5dea7a20 CC |
831 | static int find_signature(void __iomem *memcheck, const char *testStr) |
832 | { | |
833 | int i = 0; | |
834 | int loca; | |
835 | ||
836 | for (loca = 0; loca < 0xffff; loca++) { | |
837 | char temp = readb(memcheck + loca); | |
838 | ||
839 | if (temp == testStr[i]) { | |
840 | if (i == strlen(testStr)-1) | |
841 | break; | |
842 | ++i; | |
843 | } else { | |
844 | i = 0; | |
845 | } | |
846 | } | |
847 | return loca; | |
848 | } | |
849 | ||
850 | static void samsung_rfkill_exit(struct samsung_laptop *samsung) | |
851 | { | |
84d482f2 CC |
852 | if (samsung->wlan.rfkill) { |
853 | rfkill_unregister(samsung->wlan.rfkill); | |
854 | rfkill_destroy(samsung->wlan.rfkill); | |
855 | samsung->wlan.rfkill = NULL; | |
856 | } | |
857 | if (samsung->bluetooth.rfkill) { | |
858 | rfkill_unregister(samsung->bluetooth.rfkill); | |
859 | rfkill_destroy(samsung->bluetooth.rfkill); | |
860 | samsung->bluetooth.rfkill = NULL; | |
5dea7a20 CC |
861 | } |
862 | } | |
863 | ||
84d482f2 CC |
864 | static int samsung_new_rfkill(struct samsung_laptop *samsung, |
865 | struct samsung_rfkill *arfkill, | |
866 | const char *name, enum rfkill_type type, | |
867 | const struct rfkill_ops *ops, | |
868 | int blocked) | |
5dea7a20 | 869 | { |
84d482f2 CC |
870 | struct rfkill **rfkill = &arfkill->rfkill; |
871 | int ret; | |
5dea7a20 | 872 | |
84d482f2 CC |
873 | arfkill->type = type; |
874 | arfkill->samsung = samsung; | |
875 | ||
876 | *rfkill = rfkill_alloc(name, &samsung->platform_device->dev, | |
877 | type, ops, arfkill); | |
878 | ||
879 | if (!*rfkill) | |
880 | return -EINVAL; | |
881 | ||
882 | if (blocked != -1) | |
883 | rfkill_init_sw_state(*rfkill, blocked); | |
884 | ||
885 | ret = rfkill_register(*rfkill); | |
886 | if (ret) { | |
887 | rfkill_destroy(*rfkill); | |
888 | *rfkill = NULL; | |
889 | return ret; | |
5dea7a20 | 890 | } |
84d482f2 CC |
891 | return 0; |
892 | } | |
5dea7a20 | 893 | |
84d482f2 CC |
894 | static int __init samsung_rfkill_init_seclinux(struct samsung_laptop *samsung) |
895 | { | |
896 | return samsung_new_rfkill(samsung, &samsung->wlan, "samsung-wlan", | |
897 | RFKILL_TYPE_WLAN, &seclinux_rfkill_ops, -1); | |
898 | } | |
899 | ||
900 | static int __init samsung_rfkill_init_swsmi(struct samsung_laptop *samsung) | |
901 | { | |
902 | struct sabi_data data; | |
903 | int ret; | |
904 | ||
905 | ret = swsmi_wireless_status(samsung, &data); | |
20db88e3 CC |
906 | if (ret) { |
907 | /* Some swsmi laptops use the old seclinux way to control | |
908 | * wireless devices */ | |
909 | if (ret == -EINVAL) | |
910 | ret = samsung_rfkill_init_seclinux(samsung); | |
84d482f2 | 911 | return ret; |
20db88e3 | 912 | } |
84d482f2 CC |
913 | |
914 | /* 0x02 seems to mean that the device is no present/available */ | |
915 | ||
916 | if (data.data[WL_STATUS_WLAN] != 0x02) | |
917 | ret = samsung_new_rfkill(samsung, &samsung->wlan, | |
918 | "samsung-wlan", | |
919 | RFKILL_TYPE_WLAN, | |
920 | &swsmi_rfkill_ops, | |
921 | !data.data[WL_STATUS_WLAN]); | |
922 | if (ret) | |
923 | goto exit; | |
924 | ||
925 | if (data.data[WL_STATUS_BT] != 0x02) | |
926 | ret = samsung_new_rfkill(samsung, &samsung->bluetooth, | |
927 | "samsung-bluetooth", | |
928 | RFKILL_TYPE_BLUETOOTH, | |
929 | &swsmi_rfkill_ops, | |
930 | !data.data[WL_STATUS_BT]); | |
931 | if (ret) | |
932 | goto exit; | |
933 | ||
934 | exit: | |
935 | if (ret) | |
936 | samsung_rfkill_exit(samsung); | |
937 | ||
938 | return ret; | |
939 | } | |
940 | ||
941 | static int __init samsung_rfkill_init(struct samsung_laptop *samsung) | |
942 | { | |
943 | if (samsung->config->sabi_version == 2) | |
944 | return samsung_rfkill_init_seclinux(samsung); | |
945 | if (samsung->config->sabi_version == 3) | |
946 | return samsung_rfkill_init_swsmi(samsung); | |
5dea7a20 CC |
947 | return 0; |
948 | } | |
949 | ||
f674ebf1 CC |
950 | static int kbd_backlight_enable(struct samsung_laptop *samsung) |
951 | { | |
952 | const struct sabi_commands *commands = &samsung->config->commands; | |
953 | struct sabi_data data; | |
954 | int retval; | |
955 | ||
956 | if (commands->kbd_backlight == 0xFFFF) | |
957 | return -ENODEV; | |
958 | ||
959 | memset(&data, 0, sizeof(data)); | |
960 | data.d0 = 0xaabb; | |
961 | retval = sabi_command(samsung, commands->kbd_backlight, | |
962 | &data, &data); | |
963 | ||
964 | if (retval) | |
965 | return retval; | |
966 | ||
967 | if (data.d0 != 0xccdd) | |
968 | return -ENODEV; | |
969 | return 0; | |
970 | } | |
971 | ||
972 | static int kbd_backlight_read(struct samsung_laptop *samsung) | |
973 | { | |
974 | const struct sabi_commands *commands = &samsung->config->commands; | |
975 | struct sabi_data data; | |
976 | int retval; | |
977 | ||
978 | memset(&data, 0, sizeof(data)); | |
979 | data.data[0] = 0x81; | |
980 | retval = sabi_command(samsung, commands->kbd_backlight, | |
981 | &data, &data); | |
982 | ||
983 | if (retval) | |
984 | return retval; | |
985 | ||
986 | return data.data[0]; | |
987 | } | |
988 | ||
989 | static int kbd_backlight_write(struct samsung_laptop *samsung, int brightness) | |
990 | { | |
991 | const struct sabi_commands *commands = &samsung->config->commands; | |
992 | struct sabi_data data; | |
993 | ||
994 | memset(&data, 0, sizeof(data)); | |
995 | data.d0 = 0x82 | ((brightness & 0xFF) << 8); | |
996 | return sabi_command(samsung, commands->kbd_backlight, | |
997 | &data, NULL); | |
998 | } | |
999 | ||
1000 | static void kbd_led_update(struct work_struct *work) | |
1001 | { | |
1002 | struct samsung_laptop *samsung; | |
1003 | ||
1004 | samsung = container_of(work, struct samsung_laptop, kbd_led_work); | |
1005 | kbd_backlight_write(samsung, samsung->kbd_led_wk); | |
1006 | } | |
1007 | ||
1008 | static void kbd_led_set(struct led_classdev *led_cdev, | |
1009 | enum led_brightness value) | |
1010 | { | |
1011 | struct samsung_laptop *samsung; | |
1012 | ||
1013 | samsung = container_of(led_cdev, struct samsung_laptop, kbd_led); | |
1014 | ||
1015 | if (value > samsung->kbd_led.max_brightness) | |
1016 | value = samsung->kbd_led.max_brightness; | |
1017 | else if (value < 0) | |
1018 | value = 0; | |
1019 | ||
1020 | samsung->kbd_led_wk = value; | |
1021 | queue_work(samsung->led_workqueue, &samsung->kbd_led_work); | |
1022 | } | |
1023 | ||
1024 | static enum led_brightness kbd_led_get(struct led_classdev *led_cdev) | |
1025 | { | |
1026 | struct samsung_laptop *samsung; | |
1027 | ||
1028 | samsung = container_of(led_cdev, struct samsung_laptop, kbd_led); | |
1029 | return kbd_backlight_read(samsung); | |
1030 | } | |
1031 | ||
1032 | static void samsung_leds_exit(struct samsung_laptop *samsung) | |
1033 | { | |
1034 | if (!IS_ERR_OR_NULL(samsung->kbd_led.dev)) | |
1035 | led_classdev_unregister(&samsung->kbd_led); | |
1036 | if (samsung->led_workqueue) | |
1037 | destroy_workqueue(samsung->led_workqueue); | |
1038 | } | |
1039 | ||
1040 | static int __init samsung_leds_init(struct samsung_laptop *samsung) | |
1041 | { | |
1042 | int ret = 0; | |
1043 | ||
1044 | samsung->led_workqueue = create_singlethread_workqueue("led_workqueue"); | |
1045 | if (!samsung->led_workqueue) | |
1046 | return -ENOMEM; | |
1047 | ||
1048 | if (kbd_backlight_enable(samsung) >= 0) { | |
1049 | INIT_WORK(&samsung->kbd_led_work, kbd_led_update); | |
1050 | ||
1051 | samsung->kbd_led.name = "samsung::kbd_backlight"; | |
1052 | samsung->kbd_led.brightness_set = kbd_led_set; | |
1053 | samsung->kbd_led.brightness_get = kbd_led_get; | |
1054 | samsung->kbd_led.max_brightness = 8; | |
1055 | ||
1056 | ret = led_classdev_register(&samsung->platform_device->dev, | |
1057 | &samsung->kbd_led); | |
1058 | } | |
1059 | ||
1060 | if (ret) | |
1061 | samsung_leds_exit(samsung); | |
1062 | ||
1063 | return ret; | |
1064 | } | |
1065 | ||
5dea7a20 CC |
1066 | static void samsung_backlight_exit(struct samsung_laptop *samsung) |
1067 | { | |
1068 | if (samsung->backlight_device) { | |
1069 | backlight_device_unregister(samsung->backlight_device); | |
1070 | samsung->backlight_device = NULL; | |
1071 | } | |
1072 | } | |
1073 | ||
1074 | static int __init samsung_backlight_init(struct samsung_laptop *samsung) | |
1075 | { | |
1076 | struct backlight_device *bd; | |
1077 | struct backlight_properties props; | |
1078 | ||
f34cd9ca CC |
1079 | if (!samsung->handle_backlight) |
1080 | return 0; | |
1081 | ||
5dea7a20 CC |
1082 | memset(&props, 0, sizeof(struct backlight_properties)); |
1083 | props.type = BACKLIGHT_PLATFORM; | |
1084 | props.max_brightness = samsung->config->max_brightness - | |
1085 | samsung->config->min_brightness; | |
1086 | ||
1087 | bd = backlight_device_register("samsung", | |
1088 | &samsung->platform_device->dev, | |
1089 | samsung, &backlight_ops, | |
1090 | &props); | |
1091 | if (IS_ERR(bd)) | |
1092 | return PTR_ERR(bd); | |
1093 | ||
1094 | samsung->backlight_device = bd; | |
1095 | samsung->backlight_device->props.brightness = read_brightness(samsung); | |
1096 | samsung->backlight_device->props.power = FB_BLANK_UNBLANK; | |
1097 | backlight_update_status(samsung->backlight_device); | |
1098 | ||
1099 | return 0; | |
1100 | } | |
1101 | ||
bde9e509 | 1102 | static umode_t samsung_sysfs_is_visible(struct kobject *kobj, |
a66c1662 CC |
1103 | struct attribute *attr, int idx) |
1104 | { | |
1105 | struct device *dev = container_of(kobj, struct device, kobj); | |
1106 | struct platform_device *pdev = to_platform_device(dev); | |
1107 | struct samsung_laptop *samsung = platform_get_drvdata(pdev); | |
1108 | bool ok = true; | |
1109 | ||
1110 | if (attr == &dev_attr_performance_level.attr) | |
1111 | ok = !!samsung->config->performance_levels[0].name; | |
cb5b5c91 CC |
1112 | if (attr == &dev_attr_battery_life_extender.attr) |
1113 | ok = !!(read_battery_life_extender(samsung) >= 0); | |
3a75d378 CC |
1114 | if (attr == &dev_attr_usb_charge.attr) |
1115 | ok = !!(read_usb_charge(samsung) >= 0); | |
a66c1662 CC |
1116 | |
1117 | return ok ? attr->mode : 0; | |
1118 | } | |
1119 | ||
1120 | static struct attribute_group platform_attribute_group = { | |
1121 | .is_visible = samsung_sysfs_is_visible, | |
1122 | .attrs = platform_attributes | |
1123 | }; | |
1124 | ||
5dea7a20 CC |
1125 | static void samsung_sysfs_exit(struct samsung_laptop *samsung) |
1126 | { | |
a66c1662 CC |
1127 | struct platform_device *device = samsung->platform_device; |
1128 | ||
1129 | sysfs_remove_group(&device->dev.kobj, &platform_attribute_group); | |
5dea7a20 CC |
1130 | } |
1131 | ||
1132 | static int __init samsung_sysfs_init(struct samsung_laptop *samsung) | |
1133 | { | |
a66c1662 CC |
1134 | struct platform_device *device = samsung->platform_device; |
1135 | ||
1136 | return sysfs_create_group(&device->dev.kobj, &platform_attribute_group); | |
1137 | ||
5dea7a20 CC |
1138 | } |
1139 | ||
5b80fc40 CC |
1140 | static int show_call(struct seq_file *m, void *data) |
1141 | { | |
1142 | struct samsung_laptop *samsung = m->private; | |
1143 | struct sabi_data *sdata = &samsung->debug.data; | |
1144 | int ret; | |
1145 | ||
1146 | seq_printf(m, "SABI 0x%04x {0x%08x, 0x%08x, 0x%04x, 0x%02x}\n", | |
1147 | samsung->debug.command, | |
1148 | sdata->d0, sdata->d1, sdata->d2, sdata->d3); | |
1149 | ||
1150 | ret = sabi_command(samsung, samsung->debug.command, sdata, sdata); | |
1151 | ||
1152 | if (ret) { | |
1153 | seq_printf(m, "SABI command 0x%04x failed\n", | |
1154 | samsung->debug.command); | |
1155 | return ret; | |
1156 | } | |
1157 | ||
1158 | seq_printf(m, "SABI {0x%08x, 0x%08x, 0x%04x, 0x%02x}\n", | |
1159 | sdata->d0, sdata->d1, sdata->d2, sdata->d3); | |
1160 | return 0; | |
1161 | } | |
1162 | ||
1163 | static int samsung_debugfs_open(struct inode *inode, struct file *file) | |
1164 | { | |
1165 | return single_open(file, show_call, inode->i_private); | |
1166 | } | |
1167 | ||
1168 | static const struct file_operations samsung_laptop_call_io_ops = { | |
1169 | .owner = THIS_MODULE, | |
1170 | .open = samsung_debugfs_open, | |
1171 | .read = seq_read, | |
1172 | .llseek = seq_lseek, | |
1173 | .release = single_release, | |
1174 | }; | |
1175 | ||
1176 | static void samsung_debugfs_exit(struct samsung_laptop *samsung) | |
1177 | { | |
1178 | debugfs_remove_recursive(samsung->debug.root); | |
1179 | } | |
1180 | ||
1181 | static int samsung_debugfs_init(struct samsung_laptop *samsung) | |
1182 | { | |
1183 | struct dentry *dent; | |
1184 | ||
1185 | samsung->debug.root = debugfs_create_dir("samsung-laptop", NULL); | |
1186 | if (!samsung->debug.root) { | |
1187 | pr_err("failed to create debugfs directory"); | |
1188 | goto error_debugfs; | |
1189 | } | |
1190 | ||
1191 | samsung->debug.f0000_wrapper.data = samsung->f0000_segment; | |
1192 | samsung->debug.f0000_wrapper.size = 0xffff; | |
1193 | ||
1194 | samsung->debug.data_wrapper.data = &samsung->debug.data; | |
1195 | samsung->debug.data_wrapper.size = sizeof(samsung->debug.data); | |
1196 | ||
6f6ae06e CC |
1197 | samsung->debug.sdiag_wrapper.data = samsung->sdiag; |
1198 | samsung->debug.sdiag_wrapper.size = strlen(samsung->sdiag); | |
1199 | ||
5b80fc40 CC |
1200 | dent = debugfs_create_u16("command", S_IRUGO | S_IWUSR, |
1201 | samsung->debug.root, &samsung->debug.command); | |
1202 | if (!dent) | |
1203 | goto error_debugfs; | |
1204 | ||
1205 | dent = debugfs_create_u32("d0", S_IRUGO | S_IWUSR, samsung->debug.root, | |
1206 | &samsung->debug.data.d0); | |
1207 | if (!dent) | |
1208 | goto error_debugfs; | |
1209 | ||
1210 | dent = debugfs_create_u32("d1", S_IRUGO | S_IWUSR, samsung->debug.root, | |
1211 | &samsung->debug.data.d1); | |
1212 | if (!dent) | |
1213 | goto error_debugfs; | |
1214 | ||
1215 | dent = debugfs_create_u16("d2", S_IRUGO | S_IWUSR, samsung->debug.root, | |
1216 | &samsung->debug.data.d2); | |
1217 | if (!dent) | |
1218 | goto error_debugfs; | |
1219 | ||
1220 | dent = debugfs_create_u8("d3", S_IRUGO | S_IWUSR, samsung->debug.root, | |
1221 | &samsung->debug.data.d3); | |
1222 | if (!dent) | |
1223 | goto error_debugfs; | |
1224 | ||
1225 | dent = debugfs_create_blob("data", S_IRUGO | S_IWUSR, | |
1226 | samsung->debug.root, | |
1227 | &samsung->debug.data_wrapper); | |
1228 | if (!dent) | |
1229 | goto error_debugfs; | |
1230 | ||
1231 | dent = debugfs_create_blob("f0000_segment", S_IRUSR | S_IWUSR, | |
1232 | samsung->debug.root, | |
1233 | &samsung->debug.f0000_wrapper); | |
1234 | if (!dent) | |
1235 | goto error_debugfs; | |
1236 | ||
1237 | dent = debugfs_create_file("call", S_IFREG | S_IRUGO, | |
1238 | samsung->debug.root, samsung, | |
1239 | &samsung_laptop_call_io_ops); | |
1240 | if (!dent) | |
1241 | goto error_debugfs; | |
1242 | ||
6f6ae06e CC |
1243 | dent = debugfs_create_blob("sdiag", S_IRUGO | S_IWUSR, |
1244 | samsung->debug.root, | |
1245 | &samsung->debug.sdiag_wrapper); | |
1246 | if (!dent) | |
1247 | goto error_debugfs; | |
1248 | ||
5b80fc40 CC |
1249 | return 0; |
1250 | ||
1251 | error_debugfs: | |
1252 | samsung_debugfs_exit(samsung); | |
1253 | return -ENOMEM; | |
1254 | } | |
1255 | ||
5dea7a20 CC |
1256 | static void samsung_sabi_exit(struct samsung_laptop *samsung) |
1257 | { | |
1258 | const struct sabi_config *config = samsung->config; | |
1259 | ||
1260 | /* Turn off "Linux" mode in the BIOS */ | |
1261 | if (config && config->commands.set_linux != 0xff) | |
7e960711 | 1262 | sabi_set_commandb(samsung, config->commands.set_linux, 0x80); |
5dea7a20 CC |
1263 | |
1264 | if (samsung->sabi_iface) { | |
1265 | iounmap(samsung->sabi_iface); | |
1266 | samsung->sabi_iface = NULL; | |
1267 | } | |
1268 | if (samsung->f0000_segment) { | |
1269 | iounmap(samsung->f0000_segment); | |
1270 | samsung->f0000_segment = NULL; | |
1271 | } | |
1272 | ||
1273 | samsung->config = NULL; | |
1274 | } | |
1275 | ||
49dd7730 CC |
1276 | static __init void samsung_sabi_infos(struct samsung_laptop *samsung, int loca, |
1277 | unsigned int ifaceP) | |
5dea7a20 CC |
1278 | { |
1279 | const struct sabi_config *config = samsung->config; | |
1280 | ||
1281 | printk(KERN_DEBUG "This computer supports SABI==%x\n", | |
1282 | loca + 0xf0000 - 6); | |
49dd7730 | 1283 | |
5dea7a20 CC |
1284 | printk(KERN_DEBUG "SABI header:\n"); |
1285 | printk(KERN_DEBUG " SMI Port Number = 0x%04x\n", | |
1286 | readw(samsung->sabi + config->header_offsets.port)); | |
1287 | printk(KERN_DEBUG " SMI Interface Function = 0x%02x\n", | |
1288 | readb(samsung->sabi + config->header_offsets.iface_func)); | |
1289 | printk(KERN_DEBUG " SMI enable memory buffer = 0x%02x\n", | |
1290 | readb(samsung->sabi + config->header_offsets.en_mem)); | |
1291 | printk(KERN_DEBUG " SMI restore memory buffer = 0x%02x\n", | |
1292 | readb(samsung->sabi + config->header_offsets.re_mem)); | |
1293 | printk(KERN_DEBUG " SABI data offset = 0x%04x\n", | |
1294 | readw(samsung->sabi + config->header_offsets.data_offset)); | |
1295 | printk(KERN_DEBUG " SABI data segment = 0x%04x\n", | |
1296 | readw(samsung->sabi + config->header_offsets.data_segment)); | |
5dea7a20 | 1297 | |
49dd7730 | 1298 | printk(KERN_DEBUG " SABI pointer = 0x%08x\n", ifaceP); |
5dea7a20 CC |
1299 | } |
1300 | ||
6f6ae06e CC |
1301 | static void __init samsung_sabi_diag(struct samsung_laptop *samsung) |
1302 | { | |
1303 | int loca = find_signature(samsung->f0000_segment, "SDiaG@"); | |
1304 | int i; | |
1305 | ||
1306 | if (loca == 0xffff) | |
1307 | return ; | |
1308 | ||
1309 | /* Example: | |
1310 | * Ident: @SDiaG@686XX-N90X3A/966-SEC-07HL-S90X3A | |
1311 | * | |
1312 | * Product name: 90X3A | |
1313 | * BIOS Version: 07HL | |
1314 | */ | |
1315 | loca += 1; | |
1316 | for (i = 0; loca < 0xffff && i < sizeof(samsung->sdiag) - 1; loca++) { | |
1317 | char temp = readb(samsung->f0000_segment + loca); | |
1318 | ||
1319 | if (isalnum(temp) || temp == '/' || temp == '-') | |
1320 | samsung->sdiag[i++] = temp; | |
1321 | else | |
1322 | break ; | |
1323 | } | |
1324 | ||
1325 | if (debug && samsung->sdiag[0]) | |
1326 | pr_info("sdiag: %s", samsung->sdiag); | |
1327 | } | |
1328 | ||
5dea7a20 CC |
1329 | static int __init samsung_sabi_init(struct samsung_laptop *samsung) |
1330 | { | |
1331 | const struct sabi_config *config = NULL; | |
1332 | const struct sabi_commands *commands; | |
1333 | unsigned int ifaceP; | |
1334 | int ret = 0; | |
1335 | int i; | |
1336 | int loca; | |
1337 | ||
1338 | samsung->f0000_segment = ioremap_nocache(0xf0000, 0xffff); | |
1339 | if (!samsung->f0000_segment) { | |
3be324a9 CC |
1340 | if (debug || force) |
1341 | pr_err("Can't map the segment at 0xf0000\n"); | |
5dea7a20 CC |
1342 | ret = -EINVAL; |
1343 | goto exit; | |
1344 | } | |
1345 | ||
6f6ae06e CC |
1346 | samsung_sabi_diag(samsung); |
1347 | ||
5dea7a20 CC |
1348 | /* Try to find one of the signatures in memory to find the header */ |
1349 | for (i = 0; sabi_configs[i].test_string != 0; ++i) { | |
1350 | samsung->config = &sabi_configs[i]; | |
1351 | loca = find_signature(samsung->f0000_segment, | |
1352 | samsung->config->test_string); | |
1353 | if (loca != 0xffff) | |
1354 | break; | |
1355 | } | |
1356 | ||
1357 | if (loca == 0xffff) { | |
3be324a9 CC |
1358 | if (debug || force) |
1359 | pr_err("This computer does not support SABI\n"); | |
5dea7a20 CC |
1360 | ret = -ENODEV; |
1361 | goto exit; | |
1362 | } | |
1363 | ||
1364 | config = samsung->config; | |
1365 | commands = &config->commands; | |
1366 | ||
1367 | /* point to the SMI port Number */ | |
1368 | loca += 1; | |
1369 | samsung->sabi = (samsung->f0000_segment + loca); | |
1370 | ||
5dea7a20 CC |
1371 | /* Get a pointer to the SABI Interface */ |
1372 | ifaceP = (readw(samsung->sabi + config->header_offsets.data_segment) & 0x0ffff) << 4; | |
1373 | ifaceP += readw(samsung->sabi + config->header_offsets.data_offset) & 0x0ffff; | |
49dd7730 CC |
1374 | |
1375 | if (debug) | |
1376 | samsung_sabi_infos(samsung, loca, ifaceP); | |
1377 | ||
5dea7a20 CC |
1378 | samsung->sabi_iface = ioremap_nocache(ifaceP, 16); |
1379 | if (!samsung->sabi_iface) { | |
1380 | pr_err("Can't remap %x\n", ifaceP); | |
1381 | ret = -EINVAL; | |
1382 | goto exit; | |
1383 | } | |
1384 | ||
5dea7a20 CC |
1385 | /* Turn on "Linux" mode in the BIOS */ |
1386 | if (commands->set_linux != 0xff) { | |
7e960711 CC |
1387 | int retval = sabi_set_commandb(samsung, |
1388 | commands->set_linux, 0x81); | |
5dea7a20 CC |
1389 | if (retval) { |
1390 | pr_warn("Linux mode was not set!\n"); | |
1391 | ret = -ENODEV; | |
1392 | goto exit; | |
1393 | } | |
1394 | } | |
1395 | ||
1396 | /* Check for stepping quirk */ | |
f34cd9ca CC |
1397 | if (samsung->handle_backlight) |
1398 | check_for_stepping_quirk(samsung); | |
5dea7a20 | 1399 | |
2e777187 CC |
1400 | pr_info("detected SABI interface: %s\n", |
1401 | samsung->config->test_string); | |
1402 | ||
5dea7a20 CC |
1403 | exit: |
1404 | if (ret) | |
1405 | samsung_sabi_exit(samsung); | |
1406 | ||
1407 | return ret; | |
1408 | } | |
1409 | ||
1410 | static void samsung_platform_exit(struct samsung_laptop *samsung) | |
1411 | { | |
1412 | if (samsung->platform_device) { | |
1413 | platform_device_unregister(samsung->platform_device); | |
1414 | samsung->platform_device = NULL; | |
1415 | } | |
1416 | } | |
1417 | ||
1418 | static int __init samsung_platform_init(struct samsung_laptop *samsung) | |
1419 | { | |
1420 | struct platform_device *pdev; | |
1421 | ||
1422 | pdev = platform_device_register_simple("samsung", -1, NULL, 0); | |
1423 | if (IS_ERR(pdev)) | |
1424 | return PTR_ERR(pdev); | |
1425 | ||
1426 | samsung->platform_device = pdev; | |
1427 | platform_set_drvdata(samsung->platform_device, samsung); | |
1428 | return 0; | |
1429 | } | |
1430 | ||
a979e2e2 CC |
1431 | static struct samsung_quirks *quirks; |
1432 | ||
1433 | static int __init samsung_dmi_matched(const struct dmi_system_id *d) | |
1434 | { | |
1435 | quirks = d->driver_data; | |
1436 | return 0; | |
1437 | } | |
1438 | ||
2d70b73a GKH |
1439 | static struct dmi_system_id __initdata samsung_dmi_table[] = { |
1440 | { | |
2d70b73a GKH |
1441 | .matches = { |
1442 | DMI_MATCH(DMI_SYS_VENDOR, | |
1443 | "SAMSUNG ELECTRONICS CO., LTD."), | |
3be324a9 | 1444 | DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */ |
2d70b73a | 1445 | }, |
2d70b73a GKH |
1446 | }, |
1447 | { | |
2d70b73a GKH |
1448 | .matches = { |
1449 | DMI_MATCH(DMI_SYS_VENDOR, | |
1450 | "SAMSUNG ELECTRONICS CO., LTD."), | |
3be324a9 | 1451 | DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */ |
2d70b73a | 1452 | }, |
2d70b73a | 1453 | }, |
78a7539b | 1454 | { |
78a7539b TC |
1455 | .matches = { |
1456 | DMI_MATCH(DMI_SYS_VENDOR, | |
1457 | "SAMSUNG ELECTRONICS CO., LTD."), | |
3be324a9 | 1458 | DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */ |
78a7539b | 1459 | }, |
78a7539b | 1460 | }, |
f689c875 | 1461 | { |
f689c875 RGS |
1462 | .matches = { |
1463 | DMI_MATCH(DMI_SYS_VENDOR, | |
1464 | "SAMSUNG ELECTRONICS CO., LTD."), | |
3be324a9 | 1465 | DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */ |
f689c875 | 1466 | }, |
7b3c257c | 1467 | }, |
a979e2e2 CC |
1468 | /* Specific DMI ids for laptop with quirks */ |
1469 | { | |
1470 | .callback = samsung_dmi_matched, | |
1471 | .ident = "N150P", | |
1472 | .matches = { | |
1473 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | |
1474 | DMI_MATCH(DMI_PRODUCT_NAME, "N150P"), | |
1475 | DMI_MATCH(DMI_BOARD_NAME, "N150P"), | |
1476 | }, | |
1477 | .driver_data = &samsung_broken_acpi_video, | |
1478 | }, | |
1479 | { | |
1480 | .callback = samsung_dmi_matched, | |
1481 | .ident = "N145P/N250P/N260P", | |
1482 | .matches = { | |
1483 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | |
1484 | DMI_MATCH(DMI_PRODUCT_NAME, "N145P/N250P/N260P"), | |
1485 | DMI_MATCH(DMI_BOARD_NAME, "N145P/N250P/N260P"), | |
1486 | }, | |
1487 | .driver_data = &samsung_broken_acpi_video, | |
1488 | }, | |
1489 | { | |
1490 | .callback = samsung_dmi_matched, | |
1491 | .ident = "N150/N210/N220", | |
1492 | .matches = { | |
1493 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | |
1494 | DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220"), | |
1495 | DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220"), | |
1496 | }, | |
1497 | .driver_data = &samsung_broken_acpi_video, | |
1498 | }, | |
1499 | { | |
1500 | .callback = samsung_dmi_matched, | |
1501 | .ident = "NF110/NF210/NF310", | |
1502 | .matches = { | |
1503 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | |
1504 | DMI_MATCH(DMI_PRODUCT_NAME, "NF110/NF210/NF310"), | |
1505 | DMI_MATCH(DMI_BOARD_NAME, "NF110/NF210/NF310"), | |
1506 | }, | |
1507 | .driver_data = &samsung_broken_acpi_video, | |
1508 | }, | |
09d5677c CC |
1509 | { |
1510 | .callback = samsung_dmi_matched, | |
1511 | .ident = "X360", | |
1512 | .matches = { | |
1513 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | |
1514 | DMI_MATCH(DMI_PRODUCT_NAME, "X360"), | |
1515 | DMI_MATCH(DMI_BOARD_NAME, "X360"), | |
1516 | }, | |
1517 | .driver_data = &samsung_broken_acpi_video, | |
1518 | }, | |
2d70b73a GKH |
1519 | { }, |
1520 | }; | |
1521 | MODULE_DEVICE_TABLE(dmi, samsung_dmi_table); | |
1522 | ||
5dea7a20 | 1523 | static struct platform_device *samsung_platform_device; |
2d70b73a GKH |
1524 | |
1525 | static int __init samsung_init(void) | |
1526 | { | |
5dea7a20 CC |
1527 | struct samsung_laptop *samsung; |
1528 | int ret; | |
2d70b73a | 1529 | |
a979e2e2 | 1530 | quirks = &samsung_unknown; |
2d70b73a GKH |
1531 | if (!force && !dmi_check_system(samsung_dmi_table)) |
1532 | return -ENODEV; | |
1533 | ||
a6df4894 CC |
1534 | samsung = kzalloc(sizeof(*samsung), GFP_KERNEL); |
1535 | if (!samsung) | |
1536 | return -ENOMEM; | |
1537 | ||
1538 | mutex_init(&samsung->sabi_mutex); | |
f34cd9ca | 1539 | samsung->handle_backlight = true; |
a979e2e2 | 1540 | samsung->quirks = quirks; |
f34cd9ca | 1541 | |
a979e2e2 | 1542 | |
a60b2176 CC |
1543 | #ifdef CONFIG_ACPI |
1544 | if (samsung->quirks->broken_acpi_video) | |
1545 | acpi_video_dmi_promote_vendor(); | |
1546 | ||
f34cd9ca | 1547 | /* Don't handle backlight here if the acpi video already handle it */ |
a979e2e2 | 1548 | if (acpi_video_backlight_support()) { |
a60b2176 CC |
1549 | samsung->handle_backlight = false; |
1550 | } else if (samsung->quirks->broken_acpi_video) { | |
1551 | pr_info("Disabling ACPI video driver\n"); | |
1552 | #ifdef CONFIG_ACPI_VIDEO | |
1553 | acpi_video_unregister(); | |
1554 | #endif | |
a979e2e2 | 1555 | } |
f34cd9ca | 1556 | #endif |
a979e2e2 | 1557 | |
5dea7a20 CC |
1558 | ret = samsung_platform_init(samsung); |
1559 | if (ret) | |
1560 | goto error_platform; | |
1561 | ||
1562 | ret = samsung_sabi_init(samsung); | |
1563 | if (ret) | |
1564 | goto error_sabi; | |
1565 | ||
3be324a9 CC |
1566 | #ifdef CONFIG_ACPI |
1567 | /* Only log that if we are really on a sabi platform */ | |
a60b2176 | 1568 | if (acpi_video_backlight_support()) |
3be324a9 CC |
1569 | pr_info("Backlight controlled by ACPI video driver\n"); |
1570 | #endif | |
1571 | ||
5dea7a20 CC |
1572 | ret = samsung_sysfs_init(samsung); |
1573 | if (ret) | |
1574 | goto error_sysfs; | |
1575 | ||
1576 | ret = samsung_backlight_init(samsung); | |
1577 | if (ret) | |
1578 | goto error_backlight; | |
1579 | ||
1580 | ret = samsung_rfkill_init(samsung); | |
1581 | if (ret) | |
1582 | goto error_rfkill; | |
1583 | ||
f674ebf1 CC |
1584 | ret = samsung_leds_init(samsung); |
1585 | if (ret) | |
1586 | goto error_leds; | |
1587 | ||
5b80fc40 CC |
1588 | ret = samsung_debugfs_init(samsung); |
1589 | if (ret) | |
1590 | goto error_debugfs; | |
1591 | ||
5dea7a20 CC |
1592 | samsung_platform_device = samsung->platform_device; |
1593 | return ret; | |
1594 | ||
5b80fc40 | 1595 | error_debugfs: |
f674ebf1 CC |
1596 | samsung_leds_exit(samsung); |
1597 | error_leds: | |
5b80fc40 | 1598 | samsung_rfkill_exit(samsung); |
5dea7a20 CC |
1599 | error_rfkill: |
1600 | samsung_backlight_exit(samsung); | |
1601 | error_backlight: | |
1602 | samsung_sysfs_exit(samsung); | |
1603 | error_sysfs: | |
1604 | samsung_sabi_exit(samsung); | |
1605 | error_sabi: | |
1606 | samsung_platform_exit(samsung); | |
1607 | error_platform: | |
a6df4894 | 1608 | kfree(samsung); |
5dea7a20 | 1609 | return ret; |
2d70b73a GKH |
1610 | } |
1611 | ||
1612 | static void __exit samsung_exit(void) | |
1613 | { | |
5dea7a20 CC |
1614 | struct samsung_laptop *samsung; |
1615 | ||
1616 | samsung = platform_get_drvdata(samsung_platform_device); | |
1617 | ||
5b80fc40 | 1618 | samsung_debugfs_exit(samsung); |
f674ebf1 | 1619 | samsung_leds_exit(samsung); |
5dea7a20 CC |
1620 | samsung_rfkill_exit(samsung); |
1621 | samsung_backlight_exit(samsung); | |
1622 | samsung_sysfs_exit(samsung); | |
1623 | samsung_sabi_exit(samsung); | |
1624 | samsung_platform_exit(samsung); | |
a6df4894 | 1625 | |
a6df4894 | 1626 | kfree(samsung); |
5dea7a20 | 1627 | samsung_platform_device = NULL; |
2d70b73a GKH |
1628 | } |
1629 | ||
1630 | module_init(samsung_init); | |
1631 | module_exit(samsung_exit); | |
1632 | ||
1633 | MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@suse.de>"); | |
1634 | MODULE_DESCRIPTION("Samsung Backlight driver"); | |
1635 | MODULE_LICENSE("GPL"); |