lkml.org 
[lkml]   [1998]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectpatch for buggy APM implentations

This may have been discussed before, but I don't remember or see it
discussed in the archives.

During a resume from suspend, some* DOS-centric BIOSi "reset" the timer
interrupt to DOS' frequency (~18Hz), instead of restoring linux' (100Hz).

Millions of jiffies ago, David Chen prepared a patch for 2.0 that remained
unofficial. With the new restructuring, it didn't apply at all, so I pre-
pared the patch below, based on his code.

It prolly should be disabled, by default (ref. KISS).

Chad Miller
( celebrating my first Thanksgiving
as a vegetarian. Turkey's overrated.)

* PhoenixBIOS 4.0 Rel 5.13, e.g..


*** linux-2.1.129ac6/arch/i386/kernel/apm.c.orig Wed Nov 25 20:19:49 1998
--- linux-2.1.129ac6/arch/i386/kernel/apm.c Thu Nov 26 02:50:19 1998
***************
*** 220,225 ****
--- 220,239 ----
#define APM_CHECK_TIMEOUT (HZ)

/*
+ * Define to re-initialize the interrupt 0 timer to 100 Hz after a suspend.
+ * This patched by Chad Miller <cmiller@surfsouth.com>, orig code by David
+ * Chen <chen@ctpa04.mit.edu>
+ */
+ #define INIT_TIMER_AFTER_SUSPEND
+
+ #ifdef INIT_TIMER_AFTER_SUSPEND
+ #include <linux/timex.h>
+ #include <asm/io.h>
+ #include <linux/delay.h>
+ #endif
+
+
+ /*
* Save a segment register away
*/
#define savesegment(seg, where) \
***************
*** 724,733 ****
--- 738,762 ----
got_clock_diff = 1;
restore_flags(flags);

+ printk("apm: suspending...\n");
+
err = apm_set_power_state(APM_STATE_SUSPEND);
if (err)
apm_error("suspend", err);
+
+ #ifdef INIT_TIMER_AFTER_SUSPEND
+ cli();
+ /* set the clock to 100 Hz */
+ outb_p(0x34,0x43); /* binary, mode 2, LSB/MSB, ch 0 */
+ udelay(10);
+ outb_p(LATCH & 0xff , 0x40); /* LSB */
+ udelay(10);
+ outb(LATCH >> 8 , 0x40); /* MSB */
+ udelay(10);
+ #endif
+
set_time();
+ printk("apm: resumed\n");
}

static void standby(void)





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

\
 
 \ /
  Last update: 2005-03-22 13:45    [W:0.036 / U:1.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site