[Ubuntu PATCH] poke the SCI_EN bit on Macbook resume

From: Randy Dunlap
Date: Wed Jun 14 2006 - 18:22:01 EST


From: Ryan Lortie <desrt@xxxxxxxx>

[UBUNTU:ich7-sci-en-quirk] poke the SCI_EN bit on Macbook resume
http://www.kernel.org/git/?p=linux/kernel/git/bcollins/ubuntu-dapper.git;a=commitdiff;h=d1d9b907570c5c9178e3d66ff208bd483d1dfd61

The following patch deals with the problem that the SCI_EN bit is
disabled when the Macbook comes back from sleeping.

It does this by registering a quirk in the exact way that another one is
registered in the same file (for a Toshiba laptop with a similar
problem).

The quirk matches based on DMI product name of "MacBook1,1" so it should
really only affect the Macbook.

The actual bit-poking is done immediately on return from
do_suspend_lowlevel(). If I do it in the 'finish' function it is too
late (as at this point IRQs have been enabled again for some time).

Signed-off-by: Ben Collins <bcollins@xxxxxxxxxx>
---

--- a/drivers/acpi/sleep/main.c
+++ b/drivers/acpi/sleep/main.c
@@ -17,6 +17,7 @@
#include <linux/suspend.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
+#include <asm/io.h>
#include "sleep.h"

int acpi_in_suspend;
@@ -37,6 +38,7 @@ static u32 acpi_suspend_states[] = {
};

static int init_8259A_after_S1;
+static int ich7_sci_en_quirk_enabled;

/**
* acpi_pm_prepare - Do preliminary suspend work.
@@ -98,6 +100,14 @@ static int acpi_pm_enter(suspend_state_t

case PM_SUSPEND_MEM:
do_suspend_lowlevel();
+
+ if (ich7_sci_en_quirk_enabled)
+ {
+ int pm1c = inw(0x404);
+ pm1c |= 0x01; /* SCI_EN */
+ outw (pm1c, 0x404);
+ }
+
break;

case PM_SUSPEND_DISK:
@@ -190,12 +200,31 @@ static int __init init_ints_after_s1(str
return 0;
}

+/*
+ * Apple Macbook comes back from sleep with the SCI_EN bit disabled
+ * causing a flood of unacknowledged IRQ9s. We need to set SCI_EN
+ * as soon as we come back
+ */
+static int __init init_ich7_sci_en_quirk(struct dmi_system_id *d)
+{
+ printk(KERN_WARNING "%s detected (ICH7 SCI_EN quirk enabled)\n",
+ d->ident);
+ ich7_sci_en_quirk_enabled = 1;
+ return 0;
+}
+
+
static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
{
.callback = init_ints_after_s1,
.ident = "Toshiba Satellite 4030cdt",
.matches = {DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),},
},
+ {
+ .callback = init_ich7_sci_en_quirk,
+ .ident = "Apple MacBook",
+ .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "MacBook1,1"),},
+ },
{},
};

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/