blob: 1cb39d00d01411dc05b6972832598db4b2eaedad [file] [log] [blame]
Jonathan Woithed0482532007-08-29 15:58:19 +09301/*-*-linux-c-*-*/
2
3/*
Jonathan Woithe409a3e92012-03-27 13:01:01 +10304 Copyright (C) 2007,2008 Jonathan Woithe <jwoithe@just42.net>
Jonathan Woithe20b93732008-06-11 10:14:56 +09305 Copyright (C) 2008 Peter Gruber <nokos@gmx.net>
Tony Vroon3a407082008-12-31 18:19:59 +00006 Copyright (C) 2008 Tony Vroon <tony@linx.net>
Jonathan Woithed0482532007-08-29 15:58:19 +09307 Based on earlier work:
8 Copyright (C) 2003 Shane Spencer <shane@bogomip.com>
9 Adrian Yee <brewt-fujitsu@brewt.org>
10
Jonathan Woithe20b93732008-06-11 10:14:56 +093011 Templated from msi-laptop.c and thinkpad_acpi.c which is copyright
12 by its respective authors.
Jonathan Woithed0482532007-08-29 15:58:19 +093013
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 2 of the License, or
17 (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program; if not, write to the Free Software
26 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
27 02110-1301, USA.
28 */
29
30/*
31 * fujitsu-laptop.c - Fujitsu laptop support, providing access to additional
32 * features made available on a range of Fujitsu laptops including the
33 * P2xxx/P5xxx/S6xxx/S7xxx series.
34 *
35 * This driver exports a few files in /sys/devices/platform/fujitsu-laptop/;
36 * others may be added at a later date.
37 *
38 * lcd_level - Screen brightness: contains a single integer in the
39 * range 0..7. (rw)
40 *
41 * In addition to these platform device attributes the driver
42 * registers itself in the Linux backlight control subsystem and is
43 * available to userspace under /sys/class/backlight/fujitsu-laptop/.
44 *
Jonathan Woithe20b93732008-06-11 10:14:56 +093045 * Hotkeys present on certain Fujitsu laptops (eg: the S6xxx series) are
46 * also supported by this driver.
47 *
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +093048 * This driver has been tested on a Fujitsu Lifebook S6410, S7020 and
49 * P8010. It should work on most P-series and S-series Lifebooks, but
50 * YMMV.
Jonathan Woithe20b93732008-06-11 10:14:56 +093051 *
52 * The module parameter use_alt_lcd_levels switches between different ACPI
53 * brightness controls which are used by different Fujitsu laptops. In most
54 * cases the correct method is automatically detected. "use_alt_lcd_levels=1"
55 * is applicable for a Fujitsu Lifebook S6410 if autodetection fails.
56 *
Jonathan Woithed0482532007-08-29 15:58:19 +093057 */
58
Joe Perches77bad7c2011-03-29 15:21:39 -070059#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
60
Jonathan Woithed0482532007-08-29 15:58:19 +093061#include <linux/module.h>
62#include <linux/kernel.h>
63#include <linux/init.h>
64#include <linux/acpi.h>
65#include <linux/dmi.h>
66#include <linux/backlight.h>
Michael Karchere8549e22015-01-18 20:28:46 +010067#include <linux/fb.h>
Jonathan Woithe20b93732008-06-11 10:14:56 +093068#include <linux/input.h>
69#include <linux/kfifo.h>
Jonathan Woithed0482532007-08-29 15:58:19 +093070#include <linux/platform_device.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090071#include <linux/slab.h>
Stephen Gildea1e384cb2009-08-25 14:41:52 +093072#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
Tony Vroon3a407082008-12-31 18:19:59 +000073#include <linux/leds.h>
74#endif
Hans de Goede413226f2015-06-16 16:28:03 +020075#include <acpi/video.h>
Jonathan Woithed0482532007-08-29 15:58:19 +093076
Jonathan Woithe84a6ce22009-07-31 18:16:59 +093077#define FUJITSU_DRIVER_VERSION "0.6.0"
Jonathan Woithed0482532007-08-29 15:58:19 +093078
79#define FUJITSU_LCD_N_LEVELS 8
80
81#define ACPI_FUJITSU_CLASS "fujitsu"
82#define ACPI_FUJITSU_HID "FUJ02B1"
Jonathan Woithe20b93732008-06-11 10:14:56 +093083#define ACPI_FUJITSU_DRIVER_NAME "Fujitsu laptop FUJ02B1 ACPI brightness driver"
Jonathan Woithed0482532007-08-29 15:58:19 +093084#define ACPI_FUJITSU_DEVICE_NAME "Fujitsu FUJ02B1"
Jonathan Woithe20b93732008-06-11 10:14:56 +093085#define ACPI_FUJITSU_HOTKEY_HID "FUJ02E3"
86#define ACPI_FUJITSU_HOTKEY_DRIVER_NAME "Fujitsu laptop FUJ02E3 ACPI hotkeys driver"
87#define ACPI_FUJITSU_HOTKEY_DEVICE_NAME "Fujitsu FUJ02E3"
Jonathan Woithed0482532007-08-29 15:58:19 +093088
Jonathan Woithe20b93732008-06-11 10:14:56 +093089#define ACPI_FUJITSU_NOTIFY_CODE1 0x80
90
91#define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86
92#define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87
93
Tony Vroon3a407082008-12-31 18:19:59 +000094/* FUNC interface - command values */
95#define FUNC_RFKILL 0x1000
96#define FUNC_LEDS 0x1001
97#define FUNC_BUTTONS 0x1002
98#define FUNC_BACKLIGHT 0x1004
99
100/* FUNC interface - responses */
101#define UNSUPPORTED_CMD 0x80000000
102
Stephen Gildea1e384cb2009-08-25 14:41:52 +0930103#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
Tony Vroon3a407082008-12-31 18:19:59 +0000104/* FUNC interface - LED control */
105#define FUNC_LED_OFF 0x1
106#define FUNC_LED_ON 0x30001
107#define KEYBOARD_LAMPS 0x100
108#define LOGOLAMP_POWERON 0x2000
109#define LOGOLAMP_ALWAYS 0x4000
Michał Kępień4f625682016-04-12 22:06:34 +0930110#define RADIO_LED_ON 0x20
Tony Vroon3a407082008-12-31 18:19:59 +0000111#endif
112
Jonathan Woithe20b93732008-06-11 10:14:56 +0930113/* Hotkey details */
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +0930114#define KEY1_CODE 0x410 /* codes for the keys in the GIRB register */
115#define KEY2_CODE 0x411
116#define KEY3_CODE 0x412
117#define KEY4_CODE 0x413
Michał Kępieńb5df36c2016-02-24 14:23:32 +0100118#define KEY5_CODE 0x420
Jonathan Woithe20b93732008-06-11 10:14:56 +0930119
120#define MAX_HOTKEY_RINGBUFFER_SIZE 100
121#define RINGBUFFERSIZE 40
122
123/* Debugging */
124#define FUJLAPTOP_LOG ACPI_FUJITSU_HID ": "
125#define FUJLAPTOP_ERR KERN_ERR FUJLAPTOP_LOG
126#define FUJLAPTOP_NOTICE KERN_NOTICE FUJLAPTOP_LOG
127#define FUJLAPTOP_INFO KERN_INFO FUJLAPTOP_LOG
128#define FUJLAPTOP_DEBUG KERN_DEBUG FUJLAPTOP_LOG
129
130#define FUJLAPTOP_DBG_ALL 0xffff
131#define FUJLAPTOP_DBG_ERROR 0x0001
132#define FUJLAPTOP_DBG_WARN 0x0002
133#define FUJLAPTOP_DBG_INFO 0x0004
134#define FUJLAPTOP_DBG_TRACE 0x0008
135
Jean Delvarec4960cf2014-06-16 11:55:13 +0200136#ifdef CONFIG_FUJITSU_LAPTOP_DEBUG
137#define vdbg_printk(a_dbg_level, format, arg...) \
Jonathan Woithe20b93732008-06-11 10:14:56 +0930138 do { if (dbg_level & a_dbg_level) \
139 printk(FUJLAPTOP_DEBUG "%s: " format, __func__ , ## arg); \
140 } while (0)
Jonathan Woithe20b93732008-06-11 10:14:56 +0930141#else
Jean Delvarec4960cf2014-06-16 11:55:13 +0200142#define vdbg_printk(a_dbg_level, format, arg...) \
143 do { } while (0)
Jonathan Woithe20b93732008-06-11 10:14:56 +0930144#endif
145
146/* Device controlling the backlight and associated keys */
Jonathan Woithed0482532007-08-29 15:58:19 +0930147struct fujitsu_t {
148 acpi_handle acpi_handle;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930149 struct acpi_device *dev;
150 struct input_dev *input;
151 char phys[32];
Jonathan Woithed0482532007-08-29 15:58:19 +0930152 struct backlight_device *bl_device;
153 struct platform_device *pf_device;
Michał Kępieńb5df36c2016-02-24 14:23:32 +0100154 int keycode1, keycode2, keycode3, keycode4, keycode5;
Jonathan Woithed0482532007-08-29 15:58:19 +0930155
Jonathan Woithe20b93732008-06-11 10:14:56 +0930156 unsigned int max_brightness;
Jonathan Woithed0482532007-08-29 15:58:19 +0930157 unsigned int brightness_changed;
158 unsigned int brightness_level;
159};
160
161static struct fujitsu_t *fujitsu;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930162static int use_alt_lcd_levels = -1;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930163static int disable_brightness_adjust = -1;
Jonathan Woithed0482532007-08-29 15:58:19 +0930164
Jonathan Woithe20b93732008-06-11 10:14:56 +0930165/* Device used to access other hotkeys on the laptop */
166struct fujitsu_hotkey_t {
167 acpi_handle acpi_handle;
168 struct acpi_device *dev;
169 struct input_dev *input;
170 char phys[32];
171 struct platform_device *pf_device;
Stefani Seibold45465482009-12-21 14:37:26 -0800172 struct kfifo fifo;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930173 spinlock_t fifo_lock;
Tony Vroon4898c2b2009-02-02 11:11:10 +0000174 int rfkill_supported;
Tony Vroon3a407082008-12-31 18:19:59 +0000175 int rfkill_state;
176 int logolamp_registered;
177 int kblamps_registered;
Michał Kępień4f625682016-04-12 22:06:34 +0930178 int radio_led_registered;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930179};
180
181static struct fujitsu_hotkey_t *fujitsu_hotkey;
182
Bjorn Helgaasb4ec0272009-04-07 15:37:22 +0000183static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930184
Stephen Gildea1e384cb2009-08-25 14:41:52 +0930185#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
Tony Vroon3a407082008-12-31 18:19:59 +0000186static enum led_brightness logolamp_get(struct led_classdev *cdev);
187static void logolamp_set(struct led_classdev *cdev,
188 enum led_brightness brightness);
189
Axel Lin67af7112010-07-20 15:19:45 -0700190static struct led_classdev logolamp_led = {
Tony Vroon3a407082008-12-31 18:19:59 +0000191 .name = "fujitsu::logolamp",
192 .brightness_get = logolamp_get,
193 .brightness_set = logolamp_set
194};
195
196static enum led_brightness kblamps_get(struct led_classdev *cdev);
197static void kblamps_set(struct led_classdev *cdev,
198 enum led_brightness brightness);
199
Axel Lin67af7112010-07-20 15:19:45 -0700200static struct led_classdev kblamps_led = {
Tony Vroon3a407082008-12-31 18:19:59 +0000201 .name = "fujitsu::kblamps",
202 .brightness_get = kblamps_get,
203 .brightness_set = kblamps_set
204};
Michał Kępień4f625682016-04-12 22:06:34 +0930205
206static enum led_brightness radio_led_get(struct led_classdev *cdev);
207static void radio_led_set(struct led_classdev *cdev,
208 enum led_brightness brightness);
209
210static struct led_classdev radio_led = {
211 .name = "fujitsu::radio_led",
212 .brightness_get = radio_led_get,
213 .brightness_set = radio_led_set
214};
Tony Vroon3a407082008-12-31 18:19:59 +0000215#endif
216
Jonathan Woithe20b93732008-06-11 10:14:56 +0930217#ifdef CONFIG_FUJITSU_LAPTOP_DEBUG
218static u32 dbg_level = 0x03;
219#endif
220
Bjorn Helgaas700b6722009-04-07 15:37:16 +0000221static void acpi_fujitsu_notify(struct acpi_device *device, u32 event);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930222
Tony Vroon3a407082008-12-31 18:19:59 +0000223/* Fujitsu ACPI interface function */
224
225static int call_fext_func(int cmd, int arg0, int arg1, int arg2)
226{
227 acpi_status status = AE_OK;
228 union acpi_object params[4] = {
229 { .type = ACPI_TYPE_INTEGER },
230 { .type = ACPI_TYPE_INTEGER },
231 { .type = ACPI_TYPE_INTEGER },
232 { .type = ACPI_TYPE_INTEGER }
233 };
234 struct acpi_object_list arg_list = { 4, &params[0] };
Zhang Rui29c29a92013-09-03 08:32:12 +0800235 unsigned long long value;
Tony Vroon3a407082008-12-31 18:19:59 +0000236 acpi_handle handle = NULL;
237
238 status = acpi_get_handle(fujitsu_hotkey->acpi_handle, "FUNC", &handle);
239 if (ACPI_FAILURE(status)) {
240 vdbg_printk(FUJLAPTOP_DBG_ERROR,
241 "FUNC interface is not present\n");
242 return -ENODEV;
243 }
244
245 params[0].integer.value = cmd;
246 params[1].integer.value = arg0;
247 params[2].integer.value = arg1;
248 params[3].integer.value = arg2;
249
Zhang Rui29c29a92013-09-03 08:32:12 +0800250 status = acpi_evaluate_integer(handle, NULL, &arg_list, &value);
Tony Vroon3a407082008-12-31 18:19:59 +0000251 if (ACPI_FAILURE(status)) {
252 vdbg_printk(FUJLAPTOP_DBG_WARN,
253 "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) call failed\n",
254 cmd, arg0, arg1, arg2);
255 return -ENODEV;
256 }
257
Tony Vroon3a407082008-12-31 18:19:59 +0000258 vdbg_printk(FUJLAPTOP_DBG_TRACE,
259 "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) returned 0x%x\n",
Zhang Rui29c29a92013-09-03 08:32:12 +0800260 cmd, arg0, arg1, arg2, (int)value);
261 return value;
Tony Vroon3a407082008-12-31 18:19:59 +0000262}
263
Stephen Gildea1e384cb2009-08-25 14:41:52 +0930264#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
Tony Vroon3a407082008-12-31 18:19:59 +0000265/* LED class callbacks */
266
267static void logolamp_set(struct led_classdev *cdev,
268 enum led_brightness brightness)
269{
270 if (brightness >= LED_FULL) {
271 call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON);
272 call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_ON);
273 } else if (brightness >= LED_HALF) {
274 call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON);
275 call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_OFF);
276 } else {
277 call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_OFF);
278 }
279}
280
281static void kblamps_set(struct led_classdev *cdev,
282 enum led_brightness brightness)
283{
284 if (brightness >= LED_FULL)
285 call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_ON);
286 else
287 call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_OFF);
288}
289
Michał Kępień4f625682016-04-12 22:06:34 +0930290static void radio_led_set(struct led_classdev *cdev,
291 enum led_brightness brightness)
292{
293 if (brightness >= LED_FULL)
294 call_fext_func(FUNC_RFKILL, 0x5, RADIO_LED_ON, RADIO_LED_ON);
295 else
296 call_fext_func(FUNC_RFKILL, 0x5, RADIO_LED_ON, 0x0);
297}
298
Tony Vroon3a407082008-12-31 18:19:59 +0000299static enum led_brightness logolamp_get(struct led_classdev *cdev)
300{
301 enum led_brightness brightness = LED_OFF;
302 int poweron, always;
303
304 poweron = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_POWERON, 0x0);
305 if (poweron == FUNC_LED_ON) {
306 brightness = LED_HALF;
307 always = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_ALWAYS, 0x0);
308 if (always == FUNC_LED_ON)
309 brightness = LED_FULL;
310 }
311 return brightness;
312}
313
314static enum led_brightness kblamps_get(struct led_classdev *cdev)
315{
316 enum led_brightness brightness = LED_OFF;
317
318 if (call_fext_func(FUNC_LEDS, 0x2, KEYBOARD_LAMPS, 0x0) == FUNC_LED_ON)
319 brightness = LED_FULL;
320
321 return brightness;
322}
Michał Kępień4f625682016-04-12 22:06:34 +0930323
324static enum led_brightness radio_led_get(struct led_classdev *cdev)
325{
326 enum led_brightness brightness = LED_OFF;
327
328 if (call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0) & RADIO_LED_ON)
329 brightness = LED_FULL;
330
331 return brightness;
332}
Tony Vroon3a407082008-12-31 18:19:59 +0000333#endif
334
Jonathan Woithe20b93732008-06-11 10:14:56 +0930335/* Hardware access for LCD brightness control */
Jonathan Woithed0482532007-08-29 15:58:19 +0930336
337static int set_lcd_level(int level)
338{
339 acpi_status status = AE_OK;
Jonathan Woithed0482532007-08-29 15:58:19 +0930340 acpi_handle handle = NULL;
341
Jonathan Woithe20b93732008-06-11 10:14:56 +0930342 vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBLL [%d]\n",
343 level);
344
345 if (level < 0 || level >= fujitsu->max_brightness)
Jonathan Woithed0482532007-08-29 15:58:19 +0930346 return -EINVAL;
347
Jonathan Woithed0482532007-08-29 15:58:19 +0930348 status = acpi_get_handle(fujitsu->acpi_handle, "SBLL", &handle);
349 if (ACPI_FAILURE(status)) {
Jonathan Woithe20b93732008-06-11 10:14:56 +0930350 vdbg_printk(FUJLAPTOP_DBG_ERROR, "SBLL not present\n");
351 return -ENODEV;
352 }
353
Jonathan Woithe20b93732008-06-11 10:14:56 +0930354
Zhang Rui6c7fe47a2013-09-03 08:31:52 +0800355 status = acpi_execute_simple_method(handle, NULL, level);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930356 if (ACPI_FAILURE(status))
357 return -ENODEV;
358
359 return 0;
360}
361
362static int set_lcd_level_alt(int level)
363{
364 acpi_status status = AE_OK;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930365 acpi_handle handle = NULL;
366
367 vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBL2 [%d]\n",
368 level);
369
370 if (level < 0 || level >= fujitsu->max_brightness)
371 return -EINVAL;
372
Jonathan Woithe20b93732008-06-11 10:14:56 +0930373 status = acpi_get_handle(fujitsu->acpi_handle, "SBL2", &handle);
374 if (ACPI_FAILURE(status)) {
375 vdbg_printk(FUJLAPTOP_DBG_ERROR, "SBL2 not present\n");
Jonathan Woithed0482532007-08-29 15:58:19 +0930376 return -ENODEV;
377 }
378
Zhang Rui6c7fe47a2013-09-03 08:31:52 +0800379 status = acpi_execute_simple_method(handle, NULL, level);
Jonathan Woithed0482532007-08-29 15:58:19 +0930380 if (ACPI_FAILURE(status))
381 return -ENODEV;
382
383 return 0;
384}
385
386static int get_lcd_level(void)
387{
Matthew Wilcox27663c52008-10-10 02:22:59 -0400388 unsigned long long state = 0;
Jonathan Woithed0482532007-08-29 15:58:19 +0930389 acpi_status status = AE_OK;
390
Jonathan Woithe20b93732008-06-11 10:14:56 +0930391 vdbg_printk(FUJLAPTOP_DBG_TRACE, "get lcd level via GBLL\n");
392
Jonathan Woithed0482532007-08-29 15:58:19 +0930393 status =
394 acpi_evaluate_integer(fujitsu->acpi_handle, "GBLL", NULL, &state);
Jonathan Woithe3b1c37c2009-12-23 09:19:42 +1030395 if (ACPI_FAILURE(status))
396 return 0;
Jonathan Woithed0482532007-08-29 15:58:19 +0930397
Jonathan Woithe20b93732008-06-11 10:14:56 +0930398 fujitsu->brightness_level = state & 0x0fffffff;
399
400 if (state & 0x80000000)
401 fujitsu->brightness_changed = 1;
402 else
403 fujitsu->brightness_changed = 0;
404
405 return fujitsu->brightness_level;
406}
407
408static int get_max_brightness(void)
409{
Matthew Wilcox27663c52008-10-10 02:22:59 -0400410 unsigned long long state = 0;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930411 acpi_status status = AE_OK;
412
413 vdbg_printk(FUJLAPTOP_DBG_TRACE, "get max lcd level via RBLL\n");
414
415 status =
416 acpi_evaluate_integer(fujitsu->acpi_handle, "RBLL", NULL, &state);
Jonathan Woithe3b1c37c2009-12-23 09:19:42 +1030417 if (ACPI_FAILURE(status))
418 return -1;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930419
420 fujitsu->max_brightness = state;
421
422 return fujitsu->max_brightness;
423}
424
Jonathan Woithed0482532007-08-29 15:58:19 +0930425/* Backlight device stuff */
426
427static int bl_get_brightness(struct backlight_device *b)
428{
Tony Vroonf87a1a52009-01-07 10:11:24 +0000429 return get_lcd_level();
Jonathan Woithed0482532007-08-29 15:58:19 +0930430}
431
432static int bl_update_status(struct backlight_device *b)
433{
Tony Vroon3a407082008-12-31 18:19:59 +0000434 int ret;
Michael Karchere8549e22015-01-18 20:28:46 +0100435 if (b->props.power == FB_BLANK_POWERDOWN)
Tony Vroon3a407082008-12-31 18:19:59 +0000436 ret = call_fext_func(FUNC_BACKLIGHT, 0x1, 0x4, 0x3);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930437 else
Tony Vroon3a407082008-12-31 18:19:59 +0000438 ret = call_fext_func(FUNC_BACKLIGHT, 0x1, 0x4, 0x0);
439 if (ret != 0)
440 vdbg_printk(FUJLAPTOP_DBG_ERROR,
441 "Unable to adjust backlight power, error code %i\n",
442 ret);
443
444 if (use_alt_lcd_levels)
445 ret = set_lcd_level_alt(b->props.brightness);
446 else
447 ret = set_lcd_level(b->props.brightness);
448 if (ret != 0)
449 vdbg_printk(FUJLAPTOP_DBG_ERROR,
450 "Unable to adjust LCD brightness, error code %i\n",
451 ret);
452 return ret;
Jonathan Woithed0482532007-08-29 15:58:19 +0930453}
454
Lionel Debrouxacc24722010-11-16 14:14:02 +0100455static const struct backlight_ops fujitsubl_ops = {
Jonathan Woithed0482532007-08-29 15:58:19 +0930456 .get_brightness = bl_get_brightness,
457 .update_status = bl_update_status,
458};
459
Jonathan Woithe20b93732008-06-11 10:14:56 +0930460/* Platform LCD brightness device */
461
462static ssize_t
463show_max_brightness(struct device *dev,
464 struct device_attribute *attr, char *buf)
465{
466
467 int ret;
468
469 ret = get_max_brightness();
470 if (ret < 0)
471 return ret;
472
473 return sprintf(buf, "%i\n", ret);
474}
475
476static ssize_t
477show_brightness_changed(struct device *dev,
478 struct device_attribute *attr, char *buf)
479{
480
481 int ret;
482
483 ret = fujitsu->brightness_changed;
484 if (ret < 0)
485 return ret;
486
487 return sprintf(buf, "%i\n", ret);
488}
Jonathan Woithed0482532007-08-29 15:58:19 +0930489
490static ssize_t show_lcd_level(struct device *dev,
491 struct device_attribute *attr, char *buf)
492{
493
494 int ret;
495
Tony Vroonf87a1a52009-01-07 10:11:24 +0000496 ret = get_lcd_level();
Jonathan Woithed0482532007-08-29 15:58:19 +0930497 if (ret < 0)
498 return ret;
499
500 return sprintf(buf, "%i\n", ret);
501}
502
503static ssize_t store_lcd_level(struct device *dev,
504 struct device_attribute *attr, const char *buf,
505 size_t count)
506{
507
508 int level, ret;
509
510 if (sscanf(buf, "%i", &level) != 1
Jonathan Woithe20b93732008-06-11 10:14:56 +0930511 || (level < 0 || level >= fujitsu->max_brightness))
Jonathan Woithed0482532007-08-29 15:58:19 +0930512 return -EINVAL;
513
Jonathan Woithe20b93732008-06-11 10:14:56 +0930514 if (use_alt_lcd_levels)
515 ret = set_lcd_level_alt(level);
516 else
517 ret = set_lcd_level(level);
518 if (ret < 0)
519 return ret;
520
Tony Vroonf87a1a52009-01-07 10:11:24 +0000521 ret = get_lcd_level();
Jonathan Woithed0482532007-08-29 15:58:19 +0930522 if (ret < 0)
523 return ret;
524
525 return count;
526}
527
Jonathan Woithe20b93732008-06-11 10:14:56 +0930528static ssize_t
529ignore_store(struct device *dev,
530 struct device_attribute *attr, const char *buf, size_t count)
531{
532 return count;
533}
534
Tony Vroon3a407082008-12-31 18:19:59 +0000535static ssize_t
536show_lid_state(struct device *dev,
537 struct device_attribute *attr, char *buf)
538{
Tony Vroon4898c2b2009-02-02 11:11:10 +0000539 if (!(fujitsu_hotkey->rfkill_supported & 0x100))
Tony Vroon3a407082008-12-31 18:19:59 +0000540 return sprintf(buf, "unknown\n");
541 if (fujitsu_hotkey->rfkill_state & 0x100)
542 return sprintf(buf, "open\n");
543 else
544 return sprintf(buf, "closed\n");
545}
546
547static ssize_t
548show_dock_state(struct device *dev,
549 struct device_attribute *attr, char *buf)
550{
Tony Vroon4898c2b2009-02-02 11:11:10 +0000551 if (!(fujitsu_hotkey->rfkill_supported & 0x200))
Tony Vroon3a407082008-12-31 18:19:59 +0000552 return sprintf(buf, "unknown\n");
553 if (fujitsu_hotkey->rfkill_state & 0x200)
554 return sprintf(buf, "docked\n");
555 else
556 return sprintf(buf, "undocked\n");
557}
558
559static ssize_t
560show_radios_state(struct device *dev,
561 struct device_attribute *attr, char *buf)
562{
Tony Vroon4898c2b2009-02-02 11:11:10 +0000563 if (!(fujitsu_hotkey->rfkill_supported & 0x20))
Tony Vroon3a407082008-12-31 18:19:59 +0000564 return sprintf(buf, "unknown\n");
565 if (fujitsu_hotkey->rfkill_state & 0x20)
566 return sprintf(buf, "on\n");
567 else
568 return sprintf(buf, "killed\n");
569}
570
Jonathan Woithe20b93732008-06-11 10:14:56 +0930571static DEVICE_ATTR(max_brightness, 0444, show_max_brightness, ignore_store);
572static DEVICE_ATTR(brightness_changed, 0444, show_brightness_changed,
573 ignore_store);
Jonathan Woithed0482532007-08-29 15:58:19 +0930574static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level);
Tony Vroon3a407082008-12-31 18:19:59 +0000575static DEVICE_ATTR(lid, 0444, show_lid_state, ignore_store);
576static DEVICE_ATTR(dock, 0444, show_dock_state, ignore_store);
577static DEVICE_ATTR(radios, 0444, show_radios_state, ignore_store);
Jonathan Woithed0482532007-08-29 15:58:19 +0930578
579static struct attribute *fujitsupf_attributes[] = {
Jonathan Woithe20b93732008-06-11 10:14:56 +0930580 &dev_attr_brightness_changed.attr,
581 &dev_attr_max_brightness.attr,
Jonathan Woithed0482532007-08-29 15:58:19 +0930582 &dev_attr_lcd_level.attr,
Tony Vroon3a407082008-12-31 18:19:59 +0000583 &dev_attr_lid.attr,
584 &dev_attr_dock.attr,
585 &dev_attr_radios.attr,
Jonathan Woithed0482532007-08-29 15:58:19 +0930586 NULL
587};
588
589static struct attribute_group fujitsupf_attribute_group = {
590 .attrs = fujitsupf_attributes
591};
592
593static struct platform_driver fujitsupf_driver = {
594 .driver = {
595 .name = "fujitsu-laptop",
Jonathan Woithed0482532007-08-29 15:58:19 +0930596 }
597};
598
Mathias Krausefbe9b792014-07-16 19:43:11 +0200599static void __init dmi_check_cb_common(const struct dmi_system_id *id)
Jonathan Woithe20b93732008-06-11 10:14:56 +0930600{
Joe Perches77bad7c2011-03-29 15:21:39 -0700601 pr_info("Identified laptop model '%s'\n", id->ident);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930602 if (use_alt_lcd_levels == -1) {
Zhang Ruidd13b9a2013-09-03 08:32:03 +0800603 if (acpi_has_method(NULL,
604 "\\_SB.PCI0.LPCB.FJEX.SBL2"))
Tony Vroonf87a1a52009-01-07 10:11:24 +0000605 use_alt_lcd_levels = 1;
606 else
607 use_alt_lcd_levels = 0;
608 vdbg_printk(FUJLAPTOP_DBG_TRACE, "auto-detected usealt as "
609 "%i\n", use_alt_lcd_levels);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930610 }
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +0930611}
612
Mathias Krausefbe9b792014-07-16 19:43:11 +0200613static int __init dmi_check_cb_s6410(const struct dmi_system_id *id)
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +0930614{
615 dmi_check_cb_common(id);
616 fujitsu->keycode1 = KEY_SCREENLOCK; /* "Lock" */
617 fujitsu->keycode2 = KEY_HELP; /* "Mobility Center" */
Axel Lin80183a42010-07-20 15:19:40 -0700618 return 1;
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +0930619}
620
Mathias Krausefbe9b792014-07-16 19:43:11 +0200621static int __init dmi_check_cb_s6420(const struct dmi_system_id *id)
Tony Vroon56960b52008-11-09 04:20:05 +0000622{
623 dmi_check_cb_common(id);
624 fujitsu->keycode1 = KEY_SCREENLOCK; /* "Lock" */
625 fujitsu->keycode2 = KEY_HELP; /* "Mobility Center" */
Axel Lin80183a42010-07-20 15:19:40 -0700626 return 1;
Tony Vroon56960b52008-11-09 04:20:05 +0000627}
628
Mathias Krausefbe9b792014-07-16 19:43:11 +0200629static int __init dmi_check_cb_p8010(const struct dmi_system_id *id)
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +0930630{
631 dmi_check_cb_common(id);
632 fujitsu->keycode1 = KEY_HELP; /* "Support" */
633 fujitsu->keycode3 = KEY_SWITCHVIDEOMODE; /* "Presentation" */
634 fujitsu->keycode4 = KEY_WWW; /* "Internet" */
Axel Lin80183a42010-07-20 15:19:40 -0700635 return 1;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930636}
637
Mathias Krausefbe9b792014-07-16 19:43:11 +0200638static const struct dmi_system_id fujitsu_dmi_table[] __initconst = {
Jonathan Woithe20b93732008-06-11 10:14:56 +0930639 {
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +0930640 .ident = "Fujitsu Siemens S6410",
Jonathan Woithe20b93732008-06-11 10:14:56 +0930641 .matches = {
642 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
643 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S6410"),
644 },
645 .callback = dmi_check_cb_s6410},
Jonathan Woithed8196a92008-08-29 11:06:21 +0930646 {
Tony Vroon56960b52008-11-09 04:20:05 +0000647 .ident = "Fujitsu Siemens S6420",
648 .matches = {
649 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
650 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S6420"),
651 },
652 .callback = dmi_check_cb_s6420},
653 {
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +0930654 .ident = "Fujitsu LifeBook P8010",
Jonathan Woithed8196a92008-08-29 11:06:21 +0930655 .matches = {
656 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
657 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P8010"),
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +0930658 },
659 .callback = dmi_check_cb_p8010},
Jonathan Woithe20b93732008-06-11 10:14:56 +0930660 {}
661};
662
663/* ACPI device for LCD brightness control */
Jonathan Woithed0482532007-08-29 15:58:19 +0930664
Adrian Bunkb6f03ae2007-10-24 18:23:16 +0200665static int acpi_fujitsu_add(struct acpi_device *device)
Jonathan Woithed0482532007-08-29 15:58:19 +0930666{
Jonathan Woithed0482532007-08-29 15:58:19 +0930667 int state = 0;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930668 struct input_dev *input;
669 int error;
Jonathan Woithed0482532007-08-29 15:58:19 +0930670
671 if (!device)
672 return -EINVAL;
673
674 fujitsu->acpi_handle = device->handle;
675 sprintf(acpi_device_name(device), "%s", ACPI_FUJITSU_DEVICE_NAME);
676 sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
Pavel Machekdb89b4f2008-09-22 14:37:34 -0700677 device->driver_data = fujitsu;
Jonathan Woithed0482532007-08-29 15:58:19 +0930678
Jonathan Woithe20b93732008-06-11 10:14:56 +0930679 fujitsu->input = input = input_allocate_device();
680 if (!input) {
681 error = -ENOMEM;
Bjorn Helgaas700b6722009-04-07 15:37:16 +0000682 goto err_stop;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930683 }
684
685 snprintf(fujitsu->phys, sizeof(fujitsu->phys),
686 "%s/video/input0", acpi_device_hid(device));
687
688 input->name = acpi_device_name(device);
689 input->phys = fujitsu->phys;
690 input->id.bustype = BUS_HOST;
691 input->id.product = 0x06;
692 input->dev.parent = &device->dev;
693 input->evbit[0] = BIT(EV_KEY);
694 set_bit(KEY_BRIGHTNESSUP, input->keybit);
695 set_bit(KEY_BRIGHTNESSDOWN, input->keybit);
696 set_bit(KEY_UNKNOWN, input->keybit);
697
698 error = input_register_device(input);
699 if (error)
700 goto err_free_input_dev;
701
Julia Lawallb30bb892013-12-29 23:47:36 +0100702 error = acpi_bus_update_power(fujitsu->acpi_handle, &state);
703 if (error) {
Joe Perches77bad7c2011-03-29 15:21:39 -0700704 pr_err("Error reading power state\n");
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +0930705 goto err_unregister_input_dev;
Jonathan Woithed0482532007-08-29 15:58:19 +0930706 }
707
Joe Perches77bad7c2011-03-29 15:21:39 -0700708 pr_info("ACPI: %s [%s] (%s)\n",
Jonathan Woithed0482532007-08-29 15:58:19 +0930709 acpi_device_name(device), acpi_device_bid(device),
710 !device->power.state ? "on" : "off");
711
Jonathan Woithe20b93732008-06-11 10:14:56 +0930712 fujitsu->dev = device;
713
Zhang Ruidd13b9a2013-09-03 08:32:03 +0800714 if (acpi_has_method(device->handle, METHOD_NAME__INI)) {
Jonathan Woithe20b93732008-06-11 10:14:56 +0930715 vdbg_printk(FUJLAPTOP_DBG_INFO, "Invoking _INI\n");
716 if (ACPI_FAILURE
717 (acpi_evaluate_object
718 (device->handle, METHOD_NAME__INI, NULL, NULL)))
Joe Perches77bad7c2011-03-29 15:21:39 -0700719 pr_err("_INI Method failed\n");
Jonathan Woithe20b93732008-06-11 10:14:56 +0930720 }
721
722 /* do config (detect defaults) */
Jonathan Woithe20b93732008-06-11 10:14:56 +0930723 use_alt_lcd_levels = use_alt_lcd_levels == 1 ? 1 : 0;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930724 disable_brightness_adjust = disable_brightness_adjust == 1 ? 1 : 0;
725 vdbg_printk(FUJLAPTOP_DBG_INFO,
Tony Vroonf87a1a52009-01-07 10:11:24 +0000726 "config: [alt interface: %d], [adjust disable: %d]\n",
727 use_alt_lcd_levels, disable_brightness_adjust);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930728
729 if (get_max_brightness() <= 0)
730 fujitsu->max_brightness = FUJITSU_LCD_N_LEVELS;
Tony Vroonf87a1a52009-01-07 10:11:24 +0000731 get_lcd_level();
Jonathan Woithe20b93732008-06-11 10:14:56 +0930732
Julia Lawallb30bb892013-12-29 23:47:36 +0100733 return 0;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930734
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +0930735err_unregister_input_dev:
736 input_unregister_device(input);
Axel Lin8e4e2ef2010-07-20 15:19:34 -0700737 input = NULL;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930738err_free_input_dev:
739 input_free_device(input);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930740err_stop:
Julia Lawallb30bb892013-12-29 23:47:36 +0100741 return error;
Jonathan Woithed0482532007-08-29 15:58:19 +0930742}
743
Rafael J. Wysocki51fac832013-01-24 00:24:48 +0100744static int acpi_fujitsu_remove(struct acpi_device *device)
Jonathan Woithed0482532007-08-29 15:58:19 +0930745{
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +0930746 struct fujitsu_t *fujitsu = acpi_driver_data(device);
747 struct input_dev *input = fujitsu->input;
Jonathan Woithed0482532007-08-29 15:58:19 +0930748
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +0930749 input_unregister_device(input);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930750
Al Viro5cf83b92008-03-29 03:07:48 +0000751 fujitsu->acpi_handle = NULL;
Jonathan Woithed0482532007-08-29 15:58:19 +0930752
753 return 0;
754}
755
Jonathan Woithe20b93732008-06-11 10:14:56 +0930756/* Brightness notify */
757
Bjorn Helgaas700b6722009-04-07 15:37:16 +0000758static void acpi_fujitsu_notify(struct acpi_device *device, u32 event)
Jonathan Woithe20b93732008-06-11 10:14:56 +0930759{
760 struct input_dev *input;
761 int keycode;
762 int oldb, newb;
763
764 input = fujitsu->input;
765
766 switch (event) {
767 case ACPI_FUJITSU_NOTIFY_CODE1:
768 keycode = 0;
769 oldb = fujitsu->brightness_level;
Tony Vroonf87a1a52009-01-07 10:11:24 +0000770 get_lcd_level();
Jonathan Woithe20b93732008-06-11 10:14:56 +0930771 newb = fujitsu->brightness_level;
772
773 vdbg_printk(FUJLAPTOP_DBG_TRACE,
774 "brightness button event [%i -> %i (%i)]\n",
775 oldb, newb, fujitsu->brightness_changed);
776
Tony Vroonf87a1a52009-01-07 10:11:24 +0000777 if (oldb < newb) {
Jonathan Woithe20b93732008-06-11 10:14:56 +0930778 if (disable_brightness_adjust != 1) {
779 if (use_alt_lcd_levels)
780 set_lcd_level_alt(newb);
781 else
782 set_lcd_level(newb);
783 }
Tony Vroonf87a1a52009-01-07 10:11:24 +0000784 keycode = KEY_BRIGHTNESSUP;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930785 } else if (oldb > newb) {
786 if (disable_brightness_adjust != 1) {
787 if (use_alt_lcd_levels)
788 set_lcd_level_alt(newb);
789 else
790 set_lcd_level(newb);
791 }
Tony Vroonf87a1a52009-01-07 10:11:24 +0000792 keycode = KEY_BRIGHTNESSDOWN;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930793 }
794 break;
795 default:
796 keycode = KEY_UNKNOWN;
797 vdbg_printk(FUJLAPTOP_DBG_WARN,
798 "unsupported event [0x%x]\n", event);
799 break;
800 }
801
802 if (keycode != 0) {
803 input_report_key(input, keycode, 1);
804 input_sync(input);
805 input_report_key(input, keycode, 0);
806 input_sync(input);
807 }
Jonathan Woithe20b93732008-06-11 10:14:56 +0930808}
809
810/* ACPI device for hotkey handling */
811
812static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
813{
Jonathan Woithe20b93732008-06-11 10:14:56 +0930814 int result = 0;
815 int state = 0;
816 struct input_dev *input;
817 int error;
818 int i;
819
820 if (!device)
821 return -EINVAL;
822
823 fujitsu_hotkey->acpi_handle = device->handle;
824 sprintf(acpi_device_name(device), "%s",
825 ACPI_FUJITSU_HOTKEY_DEVICE_NAME);
826 sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
Pavel Machekdb89b4f2008-09-22 14:37:34 -0700827 device->driver_data = fujitsu_hotkey;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930828
Jonathan Woithe20b93732008-06-11 10:14:56 +0930829 /* kfifo */
830 spin_lock_init(&fujitsu_hotkey->fifo_lock);
Stefani Seibold45465482009-12-21 14:37:26 -0800831 error = kfifo_alloc(&fujitsu_hotkey->fifo, RINGBUFFERSIZE * sizeof(int),
Stefani Seiboldc1e13f22009-12-21 14:37:27 -0800832 GFP_KERNEL);
Stefani Seibold45465482009-12-21 14:37:26 -0800833 if (error) {
Joe Perches77bad7c2011-03-29 15:21:39 -0700834 pr_err("kfifo_alloc failed\n");
Jonathan Woithe20b93732008-06-11 10:14:56 +0930835 goto err_stop;
836 }
837
838 fujitsu_hotkey->input = input = input_allocate_device();
839 if (!input) {
840 error = -ENOMEM;
Bjorn Helgaasb4ec0272009-04-07 15:37:22 +0000841 goto err_free_fifo;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930842 }
843
844 snprintf(fujitsu_hotkey->phys, sizeof(fujitsu_hotkey->phys),
845 "%s/video/input0", acpi_device_hid(device));
846
847 input->name = acpi_device_name(device);
848 input->phys = fujitsu_hotkey->phys;
849 input->id.bustype = BUS_HOST;
850 input->id.product = 0x06;
851 input->dev.parent = &device->dev;
Tony Vroon3a407082008-12-31 18:19:59 +0000852
853 set_bit(EV_KEY, input->evbit);
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +0930854 set_bit(fujitsu->keycode1, input->keybit);
855 set_bit(fujitsu->keycode2, input->keybit);
856 set_bit(fujitsu->keycode3, input->keybit);
857 set_bit(fujitsu->keycode4, input->keybit);
Michał Kępieńb5df36c2016-02-24 14:23:32 +0100858 set_bit(fujitsu->keycode5, input->keybit);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930859 set_bit(KEY_UNKNOWN, input->keybit);
860
861 error = input_register_device(input);
862 if (error)
863 goto err_free_input_dev;
864
Julia Lawallb30bb892013-12-29 23:47:36 +0100865 error = acpi_bus_update_power(fujitsu_hotkey->acpi_handle, &state);
866 if (error) {
Joe Perches77bad7c2011-03-29 15:21:39 -0700867 pr_err("Error reading power state\n");
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +0930868 goto err_unregister_input_dev;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930869 }
870
Joe Perches77bad7c2011-03-29 15:21:39 -0700871 pr_info("ACPI: %s [%s] (%s)\n",
872 acpi_device_name(device), acpi_device_bid(device),
873 !device->power.state ? "on" : "off");
Jonathan Woithe20b93732008-06-11 10:14:56 +0930874
875 fujitsu_hotkey->dev = device;
876
Zhang Ruidd13b9a2013-09-03 08:32:03 +0800877 if (acpi_has_method(device->handle, METHOD_NAME__INI)) {
Jonathan Woithe20b93732008-06-11 10:14:56 +0930878 vdbg_printk(FUJLAPTOP_DBG_INFO, "Invoking _INI\n");
879 if (ACPI_FAILURE
880 (acpi_evaluate_object
881 (device->handle, METHOD_NAME__INI, NULL, NULL)))
Joe Perches77bad7c2011-03-29 15:21:39 -0700882 pr_err("_INI Method failed\n");
Jonathan Woithe20b93732008-06-11 10:14:56 +0930883 }
884
Tony Vroon3a407082008-12-31 18:19:59 +0000885 i = 0;
886 while (call_fext_func(FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0
887 && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE)
888 ; /* No action, result is discarded */
Jonathan Woithe20b93732008-06-11 10:14:56 +0930889 vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i);
890
Tony Vroon4898c2b2009-02-02 11:11:10 +0000891 fujitsu_hotkey->rfkill_supported =
892 call_fext_func(FUNC_RFKILL, 0x0, 0x0, 0x0);
893
894 /* Make sure our bitmask of supported functions is cleared if the
895 RFKILL function block is not implemented, like on the S7020. */
896 if (fujitsu_hotkey->rfkill_supported == UNSUPPORTED_CMD)
897 fujitsu_hotkey->rfkill_supported = 0;
898
899 if (fujitsu_hotkey->rfkill_supported)
900 fujitsu_hotkey->rfkill_state =
901 call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
Tony Vroon3a407082008-12-31 18:19:59 +0000902
903 /* Suspect this is a keymap of the application panel, print it */
Joe Perches77bad7c2011-03-29 15:21:39 -0700904 pr_info("BTNI: [0x%x]\n", call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0));
Tony Vroon3a407082008-12-31 18:19:59 +0000905
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +0930906#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
Tony Vroon3a407082008-12-31 18:19:59 +0000907 if (call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) {
908 result = led_classdev_register(&fujitsu->pf_device->dev,
909 &logolamp_led);
910 if (result == 0) {
911 fujitsu_hotkey->logolamp_registered = 1;
912 } else {
Joe Perches77bad7c2011-03-29 15:21:39 -0700913 pr_err("Could not register LED handler for logo lamp, error %i\n",
914 result);
Tony Vroon3a407082008-12-31 18:19:59 +0000915 }
916 }
917
918 if ((call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & KEYBOARD_LAMPS) &&
919 (call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0) == 0x0)) {
920 result = led_classdev_register(&fujitsu->pf_device->dev,
921 &kblamps_led);
922 if (result == 0) {
923 fujitsu_hotkey->kblamps_registered = 1;
924 } else {
Joe Perches77bad7c2011-03-29 15:21:39 -0700925 pr_err("Could not register LED handler for keyboard lamps, error %i\n",
926 result);
Tony Vroon3a407082008-12-31 18:19:59 +0000927 }
928 }
Michał Kępień4f625682016-04-12 22:06:34 +0930929
930 /*
931 * BTNI bit 24 seems to indicate the presence of a radio toggle
932 * button in place of a slide switch, and all such machines appear
933 * to also have an RF LED. Therefore use bit 24 as an indicator
934 * that an RF LED is present.
935 */
936 if (call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0) & BIT(24)) {
937 result = led_classdev_register(&fujitsu->pf_device->dev,
938 &radio_led);
939 if (result == 0) {
940 fujitsu_hotkey->radio_led_registered = 1;
941 } else {
942 pr_err("Could not register LED handler for radio LED, error %i\n",
943 result);
944 }
945 }
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +0930946#endif
Tony Vroon3a407082008-12-31 18:19:59 +0000947
Jonathan Woithe20b93732008-06-11 10:14:56 +0930948 return result;
949
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +0930950err_unregister_input_dev:
951 input_unregister_device(input);
Axel Lin8e4e2ef2010-07-20 15:19:34 -0700952 input = NULL;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930953err_free_input_dev:
954 input_free_device(input);
Bjorn Helgaasb4ec0272009-04-07 15:37:22 +0000955err_free_fifo:
Stefani Seibold45465482009-12-21 14:37:26 -0800956 kfifo_free(&fujitsu_hotkey->fifo);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930957err_stop:
Julia Lawallb30bb892013-12-29 23:47:36 +0100958 return error;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930959}
960
Rafael J. Wysocki51fac832013-01-24 00:24:48 +0100961static int acpi_fujitsu_hotkey_remove(struct acpi_device *device)
Jonathan Woithe20b93732008-06-11 10:14:56 +0930962{
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +0930963 struct fujitsu_hotkey_t *fujitsu_hotkey = acpi_driver_data(device);
964 struct input_dev *input = fujitsu_hotkey->input;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930965
Jonathan Woithe29062062009-10-08 13:19:12 +0930966#if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +0930967 if (fujitsu_hotkey->logolamp_registered)
968 led_classdev_unregister(&logolamp_led);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930969
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +0930970 if (fujitsu_hotkey->kblamps_registered)
971 led_classdev_unregister(&kblamps_led);
Michał Kępień4f625682016-04-12 22:06:34 +0930972
973 if (fujitsu_hotkey->radio_led_registered)
974 led_classdev_unregister(&radio_led);
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +0930975#endif
Jonathan Woithe20b93732008-06-11 10:14:56 +0930976
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +0930977 input_unregister_device(input);
978
Stefani Seibold45465482009-12-21 14:37:26 -0800979 kfifo_free(&fujitsu_hotkey->fifo);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930980
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +0930981 fujitsu_hotkey->acpi_handle = NULL;
982
Jonathan Woithe20b93732008-06-11 10:14:56 +0930983 return 0;
984}
985
Bjorn Helgaasb4ec0272009-04-07 15:37:22 +0000986static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event)
Jonathan Woithe20b93732008-06-11 10:14:56 +0930987{
988 struct input_dev *input;
989 int keycode, keycode_r;
990 unsigned int irb = 1;
991 int i, status;
992
993 input = fujitsu_hotkey->input;
994
Tony Vroon4898c2b2009-02-02 11:11:10 +0000995 if (fujitsu_hotkey->rfkill_supported)
996 fujitsu_hotkey->rfkill_state =
997 call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930998
999 switch (event) {
1000 case ACPI_FUJITSU_NOTIFY_CODE1:
1001 i = 0;
Tony Vroon3a407082008-12-31 18:19:59 +00001002 while ((irb =
1003 call_fext_func(FUNC_BUTTONS, 0x1, 0x0, 0x0)) != 0
1004 && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) {
Jonathan Woithe20b93732008-06-11 10:14:56 +09301005 switch (irb & 0x4ff) {
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +09301006 case KEY1_CODE:
1007 keycode = fujitsu->keycode1;
Jonathan Woithe20b93732008-06-11 10:14:56 +09301008 break;
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +09301009 case KEY2_CODE:
1010 keycode = fujitsu->keycode2;
Jonathan Woithe20b93732008-06-11 10:14:56 +09301011 break;
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +09301012 case KEY3_CODE:
1013 keycode = fujitsu->keycode3;
Jonathan Woithe20b93732008-06-11 10:14:56 +09301014 break;
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +09301015 case KEY4_CODE:
1016 keycode = fujitsu->keycode4;
Jonathan Woithe20b93732008-06-11 10:14:56 +09301017 break;
Michał Kępieńb5df36c2016-02-24 14:23:32 +01001018 case KEY5_CODE:
1019 keycode = fujitsu->keycode5;
1020 break;
Jonathan Woithe20b93732008-06-11 10:14:56 +09301021 case 0:
1022 keycode = 0;
1023 break;
1024 default:
1025 vdbg_printk(FUJLAPTOP_DBG_WARN,
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +09301026 "Unknown GIRB result [%x]\n", irb);
Jonathan Woithe20b93732008-06-11 10:14:56 +09301027 keycode = -1;
1028 break;
1029 }
1030 if (keycode > 0) {
1031 vdbg_printk(FUJLAPTOP_DBG_TRACE,
1032 "Push keycode into ringbuffer [%d]\n",
1033 keycode);
Stefani Seibold7acd72e2009-12-21 14:37:28 -08001034 status = kfifo_in_locked(&fujitsu_hotkey->fifo,
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +09301035 (unsigned char *)&keycode,
Stefani Seiboldc1e13f22009-12-21 14:37:27 -08001036 sizeof(keycode),
1037 &fujitsu_hotkey->fifo_lock);
Jonathan Woithe20b93732008-06-11 10:14:56 +09301038 if (status != sizeof(keycode)) {
1039 vdbg_printk(FUJLAPTOP_DBG_WARN,
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +09301040 "Could not push keycode [0x%x]\n",
1041 keycode);
Jonathan Woithe20b93732008-06-11 10:14:56 +09301042 } else {
1043 input_report_key(input, keycode, 1);
1044 input_sync(input);
1045 }
1046 } else if (keycode == 0) {
1047 while ((status =
Stefani Seibold7acd72e2009-12-21 14:37:28 -08001048 kfifo_out_locked(
Stefani Seiboldc1e13f22009-12-21 14:37:27 -08001049 &fujitsu_hotkey->fifo,
1050 (unsigned char *) &keycode_r,
1051 sizeof(keycode_r),
1052 &fujitsu_hotkey->fifo_lock))
1053 == sizeof(keycode_r)) {
Jonathan Woithe20b93732008-06-11 10:14:56 +09301054 input_report_key(input, keycode_r, 0);
1055 input_sync(input);
1056 vdbg_printk(FUJLAPTOP_DBG_TRACE,
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +09301057 "Pop keycode from ringbuffer [%d]\n",
1058 keycode_r);
Jonathan Woithe20b93732008-06-11 10:14:56 +09301059 }
1060 }
1061 }
1062
1063 break;
1064 default:
1065 keycode = KEY_UNKNOWN;
1066 vdbg_printk(FUJLAPTOP_DBG_WARN,
1067 "Unsupported event [0x%x]\n", event);
1068 input_report_key(input, keycode, 1);
1069 input_sync(input);
1070 input_report_key(input, keycode, 0);
1071 input_sync(input);
1072 break;
1073 }
Jonathan Woithe20b93732008-06-11 10:14:56 +09301074}
1075
1076/* Initialization */
1077
Jonathan Woithed0482532007-08-29 15:58:19 +09301078static const struct acpi_device_id fujitsu_device_ids[] = {
1079 {ACPI_FUJITSU_HID, 0},
1080 {"", 0},
1081};
1082
1083static struct acpi_driver acpi_fujitsu_driver = {
1084 .name = ACPI_FUJITSU_DRIVER_NAME,
1085 .class = ACPI_FUJITSU_CLASS,
1086 .ids = fujitsu_device_ids,
1087 .ops = {
1088 .add = acpi_fujitsu_add,
1089 .remove = acpi_fujitsu_remove,
Bjorn Helgaas700b6722009-04-07 15:37:16 +00001090 .notify = acpi_fujitsu_notify,
Jonathan Woithed0482532007-08-29 15:58:19 +09301091 },
1092};
1093
Jonathan Woithe20b93732008-06-11 10:14:56 +09301094static const struct acpi_device_id fujitsu_hotkey_device_ids[] = {
1095 {ACPI_FUJITSU_HOTKEY_HID, 0},
1096 {"", 0},
1097};
1098
1099static struct acpi_driver acpi_fujitsu_hotkey_driver = {
1100 .name = ACPI_FUJITSU_HOTKEY_DRIVER_NAME,
1101 .class = ACPI_FUJITSU_CLASS,
1102 .ids = fujitsu_hotkey_device_ids,
1103 .ops = {
1104 .add = acpi_fujitsu_hotkey_add,
1105 .remove = acpi_fujitsu_hotkey_remove,
Bjorn Helgaasb4ec0272009-04-07 15:37:22 +00001106 .notify = acpi_fujitsu_hotkey_notify,
Jonathan Woithe20b93732008-06-11 10:14:56 +09301107 },
1108};
Jonathan Woithed0482532007-08-29 15:58:19 +09301109
Zhang Rui49901412014-09-09 00:21:59 +02001110static const struct acpi_device_id fujitsu_ids[] __used = {
1111 {ACPI_FUJITSU_HID, 0},
1112 {ACPI_FUJITSU_HOTKEY_HID, 0},
1113 {"", 0}
1114};
1115MODULE_DEVICE_TABLE(acpi, fujitsu_ids);
1116
Jonathan Woithed0482532007-08-29 15:58:19 +09301117static int __init fujitsu_init(void)
1118{
Jonathan Woithe20b93732008-06-11 10:14:56 +09301119 int ret, result, max_brightness;
Jonathan Woithed0482532007-08-29 15:58:19 +09301120
1121 if (acpi_disabled)
1122 return -ENODEV;
1123
Julia Lawall6c75dd02010-05-13 22:06:20 +02001124 fujitsu = kzalloc(sizeof(struct fujitsu_t), GFP_KERNEL);
Jonathan Woithed0482532007-08-29 15:58:19 +09301125 if (!fujitsu)
1126 return -ENOMEM;
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +09301127 fujitsu->keycode1 = KEY_PROG1;
1128 fujitsu->keycode2 = KEY_PROG2;
1129 fujitsu->keycode3 = KEY_PROG3;
1130 fujitsu->keycode4 = KEY_PROG4;
Michał Kępieńb5df36c2016-02-24 14:23:32 +01001131 fujitsu->keycode5 = KEY_RFKILL;
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +09301132 dmi_check_system(fujitsu_dmi_table);
Jonathan Woithed0482532007-08-29 15:58:19 +09301133
1134 result = acpi_bus_register_driver(&acpi_fujitsu_driver);
1135 if (result < 0) {
1136 ret = -ENODEV;
1137 goto fail_acpi;
1138 }
1139
Jonathan Woithed0482532007-08-29 15:58:19 +09301140 /* Register platform stuff */
1141
1142 fujitsu->pf_device = platform_device_alloc("fujitsu-laptop", -1);
1143 if (!fujitsu->pf_device) {
1144 ret = -ENOMEM;
1145 goto fail_platform_driver;
1146 }
1147
1148 ret = platform_device_add(fujitsu->pf_device);
1149 if (ret)
1150 goto fail_platform_device1;
1151
1152 ret =
1153 sysfs_create_group(&fujitsu->pf_device->dev.kobj,
1154 &fujitsupf_attribute_group);
1155 if (ret)
1156 goto fail_platform_device2;
1157
Jonathan Woithe20b93732008-06-11 10:14:56 +09301158 /* Register backlight stuff */
1159
Hans de Goede413226f2015-06-16 16:28:03 +02001160 if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
Matthew Garretta19a6ee2010-02-17 16:39:44 -05001161 struct backlight_properties props;
1162
1163 memset(&props, 0, sizeof(struct backlight_properties));
1164 max_brightness = fujitsu->max_brightness;
Matthew Garrettbb7ca742011-03-22 16:30:21 -07001165 props.type = BACKLIGHT_PLATFORM;
Matthew Garretta19a6ee2010-02-17 16:39:44 -05001166 props.max_brightness = max_brightness - 1;
1167 fujitsu->bl_device = backlight_device_register("fujitsu-laptop",
1168 NULL, NULL,
1169 &fujitsubl_ops,
1170 &props);
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +09301171 if (IS_ERR(fujitsu->bl_device)) {
1172 ret = PTR_ERR(fujitsu->bl_device);
1173 fujitsu->bl_device = NULL;
1174 goto fail_sysfs_group;
1175 }
Thomas Renninger7d5c89a2008-08-01 17:38:00 +02001176 fujitsu->bl_device->props.brightness = fujitsu->brightness_level;
1177 }
Jonathan Woithe20b93732008-06-11 10:14:56 +09301178
1179 ret = platform_driver_register(&fujitsupf_driver);
1180 if (ret)
1181 goto fail_backlight;
1182
1183 /* Register hotkey driver */
1184
Julia Lawall6c75dd02010-05-13 22:06:20 +02001185 fujitsu_hotkey = kzalloc(sizeof(struct fujitsu_hotkey_t), GFP_KERNEL);
Jonathan Woithe20b93732008-06-11 10:14:56 +09301186 if (!fujitsu_hotkey) {
1187 ret = -ENOMEM;
1188 goto fail_hotkey;
1189 }
Jonathan Woithe20b93732008-06-11 10:14:56 +09301190
1191 result = acpi_bus_register_driver(&acpi_fujitsu_hotkey_driver);
1192 if (result < 0) {
1193 ret = -ENODEV;
1194 goto fail_hotkey1;
1195 }
1196
Tony Vroon3a407082008-12-31 18:19:59 +00001197 /* Sync backlight power status (needs FUJ02E3 device, hence deferred) */
Hans de Goede413226f2015-06-16 16:28:03 +02001198 if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
Tony Vroon3a407082008-12-31 18:19:59 +00001199 if (call_fext_func(FUNC_BACKLIGHT, 0x2, 0x4, 0x0) == 3)
Michael Karchere8549e22015-01-18 20:28:46 +01001200 fujitsu->bl_device->props.power = FB_BLANK_POWERDOWN;
Tony Vroon3a407082008-12-31 18:19:59 +00001201 else
Michael Karchere8549e22015-01-18 20:28:46 +01001202 fujitsu->bl_device->props.power = FB_BLANK_UNBLANK;
Tony Vroon3a407082008-12-31 18:19:59 +00001203 }
1204
Joe Perches77bad7c2011-03-29 15:21:39 -07001205 pr_info("driver " FUJITSU_DRIVER_VERSION " successfully loaded\n");
Jonathan Woithed0482532007-08-29 15:58:19 +09301206
1207 return 0;
1208
Jonathan Woithe20b93732008-06-11 10:14:56 +09301209fail_hotkey1:
Jonathan Woithe20b93732008-06-11 10:14:56 +09301210 kfree(fujitsu_hotkey);
Jonathan Woithe20b93732008-06-11 10:14:56 +09301211fail_hotkey:
Jonathan Woithed0482532007-08-29 15:58:19 +09301212 platform_driver_unregister(&fujitsupf_driver);
Jonathan Woithe20b93732008-06-11 10:14:56 +09301213fail_backlight:
Markus Elfring00981812014-11-24 20:30:29 +01001214 backlight_device_unregister(fujitsu->bl_device);
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +09301215fail_sysfs_group:
1216 sysfs_remove_group(&fujitsu->pf_device->dev.kobj,
1217 &fujitsupf_attribute_group);
Jonathan Woithe20b93732008-06-11 10:14:56 +09301218fail_platform_device2:
Jonathan Woithe20b93732008-06-11 10:14:56 +09301219 platform_device_del(fujitsu->pf_device);
Jonathan Woithe20b93732008-06-11 10:14:56 +09301220fail_platform_device1:
Jonathan Woithe20b93732008-06-11 10:14:56 +09301221 platform_device_put(fujitsu->pf_device);
Jonathan Woithe20b93732008-06-11 10:14:56 +09301222fail_platform_driver:
Jonathan Woithe20b93732008-06-11 10:14:56 +09301223 acpi_bus_unregister_driver(&acpi_fujitsu_driver);
Jonathan Woithe20b93732008-06-11 10:14:56 +09301224fail_acpi:
Jonathan Woithed0482532007-08-29 15:58:19 +09301225 kfree(fujitsu);
1226
1227 return ret;
1228}
1229
1230static void __exit fujitsu_cleanup(void)
1231{
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +09301232 acpi_bus_unregister_driver(&acpi_fujitsu_hotkey_driver);
Tony Vroon3a407082008-12-31 18:19:59 +00001233
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +09301234 kfree(fujitsu_hotkey);
1235
1236 platform_driver_unregister(&fujitsupf_driver);
1237
Markus Elfring00981812014-11-24 20:30:29 +01001238 backlight_device_unregister(fujitsu->bl_device);
Tony Vroon3a407082008-12-31 18:19:59 +00001239
Jonathan Woithed0482532007-08-29 15:58:19 +09301240 sysfs_remove_group(&fujitsu->pf_device->dev.kobj,
1241 &fujitsupf_attribute_group);
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +09301242
Jonathan Woithed0482532007-08-29 15:58:19 +09301243 platform_device_unregister(fujitsu->pf_device);
Jonathan Woithed0482532007-08-29 15:58:19 +09301244
1245 acpi_bus_unregister_driver(&acpi_fujitsu_driver);
1246
1247 kfree(fujitsu);
1248
Joe Perches77bad7c2011-03-29 15:21:39 -07001249 pr_info("driver unloaded\n");
Jonathan Woithed0482532007-08-29 15:58:19 +09301250}
1251
1252module_init(fujitsu_init);
1253module_exit(fujitsu_cleanup);
1254
Jonathan Woithe20b93732008-06-11 10:14:56 +09301255module_param(use_alt_lcd_levels, uint, 0644);
1256MODULE_PARM_DESC(use_alt_lcd_levels,
1257 "Use alternative interface for lcd_levels (needed for Lifebook s6410).");
Jonathan Woithe20b93732008-06-11 10:14:56 +09301258module_param(disable_brightness_adjust, uint, 0644);
1259MODULE_PARM_DESC(disable_brightness_adjust, "Disable brightness adjustment .");
1260#ifdef CONFIG_FUJITSU_LAPTOP_DEBUG
1261module_param_named(debug, dbg_level, uint, 0644);
1262MODULE_PARM_DESC(debug, "Sets debug level bit-mask");
1263#endif
1264
Tony Vroon3a407082008-12-31 18:19:59 +00001265MODULE_AUTHOR("Jonathan Woithe, Peter Gruber, Tony Vroon");
Jonathan Woithed0482532007-08-29 15:58:19 +09301266MODULE_DESCRIPTION("Fujitsu laptop extras support");
1267MODULE_VERSION(FUJITSU_DRIVER_VERSION);
1268MODULE_LICENSE("GPL");
Dan Williamsa361a822008-06-05 22:46:08 -07001269
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +09301270MODULE_ALIAS("dmi:*:svnFUJITSUSIEMENS:*:pvr:rvnFUJITSU:rnFJNB1D3:*:cvrS6410:*");
Tony Vroon3a407082008-12-31 18:19:59 +00001271MODULE_ALIAS("dmi:*:svnFUJITSUSIEMENS:*:pvr:rvnFUJITSU:rnFJNB1E6:*:cvrS6420:*");
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +09301272MODULE_ALIAS("dmi:*:svnFUJITSU:*:pvr:rvnFUJITSU:rnFJNB19C:*:cvrS7020:*");