Commit 62c38016 authored by Fei Shao's avatar Fei Shao Committed by Dmitry Torokhov

Input: cros_ec_keyb - add back missing mask for event_type

In the previous patch we didn't mask out event_type in case statement,
so switches are always picked instead of buttons, which results in
ChromeOS devices misbehaving when power button is pressed.
This patch adds back the missing mask.

Fixes: d096aa3e ("Input: cros_ec_keyb: mask out extra flags in event_type")
Signed-off-by: default avatarFei Shao <fshao@chromium.org>
Reviewed-by: default avatarNicolas Boichat <drinkcat@chromium.org>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 0bec8b7e
...@@ -226,6 +226,8 @@ static int cros_ec_keyb_work(struct notifier_block *nb, ...@@ -226,6 +226,8 @@ static int cros_ec_keyb_work(struct notifier_block *nb,
{ {
struct cros_ec_keyb *ckdev = container_of(nb, struct cros_ec_keyb, struct cros_ec_keyb *ckdev = container_of(nb, struct cros_ec_keyb,
notifier); notifier);
uint8_t mkbp_event_type = ckdev->ec->event_data.event_type &
EC_MKBP_EVENT_TYPE_MASK;
u32 val; u32 val;
unsigned int ev_type; unsigned int ev_type;
...@@ -237,7 +239,7 @@ static int cros_ec_keyb_work(struct notifier_block *nb, ...@@ -237,7 +239,7 @@ static int cros_ec_keyb_work(struct notifier_block *nb,
if (queued_during_suspend && !device_may_wakeup(ckdev->dev)) if (queued_during_suspend && !device_may_wakeup(ckdev->dev))
return NOTIFY_OK; return NOTIFY_OK;
switch (ckdev->ec->event_data.event_type & EC_MKBP_EVENT_TYPE_MASK) { switch (mkbp_event_type) {
case EC_MKBP_EVENT_KEY_MATRIX: case EC_MKBP_EVENT_KEY_MATRIX:
pm_wakeup_event(ckdev->dev, 0); pm_wakeup_event(ckdev->dev, 0);
...@@ -264,7 +266,7 @@ static int cros_ec_keyb_work(struct notifier_block *nb, ...@@ -264,7 +266,7 @@ static int cros_ec_keyb_work(struct notifier_block *nb,
case EC_MKBP_EVENT_SWITCH: case EC_MKBP_EVENT_SWITCH:
pm_wakeup_event(ckdev->dev, 0); pm_wakeup_event(ckdev->dev, 0);
if (ckdev->ec->event_data.event_type == EC_MKBP_EVENT_BUTTON) { if (mkbp_event_type == EC_MKBP_EVENT_BUTTON) {
val = get_unaligned_le32( val = get_unaligned_le32(
&ckdev->ec->event_data.data.buttons); &ckdev->ec->event_data.data.buttons);
ev_type = EV_KEY; ev_type = EV_KEY;
......
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