lg-laptop.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * lg-laptop.c - LG Gram ACPI features and hotkeys Driver
  4. *
  5. * Copyright (C) 2018 Matan Ziv-Av <matan@svgalib.org>
  6. */
  7. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  8. #include <linux/acpi.h>
  9. #include <linux/input.h>
  10. #include <linux/input/sparse-keymap.h>
  11. #include <linux/kernel.h>
  12. #include <linux/leds.h>
  13. #include <linux/module.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/types.h>
  16. #define LED_DEVICE(_name, max) struct led_classdev _name = { \
  17. .name = __stringify(_name), \
  18. .max_brightness = max, \
  19. .brightness_set = _name##_set, \
  20. .brightness_get = _name##_get, \
  21. }
  22. MODULE_AUTHOR("Matan Ziv-Av");
  23. MODULE_DESCRIPTION("LG WMI Hotkey Driver");
  24. MODULE_LICENSE("GPL");
  25. #define WMI_EVENT_GUID0 "E4FB94F9-7F2B-4173-AD1A-CD1D95086248"
  26. #define WMI_EVENT_GUID1 "023B133E-49D1-4E10-B313-698220140DC2"
  27. #define WMI_EVENT_GUID2 "37BE1AC0-C3F2-4B1F-BFBE-8FDEAF2814D6"
  28. #define WMI_EVENT_GUID3 "911BAD44-7DF8-4FBB-9319-BABA1C4B293B"
  29. #define WMI_METHOD_WMAB "C3A72B38-D3EF-42D3-8CBB-D5A57049F66D"
  30. #define WMI_METHOD_WMBB "2B4F501A-BD3C-4394-8DCF-00A7D2BC8210"
  31. #define WMI_EVENT_GUID WMI_EVENT_GUID0
  32. #define WMAB_METHOD "\\XINI.WMAB"
  33. #define WMBB_METHOD "\\XINI.WMBB"
  34. #define SB_GGOV_METHOD "\\_SB.GGOV"
  35. #define GOV_TLED 0x2020008
  36. #define WM_GET 1
  37. #define WM_SET 2
  38. #define WM_KEY_LIGHT 0x400
  39. #define WM_TLED 0x404
  40. #define WM_FN_LOCK 0x407
  41. #define WM_BATT_LIMIT 0x61
  42. #define WM_READER_MODE 0xBF
  43. #define WM_FAN_MODE 0x33
  44. #define WMBB_USB_CHARGE 0x10B
  45. #define WMBB_BATT_LIMIT 0x10C
  46. #define PLATFORM_NAME "lg-laptop"
  47. MODULE_ALIAS("wmi:" WMI_EVENT_GUID0);
  48. MODULE_ALIAS("wmi:" WMI_EVENT_GUID1);
  49. MODULE_ALIAS("wmi:" WMI_EVENT_GUID2);
  50. MODULE_ALIAS("wmi:" WMI_EVENT_GUID3);
  51. MODULE_ALIAS("wmi:" WMI_METHOD_WMAB);
  52. MODULE_ALIAS("wmi:" WMI_METHOD_WMBB);
  53. MODULE_ALIAS("acpi*:LGEX0815:*");
  54. static struct platform_device *pf_device;
  55. static struct input_dev *wmi_input_dev;
  56. static u32 inited;
  57. #define INIT_INPUT_WMI_0 0x01
  58. #define INIT_INPUT_WMI_2 0x02
  59. #define INIT_INPUT_ACPI 0x04
  60. #define INIT_TPAD_LED 0x08
  61. #define INIT_KBD_LED 0x10
  62. #define INIT_SPARSE_KEYMAP 0x80
  63. static const struct key_entry wmi_keymap[] = {
  64. {KE_KEY, 0x70, {KEY_F15} }, /* LG control panel (F1) */
  65. {KE_KEY, 0x74, {KEY_F13} }, /* Touchpad toggle (F5) */
  66. {KE_KEY, 0xf020000, {KEY_F14} }, /* Read mode (F9) */
  67. {KE_KEY, 0x10000000, {KEY_F16} },/* Keyboard backlight (F8) - pressing
  68. * this key both sends an event and
  69. * changes backlight level.
  70. */
  71. {KE_KEY, 0x80, {KEY_RFKILL} },
  72. {KE_END, 0}
  73. };
  74. static int ggov(u32 arg0)
  75. {
  76. union acpi_object args[1];
  77. union acpi_object *r;
  78. acpi_status status;
  79. acpi_handle handle;
  80. struct acpi_object_list arg;
  81. struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
  82. int res;
  83. args[0].type = ACPI_TYPE_INTEGER;
  84. args[0].integer.value = arg0;
  85. status = acpi_get_handle(NULL, (acpi_string) SB_GGOV_METHOD, &handle);
  86. if (ACPI_FAILURE(status)) {
  87. pr_err("Cannot get handle");
  88. return -ENODEV;
  89. }
  90. arg.count = 1;
  91. arg.pointer = args;
  92. status = acpi_evaluate_object(handle, NULL, &arg, &buffer);
  93. if (ACPI_FAILURE(status)) {
  94. acpi_handle_err(handle, "GGOV: call failed.\n");
  95. return -EINVAL;
  96. }
  97. r = buffer.pointer;
  98. if (r->type != ACPI_TYPE_INTEGER) {
  99. kfree(r);
  100. return -EINVAL;
  101. }
  102. res = r->integer.value;
  103. kfree(r);
  104. return res;
  105. }
  106. static union acpi_object *lg_wmab(u32 method, u32 arg1, u32 arg2)
  107. {
  108. union acpi_object args[3];
  109. acpi_status status;
  110. acpi_handle handle;
  111. struct acpi_object_list arg;
  112. struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
  113. args[0].type = ACPI_TYPE_INTEGER;
  114. args[0].integer.value = method;
  115. args[1].type = ACPI_TYPE_INTEGER;
  116. args[1].integer.value = arg1;
  117. args[2].type = ACPI_TYPE_INTEGER;
  118. args[2].integer.value = arg2;
  119. status = acpi_get_handle(NULL, (acpi_string) WMAB_METHOD, &handle);
  120. if (ACPI_FAILURE(status)) {
  121. pr_err("Cannot get handle");
  122. return NULL;
  123. }
  124. arg.count = 3;
  125. arg.pointer = args;
  126. status = acpi_evaluate_object(handle, NULL, &arg, &buffer);
  127. if (ACPI_FAILURE(status)) {
  128. acpi_handle_err(handle, "WMAB: call failed.\n");
  129. return NULL;
  130. }
  131. return buffer.pointer;
  132. }
  133. static union acpi_object *lg_wmbb(u32 method_id, u32 arg1, u32 arg2)
  134. {
  135. union acpi_object args[3];
  136. acpi_status status;
  137. acpi_handle handle;
  138. struct acpi_object_list arg;
  139. struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
  140. u8 buf[32];
  141. *(u32 *)buf = method_id;
  142. *(u32 *)(buf + 4) = arg1;
  143. *(u32 *)(buf + 16) = arg2;
  144. args[0].type = ACPI_TYPE_INTEGER;
  145. args[0].integer.value = 0; /* ignored */
  146. args[1].type = ACPI_TYPE_INTEGER;
  147. args[1].integer.value = 1; /* Must be 1 or 2. Does not matter which */
  148. args[2].type = ACPI_TYPE_BUFFER;
  149. args[2].buffer.length = 32;
  150. args[2].buffer.pointer = buf;
  151. status = acpi_get_handle(NULL, (acpi_string)WMBB_METHOD, &handle);
  152. if (ACPI_FAILURE(status)) {
  153. pr_err("Cannot get handle");
  154. return NULL;
  155. }
  156. arg.count = 3;
  157. arg.pointer = args;
  158. status = acpi_evaluate_object(handle, NULL, &arg, &buffer);
  159. if (ACPI_FAILURE(status)) {
  160. acpi_handle_err(handle, "WMAB: call failed.\n");
  161. return NULL;
  162. }
  163. return (union acpi_object *)buffer.pointer;
  164. }
  165. static void wmi_notify(u32 value, void *context)
  166. {
  167. struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
  168. union acpi_object *obj;
  169. acpi_status status;
  170. long data = (long)context;
  171. pr_debug("event guid %li\n", data);
  172. status = wmi_get_event_data(value, &response);
  173. if (ACPI_FAILURE(status)) {
  174. pr_err("Bad event status 0x%x\n", status);
  175. return;
  176. }
  177. obj = (union acpi_object *)response.pointer;
  178. if (!obj)
  179. return;
  180. if (obj->type == ACPI_TYPE_INTEGER) {
  181. int eventcode = obj->integer.value;
  182. struct key_entry *key;
  183. key =
  184. sparse_keymap_entry_from_scancode(wmi_input_dev, eventcode);
  185. if (key && key->type == KE_KEY)
  186. sparse_keymap_report_entry(wmi_input_dev, key, 1, true);
  187. }
  188. pr_debug("Type: %i Eventcode: 0x%llx\n", obj->type,
  189. obj->integer.value);
  190. kfree(response.pointer);
  191. }
  192. static void wmi_input_setup(void)
  193. {
  194. acpi_status status;
  195. wmi_input_dev = input_allocate_device();
  196. if (wmi_input_dev) {
  197. wmi_input_dev->name = "LG WMI hotkeys";
  198. wmi_input_dev->phys = "wmi/input0";
  199. wmi_input_dev->id.bustype = BUS_HOST;
  200. if (sparse_keymap_setup(wmi_input_dev, wmi_keymap, NULL) ||
  201. input_register_device(wmi_input_dev)) {
  202. pr_info("Cannot initialize input device");
  203. input_free_device(wmi_input_dev);
  204. return;
  205. }
  206. inited |= INIT_SPARSE_KEYMAP;
  207. status = wmi_install_notify_handler(WMI_EVENT_GUID0, wmi_notify,
  208. (void *)0);
  209. if (ACPI_SUCCESS(status))
  210. inited |= INIT_INPUT_WMI_0;
  211. status = wmi_install_notify_handler(WMI_EVENT_GUID2, wmi_notify,
  212. (void *)2);
  213. if (ACPI_SUCCESS(status))
  214. inited |= INIT_INPUT_WMI_2;
  215. } else {
  216. pr_info("Cannot allocate input device");
  217. }
  218. }
  219. static void acpi_notify(struct acpi_device *device, u32 event)
  220. {
  221. struct key_entry *key;
  222. acpi_handle_debug(device->handle, "notify: %d\n", event);
  223. if (inited & INIT_SPARSE_KEYMAP) {
  224. key = sparse_keymap_entry_from_scancode(wmi_input_dev, 0x80);
  225. if (key && key->type == KE_KEY)
  226. sparse_keymap_report_entry(wmi_input_dev, key, 1, true);
  227. }
  228. }
  229. static ssize_t fan_mode_store(struct device *dev,
  230. struct device_attribute *attr,
  231. const char *buffer, size_t count)
  232. {
  233. bool value;
  234. union acpi_object *r;
  235. u32 m;
  236. int ret;
  237. ret = kstrtobool(buffer, &value);
  238. if (ret)
  239. return ret;
  240. r = lg_wmab(WM_FAN_MODE, WM_GET, 0);
  241. if (!r)
  242. return -EIO;
  243. if (r->type != ACPI_TYPE_INTEGER) {
  244. kfree(r);
  245. return -EIO;
  246. }
  247. m = r->integer.value;
  248. kfree(r);
  249. r = lg_wmab(WM_FAN_MODE, WM_SET, (m & 0xffffff0f) | (value << 4));
  250. kfree(r);
  251. r = lg_wmab(WM_FAN_MODE, WM_SET, (m & 0xfffffff0) | value);
  252. kfree(r);
  253. return count;
  254. }
  255. static ssize_t fan_mode_show(struct device *dev,
  256. struct device_attribute *attr, char *buffer)
  257. {
  258. unsigned int status;
  259. union acpi_object *r;
  260. r = lg_wmab(WM_FAN_MODE, WM_GET, 0);
  261. if (!r)
  262. return -EIO;
  263. if (r->type != ACPI_TYPE_INTEGER) {
  264. kfree(r);
  265. return -EIO;
  266. }
  267. status = r->integer.value & 0x01;
  268. kfree(r);
  269. return snprintf(buffer, PAGE_SIZE, "%d\n", status);
  270. }
  271. static ssize_t usb_charge_store(struct device *dev,
  272. struct device_attribute *attr,
  273. const char *buffer, size_t count)
  274. {
  275. bool value;
  276. union acpi_object *r;
  277. int ret;
  278. ret = kstrtobool(buffer, &value);
  279. if (ret)
  280. return ret;
  281. r = lg_wmbb(WMBB_USB_CHARGE, WM_SET, value);
  282. if (!r)
  283. return -EIO;
  284. kfree(r);
  285. return count;
  286. }
  287. static ssize_t usb_charge_show(struct device *dev,
  288. struct device_attribute *attr, char *buffer)
  289. {
  290. unsigned int status;
  291. union acpi_object *r;
  292. r = lg_wmbb(WMBB_USB_CHARGE, WM_GET, 0);
  293. if (!r)
  294. return -EIO;
  295. if (r->type != ACPI_TYPE_BUFFER) {
  296. kfree(r);
  297. return -EIO;
  298. }
  299. status = !!r->buffer.pointer[0x10];
  300. kfree(r);
  301. return snprintf(buffer, PAGE_SIZE, "%d\n", status);
  302. }
  303. static ssize_t reader_mode_store(struct device *dev,
  304. struct device_attribute *attr,
  305. const char *buffer, size_t count)
  306. {
  307. bool value;
  308. union acpi_object *r;
  309. int ret;
  310. ret = kstrtobool(buffer, &value);
  311. if (ret)
  312. return ret;
  313. r = lg_wmab(WM_READER_MODE, WM_SET, value);
  314. if (!r)
  315. return -EIO;
  316. kfree(r);
  317. return count;
  318. }
  319. static ssize_t reader_mode_show(struct device *dev,
  320. struct device_attribute *attr, char *buffer)
  321. {
  322. unsigned int status;
  323. union acpi_object *r;
  324. r = lg_wmab(WM_READER_MODE, WM_GET, 0);
  325. if (!r)
  326. return -EIO;
  327. if (r->type != ACPI_TYPE_INTEGER) {
  328. kfree(r);
  329. return -EIO;
  330. }
  331. status = !!r->integer.value;
  332. kfree(r);
  333. return snprintf(buffer, PAGE_SIZE, "%d\n", status);
  334. }
  335. static ssize_t fn_lock_store(struct device *dev,
  336. struct device_attribute *attr,
  337. const char *buffer, size_t count)
  338. {
  339. bool value;
  340. union acpi_object *r;
  341. int ret;
  342. ret = kstrtobool(buffer, &value);
  343. if (ret)
  344. return ret;
  345. r = lg_wmab(WM_FN_LOCK, WM_SET, value);
  346. if (!r)
  347. return -EIO;
  348. kfree(r);
  349. return count;
  350. }
  351. static ssize_t fn_lock_show(struct device *dev,
  352. struct device_attribute *attr, char *buffer)
  353. {
  354. unsigned int status;
  355. union acpi_object *r;
  356. r = lg_wmab(WM_FN_LOCK, WM_GET, 0);
  357. if (!r)
  358. return -EIO;
  359. if (r->type != ACPI_TYPE_BUFFER) {
  360. kfree(r);
  361. return -EIO;
  362. }
  363. status = !!r->buffer.pointer[0];
  364. kfree(r);
  365. return snprintf(buffer, PAGE_SIZE, "%d\n", status);
  366. }
  367. static ssize_t battery_care_limit_store(struct device *dev,
  368. struct device_attribute *attr,
  369. const char *buffer, size_t count)
  370. {
  371. unsigned long value;
  372. int ret;
  373. ret = kstrtoul(buffer, 10, &value);
  374. if (ret)
  375. return ret;
  376. if (value == 100 || value == 80) {
  377. union acpi_object *r;
  378. r = lg_wmab(WM_BATT_LIMIT, WM_SET, value);
  379. if (!r)
  380. return -EIO;
  381. kfree(r);
  382. return count;
  383. }
  384. return -EINVAL;
  385. }
  386. static ssize_t battery_care_limit_show(struct device *dev,
  387. struct device_attribute *attr,
  388. char *buffer)
  389. {
  390. unsigned int status;
  391. union acpi_object *r;
  392. r = lg_wmab(WM_BATT_LIMIT, WM_GET, 0);
  393. if (!r)
  394. return -EIO;
  395. if (r->type != ACPI_TYPE_INTEGER) {
  396. kfree(r);
  397. return -EIO;
  398. }
  399. status = r->integer.value;
  400. kfree(r);
  401. if (status != 80 && status != 100)
  402. status = 0;
  403. return snprintf(buffer, PAGE_SIZE, "%d\n", status);
  404. }
  405. static DEVICE_ATTR_RW(fan_mode);
  406. static DEVICE_ATTR_RW(usb_charge);
  407. static DEVICE_ATTR_RW(reader_mode);
  408. static DEVICE_ATTR_RW(fn_lock);
  409. static DEVICE_ATTR_RW(battery_care_limit);
  410. static struct attribute *dev_attributes[] = {
  411. &dev_attr_fan_mode.attr,
  412. &dev_attr_usb_charge.attr,
  413. &dev_attr_reader_mode.attr,
  414. &dev_attr_fn_lock.attr,
  415. &dev_attr_battery_care_limit.attr,
  416. NULL
  417. };
  418. static const struct attribute_group dev_attribute_group = {
  419. .attrs = dev_attributes,
  420. };
  421. static void tpad_led_set(struct led_classdev *cdev,
  422. enum led_brightness brightness)
  423. {
  424. union acpi_object *r;
  425. r = lg_wmab(WM_TLED, WM_SET, brightness > LED_OFF);
  426. kfree(r);
  427. }
  428. static enum led_brightness tpad_led_get(struct led_classdev *cdev)
  429. {
  430. return ggov(GOV_TLED) > 0 ? LED_ON : LED_OFF;
  431. }
  432. static LED_DEVICE(tpad_led, 1);
  433. static void kbd_backlight_set(struct led_classdev *cdev,
  434. enum led_brightness brightness)
  435. {
  436. u32 val;
  437. union acpi_object *r;
  438. val = 0x22;
  439. if (brightness <= LED_OFF)
  440. val = 0;
  441. if (brightness >= LED_FULL)
  442. val = 0x24;
  443. r = lg_wmab(WM_KEY_LIGHT, WM_SET, val);
  444. kfree(r);
  445. }
  446. static enum led_brightness kbd_backlight_get(struct led_classdev *cdev)
  447. {
  448. union acpi_object *r;
  449. int val;
  450. r = lg_wmab(WM_KEY_LIGHT, WM_GET, 0);
  451. if (!r)
  452. return LED_OFF;
  453. if (r->type != ACPI_TYPE_BUFFER || r->buffer.pointer[1] != 0x05) {
  454. kfree(r);
  455. return LED_OFF;
  456. }
  457. switch (r->buffer.pointer[0] & 0x27) {
  458. case 0x24:
  459. val = LED_FULL;
  460. break;
  461. case 0x22:
  462. val = LED_HALF;
  463. break;
  464. default:
  465. val = LED_OFF;
  466. }
  467. kfree(r);
  468. return val;
  469. }
  470. static LED_DEVICE(kbd_backlight, 255);
  471. static void wmi_input_destroy(void)
  472. {
  473. if (inited & INIT_INPUT_WMI_2)
  474. wmi_remove_notify_handler(WMI_EVENT_GUID2);
  475. if (inited & INIT_INPUT_WMI_0)
  476. wmi_remove_notify_handler(WMI_EVENT_GUID0);
  477. if (inited & INIT_SPARSE_KEYMAP)
  478. input_unregister_device(wmi_input_dev);
  479. inited &= ~(INIT_INPUT_WMI_0 | INIT_INPUT_WMI_2 | INIT_SPARSE_KEYMAP);
  480. }
  481. static struct platform_driver pf_driver = {
  482. .driver = {
  483. .name = PLATFORM_NAME,
  484. }
  485. };
  486. static int acpi_add(struct acpi_device *device)
  487. {
  488. int ret;
  489. if (pf_device)
  490. return 0;
  491. ret = platform_driver_register(&pf_driver);
  492. if (ret)
  493. return ret;
  494. pf_device = platform_device_register_simple(PLATFORM_NAME,
  495. PLATFORM_DEVID_NONE,
  496. NULL, 0);
  497. if (IS_ERR(pf_device)) {
  498. ret = PTR_ERR(pf_device);
  499. pf_device = NULL;
  500. pr_err("unable to register platform device\n");
  501. goto out_platform_registered;
  502. }
  503. ret = sysfs_create_group(&pf_device->dev.kobj, &dev_attribute_group);
  504. if (ret)
  505. goto out_platform_device;
  506. if (!led_classdev_register(&pf_device->dev, &kbd_backlight))
  507. inited |= INIT_KBD_LED;
  508. if (!led_classdev_register(&pf_device->dev, &tpad_led))
  509. inited |= INIT_TPAD_LED;
  510. wmi_input_setup();
  511. return 0;
  512. out_platform_device:
  513. platform_device_unregister(pf_device);
  514. out_platform_registered:
  515. platform_driver_unregister(&pf_driver);
  516. return ret;
  517. }
  518. static int acpi_remove(struct acpi_device *device)
  519. {
  520. sysfs_remove_group(&pf_device->dev.kobj, &dev_attribute_group);
  521. if (inited & INIT_KBD_LED)
  522. led_classdev_unregister(&kbd_backlight);
  523. if (inited & INIT_TPAD_LED)
  524. led_classdev_unregister(&tpad_led);
  525. wmi_input_destroy();
  526. platform_device_unregister(pf_device);
  527. pf_device = NULL;
  528. platform_driver_unregister(&pf_driver);
  529. return 0;
  530. }
  531. static const struct acpi_device_id device_ids[] = {
  532. {"LGEX0815", 0},
  533. {"", 0}
  534. };
  535. MODULE_DEVICE_TABLE(acpi, device_ids);
  536. static struct acpi_driver acpi_driver = {
  537. .name = "LG Gram Laptop Support",
  538. .class = "lg-laptop",
  539. .ids = device_ids,
  540. .ops = {
  541. .add = acpi_add,
  542. .remove = acpi_remove,
  543. .notify = acpi_notify,
  544. },
  545. .owner = THIS_MODULE,
  546. };
  547. static int __init acpi_init(void)
  548. {
  549. int result;
  550. result = acpi_bus_register_driver(&acpi_driver);
  551. if (result < 0) {
  552. ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error registering driver\n"));
  553. return -ENODEV;
  554. }
  555. return 0;
  556. }
  557. static void __exit acpi_exit(void)
  558. {
  559. acpi_bus_unregister_driver(&acpi_driver);
  560. }
  561. module_init(acpi_init);
  562. module_exit(acpi_exit);