• L
    ACPI / EC: Add event clearing variation support. · 1d68d261
    Lv Zheng 提交于
    We've been suffering from the uncertainty of the SCI_EVT clearing timing.
    This patch implements 3 of 4 possible modes to handle SCI_EVT clearing
    variations. The old behavior is kept in this patch.
    
    Status: QR_EC is re-checked as early as possible after checking previous
            SCI_EVT. This always leads to 2 QR_EC transactions per SCI_EVT
            indication and the target may implement event queue which returns
            0x00 indicating "no outstanding event".
            This is proven to be a conflict against Windows behavior, but is
            still kept in this patch to make the EC driver robust to the
            possible regressions that may occur on Samsung platforms.
    Query: QR_EC is re-checked after the target has handled the QR_EC query
           request command pushed by the host.
    Event: QR_EC is re-checked after the target has noticed the query event
           response data pulled by the host.
           This timing is not determined by any IRQs, so we may need to use a
           guard period in this mode, which may explain the existence of the
           ec_guard() code used by the old EC driver where the re-check timing
           is implemented in the similar way as this mode.
    Method: QR_EC is re-checked as late as possible after completing the _Qxx
            evaluation. The target may implement SCI_EVT like a level triggered
            interrupt.
            It is proven on kernel bugzilla 94411 that, Windows will have all
            _Qxx evaluations parallelized. Thus unless required by further
            evidences, we needn't implement this mode as it is a conflict of
            the _Qxx parallelism requirement.
    
    Note that, according to the reports, there are platforms that cannot be
    handled using the "Status" mode without enabling the
    EC_FLAGS_QUERY_HANDSHAKE quirk. But they can be handled with the other
    modes according to the tests (kernel bugzilla 97381).
    
    The following log entry can be used to confirm the differences of the 3
    modes as it should appear at the different positions for the 3 modes:
      Command(QR_EC) unblocked
    Status: appearing after
             EC_SC(W) = 0x84
    Query: appearing after
             EC_DATA(R) = 0xXX
           where XX is the event number used to determine _QXX
    Event: appearing after first
             EC_SC(R) = 0xX0 SCI_EVT=x BURST=0 CMD=0 IBF=0 OBF=0
           that is next to the following log entry:
             Command(QR_EC) completed by hardware
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=94411
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=97381
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=98111Reported-and-tested-by: NGabriele Mazzotta <gabriele.mzt@gmail.com>
    Reported-and-tested-by: NTigran Gabrielyan <tigrangab@gmail.com>
    Reported-and-tested-by: NAdrien D <ghbdtn@openmailbox.org>
    Signed-off-by: NLv Zheng <lv.zheng@intel.com>
    Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
    1d68d261
ec.c 43.4 KB