fujitsu-laptop.c 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234
  1. /*-*-linux-c-*-*/
  2. /*
  3. Copyright (C) 2007,2008 Jonathan Woithe <jwoithe@just42.net>
  4. Copyright (C) 2008 Peter Gruber <nokos@gmx.net>
  5. Copyright (C) 2008 Tony Vroon <tony@linx.net>
  6. Based on earlier work:
  7. Copyright (C) 2003 Shane Spencer <shane@bogomip.com>
  8. Adrian Yee <brewt-fujitsu@brewt.org>
  9. Templated from msi-laptop.c and thinkpad_acpi.c which is copyright
  10. by its respective authors.
  11. This program is free software; you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation; either version 2 of the License, or
  14. (at your option) any later version.
  15. This program is distributed in the hope that it will be useful, but
  16. WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. General Public License for more details.
  19. You should have received a copy of the GNU General Public License
  20. along with this program; if not, write to the Free Software
  21. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  22. 02110-1301, USA.
  23. */
  24. /*
  25. * fujitsu-laptop.c - Fujitsu laptop support, providing access to additional
  26. * features made available on a range of Fujitsu laptops including the
  27. * P2xxx/P5xxx/S6xxx/S7xxx series.
  28. *
  29. * This driver exports a few files in /sys/devices/platform/fujitsu-laptop/;
  30. * others may be added at a later date.
  31. *
  32. * lcd_level - Screen brightness: contains a single integer in the
  33. * range 0..7. (rw)
  34. *
  35. * In addition to these platform device attributes the driver
  36. * registers itself in the Linux backlight control subsystem and is
  37. * available to userspace under /sys/class/backlight/fujitsu-laptop/.
  38. *
  39. * Hotkeys present on certain Fujitsu laptops (eg: the S6xxx series) are
  40. * also supported by this driver.
  41. *
  42. * This driver has been tested on a Fujitsu Lifebook S6410, S7020 and
  43. * P8010. It should work on most P-series and S-series Lifebooks, but
  44. * YMMV.
  45. *
  46. * The module parameter use_alt_lcd_levels switches between different ACPI
  47. * brightness controls which are used by different Fujitsu laptops. In most
  48. * cases the correct method is automatically detected. "use_alt_lcd_levels=1"
  49. * is applicable for a Fujitsu Lifebook S6410 if autodetection fails.
  50. *
  51. */
  52. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  53. #include <linux/module.h>
  54. #include <linux/kernel.h>
  55. #include <linux/init.h>
  56. #include <linux/acpi.h>
  57. #include <linux/dmi.h>
  58. #include <linux/backlight.h>
  59. #include <linux/input.h>
  60. #include <linux/kfifo.h>
  61. #include <linux/video_output.h>
  62. #include <linux/platform_device.h>
  63. #include <linux/slab.h>
  64. #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
  65. #include <linux/leds.h>
  66. #endif
  67. #define FUJITSU_DRIVER_VERSION "0.6.0"
  68. #define FUJITSU_LCD_N_LEVELS 8
  69. #define ACPI_FUJITSU_CLASS "fujitsu"
  70. #define ACPI_FUJITSU_HID "FUJ02B1"
  71. #define ACPI_FUJITSU_DRIVER_NAME "Fujitsu laptop FUJ02B1 ACPI brightness driver"
  72. #define ACPI_FUJITSU_DEVICE_NAME "Fujitsu FUJ02B1"
  73. #define ACPI_FUJITSU_HOTKEY_HID "FUJ02E3"
  74. #define ACPI_FUJITSU_HOTKEY_DRIVER_NAME "Fujitsu laptop FUJ02E3 ACPI hotkeys driver"
  75. #define ACPI_FUJITSU_HOTKEY_DEVICE_NAME "Fujitsu FUJ02E3"
  76. #define ACPI_FUJITSU_NOTIFY_CODE1 0x80
  77. #define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86
  78. #define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87
  79. /* FUNC interface - command values */
  80. #define FUNC_RFKILL 0x1000
  81. #define FUNC_LEDS 0x1001
  82. #define FUNC_BUTTONS 0x1002
  83. #define FUNC_BACKLIGHT 0x1004
  84. /* FUNC interface - responses */
  85. #define UNSUPPORTED_CMD 0x80000000
  86. #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
  87. /* FUNC interface - LED control */
  88. #define FUNC_LED_OFF 0x1
  89. #define FUNC_LED_ON 0x30001
  90. #define KEYBOARD_LAMPS 0x100
  91. #define LOGOLAMP_POWERON 0x2000
  92. #define LOGOLAMP_ALWAYS 0x4000
  93. #endif
  94. /* Hotkey details */
  95. #define KEY1_CODE 0x410 /* codes for the keys in the GIRB register */
  96. #define KEY2_CODE 0x411
  97. #define KEY3_CODE 0x412
  98. #define KEY4_CODE 0x413
  99. #define MAX_HOTKEY_RINGBUFFER_SIZE 100
  100. #define RINGBUFFERSIZE 40
  101. /* Debugging */
  102. #define FUJLAPTOP_LOG ACPI_FUJITSU_HID ": "
  103. #define FUJLAPTOP_ERR KERN_ERR FUJLAPTOP_LOG
  104. #define FUJLAPTOP_NOTICE KERN_NOTICE FUJLAPTOP_LOG
  105. #define FUJLAPTOP_INFO KERN_INFO FUJLAPTOP_LOG
  106. #define FUJLAPTOP_DEBUG KERN_DEBUG FUJLAPTOP_LOG
  107. #define FUJLAPTOP_DBG_ALL 0xffff
  108. #define FUJLAPTOP_DBG_ERROR 0x0001
  109. #define FUJLAPTOP_DBG_WARN 0x0002
  110. #define FUJLAPTOP_DBG_INFO 0x0004
  111. #define FUJLAPTOP_DBG_TRACE 0x0008
  112. #define dbg_printk(a_dbg_level, format, arg...) \
  113. do { if (dbg_level & a_dbg_level) \
  114. printk(FUJLAPTOP_DEBUG "%s: " format, __func__ , ## arg); \
  115. } while (0)
  116. #ifdef CONFIG_FUJITSU_LAPTOP_DEBUG
  117. #define vdbg_printk(a_dbg_level, format, arg...) \
  118. dbg_printk(a_dbg_level, format, ## arg)
  119. #else
  120. #define vdbg_printk(a_dbg_level, format, arg...)
  121. #endif
  122. /* Device controlling the backlight and associated keys */
  123. struct fujitsu_t {
  124. acpi_handle acpi_handle;
  125. struct acpi_device *dev;
  126. struct input_dev *input;
  127. char phys[32];
  128. struct backlight_device *bl_device;
  129. struct platform_device *pf_device;
  130. int keycode1, keycode2, keycode3, keycode4;
  131. unsigned int max_brightness;
  132. unsigned int brightness_changed;
  133. unsigned int brightness_level;
  134. };
  135. static struct fujitsu_t *fujitsu;
  136. static int use_alt_lcd_levels = -1;
  137. static int disable_brightness_adjust = -1;
  138. /* Device used to access other hotkeys on the laptop */
  139. struct fujitsu_hotkey_t {
  140. acpi_handle acpi_handle;
  141. struct acpi_device *dev;
  142. struct input_dev *input;
  143. char phys[32];
  144. struct platform_device *pf_device;
  145. struct kfifo fifo;
  146. spinlock_t fifo_lock;
  147. int rfkill_supported;
  148. int rfkill_state;
  149. int logolamp_registered;
  150. int kblamps_registered;
  151. };
  152. static struct fujitsu_hotkey_t *fujitsu_hotkey;
  153. static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event);
  154. #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
  155. static enum led_brightness logolamp_get(struct led_classdev *cdev);
  156. static void logolamp_set(struct led_classdev *cdev,
  157. enum led_brightness brightness);
  158. static struct led_classdev logolamp_led = {
  159. .name = "fujitsu::logolamp",
  160. .brightness_get = logolamp_get,
  161. .brightness_set = logolamp_set
  162. };
  163. static enum led_brightness kblamps_get(struct led_classdev *cdev);
  164. static void kblamps_set(struct led_classdev *cdev,
  165. enum led_brightness brightness);
  166. static struct led_classdev kblamps_led = {
  167. .name = "fujitsu::kblamps",
  168. .brightness_get = kblamps_get,
  169. .brightness_set = kblamps_set
  170. };
  171. #endif
  172. #ifdef CONFIG_FUJITSU_LAPTOP_DEBUG
  173. static u32 dbg_level = 0x03;
  174. #endif
  175. static void acpi_fujitsu_notify(struct acpi_device *device, u32 event);
  176. /* Fujitsu ACPI interface function */
  177. static int call_fext_func(int cmd, int arg0, int arg1, int arg2)
  178. {
  179. acpi_status status = AE_OK;
  180. union acpi_object params[4] = {
  181. { .type = ACPI_TYPE_INTEGER },
  182. { .type = ACPI_TYPE_INTEGER },
  183. { .type = ACPI_TYPE_INTEGER },
  184. { .type = ACPI_TYPE_INTEGER }
  185. };
  186. struct acpi_object_list arg_list = { 4, &params[0] };
  187. struct acpi_buffer output;
  188. union acpi_object out_obj;
  189. acpi_handle handle = NULL;
  190. status = acpi_get_handle(fujitsu_hotkey->acpi_handle, "FUNC", &handle);
  191. if (ACPI_FAILURE(status)) {
  192. vdbg_printk(FUJLAPTOP_DBG_ERROR,
  193. "FUNC interface is not present\n");
  194. return -ENODEV;
  195. }
  196. params[0].integer.value = cmd;
  197. params[1].integer.value = arg0;
  198. params[2].integer.value = arg1;
  199. params[3].integer.value = arg2;
  200. output.length = sizeof(out_obj);
  201. output.pointer = &out_obj;
  202. status = acpi_evaluate_object(handle, NULL, &arg_list, &output);
  203. if (ACPI_FAILURE(status)) {
  204. vdbg_printk(FUJLAPTOP_DBG_WARN,
  205. "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) call failed\n",
  206. cmd, arg0, arg1, arg2);
  207. return -ENODEV;
  208. }
  209. if (out_obj.type != ACPI_TYPE_INTEGER) {
  210. vdbg_printk(FUJLAPTOP_DBG_WARN,
  211. "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) did not "
  212. "return an integer\n",
  213. cmd, arg0, arg1, arg2);
  214. return -ENODEV;
  215. }
  216. vdbg_printk(FUJLAPTOP_DBG_TRACE,
  217. "FUNC 0x%x (args 0x%x, 0x%x, 0x%x) returned 0x%x\n",
  218. cmd, arg0, arg1, arg2, (int)out_obj.integer.value);
  219. return out_obj.integer.value;
  220. }
  221. #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
  222. /* LED class callbacks */
  223. static void logolamp_set(struct led_classdev *cdev,
  224. enum led_brightness brightness)
  225. {
  226. if (brightness >= LED_FULL) {
  227. call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON);
  228. call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_ON);
  229. } else if (brightness >= LED_HALF) {
  230. call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_ON);
  231. call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_ALWAYS, FUNC_LED_OFF);
  232. } else {
  233. call_fext_func(FUNC_LEDS, 0x1, LOGOLAMP_POWERON, FUNC_LED_OFF);
  234. }
  235. }
  236. static void kblamps_set(struct led_classdev *cdev,
  237. enum led_brightness brightness)
  238. {
  239. if (brightness >= LED_FULL)
  240. call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_ON);
  241. else
  242. call_fext_func(FUNC_LEDS, 0x1, KEYBOARD_LAMPS, FUNC_LED_OFF);
  243. }
  244. static enum led_brightness logolamp_get(struct led_classdev *cdev)
  245. {
  246. enum led_brightness brightness = LED_OFF;
  247. int poweron, always;
  248. poweron = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_POWERON, 0x0);
  249. if (poweron == FUNC_LED_ON) {
  250. brightness = LED_HALF;
  251. always = call_fext_func(FUNC_LEDS, 0x2, LOGOLAMP_ALWAYS, 0x0);
  252. if (always == FUNC_LED_ON)
  253. brightness = LED_FULL;
  254. }
  255. return brightness;
  256. }
  257. static enum led_brightness kblamps_get(struct led_classdev *cdev)
  258. {
  259. enum led_brightness brightness = LED_OFF;
  260. if (call_fext_func(FUNC_LEDS, 0x2, KEYBOARD_LAMPS, 0x0) == FUNC_LED_ON)
  261. brightness = LED_FULL;
  262. return brightness;
  263. }
  264. #endif
  265. /* Hardware access for LCD brightness control */
  266. static int set_lcd_level(int level)
  267. {
  268. acpi_status status = AE_OK;
  269. acpi_handle handle = NULL;
  270. vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBLL [%d]\n",
  271. level);
  272. if (level < 0 || level >= fujitsu->max_brightness)
  273. return -EINVAL;
  274. status = acpi_get_handle(fujitsu->acpi_handle, "SBLL", &handle);
  275. if (ACPI_FAILURE(status)) {
  276. vdbg_printk(FUJLAPTOP_DBG_ERROR, "SBLL not present\n");
  277. return -ENODEV;
  278. }
  279. status = acpi_execute_simple_method(handle, NULL, level);
  280. if (ACPI_FAILURE(status))
  281. return -ENODEV;
  282. return 0;
  283. }
  284. static int set_lcd_level_alt(int level)
  285. {
  286. acpi_status status = AE_OK;
  287. acpi_handle handle = NULL;
  288. vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBL2 [%d]\n",
  289. level);
  290. if (level < 0 || level >= fujitsu->max_brightness)
  291. return -EINVAL;
  292. status = acpi_get_handle(fujitsu->acpi_handle, "SBL2", &handle);
  293. if (ACPI_FAILURE(status)) {
  294. vdbg_printk(FUJLAPTOP_DBG_ERROR, "SBL2 not present\n");
  295. return -ENODEV;
  296. }
  297. status = acpi_execute_simple_method(handle, NULL, level);
  298. if (ACPI_FAILURE(status))
  299. return -ENODEV;
  300. return 0;
  301. }
  302. static int get_lcd_level(void)
  303. {
  304. unsigned long long state = 0;
  305. acpi_status status = AE_OK;
  306. vdbg_printk(FUJLAPTOP_DBG_TRACE, "get lcd level via GBLL\n");
  307. status =
  308. acpi_evaluate_integer(fujitsu->acpi_handle, "GBLL", NULL, &state);
  309. if (ACPI_FAILURE(status))
  310. return 0;
  311. fujitsu->brightness_level = state & 0x0fffffff;
  312. if (state & 0x80000000)
  313. fujitsu->brightness_changed = 1;
  314. else
  315. fujitsu->brightness_changed = 0;
  316. return fujitsu->brightness_level;
  317. }
  318. static int get_max_brightness(void)
  319. {
  320. unsigned long long state = 0;
  321. acpi_status status = AE_OK;
  322. vdbg_printk(FUJLAPTOP_DBG_TRACE, "get max lcd level via RBLL\n");
  323. status =
  324. acpi_evaluate_integer(fujitsu->acpi_handle, "RBLL", NULL, &state);
  325. if (ACPI_FAILURE(status))
  326. return -1;
  327. fujitsu->max_brightness = state;
  328. return fujitsu->max_brightness;
  329. }
  330. /* Backlight device stuff */
  331. static int bl_get_brightness(struct backlight_device *b)
  332. {
  333. return get_lcd_level();
  334. }
  335. static int bl_update_status(struct backlight_device *b)
  336. {
  337. int ret;
  338. if (b->props.power == 4)
  339. ret = call_fext_func(FUNC_BACKLIGHT, 0x1, 0x4, 0x3);
  340. else
  341. ret = call_fext_func(FUNC_BACKLIGHT, 0x1, 0x4, 0x0);
  342. if (ret != 0)
  343. vdbg_printk(FUJLAPTOP_DBG_ERROR,
  344. "Unable to adjust backlight power, error code %i\n",
  345. ret);
  346. if (use_alt_lcd_levels)
  347. ret = set_lcd_level_alt(b->props.brightness);
  348. else
  349. ret = set_lcd_level(b->props.brightness);
  350. if (ret != 0)
  351. vdbg_printk(FUJLAPTOP_DBG_ERROR,
  352. "Unable to adjust LCD brightness, error code %i\n",
  353. ret);
  354. return ret;
  355. }
  356. static const struct backlight_ops fujitsubl_ops = {
  357. .get_brightness = bl_get_brightness,
  358. .update_status = bl_update_status,
  359. };
  360. /* Platform LCD brightness device */
  361. static ssize_t
  362. show_max_brightness(struct device *dev,
  363. struct device_attribute *attr, char *buf)
  364. {
  365. int ret;
  366. ret = get_max_brightness();
  367. if (ret < 0)
  368. return ret;
  369. return sprintf(buf, "%i\n", ret);
  370. }
  371. static ssize_t
  372. show_brightness_changed(struct device *dev,
  373. struct device_attribute *attr, char *buf)
  374. {
  375. int ret;
  376. ret = fujitsu->brightness_changed;
  377. if (ret < 0)
  378. return ret;
  379. return sprintf(buf, "%i\n", ret);
  380. }
  381. static ssize_t show_lcd_level(struct device *dev,
  382. struct device_attribute *attr, char *buf)
  383. {
  384. int ret;
  385. ret = get_lcd_level();
  386. if (ret < 0)
  387. return ret;
  388. return sprintf(buf, "%i\n", ret);
  389. }
  390. static ssize_t store_lcd_level(struct device *dev,
  391. struct device_attribute *attr, const char *buf,
  392. size_t count)
  393. {
  394. int level, ret;
  395. if (sscanf(buf, "%i", &level) != 1
  396. || (level < 0 || level >= fujitsu->max_brightness))
  397. return -EINVAL;
  398. if (use_alt_lcd_levels)
  399. ret = set_lcd_level_alt(level);
  400. else
  401. ret = set_lcd_level(level);
  402. if (ret < 0)
  403. return ret;
  404. ret = get_lcd_level();
  405. if (ret < 0)
  406. return ret;
  407. return count;
  408. }
  409. static ssize_t
  410. ignore_store(struct device *dev,
  411. struct device_attribute *attr, const char *buf, size_t count)
  412. {
  413. return count;
  414. }
  415. static ssize_t
  416. show_lid_state(struct device *dev,
  417. struct device_attribute *attr, char *buf)
  418. {
  419. if (!(fujitsu_hotkey->rfkill_supported & 0x100))
  420. return sprintf(buf, "unknown\n");
  421. if (fujitsu_hotkey->rfkill_state & 0x100)
  422. return sprintf(buf, "open\n");
  423. else
  424. return sprintf(buf, "closed\n");
  425. }
  426. static ssize_t
  427. show_dock_state(struct device *dev,
  428. struct device_attribute *attr, char *buf)
  429. {
  430. if (!(fujitsu_hotkey->rfkill_supported & 0x200))
  431. return sprintf(buf, "unknown\n");
  432. if (fujitsu_hotkey->rfkill_state & 0x200)
  433. return sprintf(buf, "docked\n");
  434. else
  435. return sprintf(buf, "undocked\n");
  436. }
  437. static ssize_t
  438. show_radios_state(struct device *dev,
  439. struct device_attribute *attr, char *buf)
  440. {
  441. if (!(fujitsu_hotkey->rfkill_supported & 0x20))
  442. return sprintf(buf, "unknown\n");
  443. if (fujitsu_hotkey->rfkill_state & 0x20)
  444. return sprintf(buf, "on\n");
  445. else
  446. return sprintf(buf, "killed\n");
  447. }
  448. static DEVICE_ATTR(max_brightness, 0444, show_max_brightness, ignore_store);
  449. static DEVICE_ATTR(brightness_changed, 0444, show_brightness_changed,
  450. ignore_store);
  451. static DEVICE_ATTR(lcd_level, 0644, show_lcd_level, store_lcd_level);
  452. static DEVICE_ATTR(lid, 0444, show_lid_state, ignore_store);
  453. static DEVICE_ATTR(dock, 0444, show_dock_state, ignore_store);
  454. static DEVICE_ATTR(radios, 0444, show_radios_state, ignore_store);
  455. static struct attribute *fujitsupf_attributes[] = {
  456. &dev_attr_brightness_changed.attr,
  457. &dev_attr_max_brightness.attr,
  458. &dev_attr_lcd_level.attr,
  459. &dev_attr_lid.attr,
  460. &dev_attr_dock.attr,
  461. &dev_attr_radios.attr,
  462. NULL
  463. };
  464. static struct attribute_group fujitsupf_attribute_group = {
  465. .attrs = fujitsupf_attributes
  466. };
  467. static struct platform_driver fujitsupf_driver = {
  468. .driver = {
  469. .name = "fujitsu-laptop",
  470. .owner = THIS_MODULE,
  471. }
  472. };
  473. static void dmi_check_cb_common(const struct dmi_system_id *id)
  474. {
  475. pr_info("Identified laptop model '%s'\n", id->ident);
  476. if (use_alt_lcd_levels == -1) {
  477. if (acpi_has_method(NULL,
  478. "\\_SB.PCI0.LPCB.FJEX.SBL2"))
  479. use_alt_lcd_levels = 1;
  480. else
  481. use_alt_lcd_levels = 0;
  482. vdbg_printk(FUJLAPTOP_DBG_TRACE, "auto-detected usealt as "
  483. "%i\n", use_alt_lcd_levels);
  484. }
  485. }
  486. static int dmi_check_cb_s6410(const struct dmi_system_id *id)
  487. {
  488. dmi_check_cb_common(id);
  489. fujitsu->keycode1 = KEY_SCREENLOCK; /* "Lock" */
  490. fujitsu->keycode2 = KEY_HELP; /* "Mobility Center" */
  491. return 1;
  492. }
  493. static int dmi_check_cb_s6420(const struct dmi_system_id *id)
  494. {
  495. dmi_check_cb_common(id);
  496. fujitsu->keycode1 = KEY_SCREENLOCK; /* "Lock" */
  497. fujitsu->keycode2 = KEY_HELP; /* "Mobility Center" */
  498. return 1;
  499. }
  500. static int dmi_check_cb_p8010(const struct dmi_system_id *id)
  501. {
  502. dmi_check_cb_common(id);
  503. fujitsu->keycode1 = KEY_HELP; /* "Support" */
  504. fujitsu->keycode3 = KEY_SWITCHVIDEOMODE; /* "Presentation" */
  505. fujitsu->keycode4 = KEY_WWW; /* "Internet" */
  506. return 1;
  507. }
  508. static struct dmi_system_id fujitsu_dmi_table[] = {
  509. {
  510. .ident = "Fujitsu Siemens S6410",
  511. .matches = {
  512. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  513. DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S6410"),
  514. },
  515. .callback = dmi_check_cb_s6410},
  516. {
  517. .ident = "Fujitsu Siemens S6420",
  518. .matches = {
  519. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
  520. DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK S6420"),
  521. },
  522. .callback = dmi_check_cb_s6420},
  523. {
  524. .ident = "Fujitsu LifeBook P8010",
  525. .matches = {
  526. DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
  527. DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P8010"),
  528. },
  529. .callback = dmi_check_cb_p8010},
  530. {}
  531. };
  532. /* ACPI device for LCD brightness control */
  533. static int acpi_fujitsu_add(struct acpi_device *device)
  534. {
  535. int result = 0;
  536. int state = 0;
  537. struct input_dev *input;
  538. int error;
  539. if (!device)
  540. return -EINVAL;
  541. fujitsu->acpi_handle = device->handle;
  542. sprintf(acpi_device_name(device), "%s", ACPI_FUJITSU_DEVICE_NAME);
  543. sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
  544. device->driver_data = fujitsu;
  545. fujitsu->input = input = input_allocate_device();
  546. if (!input) {
  547. error = -ENOMEM;
  548. goto err_stop;
  549. }
  550. snprintf(fujitsu->phys, sizeof(fujitsu->phys),
  551. "%s/video/input0", acpi_device_hid(device));
  552. input->name = acpi_device_name(device);
  553. input->phys = fujitsu->phys;
  554. input->id.bustype = BUS_HOST;
  555. input->id.product = 0x06;
  556. input->dev.parent = &device->dev;
  557. input->evbit[0] = BIT(EV_KEY);
  558. set_bit(KEY_BRIGHTNESSUP, input->keybit);
  559. set_bit(KEY_BRIGHTNESSDOWN, input->keybit);
  560. set_bit(KEY_UNKNOWN, input->keybit);
  561. error = input_register_device(input);
  562. if (error)
  563. goto err_free_input_dev;
  564. result = acpi_bus_update_power(fujitsu->acpi_handle, &state);
  565. if (result) {
  566. pr_err("Error reading power state\n");
  567. goto err_unregister_input_dev;
  568. }
  569. pr_info("ACPI: %s [%s] (%s)\n",
  570. acpi_device_name(device), acpi_device_bid(device),
  571. !device->power.state ? "on" : "off");
  572. fujitsu->dev = device;
  573. if (acpi_has_method(device->handle, METHOD_NAME__INI)) {
  574. vdbg_printk(FUJLAPTOP_DBG_INFO, "Invoking _INI\n");
  575. if (ACPI_FAILURE
  576. (acpi_evaluate_object
  577. (device->handle, METHOD_NAME__INI, NULL, NULL)))
  578. pr_err("_INI Method failed\n");
  579. }
  580. /* do config (detect defaults) */
  581. use_alt_lcd_levels = use_alt_lcd_levels == 1 ? 1 : 0;
  582. disable_brightness_adjust = disable_brightness_adjust == 1 ? 1 : 0;
  583. vdbg_printk(FUJLAPTOP_DBG_INFO,
  584. "config: [alt interface: %d], [adjust disable: %d]\n",
  585. use_alt_lcd_levels, disable_brightness_adjust);
  586. if (get_max_brightness() <= 0)
  587. fujitsu->max_brightness = FUJITSU_LCD_N_LEVELS;
  588. get_lcd_level();
  589. return result;
  590. err_unregister_input_dev:
  591. input_unregister_device(input);
  592. input = NULL;
  593. err_free_input_dev:
  594. input_free_device(input);
  595. err_stop:
  596. return result;
  597. }
  598. static int acpi_fujitsu_remove(struct acpi_device *device)
  599. {
  600. struct fujitsu_t *fujitsu = acpi_driver_data(device);
  601. struct input_dev *input = fujitsu->input;
  602. input_unregister_device(input);
  603. fujitsu->acpi_handle = NULL;
  604. return 0;
  605. }
  606. /* Brightness notify */
  607. static void acpi_fujitsu_notify(struct acpi_device *device, u32 event)
  608. {
  609. struct input_dev *input;
  610. int keycode;
  611. int oldb, newb;
  612. input = fujitsu->input;
  613. switch (event) {
  614. case ACPI_FUJITSU_NOTIFY_CODE1:
  615. keycode = 0;
  616. oldb = fujitsu->brightness_level;
  617. get_lcd_level();
  618. newb = fujitsu->brightness_level;
  619. vdbg_printk(FUJLAPTOP_DBG_TRACE,
  620. "brightness button event [%i -> %i (%i)]\n",
  621. oldb, newb, fujitsu->brightness_changed);
  622. if (oldb < newb) {
  623. if (disable_brightness_adjust != 1) {
  624. if (use_alt_lcd_levels)
  625. set_lcd_level_alt(newb);
  626. else
  627. set_lcd_level(newb);
  628. }
  629. keycode = KEY_BRIGHTNESSUP;
  630. } else if (oldb > newb) {
  631. if (disable_brightness_adjust != 1) {
  632. if (use_alt_lcd_levels)
  633. set_lcd_level_alt(newb);
  634. else
  635. set_lcd_level(newb);
  636. }
  637. keycode = KEY_BRIGHTNESSDOWN;
  638. }
  639. break;
  640. default:
  641. keycode = KEY_UNKNOWN;
  642. vdbg_printk(FUJLAPTOP_DBG_WARN,
  643. "unsupported event [0x%x]\n", event);
  644. break;
  645. }
  646. if (keycode != 0) {
  647. input_report_key(input, keycode, 1);
  648. input_sync(input);
  649. input_report_key(input, keycode, 0);
  650. input_sync(input);
  651. }
  652. }
  653. /* ACPI device for hotkey handling */
  654. static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
  655. {
  656. int result = 0;
  657. int state = 0;
  658. struct input_dev *input;
  659. int error;
  660. int i;
  661. if (!device)
  662. return -EINVAL;
  663. fujitsu_hotkey->acpi_handle = device->handle;
  664. sprintf(acpi_device_name(device), "%s",
  665. ACPI_FUJITSU_HOTKEY_DEVICE_NAME);
  666. sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
  667. device->driver_data = fujitsu_hotkey;
  668. /* kfifo */
  669. spin_lock_init(&fujitsu_hotkey->fifo_lock);
  670. error = kfifo_alloc(&fujitsu_hotkey->fifo, RINGBUFFERSIZE * sizeof(int),
  671. GFP_KERNEL);
  672. if (error) {
  673. pr_err("kfifo_alloc failed\n");
  674. goto err_stop;
  675. }
  676. fujitsu_hotkey->input = input = input_allocate_device();
  677. if (!input) {
  678. error = -ENOMEM;
  679. goto err_free_fifo;
  680. }
  681. snprintf(fujitsu_hotkey->phys, sizeof(fujitsu_hotkey->phys),
  682. "%s/video/input0", acpi_device_hid(device));
  683. input->name = acpi_device_name(device);
  684. input->phys = fujitsu_hotkey->phys;
  685. input->id.bustype = BUS_HOST;
  686. input->id.product = 0x06;
  687. input->dev.parent = &device->dev;
  688. set_bit(EV_KEY, input->evbit);
  689. set_bit(fujitsu->keycode1, input->keybit);
  690. set_bit(fujitsu->keycode2, input->keybit);
  691. set_bit(fujitsu->keycode3, input->keybit);
  692. set_bit(fujitsu->keycode4, input->keybit);
  693. set_bit(KEY_UNKNOWN, input->keybit);
  694. error = input_register_device(input);
  695. if (error)
  696. goto err_free_input_dev;
  697. result = acpi_bus_update_power(fujitsu_hotkey->acpi_handle, &state);
  698. if (result) {
  699. pr_err("Error reading power state\n");
  700. goto err_unregister_input_dev;
  701. }
  702. pr_info("ACPI: %s [%s] (%s)\n",
  703. acpi_device_name(device), acpi_device_bid(device),
  704. !device->power.state ? "on" : "off");
  705. fujitsu_hotkey->dev = device;
  706. if (acpi_has_method(device->handle, METHOD_NAME__INI)) {
  707. vdbg_printk(FUJLAPTOP_DBG_INFO, "Invoking _INI\n");
  708. if (ACPI_FAILURE
  709. (acpi_evaluate_object
  710. (device->handle, METHOD_NAME__INI, NULL, NULL)))
  711. pr_err("_INI Method failed\n");
  712. }
  713. i = 0;
  714. while (call_fext_func(FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0
  715. && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE)
  716. ; /* No action, result is discarded */
  717. vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i);
  718. fujitsu_hotkey->rfkill_supported =
  719. call_fext_func(FUNC_RFKILL, 0x0, 0x0, 0x0);
  720. /* Make sure our bitmask of supported functions is cleared if the
  721. RFKILL function block is not implemented, like on the S7020. */
  722. if (fujitsu_hotkey->rfkill_supported == UNSUPPORTED_CMD)
  723. fujitsu_hotkey->rfkill_supported = 0;
  724. if (fujitsu_hotkey->rfkill_supported)
  725. fujitsu_hotkey->rfkill_state =
  726. call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
  727. /* Suspect this is a keymap of the application panel, print it */
  728. pr_info("BTNI: [0x%x]\n", call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0));
  729. #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
  730. if (call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) {
  731. result = led_classdev_register(&fujitsu->pf_device->dev,
  732. &logolamp_led);
  733. if (result == 0) {
  734. fujitsu_hotkey->logolamp_registered = 1;
  735. } else {
  736. pr_err("Could not register LED handler for logo lamp, error %i\n",
  737. result);
  738. }
  739. }
  740. if ((call_fext_func(FUNC_LEDS, 0x0, 0x0, 0x0) & KEYBOARD_LAMPS) &&
  741. (call_fext_func(FUNC_BUTTONS, 0x0, 0x0, 0x0) == 0x0)) {
  742. result = led_classdev_register(&fujitsu->pf_device->dev,
  743. &kblamps_led);
  744. if (result == 0) {
  745. fujitsu_hotkey->kblamps_registered = 1;
  746. } else {
  747. pr_err("Could not register LED handler for keyboard lamps, error %i\n",
  748. result);
  749. }
  750. }
  751. #endif
  752. return result;
  753. err_unregister_input_dev:
  754. input_unregister_device(input);
  755. input = NULL;
  756. err_free_input_dev:
  757. input_free_device(input);
  758. err_free_fifo:
  759. kfifo_free(&fujitsu_hotkey->fifo);
  760. err_stop:
  761. return result;
  762. }
  763. static int acpi_fujitsu_hotkey_remove(struct acpi_device *device)
  764. {
  765. struct fujitsu_hotkey_t *fujitsu_hotkey = acpi_driver_data(device);
  766. struct input_dev *input = fujitsu_hotkey->input;
  767. #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
  768. if (fujitsu_hotkey->logolamp_registered)
  769. led_classdev_unregister(&logolamp_led);
  770. if (fujitsu_hotkey->kblamps_registered)
  771. led_classdev_unregister(&kblamps_led);
  772. #endif
  773. input_unregister_device(input);
  774. kfifo_free(&fujitsu_hotkey->fifo);
  775. fujitsu_hotkey->acpi_handle = NULL;
  776. return 0;
  777. }
  778. static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event)
  779. {
  780. struct input_dev *input;
  781. int keycode, keycode_r;
  782. unsigned int irb = 1;
  783. int i, status;
  784. input = fujitsu_hotkey->input;
  785. if (fujitsu_hotkey->rfkill_supported)
  786. fujitsu_hotkey->rfkill_state =
  787. call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
  788. switch (event) {
  789. case ACPI_FUJITSU_NOTIFY_CODE1:
  790. i = 0;
  791. while ((irb =
  792. call_fext_func(FUNC_BUTTONS, 0x1, 0x0, 0x0)) != 0
  793. && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) {
  794. switch (irb & 0x4ff) {
  795. case KEY1_CODE:
  796. keycode = fujitsu->keycode1;
  797. break;
  798. case KEY2_CODE:
  799. keycode = fujitsu->keycode2;
  800. break;
  801. case KEY3_CODE:
  802. keycode = fujitsu->keycode3;
  803. break;
  804. case KEY4_CODE:
  805. keycode = fujitsu->keycode4;
  806. break;
  807. case 0:
  808. keycode = 0;
  809. break;
  810. default:
  811. vdbg_printk(FUJLAPTOP_DBG_WARN,
  812. "Unknown GIRB result [%x]\n", irb);
  813. keycode = -1;
  814. break;
  815. }
  816. if (keycode > 0) {
  817. vdbg_printk(FUJLAPTOP_DBG_TRACE,
  818. "Push keycode into ringbuffer [%d]\n",
  819. keycode);
  820. status = kfifo_in_locked(&fujitsu_hotkey->fifo,
  821. (unsigned char *)&keycode,
  822. sizeof(keycode),
  823. &fujitsu_hotkey->fifo_lock);
  824. if (status != sizeof(keycode)) {
  825. vdbg_printk(FUJLAPTOP_DBG_WARN,
  826. "Could not push keycode [0x%x]\n",
  827. keycode);
  828. } else {
  829. input_report_key(input, keycode, 1);
  830. input_sync(input);
  831. }
  832. } else if (keycode == 0) {
  833. while ((status =
  834. kfifo_out_locked(
  835. &fujitsu_hotkey->fifo,
  836. (unsigned char *) &keycode_r,
  837. sizeof(keycode_r),
  838. &fujitsu_hotkey->fifo_lock))
  839. == sizeof(keycode_r)) {
  840. input_report_key(input, keycode_r, 0);
  841. input_sync(input);
  842. vdbg_printk(FUJLAPTOP_DBG_TRACE,
  843. "Pop keycode from ringbuffer [%d]\n",
  844. keycode_r);
  845. }
  846. }
  847. }
  848. break;
  849. default:
  850. keycode = KEY_UNKNOWN;
  851. vdbg_printk(FUJLAPTOP_DBG_WARN,
  852. "Unsupported event [0x%x]\n", event);
  853. input_report_key(input, keycode, 1);
  854. input_sync(input);
  855. input_report_key(input, keycode, 0);
  856. input_sync(input);
  857. break;
  858. }
  859. }
  860. /* Initialization */
  861. static const struct acpi_device_id fujitsu_device_ids[] = {
  862. {ACPI_FUJITSU_HID, 0},
  863. {"", 0},
  864. };
  865. static struct acpi_driver acpi_fujitsu_driver = {
  866. .name = ACPI_FUJITSU_DRIVER_NAME,
  867. .class = ACPI_FUJITSU_CLASS,
  868. .ids = fujitsu_device_ids,
  869. .ops = {
  870. .add = acpi_fujitsu_add,
  871. .remove = acpi_fujitsu_remove,
  872. .notify = acpi_fujitsu_notify,
  873. },
  874. };
  875. static const struct acpi_device_id fujitsu_hotkey_device_ids[] = {
  876. {ACPI_FUJITSU_HOTKEY_HID, 0},
  877. {"", 0},
  878. };
  879. static struct acpi_driver acpi_fujitsu_hotkey_driver = {
  880. .name = ACPI_FUJITSU_HOTKEY_DRIVER_NAME,
  881. .class = ACPI_FUJITSU_CLASS,
  882. .ids = fujitsu_hotkey_device_ids,
  883. .ops = {
  884. .add = acpi_fujitsu_hotkey_add,
  885. .remove = acpi_fujitsu_hotkey_remove,
  886. .notify = acpi_fujitsu_hotkey_notify,
  887. },
  888. };
  889. static int __init fujitsu_init(void)
  890. {
  891. int ret, result, max_brightness;
  892. if (acpi_disabled)
  893. return -ENODEV;
  894. fujitsu = kzalloc(sizeof(struct fujitsu_t), GFP_KERNEL);
  895. if (!fujitsu)
  896. return -ENOMEM;
  897. fujitsu->keycode1 = KEY_PROG1;
  898. fujitsu->keycode2 = KEY_PROG2;
  899. fujitsu->keycode3 = KEY_PROG3;
  900. fujitsu->keycode4 = KEY_PROG4;
  901. dmi_check_system(fujitsu_dmi_table);
  902. result = acpi_bus_register_driver(&acpi_fujitsu_driver);
  903. if (result < 0) {
  904. ret = -ENODEV;
  905. goto fail_acpi;
  906. }
  907. /* Register platform stuff */
  908. fujitsu->pf_device = platform_device_alloc("fujitsu-laptop", -1);
  909. if (!fujitsu->pf_device) {
  910. ret = -ENOMEM;
  911. goto fail_platform_driver;
  912. }
  913. ret = platform_device_add(fujitsu->pf_device);
  914. if (ret)
  915. goto fail_platform_device1;
  916. ret =
  917. sysfs_create_group(&fujitsu->pf_device->dev.kobj,
  918. &fujitsupf_attribute_group);
  919. if (ret)
  920. goto fail_platform_device2;
  921. /* Register backlight stuff */
  922. if (!acpi_video_backlight_support()) {
  923. struct backlight_properties props;
  924. memset(&props, 0, sizeof(struct backlight_properties));
  925. max_brightness = fujitsu->max_brightness;
  926. props.type = BACKLIGHT_PLATFORM;
  927. props.max_brightness = max_brightness - 1;
  928. fujitsu->bl_device = backlight_device_register("fujitsu-laptop",
  929. NULL, NULL,
  930. &fujitsubl_ops,
  931. &props);
  932. if (IS_ERR(fujitsu->bl_device)) {
  933. ret = PTR_ERR(fujitsu->bl_device);
  934. fujitsu->bl_device = NULL;
  935. goto fail_sysfs_group;
  936. }
  937. fujitsu->bl_device->props.brightness = fujitsu->brightness_level;
  938. }
  939. ret = platform_driver_register(&fujitsupf_driver);
  940. if (ret)
  941. goto fail_backlight;
  942. /* Register hotkey driver */
  943. fujitsu_hotkey = kzalloc(sizeof(struct fujitsu_hotkey_t), GFP_KERNEL);
  944. if (!fujitsu_hotkey) {
  945. ret = -ENOMEM;
  946. goto fail_hotkey;
  947. }
  948. result = acpi_bus_register_driver(&acpi_fujitsu_hotkey_driver);
  949. if (result < 0) {
  950. ret = -ENODEV;
  951. goto fail_hotkey1;
  952. }
  953. /* Sync backlight power status (needs FUJ02E3 device, hence deferred) */
  954. if (!acpi_video_backlight_support()) {
  955. if (call_fext_func(FUNC_BACKLIGHT, 0x2, 0x4, 0x0) == 3)
  956. fujitsu->bl_device->props.power = 4;
  957. else
  958. fujitsu->bl_device->props.power = 0;
  959. }
  960. pr_info("driver " FUJITSU_DRIVER_VERSION " successfully loaded\n");
  961. return 0;
  962. fail_hotkey1:
  963. kfree(fujitsu_hotkey);
  964. fail_hotkey:
  965. platform_driver_unregister(&fujitsupf_driver);
  966. fail_backlight:
  967. if (fujitsu->bl_device)
  968. backlight_device_unregister(fujitsu->bl_device);
  969. fail_sysfs_group:
  970. sysfs_remove_group(&fujitsu->pf_device->dev.kobj,
  971. &fujitsupf_attribute_group);
  972. fail_platform_device2:
  973. platform_device_del(fujitsu->pf_device);
  974. fail_platform_device1:
  975. platform_device_put(fujitsu->pf_device);
  976. fail_platform_driver:
  977. acpi_bus_unregister_driver(&acpi_fujitsu_driver);
  978. fail_acpi:
  979. kfree(fujitsu);
  980. return ret;
  981. }
  982. static void __exit fujitsu_cleanup(void)
  983. {
  984. acpi_bus_unregister_driver(&acpi_fujitsu_hotkey_driver);
  985. kfree(fujitsu_hotkey);
  986. platform_driver_unregister(&fujitsupf_driver);
  987. if (fujitsu->bl_device)
  988. backlight_device_unregister(fujitsu->bl_device);
  989. sysfs_remove_group(&fujitsu->pf_device->dev.kobj,
  990. &fujitsupf_attribute_group);
  991. platform_device_unregister(fujitsu->pf_device);
  992. acpi_bus_unregister_driver(&acpi_fujitsu_driver);
  993. kfree(fujitsu);
  994. pr_info("driver unloaded\n");
  995. }
  996. module_init(fujitsu_init);
  997. module_exit(fujitsu_cleanup);
  998. module_param(use_alt_lcd_levels, uint, 0644);
  999. MODULE_PARM_DESC(use_alt_lcd_levels,
  1000. "Use alternative interface for lcd_levels (needed for Lifebook s6410).");
  1001. module_param(disable_brightness_adjust, uint, 0644);
  1002. MODULE_PARM_DESC(disable_brightness_adjust, "Disable brightness adjustment .");
  1003. #ifdef CONFIG_FUJITSU_LAPTOP_DEBUG
  1004. module_param_named(debug, dbg_level, uint, 0644);
  1005. MODULE_PARM_DESC(debug, "Sets debug level bit-mask");
  1006. #endif
  1007. MODULE_AUTHOR("Jonathan Woithe, Peter Gruber, Tony Vroon");
  1008. MODULE_DESCRIPTION("Fujitsu laptop extras support");
  1009. MODULE_VERSION(FUJITSU_DRIVER_VERSION);
  1010. MODULE_LICENSE("GPL");
  1011. MODULE_ALIAS("dmi:*:svnFUJITSUSIEMENS:*:pvr:rvnFUJITSU:rnFJNB1D3:*:cvrS6410:*");
  1012. MODULE_ALIAS("dmi:*:svnFUJITSUSIEMENS:*:pvr:rvnFUJITSU:rnFJNB1E6:*:cvrS6420:*");
  1013. MODULE_ALIAS("dmi:*:svnFUJITSU:*:pvr:rvnFUJITSU:rnFJNB19C:*:cvrS7020:*");
  1014. static struct pnp_device_id pnp_ids[] __used = {
  1015. {.id = "FUJ02bf"},
  1016. {.id = "FUJ02B1"},
  1017. {.id = "FUJ02E3"},
  1018. {.id = ""}
  1019. };
  1020. MODULE_DEVICE_TABLE(pnp, pnp_ids);