Skip to content

Commit 1021dcf

Browse files
Anson-Huangdtor
authored andcommitted
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: 688f1df ("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>
1 parent cb222ae commit 1021dcf

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎drivers/input/keyboard/imx_sc_key.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,13 @@ static void imx_sc_check_for_events(struct work_struct *work)
7878
return;
7979
}
8080

81-
state = (bool)msg.state;
81+
/*
82+
* The response data from SCU firmware is 4 bytes,
83+
* but ONLY the first byte is the key state, other
84+
* 3 bytes could be some dirty data, so we should
85+
* ONLY take the first byte as key state.
86+
*/
87+
state = (bool)(msg.state & 0xff);
8288

8389
if (state ^ priv->keystate) {
8490
priv->keystate = state;

0 commit comments

Comments
 (0)