* Re: Dell Latitude C600 suspend problem
2001-10-07 16:09 ` Tim Stadelmann
@ 2001-10-07 16:26 ` Tim Stadelmann
2001-10-08 1:28 ` Pete Zaitcev
1 sibling, 0 replies; 5+ messages in thread
From: Tim Stadelmann @ 2001-10-07 16:26 UTC (permalink / raw)
To: Alan Cox; +Cc: linux-kernel
On Sun, Oct 07, 2001 at 05:09:57PM +0100, Tim Stadelmann wrote:
> I've written a little patch (not included yet) that makes
> pckbd_pm_resume behave well in connection with the current incarnation
> of the power management code. Suspend and resume work again without
> problems.
>
> Unfortunatly, now the actual tweeks done by the callback seem to
> slightly confuse my keyboard driver...? Will look into that soon.
Oh well... Can't reproduce the problem any more. I probably
accidentially hit a couple of keys while reaching for the power
button.
In any case, here's the patch:
--- linux/include/asm/keyboard.h.bak Sun Oct 7 16:38:23 2001
+++ linux/include/asm/keyboard.h Sun Oct 7 16:37:45 2001
@@ -16,6 +16,7 @@
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/kd.h>
+#include <linux/pm.h>
#include <asm/io.h>
#define KEYBOARD_IRQ 1
@@ -28,7 +29,7 @@
extern char pckbd_unexpected_up(unsigned char keycode);
extern void pckbd_leds(unsigned char leds);
extern void pckbd_init_hw(void);
-extern void pckbd_pm_resume(void);
+extern int pckbd_pm_resume(struct pm_dev *, pm_request_t, void *);
extern unsigned char pckbd_sysrq_xlate[128];
#define kbd_setkeycode pckbd_setkeycode
--- linux/drivers/char/pc_keyb.c.bak Sun Oct 7 17:18:45 2001
+++ linux/drivers/char/pc_keyb.c Sun Oct 7 16:37:07 2001
@@ -397,29 +397,32 @@
return 0200;
}
-void pckbd_pm_resume(void)
+int pckbd_pm_resume(struct pm_dev *dev, pm_request_t rqst, void *data)
{
#if defined CONFIG_PSMOUSE
unsigned long flags;
- if (queue) { /* Aux port detected */
- if (aux_count == 0) { /* Mouse not in use */
- spin_lock_irqsave(&kbd_controller_lock, flags);
- /*
- * Dell Lat. C600 A06 enables mouse after resume.
- * When user touches the pad, it posts IRQ 12
- * (which we do not process), thus holding keyboard.
- */
- kbd_write_command(KBD_CCMD_MOUSE_DISABLE);
- /* kbd_write_cmd(AUX_INTS_OFF); */ /* Config & lock */
- kb_wait();
- kbd_write_command(KBD_CCMD_WRITE_MODE);
- kb_wait();
- kbd_write_output(AUX_INTS_OFF);
- spin_unlock_irqrestore(&kbd_controller_lock, flags);
- }
+ if (rqst == PM_RESUME) {
+ if (queue) { /* Aux port detected */
+ if (aux_count == 0) { /* Mouse not in use */
+ spin_lock_irqsave(&kbd_controller_lock, flags);
+ /*
+ * Dell Lat. C600 A06 enables mouse after resume.
+ * When user touches the pad, it posts IRQ 12
+ * (which we do not process), thus holding keyboard.
+ */
+ kbd_write_command(KBD_CCMD_MOUSE_DISABLE);
+ /* kbd_write_cmd(AUX_INTS_OFF); */ /* Config & lock */
+ kb_wait();
+ kbd_write_command(KBD_CCMD_WRITE_MODE);
+ kb_wait();
+ kbd_write_output(AUX_INTS_OFF);
+ spin_unlock_irqrestore(&kbd_controller_lock, flags);
+ }
+ }
}
-#endif
+#endif
+ return 0;
}
Greetings,
Tim
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Dell Latitude C600 suspend problem
2001-10-07 16:09 ` Tim Stadelmann
2001-10-07 16:26 ` Tim Stadelmann
@ 2001-10-08 1:28 ` Pete Zaitcev
1 sibling, 0 replies; 5+ messages in thread
From: Pete Zaitcev @ 2001-10-08 1:28 UTC (permalink / raw)
To: Tim.Stadelmann, Alan Cox; +Cc: linux-kernel
> From: Tim Stadelmann
> In any case, here's the patch:
Looks good, but I'd prefer just a tiny bit better.
1. asm-i386 instead of asm in filenames
2. replace space with tabs - Arjan used xterm paste or something?
3. I hate too long lines
The root of the evil is that the declaration of an external was
not in any header (because it would make a header dependent on
pm.h, and for the benefit of some obscure broken BIOS), and
sooner or later a mismatch happened.
Unfortunately, I see no good way to correct that.
-- Pete
diff -ur -X dontdiff linux-2.4.10/arch/i386/kernel/dmi_scan.c linux-2.4.10-e/arch/i386/kernel/dmi_scan.c
--- linux-2.4.10/arch/i386/kernel/dmi_scan.c Mon Sep 17 22:52:35 2001
+++ linux-2.4.10-e/arch/i386/kernel/dmi_scan.c Sun Oct 7 18:02:46 2001
@@ -369,15 +369,14 @@
* was disabled before the suspend. Linux gets terribly confused by that.
*/
-typedef void (pm_kbd_func) (void);
-extern pm_kbd_func *pm_kbd_request_override;
+extern pm_callback pm_kbd_request_override;
static __init int broken_ps2_resume(struct dmi_blacklist *d)
{
#ifdef CONFIG_VT
if (pm_kbd_request_override == NULL)
{
- pm_kbd_request_override = pckbd_pm_resume;
+ pm_kbd_request_override = pckbd_pm_callback;
printk(KERN_INFO "%s machine detected. Mousepad Resume Bug workaround enabled.\n", d->ident);
}
#endif
diff -ur -X dontdiff linux-2.4.10/drivers/char/keyboard.c linux-2.4.10-e/drivers/char/keyboard.c
--- linux-2.4.10/drivers/char/keyboard.c Tue Sep 18 13:39:51 2001
+++ linux-2.4.10-e/drivers/char/keyboard.c Sun Oct 7 18:12:45 2001
@@ -911,8 +911,6 @@
EXPORT_SYMBOL(keyboard_tasklet);
DECLARE_TASKLET_DISABLED(keyboard_tasklet, kbd_bh, 0);
-typedef void (pm_kbd_func) (void);
-
pm_callback pm_kbd_request_override = NULL;
int __init kbd_init(void)
@@ -937,7 +935,7 @@
tasklet_enable(&keyboard_tasklet);
tasklet_schedule(&keyboard_tasklet);
-
+
pm_kbd = pm_register(PM_SYS_DEV, PM_SYS_KBC, pm_kbd_request_override);
return 0;
diff -ur -X dontdiff linux-2.4.10/drivers/char/pc_keyb.c linux-2.4.10-e/drivers/char/pc_keyb.c
--- linux-2.4.10/drivers/char/pc_keyb.c Mon Sep 17 22:52:35 2001
+++ linux-2.4.10-e/drivers/char/pc_keyb.c Sun Oct 7 17:57:43 2001
@@ -397,29 +397,33 @@
return 0200;
}
-void pckbd_pm_resume(void)
+int pckbd_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data)
{
#if defined CONFIG_PSMOUSE
unsigned long flags;
- if (queue) { /* Aux port detected */
- if (aux_count == 0) { /* Mouse not in use */
- spin_lock_irqsave(&kbd_controller_lock, flags);
- /*
- * Dell Lat. C600 A06 enables mouse after resume.
- * When user touches the pad, it posts IRQ 12
- * (which we do not process), thus holding keyboard.
- */
- kbd_write_command(KBD_CCMD_MOUSE_DISABLE);
- /* kbd_write_cmd(AUX_INTS_OFF); */ /* Config & lock */
- kb_wait();
- kbd_write_command(KBD_CCMD_WRITE_MODE);
- kb_wait();
- kbd_write_output(AUX_INTS_OFF);
- spin_unlock_irqrestore(&kbd_controller_lock, flags);
- }
- }
-#endif
+ if (rqst != PM_RESUME)
+ return 0;
+
+ if (queue) { /* Aux port detected */
+ if (aux_count == 0) { /* Mouse not in use */
+ spin_lock_irqsave(&kbd_controller_lock, flags);
+ /*
+ * Dell Lat. C600 A06 enables mouse after resume.
+ * When user touches the pad, it posts IRQ 12
+ * (which we do not process), thus holding keyboard.
+ */
+ kbd_write_command(KBD_CCMD_MOUSE_DISABLE);
+ /* kbd_write_cmd(AUX_INTS_OFF); */ /* Config & lock */
+ kb_wait();
+ kbd_write_command(KBD_CCMD_WRITE_MODE);
+ kb_wait();
+ kbd_write_output(AUX_INTS_OFF);
+ spin_unlock_irqrestore(&kbd_controller_lock, flags);
+ }
+ }
+#endif
+ return 0;
}
diff -ur -X dontdiff linux-2.4.10/include/asm-i386/keyboard.h linux-2.4.10-e/include/asm-i386/keyboard.h
--- linux-2.4.10/include/asm-i386/keyboard.h Sun Sep 23 10:31:59 2001
+++ linux-2.4.10-e/include/asm-i386/keyboard.h Sun Oct 7 17:53:28 2001
@@ -28,7 +28,7 @@
extern char pckbd_unexpected_up(unsigned char keycode);
extern void pckbd_leds(unsigned char leds);
extern void pckbd_init_hw(void);
-extern void pckbd_pm_resume(void);
+extern int pckbd_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data);
extern unsigned char pckbd_sysrq_xlate[128];
#define kbd_setkeycode pckbd_setkeycode
^ permalink raw reply [flat|nested] 5+ messages in thread