From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Anson Huang <Anson.Huang@nxp.com>
Cc: shawnguo@kernel.org, s.hauer@pengutronix.de,
kernel@pengutronix.de, festevam@gmail.com, robh@kernel.org,
linux-input@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Linux-imx@nxp.com
Subject: Re: [PATCH] input: keyboard: imx_sc_key: Only take the valid data from SCU firmware as key state
Date: Fri, 13 Dec 2019 14:03:21 -0800 [thread overview]
Message-ID: <20191213220321.GJ101194@dtor-ws> (raw)
In-Reply-To: <1576202909-1661-1-git-send-email-Anson.Huang@nxp.com>
On Fri, Dec 13, 2019 at 10:08:29AM +0800, Anson Huang wrote:
> 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>
Applied, thank you.
> ---
> drivers/input/keyboard/imx_sc_key.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
> index 5379952..9f809ae 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;
> --
> 2.7.4
>
--
Dmitry
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Anson Huang <Anson.Huang@nxp.com>
Cc: robh@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de,
linux-kernel@vger.kernel.org, Linux-imx@nxp.com,
kernel@pengutronix.de, linux-input@vger.kernel.org,
festevam@gmail.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] input: keyboard: imx_sc_key: Only take the valid data from SCU firmware as key state
Date: Fri, 13 Dec 2019 14:03:21 -0800 [thread overview]
Message-ID: <20191213220321.GJ101194@dtor-ws> (raw)
In-Reply-To: <1576202909-1661-1-git-send-email-Anson.Huang@nxp.com>
On Fri, Dec 13, 2019 at 10:08:29AM +0800, Anson Huang wrote:
> 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>
Applied, thank you.
> ---
> drivers/input/keyboard/imx_sc_key.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/imx_sc_key.c b/drivers/input/keyboard/imx_sc_key.c
> index 5379952..9f809ae 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;
> --
> 2.7.4
>
--
Dmitry
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-12-13 22:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-13 2:08 [PATCH] input: keyboard: imx_sc_key: Only take the valid data from SCU firmware as key state Anson Huang
2019-12-13 2:08 ` Anson Huang
2019-12-13 22:03 ` Dmitry Torokhov [this message]
2019-12-13 22:03 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191213220321.GJ101194@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=Anson.Huang@nxp.com \
--cc=Linux-imx@nxp.com \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.