clockevents: fix resume logic
[GitHub/MotorolaMobilityLLC/kernel-slsi.git] / arch / i386 / kernel / hpet.c
index 17d73459fc5f3310b58109656ff27db1174843c3..cfbf792a0bf49bb0f7998957747bd5dccb18951e 100644 (file)
@@ -187,6 +187,10 @@ static void hpet_set_mode(enum clock_event_mode mode,
                cfg &= ~HPET_TN_ENABLE;
                hpet_writel(cfg, HPET_T0_CFG);
                break;
+
+       case CLOCK_EVT_MODE_RESUME:
+               hpet_enable_int();
+               break;
        }
 }
 
@@ -217,6 +221,7 @@ static struct clocksource clocksource_hpet = {
        .mask           = HPET_MASK,
        .shift          = HPET_SHIFT,
        .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
+       .resume         = hpet_start_counter,
 };
 
 /*
@@ -291,7 +296,6 @@ int __init hpet_enable(void)
 
        clocksource_register(&clocksource_hpet);
 
-
        if (id & HPET_ID_LEGSUP) {
                hpet_enable_int();
                hpet_reserve_platform_timers(id);
@@ -524,68 +528,3 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 #endif
-
-
-/*
- * Suspend/resume part
- */
-
-#ifdef CONFIG_PM
-
-static int hpet_suspend(struct sys_device *sys_device, pm_message_t state)
-{
-       unsigned long cfg = hpet_readl(HPET_CFG);
-
-       cfg &= ~(HPET_CFG_ENABLE|HPET_CFG_LEGACY);
-       hpet_writel(cfg, HPET_CFG);
-
-       return 0;
-}
-
-static int hpet_resume(struct sys_device *sys_device)
-{
-       unsigned int id;
-
-       hpet_start_counter();
-
-       id = hpet_readl(HPET_ID);
-
-       if (id & HPET_ID_LEGSUP)
-               hpet_enable_int();
-
-       return 0;
-}
-
-static struct sysdev_class hpet_class = {
-       set_kset_name("hpet"),
-       .suspend        = hpet_suspend,
-       .resume         = hpet_resume,
-};
-
-static struct sys_device hpet_device = {
-       .id             = 0,
-       .cls            = &hpet_class,
-};
-
-
-static __init int hpet_register_sysfs(void)
-{
-       int err;
-
-       if (!is_hpet_capable())
-               return 0;
-
-       err = sysdev_class_register(&hpet_class);
-
-       if (!err) {
-               err = sysdev_register(&hpet_device);
-               if (err)
-                       sysdev_class_unregister(&hpet_class);
-       }
-
-       return err;
-}
-
-device_initcall(hpet_register_sysfs);
-
-#endif