ideapad-laptop.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. /*
  2. * ideapad-laptop.c - Lenovo IdeaPad ACPI Extras
  3. *
  4. * Copyright © 2010 Intel Corporation
  5. * Copyright © 2010 David Woodhouse <dwmw2@infradead.org>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  20. * 02110-1301, USA.
  21. */
  22. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  23. #include <linux/kernel.h>
  24. #include <linux/module.h>
  25. #include <linux/init.h>
  26. #include <linux/types.h>
  27. #include <acpi/acpi_bus.h>
  28. #include <acpi/acpi_drivers.h>
  29. #include <linux/rfkill.h>
  30. #include <linux/platform_device.h>
  31. #include <linux/input.h>
  32. #include <linux/input/sparse-keymap.h>
  33. #include <linux/backlight.h>
  34. #include <linux/fb.h>
  35. #define IDEAPAD_RFKILL_DEV_NUM (3)
  36. #define CFG_BT_BIT (16)
  37. #define CFG_3G_BIT (17)
  38. #define CFG_WIFI_BIT (18)
  39. #define CFG_CAMERA_BIT (19)
  40. enum {
  41. VPCCMD_R_VPC1 = 0x10,
  42. VPCCMD_R_BL_MAX,
  43. VPCCMD_R_BL,
  44. VPCCMD_W_BL,
  45. VPCCMD_R_WIFI,
  46. VPCCMD_W_WIFI,
  47. VPCCMD_R_BT,
  48. VPCCMD_W_BT,
  49. VPCCMD_R_BL_POWER,
  50. VPCCMD_R_NOVO,
  51. VPCCMD_R_VPC2,
  52. VPCCMD_R_TOUCHPAD,
  53. VPCCMD_W_TOUCHPAD,
  54. VPCCMD_R_CAMERA,
  55. VPCCMD_W_CAMERA,
  56. VPCCMD_R_3G,
  57. VPCCMD_W_3G,
  58. VPCCMD_R_ODD, /* 0x21 */
  59. VPCCMD_R_RF = 0x23,
  60. VPCCMD_W_RF,
  61. VPCCMD_W_BL_POWER = 0x33,
  62. };
  63. struct ideapad_private {
  64. struct rfkill *rfk[IDEAPAD_RFKILL_DEV_NUM];
  65. struct platform_device *platform_device;
  66. struct input_dev *inputdev;
  67. struct backlight_device *blightdev;
  68. unsigned long cfg;
  69. };
  70. static acpi_handle ideapad_handle;
  71. static bool no_bt_rfkill;
  72. module_param(no_bt_rfkill, bool, 0444);
  73. MODULE_PARM_DESC(no_bt_rfkill, "No rfkill for bluetooth.");
  74. /*
  75. * ACPI Helpers
  76. */
  77. #define IDEAPAD_EC_TIMEOUT (100) /* in ms */
  78. static int read_method_int(acpi_handle handle, const char *method, int *val)
  79. {
  80. acpi_status status;
  81. unsigned long long result;
  82. status = acpi_evaluate_integer(handle, (char *)method, NULL, &result);
  83. if (ACPI_FAILURE(status)) {
  84. *val = -1;
  85. return -1;
  86. } else {
  87. *val = result;
  88. return 0;
  89. }
  90. }
  91. static int method_vpcr(acpi_handle handle, int cmd, int *ret)
  92. {
  93. acpi_status status;
  94. unsigned long long result;
  95. struct acpi_object_list params;
  96. union acpi_object in_obj;
  97. params.count = 1;
  98. params.pointer = &in_obj;
  99. in_obj.type = ACPI_TYPE_INTEGER;
  100. in_obj.integer.value = cmd;
  101. status = acpi_evaluate_integer(handle, "VPCR", &params, &result);
  102. if (ACPI_FAILURE(status)) {
  103. *ret = -1;
  104. return -1;
  105. } else {
  106. *ret = result;
  107. return 0;
  108. }
  109. }
  110. static int method_vpcw(acpi_handle handle, int cmd, int data)
  111. {
  112. struct acpi_object_list params;
  113. union acpi_object in_obj[2];
  114. acpi_status status;
  115. params.count = 2;
  116. params.pointer = in_obj;
  117. in_obj[0].type = ACPI_TYPE_INTEGER;
  118. in_obj[0].integer.value = cmd;
  119. in_obj[1].type = ACPI_TYPE_INTEGER;
  120. in_obj[1].integer.value = data;
  121. status = acpi_evaluate_object(handle, "VPCW", &params, NULL);
  122. if (status != AE_OK)
  123. return -1;
  124. return 0;
  125. }
  126. static int read_ec_data(acpi_handle handle, int cmd, unsigned long *data)
  127. {
  128. int val;
  129. unsigned long int end_jiffies;
  130. if (method_vpcw(handle, 1, cmd))
  131. return -1;
  132. for (end_jiffies = jiffies+(HZ)*IDEAPAD_EC_TIMEOUT/1000+1;
  133. time_before(jiffies, end_jiffies);) {
  134. schedule();
  135. if (method_vpcr(handle, 1, &val))
  136. return -1;
  137. if (val == 0) {
  138. if (method_vpcr(handle, 0, &val))
  139. return -1;
  140. *data = val;
  141. return 0;
  142. }
  143. }
  144. pr_err("timeout in read_ec_cmd\n");
  145. return -1;
  146. }
  147. static int write_ec_cmd(acpi_handle handle, int cmd, unsigned long data)
  148. {
  149. int val;
  150. unsigned long int end_jiffies;
  151. if (method_vpcw(handle, 0, data))
  152. return -1;
  153. if (method_vpcw(handle, 1, cmd))
  154. return -1;
  155. for (end_jiffies = jiffies+(HZ)*IDEAPAD_EC_TIMEOUT/1000+1;
  156. time_before(jiffies, end_jiffies);) {
  157. schedule();
  158. if (method_vpcr(handle, 1, &val))
  159. return -1;
  160. if (val == 0)
  161. return 0;
  162. }
  163. pr_err("timeout in write_ec_cmd\n");
  164. return -1;
  165. }
  166. /*
  167. * sysfs
  168. */
  169. static ssize_t show_ideapad_cam(struct device *dev,
  170. struct device_attribute *attr,
  171. char *buf)
  172. {
  173. unsigned long result;
  174. if (read_ec_data(ideapad_handle, VPCCMD_R_CAMERA, &result))
  175. return sprintf(buf, "-1\n");
  176. return sprintf(buf, "%lu\n", result);
  177. }
  178. static ssize_t store_ideapad_cam(struct device *dev,
  179. struct device_attribute *attr,
  180. const char *buf, size_t count)
  181. {
  182. int ret, state;
  183. if (!count)
  184. return 0;
  185. if (sscanf(buf, "%i", &state) != 1)
  186. return -EINVAL;
  187. ret = write_ec_cmd(ideapad_handle, VPCCMD_W_CAMERA, state);
  188. if (ret < 0)
  189. return ret;
  190. return count;
  191. }
  192. static DEVICE_ATTR(camera_power, 0644, show_ideapad_cam, store_ideapad_cam);
  193. static ssize_t show_ideapad_cfg(struct device *dev,
  194. struct device_attribute *attr,
  195. char *buf)
  196. {
  197. struct ideapad_private *priv = dev_get_drvdata(dev);
  198. return sprintf(buf, "0x%.8lX\n", priv->cfg);
  199. }
  200. static DEVICE_ATTR(cfg, 0444, show_ideapad_cfg, NULL);
  201. static struct attribute *ideapad_attributes[] = {
  202. &dev_attr_camera_power.attr,
  203. &dev_attr_cfg.attr,
  204. NULL
  205. };
  206. static mode_t ideapad_is_visible(struct kobject *kobj,
  207. struct attribute *attr,
  208. int idx)
  209. {
  210. struct device *dev = container_of(kobj, struct device, kobj);
  211. struct ideapad_private *priv = dev_get_drvdata(dev);
  212. bool supported;
  213. if (attr == &dev_attr_camera_power.attr)
  214. supported = test_bit(CFG_CAMERA_BIT, &(priv->cfg));
  215. else
  216. supported = true;
  217. return supported ? attr->mode : 0;
  218. }
  219. static struct attribute_group ideapad_attribute_group = {
  220. .is_visible = ideapad_is_visible,
  221. .attrs = ideapad_attributes
  222. };
  223. /*
  224. * Rfkill
  225. */
  226. struct ideapad_rfk_data {
  227. char *name;
  228. int cfgbit;
  229. int opcode;
  230. int type;
  231. };
  232. const struct ideapad_rfk_data ideapad_rfk_data[] = {
  233. { "ideapad_wlan", CFG_WIFI_BIT, VPCCMD_W_WIFI, RFKILL_TYPE_WLAN },
  234. { "ideapad_bluetooth", CFG_BT_BIT, VPCCMD_W_BT, RFKILL_TYPE_BLUETOOTH },
  235. { "ideapad_3g", CFG_3G_BIT, VPCCMD_W_3G, RFKILL_TYPE_WWAN },
  236. };
  237. static int ideapad_rfk_set(void *data, bool blocked)
  238. {
  239. unsigned long opcode = (unsigned long)data;
  240. return write_ec_cmd(ideapad_handle, opcode, !blocked);
  241. }
  242. static struct rfkill_ops ideapad_rfk_ops = {
  243. .set_block = ideapad_rfk_set,
  244. };
  245. static void ideapad_sync_rfk_state(struct ideapad_private *priv)
  246. {
  247. unsigned long hw_blocked;
  248. int i;
  249. if (read_ec_data(ideapad_handle, VPCCMD_R_RF, &hw_blocked))
  250. return;
  251. hw_blocked = !hw_blocked;
  252. for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
  253. if (priv->rfk[i])
  254. rfkill_set_hw_state(priv->rfk[i], hw_blocked);
  255. }
  256. static int __devinit ideapad_register_rfkill(struct acpi_device *adevice,
  257. int dev)
  258. {
  259. struct ideapad_private *priv = dev_get_drvdata(&adevice->dev);
  260. int ret;
  261. unsigned long sw_blocked;
  262. if (no_bt_rfkill &&
  263. (ideapad_rfk_data[dev].type == RFKILL_TYPE_BLUETOOTH)) {
  264. /* Force to enable bluetooth when no_bt_rfkill=1 */
  265. write_ec_cmd(ideapad_handle,
  266. ideapad_rfk_data[dev].opcode, 1);
  267. return 0;
  268. }
  269. priv->rfk[dev] = rfkill_alloc(ideapad_rfk_data[dev].name, &adevice->dev,
  270. ideapad_rfk_data[dev].type, &ideapad_rfk_ops,
  271. (void *)(long)dev);
  272. if (!priv->rfk[dev])
  273. return -ENOMEM;
  274. if (read_ec_data(ideapad_handle, ideapad_rfk_data[dev].opcode-1,
  275. &sw_blocked)) {
  276. rfkill_init_sw_state(priv->rfk[dev], 0);
  277. } else {
  278. sw_blocked = !sw_blocked;
  279. rfkill_init_sw_state(priv->rfk[dev], sw_blocked);
  280. }
  281. ret = rfkill_register(priv->rfk[dev]);
  282. if (ret) {
  283. rfkill_destroy(priv->rfk[dev]);
  284. return ret;
  285. }
  286. return 0;
  287. }
  288. static void ideapad_unregister_rfkill(struct acpi_device *adevice, int dev)
  289. {
  290. struct ideapad_private *priv = dev_get_drvdata(&adevice->dev);
  291. if (!priv->rfk[dev])
  292. return;
  293. rfkill_unregister(priv->rfk[dev]);
  294. rfkill_destroy(priv->rfk[dev]);
  295. }
  296. /*
  297. * Platform device
  298. */
  299. static int __devinit ideapad_platform_init(struct ideapad_private *priv)
  300. {
  301. int result;
  302. priv->platform_device = platform_device_alloc("ideapad", -1);
  303. if (!priv->platform_device)
  304. return -ENOMEM;
  305. platform_set_drvdata(priv->platform_device, priv);
  306. result = platform_device_add(priv->platform_device);
  307. if (result)
  308. goto fail_platform_device;
  309. result = sysfs_create_group(&priv->platform_device->dev.kobj,
  310. &ideapad_attribute_group);
  311. if (result)
  312. goto fail_sysfs;
  313. return 0;
  314. fail_sysfs:
  315. platform_device_del(priv->platform_device);
  316. fail_platform_device:
  317. platform_device_put(priv->platform_device);
  318. return result;
  319. }
  320. static void ideapad_platform_exit(struct ideapad_private *priv)
  321. {
  322. sysfs_remove_group(&priv->platform_device->dev.kobj,
  323. &ideapad_attribute_group);
  324. platform_device_unregister(priv->platform_device);
  325. }
  326. /*
  327. * input device
  328. */
  329. static const struct key_entry ideapad_keymap[] = {
  330. { KE_KEY, 6, { KEY_SWITCHVIDEOMODE } },
  331. { KE_KEY, 13, { KEY_WLAN } },
  332. { KE_KEY, 16, { KEY_PROG1 } },
  333. { KE_KEY, 17, { KEY_PROG2 } },
  334. { KE_END, 0 },
  335. };
  336. static int __devinit ideapad_input_init(struct ideapad_private *priv)
  337. {
  338. struct input_dev *inputdev;
  339. int error;
  340. inputdev = input_allocate_device();
  341. if (!inputdev) {
  342. pr_info("Unable to allocate input device\n");
  343. return -ENOMEM;
  344. }
  345. inputdev->name = "Ideapad extra buttons";
  346. inputdev->phys = "ideapad/input0";
  347. inputdev->id.bustype = BUS_HOST;
  348. inputdev->dev.parent = &priv->platform_device->dev;
  349. error = sparse_keymap_setup(inputdev, ideapad_keymap, NULL);
  350. if (error) {
  351. pr_err("Unable to setup input device keymap\n");
  352. goto err_free_dev;
  353. }
  354. error = input_register_device(inputdev);
  355. if (error) {
  356. pr_err("Unable to register input device\n");
  357. goto err_free_keymap;
  358. }
  359. priv->inputdev = inputdev;
  360. return 0;
  361. err_free_keymap:
  362. sparse_keymap_free(inputdev);
  363. err_free_dev:
  364. input_free_device(inputdev);
  365. return error;
  366. }
  367. static void ideapad_input_exit(struct ideapad_private *priv)
  368. {
  369. sparse_keymap_free(priv->inputdev);
  370. input_unregister_device(priv->inputdev);
  371. priv->inputdev = NULL;
  372. }
  373. static void ideapad_input_report(struct ideapad_private *priv,
  374. unsigned long scancode)
  375. {
  376. sparse_keymap_report_event(priv->inputdev, scancode, 1, true);
  377. }
  378. static void ideapad_input_novokey(struct ideapad_private *priv)
  379. {
  380. unsigned long long_pressed;
  381. if (read_ec_data(ideapad_handle, VPCCMD_R_NOVO, &long_pressed))
  382. return;
  383. if (long_pressed)
  384. ideapad_input_report(priv, 17);
  385. else
  386. ideapad_input_report(priv, 16);
  387. }
  388. /*
  389. * backlight
  390. */
  391. static int ideapad_backlight_get_brightness(struct backlight_device *blightdev)
  392. {
  393. unsigned long now;
  394. if (read_ec_data(ideapad_handle, VPCCMD_R_BL, &now))
  395. return -EIO;
  396. return now;
  397. }
  398. static int ideapad_backlight_update_status(struct backlight_device *blightdev)
  399. {
  400. if (write_ec_cmd(ideapad_handle, VPCCMD_W_BL,
  401. blightdev->props.brightness))
  402. return -EIO;
  403. if (write_ec_cmd(ideapad_handle, VPCCMD_W_BL_POWER,
  404. blightdev->props.power == FB_BLANK_POWERDOWN ? 0 : 1))
  405. return -EIO;
  406. return 0;
  407. }
  408. static const struct backlight_ops ideapad_backlight_ops = {
  409. .get_brightness = ideapad_backlight_get_brightness,
  410. .update_status = ideapad_backlight_update_status,
  411. };
  412. static int ideapad_backlight_init(struct ideapad_private *priv)
  413. {
  414. struct backlight_device *blightdev;
  415. struct backlight_properties props;
  416. unsigned long max, now, power;
  417. if (read_ec_data(ideapad_handle, VPCCMD_R_BL_MAX, &max))
  418. return -EIO;
  419. if (read_ec_data(ideapad_handle, VPCCMD_R_BL, &now))
  420. return -EIO;
  421. if (read_ec_data(ideapad_handle, VPCCMD_R_BL_POWER, &power))
  422. return -EIO;
  423. memset(&props, 0, sizeof(struct backlight_properties));
  424. props.max_brightness = max;
  425. props.type = BACKLIGHT_PLATFORM;
  426. blightdev = backlight_device_register("ideapad",
  427. &priv->platform_device->dev,
  428. priv,
  429. &ideapad_backlight_ops,
  430. &props);
  431. if (IS_ERR(blightdev)) {
  432. pr_err("Could not register backlight device\n");
  433. return PTR_ERR(blightdev);
  434. }
  435. priv->blightdev = blightdev;
  436. blightdev->props.brightness = now;
  437. blightdev->props.power = power ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
  438. backlight_update_status(blightdev);
  439. return 0;
  440. }
  441. static void ideapad_backlight_exit(struct ideapad_private *priv)
  442. {
  443. if (priv->blightdev)
  444. backlight_device_unregister(priv->blightdev);
  445. priv->blightdev = NULL;
  446. }
  447. static void ideapad_backlight_notify_power(struct ideapad_private *priv)
  448. {
  449. unsigned long power;
  450. struct backlight_device *blightdev = priv->blightdev;
  451. if (!blightdev)
  452. return;
  453. if (read_ec_data(ideapad_handle, VPCCMD_R_BL_POWER, &power))
  454. return;
  455. blightdev->props.power = power ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
  456. }
  457. static void ideapad_backlight_notify_brightness(struct ideapad_private *priv)
  458. {
  459. unsigned long now;
  460. /* if we control brightness via acpi video driver */
  461. if (priv->blightdev == NULL) {
  462. read_ec_data(ideapad_handle, VPCCMD_R_BL, &now);
  463. return;
  464. }
  465. backlight_force_update(priv->blightdev, BACKLIGHT_UPDATE_HOTKEY);
  466. }
  467. /*
  468. * module init/exit
  469. */
  470. static const struct acpi_device_id ideapad_device_ids[] = {
  471. { "VPC2004", 0},
  472. { "", 0},
  473. };
  474. MODULE_DEVICE_TABLE(acpi, ideapad_device_ids);
  475. static int __devinit ideapad_acpi_add(struct acpi_device *adevice)
  476. {
  477. int ret, i;
  478. unsigned long cfg;
  479. struct ideapad_private *priv;
  480. if (read_method_int(adevice->handle, "_CFG", (int *)&cfg))
  481. return -ENODEV;
  482. priv = kzalloc(sizeof(*priv), GFP_KERNEL);
  483. if (!priv)
  484. return -ENOMEM;
  485. dev_set_drvdata(&adevice->dev, priv);
  486. ideapad_handle = adevice->handle;
  487. priv->cfg = cfg;
  488. ret = ideapad_platform_init(priv);
  489. if (ret)
  490. goto platform_failed;
  491. ret = ideapad_input_init(priv);
  492. if (ret)
  493. goto input_failed;
  494. for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++) {
  495. if (test_bit(ideapad_rfk_data[i].cfgbit, &cfg))
  496. ideapad_register_rfkill(adevice, i);
  497. else
  498. priv->rfk[i] = NULL;
  499. }
  500. ideapad_sync_rfk_state(priv);
  501. if (!acpi_video_backlight_support()) {
  502. ret = ideapad_backlight_init(priv);
  503. if (ret && ret != -ENODEV)
  504. goto backlight_failed;
  505. }
  506. return 0;
  507. backlight_failed:
  508. for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
  509. ideapad_unregister_rfkill(adevice, i);
  510. ideapad_input_exit(priv);
  511. input_failed:
  512. ideapad_platform_exit(priv);
  513. platform_failed:
  514. kfree(priv);
  515. return ret;
  516. }
  517. static int __devexit ideapad_acpi_remove(struct acpi_device *adevice, int type)
  518. {
  519. struct ideapad_private *priv = dev_get_drvdata(&adevice->dev);
  520. int i;
  521. ideapad_backlight_exit(priv);
  522. for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
  523. ideapad_unregister_rfkill(adevice, i);
  524. ideapad_input_exit(priv);
  525. ideapad_platform_exit(priv);
  526. dev_set_drvdata(&adevice->dev, NULL);
  527. kfree(priv);
  528. return 0;
  529. }
  530. static void ideapad_acpi_notify(struct acpi_device *adevice, u32 event)
  531. {
  532. struct ideapad_private *priv = dev_get_drvdata(&adevice->dev);
  533. acpi_handle handle = adevice->handle;
  534. unsigned long vpc1, vpc2, vpc_bit;
  535. if (read_ec_data(handle, VPCCMD_R_VPC1, &vpc1))
  536. return;
  537. if (read_ec_data(handle, VPCCMD_R_VPC2, &vpc2))
  538. return;
  539. vpc1 = (vpc2 << 8) | vpc1;
  540. for (vpc_bit = 0; vpc_bit < 16; vpc_bit++) {
  541. if (test_bit(vpc_bit, &vpc1)) {
  542. switch (vpc_bit) {
  543. case 9:
  544. ideapad_sync_rfk_state(priv);
  545. break;
  546. case 4:
  547. ideapad_backlight_notify_brightness(priv);
  548. break;
  549. case 3:
  550. ideapad_input_novokey(priv);
  551. break;
  552. case 2:
  553. ideapad_backlight_notify_power(priv);
  554. break;
  555. default:
  556. ideapad_input_report(priv, vpc_bit);
  557. }
  558. }
  559. }
  560. }
  561. static struct acpi_driver ideapad_acpi_driver = {
  562. .name = "ideapad_acpi",
  563. .class = "IdeaPad",
  564. .ids = ideapad_device_ids,
  565. .ops.add = ideapad_acpi_add,
  566. .ops.remove = ideapad_acpi_remove,
  567. .ops.notify = ideapad_acpi_notify,
  568. .owner = THIS_MODULE,
  569. };
  570. static int __init ideapad_acpi_module_init(void)
  571. {
  572. return acpi_bus_register_driver(&ideapad_acpi_driver);
  573. }
  574. static void __exit ideapad_acpi_module_exit(void)
  575. {
  576. acpi_bus_unregister_driver(&ideapad_acpi_driver);
  577. }
  578. MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
  579. MODULE_DESCRIPTION("IdeaPad ACPI Extras");
  580. MODULE_LICENSE("GPL");
  581. module_init(ideapad_acpi_module_init);
  582. module_exit(ideapad_acpi_module_exit);