2 * ec.c - ACPI Embedded Controller Driver (v2.0)
4 * Copyright (C) 2006, 2007 Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
5 * Copyright (C) 2006 Denis Sadykov <denis.m.sadykov@intel.com>
6 * Copyright (C) 2004 Luming Yu <luming.yu@intel.com>
7 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
8 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
10 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or (at
15 * your option) any later version.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29 #include <linux/kernel.h>
30 #include <linux/module.h>
31 #include <linux/init.h>
32 #include <linux/types.h>
33 #include <linux/delay.h>
34 #include <linux/proc_fs.h>
35 #include <linux/seq_file.h>
36 #include <linux/interrupt.h>
37 #include <linux/list.h>
39 #include <acpi/acpi_bus.h>
40 #include <acpi/acpi_drivers.h>
41 #include <acpi/actypes.h>
43 #define ACPI_EC_CLASS "embedded_controller"
44 #define ACPI_EC_DEVICE_NAME "Embedded Controller"
45 #define ACPI_EC_FILE_INFO "info"
48 #define PREFIX "ACPI: EC: "
50 /* EC status register */
51 #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */
52 #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */
53 #define ACPI_EC_FLAG_BURST 0x10 /* burst mode */
54 #define ACPI_EC_FLAG_SCI 0x20 /* EC-SCI occurred */
58 ACPI_EC_COMMAND_READ = 0x80,
59 ACPI_EC_COMMAND_WRITE = 0x81,
60 ACPI_EC_BURST_ENABLE = 0x82,
61 ACPI_EC_BURST_DISABLE = 0x83,
62 ACPI_EC_COMMAND_QUERY = 0x84,
67 ACPI_EC_EVENT_OBF_1 = 1, /* Output buffer full */
68 ACPI_EC_EVENT_IBF_0, /* Input buffer empty */
71 #define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */
72 #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
75 EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */
76 EC_FLAGS_QUERY_PENDING, /* Query is pending */
77 EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */
78 EC_FLAGS_ONLY_IBF_GPE, /* Expect GPE only for IBF = 0 event */
81 static int acpi_ec_remove(struct acpi_device *device, int type);
82 static int acpi_ec_start(struct acpi_device *device);
83 static int acpi_ec_stop(struct acpi_device *device, int type);
84 static int acpi_ec_add(struct acpi_device *device);
86 static const struct acpi_device_id ec_device_ids[] = {
91 static struct acpi_driver acpi_ec_driver = {
93 .class = ACPI_EC_CLASS,
97 .remove = acpi_ec_remove,
98 .start = acpi_ec_start,
103 /* If we find an EC via the ECDT, we need to keep a ptr to its context */
104 /* External interfaces use first EC only, so remember */
105 typedef int (*acpi_ec_query_func) (void *data);
107 struct acpi_ec_query_handler {
108 struct list_head node;
109 acpi_ec_query_func func;
115 static struct acpi_ec {
118 unsigned long command_addr;
119 unsigned long data_addr;
120 unsigned long global_lock;
123 wait_queue_head_t wait;
124 struct list_head list;
125 u8 handlers_installed;
126 } *boot_ec, *first_ec;
128 /* --------------------------------------------------------------------------
129 Transaction Management
130 -------------------------------------------------------------------------- */
132 static inline u8 acpi_ec_read_status(struct acpi_ec *ec)
134 return inb(ec->command_addr);
137 static inline u8 acpi_ec_read_data(struct acpi_ec *ec)
139 return inb(ec->data_addr);
142 static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command)
144 outb(command, ec->command_addr);
147 static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
149 outb(data, ec->data_addr);
152 static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event)
154 if (test_bit(EC_FLAGS_WAIT_GPE, &ec->flags))
156 if (event == ACPI_EC_EVENT_OBF_1) {
157 if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_OBF)
159 } else if (event == ACPI_EC_EVENT_IBF_0) {
160 if (!(acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF))
167 static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll)
169 if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) &&
170 likely(!force_poll)) {
171 if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event),
172 msecs_to_jiffies(ACPI_EC_DELAY)))
174 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
175 if (acpi_ec_check_status(ec, event)) {
176 if (event == ACPI_EC_EVENT_OBF_1)
177 /* miss OBF = 1 GPE, don't expect it anymore */
178 set_bit(EC_FLAGS_ONLY_IBF_GPE, &ec->flags);
180 /* missing GPEs, switch back to poll mode */
181 clear_bit(EC_FLAGS_GPE_MODE, &ec->flags);
185 unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
186 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
187 while (time_before(jiffies, delay)) {
188 if (acpi_ec_check_status(ec, event))
192 printk(KERN_ERR PREFIX "acpi_ec_wait timeout,"
193 " status = %d, expect_event = %d\n",
194 acpi_ec_read_status(ec), event);
198 static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
199 const u8 * wdata, unsigned wdata_len,
200 u8 * rdata, unsigned rdata_len,
204 set_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
205 acpi_ec_write_cmd(ec, command);
207 for (; wdata_len > 0; --wdata_len) {
208 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll);
210 printk(KERN_ERR PREFIX
211 "write_cmd timeout, command = %d\n", command);
214 set_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
215 acpi_ec_write_data(ec, *(wdata++));
219 result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll);
221 printk(KERN_ERR PREFIX
222 "finish-write timeout, command = %d\n", command);
225 } else if (command == ACPI_EC_COMMAND_QUERY)
226 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
228 for (; rdata_len > 0; --rdata_len) {
229 if (test_bit(EC_FLAGS_ONLY_IBF_GPE, &ec->flags))
231 result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll);
233 printk(KERN_ERR PREFIX "read timeout, command = %d\n",
237 /* Don't expect GPE after last read */
239 set_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
240 *(rdata++) = acpi_ec_read_data(ec);
246 static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
247 const u8 * wdata, unsigned wdata_len,
248 u8 * rdata, unsigned rdata_len,
254 if (!ec || (wdata_len && !wdata) || (rdata_len && !rdata))
258 memset(rdata, 0, rdata_len);
260 mutex_lock(&ec->lock);
261 if (ec->global_lock) {
262 status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk);
263 if (ACPI_FAILURE(status)) {
264 mutex_unlock(&ec->lock);
269 status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0);
271 printk(KERN_ERR PREFIX
272 "input buffer is not empty, aborting transaction\n");
276 status = acpi_ec_transaction_unlocked(ec, command,
284 acpi_release_global_lock(glk);
285 mutex_unlock(&ec->lock);
291 * Note: samsung nv5000 doesn't work with ec burst mode.
292 * http://bugzilla.kernel.org/show_bug.cgi?id=4980
294 int acpi_ec_burst_enable(struct acpi_ec *ec)
297 return acpi_ec_transaction(ec, ACPI_EC_BURST_ENABLE, NULL, 0, &d, 1, 0);
300 int acpi_ec_burst_disable(struct acpi_ec *ec)
302 return acpi_ec_transaction(ec, ACPI_EC_BURST_DISABLE, NULL, 0, NULL, 0, 0);
305 static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data)
310 result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_READ,
311 &address, 1, &d, 1, 0);
316 static int acpi_ec_write(struct acpi_ec *ec, u8 address, u8 data)
318 u8 wdata[2] = { address, data };
319 return acpi_ec_transaction(ec, ACPI_EC_COMMAND_WRITE,
320 wdata, 2, NULL, 0, 0);
324 * Externally callable EC access functions. For now, assume 1 EC only
326 int ec_burst_enable(void)
330 return acpi_ec_burst_enable(first_ec);
333 EXPORT_SYMBOL(ec_burst_enable);
335 int ec_burst_disable(void)
339 return acpi_ec_burst_disable(first_ec);
342 EXPORT_SYMBOL(ec_burst_disable);
344 int ec_read(u8 addr, u8 * val)
352 err = acpi_ec_read(first_ec, addr, &temp_data);
361 EXPORT_SYMBOL(ec_read);
363 int ec_write(u8 addr, u8 val)
370 err = acpi_ec_write(first_ec, addr, val);
375 EXPORT_SYMBOL(ec_write);
377 int ec_transaction(u8 command,
378 const u8 * wdata, unsigned wdata_len,
379 u8 * rdata, unsigned rdata_len,
385 return acpi_ec_transaction(first_ec, command, wdata,
386 wdata_len, rdata, rdata_len,
390 EXPORT_SYMBOL(ec_transaction);
392 static int acpi_ec_query(struct acpi_ec *ec, u8 * data)
401 * Query the EC to find out which _Qxx method we need to evaluate.
402 * Note that successful completion of the query causes the ACPI_EC_SCI
403 * bit to be cleared (and thus clearing the interrupt source).
406 result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_QUERY, NULL, 0, &d, 1, 0);
417 /* --------------------------------------------------------------------------
419 -------------------------------------------------------------------------- */
420 int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
421 acpi_handle handle, acpi_ec_query_func func,
424 struct acpi_ec_query_handler *handler =
425 kzalloc(sizeof(struct acpi_ec_query_handler), GFP_KERNEL);
429 handler->query_bit = query_bit;
430 handler->handle = handle;
431 handler->func = func;
432 handler->data = data;
433 mutex_lock(&ec->lock);
434 list_add(&handler->node, &ec->list);
435 mutex_unlock(&ec->lock);
439 EXPORT_SYMBOL_GPL(acpi_ec_add_query_handler);
441 void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit)
443 struct acpi_ec_query_handler *handler;
444 mutex_lock(&ec->lock);
445 list_for_each_entry(handler, &ec->list, node) {
446 if (query_bit == handler->query_bit) {
447 list_del(&handler->node);
451 mutex_unlock(&ec->lock);
454 EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler);
456 static void acpi_ec_gpe_query(void *ec_cxt)
458 struct acpi_ec *ec = ec_cxt;
460 struct acpi_ec_query_handler *handler, copy;
462 if (!ec || acpi_ec_query(ec, &value))
464 mutex_lock(&ec->lock);
465 list_for_each_entry(handler, &ec->list, node) {
466 if (value == handler->query_bit) {
467 /* have custom handler for this bit */
468 memcpy(©, handler, sizeof(copy));
469 mutex_unlock(&ec->lock);
471 copy.func(copy.data);
472 } else if (copy.handle) {
473 acpi_evaluate_object(copy.handle, NULL, NULL, NULL);
478 mutex_unlock(&ec->lock);
481 static u32 acpi_ec_gpe_handler(void *data)
483 acpi_status status = AE_OK;
484 struct acpi_ec *ec = data;
486 clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags);
487 if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))
490 if (acpi_ec_read_status(ec) & ACPI_EC_FLAG_SCI) {
491 if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags))
492 status = acpi_os_execute(OSL_EC_BURST_HANDLER,
493 acpi_ec_gpe_query, ec);
494 } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags)))
495 set_bit(EC_FLAGS_GPE_MODE, &ec->flags);
497 return ACPI_SUCCESS(status) ?
498 ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED;
501 /* --------------------------------------------------------------------------
502 Address Space Management
503 -------------------------------------------------------------------------- */
506 acpi_ec_space_setup(acpi_handle region_handle,
507 u32 function, void *handler_context, void **return_context)
510 * The EC object is in the handler context and is needed
511 * when calling the acpi_ec_space_handler.
513 *return_context = (function != ACPI_REGION_DEACTIVATE) ?
514 handler_context : NULL;
520 acpi_ec_space_handler(u32 function, acpi_physical_address address,
521 u32 bits, acpi_integer *value,
522 void *handler_context, void *region_context)
524 struct acpi_ec *ec = handler_context;
525 int result = 0, i = 0;
528 if ((address > 0xFF) || !value || !handler_context)
529 return AE_BAD_PARAMETER;
531 if (function != ACPI_READ && function != ACPI_WRITE)
532 return AE_BAD_PARAMETER;
534 if (bits != 8 && acpi_strict)
535 return AE_BAD_PARAMETER;
537 while (bits - i > 0) {
538 if (function == ACPI_READ) {
539 result = acpi_ec_read(ec, address, &temp);
540 (*value) |= ((acpi_integer)temp) << i;
542 temp = 0xff & ((*value) >> i);
543 result = acpi_ec_write(ec, address, temp);
551 return AE_BAD_PARAMETER;
564 /* --------------------------------------------------------------------------
566 -------------------------------------------------------------------------- */
568 static struct proc_dir_entry *acpi_ec_dir;
570 static int acpi_ec_read_info(struct seq_file *seq, void *offset)
572 struct acpi_ec *ec = seq->private;
577 seq_printf(seq, "gpe:\t\t\t0x%02x\n", (u32) ec->gpe);
578 seq_printf(seq, "ports:\t\t\t0x%02x, 0x%02x\n",
579 (unsigned)ec->command_addr, (unsigned)ec->data_addr);
580 seq_printf(seq, "use global lock:\t%s\n",
581 ec->global_lock ? "yes" : "no");
586 static int acpi_ec_info_open_fs(struct inode *inode, struct file *file)
588 return single_open(file, acpi_ec_read_info, PDE(inode)->data);
591 static struct file_operations acpi_ec_info_ops = {
592 .open = acpi_ec_info_open_fs,
595 .release = single_release,
596 .owner = THIS_MODULE,
599 static int acpi_ec_add_fs(struct acpi_device *device)
601 struct proc_dir_entry *entry = NULL;
603 if (!acpi_device_dir(device)) {
604 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
606 if (!acpi_device_dir(device))
610 entry = create_proc_entry(ACPI_EC_FILE_INFO, S_IRUGO,
611 acpi_device_dir(device));
615 entry->proc_fops = &acpi_ec_info_ops;
616 entry->data = acpi_driver_data(device);
617 entry->owner = THIS_MODULE;
623 static int acpi_ec_remove_fs(struct acpi_device *device)
626 if (acpi_device_dir(device)) {
627 remove_proc_entry(ACPI_EC_FILE_INFO, acpi_device_dir(device));
628 remove_proc_entry(acpi_device_bid(device), acpi_ec_dir);
629 acpi_device_dir(device) = NULL;
635 /* --------------------------------------------------------------------------
637 -------------------------------------------------------------------------- */
639 ec_parse_io_ports(struct acpi_resource *resource, void *context);
641 static struct acpi_ec *make_acpi_ec(void)
643 struct acpi_ec *ec = kzalloc(sizeof(struct acpi_ec), GFP_KERNEL);
646 ec->flags = 1 << EC_FLAGS_QUERY_PENDING;
647 mutex_init(&ec->lock);
648 init_waitqueue_head(&ec->wait);
649 INIT_LIST_HEAD(&ec->list);
654 acpi_ec_register_query_methods(acpi_handle handle, u32 level,
655 void *context, void **return_value)
657 struct acpi_namespace_node *node = handle;
658 struct acpi_ec *ec = context;
660 if (sscanf(node->name.ascii, "_Q%x", &value) == 1) {
661 acpi_ec_add_query_handler(ec, value, handle, NULL, NULL);
667 ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
671 struct acpi_ec *ec = context;
672 status = acpi_walk_resources(handle, METHOD_NAME__CRS,
673 ec_parse_io_ports, ec);
674 if (ACPI_FAILURE(status))
677 /* Get GPE bit assignment (EC events). */
678 /* TODO: Add support for _GPE returning a package */
679 status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe);
680 if (ACPI_FAILURE(status))
682 /* Find and register all query methods */
683 acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1,
684 acpi_ec_register_query_methods, ec, NULL);
685 /* Use the global lock for all EC transactions? */
686 acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock);
688 return AE_CTRL_TERMINATE;
691 static void ec_remove_handlers(struct acpi_ec *ec)
693 if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle,
694 ACPI_ADR_SPACE_EC, &acpi_ec_space_handler)))
695 printk(KERN_ERR PREFIX "failed to remove space handler\n");
696 if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe,
697 &acpi_ec_gpe_handler)))
698 printk(KERN_ERR PREFIX "failed to remove gpe handler\n");
699 ec->handlers_installed = 0;
702 static int acpi_ec_add(struct acpi_device *device)
704 struct acpi_ec *ec = NULL;
708 strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
709 strcpy(acpi_device_class(device), ACPI_EC_CLASS);
711 /* Check for boot EC */
713 if (boot_ec->handle == device->handle) {
714 /* Pre-loaded EC from DSDT, just move pointer */
718 } else if (boot_ec->handle == ACPI_ROOT_OBJECT) {
719 /* ECDT-based EC, time to shut it down */
720 ec_remove_handlers(boot_ec);
722 first_ec = boot_ec = NULL;
730 if (ec_parse_device(device->handle, 0, ec, NULL) !=
735 ec->handle = device->handle;
739 acpi_driver_data(device) = ec;
740 acpi_ec_add_fs(device);
741 printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n",
742 ec->gpe, ec->command_addr, ec->data_addr);
746 static int acpi_ec_remove(struct acpi_device *device, int type)
749 struct acpi_ec_query_handler *handler, *tmp;
754 ec = acpi_driver_data(device);
755 mutex_lock(&ec->lock);
756 list_for_each_entry_safe(handler, tmp, &ec->list, node) {
757 list_del(&handler->node);
760 mutex_unlock(&ec->lock);
761 acpi_ec_remove_fs(device);
762 acpi_driver_data(device) = NULL;
770 ec_parse_io_ports(struct acpi_resource *resource, void *context)
772 struct acpi_ec *ec = context;
774 if (resource->type != ACPI_RESOURCE_TYPE_IO)
778 * The first address region returned is the data port, and
779 * the second address region returned is the status/command
782 if (ec->data_addr == 0)
783 ec->data_addr = resource->data.io.minimum;
784 else if (ec->command_addr == 0)
785 ec->command_addr = resource->data.io.minimum;
787 return AE_CTRL_TERMINATE;
792 static int ec_install_handlers(struct acpi_ec *ec)
795 if (ec->handlers_installed)
797 status = acpi_install_gpe_handler(NULL, ec->gpe,
798 ACPI_GPE_EDGE_TRIGGERED,
799 &acpi_ec_gpe_handler, ec);
800 if (ACPI_FAILURE(status))
803 acpi_set_gpe_type(NULL, ec->gpe, ACPI_GPE_TYPE_RUNTIME);
804 acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
806 status = acpi_install_address_space_handler(ec->handle,
808 &acpi_ec_space_handler,
809 &acpi_ec_space_setup, ec);
810 if (ACPI_FAILURE(status)) {
811 acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
815 ec->handlers_installed = 1;
819 static int acpi_ec_start(struct acpi_device *device)
827 ec = acpi_driver_data(device);
832 ret = ec_install_handlers(ec);
834 /* EC is fully operational, allow queries */
835 clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
839 static int acpi_ec_stop(struct acpi_device *device, int type)
844 ec = acpi_driver_data(device);
847 ec_remove_handlers(ec);
852 int __init acpi_ec_ecdt_probe(void)
856 struct acpi_table_ecdt *ecdt_ptr;
858 boot_ec = make_acpi_ec();
862 * Generate a boot ec context
864 status = acpi_get_table(ACPI_SIG_ECDT, 1,
865 (struct acpi_table_header **)&ecdt_ptr);
866 if (ACPI_SUCCESS(status)) {
867 printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n");
868 boot_ec->command_addr = ecdt_ptr->control.address;
869 boot_ec->data_addr = ecdt_ptr->data.address;
870 boot_ec->gpe = ecdt_ptr->gpe;
871 boot_ec->handle = ACPI_ROOT_OBJECT;
873 printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
874 status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
876 /* Check that acpi_get_devices actually find something */
877 if (ACPI_FAILURE(status) || !boot_ec->handle)
881 ret = ec_install_handlers(boot_ec);
892 static int __init acpi_ec_init(void)
899 acpi_ec_dir = proc_mkdir(ACPI_EC_CLASS, acpi_root_dir);
903 /* Now register the driver for the EC */
904 result = acpi_bus_register_driver(&acpi_ec_driver);
906 remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);
913 subsys_initcall(acpi_ec_init);
915 /* EC driver currently not unloadable */
917 static void __exit acpi_ec_exit(void)
920 acpi_bus_unregister_driver(&acpi_ec_driver);
922 remove_proc_entry(ACPI_EC_CLASS, acpi_root_dir);