Skip to content

Commit

Permalink
Input: imx_sc_key - only take the valid data from SCU firmware as key…
Browse files Browse the repository at this point in the history
… 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>
  • Loading branch information
Anson Huang authored and Dmitry Torokhov committed Dec 14, 2019
1 parent cb222ae commit 1021dcf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/input/keyboard/imx_sc_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1021dcf

Please sign in to comment.