Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2500822b authored by Zhao Yakui's avatar Zhao Yakui Committed by Andi Kleen
Browse files

ACPI : Add the EC dmi table to fix the incorrect ECDT table

On some ASUS laptops the ECDT gives the incorrect command/status & Data I/O
register address.

AK: it seems like the command/data addresses are exchanged.

In such case it will cause that EC device can't be
initialized correctly.
To add the EC dmi table is to fix this issue. If the laptop falls into the
EC dmi table, the EC command/data I/O address will be fixed.

AK: Add comments describing this better

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



Signed-off-by: default avatarZhao Yakui <yakui.zhao@intel.com>
tested-by    : Jan Kasprzak  <kas@fi.muni.cz>
Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
parent b635acec
Loading
Loading
Loading
Loading
+34 −0
Original line number Original line Diff line number Diff line
@@ -110,6 +110,31 @@ static struct acpi_ec {
	u8 handlers_installed;
	u8 handlers_installed;
} *boot_ec, *first_ec;
} *boot_ec, *first_ec;


/* 
 * Some Asus system have exchanged ECDT data/command IO addresses.
 */
static int print_ecdt_error(const struct dmi_system_id *id)
{
	printk(KERN_NOTICE PREFIX "%s detected - "
		"ECDT has exchanged control/data I/O address\n",
		id->ident);
	return 0;
}

static struct dmi_system_id __cpuinitdata ec_dmi_table[] = {
	{
	print_ecdt_error, "Asus L4R", {
	DMI_MATCH(DMI_BIOS_VERSION, "1008.006"),
	DMI_MATCH(DMI_PRODUCT_NAME, "L4R"),
	DMI_MATCH(DMI_BOARD_NAME, "L4R") }, NULL},
	{
	print_ecdt_error, "Asus M6R", {
	DMI_MATCH(DMI_BIOS_VERSION, "0207"),
	DMI_MATCH(DMI_PRODUCT_NAME, "M6R"),
	DMI_MATCH(DMI_BOARD_NAME, "M6R") }, NULL},
	{},
};

/* --------------------------------------------------------------------------
/* --------------------------------------------------------------------------
                             Transaction Management
                             Transaction Management
   -------------------------------------------------------------------------- */
   -------------------------------------------------------------------------- */
@@ -911,6 +936,15 @@ int __init acpi_ec_ecdt_probe(void)
		pr_info(PREFIX "EC description table is found, configuring boot EC\n");
		pr_info(PREFIX "EC description table is found, configuring boot EC\n");
		boot_ec->command_addr = ecdt_ptr->control.address;
		boot_ec->command_addr = ecdt_ptr->control.address;
		boot_ec->data_addr = ecdt_ptr->data.address;
		boot_ec->data_addr = ecdt_ptr->data.address;
		if (dmi_check_system(ec_dmi_table)) {
			/*
			 * If the board falls into ec_dmi_table, it means
			 * that ECDT table gives the incorrect command/status
			 * & data I/O address. Just fix it.
			 */
			boot_ec->data_addr = ecdt_ptr->control.address;
			boot_ec->command_addr = ecdt_ptr->data.address;
		}
		boot_ec->gpe = ecdt_ptr->gpe;
		boot_ec->gpe = ecdt_ptr->gpe;
		boot_ec->handle = ACPI_ROOT_OBJECT;
		boot_ec->handle = ACPI_ROOT_OBJECT;
		acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle);
		acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle);