blob: 2cfbd3fa5136002362bdc558c14d00e40ed56e22 [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 *
Michał Kępień78b26022017-03-14 11:26:27 +010035 * This driver implements a vendor-specific backlight control interface for
36 * Fujitsu laptops and provides support for hotkeys present on certain Fujitsu
37 * laptops.
Jonathan Woithe20b93732008-06-11 10:14:56 +093038 *
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +093039 * This driver has been tested on a Fujitsu Lifebook S6410, S7020 and
40 * P8010. It should work on most P-series and S-series Lifebooks, but
41 * YMMV.
Jonathan Woithe20b93732008-06-11 10:14:56 +093042 *
43 * The module parameter use_alt_lcd_levels switches between different ACPI
44 * brightness controls which are used by different Fujitsu laptops. In most
45 * cases the correct method is automatically detected. "use_alt_lcd_levels=1"
46 * is applicable for a Fujitsu Lifebook S6410 if autodetection fails.
47 *
Jonathan Woithed0482532007-08-29 15:58:19 +093048 */
49
Joe Perches77bad7c2011-03-29 15:21:39 -070050#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
51
Jonathan Woithed0482532007-08-29 15:58:19 +093052#include <linux/module.h>
53#include <linux/kernel.h>
54#include <linux/init.h>
55#include <linux/acpi.h>
56#include <linux/dmi.h>
57#include <linux/backlight.h>
Michael Karchere8549e22015-01-18 20:28:46 +010058#include <linux/fb.h>
Jonathan Woithe20b93732008-06-11 10:14:56 +093059#include <linux/input.h>
Michał Kępieńf2252672017-03-20 10:32:19 +010060#include <linux/input/sparse-keymap.h>
Jonathan Woithe20b93732008-06-11 10:14:56 +093061#include <linux/kfifo.h>
Michał Kępieńd89bcc82017-04-07 15:07:08 +020062#include <linux/leds.h>
Jonathan Woithed0482532007-08-29 15:58:19 +093063#include <linux/platform_device.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090064#include <linux/slab.h>
Hans de Goede413226f2015-06-16 16:28:03 +020065#include <acpi/video.h>
Jonathan Woithed0482532007-08-29 15:58:19 +093066
Jonathan Woithe84a6ce22009-07-31 18:16:59 +093067#define FUJITSU_DRIVER_VERSION "0.6.0"
Jonathan Woithed0482532007-08-29 15:58:19 +093068
69#define FUJITSU_LCD_N_LEVELS 8
70
Alan Jenkins9fc5cf62017-02-08 14:46:24 +010071#define ACPI_FUJITSU_CLASS "fujitsu"
72#define ACPI_FUJITSU_BL_HID "FUJ02B1"
73#define ACPI_FUJITSU_BL_DRIVER_NAME "Fujitsu laptop FUJ02B1 ACPI brightness driver"
74#define ACPI_FUJITSU_BL_DEVICE_NAME "Fujitsu FUJ02B1"
Alan Jenkins6942eab2017-02-08 14:46:25 +010075#define ACPI_FUJITSU_LAPTOP_HID "FUJ02E3"
76#define ACPI_FUJITSU_LAPTOP_DRIVER_NAME "Fujitsu laptop FUJ02E3 ACPI hotkeys driver"
77#define ACPI_FUJITSU_LAPTOP_DEVICE_NAME "Fujitsu FUJ02E3"
Jonathan Woithed0482532007-08-29 15:58:19 +093078
Jonathan Woithe20b93732008-06-11 10:14:56 +093079#define ACPI_FUJITSU_NOTIFY_CODE1 0x80
80
Tony Vroon3a407082008-12-31 18:19:59 +000081/* FUNC interface - command values */
Alan Jenkins8ef27bd2017-02-08 14:46:27 +010082#define FUNC_FLAGS 0x1000
Tony Vroon3a407082008-12-31 18:19:59 +000083#define FUNC_LEDS 0x1001
84#define FUNC_BUTTONS 0x1002
85#define FUNC_BACKLIGHT 0x1004
86
87/* FUNC interface - responses */
88#define UNSUPPORTED_CMD 0x80000000
89
Alan Jenkinsd3dd4482017-02-08 14:46:28 +010090/* FUNC interface - status flags */
91#define FLAG_RFKILL 0x020
92#define FLAG_LID 0x100
93#define FLAG_DOCK 0x200
94
Tony Vroon3a407082008-12-31 18:19:59 +000095/* FUNC interface - LED control */
96#define FUNC_LED_OFF 0x1
97#define FUNC_LED_ON 0x30001
98#define KEYBOARD_LAMPS 0x100
99#define LOGOLAMP_POWERON 0x2000
100#define LOGOLAMP_ALWAYS 0x4000
Michał Kępień4f625682016-04-12 22:06:34 +0930101#define RADIO_LED_ON 0x20
Matej Gromad6b88f62016-06-21 10:09:21 +0200102#define ECO_LED 0x10000
103#define ECO_LED_ON 0x80000
Tony Vroon3a407082008-12-31 18:19:59 +0000104
Jonathan Woithe20b93732008-06-11 10:14:56 +0930105/* Hotkey details */
Jonathan Woithe0e6a66e2008-10-09 13:44:40 +0930106#define KEY1_CODE 0x410 /* codes for the keys in the GIRB register */
107#define KEY2_CODE 0x411
108#define KEY3_CODE 0x412
109#define KEY4_CODE 0x413
Michał Kępieńb5df36c2016-02-24 14:23:32 +0100110#define KEY5_CODE 0x420
Jonathan Woithe20b93732008-06-11 10:14:56 +0930111
112#define MAX_HOTKEY_RINGBUFFER_SIZE 100
113#define RINGBUFFERSIZE 40
114
Jonathan Woithe20b93732008-06-11 10:14:56 +0930115/* Device controlling the backlight and associated keys */
Alan Jenkins9fc5cf62017-02-08 14:46:24 +0100116struct fujitsu_bl {
Jonathan Woithe20b93732008-06-11 10:14:56 +0930117 struct input_dev *input;
118 char phys[32];
Jonathan Woithed0482532007-08-29 15:58:19 +0930119 struct backlight_device *bl_device;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930120 unsigned int max_brightness;
Jonathan Woithed0482532007-08-29 15:58:19 +0930121 unsigned int brightness_level;
122};
123
Alan Jenkins9fc5cf62017-02-08 14:46:24 +0100124static struct fujitsu_bl *fujitsu_bl;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930125static int use_alt_lcd_levels = -1;
Michał Kępieńb4bb0cf2017-04-05 08:49:06 +0200126static bool disable_brightness_adjust;
Jonathan Woithed0482532007-08-29 15:58:19 +0930127
Alan Jenkins6942eab2017-02-08 14:46:25 +0100128/* Device used to access hotkeys and other features on the laptop */
129struct fujitsu_laptop {
Jonathan Woithe20b93732008-06-11 10:14:56 +0930130 struct input_dev *input;
131 char phys[32];
132 struct platform_device *pf_device;
Stefani Seibold45465482009-12-21 14:37:26 -0800133 struct kfifo fifo;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930134 spinlock_t fifo_lock;
Alan Jenkins8ef27bd2017-02-08 14:46:27 +0100135 int flags_supported;
136 int flags_state;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930137};
138
Michał Kępieńca0d9ea2017-05-19 09:44:45 +0200139static struct acpi_device *fext;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930140
Tony Vroon3a407082008-12-31 18:19:59 +0000141/* Fujitsu ACPI interface function */
142
Michał Kępień84631e02017-05-19 09:44:46 +0200143static int call_fext_func(struct acpi_device *device,
144 int func, int op, int feature, int state)
Tony Vroon3a407082008-12-31 18:19:59 +0000145{
Tony Vroon3a407082008-12-31 18:19:59 +0000146 union acpi_object params[4] = {
Michał Kępieńf68e4922017-04-03 11:38:59 +0200147 { .integer.type = ACPI_TYPE_INTEGER, .integer.value = func },
148 { .integer.type = ACPI_TYPE_INTEGER, .integer.value = op },
149 { .integer.type = ACPI_TYPE_INTEGER, .integer.value = feature },
150 { .integer.type = ACPI_TYPE_INTEGER, .integer.value = state }
Tony Vroon3a407082008-12-31 18:19:59 +0000151 };
Michał Kępieńb1066412017-04-03 11:38:57 +0200152 struct acpi_object_list arg_list = { 4, params };
Zhang Rui29c29a92013-09-03 08:32:12 +0800153 unsigned long long value;
Michał Kępieńb1066412017-04-03 11:38:57 +0200154 acpi_status status;
Tony Vroon3a407082008-12-31 18:19:59 +0000155
Michał Kępień84631e02017-05-19 09:44:46 +0200156 status = acpi_evaluate_integer(device->handle, "FUNC", &arg_list,
157 &value);
Tony Vroon3a407082008-12-31 18:19:59 +0000158 if (ACPI_FAILURE(status)) {
Michał Kępieńeee77da12017-06-16 06:40:58 +0200159 acpi_handle_err(device->handle, "Failed to evaluate FUNC\n");
Tony Vroon3a407082008-12-31 18:19:59 +0000160 return -ENODEV;
161 }
162
Michał Kępieńeee77da12017-06-16 06:40:58 +0200163 acpi_handle_debug(device->handle,
164 "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) returned 0x%x\n",
165 func, op, feature, state, (int)value);
Zhang Rui29c29a92013-09-03 08:32:12 +0800166 return value;
Tony Vroon3a407082008-12-31 18:19:59 +0000167}
168
Jonathan Woithe20b93732008-06-11 10:14:56 +0930169/* Hardware access for LCD brightness control */
Jonathan Woithed0482532007-08-29 15:58:19 +0930170
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200171static int set_lcd_level(struct acpi_device *device, int level)
Jonathan Woithed0482532007-08-29 15:58:19 +0930172{
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200173 struct fujitsu_bl *priv = acpi_driver_data(device);
Michał Kępieńa8779c32017-04-05 08:49:03 +0200174 acpi_status status;
Michał Kępieńe32c50b2017-04-05 08:49:02 +0200175 char *method;
Jonathan Woithed0482532007-08-29 15:58:19 +0930176
Michał Kępieńe32c50b2017-04-05 08:49:02 +0200177 switch (use_alt_lcd_levels) {
Michał Kępieńe06e4832017-04-05 08:49:05 +0200178 case -1:
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200179 if (acpi_has_method(device->handle, "SBL2"))
Michał Kępieńe06e4832017-04-05 08:49:05 +0200180 method = "SBL2";
181 else
182 method = "SBLL";
183 break;
Michał Kępieńe32c50b2017-04-05 08:49:02 +0200184 case 1:
185 method = "SBL2";
186 break;
187 default:
188 method = "SBLL";
189 break;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930190 }
191
Michał Kępieńeee77da12017-06-16 06:40:58 +0200192 acpi_handle_debug(device->handle, "set lcd level via %s [%d]\n", method,
193 level);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930194
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200195 if (level < 0 || level >= priv->max_brightness)
Jonathan Woithe20b93732008-06-11 10:14:56 +0930196 return -EINVAL;
197
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200198 status = acpi_execute_simple_method(device->handle, method, level);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930199 if (ACPI_FAILURE(status)) {
Michał Kępieńeee77da12017-06-16 06:40:58 +0200200 acpi_handle_err(device->handle, "Failed to evaluate %s\n",
201 method);
Jonathan Woithed0482532007-08-29 15:58:19 +0930202 return -ENODEV;
203 }
204
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200205 priv->brightness_level = level;
Michał Kępieńbd079a22017-04-05 08:49:04 +0200206
Jonathan Woithed0482532007-08-29 15:58:19 +0930207 return 0;
208}
209
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200210static int get_lcd_level(struct acpi_device *device)
Jonathan Woithed0482532007-08-29 15:58:19 +0930211{
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200212 struct fujitsu_bl *priv = acpi_driver_data(device);
Matthew Wilcox27663c52008-10-10 02:22:59 -0400213 unsigned long long state = 0;
Jonathan Woithed0482532007-08-29 15:58:19 +0930214 acpi_status status = AE_OK;
215
Michał Kępieńeee77da12017-06-16 06:40:58 +0200216 acpi_handle_debug(device->handle, "get lcd level via GBLL\n");
Jonathan Woithe20b93732008-06-11 10:14:56 +0930217
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200218 status = acpi_evaluate_integer(device->handle, "GBLL", NULL, &state);
Jonathan Woithe3b1c37c2009-12-23 09:19:42 +1030219 if (ACPI_FAILURE(status))
220 return 0;
Jonathan Woithed0482532007-08-29 15:58:19 +0930221
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200222 priv->brightness_level = state & 0x0fffffff;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930223
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200224 return priv->brightness_level;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930225}
226
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200227static int get_max_brightness(struct acpi_device *device)
Jonathan Woithe20b93732008-06-11 10:14:56 +0930228{
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200229 struct fujitsu_bl *priv = acpi_driver_data(device);
Matthew Wilcox27663c52008-10-10 02:22:59 -0400230 unsigned long long state = 0;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930231 acpi_status status = AE_OK;
232
Michał Kępieńeee77da12017-06-16 06:40:58 +0200233 acpi_handle_debug(device->handle, "get max lcd level via RBLL\n");
Jonathan Woithe20b93732008-06-11 10:14:56 +0930234
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200235 status = acpi_evaluate_integer(device->handle, "RBLL", NULL, &state);
Jonathan Woithe3b1c37c2009-12-23 09:19:42 +1030236 if (ACPI_FAILURE(status))
237 return -1;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930238
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200239 priv->max_brightness = state;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930240
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200241 return priv->max_brightness;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930242}
243
Jonathan Woithed0482532007-08-29 15:58:19 +0930244/* Backlight device stuff */
245
246static int bl_get_brightness(struct backlight_device *b)
247{
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200248 struct acpi_device *device = bl_get_data(b);
249
250 return b->props.power == FB_BLANK_POWERDOWN ? 0 : get_lcd_level(device);
Jonathan Woithed0482532007-08-29 15:58:19 +0930251}
252
253static int bl_update_status(struct backlight_device *b)
254{
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200255 struct acpi_device *device = bl_get_data(b);
256
Ville Syrjäläcd6bf772017-09-18 23:00:59 +0300257 if (fext) {
258 if (b->props.power == FB_BLANK_POWERDOWN)
259 call_fext_func(fext, FUNC_BACKLIGHT, 0x1, 0x4, 0x3);
260 else
261 call_fext_func(fext, FUNC_BACKLIGHT, 0x1, 0x4, 0x0);
262 }
Tony Vroon3a407082008-12-31 18:19:59 +0000263
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200264 return set_lcd_level(device, b->props.brightness);
Jonathan Woithed0482532007-08-29 15:58:19 +0930265}
266
Alan Jenkins9fc5cf62017-02-08 14:46:24 +0100267static const struct backlight_ops fujitsu_bl_ops = {
Jonathan Woithed0482532007-08-29 15:58:19 +0930268 .get_brightness = bl_get_brightness,
269 .update_status = bl_update_status,
270};
271
Michał Kępieńb0c4b9c2017-03-14 11:26:28 +0100272static ssize_t lid_show(struct device *dev, struct device_attribute *attr,
273 char *buf)
Tony Vroon3a407082008-12-31 18:19:59 +0000274{
Michał Kępieńd659d112017-05-19 09:44:48 +0200275 struct fujitsu_laptop *priv = dev_get_drvdata(dev);
276
277 if (!(priv->flags_supported & FLAG_LID))
Tony Vroon3a407082008-12-31 18:19:59 +0000278 return sprintf(buf, "unknown\n");
Michał Kępieńd659d112017-05-19 09:44:48 +0200279 if (priv->flags_state & FLAG_LID)
Tony Vroon3a407082008-12-31 18:19:59 +0000280 return sprintf(buf, "open\n");
281 else
282 return sprintf(buf, "closed\n");
283}
284
Michał Kępieńb0c4b9c2017-03-14 11:26:28 +0100285static ssize_t dock_show(struct device *dev, struct device_attribute *attr,
286 char *buf)
Tony Vroon3a407082008-12-31 18:19:59 +0000287{
Michał Kępieńd659d112017-05-19 09:44:48 +0200288 struct fujitsu_laptop *priv = dev_get_drvdata(dev);
289
290 if (!(priv->flags_supported & FLAG_DOCK))
Tony Vroon3a407082008-12-31 18:19:59 +0000291 return sprintf(buf, "unknown\n");
Michał Kępieńd659d112017-05-19 09:44:48 +0200292 if (priv->flags_state & FLAG_DOCK)
Tony Vroon3a407082008-12-31 18:19:59 +0000293 return sprintf(buf, "docked\n");
294 else
295 return sprintf(buf, "undocked\n");
296}
297
Michał Kępieńb0c4b9c2017-03-14 11:26:28 +0100298static ssize_t radios_show(struct device *dev, struct device_attribute *attr,
299 char *buf)
Tony Vroon3a407082008-12-31 18:19:59 +0000300{
Michał Kępieńd659d112017-05-19 09:44:48 +0200301 struct fujitsu_laptop *priv = dev_get_drvdata(dev);
302
303 if (!(priv->flags_supported & FLAG_RFKILL))
Tony Vroon3a407082008-12-31 18:19:59 +0000304 return sprintf(buf, "unknown\n");
Michał Kępieńd659d112017-05-19 09:44:48 +0200305 if (priv->flags_state & FLAG_RFKILL)
Tony Vroon3a407082008-12-31 18:19:59 +0000306 return sprintf(buf, "on\n");
307 else
308 return sprintf(buf, "killed\n");
309}
310
Michał Kępieńb0c4b9c2017-03-14 11:26:28 +0100311static DEVICE_ATTR_RO(lid);
312static DEVICE_ATTR_RO(dock);
313static DEVICE_ATTR_RO(radios);
Jonathan Woithed0482532007-08-29 15:58:19 +0930314
Alan Jenkins16506022017-02-08 14:46:26 +0100315static struct attribute *fujitsu_pf_attributes[] = {
Tony Vroon3a407082008-12-31 18:19:59 +0000316 &dev_attr_lid.attr,
317 &dev_attr_dock.attr,
318 &dev_attr_radios.attr,
Jonathan Woithed0482532007-08-29 15:58:19 +0930319 NULL
320};
321
Arvind Yadavee56ff72017-07-11 16:18:14 +0530322static const struct attribute_group fujitsu_pf_attribute_group = {
Alan Jenkins16506022017-02-08 14:46:26 +0100323 .attrs = fujitsu_pf_attributes
Jonathan Woithed0482532007-08-29 15:58:19 +0930324};
325
Alan Jenkins16506022017-02-08 14:46:26 +0100326static struct platform_driver fujitsu_pf_driver = {
Jonathan Woithed0482532007-08-29 15:58:19 +0930327 .driver = {
328 .name = "fujitsu-laptop",
Jonathan Woithed0482532007-08-29 15:58:19 +0930329 }
330};
331
Jonathan Woithe20b93732008-06-11 10:14:56 +0930332/* ACPI device for LCD brightness control */
Jonathan Woithed0482532007-08-29 15:58:19 +0930333
Michał Kępieńf2252672017-03-20 10:32:19 +0100334static const struct key_entry keymap_backlight[] = {
335 { KE_KEY, true, { KEY_BRIGHTNESSUP } },
336 { KE_KEY, false, { KEY_BRIGHTNESSDOWN } },
337 { KE_END, 0 }
338};
339
Michał Kępień7d134e42017-03-20 10:32:17 +0100340static int acpi_fujitsu_bl_input_setup(struct acpi_device *device)
341{
Michał Kępień7ec3b542017-05-19 09:44:41 +0200342 struct fujitsu_bl *priv = acpi_driver_data(device);
Michał Kępieńf2252672017-03-20 10:32:19 +0100343 int ret;
Michał Kępień7d134e42017-03-20 10:32:17 +0100344
Michał Kępień7ec3b542017-05-19 09:44:41 +0200345 priv->input = devm_input_allocate_device(&device->dev);
346 if (!priv->input)
Michał Kępień7d134e42017-03-20 10:32:17 +0100347 return -ENOMEM;
348
Michał Kępień7ec3b542017-05-19 09:44:41 +0200349 snprintf(priv->phys, sizeof(priv->phys), "%s/video/input0",
350 acpi_device_hid(device));
Michał Kępień7d134e42017-03-20 10:32:17 +0100351
Michał Kępień7ec3b542017-05-19 09:44:41 +0200352 priv->input->name = acpi_device_name(device);
353 priv->input->phys = priv->phys;
354 priv->input->id.bustype = BUS_HOST;
355 priv->input->id.product = 0x06;
Michał Kępieńf2252672017-03-20 10:32:19 +0100356
Michał Kępień7ec3b542017-05-19 09:44:41 +0200357 ret = sparse_keymap_setup(priv->input, keymap_backlight, NULL);
Michał Kępieńf2252672017-03-20 10:32:19 +0100358 if (ret)
359 return ret;
Michał Kępień7d134e42017-03-20 10:32:17 +0100360
Michał Kępień7ec3b542017-05-19 09:44:41 +0200361 return input_register_device(priv->input);
Michał Kępień7d134e42017-03-20 10:32:17 +0100362}
363
Michał Kępieńa1aabd52017-04-05 08:49:01 +0200364static int fujitsu_backlight_register(struct acpi_device *device)
Michał Kępieńb8d69c12017-03-10 11:50:33 +0100365{
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200366 struct fujitsu_bl *priv = acpi_driver_data(device);
Michał Kępieńa1aabd52017-04-05 08:49:01 +0200367 const struct backlight_properties props = {
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200368 .brightness = priv->brightness_level,
369 .max_brightness = priv->max_brightness - 1,
Michał Kępieńb8d69c12017-03-10 11:50:33 +0100370 .type = BACKLIGHT_PLATFORM
371 };
372 struct backlight_device *bd;
373
Michał Kępieńa1aabd52017-04-05 08:49:01 +0200374 bd = devm_backlight_device_register(&device->dev, "fujitsu-laptop",
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200375 &device->dev, device,
Michał Kępieńa1aabd52017-04-05 08:49:01 +0200376 &fujitsu_bl_ops, &props);
Michał Kępieńb8d69c12017-03-10 11:50:33 +0100377 if (IS_ERR(bd))
378 return PTR_ERR(bd);
379
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200380 priv->bl_device = bd;
Michał Kępieńb8d69c12017-03-10 11:50:33 +0100381
382 return 0;
383}
384
Alan Jenkins9fc5cf62017-02-08 14:46:24 +0100385static int acpi_fujitsu_bl_add(struct acpi_device *device)
Jonathan Woithed0482532007-08-29 15:58:19 +0930386{
Michał Kępień679374e2017-05-19 09:44:42 +0200387 struct fujitsu_bl *priv;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930388 int error;
Jonathan Woithed0482532007-08-29 15:58:19 +0930389
Michał Kępień07acf622017-04-05 08:49:00 +0200390 if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
391 return -ENODEV;
392
Michał Kępień679374e2017-05-19 09:44:42 +0200393 priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL);
394 if (!priv)
395 return -ENOMEM;
396
397 fujitsu_bl = priv;
Michał Kępieńd6a298a2017-06-16 06:40:54 +0200398 strcpy(acpi_device_name(device), ACPI_FUJITSU_BL_DEVICE_NAME);
399 strcpy(acpi_device_class(device), ACPI_FUJITSU_CLASS);
Michał Kępień679374e2017-05-19 09:44:42 +0200400 device->driver_data = priv;
Jonathan Woithed0482532007-08-29 15:58:19 +0930401
Michał Kępień7d134e42017-03-20 10:32:17 +0100402 error = acpi_fujitsu_bl_input_setup(device);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930403 if (error)
Michał Kępieńf8a399d2017-03-20 10:32:18 +0100404 return error;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930405
Michał Kępień1c194622017-06-16 06:40:56 +0200406 pr_info("ACPI: %s [%s]\n",
407 acpi_device_name(device), acpi_device_bid(device));
Jonathan Woithed0482532007-08-29 15:58:19 +0930408
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200409 if (get_max_brightness(device) <= 0)
410 priv->max_brightness = FUJITSU_LCD_N_LEVELS;
411 get_lcd_level(device);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930412
Michał Kępieńa1aabd52017-04-05 08:49:01 +0200413 error = fujitsu_backlight_register(device);
Michał Kępień07acf622017-04-05 08:49:00 +0200414 if (error)
415 return error;
Michał Kępieńaea31372017-03-10 11:50:35 +0100416
Julia Lawallb30bb892013-12-29 23:47:36 +0100417 return 0;
Jonathan Woithed0482532007-08-29 15:58:19 +0930418}
419
Jonathan Woithe20b93732008-06-11 10:14:56 +0930420/* Brightness notify */
421
Alan Jenkins9fc5cf62017-02-08 14:46:24 +0100422static void acpi_fujitsu_bl_notify(struct acpi_device *device, u32 event)
Jonathan Woithe20b93732008-06-11 10:14:56 +0930423{
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200424 struct fujitsu_bl *priv = acpi_driver_data(device);
Michał Kępieńf2252672017-03-20 10:32:19 +0100425 int oldb, newb;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930426
Michał Kępień5efc8002017-03-01 07:42:53 +0100427 if (event != ACPI_FUJITSU_NOTIFY_CODE1) {
Michał Kępieńeee77da12017-06-16 06:40:58 +0200428 acpi_handle_info(device->handle, "unsupported event [0x%x]\n",
429 event);
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200430 sparse_keymap_report_event(priv->input, -1, 1, true);
Michał Kępień5efc8002017-03-01 07:42:53 +0100431 return;
432 }
433
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200434 oldb = priv->brightness_level;
435 get_lcd_level(device);
436 newb = priv->brightness_level;
Michał Kępień5efc8002017-03-01 07:42:53 +0100437
Michał Kępieńeee77da12017-06-16 06:40:58 +0200438 acpi_handle_debug(device->handle,
439 "brightness button event [%i -> %i]\n", oldb, newb);
Michał Kępień5efc8002017-03-01 07:42:53 +0100440
Michał Kępieńd2aa3ae2017-03-01 07:42:54 +0100441 if (oldb == newb)
442 return;
443
Michał Kępieńb4bb0cf2017-04-05 08:49:06 +0200444 if (!disable_brightness_adjust)
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200445 set_lcd_level(device, newb);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930446
Michał Kępieńf2db7c62017-05-19 09:44:43 +0200447 sparse_keymap_report_event(priv->input, oldb < newb, 1, true);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930448}
449
450/* ACPI device for hotkey handling */
451
Michał Kępień527483a2017-03-20 10:32:22 +0100452static const struct key_entry keymap_default[] = {
453 { KE_KEY, KEY1_CODE, { KEY_PROG1 } },
454 { KE_KEY, KEY2_CODE, { KEY_PROG2 } },
455 { KE_KEY, KEY3_CODE, { KEY_PROG3 } },
456 { KE_KEY, KEY4_CODE, { KEY_PROG4 } },
457 { KE_KEY, KEY5_CODE, { KEY_RFKILL } },
458 { KE_KEY, BIT(26), { KEY_TOUCHPAD_TOGGLE } },
459 { KE_END, 0 }
460};
461
Michał Kępieńf8c94ec2017-03-20 10:32:23 +0100462static const struct key_entry keymap_s64x0[] = {
463 { KE_KEY, KEY1_CODE, { KEY_SCREENLOCK } }, /* "Lock" */
464 { KE_KEY, KEY2_CODE, { KEY_HELP } }, /* "Mobility Center */
465 { KE_KEY, KEY3_CODE, { KEY_PROG3 } },
466 { KE_KEY, KEY4_CODE, { KEY_PROG4 } },
467 { KE_END, 0 }
468};
469
470static const struct key_entry keymap_p8010[] = {
471 { KE_KEY, KEY1_CODE, { KEY_HELP } }, /* "Support" */
472 { KE_KEY, KEY2_CODE, { KEY_PROG2 } },
473 { KE_KEY, KEY3_CODE, { KEY_SWITCHVIDEOMODE } }, /* "Presentation" */
474 { KE_KEY, KEY4_CODE, { KEY_WWW } }, /* "WWW" */
475 { KE_END, 0 }
476};
477
Michał Kępień527483a2017-03-20 10:32:22 +0100478static const struct key_entry *keymap = keymap_default;
479
Michał Kępieńf8c94ec2017-03-20 10:32:23 +0100480static int fujitsu_laptop_dmi_keymap_override(const struct dmi_system_id *id)
481{
482 pr_info("Identified laptop model '%s'\n", id->ident);
483 keymap = id->driver_data;
484 return 1;
485}
486
487static const struct dmi_system_id fujitsu_laptop_dmi_table[] = {
488 {
489 .callback = fujitsu_laptop_dmi_keymap_override,
490 .ident = "Fujitsu Siemens S6410",
491 .matches = {
492 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
493 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S6410"),
494 },
495 .driver_data = (void *)keymap_s64x0
496 },
497 {
498 .callback = fujitsu_laptop_dmi_keymap_override,
499 .ident = "Fujitsu Siemens S6420",
500 .matches = {
501 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
502 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S6420"),
503 },
504 .driver_data = (void *)keymap_s64x0
505 },
506 {
507 .callback = fujitsu_laptop_dmi_keymap_override,
508 .ident = "Fujitsu LifeBook P8010",
509 .matches = {
510 DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
511 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P8010"),
512 },
513 .driver_data = (void *)keymap_p8010
514 },
515 {}
516};
517
Michał Kępień11182db2017-03-20 10:32:20 +0100518static int acpi_fujitsu_laptop_input_setup(struct acpi_device *device)
519{
Michał Kępień7ec3b542017-05-19 09:44:41 +0200520 struct fujitsu_laptop *priv = acpi_driver_data(device);
Michał Kępień527483a2017-03-20 10:32:22 +0100521 int ret;
Michał Kępień11182db2017-03-20 10:32:20 +0100522
Michał Kępień7ec3b542017-05-19 09:44:41 +0200523 priv->input = devm_input_allocate_device(&device->dev);
524 if (!priv->input)
Michał Kępień11182db2017-03-20 10:32:20 +0100525 return -ENOMEM;
526
Michał Kępieńc1f51f12017-06-16 06:40:55 +0200527 snprintf(priv->phys, sizeof(priv->phys), "%s/input0",
Michał Kępień7ec3b542017-05-19 09:44:41 +0200528 acpi_device_hid(device));
Michał Kępień11182db2017-03-20 10:32:20 +0100529
Michał Kępień7ec3b542017-05-19 09:44:41 +0200530 priv->input->name = acpi_device_name(device);
531 priv->input->phys = priv->phys;
532 priv->input->id.bustype = BUS_HOST;
Michał Kępień11182db2017-03-20 10:32:20 +0100533
Michał Kępieńf8c94ec2017-03-20 10:32:23 +0100534 dmi_check_system(fujitsu_laptop_dmi_table);
Michał Kępień7ec3b542017-05-19 09:44:41 +0200535 ret = sparse_keymap_setup(priv->input, keymap, NULL);
Michał Kępień527483a2017-03-20 10:32:22 +0100536 if (ret)
537 return ret;
Michał Kępień11182db2017-03-20 10:32:20 +0100538
Michał Kępień7ec3b542017-05-19 09:44:41 +0200539 return input_register_device(priv->input);
Michał Kępień11182db2017-03-20 10:32:20 +0100540}
541
Michał Kępieńd659d112017-05-19 09:44:48 +0200542static int fujitsu_laptop_platform_add(struct acpi_device *device)
Michał Kępieńd811b512017-03-14 11:26:29 +0100543{
Michał Kępieńd659d112017-05-19 09:44:48 +0200544 struct fujitsu_laptop *priv = acpi_driver_data(device);
Michał Kępieńd811b512017-03-14 11:26:29 +0100545 int ret;
546
Michał Kępieńd659d112017-05-19 09:44:48 +0200547 priv->pf_device = platform_device_alloc("fujitsu-laptop", -1);
548 if (!priv->pf_device)
Michał Kępieńd811b512017-03-14 11:26:29 +0100549 return -ENOMEM;
550
Michał Kępieńd659d112017-05-19 09:44:48 +0200551 platform_set_drvdata(priv->pf_device, priv);
552
553 ret = platform_device_add(priv->pf_device);
Michał Kępieńd811b512017-03-14 11:26:29 +0100554 if (ret)
555 goto err_put_platform_device;
556
Michał Kępieńd659d112017-05-19 09:44:48 +0200557 ret = sysfs_create_group(&priv->pf_device->dev.kobj,
Michał Kępieńd811b512017-03-14 11:26:29 +0100558 &fujitsu_pf_attribute_group);
559 if (ret)
560 goto err_del_platform_device;
561
562 return 0;
563
564err_del_platform_device:
Michał Kępieńd659d112017-05-19 09:44:48 +0200565 platform_device_del(priv->pf_device);
Michał Kępieńd811b512017-03-14 11:26:29 +0100566err_put_platform_device:
Michał Kępieńd659d112017-05-19 09:44:48 +0200567 platform_device_put(priv->pf_device);
Michał Kępieńd811b512017-03-14 11:26:29 +0100568
569 return ret;
570}
571
Michał Kępieńd659d112017-05-19 09:44:48 +0200572static void fujitsu_laptop_platform_remove(struct acpi_device *device)
Michał Kępieńd811b512017-03-14 11:26:29 +0100573{
Michał Kępieńd659d112017-05-19 09:44:48 +0200574 struct fujitsu_laptop *priv = acpi_driver_data(device);
575
576 sysfs_remove_group(&priv->pf_device->dev.kobj,
Michał Kępieńd811b512017-03-14 11:26:29 +0100577 &fujitsu_pf_attribute_group);
Michał Kępieńd659d112017-05-19 09:44:48 +0200578 platform_device_unregister(priv->pf_device);
Michał Kępieńd811b512017-03-14 11:26:29 +0100579}
580
Michał Kępieńe33ca452017-04-07 15:07:10 +0200581static int logolamp_set(struct led_classdev *cdev,
582 enum led_brightness brightness)
583{
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200584 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
Michał Kępieńe33ca452017-04-07 15:07:10 +0200585 int poweron = FUNC_LED_ON, always = FUNC_LED_ON;
586 int ret;
587
588 if (brightness < LED_HALF)
589 poweron = FUNC_LED_OFF;
590
591 if (brightness < LED_FULL)
592 always = FUNC_LED_OFF;
593
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200594 ret = call_fext_func(device, FUNC_LEDS, 0x1, LOGOLAMP_POWERON, poweron);
Michał Kępieńe33ca452017-04-07 15:07:10 +0200595 if (ret < 0)
596 return ret;
597
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200598 return call_fext_func(device, FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, always);
Michał Kępieńe33ca452017-04-07 15:07:10 +0200599}
600
601static enum led_brightness logolamp_get(struct led_classdev *cdev)
602{
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200603 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
Michał Kępieńe33ca452017-04-07 15:07:10 +0200604 int ret;
605
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200606 ret = call_fext_func(device, FUNC_LEDS, 0x2, LOGOLAMP_ALWAYS, 0x0);
Michał Kępieńe33ca452017-04-07 15:07:10 +0200607 if (ret == FUNC_LED_ON)
608 return LED_FULL;
609
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200610 ret = call_fext_func(device, FUNC_LEDS, 0x2, LOGOLAMP_POWERON, 0x0);
Michał Kępieńe33ca452017-04-07 15:07:10 +0200611 if (ret == FUNC_LED_ON)
612 return LED_HALF;
613
614 return LED_OFF;
615}
616
Michał Kępieńe33ca452017-04-07 15:07:10 +0200617static int kblamps_set(struct led_classdev *cdev,
618 enum led_brightness brightness)
619{
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200620 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
621
Michał Kępieńe33ca452017-04-07 15:07:10 +0200622 if (brightness >= LED_FULL)
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200623 return call_fext_func(device, FUNC_LEDS, 0x1, KEYBOARD_LAMPS,
Michał Kępieńe33ca452017-04-07 15:07:10 +0200624 FUNC_LED_ON);
625 else
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200626 return call_fext_func(device, FUNC_LEDS, 0x1, KEYBOARD_LAMPS,
Michał Kępieńe33ca452017-04-07 15:07:10 +0200627 FUNC_LED_OFF);
628}
629
630static enum led_brightness kblamps_get(struct led_classdev *cdev)
631{
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200632 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
Michał Kępieńe33ca452017-04-07 15:07:10 +0200633 enum led_brightness brightness = LED_OFF;
634
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200635 if (call_fext_func(device,
Michał Kępień84631e02017-05-19 09:44:46 +0200636 FUNC_LEDS, 0x2, KEYBOARD_LAMPS, 0x0) == FUNC_LED_ON)
Michał Kępieńe33ca452017-04-07 15:07:10 +0200637 brightness = LED_FULL;
638
639 return brightness;
640}
641
Michał Kępieńe33ca452017-04-07 15:07:10 +0200642static int radio_led_set(struct led_classdev *cdev,
643 enum led_brightness brightness)
644{
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200645 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
646
Michał Kępieńe33ca452017-04-07 15:07:10 +0200647 if (brightness >= LED_FULL)
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200648 return call_fext_func(device, FUNC_FLAGS, 0x5, RADIO_LED_ON,
Michał Kępieńe33ca452017-04-07 15:07:10 +0200649 RADIO_LED_ON);
650 else
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200651 return call_fext_func(device, FUNC_FLAGS, 0x5, RADIO_LED_ON,
Michał Kępień84631e02017-05-19 09:44:46 +0200652 0x0);
Michał Kępieńe33ca452017-04-07 15:07:10 +0200653}
654
655static enum led_brightness radio_led_get(struct led_classdev *cdev)
656{
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200657 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
Michał Kępieńe33ca452017-04-07 15:07:10 +0200658 enum led_brightness brightness = LED_OFF;
659
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200660 if (call_fext_func(device, FUNC_FLAGS, 0x4, 0x0, 0x0) & RADIO_LED_ON)
Michał Kępieńe33ca452017-04-07 15:07:10 +0200661 brightness = LED_FULL;
662
663 return brightness;
664}
665
Michał Kępieńe33ca452017-04-07 15:07:10 +0200666static int eco_led_set(struct led_classdev *cdev,
667 enum led_brightness brightness)
668{
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200669 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
Michał Kępieńe33ca452017-04-07 15:07:10 +0200670 int curr;
671
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200672 curr = call_fext_func(device, FUNC_LEDS, 0x2, ECO_LED, 0x0);
Michał Kępieńe33ca452017-04-07 15:07:10 +0200673 if (brightness >= LED_FULL)
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200674 return call_fext_func(device, FUNC_LEDS, 0x1, ECO_LED,
Michał Kępieńe33ca452017-04-07 15:07:10 +0200675 curr | ECO_LED_ON);
676 else
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200677 return call_fext_func(device, FUNC_LEDS, 0x1, ECO_LED,
Michał Kępieńe33ca452017-04-07 15:07:10 +0200678 curr & ~ECO_LED_ON);
679}
680
681static enum led_brightness eco_led_get(struct led_classdev *cdev)
682{
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200683 struct acpi_device *device = to_acpi_device(cdev->dev->parent);
Michał Kępieńe33ca452017-04-07 15:07:10 +0200684 enum led_brightness brightness = LED_OFF;
685
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200686 if (call_fext_func(device, FUNC_LEDS, 0x2, ECO_LED, 0x0) & ECO_LED_ON)
Michał Kępieńe33ca452017-04-07 15:07:10 +0200687 brightness = LED_FULL;
688
689 return brightness;
690}
691
Michał Kępień81f68212017-04-07 15:07:11 +0200692static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
Jonathan Woithe20b93732008-06-11 10:14:56 +0930693{
Michał Kępieńc7b3e982017-10-25 06:29:46 +0200694 struct fujitsu_laptop *priv = acpi_driver_data(device);
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200695 struct led_classdev *led;
Michał Kępień30943e12017-04-07 15:07:12 +0200696 int result;
Michał Kępień7adb7b12017-04-07 15:07:09 +0200697
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200698 if (call_fext_func(device,
Michał Kępień84631e02017-05-19 09:44:46 +0200699 FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) {
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200700 led = devm_kzalloc(&device->dev, sizeof(*led), GFP_KERNEL);
Gustavo A. R. Silvab77a5372017-07-06 17:19:02 -0500701 if (!led)
702 return -ENOMEM;
703
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200704 led->name = "fujitsu::logolamp";
705 led->brightness_set_blocking = logolamp_set;
706 led->brightness_get = logolamp_get;
707 result = devm_led_classdev_register(&device->dev, led);
Michał Kępień81f68212017-04-07 15:07:11 +0200708 if (result)
Michał Kępień30943e12017-04-07 15:07:12 +0200709 return result;
Michał Kępień7adb7b12017-04-07 15:07:09 +0200710 }
711
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200712 if ((call_fext_func(device,
Michał Kępień84631e02017-05-19 09:44:46 +0200713 FUNC_LEDS, 0x0, 0x0, 0x0) & KEYBOARD_LAMPS) &&
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200714 (call_fext_func(device, FUNC_BUTTONS, 0x0, 0x0, 0x0) == 0x0)) {
715 led = devm_kzalloc(&device->dev, sizeof(*led), GFP_KERNEL);
Gustavo A. R. Silvab77a5372017-07-06 17:19:02 -0500716 if (!led)
717 return -ENOMEM;
718
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200719 led->name = "fujitsu::kblamps";
720 led->brightness_set_blocking = kblamps_set;
721 led->brightness_get = kblamps_get;
722 result = devm_led_classdev_register(&device->dev, led);
Michał Kępień81f68212017-04-07 15:07:11 +0200723 if (result)
Michał Kępień30943e12017-04-07 15:07:12 +0200724 return result;
Michał Kępień7adb7b12017-04-07 15:07:09 +0200725 }
726
727 /*
Michał Kępieńc7b3e982017-10-25 06:29:46 +0200728 * Some Fujitsu laptops have a radio toggle button in place of a slide
729 * switch and all such machines appear to also have an RF LED. Based on
730 * comparing DSDT tables of four Fujitsu Lifebook models (E744, E751,
731 * S7110, S8420; the first one has a radio toggle button, the other
732 * three have slide switches), bit 17 of flags_supported (the value
733 * returned by method S000 of ACPI device FUJ02E3) seems to indicate
734 * whether given model has a radio toggle button.
Michał Kępień7adb7b12017-04-07 15:07:09 +0200735 */
Michał Kępieńc7b3e982017-10-25 06:29:46 +0200736 if (priv->flags_supported & BIT(17)) {
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200737 led = devm_kzalloc(&device->dev, sizeof(*led), GFP_KERNEL);
Gustavo A. R. Silvab77a5372017-07-06 17:19:02 -0500738 if (!led)
739 return -ENOMEM;
740
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200741 led->name = "fujitsu::radio_led";
742 led->brightness_set_blocking = radio_led_set;
743 led->brightness_get = radio_led_get;
744 led->default_trigger = "rfkill-any";
745 result = devm_led_classdev_register(&device->dev, led);
Michał Kępień81f68212017-04-07 15:07:11 +0200746 if (result)
Michał Kępień30943e12017-04-07 15:07:12 +0200747 return result;
Michał Kępień7adb7b12017-04-07 15:07:09 +0200748 }
749
750 /* Support for eco led is not always signaled in bit corresponding
751 * to the bit used to control the led. According to the DSDT table,
752 * bit 14 seems to indicate presence of said led as well.
753 * Confirm by testing the status.
754 */
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200755 if ((call_fext_func(device, FUNC_LEDS, 0x0, 0x0, 0x0) & BIT(14)) &&
756 (call_fext_func(device,
Michał Kępień84631e02017-05-19 09:44:46 +0200757 FUNC_LEDS, 0x2, ECO_LED, 0x0) != UNSUPPORTED_CMD)) {
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200758 led = devm_kzalloc(&device->dev, sizeof(*led), GFP_KERNEL);
Gustavo A. R. Silvab77a5372017-07-06 17:19:02 -0500759 if (!led)
760 return -ENOMEM;
761
Michał Kępieńa823f8e2017-05-19 09:44:47 +0200762 led->name = "fujitsu::eco_led";
763 led->brightness_set_blocking = eco_led_set;
764 led->brightness_get = eco_led_get;
765 result = devm_led_classdev_register(&device->dev, led);
Michał Kępień81f68212017-04-07 15:07:11 +0200766 if (result)
Michał Kępień30943e12017-04-07 15:07:12 +0200767 return result;
Michał Kępień7adb7b12017-04-07 15:07:09 +0200768 }
769
Michał Kępień30943e12017-04-07 15:07:12 +0200770 return 0;
Michał Kępień7adb7b12017-04-07 15:07:09 +0200771}
772
773static int acpi_fujitsu_laptop_add(struct acpi_device *device)
774{
Michał Kępieńa4b176e2017-05-19 09:44:44 +0200775 struct fujitsu_laptop *priv;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930776 int error;
777 int i;
778
Michał Kępieńa4b176e2017-05-19 09:44:44 +0200779 priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL);
780 if (!priv)
781 return -ENOMEM;
782
Michał Kępieńca0d9ea2017-05-19 09:44:45 +0200783 WARN_ONCE(fext, "More than one FUJ02E3 ACPI device was found. Driver may not work as intended.");
784 fext = device;
785
Michał Kępieńd6a298a2017-06-16 06:40:54 +0200786 strcpy(acpi_device_name(device), ACPI_FUJITSU_LAPTOP_DEVICE_NAME);
787 strcpy(acpi_device_class(device), ACPI_FUJITSU_CLASS);
Michał Kępieńa4b176e2017-05-19 09:44:44 +0200788 device->driver_data = priv;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930789
Jonathan Woithe20b93732008-06-11 10:14:56 +0930790 /* kfifo */
Michał Kępieńd659d112017-05-19 09:44:48 +0200791 spin_lock_init(&priv->fifo_lock);
792 error = kfifo_alloc(&priv->fifo, RINGBUFFERSIZE * sizeof(int),
793 GFP_KERNEL);
Stefani Seibold45465482009-12-21 14:37:26 -0800794 if (error) {
Joe Perches77bad7c2011-03-29 15:21:39 -0700795 pr_err("kfifo_alloc failed\n");
Jonathan Woithe20b93732008-06-11 10:14:56 +0930796 goto err_stop;
797 }
798
Michał Kępień11182db2017-03-20 10:32:20 +0100799 error = acpi_fujitsu_laptop_input_setup(device);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930800 if (error)
Michał Kępień11182db2017-03-20 10:32:20 +0100801 goto err_free_fifo;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930802
Michał Kępień1c194622017-06-16 06:40:56 +0200803 pr_info("ACPI: %s [%s]\n",
804 acpi_device_name(device), acpi_device_bid(device));
Jonathan Woithe20b93732008-06-11 10:14:56 +0930805
Tony Vroon3a407082008-12-31 18:19:59 +0000806 i = 0;
Michał Kępieńd659d112017-05-19 09:44:48 +0200807 while (call_fext_func(device, FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0
Tony Vroon3a407082008-12-31 18:19:59 +0000808 && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE)
809 ; /* No action, result is discarded */
Michał Kępieńeee77da12017-06-16 06:40:58 +0200810 acpi_handle_debug(device->handle, "Discarded %i ringbuffer entries\n",
811 i);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930812
Michał Kępieńd659d112017-05-19 09:44:48 +0200813 priv->flags_supported = call_fext_func(device, FUNC_FLAGS, 0x0, 0x0,
814 0x0);
Tony Vroon4898c2b2009-02-02 11:11:10 +0000815
816 /* Make sure our bitmask of supported functions is cleared if the
817 RFKILL function block is not implemented, like on the S7020. */
Michał Kępieńd659d112017-05-19 09:44:48 +0200818 if (priv->flags_supported == UNSUPPORTED_CMD)
819 priv->flags_supported = 0;
Tony Vroon4898c2b2009-02-02 11:11:10 +0000820
Michał Kępieńd659d112017-05-19 09:44:48 +0200821 if (priv->flags_supported)
822 priv->flags_state = call_fext_func(device, FUNC_FLAGS, 0x4, 0x0,
823 0x0);
Tony Vroon3a407082008-12-31 18:19:59 +0000824
825 /* Suspect this is a keymap of the application panel, print it */
Michał Kępieńeee77da12017-06-16 06:40:58 +0200826 acpi_handle_info(device->handle, "BTNI: [0x%x]\n",
827 call_fext_func(device, FUNC_BUTTONS, 0x0, 0x0, 0x0));
Tony Vroon3a407082008-12-31 18:19:59 +0000828
Michał Kępień1877e262017-03-10 11:50:34 +0100829 /* Sync backlight power status */
Michał Kępień679374e2017-05-19 09:44:42 +0200830 if (fujitsu_bl && fujitsu_bl->bl_device &&
Michał Kępieńaea31372017-03-10 11:50:35 +0100831 acpi_video_get_backlight_type() == acpi_backlight_vendor) {
Michał Kępień84631e02017-05-19 09:44:46 +0200832 if (call_fext_func(fext, FUNC_BACKLIGHT, 0x2, 0x4, 0x0) == 3)
Michał Kępień1877e262017-03-10 11:50:34 +0100833 fujitsu_bl->bl_device->props.power = FB_BLANK_POWERDOWN;
834 else
835 fujitsu_bl->bl_device->props.power = FB_BLANK_UNBLANK;
836 }
837
Michał Kępieńd1c70732017-04-07 15:07:13 +0200838 error = acpi_fujitsu_laptop_leds_register(device);
839 if (error)
840 goto err_free_fifo;
841
Michał Kępieńd659d112017-05-19 09:44:48 +0200842 error = fujitsu_laptop_platform_add(device);
Michał Kępieńc33f4c02017-03-14 11:26:30 +0100843 if (error)
Michał Kępieńf66735f2017-03-20 10:32:21 +0100844 goto err_free_fifo;
Michał Kępieńc33f4c02017-03-14 11:26:30 +0100845
Michał Kępień7adb7b12017-04-07 15:07:09 +0200846 return 0;
Michał Kępień4f625682016-04-12 22:06:34 +0930847
Bjorn Helgaasb4ec0272009-04-07 15:37:22 +0000848err_free_fifo:
Michał Kępieńd659d112017-05-19 09:44:48 +0200849 kfifo_free(&priv->fifo);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930850err_stop:
Julia Lawallb30bb892013-12-29 23:47:36 +0100851 return error;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930852}
853
Alan Jenkins6942eab2017-02-08 14:46:25 +0100854static int acpi_fujitsu_laptop_remove(struct acpi_device *device)
Jonathan Woithe20b93732008-06-11 10:14:56 +0930855{
Michał Kępień7ec3b542017-05-19 09:44:41 +0200856 struct fujitsu_laptop *priv = acpi_driver_data(device);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930857
Michał Kępieńd659d112017-05-19 09:44:48 +0200858 fujitsu_laptop_platform_remove(device);
Michał Kępieńc33f4c02017-03-14 11:26:30 +0100859
Michał Kępień7ec3b542017-05-19 09:44:41 +0200860 kfifo_free(&priv->fifo);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930861
862 return 0;
863}
864
Michał Kępieńd659d112017-05-19 09:44:48 +0200865static void acpi_fujitsu_laptop_press(struct acpi_device *device, int scancode)
Michał Kępień2451d192017-01-11 09:59:31 +0100866{
Michał Kępieńd659d112017-05-19 09:44:48 +0200867 struct fujitsu_laptop *priv = acpi_driver_data(device);
Michał Kępień2451d192017-01-11 09:59:31 +0100868 int status;
869
Michał Kępieńd659d112017-05-19 09:44:48 +0200870 status = kfifo_in_locked(&priv->fifo, (unsigned char *)&scancode,
871 sizeof(scancode), &priv->fifo_lock);
Michał Kępień527483a2017-03-20 10:32:22 +0100872 if (status != sizeof(scancode)) {
Michał Kępieńeee77da12017-06-16 06:40:58 +0200873 dev_info(&priv->input->dev, "Could not push scancode [0x%x]\n",
874 scancode);
Michał Kępieńa28c7e92017-01-11 09:59:33 +0100875 return;
Michał Kępień2451d192017-01-11 09:59:31 +0100876 }
Michał Kępieńd659d112017-05-19 09:44:48 +0200877 sparse_keymap_report_event(priv->input, scancode, 1, false);
Michał Kępieńeee77da12017-06-16 06:40:58 +0200878 dev_dbg(&priv->input->dev, "Push scancode into ringbuffer [0x%x]\n",
879 scancode);
Michał Kępień2451d192017-01-11 09:59:31 +0100880}
881
Michał Kępieńd659d112017-05-19 09:44:48 +0200882static void acpi_fujitsu_laptop_release(struct acpi_device *device)
Michał Kępień2451d192017-01-11 09:59:31 +0100883{
Michał Kępieńd659d112017-05-19 09:44:48 +0200884 struct fujitsu_laptop *priv = acpi_driver_data(device);
Michał Kępień527483a2017-03-20 10:32:22 +0100885 int scancode, status;
Michał Kępień2451d192017-01-11 09:59:31 +0100886
Michał Kępień29544f02017-01-11 09:59:32 +0100887 while (true) {
Michał Kępieńd659d112017-05-19 09:44:48 +0200888 status = kfifo_out_locked(&priv->fifo,
Michał Kępień527483a2017-03-20 10:32:22 +0100889 (unsigned char *)&scancode,
Michał Kępieńd659d112017-05-19 09:44:48 +0200890 sizeof(scancode), &priv->fifo_lock);
Michał Kępień527483a2017-03-20 10:32:22 +0100891 if (status != sizeof(scancode))
Michał Kępień29544f02017-01-11 09:59:32 +0100892 return;
Michał Kępieńd659d112017-05-19 09:44:48 +0200893 sparse_keymap_report_event(priv->input, scancode, 0, false);
Michał Kępieńeee77da12017-06-16 06:40:58 +0200894 dev_dbg(&priv->input->dev,
895 "Pop scancode from ringbuffer [0x%x]\n", scancode);
Michał Kępień2451d192017-01-11 09:59:31 +0100896 }
897}
898
Alan Jenkins6942eab2017-02-08 14:46:25 +0100899static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 event)
Jonathan Woithe20b93732008-06-11 10:14:56 +0930900{
Michał Kępieńd659d112017-05-19 09:44:48 +0200901 struct fujitsu_laptop *priv = acpi_driver_data(device);
Michał Kępień527483a2017-03-20 10:32:22 +0100902 int scancode, i = 0;
903 unsigned int irb;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930904
Michał Kępieńeb357cb2017-01-11 09:59:30 +0100905 if (event != ACPI_FUJITSU_NOTIFY_CODE1) {
Michał Kępieńeee77da12017-06-16 06:40:58 +0200906 acpi_handle_info(device->handle, "Unsupported event [0x%x]\n",
907 event);
Michał Kępieńd659d112017-05-19 09:44:48 +0200908 sparse_keymap_report_event(priv->input, -1, 1, true);
Michał Kępieńeb357cb2017-01-11 09:59:30 +0100909 return;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930910 }
Michał Kępieńeb357cb2017-01-11 09:59:30 +0100911
Michał Kępieńd659d112017-05-19 09:44:48 +0200912 if (priv->flags_supported)
913 priv->flags_state = call_fext_func(device, FUNC_FLAGS, 0x4, 0x0,
914 0x0);
Michał Kępieńeb357cb2017-01-11 09:59:30 +0100915
Michał Kępieńd659d112017-05-19 09:44:48 +0200916 while ((irb = call_fext_func(device,
Michał Kępień84631e02017-05-19 09:44:46 +0200917 FUNC_BUTTONS, 0x1, 0x0, 0x0)) != 0 &&
Michał Kępień527483a2017-03-20 10:32:22 +0100918 i++ < MAX_HOTKEY_RINGBUFFER_SIZE) {
919 scancode = irb & 0x4ff;
Michał Kępieńd659d112017-05-19 09:44:48 +0200920 if (sparse_keymap_entry_from_scancode(priv->input, scancode))
921 acpi_fujitsu_laptop_press(device, scancode);
Michał Kępień527483a2017-03-20 10:32:22 +0100922 else if (scancode == 0)
Michał Kępieńd659d112017-05-19 09:44:48 +0200923 acpi_fujitsu_laptop_release(device);
Michał Kępień527483a2017-03-20 10:32:22 +0100924 else
Michał Kępieńeee77da12017-06-16 06:40:58 +0200925 acpi_handle_info(device->handle,
926 "Unknown GIRB result [%x]\n", irb);
Michał Kępieńeb357cb2017-01-11 09:59:30 +0100927 }
928
929 /* On some models (first seen on the Skylake-based Lifebook
930 * E736/E746/E756), the touchpad toggle hotkey (Fn+F4) is
Alan Jenkins8ef27bd2017-02-08 14:46:27 +0100931 * handled in software; its state is queried using FUNC_FLAGS
Michał Kępieńeb357cb2017-01-11 09:59:30 +0100932 */
Michał Kępieńd659d112017-05-19 09:44:48 +0200933 if ((priv->flags_supported & BIT(26)) &&
934 (call_fext_func(device, FUNC_FLAGS, 0x1, 0x0, 0x0) & BIT(26)))
935 sparse_keymap_report_event(priv->input, BIT(26), 1, true);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930936}
937
938/* Initialization */
939
Alan Jenkins9fc5cf62017-02-08 14:46:24 +0100940static const struct acpi_device_id fujitsu_bl_device_ids[] = {
941 {ACPI_FUJITSU_BL_HID, 0},
Jonathan Woithed0482532007-08-29 15:58:19 +0930942 {"", 0},
943};
944
Alan Jenkins9fc5cf62017-02-08 14:46:24 +0100945static struct acpi_driver acpi_fujitsu_bl_driver = {
946 .name = ACPI_FUJITSU_BL_DRIVER_NAME,
Jonathan Woithed0482532007-08-29 15:58:19 +0930947 .class = ACPI_FUJITSU_CLASS,
Alan Jenkins9fc5cf62017-02-08 14:46:24 +0100948 .ids = fujitsu_bl_device_ids,
Jonathan Woithed0482532007-08-29 15:58:19 +0930949 .ops = {
Alan Jenkins9fc5cf62017-02-08 14:46:24 +0100950 .add = acpi_fujitsu_bl_add,
Alan Jenkins9fc5cf62017-02-08 14:46:24 +0100951 .notify = acpi_fujitsu_bl_notify,
Jonathan Woithed0482532007-08-29 15:58:19 +0930952 },
953};
954
Alan Jenkins6942eab2017-02-08 14:46:25 +0100955static const struct acpi_device_id fujitsu_laptop_device_ids[] = {
956 {ACPI_FUJITSU_LAPTOP_HID, 0},
Jonathan Woithe20b93732008-06-11 10:14:56 +0930957 {"", 0},
958};
959
Alan Jenkins6942eab2017-02-08 14:46:25 +0100960static struct acpi_driver acpi_fujitsu_laptop_driver = {
961 .name = ACPI_FUJITSU_LAPTOP_DRIVER_NAME,
Jonathan Woithe20b93732008-06-11 10:14:56 +0930962 .class = ACPI_FUJITSU_CLASS,
Alan Jenkins6942eab2017-02-08 14:46:25 +0100963 .ids = fujitsu_laptop_device_ids,
Jonathan Woithe20b93732008-06-11 10:14:56 +0930964 .ops = {
Alan Jenkins6942eab2017-02-08 14:46:25 +0100965 .add = acpi_fujitsu_laptop_add,
966 .remove = acpi_fujitsu_laptop_remove,
967 .notify = acpi_fujitsu_laptop_notify,
Jonathan Woithe20b93732008-06-11 10:14:56 +0930968 },
969};
Jonathan Woithed0482532007-08-29 15:58:19 +0930970
Zhang Rui49901412014-09-09 00:21:59 +0200971static const struct acpi_device_id fujitsu_ids[] __used = {
Alan Jenkins9fc5cf62017-02-08 14:46:24 +0100972 {ACPI_FUJITSU_BL_HID, 0},
Alan Jenkins6942eab2017-02-08 14:46:25 +0100973 {ACPI_FUJITSU_LAPTOP_HID, 0},
Zhang Rui49901412014-09-09 00:21:59 +0200974 {"", 0}
975};
976MODULE_DEVICE_TABLE(acpi, fujitsu_ids);
977
Jonathan Woithed0482532007-08-29 15:58:19 +0930978static int __init fujitsu_init(void)
979{
Michał Kępieńb8d69c12017-03-10 11:50:33 +0100980 int ret;
Jonathan Woithed0482532007-08-29 15:58:19 +0930981
Alan Jenkinsc1d1e8a2017-02-08 14:46:30 +0100982 ret = acpi_bus_register_driver(&acpi_fujitsu_bl_driver);
983 if (ret)
Michał Kępień679374e2017-05-19 09:44:42 +0200984 return ret;
Jonathan Woithed0482532007-08-29 15:58:19 +0930985
Jonathan Woithed0482532007-08-29 15:58:19 +0930986 /* Register platform stuff */
987
Alan Jenkins16506022017-02-08 14:46:26 +0100988 ret = platform_driver_register(&fujitsu_pf_driver);
Jonathan Woithe20b93732008-06-11 10:14:56 +0930989 if (ret)
Michał Kępieńc33f4c02017-03-14 11:26:30 +0100990 goto err_unregister_acpi;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930991
Alan Jenkins6942eab2017-02-08 14:46:25 +0100992 /* Register laptop driver */
Jonathan Woithe20b93732008-06-11 10:14:56 +0930993
Alan Jenkinsc1d1e8a2017-02-08 14:46:30 +0100994 ret = acpi_bus_register_driver(&acpi_fujitsu_laptop_driver);
995 if (ret)
Michał Kępieńa4b176e2017-05-19 09:44:44 +0200996 goto err_unregister_platform_driver;
Jonathan Woithe20b93732008-06-11 10:14:56 +0930997
Joe Perches77bad7c2011-03-29 15:21:39 -0700998 pr_info("driver " FUJITSU_DRIVER_VERSION " successfully loaded\n");
Jonathan Woithed0482532007-08-29 15:58:19 +0930999
1000 return 0;
1001
Michał Kępieńc2cddd42017-03-10 11:50:36 +01001002err_unregister_platform_driver:
Alan Jenkins16506022017-02-08 14:46:26 +01001003 platform_driver_unregister(&fujitsu_pf_driver);
Michał Kępieńc2cddd42017-03-10 11:50:36 +01001004err_unregister_acpi:
Alan Jenkins9fc5cf62017-02-08 14:46:24 +01001005 acpi_bus_unregister_driver(&acpi_fujitsu_bl_driver);
Jonathan Woithed0482532007-08-29 15:58:19 +09301006
1007 return ret;
1008}
1009
1010static void __exit fujitsu_cleanup(void)
1011{
Alan Jenkins6942eab2017-02-08 14:46:25 +01001012 acpi_bus_unregister_driver(&acpi_fujitsu_laptop_driver);
Tony Vroon3a407082008-12-31 18:19:59 +00001013
Alan Jenkins16506022017-02-08 14:46:26 +01001014 platform_driver_unregister(&fujitsu_pf_driver);
Bartlomiej Zolnierkiewicz72afeea2009-07-31 18:16:02 +09301015
Alan Jenkins9fc5cf62017-02-08 14:46:24 +01001016 acpi_bus_unregister_driver(&acpi_fujitsu_bl_driver);
Jonathan Woithed0482532007-08-29 15:58:19 +09301017
Joe Perches77bad7c2011-03-29 15:21:39 -07001018 pr_info("driver unloaded\n");
Jonathan Woithed0482532007-08-29 15:58:19 +09301019}
1020
1021module_init(fujitsu_init);
1022module_exit(fujitsu_cleanup);
1023
Michał Kępieńe06e4832017-04-05 08:49:05 +02001024module_param(use_alt_lcd_levels, int, 0644);
1025MODULE_PARM_DESC(use_alt_lcd_levels, "Interface used for setting LCD brightness level (-1 = auto, 0 = force SBLL, 1 = force SBL2)");
Michał Kępieńb4bb0cf2017-04-05 08:49:06 +02001026module_param(disable_brightness_adjust, bool, 0644);
1027MODULE_PARM_DESC(disable_brightness_adjust, "Disable LCD brightness adjustment");
Jonathan Woithe20b93732008-06-11 10:14:56 +09301028
Tony Vroon3a407082008-12-31 18:19:59 +00001029MODULE_AUTHOR("Jonathan Woithe, Peter Gruber, Tony Vroon");
Jonathan Woithed0482532007-08-29 15:58:19 +09301030MODULE_DESCRIPTION("Fujitsu laptop extras support");
1031MODULE_VERSION(FUJITSU_DRIVER_VERSION);
1032MODULE_LICENSE("GPL");