Commit 79d80b87 authored by Michael Kelley's avatar Michael Kelley Committed by Greg Kroah-Hartman
Browse files

clockevents/drivers/i8253: Add support for PIT shutdown quirk

commit 35b69a42


Add support for platforms where pit_shutdown() doesn't work because of a
quirk in the PIT emulation. On these platforms setting the counter register
to zero causes the PIT to start running again, negating the shutdown.

Provide a global variable that controls whether the counter register is
zero'ed, which platform specific code can override.
Signed-off-by: default avatarMichael Kelley <>
Signed-off-by: default avatarThomas Gleixner <>
Cc: "" <>
Cc: "" <>
Cc: "" <>
Cc: "" <>
Cc: "" <>
Cc: "" <>
Cc: "" <>
Cc: "" <>
Cc: vkuznets <>
Cc: "" <>
Cc: "" <>
Cc: KY Srinivasan <>

Signed-off-by: default avatarGreg Kroah-Hartman <>
parent d62eead0
......@@ -20,6 +20,13 @@
* Handle PIT quirk in pit_shutdown() where zeroing the counter register
* restarts the PIT, negating the shutdown. On platforms with the quirk,
* platform specific code can set this to false.
bool i8253_clear_counter_on_shutdown __ro_after_init = true;
#ifdef CONFIG_CLKSRC_I8253
* Since the PIT overflows every tick, its not very useful
......@@ -109,8 +116,11 @@ static int pit_shutdown(struct clock_event_device *evt)
outb_p(0x30, PIT_MODE);
outb_p(0, PIT_CH0);
outb_p(0, PIT_CH0);
if (i8253_clear_counter_on_shutdown) {
outb_p(0, PIT_CH0);
outb_p(0, PIT_CH0);
return 0;
......@@ -21,6 +21,7 @@
#define PIT_LATCH ((PIT_TICK_RATE + HZ/2) / HZ)
extern raw_spinlock_t i8253_lock;
extern bool i8253_clear_counter_on_shutdown;
extern struct clock_event_device i8253_clockevent;
extern void clockevent_i8253_init(bool oneshot);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment