button.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. /*
  2. * button.c - ACPI Button Driver
  3. *
  4. * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
  5. * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
  6. *
  7. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or (at
  12. * your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  20. */
  21. #define pr_fmt(fmt) "ACPI: button: " fmt
  22. #include <linux/kernel.h>
  23. #include <linux/module.h>
  24. #include <linux/init.h>
  25. #include <linux/types.h>
  26. #include <linux/proc_fs.h>
  27. #include <linux/seq_file.h>
  28. #include <linux/input.h>
  29. #include <linux/slab.h>
  30. #include <linux/acpi.h>
  31. #include <acpi/button.h>
  32. #define PREFIX "ACPI: "
  33. #define ACPI_BUTTON_CLASS "button"
  34. #define ACPI_BUTTON_FILE_INFO "info"
  35. #define ACPI_BUTTON_FILE_STATE "state"
  36. #define ACPI_BUTTON_TYPE_UNKNOWN 0x00
  37. #define ACPI_BUTTON_NOTIFY_STATUS 0x80
  38. #define ACPI_BUTTON_SUBCLASS_POWER "power"
  39. #define ACPI_BUTTON_HID_POWER "PNP0C0C"
  40. #define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button"
  41. #define ACPI_BUTTON_TYPE_POWER 0x01
  42. #define ACPI_BUTTON_SUBCLASS_SLEEP "sleep"
  43. #define ACPI_BUTTON_HID_SLEEP "PNP0C0E"
  44. #define ACPI_BUTTON_DEVICE_NAME_SLEEP "Sleep Button"
  45. #define ACPI_BUTTON_TYPE_SLEEP 0x03
  46. #define ACPI_BUTTON_SUBCLASS_LID "lid"
  47. #define ACPI_BUTTON_HID_LID "PNP0C0D"
  48. #define ACPI_BUTTON_DEVICE_NAME_LID "Lid Switch"
  49. #define ACPI_BUTTON_TYPE_LID 0x05
  50. #define ACPI_BUTTON_LID_INIT_IGNORE 0x00
  51. #define ACPI_BUTTON_LID_INIT_OPEN 0x01
  52. #define ACPI_BUTTON_LID_INIT_METHOD 0x02
  53. #define _COMPONENT ACPI_BUTTON_COMPONENT
  54. ACPI_MODULE_NAME("button");
  55. MODULE_AUTHOR("Paul Diefenbaugh");
  56. MODULE_DESCRIPTION("ACPI Button Driver");
  57. MODULE_LICENSE("GPL");
  58. static const struct acpi_device_id button_device_ids[] = {
  59. {ACPI_BUTTON_HID_LID, 0},
  60. {ACPI_BUTTON_HID_SLEEP, 0},
  61. {ACPI_BUTTON_HID_SLEEPF, 0},
  62. {ACPI_BUTTON_HID_POWER, 0},
  63. {ACPI_BUTTON_HID_POWERF, 0},
  64. {"", 0},
  65. };
  66. MODULE_DEVICE_TABLE(acpi, button_device_ids);
  67. static int acpi_button_add(struct acpi_device *device);
  68. static int acpi_button_remove(struct acpi_device *device);
  69. static void acpi_button_notify(struct acpi_device *device, u32 event);
  70. #ifdef CONFIG_PM_SLEEP
  71. static int acpi_button_suspend(struct device *dev);
  72. static int acpi_button_resume(struct device *dev);
  73. #else
  74. #define acpi_button_suspend NULL
  75. #define acpi_button_resume NULL
  76. #endif
  77. static SIMPLE_DEV_PM_OPS(acpi_button_pm, acpi_button_suspend, acpi_button_resume);
  78. static struct acpi_driver acpi_button_driver = {
  79. .name = "button",
  80. .class = ACPI_BUTTON_CLASS,
  81. .ids = button_device_ids,
  82. .ops = {
  83. .add = acpi_button_add,
  84. .remove = acpi_button_remove,
  85. .notify = acpi_button_notify,
  86. },
  87. .drv.pm = &acpi_button_pm,
  88. };
  89. struct acpi_button {
  90. unsigned int type;
  91. struct input_dev *input;
  92. char phys[32]; /* for input device */
  93. unsigned long pushed;
  94. int last_state;
  95. ktime_t last_time;
  96. bool suspended;
  97. };
  98. static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier);
  99. static struct acpi_device *lid_device;
  100. static u8 lid_init_state = ACPI_BUTTON_LID_INIT_METHOD;
  101. static unsigned long lid_report_interval __read_mostly = 500;
  102. module_param(lid_report_interval, ulong, 0644);
  103. MODULE_PARM_DESC(lid_report_interval, "Interval (ms) between lid key events");
  104. /* --------------------------------------------------------------------------
  105. FS Interface (/proc)
  106. -------------------------------------------------------------------------- */
  107. static struct proc_dir_entry *acpi_button_dir;
  108. static struct proc_dir_entry *acpi_lid_dir;
  109. static int acpi_lid_evaluate_state(struct acpi_device *device)
  110. {
  111. unsigned long long lid_state;
  112. acpi_status status;
  113. status = acpi_evaluate_integer(device->handle, "_LID", NULL, &lid_state);
  114. if (ACPI_FAILURE(status))
  115. return -ENODEV;
  116. return lid_state ? 1 : 0;
  117. }
  118. static int acpi_lid_notify_state(struct acpi_device *device, int state)
  119. {
  120. struct acpi_button *button = acpi_driver_data(device);
  121. int ret;
  122. ktime_t next_report;
  123. bool do_update;
  124. /*
  125. * In lid_init_state=ignore mode, if user opens/closes lid
  126. * frequently with "open" missing, and "last_time" is also updated
  127. * frequently, "close" cannot be delivered to the userspace.
  128. * So "last_time" is only updated after a timeout or an actual
  129. * switch.
  130. */
  131. if (lid_init_state != ACPI_BUTTON_LID_INIT_IGNORE ||
  132. button->last_state != !!state)
  133. do_update = true;
  134. else
  135. do_update = false;
  136. next_report = ktime_add(button->last_time,
  137. ms_to_ktime(lid_report_interval));
  138. if (button->last_state == !!state &&
  139. ktime_after(ktime_get(), next_report)) {
  140. /* Complain the buggy firmware */
  141. pr_warn_once("The lid device is not compliant to SW_LID.\n");
  142. /*
  143. * Send the unreliable complement switch event:
  144. *
  145. * On most platforms, the lid device is reliable. However
  146. * there are exceptions:
  147. * 1. Platforms returning initial lid state as "close" by
  148. * default after booting/resuming:
  149. * https://bugzilla.kernel.org/show_bug.cgi?id=89211
  150. * https://bugzilla.kernel.org/show_bug.cgi?id=106151
  151. * 2. Platforms never reporting "open" events:
  152. * https://bugzilla.kernel.org/show_bug.cgi?id=106941
  153. * On these buggy platforms, the usage model of the ACPI
  154. * lid device actually is:
  155. * 1. The initial returning value of _LID may not be
  156. * reliable.
  157. * 2. The open event may not be reliable.
  158. * 3. The close event is reliable.
  159. *
  160. * But SW_LID is typed as input switch event, the input
  161. * layer checks if the event is redundant. Hence if the
  162. * state is not switched, the userspace cannot see this
  163. * platform triggered reliable event. By inserting a
  164. * complement switch event, it then is guaranteed that the
  165. * platform triggered reliable one can always be seen by
  166. * the userspace.
  167. */
  168. if (lid_init_state == ACPI_BUTTON_LID_INIT_IGNORE) {
  169. do_update = true;
  170. /*
  171. * Do generate complement switch event for "close"
  172. * as "close" is reliable and wrong "open" won't
  173. * trigger unexpected behaviors.
  174. * Do not generate complement switch event for
  175. * "open" as "open" is not reliable and wrong
  176. * "close" will trigger unexpected behaviors.
  177. */
  178. if (!state) {
  179. input_report_switch(button->input,
  180. SW_LID, state);
  181. input_sync(button->input);
  182. }
  183. }
  184. }
  185. /* Send the platform triggered reliable event */
  186. if (do_update) {
  187. input_report_switch(button->input, SW_LID, !state);
  188. input_sync(button->input);
  189. button->last_state = !!state;
  190. button->last_time = ktime_get();
  191. }
  192. if (state)
  193. acpi_pm_wakeup_event(&device->dev);
  194. ret = blocking_notifier_call_chain(&acpi_lid_notifier, state, device);
  195. if (ret == NOTIFY_DONE)
  196. ret = blocking_notifier_call_chain(&acpi_lid_notifier, state,
  197. device);
  198. if (ret == NOTIFY_DONE || ret == NOTIFY_OK) {
  199. /*
  200. * It is also regarded as success if the notifier_chain
  201. * returns NOTIFY_OK or NOTIFY_DONE.
  202. */
  203. ret = 0;
  204. }
  205. return ret;
  206. }
  207. static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
  208. {
  209. struct acpi_device *device = seq->private;
  210. int state;
  211. state = acpi_lid_evaluate_state(device);
  212. seq_printf(seq, "state: %s\n",
  213. state < 0 ? "unsupported" : (state ? "open" : "closed"));
  214. return 0;
  215. }
  216. static int acpi_button_state_open_fs(struct inode *inode, struct file *file)
  217. {
  218. return single_open(file, acpi_button_state_seq_show, PDE_DATA(inode));
  219. }
  220. static const struct file_operations acpi_button_state_fops = {
  221. .owner = THIS_MODULE,
  222. .open = acpi_button_state_open_fs,
  223. .read = seq_read,
  224. .llseek = seq_lseek,
  225. .release = single_release,
  226. };
  227. static int acpi_button_add_fs(struct acpi_device *device)
  228. {
  229. struct acpi_button *button = acpi_driver_data(device);
  230. struct proc_dir_entry *entry = NULL;
  231. int ret = 0;
  232. /* procfs I/F for ACPI lid device only */
  233. if (button->type != ACPI_BUTTON_TYPE_LID)
  234. return 0;
  235. if (acpi_button_dir || acpi_lid_dir) {
  236. printk(KERN_ERR PREFIX "More than one Lid device found!\n");
  237. return -EEXIST;
  238. }
  239. /* create /proc/acpi/button */
  240. acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir);
  241. if (!acpi_button_dir)
  242. return -ENODEV;
  243. /* create /proc/acpi/button/lid */
  244. acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
  245. if (!acpi_lid_dir) {
  246. ret = -ENODEV;
  247. goto remove_button_dir;
  248. }
  249. /* create /proc/acpi/button/lid/LID/ */
  250. acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), acpi_lid_dir);
  251. if (!acpi_device_dir(device)) {
  252. ret = -ENODEV;
  253. goto remove_lid_dir;
  254. }
  255. /* create /proc/acpi/button/lid/LID/state */
  256. entry = proc_create_data(ACPI_BUTTON_FILE_STATE,
  257. S_IRUGO, acpi_device_dir(device),
  258. &acpi_button_state_fops, device);
  259. if (!entry) {
  260. ret = -ENODEV;
  261. goto remove_dev_dir;
  262. }
  263. done:
  264. return ret;
  265. remove_dev_dir:
  266. remove_proc_entry(acpi_device_bid(device),
  267. acpi_lid_dir);
  268. acpi_device_dir(device) = NULL;
  269. remove_lid_dir:
  270. remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
  271. acpi_lid_dir = NULL;
  272. remove_button_dir:
  273. remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
  274. acpi_button_dir = NULL;
  275. goto done;
  276. }
  277. static int acpi_button_remove_fs(struct acpi_device *device)
  278. {
  279. struct acpi_button *button = acpi_driver_data(device);
  280. if (button->type != ACPI_BUTTON_TYPE_LID)
  281. return 0;
  282. remove_proc_entry(ACPI_BUTTON_FILE_STATE,
  283. acpi_device_dir(device));
  284. remove_proc_entry(acpi_device_bid(device),
  285. acpi_lid_dir);
  286. acpi_device_dir(device) = NULL;
  287. remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
  288. acpi_lid_dir = NULL;
  289. remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
  290. acpi_button_dir = NULL;
  291. return 0;
  292. }
  293. /* --------------------------------------------------------------------------
  294. Driver Interface
  295. -------------------------------------------------------------------------- */
  296. int acpi_lid_notifier_register(struct notifier_block *nb)
  297. {
  298. return blocking_notifier_chain_register(&acpi_lid_notifier, nb);
  299. }
  300. EXPORT_SYMBOL(acpi_lid_notifier_register);
  301. int acpi_lid_notifier_unregister(struct notifier_block *nb)
  302. {
  303. return blocking_notifier_chain_unregister(&acpi_lid_notifier, nb);
  304. }
  305. EXPORT_SYMBOL(acpi_lid_notifier_unregister);
  306. int acpi_lid_open(void)
  307. {
  308. if (!lid_device)
  309. return -ENODEV;
  310. return acpi_lid_evaluate_state(lid_device);
  311. }
  312. EXPORT_SYMBOL(acpi_lid_open);
  313. static int acpi_lid_update_state(struct acpi_device *device)
  314. {
  315. int state;
  316. state = acpi_lid_evaluate_state(device);
  317. if (state < 0)
  318. return state;
  319. return acpi_lid_notify_state(device, state);
  320. }
  321. static void acpi_lid_initialize_state(struct acpi_device *device)
  322. {
  323. switch (lid_init_state) {
  324. case ACPI_BUTTON_LID_INIT_OPEN:
  325. (void)acpi_lid_notify_state(device, 1);
  326. break;
  327. case ACPI_BUTTON_LID_INIT_METHOD:
  328. (void)acpi_lid_update_state(device);
  329. break;
  330. case ACPI_BUTTON_LID_INIT_IGNORE:
  331. default:
  332. break;
  333. }
  334. }
  335. static void acpi_button_notify(struct acpi_device *device, u32 event)
  336. {
  337. struct acpi_button *button = acpi_driver_data(device);
  338. struct input_dev *input;
  339. int users;
  340. switch (event) {
  341. case ACPI_FIXED_HARDWARE_EVENT:
  342. event = ACPI_BUTTON_NOTIFY_STATUS;
  343. /* fall through */
  344. case ACPI_BUTTON_NOTIFY_STATUS:
  345. input = button->input;
  346. if (button->type == ACPI_BUTTON_TYPE_LID) {
  347. mutex_lock(&button->input->mutex);
  348. users = button->input->users;
  349. mutex_unlock(&button->input->mutex);
  350. if (users)
  351. acpi_lid_update_state(device);
  352. } else {
  353. int keycode;
  354. acpi_pm_wakeup_event(&device->dev);
  355. if (button->suspended)
  356. break;
  357. keycode = test_bit(KEY_SLEEP, input->keybit) ?
  358. KEY_SLEEP : KEY_POWER;
  359. input_report_key(input, keycode, 1);
  360. input_sync(input);
  361. input_report_key(input, keycode, 0);
  362. input_sync(input);
  363. acpi_bus_generate_netlink_event(
  364. device->pnp.device_class,
  365. dev_name(&device->dev),
  366. event, ++button->pushed);
  367. }
  368. break;
  369. default:
  370. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  371. "Unsupported event [0x%x]\n", event));
  372. break;
  373. }
  374. }
  375. #ifdef CONFIG_PM_SLEEP
  376. static int acpi_button_suspend(struct device *dev)
  377. {
  378. struct acpi_device *device = to_acpi_device(dev);
  379. struct acpi_button *button = acpi_driver_data(device);
  380. button->suspended = true;
  381. return 0;
  382. }
  383. static int acpi_button_resume(struct device *dev)
  384. {
  385. struct acpi_device *device = to_acpi_device(dev);
  386. struct acpi_button *button = acpi_driver_data(device);
  387. button->suspended = false;
  388. if (button->type == ACPI_BUTTON_TYPE_LID && button->input->users)
  389. acpi_lid_initialize_state(device);
  390. return 0;
  391. }
  392. #endif
  393. static int acpi_lid_input_open(struct input_dev *input)
  394. {
  395. struct acpi_device *device = input_get_drvdata(input);
  396. struct acpi_button *button = acpi_driver_data(device);
  397. button->last_state = !!acpi_lid_evaluate_state(device);
  398. button->last_time = ktime_get();
  399. acpi_lid_initialize_state(device);
  400. return 0;
  401. }
  402. static int acpi_button_add(struct acpi_device *device)
  403. {
  404. struct acpi_button *button;
  405. struct input_dev *input;
  406. const char *hid = acpi_device_hid(device);
  407. char *name, *class;
  408. int error;
  409. button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL);
  410. if (!button)
  411. return -ENOMEM;
  412. device->driver_data = button;
  413. button->input = input = input_allocate_device();
  414. if (!input) {
  415. error = -ENOMEM;
  416. goto err_free_button;
  417. }
  418. name = acpi_device_name(device);
  419. class = acpi_device_class(device);
  420. if (!strcmp(hid, ACPI_BUTTON_HID_POWER) ||
  421. !strcmp(hid, ACPI_BUTTON_HID_POWERF)) {
  422. button->type = ACPI_BUTTON_TYPE_POWER;
  423. strcpy(name, ACPI_BUTTON_DEVICE_NAME_POWER);
  424. sprintf(class, "%s/%s",
  425. ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
  426. } else if (!strcmp(hid, ACPI_BUTTON_HID_SLEEP) ||
  427. !strcmp(hid, ACPI_BUTTON_HID_SLEEPF)) {
  428. button->type = ACPI_BUTTON_TYPE_SLEEP;
  429. strcpy(name, ACPI_BUTTON_DEVICE_NAME_SLEEP);
  430. sprintf(class, "%s/%s",
  431. ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
  432. } else if (!strcmp(hid, ACPI_BUTTON_HID_LID)) {
  433. button->type = ACPI_BUTTON_TYPE_LID;
  434. strcpy(name, ACPI_BUTTON_DEVICE_NAME_LID);
  435. sprintf(class, "%s/%s",
  436. ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
  437. input->open = acpi_lid_input_open;
  438. } else {
  439. printk(KERN_ERR PREFIX "Unsupported hid [%s]\n", hid);
  440. error = -ENODEV;
  441. goto err_free_input;
  442. }
  443. error = acpi_button_add_fs(device);
  444. if (error)
  445. goto err_free_input;
  446. snprintf(button->phys, sizeof(button->phys), "%s/button/input0", hid);
  447. input->name = name;
  448. input->phys = button->phys;
  449. input->id.bustype = BUS_HOST;
  450. input->id.product = button->type;
  451. input->dev.parent = &device->dev;
  452. switch (button->type) {
  453. case ACPI_BUTTON_TYPE_POWER:
  454. input_set_capability(input, EV_KEY, KEY_POWER);
  455. break;
  456. case ACPI_BUTTON_TYPE_SLEEP:
  457. input_set_capability(input, EV_KEY, KEY_SLEEP);
  458. break;
  459. case ACPI_BUTTON_TYPE_LID:
  460. input_set_capability(input, EV_SW, SW_LID);
  461. break;
  462. }
  463. input_set_drvdata(input, device);
  464. error = input_register_device(input);
  465. if (error)
  466. goto err_remove_fs;
  467. if (button->type == ACPI_BUTTON_TYPE_LID) {
  468. /*
  469. * This assumes there's only one lid device, or if there are
  470. * more we only care about the last one...
  471. */
  472. lid_device = device;
  473. }
  474. device_init_wakeup(&device->dev, true);
  475. printk(KERN_INFO PREFIX "%s [%s]\n", name, acpi_device_bid(device));
  476. return 0;
  477. err_remove_fs:
  478. acpi_button_remove_fs(device);
  479. err_free_input:
  480. input_free_device(input);
  481. err_free_button:
  482. kfree(button);
  483. return error;
  484. }
  485. static int acpi_button_remove(struct acpi_device *device)
  486. {
  487. struct acpi_button *button = acpi_driver_data(device);
  488. acpi_button_remove_fs(device);
  489. input_unregister_device(button->input);
  490. kfree(button);
  491. return 0;
  492. }
  493. static int param_set_lid_init_state(const char *val,
  494. const struct kernel_param *kp)
  495. {
  496. int result = 0;
  497. if (!strncmp(val, "open", sizeof("open") - 1)) {
  498. lid_init_state = ACPI_BUTTON_LID_INIT_OPEN;
  499. pr_info("Notify initial lid state as open\n");
  500. } else if (!strncmp(val, "method", sizeof("method") - 1)) {
  501. lid_init_state = ACPI_BUTTON_LID_INIT_METHOD;
  502. pr_info("Notify initial lid state with _LID return value\n");
  503. } else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) {
  504. lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE;
  505. pr_info("Do not notify initial lid state\n");
  506. } else
  507. result = -EINVAL;
  508. return result;
  509. }
  510. static int param_get_lid_init_state(char *buffer,
  511. const struct kernel_param *kp)
  512. {
  513. switch (lid_init_state) {
  514. case ACPI_BUTTON_LID_INIT_OPEN:
  515. return sprintf(buffer, "open");
  516. case ACPI_BUTTON_LID_INIT_METHOD:
  517. return sprintf(buffer, "method");
  518. case ACPI_BUTTON_LID_INIT_IGNORE:
  519. return sprintf(buffer, "ignore");
  520. default:
  521. return sprintf(buffer, "invalid");
  522. }
  523. return 0;
  524. }
  525. module_param_call(lid_init_state,
  526. param_set_lid_init_state, param_get_lid_init_state,
  527. NULL, 0644);
  528. MODULE_PARM_DESC(lid_init_state, "Behavior for reporting LID initial state");
  529. module_acpi_driver(acpi_button_driver);