| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1 | /*-*-linux-c-*-*/ |
| 2 | |
| 3 | /* |
| Jonathan Woithe | 409a3e9 | 2012-03-27 13:01:01 +1030 | [diff] [blame] | 4 | Copyright (C) 2007,2008 Jonathan Woithe <jwoithe@just42.net> |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 5 | Copyright (C) 2008 Peter Gruber <nokos@gmx.net> |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 6 | Copyright (C) 2008 Tony Vroon <tony@linx.net> |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 7 | Based on earlier work: |
| 8 | Copyright (C) 2003 Shane Spencer <shane@bogomip.com> |
| 9 | Adrian Yee <brewt-fujitsu@brewt.org> |
| 10 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 11 | Templated from msi-laptop.c and thinkpad_acpi.c which is copyright |
| 12 | by its respective authors. |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 13 | |
| 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ń | 78b2602 | 2017-03-14 11:26:27 +0100 | [diff] [blame] | 35 | * 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 Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 38 | * |
| Jonathan Woithe | 0e6a66e | 2008-10-09 13:44:40 +0930 | [diff] [blame] | 39 | * 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 Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 42 | * |
| 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 Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 48 | */ |
| 49 | |
| Joe Perches | 77bad7c | 2011-03-29 15:21:39 -0700 | [diff] [blame] | 50 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 51 | |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 52 | #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 Karcher | e8549e2 | 2015-01-18 20:28:46 +0100 | [diff] [blame] | 58 | #include <linux/fb.h> |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 59 | #include <linux/input.h> |
| Michał Kępień | f225267 | 2017-03-20 10:32:19 +0100 | [diff] [blame^] | 60 | #include <linux/input/sparse-keymap.h> |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 61 | #include <linux/kfifo.h> |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 62 | #include <linux/platform_device.h> |
| Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 63 | #include <linux/slab.h> |
| Javier Martinez Canillas | 575b245 | 2016-04-26 18:28:17 -0400 | [diff] [blame] | 64 | #if IS_ENABLED(CONFIG_LEDS_CLASS) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 65 | #include <linux/leds.h> |
| 66 | #endif |
| Hans de Goede | 413226f | 2015-06-16 16:28:03 +0200 | [diff] [blame] | 67 | #include <acpi/video.h> |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 68 | |
| Jonathan Woithe | 84a6ce2 | 2009-07-31 18:16:59 +0930 | [diff] [blame] | 69 | #define FUJITSU_DRIVER_VERSION "0.6.0" |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 70 | |
| 71 | #define FUJITSU_LCD_N_LEVELS 8 |
| 72 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 73 | #define ACPI_FUJITSU_CLASS "fujitsu" |
| 74 | #define ACPI_FUJITSU_BL_HID "FUJ02B1" |
| 75 | #define ACPI_FUJITSU_BL_DRIVER_NAME "Fujitsu laptop FUJ02B1 ACPI brightness driver" |
| 76 | #define ACPI_FUJITSU_BL_DEVICE_NAME "Fujitsu FUJ02B1" |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 77 | #define ACPI_FUJITSU_LAPTOP_HID "FUJ02E3" |
| 78 | #define ACPI_FUJITSU_LAPTOP_DRIVER_NAME "Fujitsu laptop FUJ02E3 ACPI hotkeys driver" |
| 79 | #define ACPI_FUJITSU_LAPTOP_DEVICE_NAME "Fujitsu FUJ02E3" |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 80 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 81 | #define ACPI_FUJITSU_NOTIFY_CODE1 0x80 |
| 82 | |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 83 | /* FUNC interface - command values */ |
| Alan Jenkins | 8ef27bd | 2017-02-08 14:46:27 +0100 | [diff] [blame] | 84 | #define FUNC_FLAGS 0x1000 |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 85 | #define FUNC_LEDS 0x1001 |
| 86 | #define FUNC_BUTTONS 0x1002 |
| 87 | #define FUNC_BACKLIGHT 0x1004 |
| 88 | |
| 89 | /* FUNC interface - responses */ |
| 90 | #define UNSUPPORTED_CMD 0x80000000 |
| 91 | |
| Alan Jenkins | d3dd448 | 2017-02-08 14:46:28 +0100 | [diff] [blame] | 92 | /* FUNC interface - status flags */ |
| 93 | #define FLAG_RFKILL 0x020 |
| 94 | #define FLAG_LID 0x100 |
| 95 | #define FLAG_DOCK 0x200 |
| 96 | |
| Javier Martinez Canillas | 575b245 | 2016-04-26 18:28:17 -0400 | [diff] [blame] | 97 | #if IS_ENABLED(CONFIG_LEDS_CLASS) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 98 | /* FUNC interface - LED control */ |
| 99 | #define FUNC_LED_OFF 0x1 |
| 100 | #define FUNC_LED_ON 0x30001 |
| 101 | #define KEYBOARD_LAMPS 0x100 |
| 102 | #define LOGOLAMP_POWERON 0x2000 |
| 103 | #define LOGOLAMP_ALWAYS 0x4000 |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 104 | #define RADIO_LED_ON 0x20 |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 105 | #define ECO_LED 0x10000 |
| 106 | #define ECO_LED_ON 0x80000 |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 107 | #endif |
| 108 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 109 | /* Hotkey details */ |
| Jonathan Woithe | 0e6a66e | 2008-10-09 13:44:40 +0930 | [diff] [blame] | 110 | #define KEY1_CODE 0x410 /* codes for the keys in the GIRB register */ |
| 111 | #define KEY2_CODE 0x411 |
| 112 | #define KEY3_CODE 0x412 |
| 113 | #define KEY4_CODE 0x413 |
| Michał Kępień | b5df36c | 2016-02-24 14:23:32 +0100 | [diff] [blame] | 114 | #define KEY5_CODE 0x420 |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 115 | |
| 116 | #define MAX_HOTKEY_RINGBUFFER_SIZE 100 |
| 117 | #define RINGBUFFERSIZE 40 |
| 118 | |
| 119 | /* Debugging */ |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 120 | #define FUJLAPTOP_DBG_ERROR 0x0001 |
| 121 | #define FUJLAPTOP_DBG_WARN 0x0002 |
| 122 | #define FUJLAPTOP_DBG_INFO 0x0004 |
| 123 | #define FUJLAPTOP_DBG_TRACE 0x0008 |
| 124 | |
| Jean Delvare | c4960cf | 2014-06-16 11:55:13 +0200 | [diff] [blame] | 125 | #ifdef CONFIG_FUJITSU_LAPTOP_DEBUG |
| 126 | #define vdbg_printk(a_dbg_level, format, arg...) \ |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 127 | do { if (dbg_level & a_dbg_level) \ |
| Michał Kępień | 98020a4 | 2016-06-23 12:02:47 +0200 | [diff] [blame] | 128 | printk(KERN_DEBUG pr_fmt("%s: " format), __func__, ## arg); \ |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 129 | } while (0) |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 130 | #else |
| Jean Delvare | c4960cf | 2014-06-16 11:55:13 +0200 | [diff] [blame] | 131 | #define vdbg_printk(a_dbg_level, format, arg...) \ |
| 132 | do { } while (0) |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 133 | #endif |
| 134 | |
| 135 | /* Device controlling the backlight and associated keys */ |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 136 | struct fujitsu_bl { |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 137 | acpi_handle acpi_handle; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 138 | struct acpi_device *dev; |
| 139 | struct input_dev *input; |
| 140 | char phys[32]; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 141 | struct backlight_device *bl_device; |
| Michał Kępień | b5df36c | 2016-02-24 14:23:32 +0100 | [diff] [blame] | 142 | int keycode1, keycode2, keycode3, keycode4, keycode5; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 143 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 144 | unsigned int max_brightness; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 145 | unsigned int brightness_changed; |
| 146 | unsigned int brightness_level; |
| 147 | }; |
| 148 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 149 | static struct fujitsu_bl *fujitsu_bl; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 150 | static int use_alt_lcd_levels = -1; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 151 | static int disable_brightness_adjust = -1; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 152 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 153 | /* Device used to access hotkeys and other features on the laptop */ |
| 154 | struct fujitsu_laptop { |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 155 | acpi_handle acpi_handle; |
| 156 | struct acpi_device *dev; |
| 157 | struct input_dev *input; |
| 158 | char phys[32]; |
| 159 | struct platform_device *pf_device; |
| Stefani Seibold | 4546548 | 2009-12-21 14:37:26 -0800 | [diff] [blame] | 160 | struct kfifo fifo; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 161 | spinlock_t fifo_lock; |
| Alan Jenkins | 8ef27bd | 2017-02-08 14:46:27 +0100 | [diff] [blame] | 162 | int flags_supported; |
| 163 | int flags_state; |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 164 | int logolamp_registered; |
| 165 | int kblamps_registered; |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 166 | int radio_led_registered; |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 167 | int eco_led_registered; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 168 | }; |
| 169 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 170 | static struct fujitsu_laptop *fujitsu_laptop; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 171 | |
| Javier Martinez Canillas | 575b245 | 2016-04-26 18:28:17 -0400 | [diff] [blame] | 172 | #if IS_ENABLED(CONFIG_LEDS_CLASS) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 173 | static enum led_brightness logolamp_get(struct led_classdev *cdev); |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 174 | static int logolamp_set(struct led_classdev *cdev, |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 175 | enum led_brightness brightness); |
| 176 | |
| Axel Lin | 67af711 | 2010-07-20 15:19:45 -0700 | [diff] [blame] | 177 | static struct led_classdev logolamp_led = { |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 178 | .name = "fujitsu::logolamp", |
| 179 | .brightness_get = logolamp_get, |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 180 | .brightness_set_blocking = logolamp_set |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 181 | }; |
| 182 | |
| 183 | static enum led_brightness kblamps_get(struct led_classdev *cdev); |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 184 | static int kblamps_set(struct led_classdev *cdev, |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 185 | enum led_brightness brightness); |
| 186 | |
| Axel Lin | 67af711 | 2010-07-20 15:19:45 -0700 | [diff] [blame] | 187 | static struct led_classdev kblamps_led = { |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 188 | .name = "fujitsu::kblamps", |
| 189 | .brightness_get = kblamps_get, |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 190 | .brightness_set_blocking = kblamps_set |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 191 | }; |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 192 | |
| 193 | static enum led_brightness radio_led_get(struct led_classdev *cdev); |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 194 | static int radio_led_set(struct led_classdev *cdev, |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 195 | enum led_brightness brightness); |
| 196 | |
| 197 | static struct led_classdev radio_led = { |
| 198 | .name = "fujitsu::radio_led", |
| Micha? K?pie? | 5f25b00 | 2016-12-16 15:46:03 +0100 | [diff] [blame] | 199 | .default_trigger = "rfkill-any", |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 200 | .brightness_get = radio_led_get, |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 201 | .brightness_set_blocking = radio_led_set |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 202 | }; |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 203 | |
| 204 | static enum led_brightness eco_led_get(struct led_classdev *cdev); |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 205 | static int eco_led_set(struct led_classdev *cdev, |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 206 | enum led_brightness brightness); |
| 207 | |
| 208 | static struct led_classdev eco_led = { |
| 209 | .name = "fujitsu::eco_led", |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 210 | .brightness_get = eco_led_get, |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 211 | .brightness_set_blocking = eco_led_set |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 212 | }; |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 213 | #endif |
| 214 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 215 | #ifdef CONFIG_FUJITSU_LAPTOP_DEBUG |
| 216 | static u32 dbg_level = 0x03; |
| 217 | #endif |
| 218 | |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 219 | /* Fujitsu ACPI interface function */ |
| 220 | |
| 221 | static int call_fext_func(int cmd, int arg0, int arg1, int arg2) |
| 222 | { |
| 223 | acpi_status status = AE_OK; |
| 224 | union acpi_object params[4] = { |
| 225 | { .type = ACPI_TYPE_INTEGER }, |
| 226 | { .type = ACPI_TYPE_INTEGER }, |
| 227 | { .type = ACPI_TYPE_INTEGER }, |
| 228 | { .type = ACPI_TYPE_INTEGER } |
| 229 | }; |
| 230 | struct acpi_object_list arg_list = { 4, ¶ms[0] }; |
| Zhang Rui | 29c29a9 | 2013-09-03 08:32:12 +0800 | [diff] [blame] | 231 | unsigned long long value; |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 232 | acpi_handle handle = NULL; |
| 233 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 234 | status = acpi_get_handle(fujitsu_laptop->acpi_handle, "FUNC", &handle); |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 235 | if (ACPI_FAILURE(status)) { |
| 236 | vdbg_printk(FUJLAPTOP_DBG_ERROR, |
| 237 | "FUNC interface is not present\n"); |
| 238 | return -ENODEV; |
| 239 | } |
| 240 | |
| 241 | params[0].integer.value = cmd; |
| 242 | params[1].integer.value = arg0; |
| 243 | params[2].integer.value = arg1; |
| 244 | params[3].integer.value = arg2; |
| 245 | |
| Zhang Rui | 29c29a9 | 2013-09-03 08:32:12 +0800 | [diff] [blame] | 246 | status = acpi_evaluate_integer(handle, NULL, &arg_list, &value); |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 247 | if (ACPI_FAILURE(status)) { |
| 248 | vdbg_printk(FUJLAPTOP_DBG_WARN, |
| 249 | "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) call failed\n", |
| 250 | cmd, arg0, arg1, arg2); |
| 251 | return -ENODEV; |
| 252 | } |
| 253 | |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 254 | vdbg_printk(FUJLAPTOP_DBG_TRACE, |
| 255 | "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) returned 0x%x\n", |
| Zhang Rui | 29c29a9 | 2013-09-03 08:32:12 +0800 | [diff] [blame] | 256 | cmd, arg0, arg1, arg2, (int)value); |
| 257 | return value; |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 258 | } |
| 259 | |
| Javier Martinez Canillas | 575b245 | 2016-04-26 18:28:17 -0400 | [diff] [blame] | 260 | #if IS_ENABLED(CONFIG_LEDS_CLASS) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 261 | /* LED class callbacks */ |
| 262 | |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 263 | static int logolamp_set(struct led_classdev *cdev, |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 264 | enum led_brightness brightness) |
| 265 | { |
| Michał Kępień | dcb50b3 | 2017-01-09 14:14:16 +0100 | [diff] [blame] | 266 | int poweron = FUNC_LED_ON, always = FUNC_LED_ON; |
| 267 | int ret; |
| 268 | |
| 269 | if (brightness < LED_HALF) |
| 270 | poweron = FUNC_LED_OFF; |
| 271 | |
| 272 | if (brightness < LED_FULL) |
| 273 | always = FUNC_LED_OFF; |
| 274 | |
| 275 | ret = call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, poweron); |
| 276 | if (ret < 0) |
| 277 | return ret; |
| 278 | |
| 279 | return call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, always); |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 280 | } |
| 281 | |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 282 | static int kblamps_set(struct led_classdev *cdev, |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 283 | enum led_brightness brightness) |
| 284 | { |
| 285 | if (brightness >= LED_FULL) |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 286 | return call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_ON); |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 287 | else |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 288 | return call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_OFF); |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 289 | } |
| 290 | |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 291 | static int radio_led_set(struct led_classdev *cdev, |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 292 | enum led_brightness brightness) |
| 293 | { |
| 294 | if (brightness >= LED_FULL) |
| Alan Jenkins | 8ef27bd | 2017-02-08 14:46:27 +0100 | [diff] [blame] | 295 | return call_fext_func(FUNC_FLAGS, 0x5, RADIO_LED_ON, RADIO_LED_ON); |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 296 | else |
| Alan Jenkins | 8ef27bd | 2017-02-08 14:46:27 +0100 | [diff] [blame] | 297 | return call_fext_func(FUNC_FLAGS, 0x5, RADIO_LED_ON, 0x0); |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 298 | } |
| 299 | |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 300 | static int eco_led_set(struct led_classdev *cdev, |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 301 | enum led_brightness brightness) |
| 302 | { |
| 303 | int curr; |
| 304 | |
| 305 | curr = call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0); |
| Matej Groma | 6967893 | 2016-07-04 12:04:12 +0200 | [diff] [blame] | 306 | if (brightness >= LED_FULL) |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 307 | return call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr | ECO_LED_ON); |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 308 | else |
| Micha? K?pie? | a608a9d | 2016-12-23 10:00:08 +0100 | [diff] [blame] | 309 | return call_fext_func(FUNC_LEDS, 0x1, ECO_LED, curr & ~ECO_LED_ON); |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 310 | } |
| 311 | |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 312 | static enum led_brightness logolamp_get(struct led_classdev *cdev) |
| 313 | { |
| Michał Kępień | 5c461e8 | 2017-01-09 14:14:17 +0100 | [diff] [blame] | 314 | int ret; |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 315 | |
| Michał Kępień | 5c461e8 | 2017-01-09 14:14:17 +0100 | [diff] [blame] | 316 | ret = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_ALWAYS, 0x0); |
| 317 | if (ret == FUNC_LED_ON) |
| 318 | return LED_FULL; |
| 319 | |
| 320 | ret = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_POWERON, 0x0); |
| 321 | if (ret == FUNC_LED_ON) |
| 322 | return LED_HALF; |
| 323 | |
| 324 | return LED_OFF; |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | static enum led_brightness kblamps_get(struct led_classdev *cdev) |
| 328 | { |
| 329 | enum led_brightness brightness = LED_OFF; |
| 330 | |
| 331 | if (call_fext_func(FUNC_LEDS, 0x2, KEYBOARD_LAMPS, 0x0) == FUNC_LED_ON) |
| 332 | brightness = LED_FULL; |
| 333 | |
| 334 | return brightness; |
| 335 | } |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 336 | |
| 337 | static enum led_brightness radio_led_get(struct led_classdev *cdev) |
| 338 | { |
| 339 | enum led_brightness brightness = LED_OFF; |
| 340 | |
| Alan Jenkins | 8ef27bd | 2017-02-08 14:46:27 +0100 | [diff] [blame] | 341 | if (call_fext_func(FUNC_FLAGS, 0x4, 0x0, 0x0) & RADIO_LED_ON) |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 342 | brightness = LED_FULL; |
| 343 | |
| 344 | return brightness; |
| 345 | } |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 346 | |
| 347 | static enum led_brightness eco_led_get(struct led_classdev *cdev) |
| 348 | { |
| 349 | enum led_brightness brightness = LED_OFF; |
| 350 | |
| 351 | if (call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0) & ECO_LED_ON) |
| Matej Groma | 6967893 | 2016-07-04 12:04:12 +0200 | [diff] [blame] | 352 | brightness = LED_FULL; |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 353 | |
| 354 | return brightness; |
| 355 | } |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 356 | #endif |
| 357 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 358 | /* Hardware access for LCD brightness control */ |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 359 | |
| 360 | static int set_lcd_level(int level) |
| 361 | { |
| 362 | acpi_status status = AE_OK; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 363 | acpi_handle handle = NULL; |
| 364 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 365 | vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBLL [%d]\n", |
| 366 | level); |
| 367 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 368 | if (level < 0 || level >= fujitsu_bl->max_brightness) |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 369 | return -EINVAL; |
| 370 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 371 | status = acpi_get_handle(fujitsu_bl->acpi_handle, "SBLL", &handle); |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 372 | if (ACPI_FAILURE(status)) { |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 373 | vdbg_printk(FUJLAPTOP_DBG_ERROR, "SBLL not present\n"); |
| 374 | return -ENODEV; |
| 375 | } |
| 376 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 377 | |
| Zhang Rui | 6c7fe47a | 2013-09-03 08:31:52 +0800 | [diff] [blame] | 378 | status = acpi_execute_simple_method(handle, NULL, level); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 379 | if (ACPI_FAILURE(status)) |
| 380 | return -ENODEV; |
| 381 | |
| 382 | return 0; |
| 383 | } |
| 384 | |
| 385 | static int set_lcd_level_alt(int level) |
| 386 | { |
| 387 | acpi_status status = AE_OK; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 388 | acpi_handle handle = NULL; |
| 389 | |
| 390 | vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBL2 [%d]\n", |
| 391 | level); |
| 392 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 393 | if (level < 0 || level >= fujitsu_bl->max_brightness) |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 394 | return -EINVAL; |
| 395 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 396 | status = acpi_get_handle(fujitsu_bl->acpi_handle, "SBL2", &handle); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 397 | if (ACPI_FAILURE(status)) { |
| 398 | vdbg_printk(FUJLAPTOP_DBG_ERROR, "SBL2 not present\n"); |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 399 | return -ENODEV; |
| 400 | } |
| 401 | |
| Zhang Rui | 6c7fe47a | 2013-09-03 08:31:52 +0800 | [diff] [blame] | 402 | status = acpi_execute_simple_method(handle, NULL, level); |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 403 | if (ACPI_FAILURE(status)) |
| 404 | return -ENODEV; |
| 405 | |
| 406 | return 0; |
| 407 | } |
| 408 | |
| 409 | static int get_lcd_level(void) |
| 410 | { |
| Matthew Wilcox | 27663c5 | 2008-10-10 02:22:59 -0400 | [diff] [blame] | 411 | unsigned long long state = 0; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 412 | acpi_status status = AE_OK; |
| 413 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 414 | vdbg_printk(FUJLAPTOP_DBG_TRACE, "get lcd level via GBLL\n"); |
| 415 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 416 | status = acpi_evaluate_integer(fujitsu_bl->acpi_handle, "GBLL", NULL, |
| 417 | &state); |
| Jonathan Woithe | 3b1c37c | 2009-12-23 09:19:42 +1030 | [diff] [blame] | 418 | if (ACPI_FAILURE(status)) |
| 419 | return 0; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 420 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 421 | fujitsu_bl->brightness_level = state & 0x0fffffff; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 422 | |
| 423 | if (state & 0x80000000) |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 424 | fujitsu_bl->brightness_changed = 1; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 425 | else |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 426 | fujitsu_bl->brightness_changed = 0; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 427 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 428 | return fujitsu_bl->brightness_level; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 429 | } |
| 430 | |
| 431 | static int get_max_brightness(void) |
| 432 | { |
| Matthew Wilcox | 27663c5 | 2008-10-10 02:22:59 -0400 | [diff] [blame] | 433 | unsigned long long state = 0; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 434 | acpi_status status = AE_OK; |
| 435 | |
| 436 | vdbg_printk(FUJLAPTOP_DBG_TRACE, "get max lcd level via RBLL\n"); |
| 437 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 438 | status = acpi_evaluate_integer(fujitsu_bl->acpi_handle, "RBLL", NULL, |
| 439 | &state); |
| Jonathan Woithe | 3b1c37c | 2009-12-23 09:19:42 +1030 | [diff] [blame] | 440 | if (ACPI_FAILURE(status)) |
| 441 | return -1; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 442 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 443 | fujitsu_bl->max_brightness = state; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 444 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 445 | return fujitsu_bl->max_brightness; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 446 | } |
| 447 | |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 448 | /* Backlight device stuff */ |
| 449 | |
| 450 | static int bl_get_brightness(struct backlight_device *b) |
| 451 | { |
| Tony Vroon | f87a1a5 | 2009-01-07 10:11:24 +0000 | [diff] [blame] | 452 | return get_lcd_level(); |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 453 | } |
| 454 | |
| 455 | static int bl_update_status(struct backlight_device *b) |
| 456 | { |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 457 | int ret; |
| Michael Karcher | e8549e2 | 2015-01-18 20:28:46 +0100 | [diff] [blame] | 458 | if (b->props.power == FB_BLANK_POWERDOWN) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 459 | ret = call_fext_func(FUNC_BACKLIGHT, 0x1, 0x4, 0x3); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 460 | else |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 461 | ret = call_fext_func(FUNC_BACKLIGHT, 0x1, 0x4, 0x0); |
| 462 | if (ret != 0) |
| 463 | vdbg_printk(FUJLAPTOP_DBG_ERROR, |
| 464 | "Unable to adjust backlight power, error code %i\n", |
| 465 | ret); |
| 466 | |
| 467 | if (use_alt_lcd_levels) |
| 468 | ret = set_lcd_level_alt(b->props.brightness); |
| 469 | else |
| 470 | ret = set_lcd_level(b->props.brightness); |
| 471 | if (ret != 0) |
| 472 | vdbg_printk(FUJLAPTOP_DBG_ERROR, |
| 473 | "Unable to adjust LCD brightness, error code %i\n", |
| 474 | ret); |
| 475 | return ret; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 476 | } |
| 477 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 478 | static const struct backlight_ops fujitsu_bl_ops = { |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 479 | .get_brightness = bl_get_brightness, |
| 480 | .update_status = bl_update_status, |
| 481 | }; |
| 482 | |
| Michał Kępień | b0c4b9c | 2017-03-14 11:26:28 +0100 | [diff] [blame] | 483 | static ssize_t lid_show(struct device *dev, struct device_attribute *attr, |
| 484 | char *buf) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 485 | { |
| Alan Jenkins | d3dd448 | 2017-02-08 14:46:28 +0100 | [diff] [blame] | 486 | if (!(fujitsu_laptop->flags_supported & FLAG_LID)) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 487 | return sprintf(buf, "unknown\n"); |
| Alan Jenkins | d3dd448 | 2017-02-08 14:46:28 +0100 | [diff] [blame] | 488 | if (fujitsu_laptop->flags_state & FLAG_LID) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 489 | return sprintf(buf, "open\n"); |
| 490 | else |
| 491 | return sprintf(buf, "closed\n"); |
| 492 | } |
| 493 | |
| Michał Kępień | b0c4b9c | 2017-03-14 11:26:28 +0100 | [diff] [blame] | 494 | static ssize_t dock_show(struct device *dev, struct device_attribute *attr, |
| 495 | char *buf) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 496 | { |
| Alan Jenkins | d3dd448 | 2017-02-08 14:46:28 +0100 | [diff] [blame] | 497 | if (!(fujitsu_laptop->flags_supported & FLAG_DOCK)) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 498 | return sprintf(buf, "unknown\n"); |
| Alan Jenkins | d3dd448 | 2017-02-08 14:46:28 +0100 | [diff] [blame] | 499 | if (fujitsu_laptop->flags_state & FLAG_DOCK) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 500 | return sprintf(buf, "docked\n"); |
| 501 | else |
| 502 | return sprintf(buf, "undocked\n"); |
| 503 | } |
| 504 | |
| Michał Kępień | b0c4b9c | 2017-03-14 11:26:28 +0100 | [diff] [blame] | 505 | static ssize_t radios_show(struct device *dev, struct device_attribute *attr, |
| 506 | char *buf) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 507 | { |
| Alan Jenkins | d3dd448 | 2017-02-08 14:46:28 +0100 | [diff] [blame] | 508 | if (!(fujitsu_laptop->flags_supported & FLAG_RFKILL)) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 509 | return sprintf(buf, "unknown\n"); |
| Alan Jenkins | d3dd448 | 2017-02-08 14:46:28 +0100 | [diff] [blame] | 510 | if (fujitsu_laptop->flags_state & FLAG_RFKILL) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 511 | return sprintf(buf, "on\n"); |
| 512 | else |
| 513 | return sprintf(buf, "killed\n"); |
| 514 | } |
| 515 | |
| Michał Kępień | b0c4b9c | 2017-03-14 11:26:28 +0100 | [diff] [blame] | 516 | static DEVICE_ATTR_RO(lid); |
| 517 | static DEVICE_ATTR_RO(dock); |
| 518 | static DEVICE_ATTR_RO(radios); |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 519 | |
| Alan Jenkins | 1650602 | 2017-02-08 14:46:26 +0100 | [diff] [blame] | 520 | static struct attribute *fujitsu_pf_attributes[] = { |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 521 | &dev_attr_lid.attr, |
| 522 | &dev_attr_dock.attr, |
| 523 | &dev_attr_radios.attr, |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 524 | NULL |
| 525 | }; |
| 526 | |
| Alan Jenkins | 1650602 | 2017-02-08 14:46:26 +0100 | [diff] [blame] | 527 | static struct attribute_group fujitsu_pf_attribute_group = { |
| 528 | .attrs = fujitsu_pf_attributes |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 529 | }; |
| 530 | |
| Alan Jenkins | 1650602 | 2017-02-08 14:46:26 +0100 | [diff] [blame] | 531 | static struct platform_driver fujitsu_pf_driver = { |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 532 | .driver = { |
| 533 | .name = "fujitsu-laptop", |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 534 | } |
| 535 | }; |
| 536 | |
| Mathias Krause | fbe9b79 | 2014-07-16 19:43:11 +0200 | [diff] [blame] | 537 | static void __init dmi_check_cb_common(const struct dmi_system_id *id) |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 538 | { |
| Joe Perches | 77bad7c | 2011-03-29 15:21:39 -0700 | [diff] [blame] | 539 | pr_info("Identified laptop model '%s'\n", id->ident); |
| Jonathan Woithe | 0e6a66e | 2008-10-09 13:44:40 +0930 | [diff] [blame] | 540 | } |
| 541 | |
| Mathias Krause | fbe9b79 | 2014-07-16 19:43:11 +0200 | [diff] [blame] | 542 | static int __init dmi_check_cb_s6410(const struct dmi_system_id *id) |
| Jonathan Woithe | 0e6a66e | 2008-10-09 13:44:40 +0930 | [diff] [blame] | 543 | { |
| 544 | dmi_check_cb_common(id); |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 545 | fujitsu_bl->keycode1 = KEY_SCREENLOCK; /* "Lock" */ |
| 546 | fujitsu_bl->keycode2 = KEY_HELP; /* "Mobility Center" */ |
| Axel Lin | 80183a4 | 2010-07-20 15:19:40 -0700 | [diff] [blame] | 547 | return 1; |
| Jonathan Woithe | 0e6a66e | 2008-10-09 13:44:40 +0930 | [diff] [blame] | 548 | } |
| 549 | |
| Mathias Krause | fbe9b79 | 2014-07-16 19:43:11 +0200 | [diff] [blame] | 550 | static int __init dmi_check_cb_s6420(const struct dmi_system_id *id) |
| Tony Vroon | 56960b5 | 2008-11-09 04:20:05 +0000 | [diff] [blame] | 551 | { |
| 552 | dmi_check_cb_common(id); |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 553 | fujitsu_bl->keycode1 = KEY_SCREENLOCK; /* "Lock" */ |
| 554 | fujitsu_bl->keycode2 = KEY_HELP; /* "Mobility Center" */ |
| Axel Lin | 80183a4 | 2010-07-20 15:19:40 -0700 | [diff] [blame] | 555 | return 1; |
| Tony Vroon | 56960b5 | 2008-11-09 04:20:05 +0000 | [diff] [blame] | 556 | } |
| 557 | |
| Mathias Krause | fbe9b79 | 2014-07-16 19:43:11 +0200 | [diff] [blame] | 558 | static int __init dmi_check_cb_p8010(const struct dmi_system_id *id) |
| Jonathan Woithe | 0e6a66e | 2008-10-09 13:44:40 +0930 | [diff] [blame] | 559 | { |
| 560 | dmi_check_cb_common(id); |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 561 | fujitsu_bl->keycode1 = KEY_HELP; /* "Support" */ |
| 562 | fujitsu_bl->keycode3 = KEY_SWITCHVIDEOMODE; /* "Presentation" */ |
| 563 | fujitsu_bl->keycode4 = KEY_WWW; /* "Internet" */ |
| Axel Lin | 80183a4 | 2010-07-20 15:19:40 -0700 | [diff] [blame] | 564 | return 1; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 565 | } |
| 566 | |
| Mathias Krause | fbe9b79 | 2014-07-16 19:43:11 +0200 | [diff] [blame] | 567 | static const struct dmi_system_id fujitsu_dmi_table[] __initconst = { |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 568 | { |
| Jonathan Woithe | 0e6a66e | 2008-10-09 13:44:40 +0930 | [diff] [blame] | 569 | .ident = "Fujitsu Siemens S6410", |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 570 | .matches = { |
| 571 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), |
| 572 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S6410"), |
| 573 | }, |
| 574 | .callback = dmi_check_cb_s6410}, |
| Jonathan Woithe | d8196a9 | 2008-08-29 11:06:21 +0930 | [diff] [blame] | 575 | { |
| Tony Vroon | 56960b5 | 2008-11-09 04:20:05 +0000 | [diff] [blame] | 576 | .ident = "Fujitsu Siemens S6420", |
| 577 | .matches = { |
| 578 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), |
| 579 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S6420"), |
| 580 | }, |
| 581 | .callback = dmi_check_cb_s6420}, |
| 582 | { |
| Jonathan Woithe | 0e6a66e | 2008-10-09 13:44:40 +0930 | [diff] [blame] | 583 | .ident = "Fujitsu LifeBook P8010", |
| Jonathan Woithe | d8196a9 | 2008-08-29 11:06:21 +0930 | [diff] [blame] | 584 | .matches = { |
| 585 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), |
| 586 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P8010"), |
| Jonathan Woithe | 0e6a66e | 2008-10-09 13:44:40 +0930 | [diff] [blame] | 587 | }, |
| 588 | .callback = dmi_check_cb_p8010}, |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 589 | {} |
| 590 | }; |
| 591 | |
| 592 | /* ACPI device for LCD brightness control */ |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 593 | |
| Michał Kępień | f225267 | 2017-03-20 10:32:19 +0100 | [diff] [blame^] | 594 | static const struct key_entry keymap_backlight[] = { |
| 595 | { KE_KEY, true, { KEY_BRIGHTNESSUP } }, |
| 596 | { KE_KEY, false, { KEY_BRIGHTNESSDOWN } }, |
| 597 | { KE_END, 0 } |
| 598 | }; |
| 599 | |
| Michał Kępień | 7d134e4 | 2017-03-20 10:32:17 +0100 | [diff] [blame] | 600 | static int acpi_fujitsu_bl_input_setup(struct acpi_device *device) |
| 601 | { |
| 602 | struct fujitsu_bl *fujitsu_bl = acpi_driver_data(device); |
| Michał Kępień | f225267 | 2017-03-20 10:32:19 +0100 | [diff] [blame^] | 603 | int ret; |
| Michał Kępień | 7d134e4 | 2017-03-20 10:32:17 +0100 | [diff] [blame] | 604 | |
| Michał Kępień | f8a399d | 2017-03-20 10:32:18 +0100 | [diff] [blame] | 605 | fujitsu_bl->input = devm_input_allocate_device(&device->dev); |
| 606 | if (!fujitsu_bl->input) |
| Michał Kępień | 7d134e4 | 2017-03-20 10:32:17 +0100 | [diff] [blame] | 607 | return -ENOMEM; |
| 608 | |
| 609 | snprintf(fujitsu_bl->phys, sizeof(fujitsu_bl->phys), |
| 610 | "%s/video/input0", acpi_device_hid(device)); |
| 611 | |
| Michał Kępień | f8a399d | 2017-03-20 10:32:18 +0100 | [diff] [blame] | 612 | fujitsu_bl->input->name = acpi_device_name(device); |
| 613 | fujitsu_bl->input->phys = fujitsu_bl->phys; |
| 614 | fujitsu_bl->input->id.bustype = BUS_HOST; |
| 615 | fujitsu_bl->input->id.product = 0x06; |
| Michał Kępień | f225267 | 2017-03-20 10:32:19 +0100 | [diff] [blame^] | 616 | |
| 617 | ret = sparse_keymap_setup(fujitsu_bl->input, keymap_backlight, NULL); |
| 618 | if (ret) |
| 619 | return ret; |
| Michał Kępień | 7d134e4 | 2017-03-20 10:32:17 +0100 | [diff] [blame] | 620 | |
| Michał Kępień | f8a399d | 2017-03-20 10:32:18 +0100 | [diff] [blame] | 621 | return input_register_device(fujitsu_bl->input); |
| Michał Kępień | 7d134e4 | 2017-03-20 10:32:17 +0100 | [diff] [blame] | 622 | } |
| 623 | |
| Michał Kępień | b8d69c1 | 2017-03-10 11:50:33 +0100 | [diff] [blame] | 624 | static int fujitsu_backlight_register(void) |
| 625 | { |
| 626 | struct backlight_properties props = { |
| 627 | .brightness = fujitsu_bl->brightness_level, |
| 628 | .max_brightness = fujitsu_bl->max_brightness - 1, |
| 629 | .type = BACKLIGHT_PLATFORM |
| 630 | }; |
| 631 | struct backlight_device *bd; |
| 632 | |
| 633 | bd = backlight_device_register("fujitsu-laptop", NULL, NULL, |
| 634 | &fujitsu_bl_ops, &props); |
| 635 | if (IS_ERR(bd)) |
| 636 | return PTR_ERR(bd); |
| 637 | |
| 638 | fujitsu_bl->bl_device = bd; |
| 639 | |
| 640 | return 0; |
| 641 | } |
| 642 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 643 | static int acpi_fujitsu_bl_add(struct acpi_device *device) |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 644 | { |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 645 | int state = 0; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 646 | int error; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 647 | |
| 648 | if (!device) |
| 649 | return -EINVAL; |
| 650 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 651 | fujitsu_bl->acpi_handle = device->handle; |
| 652 | sprintf(acpi_device_name(device), "%s", ACPI_FUJITSU_BL_DEVICE_NAME); |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 653 | sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS); |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 654 | device->driver_data = fujitsu_bl; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 655 | |
| Michał Kępień | 7d134e4 | 2017-03-20 10:32:17 +0100 | [diff] [blame] | 656 | error = acpi_fujitsu_bl_input_setup(device); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 657 | if (error) |
| Michał Kępień | f8a399d | 2017-03-20 10:32:18 +0100 | [diff] [blame] | 658 | return error; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 659 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 660 | error = acpi_bus_update_power(fujitsu_bl->acpi_handle, &state); |
| Julia Lawall | b30bb89 | 2013-12-29 23:47:36 +0100 | [diff] [blame] | 661 | if (error) { |
| Joe Perches | 77bad7c | 2011-03-29 15:21:39 -0700 | [diff] [blame] | 662 | pr_err("Error reading power state\n"); |
| Michał Kępień | f8a399d | 2017-03-20 10:32:18 +0100 | [diff] [blame] | 663 | return error; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 664 | } |
| 665 | |
| Joe Perches | 77bad7c | 2011-03-29 15:21:39 -0700 | [diff] [blame] | 666 | pr_info("ACPI: %s [%s] (%s)\n", |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 667 | acpi_device_name(device), acpi_device_bid(device), |
| 668 | !device->power.state ? "on" : "off"); |
| 669 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 670 | fujitsu_bl->dev = device; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 671 | |
| Zhang Rui | dd13b9a | 2013-09-03 08:32:03 +0800 | [diff] [blame] | 672 | if (acpi_has_method(device->handle, METHOD_NAME__INI)) { |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 673 | vdbg_printk(FUJLAPTOP_DBG_INFO, "Invoking _INI\n"); |
| 674 | if (ACPI_FAILURE |
| 675 | (acpi_evaluate_object |
| 676 | (device->handle, METHOD_NAME__INI, NULL, NULL))) |
| Joe Perches | 77bad7c | 2011-03-29 15:21:39 -0700 | [diff] [blame] | 677 | pr_err("_INI Method failed\n"); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 678 | } |
| 679 | |
| Alan Jenkins | 5296a73 | 2017-02-08 14:46:32 +0100 | [diff] [blame] | 680 | if (use_alt_lcd_levels == -1) { |
| 681 | if (acpi_has_method(NULL, "\\_SB.PCI0.LPCB.FJEX.SBL2")) |
| 682 | use_alt_lcd_levels = 1; |
| 683 | else |
| 684 | use_alt_lcd_levels = 0; |
| 685 | vdbg_printk(FUJLAPTOP_DBG_TRACE, "auto-detected usealt as %i\n", |
| 686 | use_alt_lcd_levels); |
| 687 | } |
| 688 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 689 | /* do config (detect defaults) */ |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 690 | use_alt_lcd_levels = use_alt_lcd_levels == 1 ? 1 : 0; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 691 | disable_brightness_adjust = disable_brightness_adjust == 1 ? 1 : 0; |
| 692 | vdbg_printk(FUJLAPTOP_DBG_INFO, |
| Tony Vroon | f87a1a5 | 2009-01-07 10:11:24 +0000 | [diff] [blame] | 693 | "config: [alt interface: %d], [adjust disable: %d]\n", |
| 694 | use_alt_lcd_levels, disable_brightness_adjust); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 695 | |
| 696 | if (get_max_brightness() <= 0) |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 697 | fujitsu_bl->max_brightness = FUJITSU_LCD_N_LEVELS; |
| Tony Vroon | f87a1a5 | 2009-01-07 10:11:24 +0000 | [diff] [blame] | 698 | get_lcd_level(); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 699 | |
| Michał Kępień | aea3137 | 2017-03-10 11:50:35 +0100 | [diff] [blame] | 700 | if (acpi_video_get_backlight_type() == acpi_backlight_vendor) { |
| 701 | error = fujitsu_backlight_register(); |
| 702 | if (error) |
| Michał Kępień | f8a399d | 2017-03-20 10:32:18 +0100 | [diff] [blame] | 703 | return error; |
| Michał Kępień | aea3137 | 2017-03-10 11:50:35 +0100 | [diff] [blame] | 704 | } |
| 705 | |
| Julia Lawall | b30bb89 | 2013-12-29 23:47:36 +0100 | [diff] [blame] | 706 | return 0; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 707 | } |
| 708 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 709 | static int acpi_fujitsu_bl_remove(struct acpi_device *device) |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 710 | { |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 711 | struct fujitsu_bl *fujitsu_bl = acpi_driver_data(device); |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 712 | |
| Michał Kępień | aea3137 | 2017-03-10 11:50:35 +0100 | [diff] [blame] | 713 | backlight_device_unregister(fujitsu_bl->bl_device); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 714 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 715 | fujitsu_bl->acpi_handle = NULL; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 716 | |
| 717 | return 0; |
| 718 | } |
| 719 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 720 | /* Brightness notify */ |
| 721 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 722 | static void acpi_fujitsu_bl_notify(struct acpi_device *device, u32 event) |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 723 | { |
| 724 | struct input_dev *input; |
| Michał Kępień | f225267 | 2017-03-20 10:32:19 +0100 | [diff] [blame^] | 725 | int oldb, newb; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 726 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 727 | input = fujitsu_bl->input; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 728 | |
| Michał Kępień | 5efc800 | 2017-03-01 07:42:53 +0100 | [diff] [blame] | 729 | if (event != ACPI_FUJITSU_NOTIFY_CODE1) { |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 730 | vdbg_printk(FUJLAPTOP_DBG_WARN, |
| 731 | "unsupported event [0x%x]\n", event); |
| Michał Kępień | f225267 | 2017-03-20 10:32:19 +0100 | [diff] [blame^] | 732 | sparse_keymap_report_event(input, -1, 1, true); |
| Michał Kępień | 5efc800 | 2017-03-01 07:42:53 +0100 | [diff] [blame] | 733 | return; |
| 734 | } |
| 735 | |
| Michał Kępień | 5efc800 | 2017-03-01 07:42:53 +0100 | [diff] [blame] | 736 | oldb = fujitsu_bl->brightness_level; |
| 737 | get_lcd_level(); |
| 738 | newb = fujitsu_bl->brightness_level; |
| 739 | |
| 740 | vdbg_printk(FUJLAPTOP_DBG_TRACE, |
| 741 | "brightness button event [%i -> %i (%i)]\n", |
| 742 | oldb, newb, fujitsu_bl->brightness_changed); |
| 743 | |
| Michał Kępień | d2aa3ae | 2017-03-01 07:42:54 +0100 | [diff] [blame] | 744 | if (oldb == newb) |
| 745 | return; |
| 746 | |
| 747 | if (disable_brightness_adjust != 1) { |
| 748 | if (use_alt_lcd_levels) |
| 749 | set_lcd_level_alt(newb); |
| 750 | else |
| 751 | set_lcd_level(newb); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 752 | } |
| 753 | |
| Michał Kępień | f225267 | 2017-03-20 10:32:19 +0100 | [diff] [blame^] | 754 | sparse_keymap_report_event(input, oldb < newb, 1, true); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 755 | } |
| 756 | |
| 757 | /* ACPI device for hotkey handling */ |
| 758 | |
| Michał Kępień | d811b51 | 2017-03-14 11:26:29 +0100 | [diff] [blame] | 759 | static int fujitsu_laptop_platform_add(void) |
| 760 | { |
| 761 | int ret; |
| 762 | |
| Michał Kępień | 979800e | 2017-03-14 11:26:31 +0100 | [diff] [blame] | 763 | fujitsu_laptop->pf_device = platform_device_alloc("fujitsu-laptop", -1); |
| 764 | if (!fujitsu_laptop->pf_device) |
| Michał Kępień | d811b51 | 2017-03-14 11:26:29 +0100 | [diff] [blame] | 765 | return -ENOMEM; |
| 766 | |
| Michał Kępień | 979800e | 2017-03-14 11:26:31 +0100 | [diff] [blame] | 767 | ret = platform_device_add(fujitsu_laptop->pf_device); |
| Michał Kępień | d811b51 | 2017-03-14 11:26:29 +0100 | [diff] [blame] | 768 | if (ret) |
| 769 | goto err_put_platform_device; |
| 770 | |
| Michał Kępień | 979800e | 2017-03-14 11:26:31 +0100 | [diff] [blame] | 771 | ret = sysfs_create_group(&fujitsu_laptop->pf_device->dev.kobj, |
| Michał Kępień | d811b51 | 2017-03-14 11:26:29 +0100 | [diff] [blame] | 772 | &fujitsu_pf_attribute_group); |
| 773 | if (ret) |
| 774 | goto err_del_platform_device; |
| 775 | |
| 776 | return 0; |
| 777 | |
| 778 | err_del_platform_device: |
| Michał Kępień | 979800e | 2017-03-14 11:26:31 +0100 | [diff] [blame] | 779 | platform_device_del(fujitsu_laptop->pf_device); |
| Michał Kępień | d811b51 | 2017-03-14 11:26:29 +0100 | [diff] [blame] | 780 | err_put_platform_device: |
| Michał Kępień | 979800e | 2017-03-14 11:26:31 +0100 | [diff] [blame] | 781 | platform_device_put(fujitsu_laptop->pf_device); |
| Michał Kępień | d811b51 | 2017-03-14 11:26:29 +0100 | [diff] [blame] | 782 | |
| 783 | return ret; |
| 784 | } |
| 785 | |
| 786 | static void fujitsu_laptop_platform_remove(void) |
| 787 | { |
| Michał Kępień | 979800e | 2017-03-14 11:26:31 +0100 | [diff] [blame] | 788 | sysfs_remove_group(&fujitsu_laptop->pf_device->dev.kobj, |
| Michał Kępień | d811b51 | 2017-03-14 11:26:29 +0100 | [diff] [blame] | 789 | &fujitsu_pf_attribute_group); |
| Michał Kępień | 979800e | 2017-03-14 11:26:31 +0100 | [diff] [blame] | 790 | platform_device_unregister(fujitsu_laptop->pf_device); |
| Michał Kępień | d811b51 | 2017-03-14 11:26:29 +0100 | [diff] [blame] | 791 | } |
| 792 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 793 | static int acpi_fujitsu_laptop_add(struct acpi_device *device) |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 794 | { |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 795 | int result = 0; |
| 796 | int state = 0; |
| 797 | struct input_dev *input; |
| 798 | int error; |
| 799 | int i; |
| 800 | |
| 801 | if (!device) |
| 802 | return -EINVAL; |
| 803 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 804 | fujitsu_laptop->acpi_handle = device->handle; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 805 | sprintf(acpi_device_name(device), "%s", |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 806 | ACPI_FUJITSU_LAPTOP_DEVICE_NAME); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 807 | sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS); |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 808 | device->driver_data = fujitsu_laptop; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 809 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 810 | /* kfifo */ |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 811 | spin_lock_init(&fujitsu_laptop->fifo_lock); |
| 812 | error = kfifo_alloc(&fujitsu_laptop->fifo, RINGBUFFERSIZE * sizeof(int), |
| Stefani Seibold | c1e13f2 | 2009-12-21 14:37:27 -0800 | [diff] [blame] | 813 | GFP_KERNEL); |
| Stefani Seibold | 4546548 | 2009-12-21 14:37:26 -0800 | [diff] [blame] | 814 | if (error) { |
| Joe Perches | 77bad7c | 2011-03-29 15:21:39 -0700 | [diff] [blame] | 815 | pr_err("kfifo_alloc failed\n"); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 816 | goto err_stop; |
| 817 | } |
| 818 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 819 | fujitsu_laptop->input = input = input_allocate_device(); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 820 | if (!input) { |
| 821 | error = -ENOMEM; |
| Bjorn Helgaas | b4ec027 | 2009-04-07 15:37:22 +0000 | [diff] [blame] | 822 | goto err_free_fifo; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 823 | } |
| 824 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 825 | snprintf(fujitsu_laptop->phys, sizeof(fujitsu_laptop->phys), |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 826 | "%s/video/input0", acpi_device_hid(device)); |
| 827 | |
| 828 | input->name = acpi_device_name(device); |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 829 | input->phys = fujitsu_laptop->phys; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 830 | input->id.bustype = BUS_HOST; |
| 831 | input->id.product = 0x06; |
| 832 | input->dev.parent = &device->dev; |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 833 | |
| 834 | set_bit(EV_KEY, input->evbit); |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 835 | set_bit(fujitsu_bl->keycode1, input->keybit); |
| 836 | set_bit(fujitsu_bl->keycode2, input->keybit); |
| 837 | set_bit(fujitsu_bl->keycode3, input->keybit); |
| 838 | set_bit(fujitsu_bl->keycode4, input->keybit); |
| 839 | set_bit(fujitsu_bl->keycode5, input->keybit); |
| Michał Kępień | 1879e69 | 2016-06-28 09:25:50 +0200 | [diff] [blame] | 840 | set_bit(KEY_TOUCHPAD_TOGGLE, input->keybit); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 841 | set_bit(KEY_UNKNOWN, input->keybit); |
| 842 | |
| 843 | error = input_register_device(input); |
| 844 | if (error) |
| 845 | goto err_free_input_dev; |
| 846 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 847 | error = acpi_bus_update_power(fujitsu_laptop->acpi_handle, &state); |
| Julia Lawall | b30bb89 | 2013-12-29 23:47:36 +0100 | [diff] [blame] | 848 | if (error) { |
| Joe Perches | 77bad7c | 2011-03-29 15:21:39 -0700 | [diff] [blame] | 849 | pr_err("Error reading power state\n"); |
| Bartlomiej Zolnierkiewicz | 72afeea | 2009-07-31 18:16:02 +0930 | [diff] [blame] | 850 | goto err_unregister_input_dev; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 851 | } |
| 852 | |
| Joe Perches | 77bad7c | 2011-03-29 15:21:39 -0700 | [diff] [blame] | 853 | pr_info("ACPI: %s [%s] (%s)\n", |
| 854 | acpi_device_name(device), acpi_device_bid(device), |
| 855 | !device->power.state ? "on" : "off"); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 856 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 857 | fujitsu_laptop->dev = device; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 858 | |
| Zhang Rui | dd13b9a | 2013-09-03 08:32:03 +0800 | [diff] [blame] | 859 | if (acpi_has_method(device->handle, METHOD_NAME__INI)) { |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 860 | vdbg_printk(FUJLAPTOP_DBG_INFO, "Invoking _INI\n"); |
| 861 | if (ACPI_FAILURE |
| 862 | (acpi_evaluate_object |
| 863 | (device->handle, METHOD_NAME__INI, NULL, NULL))) |
| Joe Perches | 77bad7c | 2011-03-29 15:21:39 -0700 | [diff] [blame] | 864 | pr_err("_INI Method failed\n"); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 865 | } |
| 866 | |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 867 | i = 0; |
| 868 | while (call_fext_func(FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0 |
| 869 | && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) |
| 870 | ; /* No action, result is discarded */ |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 871 | vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i); |
| 872 | |
| Alan Jenkins | 8ef27bd | 2017-02-08 14:46:27 +0100 | [diff] [blame] | 873 | fujitsu_laptop->flags_supported = |
| 874 | call_fext_func(FUNC_FLAGS, 0x0, 0x0, 0x0); |
| Tony Vroon | 4898c2b | 2009-02-02 11:11:10 +0000 | [diff] [blame] | 875 | |
| 876 | /* Make sure our bitmask of supported functions is cleared if the |
| 877 | RFKILL function block is not implemented, like on the S7020. */ |
| Alan Jenkins | 8ef27bd | 2017-02-08 14:46:27 +0100 | [diff] [blame] | 878 | if (fujitsu_laptop->flags_supported == UNSUPPORTED_CMD) |
| 879 | fujitsu_laptop->flags_supported = 0; |
| Tony Vroon | 4898c2b | 2009-02-02 11:11:10 +0000 | [diff] [blame] | 880 | |
| Alan Jenkins | 8ef27bd | 2017-02-08 14:46:27 +0100 | [diff] [blame] | 881 | if (fujitsu_laptop->flags_supported) |
| 882 | fujitsu_laptop->flags_state = |
| 883 | call_fext_func(FUNC_FLAGS, 0x4, 0x0, 0x0); |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 884 | |
| 885 | /* Suspect this is a keymap of the application panel, print it */ |
| Joe Perches | 77bad7c | 2011-03-29 15:21:39 -0700 | [diff] [blame] | 886 | pr_info("BTNI: [0x%x]\n", call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0)); |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 887 | |
| Michał Kępień | 1877e26 | 2017-03-10 11:50:34 +0100 | [diff] [blame] | 888 | /* Sync backlight power status */ |
| Michał Kępień | aea3137 | 2017-03-10 11:50:35 +0100 | [diff] [blame] | 889 | if (fujitsu_bl->bl_device && |
| 890 | acpi_video_get_backlight_type() == acpi_backlight_vendor) { |
| Michał Kępień | 1877e26 | 2017-03-10 11:50:34 +0100 | [diff] [blame] | 891 | if (call_fext_func(FUNC_BACKLIGHT, 0x2, 0x4, 0x0) == 3) |
| 892 | fujitsu_bl->bl_device->props.power = FB_BLANK_POWERDOWN; |
| 893 | else |
| 894 | fujitsu_bl->bl_device->props.power = FB_BLANK_UNBLANK; |
| 895 | } |
| 896 | |
| Michał Kępień | c33f4c0 | 2017-03-14 11:26:30 +0100 | [diff] [blame] | 897 | error = fujitsu_laptop_platform_add(); |
| 898 | if (error) |
| 899 | goto err_unregister_input_dev; |
| 900 | |
| Javier Martinez Canillas | 575b245 | 2016-04-26 18:28:17 -0400 | [diff] [blame] | 901 | #if IS_ENABLED(CONFIG_LEDS_CLASS) |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 902 | if (call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) { |
| Michał Kępień | 979800e | 2017-03-14 11:26:31 +0100 | [diff] [blame] | 903 | result = led_classdev_register(&fujitsu_laptop->pf_device->dev, |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 904 | &logolamp_led); |
| 905 | if (result == 0) { |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 906 | fujitsu_laptop->logolamp_registered = 1; |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 907 | } else { |
| Joe Perches | 77bad7c | 2011-03-29 15:21:39 -0700 | [diff] [blame] | 908 | pr_err("Could not register LED handler for logo lamp, error %i\n", |
| 909 | result); |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 910 | } |
| 911 | } |
| 912 | |
| 913 | if ((call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & KEYBOARD_LAMPS) && |
| 914 | (call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0) == 0x0)) { |
| Michał Kępień | 979800e | 2017-03-14 11:26:31 +0100 | [diff] [blame] | 915 | result = led_classdev_register(&fujitsu_laptop->pf_device->dev, |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 916 | &kblamps_led); |
| 917 | if (result == 0) { |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 918 | fujitsu_laptop->kblamps_registered = 1; |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 919 | } else { |
| Joe Perches | 77bad7c | 2011-03-29 15:21:39 -0700 | [diff] [blame] | 920 | pr_err("Could not register LED handler for keyboard lamps, error %i\n", |
| 921 | result); |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 922 | } |
| 923 | } |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 924 | |
| 925 | /* |
| 926 | * BTNI bit 24 seems to indicate the presence of a radio toggle |
| 927 | * button in place of a slide switch, and all such machines appear |
| 928 | * to also have an RF LED. Therefore use bit 24 as an indicator |
| 929 | * that an RF LED is present. |
| 930 | */ |
| 931 | if (call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0) & BIT(24)) { |
| Michał Kępień | 979800e | 2017-03-14 11:26:31 +0100 | [diff] [blame] | 932 | result = led_classdev_register(&fujitsu_laptop->pf_device->dev, |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 933 | &radio_led); |
| 934 | if (result == 0) { |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 935 | fujitsu_laptop->radio_led_registered = 1; |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 936 | } else { |
| 937 | pr_err("Could not register LED handler for radio LED, error %i\n", |
| 938 | result); |
| 939 | } |
| 940 | } |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 941 | |
| 942 | /* Support for eco led is not always signaled in bit corresponding |
| 943 | * to the bit used to control the led. According to the DSDT table, |
| 944 | * bit 14 seems to indicate presence of said led as well. |
| 945 | * Confirm by testing the status. |
| 946 | */ |
| 947 | if ((call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & BIT(14)) && |
| 948 | (call_fext_func(FUNC_LEDS, 0x2, ECO_LED, 0x0) != UNSUPPORTED_CMD)) { |
| Michał Kępień | 979800e | 2017-03-14 11:26:31 +0100 | [diff] [blame] | 949 | result = led_classdev_register(&fujitsu_laptop->pf_device->dev, |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 950 | &eco_led); |
| 951 | if (result == 0) { |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 952 | fujitsu_laptop->eco_led_registered = 1; |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 953 | } else { |
| 954 | pr_err("Could not register LED handler for eco LED, error %i\n", |
| 955 | result); |
| 956 | } |
| 957 | } |
| Bartlomiej Zolnierkiewicz | 72afeea | 2009-07-31 18:16:02 +0930 | [diff] [blame] | 958 | #endif |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 959 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 960 | return result; |
| 961 | |
| Bartlomiej Zolnierkiewicz | 72afeea | 2009-07-31 18:16:02 +0930 | [diff] [blame] | 962 | err_unregister_input_dev: |
| 963 | input_unregister_device(input); |
| Axel Lin | 8e4e2ef | 2010-07-20 15:19:34 -0700 | [diff] [blame] | 964 | input = NULL; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 965 | err_free_input_dev: |
| 966 | input_free_device(input); |
| Bjorn Helgaas | b4ec027 | 2009-04-07 15:37:22 +0000 | [diff] [blame] | 967 | err_free_fifo: |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 968 | kfifo_free(&fujitsu_laptop->fifo); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 969 | err_stop: |
| Julia Lawall | b30bb89 | 2013-12-29 23:47:36 +0100 | [diff] [blame] | 970 | return error; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 971 | } |
| 972 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 973 | static int acpi_fujitsu_laptop_remove(struct acpi_device *device) |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 974 | { |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 975 | struct fujitsu_laptop *fujitsu_laptop = acpi_driver_data(device); |
| 976 | struct input_dev *input = fujitsu_laptop->input; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 977 | |
| Javier Martinez Canillas | 575b245 | 2016-04-26 18:28:17 -0400 | [diff] [blame] | 978 | #if IS_ENABLED(CONFIG_LEDS_CLASS) |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 979 | if (fujitsu_laptop->logolamp_registered) |
| Bartlomiej Zolnierkiewicz | 72afeea | 2009-07-31 18:16:02 +0930 | [diff] [blame] | 980 | led_classdev_unregister(&logolamp_led); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 981 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 982 | if (fujitsu_laptop->kblamps_registered) |
| Bartlomiej Zolnierkiewicz | 72afeea | 2009-07-31 18:16:02 +0930 | [diff] [blame] | 983 | led_classdev_unregister(&kblamps_led); |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 984 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 985 | if (fujitsu_laptop->radio_led_registered) |
| Michał Kępień | 4f62568 | 2016-04-12 22:06:34 +0930 | [diff] [blame] | 986 | led_classdev_unregister(&radio_led); |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 987 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 988 | if (fujitsu_laptop->eco_led_registered) |
| Matej Groma | d6b88f6 | 2016-06-21 10:09:21 +0200 | [diff] [blame] | 989 | led_classdev_unregister(&eco_led); |
| Bartlomiej Zolnierkiewicz | 72afeea | 2009-07-31 18:16:02 +0930 | [diff] [blame] | 990 | #endif |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 991 | |
| Michał Kępień | c33f4c0 | 2017-03-14 11:26:30 +0100 | [diff] [blame] | 992 | fujitsu_laptop_platform_remove(); |
| 993 | |
| Bartlomiej Zolnierkiewicz | 72afeea | 2009-07-31 18:16:02 +0930 | [diff] [blame] | 994 | input_unregister_device(input); |
| 995 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 996 | kfifo_free(&fujitsu_laptop->fifo); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 997 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 998 | fujitsu_laptop->acpi_handle = NULL; |
| Bartlomiej Zolnierkiewicz | 72afeea | 2009-07-31 18:16:02 +0930 | [diff] [blame] | 999 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1000 | return 0; |
| 1001 | } |
| 1002 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1003 | static void acpi_fujitsu_laptop_press(int keycode) |
| Michał Kępień | 2451d19 | 2017-01-11 09:59:31 +0100 | [diff] [blame] | 1004 | { |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1005 | struct input_dev *input = fujitsu_laptop->input; |
| Michał Kępień | 2451d19 | 2017-01-11 09:59:31 +0100 | [diff] [blame] | 1006 | int status; |
| 1007 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1008 | status = kfifo_in_locked(&fujitsu_laptop->fifo, |
| Michał Kępień | 2451d19 | 2017-01-11 09:59:31 +0100 | [diff] [blame] | 1009 | (unsigned char *)&keycode, sizeof(keycode), |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1010 | &fujitsu_laptop->fifo_lock); |
| Michał Kępień | 2451d19 | 2017-01-11 09:59:31 +0100 | [diff] [blame] | 1011 | if (status != sizeof(keycode)) { |
| 1012 | vdbg_printk(FUJLAPTOP_DBG_WARN, |
| 1013 | "Could not push keycode [0x%x]\n", keycode); |
| Michał Kępień | a28c7e9 | 2017-01-11 09:59:33 +0100 | [diff] [blame] | 1014 | return; |
| Michał Kępień | 2451d19 | 2017-01-11 09:59:31 +0100 | [diff] [blame] | 1015 | } |
| Michał Kępień | a28c7e9 | 2017-01-11 09:59:33 +0100 | [diff] [blame] | 1016 | input_report_key(input, keycode, 1); |
| 1017 | input_sync(input); |
| 1018 | vdbg_printk(FUJLAPTOP_DBG_TRACE, |
| 1019 | "Push keycode into ringbuffer [%d]\n", keycode); |
| Michał Kępień | 2451d19 | 2017-01-11 09:59:31 +0100 | [diff] [blame] | 1020 | } |
| 1021 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1022 | static void acpi_fujitsu_laptop_release(void) |
| Michał Kępień | 2451d19 | 2017-01-11 09:59:31 +0100 | [diff] [blame] | 1023 | { |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1024 | struct input_dev *input = fujitsu_laptop->input; |
| Michał Kępień | 2451d19 | 2017-01-11 09:59:31 +0100 | [diff] [blame] | 1025 | int keycode, status; |
| 1026 | |
| Michał Kępień | 29544f0 | 2017-01-11 09:59:32 +0100 | [diff] [blame] | 1027 | while (true) { |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1028 | status = kfifo_out_locked(&fujitsu_laptop->fifo, |
| Michał Kępień | 2451d19 | 2017-01-11 09:59:31 +0100 | [diff] [blame] | 1029 | (unsigned char *)&keycode, |
| 1030 | sizeof(keycode), |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1031 | &fujitsu_laptop->fifo_lock); |
| Michał Kępień | 29544f0 | 2017-01-11 09:59:32 +0100 | [diff] [blame] | 1032 | if (status != sizeof(keycode)) |
| 1033 | return; |
| Michał Kępień | 2451d19 | 2017-01-11 09:59:31 +0100 | [diff] [blame] | 1034 | input_report_key(input, keycode, 0); |
| 1035 | input_sync(input); |
| 1036 | vdbg_printk(FUJLAPTOP_DBG_TRACE, |
| 1037 | "Pop keycode from ringbuffer [%d]\n", keycode); |
| 1038 | } |
| 1039 | } |
| 1040 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1041 | static void acpi_fujitsu_laptop_notify(struct acpi_device *device, u32 event) |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1042 | { |
| 1043 | struct input_dev *input; |
| Michał Kępień | 2451d19 | 2017-01-11 09:59:31 +0100 | [diff] [blame] | 1044 | int keycode; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1045 | unsigned int irb = 1; |
| Michał Kępień | 2451d19 | 2017-01-11 09:59:31 +0100 | [diff] [blame] | 1046 | int i; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1047 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1048 | input = fujitsu_laptop->input; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1049 | |
| Michał Kępień | eb357cb | 2017-01-11 09:59:30 +0100 | [diff] [blame] | 1050 | if (event != ACPI_FUJITSU_NOTIFY_CODE1) { |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1051 | keycode = KEY_UNKNOWN; |
| 1052 | vdbg_printk(FUJLAPTOP_DBG_WARN, |
| 1053 | "Unsupported event [0x%x]\n", event); |
| 1054 | input_report_key(input, keycode, 1); |
| 1055 | input_sync(input); |
| 1056 | input_report_key(input, keycode, 0); |
| 1057 | input_sync(input); |
| Michał Kępień | eb357cb | 2017-01-11 09:59:30 +0100 | [diff] [blame] | 1058 | return; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1059 | } |
| Michał Kępień | eb357cb | 2017-01-11 09:59:30 +0100 | [diff] [blame] | 1060 | |
| Alan Jenkins | 8ef27bd | 2017-02-08 14:46:27 +0100 | [diff] [blame] | 1061 | if (fujitsu_laptop->flags_supported) |
| 1062 | fujitsu_laptop->flags_state = |
| 1063 | call_fext_func(FUNC_FLAGS, 0x4, 0x0, 0x0); |
| Michał Kępień | eb357cb | 2017-01-11 09:59:30 +0100 | [diff] [blame] | 1064 | |
| 1065 | i = 0; |
| 1066 | while ((irb = |
| 1067 | call_fext_func(FUNC_BUTTONS, 0x1, 0x0, 0x0)) != 0 |
| 1068 | && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) { |
| 1069 | switch (irb & 0x4ff) { |
| 1070 | case KEY1_CODE: |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1071 | keycode = fujitsu_bl->keycode1; |
| Michał Kępień | eb357cb | 2017-01-11 09:59:30 +0100 | [diff] [blame] | 1072 | break; |
| 1073 | case KEY2_CODE: |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1074 | keycode = fujitsu_bl->keycode2; |
| Michał Kępień | eb357cb | 2017-01-11 09:59:30 +0100 | [diff] [blame] | 1075 | break; |
| 1076 | case KEY3_CODE: |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1077 | keycode = fujitsu_bl->keycode3; |
| Michał Kępień | eb357cb | 2017-01-11 09:59:30 +0100 | [diff] [blame] | 1078 | break; |
| 1079 | case KEY4_CODE: |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1080 | keycode = fujitsu_bl->keycode4; |
| Michał Kępień | eb357cb | 2017-01-11 09:59:30 +0100 | [diff] [blame] | 1081 | break; |
| 1082 | case KEY5_CODE: |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1083 | keycode = fujitsu_bl->keycode5; |
| Michał Kępień | eb357cb | 2017-01-11 09:59:30 +0100 | [diff] [blame] | 1084 | break; |
| 1085 | case 0: |
| 1086 | keycode = 0; |
| 1087 | break; |
| 1088 | default: |
| 1089 | vdbg_printk(FUJLAPTOP_DBG_WARN, |
| 1090 | "Unknown GIRB result [%x]\n", irb); |
| 1091 | keycode = -1; |
| 1092 | break; |
| 1093 | } |
| Michał Kępień | 2451d19 | 2017-01-11 09:59:31 +0100 | [diff] [blame] | 1094 | |
| 1095 | if (keycode > 0) |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1096 | acpi_fujitsu_laptop_press(keycode); |
| Michał Kępień | 2451d19 | 2017-01-11 09:59:31 +0100 | [diff] [blame] | 1097 | else if (keycode == 0) |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1098 | acpi_fujitsu_laptop_release(); |
| Michał Kępień | eb357cb | 2017-01-11 09:59:30 +0100 | [diff] [blame] | 1099 | } |
| 1100 | |
| 1101 | /* On some models (first seen on the Skylake-based Lifebook |
| 1102 | * E736/E746/E756), the touchpad toggle hotkey (Fn+F4) is |
| Alan Jenkins | 8ef27bd | 2017-02-08 14:46:27 +0100 | [diff] [blame] | 1103 | * handled in software; its state is queried using FUNC_FLAGS |
| Michał Kępień | eb357cb | 2017-01-11 09:59:30 +0100 | [diff] [blame] | 1104 | */ |
| Alan Jenkins | 8ef27bd | 2017-02-08 14:46:27 +0100 | [diff] [blame] | 1105 | if ((fujitsu_laptop->flags_supported & BIT(26)) && |
| 1106 | (call_fext_func(FUNC_FLAGS, 0x1, 0x0, 0x0) & BIT(26))) { |
| Michał Kępień | eb357cb | 2017-01-11 09:59:30 +0100 | [diff] [blame] | 1107 | keycode = KEY_TOUCHPAD_TOGGLE; |
| 1108 | input_report_key(input, keycode, 1); |
| 1109 | input_sync(input); |
| 1110 | input_report_key(input, keycode, 0); |
| 1111 | input_sync(input); |
| 1112 | } |
| 1113 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1114 | } |
| 1115 | |
| 1116 | /* Initialization */ |
| 1117 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1118 | static const struct acpi_device_id fujitsu_bl_device_ids[] = { |
| 1119 | {ACPI_FUJITSU_BL_HID, 0}, |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1120 | {"", 0}, |
| 1121 | }; |
| 1122 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1123 | static struct acpi_driver acpi_fujitsu_bl_driver = { |
| 1124 | .name = ACPI_FUJITSU_BL_DRIVER_NAME, |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1125 | .class = ACPI_FUJITSU_CLASS, |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1126 | .ids = fujitsu_bl_device_ids, |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1127 | .ops = { |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1128 | .add = acpi_fujitsu_bl_add, |
| 1129 | .remove = acpi_fujitsu_bl_remove, |
| 1130 | .notify = acpi_fujitsu_bl_notify, |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1131 | }, |
| 1132 | }; |
| 1133 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1134 | static const struct acpi_device_id fujitsu_laptop_device_ids[] = { |
| 1135 | {ACPI_FUJITSU_LAPTOP_HID, 0}, |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1136 | {"", 0}, |
| 1137 | }; |
| 1138 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1139 | static struct acpi_driver acpi_fujitsu_laptop_driver = { |
| 1140 | .name = ACPI_FUJITSU_LAPTOP_DRIVER_NAME, |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1141 | .class = ACPI_FUJITSU_CLASS, |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1142 | .ids = fujitsu_laptop_device_ids, |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1143 | .ops = { |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1144 | .add = acpi_fujitsu_laptop_add, |
| 1145 | .remove = acpi_fujitsu_laptop_remove, |
| 1146 | .notify = acpi_fujitsu_laptop_notify, |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1147 | }, |
| 1148 | }; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1149 | |
| Zhang Rui | 4990141 | 2014-09-09 00:21:59 +0200 | [diff] [blame] | 1150 | static const struct acpi_device_id fujitsu_ids[] __used = { |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1151 | {ACPI_FUJITSU_BL_HID, 0}, |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1152 | {ACPI_FUJITSU_LAPTOP_HID, 0}, |
| Zhang Rui | 4990141 | 2014-09-09 00:21:59 +0200 | [diff] [blame] | 1153 | {"", 0} |
| 1154 | }; |
| 1155 | MODULE_DEVICE_TABLE(acpi, fujitsu_ids); |
| 1156 | |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1157 | static int __init fujitsu_init(void) |
| 1158 | { |
| Michał Kępień | b8d69c1 | 2017-03-10 11:50:33 +0100 | [diff] [blame] | 1159 | int ret; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1160 | |
| 1161 | if (acpi_disabled) |
| 1162 | return -ENODEV; |
| 1163 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1164 | fujitsu_bl = kzalloc(sizeof(struct fujitsu_bl), GFP_KERNEL); |
| 1165 | if (!fujitsu_bl) |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1166 | return -ENOMEM; |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1167 | fujitsu_bl->keycode1 = KEY_PROG1; |
| 1168 | fujitsu_bl->keycode2 = KEY_PROG2; |
| 1169 | fujitsu_bl->keycode3 = KEY_PROG3; |
| 1170 | fujitsu_bl->keycode4 = KEY_PROG4; |
| 1171 | fujitsu_bl->keycode5 = KEY_RFKILL; |
| Jonathan Woithe | 0e6a66e | 2008-10-09 13:44:40 +0930 | [diff] [blame] | 1172 | dmi_check_system(fujitsu_dmi_table); |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1173 | |
| Alan Jenkins | c1d1e8a | 2017-02-08 14:46:30 +0100 | [diff] [blame] | 1174 | ret = acpi_bus_register_driver(&acpi_fujitsu_bl_driver); |
| 1175 | if (ret) |
| Michał Kępień | c2cddd4 | 2017-03-10 11:50:36 +0100 | [diff] [blame] | 1176 | goto err_free_fujitsu_bl; |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1177 | |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1178 | /* Register platform stuff */ |
| 1179 | |
| Alan Jenkins | 1650602 | 2017-02-08 14:46:26 +0100 | [diff] [blame] | 1180 | ret = platform_driver_register(&fujitsu_pf_driver); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1181 | if (ret) |
| Michał Kępień | c33f4c0 | 2017-03-14 11:26:30 +0100 | [diff] [blame] | 1182 | goto err_unregister_acpi; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1183 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1184 | /* Register laptop driver */ |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1185 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1186 | fujitsu_laptop = kzalloc(sizeof(struct fujitsu_laptop), GFP_KERNEL); |
| 1187 | if (!fujitsu_laptop) { |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1188 | ret = -ENOMEM; |
| Michał Kępień | c2cddd4 | 2017-03-10 11:50:36 +0100 | [diff] [blame] | 1189 | goto err_unregister_platform_driver; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1190 | } |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1191 | |
| Alan Jenkins | c1d1e8a | 2017-02-08 14:46:30 +0100 | [diff] [blame] | 1192 | ret = acpi_bus_register_driver(&acpi_fujitsu_laptop_driver); |
| 1193 | if (ret) |
| Michał Kępień | c2cddd4 | 2017-03-10 11:50:36 +0100 | [diff] [blame] | 1194 | goto err_free_fujitsu_laptop; |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1195 | |
| Joe Perches | 77bad7c | 2011-03-29 15:21:39 -0700 | [diff] [blame] | 1196 | pr_info("driver " FUJITSU_DRIVER_VERSION " successfully loaded\n"); |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1197 | |
| 1198 | return 0; |
| 1199 | |
| Michał Kępień | c2cddd4 | 2017-03-10 11:50:36 +0100 | [diff] [blame] | 1200 | err_free_fujitsu_laptop: |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1201 | kfree(fujitsu_laptop); |
| Michał Kępień | c2cddd4 | 2017-03-10 11:50:36 +0100 | [diff] [blame] | 1202 | err_unregister_platform_driver: |
| Alan Jenkins | 1650602 | 2017-02-08 14:46:26 +0100 | [diff] [blame] | 1203 | platform_driver_unregister(&fujitsu_pf_driver); |
| Michał Kępień | c2cddd4 | 2017-03-10 11:50:36 +0100 | [diff] [blame] | 1204 | err_unregister_acpi: |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1205 | acpi_bus_unregister_driver(&acpi_fujitsu_bl_driver); |
| Michał Kępień | c2cddd4 | 2017-03-10 11:50:36 +0100 | [diff] [blame] | 1206 | err_free_fujitsu_bl: |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1207 | kfree(fujitsu_bl); |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1208 | |
| 1209 | return ret; |
| 1210 | } |
| 1211 | |
| 1212 | static void __exit fujitsu_cleanup(void) |
| 1213 | { |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1214 | acpi_bus_unregister_driver(&acpi_fujitsu_laptop_driver); |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 1215 | |
| Alan Jenkins | 6942eab | 2017-02-08 14:46:25 +0100 | [diff] [blame] | 1216 | kfree(fujitsu_laptop); |
| Bartlomiej Zolnierkiewicz | 72afeea | 2009-07-31 18:16:02 +0930 | [diff] [blame] | 1217 | |
| Alan Jenkins | 1650602 | 2017-02-08 14:46:26 +0100 | [diff] [blame] | 1218 | platform_driver_unregister(&fujitsu_pf_driver); |
| Bartlomiej Zolnierkiewicz | 72afeea | 2009-07-31 18:16:02 +0930 | [diff] [blame] | 1219 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1220 | acpi_bus_unregister_driver(&acpi_fujitsu_bl_driver); |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1221 | |
| Alan Jenkins | 9fc5cf6 | 2017-02-08 14:46:24 +0100 | [diff] [blame] | 1222 | kfree(fujitsu_bl); |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1223 | |
| Joe Perches | 77bad7c | 2011-03-29 15:21:39 -0700 | [diff] [blame] | 1224 | pr_info("driver unloaded\n"); |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1225 | } |
| 1226 | |
| 1227 | module_init(fujitsu_init); |
| 1228 | module_exit(fujitsu_cleanup); |
| 1229 | |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1230 | module_param(use_alt_lcd_levels, uint, 0644); |
| 1231 | MODULE_PARM_DESC(use_alt_lcd_levels, |
| 1232 | "Use alternative interface for lcd_levels (needed for Lifebook s6410)."); |
| Jonathan Woithe | 20b9373 | 2008-06-11 10:14:56 +0930 | [diff] [blame] | 1233 | module_param(disable_brightness_adjust, uint, 0644); |
| 1234 | MODULE_PARM_DESC(disable_brightness_adjust, "Disable brightness adjustment ."); |
| 1235 | #ifdef CONFIG_FUJITSU_LAPTOP_DEBUG |
| 1236 | module_param_named(debug, dbg_level, uint, 0644); |
| 1237 | MODULE_PARM_DESC(debug, "Sets debug level bit-mask"); |
| 1238 | #endif |
| 1239 | |
| Tony Vroon | 3a40708 | 2008-12-31 18:19:59 +0000 | [diff] [blame] | 1240 | MODULE_AUTHOR("Jonathan Woithe, Peter Gruber, Tony Vroon"); |
| Jonathan Woithe | d048253 | 2007-08-29 15:58:19 +0930 | [diff] [blame] | 1241 | MODULE_DESCRIPTION("Fujitsu laptop extras support"); |
| 1242 | MODULE_VERSION(FUJITSU_DRIVER_VERSION); |
| 1243 | MODULE_LICENSE("GPL"); |