All of lore.kernel.org
 help / color / mirror / Atom feed
From: Len Brown <len.brown@intel.com>
To: linux-acpi@vger.kernel.org
Cc: Alexey Starikovskiy <astarikovskiy@suse.de>,
	Len Brown <len.brown@intel.com>
Subject: [PATCH 10/12] ACPI: EC: If ECDT is not found, look up EC in DSDT.
Date: Fri,  3 Aug 2007 18:33:43 -0400	[thread overview]
Message-ID: <11861804352132-git-send-email-len.brown@intel.com> (raw)
Message-ID: <cd8c93a4e04dce8f00d1ef3a476aac8bd65ae40b.1186180370.git.len.brown@intel.com> (raw)
In-Reply-To: <11861804251625-git-send-email-len.brown@intel.com>
In-Reply-To: <67effe8fff32f60bdf51cba484766ba6003005bb.1186180370.git.len.brown@intel.com>

From: Alexey Starikovskiy <astarikovskiy@suse.de>

Some ASUS laptops access EC space from device _INI methods, but do not
provide ECDT for early EC setup. In order to make them function properly,
there is a need to find EC is DSDT before any _INI is called.

Similar functionality was turned on by acpi_fake_ecdt=1 command line
before. Now it is on all the time.

http://bugzilla.kernel.org/show_bug.cgi?id=8598

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
---
 drivers/acpi/ec.c |   50 ++++++++++++++++++++++++++++----------------------
 1 files changed, 28 insertions(+), 22 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index dd384ec..4d7fe82 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,
 	return AE_OK;
 }
 
-static int ec_parse_device(struct acpi_ec *ec, acpi_handle handle)
+static acpi_status
+ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
 {
-	if (ACPI_FAILURE(acpi_walk_resources(handle, METHOD_NAME__CRS,
-				     ec_parse_io_ports, ec)))
-		return -EINVAL;
+	acpi_status status;
+
+	struct acpi_ec *ec = context;
+	status = acpi_walk_resources(handle, METHOD_NAME__CRS,
+				     ec_parse_io_ports, ec);
+	if (ACPI_FAILURE(status))
+		return status;
 
 	/* Get GPE bit assignment (EC events). */
 	/* TODO: Add support for _GPE returning a package */
-	if (ACPI_FAILURE(acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe)))
-		return -EINVAL;
+	status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe);
+	if (ACPI_FAILURE(status))
+		return status;
 
 	/* Use the global lock for all EC transactions? */
 	acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock);
 
-	/* Find and register all query methods */
-	acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1,
-			    acpi_ec_register_query_methods, ec, NULL);
-
 	ec->handle = handle;
 
 	printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx",
 			  ec->gpe, ec->command_addr, ec->data_addr);
 
-	return 0;
+	return AE_CTRL_TERMINATE;
 }
 
 static int acpi_ec_add(struct acpi_device *device)
@@ -704,7 +706,8 @@ static int acpi_ec_add(struct acpi_device *device)
 	if (!ec)
 		return -ENOMEM;
 
-	if (ec_parse_device(ec, device->handle)) {
+	if (ec_parse_device(device->handle, 0, ec, NULL) !=
+	    AE_CTRL_TERMINATE) {
 		kfree(ec);
 		return -EINVAL;
 	}
@@ -867,18 +870,21 @@ int __init acpi_ec_ecdt_probe(void)
 	/*
 	 * Generate a boot ec context
 	 */
-
 	status = acpi_get_table(ACPI_SIG_ECDT, 1,
 				(struct acpi_table_header **)&ecdt_ptr);
-	if (ACPI_FAILURE(status))
-		goto error;
-
-	printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n");
-
-	boot_ec->command_addr = ecdt_ptr->control.address;
-	boot_ec->data_addr = ecdt_ptr->data.address;
-	boot_ec->gpe = ecdt_ptr->gpe;
-	boot_ec->handle = ACPI_ROOT_OBJECT;
+	if (ACPI_SUCCESS(status)) {
+		printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n\n");
+		boot_ec->command_addr = ecdt_ptr->control.address;
+		boot_ec->data_addr = ecdt_ptr->data.address;
+		boot_ec->gpe = ecdt_ptr->gpe;
+		boot_ec->handle = ACPI_ROOT_OBJECT;
+	} else {
+		printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
+		status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
+						boot_ec, NULL);
+		if (ACPI_FAILURE(status))
+			goto error;
+	}
 
 	ret = ec_install_handlers(boot_ec);
 	if (!ret) {
-- 
1.5.3.rc3.7.gd58e

  parent reply	other threads:[~2007-08-03 22:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-03 22:33 ACPI patches for 2.6.23-rc2 Len Brown
2007-08-03 22:33 ` [PATCH 01/12] ACPI: add "acpi_no_auto_ssdt" bootparam Len Brown
2007-08-03 22:33   ` Len Brown
2007-08-03 22:33   ` [PATCH 02/12] sony-laptop: restore the last user requested brightness level on resume Len Brown
2007-08-03 22:33     ` Len Brown
2007-08-03 22:33   ` [PATCH 03/12] sony-laptop: sony_nc_ids[] can become static Len Brown
2007-08-03 22:33     ` Len Brown
2007-08-03 22:33   ` [PATCH 04/12] sonypi: fix ids member of struct acpi_driver Len Brown
2007-08-03 22:33     ` Len Brown
2007-08-03 22:33   ` [PATCH 05/12] ACPI: thinkpad-acpi: fix the module init failure path Len Brown
2007-08-03 22:33     ` Len Brown
2007-08-03 22:33   ` [PATCH 06/12] ACPI: button: re-scan lid state on resume Len Brown
2007-08-03 22:33     ` Len Brown
2007-08-05 15:11     ` Thomas Renninger
2007-08-03 22:33   ` [PATCH 07/12] asus_acpi: fix possible double free (found by Coverity) Len Brown
2007-08-03 22:33     ` Len Brown
2007-08-03 22:33   ` [PATCH 08/12] ACPI: EC: Remove noisy debug printk fron EC driver Len Brown
2007-08-03 22:33     ` Len Brown
2007-08-03 22:33   ` [PATCH 09/12] ACPI: Battery: Synchronize battery operations Len Brown
2007-08-03 22:33     ` Len Brown
2007-08-03 22:33   ` Len Brown [this message]
2007-08-03 22:33     ` [PATCH 10/12] ACPI: EC: If ECDT is not found, look up EC in DSDT Len Brown
2007-08-03 22:33   ` [PATCH 11/12] ACPI: EC: fix build warning Len Brown
2007-08-03 22:33     ` Len Brown
2007-08-03 22:33   ` [PATCH 12/12] ACPI: EC: Switch from boot_ec as soon as we find its desc in DSDT Len Brown
2007-08-03 22:33     ` Len Brown
2007-08-08  8:11   ` [PATCH 01/12] ACPI: add "acpi_no_auto_ssdt" bootparam Thomas Renninger
2007-08-08 16:38     ` Len Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11861804352132-git-send-email-len.brown@intel.com \
    --to=len.brown@intel.com \
    --cc=astarikovskiy@suse.de \
    --cc=linux-acpi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.