LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Dell Latitude C600 suspend problem
@ 2001-10-07 10:57 ` Tim Stadelmann
  2001-10-07 14:10   ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Stadelmann @ 2001-10-07 10:57 UTC (permalink / raw)
  To: linux-kernel

Hi there,

A couple of days ago there was a discussion about a problem introduced
in 2.4.10 that would prevent APM on a Dell Latitude C600 (and possibly
others) from entering suspend mode.

A closer investigation revealed that the patch meant to correct a
problem with the internal ps2 pointing device on suspend is at fault.
Commenting out the entry in arch/i386/kernel/dmi_scan.c that triggers
the activation of this logic for the C600 allows the machine to
suspend normally.

Does anybody know the purpose of this change?  It seems to address a
problem I've never seen on my computer...

Please CC relevant replies to my personal address, as I'm not
currently subscribed.


				Tim Stadelmann


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dell Latitude C600 suspend problem
  2001-10-07 10:57 ` Dell Latitude C600 suspend problem Tim Stadelmann
@ 2001-10-07 14:10   ` Alan Cox
  2001-10-07 16:09     ` Tim Stadelmann
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2001-10-07 14:10 UTC (permalink / raw)
  To: Tim Stadelmann; +Cc: linux-kernel

> A closer investigation revealed that the patch meant to correct a
> problem with the internal ps2 pointing device on suspend is at fault.
> Commenting out the entry in arch/i386/kernel/dmi_scan.c that triggers
> the activation of this logic for the C600 allows the machine to
> suspend normally.

The change doesn't affect the suspend. What it deals with is the resume
side. When the C600 resumes it doesn't always restore the keyboard/mouse
state.

The actual code it runs is pckbd_pm_resume() (pc_keyb.c) so you might want
to see if that is actually triggering and where it hangs during the resume
Its possible it broke across the merge due to other keyb changes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Dell Latitude C600 suspend problem
  2001-10-07 14:10   ` Alan Cox
@ 2001-10-07 16:09     ` Tim Stadelmann
  2001-10-07 16:26       ` Tim Stadelmann
  2001-10-08  1:28       ` Pete Zaitcev
  0 siblings, 2 replies; 5+ messages in thread
From: Tim Stadelmann @ 2001-10-07 16:09 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

On Sun, Oct 07, 2001 at 03:10:14PM +0100, Alan Cox wrote:
> > A closer investigation revealed that the patch meant to correct a
> > problem with the internal ps2 pointing device on suspend is at fault.
> > Commenting out the entry in arch/i386/kernel/dmi_scan.c that triggers
> > the activation of this logic for the C600 allows the machine to
> > suspend normally.
> 
> The change doesn't affect the suspend. What it deals with is the resume
> side. When the C600 resumes it doesn't always restore the keyboard/mouse
> state.

Well, it SHOULDN'T affect the suspend...  I should have been more
precise here, but this was described in an earlier thread: the bug
does indeed prevent the machine from entering suspend mode at all.

> The actual code it runs is pckbd_pm_resume() (pc_keyb.c) so you might want
> to see if that is actually triggering and where it hangs during the resume

In fact, it turns out that the power management callback routine
doesn't check whether a suspend or a resume event triggered it.  More
importantly, it doesn't provide a return value either.  This explains
what happens: The power management code looks for a status value
returned by the callback and gets a more or less random int, which
usually dosn't happen to be 0 (== successful suspend).
 
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.


				Tim Stadelmann


^ 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: 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

end of thread, other threads:[~2001-10-08  1:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.1002472081.27755.linux-kernel2news@redhat.com>
2001-10-07 10:57 ` Dell Latitude C600 suspend problem Tim Stadelmann
2001-10-07 14:10   ` Alan Cox
2001-10-07 16:09     ` Tim Stadelmann
2001-10-07 16:26       ` Tim Stadelmann
2001-10-08  1:28       ` Pete Zaitcev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).