mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* devicefs support for system timer
@ 2002-12-01 21:28 Pavel Machek
  0 siblings, 0 replies; only message in thread
From: Pavel Machek @ 2002-12-01 21:28 UTC (permalink / raw)
  To: torvalds, kernel list

Hi!

Here it is; without this, time runs 50x too slow after resume, please
apply

								Pavel

--- clean/arch/i386/kernel/i8259.c	2002-09-30 20:33:40.000000000 +0200
+++ linux-sensors/arch/i386/kernel/i8259.c	2002-12-01 22:26:19.000000000 +0100
@@ -367,6 +367,45 @@
 	}
 }
 
+static void setup_timer(void)
+{
+	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 */
+}
+
+static int timer_resume(struct device *dev, u32 level)
+{
+	if (level == RESUME_POWER_ON)
+		setup_timer();
+	return 0;
+}
+
+static struct device_driver timer_driver = {
+	.name		= "timer",
+	.bus		= &system_bus_type,
+	.resume		= timer_resume,
+};
+
+static struct sys_device device_timer = {
+	.name		= "timer",
+	.id		= 0,
+	.dev		= {
+		.name	= "timer",
+		.driver	= &timer_driver,
+	},
+};
+
+static int __init init_timer_devicefs(void)
+{
+	driver_register(&timer_driver);
+	return sys_device_register(&device_timer);
+}
+
+device_initcall(init_timer_devicefs);
+
 void __init init_IRQ(void)
 {
 	int i;
@@ -386,16 +425,15 @@
 	}
 
 	/* setup after call gates are initialised (usually add in
-	 * the architecture specific gates */
+	 * the architecture specific gates)
+	 */
 	intr_init_hook();
 
 	/*
 	 * Set the clock to HZ Hz, we already have a valid
 	 * vector now:
 	 */
-	outb_p(0x34,0x43);		/* binary, mode 2, LSB/MSB, ch 0 */
-	outb_p(LATCH & 0xff , 0x40);	/* LSB */
-	outb(LATCH >> 8 , 0x40);	/* MSB */
+	setup_timer();
 
 	/*
 	 * External FPU? Set up irq13 if so, for

-- 
Worst form of spam? Adding advertisment signatures ala sourceforge.net.
What goes next? Inserting advertisment *into* email?

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-12-01 21:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-01 21:28 devicefs support for system timer Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome