Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 141966
b: refs/heads/master
c: 34ff4db
h: refs/heads/master
v: v3
  • Loading branch information
Alexey Starikovskiy authored and Len Brown committed Apr 1, 2009
1 parent a7765ca commit 569c7c0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a5032bfdd9c80e0231a6324661e123818eb46ecd
refs/heads/master: 34ff4dbccccce54c83b1234d39b7ad9e548a75dd
30 changes: 18 additions & 12 deletions trunk/drivers/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ enum ec_command {

#define ACPI_EC_DELAY 500 /* Wait 500ms max. during EC ops */
#define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */
#define ACPI_EC_UDELAY 100 /* Wait 100us before polling EC again */
#define ACPI_EC_CDELAY 10 /* Wait 10us before polling EC */

#define ACPI_EC_STORM_THRESHOLD 8 /* number of false interrupts
per one transaction */
Expand Down Expand Up @@ -236,13 +236,23 @@ static int ec_check_sci(struct acpi_ec *ec, u8 state)
return 0;
}

static void ec_delay(void)
{
/* EC in MSI notebooks don't tolerate delays other than 550 usec */
if (EC_FLAGS_MSI)
udelay(ACPI_EC_DELAY);
else
/* Use shortest sleep available */
msleep(1);
}

static int ec_poll(struct acpi_ec *ec)
{
unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
udelay(ACPI_EC_UDELAY);
udelay(ACPI_EC_CDELAY);
while (time_before(jiffies, delay)) {
gpe_transaction(ec, acpi_ec_read_status(ec));
udelay(ACPI_EC_UDELAY);
ec_delay();
if (ec_transaction_done(ec))
return 0;
}
Expand Down Expand Up @@ -755,10 +765,6 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
unsigned long long tmp = 0;

struct acpi_ec *ec = context;

/* clear addr values, ec_parse_io_ports depend on it */
ec->command_addr = ec->data_addr = 0;

status = acpi_walk_resources(handle, METHOD_NAME__CRS,
ec_parse_io_ports, ec);
if (ACPI_FAILURE(status))
Expand Down Expand Up @@ -808,11 +814,11 @@ static int acpi_ec_add(struct acpi_device *device)
ec = make_acpi_ec();
if (!ec)
return -ENOMEM;
}
if (ec_parse_device(device->handle, 0, ec, NULL) !=
AE_CTRL_TERMINATE) {
if (ec_parse_device(device->handle, 0, ec, NULL) !=
AE_CTRL_TERMINATE) {
kfree(ec);
return -EINVAL;
}
}

ec->handle = device->handle;
Expand Down Expand Up @@ -990,12 +996,12 @@ int __init acpi_ec_ecdt_probe(void)
boot_ec->handle = ACPI_ROOT_OBJECT;
acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle);
/* Don't trust ECDT, which comes from ASUSTek */
if (!dmi_name_in_vendors("ASUS") && EC_FLAGS_MSI == 0)
if (!dmi_name_in_vendors("ASUS"))
goto install;
saved_ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL);
if (!saved_ec)
return -ENOMEM;
memcpy(saved_ec, boot_ec, sizeof(struct acpi_ec));
memcpy(saved_ec, boot_ec, sizeof(*saved_ec));
/* fall through */
}
/* This workaround is needed only on some broken machines,
Expand Down

0 comments on commit 569c7c0

Please sign in to comment.