lkml.org 
[lkml]   [2015]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRE: [PATCH v2] alarmtimer: fix unexpected rtc interrupt when system resume from S3
    Date
    >> (1). alarmtimer create a rtc wake up timer however alarmtimer won't
    >> remove that timer if the system wake up earlier

    >That's hardly a bug. That's a slight incorrectness which needs to be fixed.
    I think this timer is useless after system resume. For the correctness, I think it should be fixed.
    Do you agree? Or do you have any other suggestions? :)

    >> (2). rtc wake up timer will trigger hpet_rtc_interrupt continuously
    >> until timer timeout.

    >> This patch only fixed (1). Fixing (1) can avoid (2).
    >> However, The (2) is another story which it is not covered by this patch.

    >And that's the real interesting question. Why is hpet_rtc_interrupt continously triggered?

    I think this is caused by driver implementation.
    My explanation for the continuous hpet_rtc_interrupt():
    1. In hpet_rtc_timer_init(), it will set "delta" to 1/64 seconds in AIE mode (about 16ms, because of the value DEFAULT_RTC_SHIFT),
    that will cause hpet_rtc_interrupt() be triggered in every 16ms if the wakeup time (global variable hpet_alarm_time) is not reached.
    2. When someone calls rtc_timer_start (ex: alarmtimer_suspend ), hpet driver will set timeout value (current time + delta)
    to hpet_alarm_time, and then enable hpet timer.
    3. In hpet_rtc_interrupt(), it will call hpet_rtc_timer_reinit() to reinit timer and add "delta" to
    the hpet_t1_cmp for the next timeout value ( so we will receive an interrupt after 16ms).
    If hpet_alarm_time is reached, the irq_handler() will be called, the hpet_rtc_flags will be set to 0 and the hpet timer will be disable.
    Otherwise, we will receive an interrupt in each 16ms.
    If the logic of 1,2,3 are correct, no bugs inside, maybe we can redesign the driver to reduce this periodic interrupt.

    The following call path enable hpet timer when system go to suspend, just for you reference :)
    alarmtimer_suspend
    --rtc_timer_start
    ----rtc_timer_enqueue
    ------__rtc_set_alarm
    --------cmos_set_alarm
    ----------cmos_irq_enable
    ------------hpet_set_rtc_irq_bit

    Thanks,
    Lee, Zhuo-hao


    \
     
     \ /
      Last update: 2015-11-17 08:21    [W:3.222 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site