mkbp: keyboard_clear_buffer should only drop keyboard events
mkbp: keyboard_clear_buffer should only drop keyboard events

Two hooks in HOOK_LID_CHANGE has race condition:

  1) keyboard_lid_change() wakes up KEYSCAN task and calls
     keyboard_clear_buffer() to clear the MKBP fifo
  2) mkbp_lid_change() pushes EC_MKBP_LID_OPEN event into the same fifo.

mkbp_lid_change has lowest priority, so usually the flow looks like
  keyboard_lid_change()
  keyboard_clear_buffer()
  mkbp_lid_change()
EC_MKBP_LID_OPEN event inserted after buffer clear, everything good.

But in Juniper, we found that sometimes the flow becomes
  keyboard_lid_change()
  mkbp_lid_change()
  keyboard_clear_buffer()
And cause the EC_MKBP_LID_OPEN dropped before sending to host.

To fix this, change the behavior of keyboard_clear_buffer() to keep all
non-keyboard events inside the queue. So EC_MKBP_LID_OPEN will never be
removed regardless of how task is scheduled.

BUG=b:149880594
TEST=1) On Jacuzzi, host able to receive lid switch event
     2) Set the priority mkbp_lid_change to 1(highest) and verify 1)
        still works
BRANCH=kukui

Signed-off-by: Ting Shen <c671d3efec3d7e7e285f3788bf0d1ba4c8605b78@google.com>
Change-Id: I55d7c6c45ecb6505134e430689887ce98ea0c29b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2098018
Reviewed-by: Eric Yilun Lin <2f2733c7206ea2b76bd2db1905cc5e8a75841c48@chromium.org>
Reviewed-by: Jett Rink <9d4aef0593e6843318d99df31597fb6153b89787@chromium.org>
Tested-by: Ting Shen <c671d3efec3d7e7e285f3788bf0d1ba4c8605b78@chromium.org>
Commit-Queue: Ting Shen <c671d3efec3d7e7e285f3788bf0d1ba4c8605b78@chromium.org>

coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec