power.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. /*
  2. * acpi_power.c - ACPI Bus Power Management ($Revision: 39 $)
  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. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write to the Free Software Foundation, Inc.,
  21. * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  22. *
  23. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  24. */
  25. /*
  26. * ACPI power-managed devices may be controlled in two ways:
  27. * 1. via "Device Specific (D-State) Control"
  28. * 2. via "Power Resource Control".
  29. * This module is used to manage devices relying on Power Resource Control.
  30. *
  31. * An ACPI "power resource object" describes a software controllable power
  32. * plane, clock plane, or other resource used by a power managed device.
  33. * A device may rely on multiple power resources, and a power resource
  34. * may be shared by multiple devices.
  35. */
  36. #include <linux/kernel.h>
  37. #include <linux/module.h>
  38. #include <linux/init.h>
  39. #include <linux/types.h>
  40. #include <linux/proc_fs.h>
  41. #include <linux/seq_file.h>
  42. #include <acpi/acpi_bus.h>
  43. #include <acpi/acpi_drivers.h>
  44. #define _COMPONENT ACPI_POWER_COMPONENT
  45. ACPI_MODULE_NAME ("acpi_power")
  46. #define ACPI_POWER_COMPONENT 0x00800000
  47. #define ACPI_POWER_CLASS "power_resource"
  48. #define ACPI_POWER_DRIVER_NAME "ACPI Power Resource Driver"
  49. #define ACPI_POWER_DEVICE_NAME "Power Resource"
  50. #define ACPI_POWER_FILE_INFO "info"
  51. #define ACPI_POWER_FILE_STATUS "state"
  52. #define ACPI_POWER_RESOURCE_STATE_OFF 0x00
  53. #define ACPI_POWER_RESOURCE_STATE_ON 0x01
  54. #define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF
  55. static int acpi_power_add (struct acpi_device *device);
  56. static int acpi_power_remove (struct acpi_device *device, int type);
  57. static int acpi_power_open_fs(struct inode *inode, struct file *file);
  58. static struct acpi_driver acpi_power_driver = {
  59. .name = ACPI_POWER_DRIVER_NAME,
  60. .class = ACPI_POWER_CLASS,
  61. .ids = ACPI_POWER_HID,
  62. .ops = {
  63. .add = acpi_power_add,
  64. .remove = acpi_power_remove,
  65. },
  66. };
  67. struct acpi_power_resource
  68. {
  69. acpi_handle handle;
  70. acpi_bus_id name;
  71. u32 system_level;
  72. u32 order;
  73. int state;
  74. int references;
  75. };
  76. static struct list_head acpi_power_resource_list;
  77. static struct file_operations acpi_power_fops = {
  78. .open = acpi_power_open_fs,
  79. .read = seq_read,
  80. .llseek = seq_lseek,
  81. .release = single_release,
  82. };
  83. /* --------------------------------------------------------------------------
  84. Power Resource Management
  85. -------------------------------------------------------------------------- */
  86. static int
  87. acpi_power_get_context (
  88. acpi_handle handle,
  89. struct acpi_power_resource **resource)
  90. {
  91. int result = 0;
  92. struct acpi_device *device = NULL;
  93. ACPI_FUNCTION_TRACE("acpi_power_get_context");
  94. if (!resource)
  95. return_VALUE(-ENODEV);
  96. result = acpi_bus_get_device(handle, &device);
  97. if (result) {
  98. ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error getting context [%p]\n",
  99. handle));
  100. return_VALUE(result);
  101. }
  102. *resource = (struct acpi_power_resource *) acpi_driver_data(device);
  103. if (!resource)
  104. return_VALUE(-ENODEV);
  105. return_VALUE(0);
  106. }
  107. static int
  108. acpi_power_get_state (
  109. struct acpi_power_resource *resource)
  110. {
  111. acpi_status status = AE_OK;
  112. unsigned long sta = 0;
  113. ACPI_FUNCTION_TRACE("acpi_power_get_state");
  114. if (!resource)
  115. return_VALUE(-EINVAL);
  116. status = acpi_evaluate_integer(resource->handle, "_STA", NULL, &sta);
  117. if (ACPI_FAILURE(status))
  118. return_VALUE(-ENODEV);
  119. if (sta & 0x01)
  120. resource->state = ACPI_POWER_RESOURCE_STATE_ON;
  121. else
  122. resource->state = ACPI_POWER_RESOURCE_STATE_OFF;
  123. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n",
  124. resource->name, resource->state?"on":"off"));
  125. return_VALUE(0);
  126. }
  127. static int
  128. acpi_power_get_list_state (
  129. struct acpi_handle_list *list,
  130. int *state)
  131. {
  132. int result = 0;
  133. struct acpi_power_resource *resource = NULL;
  134. u32 i = 0;
  135. ACPI_FUNCTION_TRACE("acpi_power_get_list_state");
  136. if (!list || !state)
  137. return_VALUE(-EINVAL);
  138. /* The state of the list is 'on' IFF all resources are 'on'. */
  139. for (i=0; i<list->count; i++) {
  140. result = acpi_power_get_context(list->handles[i], &resource);
  141. if (result)
  142. return_VALUE(result);
  143. result = acpi_power_get_state(resource);
  144. if (result)
  145. return_VALUE(result);
  146. *state = resource->state;
  147. if (*state != ACPI_POWER_RESOURCE_STATE_ON)
  148. break;
  149. }
  150. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource list is %s\n",
  151. *state?"on":"off"));
  152. return_VALUE(result);
  153. }
  154. static int
  155. acpi_power_on (
  156. acpi_handle handle)
  157. {
  158. int result = 0;
  159. acpi_status status = AE_OK;
  160. struct acpi_device *device = NULL;
  161. struct acpi_power_resource *resource = NULL;
  162. ACPI_FUNCTION_TRACE("acpi_power_on");
  163. result = acpi_power_get_context(handle, &resource);
  164. if (result)
  165. return_VALUE(result);
  166. resource->references++;
  167. if ((resource->references > 1)
  168. || (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) {
  169. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n",
  170. resource->name));
  171. return_VALUE(0);
  172. }
  173. status = acpi_evaluate_object(resource->handle, "_ON", NULL, NULL);
  174. if (ACPI_FAILURE(status))
  175. return_VALUE(-ENODEV);
  176. result = acpi_power_get_state(resource);
  177. if (result)
  178. return_VALUE(result);
  179. if (resource->state != ACPI_POWER_RESOURCE_STATE_ON)
  180. return_VALUE(-ENOEXEC);
  181. /* Update the power resource's _device_ power state */
  182. result = acpi_bus_get_device(resource->handle, &device);
  183. if (result)
  184. return_VALUE(result);
  185. device->power.state = ACPI_STATE_D0;
  186. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n",
  187. resource->name));
  188. return_VALUE(0);
  189. }
  190. static int
  191. acpi_power_off_device (
  192. acpi_handle handle)
  193. {
  194. int result = 0;
  195. acpi_status status = AE_OK;
  196. struct acpi_device *device = NULL;
  197. struct acpi_power_resource *resource = NULL;
  198. ACPI_FUNCTION_TRACE("acpi_power_off_device");
  199. result = acpi_power_get_context(handle, &resource);
  200. if (result)
  201. return_VALUE(result);
  202. if (resource->references)
  203. resource->references--;
  204. if (resource->references) {
  205. ACPI_DEBUG_PRINT((ACPI_DB_INFO,
  206. "Resource [%s] is still in use, dereferencing\n",
  207. device->pnp.bus_id));
  208. return_VALUE(0);
  209. }
  210. if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) {
  211. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n",
  212. device->pnp.bus_id));
  213. return_VALUE(0);
  214. }
  215. status = acpi_evaluate_object(resource->handle, "_OFF", NULL, NULL);
  216. if (ACPI_FAILURE(status))
  217. return_VALUE(-ENODEV);
  218. result = acpi_power_get_state(resource);
  219. if (result)
  220. return_VALUE(result);
  221. if (resource->state != ACPI_POWER_RESOURCE_STATE_OFF)
  222. return_VALUE(-ENOEXEC);
  223. /* Update the power resource's _device_ power state */
  224. result = acpi_bus_get_device(resource->handle, &device);
  225. if (result)
  226. return_VALUE(result);
  227. device->power.state = ACPI_STATE_D3;
  228. ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n",
  229. resource->name));
  230. return_VALUE(0);
  231. }
  232. /*
  233. * Prepare a wakeup device, two steps (Ref ACPI 2.0:P229):
  234. * 1. Power on the power resources required for the wakeup device
  235. * 2. Enable _PSW (power state wake) for the device if present
  236. */
  237. int acpi_enable_wakeup_device_power (struct acpi_device *dev)
  238. {
  239. union acpi_object arg = {ACPI_TYPE_INTEGER};
  240. struct acpi_object_list arg_list = {1, &arg};
  241. acpi_status status = AE_OK;
  242. int i;
  243. int ret = 0;
  244. ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device_power");
  245. if (!dev || !dev->wakeup.flags.valid)
  246. return_VALUE(-1);
  247. arg.integer.value = 1;
  248. /* Open power resource */
  249. for (i = 0; i < dev->wakeup.resources.count; i++) {
  250. ret = acpi_power_on(dev->wakeup.resources.handles[i]);
  251. if (ret) {
  252. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  253. "Error transition power state\n"));
  254. dev->wakeup.flags.valid = 0;
  255. return_VALUE(-1);
  256. }
  257. }
  258. /* Execute PSW */
  259. status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL);
  260. if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
  261. ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluate _PSW\n"));
  262. dev->wakeup.flags.valid = 0;
  263. ret = -1;
  264. }
  265. return_VALUE(ret);
  266. }
  267. /*
  268. * Shutdown a wakeup device, counterpart of above method
  269. * 1. Disable _PSW (power state wake)
  270. * 2. Shutdown down the power resources
  271. */
  272. int acpi_disable_wakeup_device_power (struct acpi_device *dev)
  273. {
  274. union acpi_object arg = {ACPI_TYPE_INTEGER};
  275. struct acpi_object_list arg_list = {1, &arg};
  276. acpi_status status = AE_OK;
  277. int i;
  278. int ret = 0;
  279. ACPI_FUNCTION_TRACE("acpi_disable_wakeup_device_power");
  280. if (!dev || !dev->wakeup.flags.valid)
  281. return_VALUE(-1);
  282. arg.integer.value = 0;
  283. /* Execute PSW */
  284. status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL);
  285. if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
  286. ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluate _PSW\n"));
  287. dev->wakeup.flags.valid = 0;
  288. return_VALUE(-1);
  289. }
  290. /* Close power resource */
  291. for (i = 0; i < dev->wakeup.resources.count; i++) {
  292. ret = acpi_power_off_device(dev->wakeup.resources.handles[i]);
  293. if (ret) {
  294. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  295. "Error transition power state\n"));
  296. dev->wakeup.flags.valid = 0;
  297. return_VALUE(-1);
  298. }
  299. }
  300. return_VALUE(ret);
  301. }
  302. /* --------------------------------------------------------------------------
  303. Device Power Management
  304. -------------------------------------------------------------------------- */
  305. int
  306. acpi_power_get_inferred_state (
  307. struct acpi_device *device)
  308. {
  309. int result = 0;
  310. struct acpi_handle_list *list = NULL;
  311. int list_state = 0;
  312. int i = 0;
  313. ACPI_FUNCTION_TRACE("acpi_power_get_inferred_state");
  314. if (!device)
  315. return_VALUE(-EINVAL);
  316. device->power.state = ACPI_STATE_UNKNOWN;
  317. /*
  318. * We know a device's inferred power state when all the resources
  319. * required for a given D-state are 'on'.
  320. */
  321. for (i=ACPI_STATE_D0; i<ACPI_STATE_D3; i++) {
  322. list = &device->power.states[i].resources;
  323. if (list->count < 1)
  324. continue;
  325. result = acpi_power_get_list_state(list, &list_state);
  326. if (result)
  327. return_VALUE(result);
  328. if (list_state == ACPI_POWER_RESOURCE_STATE_ON) {
  329. device->power.state = i;
  330. return_VALUE(0);
  331. }
  332. }
  333. device->power.state = ACPI_STATE_D3;
  334. return_VALUE(0);
  335. }
  336. int
  337. acpi_power_transition (
  338. struct acpi_device *device,
  339. int state)
  340. {
  341. int result = 0;
  342. struct acpi_handle_list *cl = NULL; /* Current Resources */
  343. struct acpi_handle_list *tl = NULL; /* Target Resources */
  344. int i = 0;
  345. ACPI_FUNCTION_TRACE("acpi_power_transition");
  346. if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3))
  347. return_VALUE(-EINVAL);
  348. if ((device->power.state < ACPI_STATE_D0) || (device->power.state > ACPI_STATE_D3))
  349. return_VALUE(-ENODEV);
  350. cl = &device->power.states[device->power.state].resources;
  351. tl = &device->power.states[state].resources;
  352. device->power.state = ACPI_STATE_UNKNOWN;
  353. if (!cl->count && !tl->count) {
  354. result = -ENODEV;
  355. goto end;
  356. }
  357. /* TBD: Resources must be ordered. */
  358. /*
  359. * First we reference all power resources required in the target list
  360. * (e.g. so the device doesn't lose power while transitioning).
  361. */
  362. for (i=0; i<tl->count; i++) {
  363. result = acpi_power_on(tl->handles[i]);
  364. if (result)
  365. goto end;
  366. }
  367. /*
  368. * Then we dereference all power resources used in the current list.
  369. */
  370. for (i=0; i<cl->count; i++) {
  371. result = acpi_power_off_device(cl->handles[i]);
  372. if (result)
  373. goto end;
  374. }
  375. /* We shouldn't change the state till all above operations succeed */
  376. device->power.state = state;
  377. end:
  378. if (result)
  379. ACPI_DEBUG_PRINT((ACPI_DB_WARN,
  380. "Error transitioning device [%s] to D%d\n",
  381. device->pnp.bus_id, state));
  382. return_VALUE(result);
  383. }
  384. /* --------------------------------------------------------------------------
  385. FS Interface (/proc)
  386. -------------------------------------------------------------------------- */
  387. static struct proc_dir_entry *acpi_power_dir;
  388. static int acpi_power_seq_show(struct seq_file *seq, void *offset)
  389. {
  390. struct acpi_power_resource *resource = NULL;
  391. ACPI_FUNCTION_TRACE("acpi_power_seq_show");
  392. resource = (struct acpi_power_resource *)seq->private;
  393. if (!resource)
  394. goto end;
  395. seq_puts(seq, "state: ");
  396. switch (resource->state) {
  397. case ACPI_POWER_RESOURCE_STATE_ON:
  398. seq_puts(seq, "on\n");
  399. break;
  400. case ACPI_POWER_RESOURCE_STATE_OFF:
  401. seq_puts(seq, "off\n");
  402. break;
  403. default:
  404. seq_puts(seq, "unknown\n");
  405. break;
  406. }
  407. seq_printf(seq, "system level: S%d\n"
  408. "order: %d\n"
  409. "reference count: %d\n",
  410. resource->system_level,
  411. resource->order,
  412. resource->references);
  413. end:
  414. return_VALUE(0);
  415. }
  416. static int acpi_power_open_fs(struct inode *inode, struct file *file)
  417. {
  418. return single_open(file, acpi_power_seq_show, PDE(inode)->data);
  419. }
  420. static int
  421. acpi_power_add_fs (
  422. struct acpi_device *device)
  423. {
  424. struct proc_dir_entry *entry = NULL;
  425. ACPI_FUNCTION_TRACE("acpi_power_add_fs");
  426. if (!device)
  427. return_VALUE(-EINVAL);
  428. if (!acpi_device_dir(device)) {
  429. acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
  430. acpi_power_dir);
  431. if (!acpi_device_dir(device))
  432. return_VALUE(-ENODEV);
  433. }
  434. /* 'status' [R] */
  435. entry = create_proc_entry(ACPI_POWER_FILE_STATUS,
  436. S_IRUGO, acpi_device_dir(device));
  437. if (!entry)
  438. ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
  439. "Unable to create '%s' fs entry\n",
  440. ACPI_POWER_FILE_STATUS));
  441. else {
  442. entry->proc_fops = &acpi_power_fops;
  443. entry->data = acpi_driver_data(device);
  444. }
  445. return_VALUE(0);
  446. }
  447. static int
  448. acpi_power_remove_fs (
  449. struct acpi_device *device)
  450. {
  451. ACPI_FUNCTION_TRACE("acpi_power_remove_fs");
  452. if (acpi_device_dir(device)) {
  453. remove_proc_entry(ACPI_POWER_FILE_STATUS,
  454. acpi_device_dir(device));
  455. remove_proc_entry(acpi_device_bid(device), acpi_power_dir);
  456. acpi_device_dir(device) = NULL;
  457. }
  458. return_VALUE(0);
  459. }
  460. /* --------------------------------------------------------------------------
  461. Driver Interface
  462. -------------------------------------------------------------------------- */
  463. static int
  464. acpi_power_add (
  465. struct acpi_device *device)
  466. {
  467. int result = 0;
  468. acpi_status status = AE_OK;
  469. struct acpi_power_resource *resource = NULL;
  470. union acpi_object acpi_object;
  471. struct acpi_buffer buffer = {sizeof(acpi_object), &acpi_object};
  472. ACPI_FUNCTION_TRACE("acpi_power_add");
  473. if (!device)
  474. return_VALUE(-EINVAL);
  475. resource = kmalloc(sizeof(struct acpi_power_resource), GFP_KERNEL);
  476. if (!resource)
  477. return_VALUE(-ENOMEM);
  478. memset(resource, 0, sizeof(struct acpi_power_resource));
  479. resource->handle = device->handle;
  480. strcpy(resource->name, device->pnp.bus_id);
  481. strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
  482. strcpy(acpi_device_class(device), ACPI_POWER_CLASS);
  483. acpi_driver_data(device) = resource;
  484. /* Evalute the object to get the system level and resource order. */
  485. status = acpi_evaluate_object(resource->handle, NULL, NULL, &buffer);
  486. if (ACPI_FAILURE(status)) {
  487. result = -ENODEV;
  488. goto end;
  489. }
  490. resource->system_level = acpi_object.power_resource.system_level;
  491. resource->order = acpi_object.power_resource.resource_order;
  492. result = acpi_power_get_state(resource);
  493. if (result)
  494. goto end;
  495. switch (resource->state) {
  496. case ACPI_POWER_RESOURCE_STATE_ON:
  497. device->power.state = ACPI_STATE_D0;
  498. break;
  499. case ACPI_POWER_RESOURCE_STATE_OFF:
  500. device->power.state = ACPI_STATE_D3;
  501. break;
  502. default:
  503. device->power.state = ACPI_STATE_UNKNOWN;
  504. break;
  505. }
  506. result = acpi_power_add_fs(device);
  507. if (result)
  508. goto end;
  509. printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device),
  510. acpi_device_bid(device), resource->state?"on":"off");
  511. end:
  512. if (result)
  513. kfree(resource);
  514. return_VALUE(result);
  515. }
  516. static int
  517. acpi_power_remove (
  518. struct acpi_device *device,
  519. int type)
  520. {
  521. struct acpi_power_resource *resource = NULL;
  522. ACPI_FUNCTION_TRACE("acpi_power_remove");
  523. if (!device || !acpi_driver_data(device))
  524. return_VALUE(-EINVAL);
  525. resource = (struct acpi_power_resource *) acpi_driver_data(device);
  526. acpi_power_remove_fs(device);
  527. kfree(resource);
  528. return_VALUE(0);
  529. }
  530. static int __init acpi_power_init (void)
  531. {
  532. int result = 0;
  533. ACPI_FUNCTION_TRACE("acpi_power_init");
  534. if (acpi_disabled)
  535. return_VALUE(0);
  536. INIT_LIST_HEAD(&acpi_power_resource_list);
  537. acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir);
  538. if (!acpi_power_dir)
  539. return_VALUE(-ENODEV);
  540. result = acpi_bus_register_driver(&acpi_power_driver);
  541. if (result < 0) {
  542. remove_proc_entry(ACPI_POWER_CLASS, acpi_root_dir);
  543. return_VALUE(-ENODEV);
  544. }
  545. return_VALUE(0);
  546. }
  547. subsys_initcall(acpi_power_init);