diff options
author | Anson Huang <Anson.Huang@nxp.com> | 2019-12-13 14:02:30 -0800 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2019-12-13 16:41:57 -0800 |
commit | 1021dcf19db1387bc0db26d14bbcba719923a466 (patch) | |
tree | b1c3dd4f0ad5fdc0407e933e4055e109fbb58427 /drivers/input/keyboard/imx_sc_key.c | |
parent | cb222aed03d798fc074be55e59d9a112338ee784 (diff) |
Input: imx_sc_key - only take the valid data from SCU firmware as key state
When reading key state from SCU, the response data from SCU firmware
is 4 bytes due to MU message protocol, but ONLY the first byte is the
key state, other 3 bytes could be some dirty data, so we should ONLY
take the first byte as key state to avoid reporting incorrect state.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Fixes: 688f1dfb69b4 ("Input: keyboard - imx_sc: Add i.MX system controller key support")
Link: https://lore.kernel.org/r/1576202909-1661-1-git-send-email-Anson.Huang@nxp.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/keyboard/imx_sc_key.c')
-rw-r--r-- | drivers/input/keyboard/imx_sc_key.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c index 53799527dc75..9f809aeb785c 100644 --- a/drivers/input/keyboard/imx_sc_key.c +++ b/drivers/input/keyboard/imx_sc_key.c @@ -78,7 +78,13 @@ static void imx_sc_check_for_events(struct work_struct *work) return; } - state = (bool)msg.state; + /* + * The response data from SCU firmware is 4 bytes, + * but ONLY the first byte is the key state, other + * 3 bytes could be some dirty data, so we should + * ONLY take the first byte as key state. + */ + state = (bool)(msg.state & 0xff); if (state ^ priv->keystate) { priv->keystate = state; |