aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r--drivers/acpi/ec.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index dd384ec757dd..4d7fe829a6e2 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -664,30 +664,32 @@ acpi_ec_register_query_methods(acpi_handle handle, u32 level,
664 return AE_OK; 664 return AE_OK;
665} 665}
666 666
667static int ec_parse_device(struct acpi_ec *ec, acpi_handle handle) 667static acpi_status
668ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
668{ 669{
669 if (ACPI_FAILURE(acpi_walk_resources(handle, METHOD_NAME__CRS, 670 acpi_status status;
670 ec_parse_io_ports, ec))) 671
671 return -EINVAL; 672 struct acpi_ec *ec = context;
673 status = acpi_walk_resources(handle, METHOD_NAME__CRS,
674 ec_parse_io_ports, ec);
675 if (ACPI_FAILURE(status))
676 return status;
672 677
673 /* Get GPE bit assignment (EC events). */ 678 /* Get GPE bit assignment (EC events). */
674 /* TODO: Add support for _GPE returning a package */ 679 /* TODO: Add support for _GPE returning a package */
675 if (ACPI_FAILURE(acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe))) 680 status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe);
676 return -EINVAL; 681 if (ACPI_FAILURE(status))
682 return status;
677 683
678 /* Use the global lock for all EC transactions? */ 684 /* Use the global lock for all EC transactions? */
679 acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock); 685 acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock);
680 686
681 /* Find and register all query methods */
682 acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1,
683 acpi_ec_register_query_methods, ec, NULL);
684
685 ec->handle = handle; 687 ec->handle = handle;
686 688
687 printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx", 689 printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx",
688 ec->gpe, ec->command_addr, ec->data_addr); 690 ec->gpe, ec->command_addr, ec->data_addr);
689 691
690 return 0; 692 return AE_CTRL_TERMINATE;
691} 693}
692 694
693static int acpi_ec_add(struct acpi_device *device) 695static int acpi_ec_add(struct acpi_device *device)
@@ -704,7 +706,8 @@ static int acpi_ec_add(struct acpi_device *device)
704 if (!ec) 706 if (!ec)
705 return -ENOMEM; 707 return -ENOMEM;
706 708
707 if (ec_parse_device(ec, device->handle)) { 709 if (ec_parse_device(device->handle, 0, ec, NULL) !=
710 AE_CTRL_TERMINATE) {
708 kfree(ec); 711 kfree(ec);
709 return -EINVAL; 712 return -EINVAL;
710 } 713 }
@@ -867,18 +870,21 @@ int __init acpi_ec_ecdt_probe(void)
867 /* 870 /*
868 * Generate a boot ec context 871 * Generate a boot ec context
869 */ 872 */
870
871 status = acpi_get_table(ACPI_SIG_ECDT, 1, 873 status = acpi_get_table(ACPI_SIG_ECDT, 1,
872 (struct acpi_table_header **)&ecdt_ptr); 874 (struct acpi_table_header **)&ecdt_ptr);
873 if (ACPI_FAILURE(status)) 875 if (ACPI_SUCCESS(status)) {
874 goto error; 876 printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n\n");
875 877 boot_ec->command_addr = ecdt_ptr->control.address;
876 printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n"); 878 boot_ec->data_addr = ecdt_ptr->data.address;
877 879 boot_ec->gpe = ecdt_ptr->gpe;
878 boot_ec->command_addr = ecdt_ptr->control.address; 880 boot_ec->handle = ACPI_ROOT_OBJECT;
879 boot_ec->data_addr = ecdt_ptr->data.address; 881 } else {
880 boot_ec->gpe = ecdt_ptr->gpe; 882 printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
881 boot_ec->handle = ACPI_ROOT_OBJECT; 883 status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
884 boot_ec, NULL);
885 if (ACPI_FAILURE(status))
886 goto error;
887 }
882 888
883 ret = ec_install_handlers(boot_ec); 889 ret = ec_install_handlers(boot_ec);
884 if (!ret) { 890 if (!ret) {