Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1363262ybl; Fri, 13 Dec 2019 14:06:27 -0800 (PST) X-Google-Smtp-Source: APXvYqwh2Geo2yUacuLwDIg3keKI4qQVF+rZoPM+we0UyXOE4NthQ+GAY6fklI5OllGYbGlcC6h4 X-Received: by 2002:a05:6830:10d7:: with SMTP id z23mr16968962oto.114.1576274787854; Fri, 13 Dec 2019 14:06:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576274787; cv=none; d=google.com; s=arc-20160816; b=OV+n77HzawGzNIoeizGdGDclewWN/C1zI7EJ+DqD4dDlxzesukgKcR5/LrcnkBHIdi OtZyPSYC2hAu1v7MbxFexgSjoqFsOHTutQxdKUxNyxjFdxg+YtBqk6JsNqL9y/zyPldD 5VBM6/HkMPxjaafqvbIWk6EvHD77D45y+XTfFrUdhdNp97GsA0YRSPs/MLFQV/VtgAq1 XrvJWlWCL4WznrqLm0tvGBsiGn4eGVurLJ6cLvulFpM+3AxSS0h714lA8BjMCGVFa6Kc VzANBIrvTIrJNeJQRwMgv4DDTEQ8g+cvgyiqS2wP7QvdmvAcGrvrPflisHcH756R2K13 o0BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tC9e56OkB9iMx5UogC2mae0NvXUXXZ3j9VUfeJ/X5wk=; b=B5dgia7PND+seuDV7jn8JD2K7y7AiBGmyLbe9fnTbW3kKYQPN+q1v5THr6qOPx80wo zV+laXV07GO85ECoTtVTgQAIoom6l3fYTzxub2TNC86jHyhxQw3WbXjYXcGIbjr+aiFU doAUplOqqeTGJchmu7Z/7CkLDyoUjLCg1uybu1oUJuC0NGdl2RrcydVHX5BlmPeufcEE 0syZUkkA/fLXo0qAUaUU1nfEp2gn9LwS5Dd53sOlsYM0sy9eFukVJ9yPeNsc4jM2eUgr /CuD1s+ZZXXc2TA0v7gnVMYSbEOhFEnBH37UvO77HhFUZL0aeEsRmlhcDkUctbpTxW8g dXbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tRoNRQRh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6si5818945otp.126.2019.12.13.14.06.14; Fri, 13 Dec 2019 14:06:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tRoNRQRh; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726704AbfLMWD0 (ORCPT + 99 others); Fri, 13 Dec 2019 17:03:26 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:45424 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725554AbfLMWDZ (ORCPT ); Fri, 13 Dec 2019 17:03:25 -0500 Received: by mail-pf1-f196.google.com with SMTP id 2so2164986pfg.12; Fri, 13 Dec 2019 14:03:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=tC9e56OkB9iMx5UogC2mae0NvXUXXZ3j9VUfeJ/X5wk=; b=tRoNRQRh+sJGD73mI4PDIDyRvkzBaNEx53l8oRH/Sn6LiwA5jhvcsHTHKt0UYjOfKD hI8+MAPu3GAvso6itHVboQN17c5NMohOaIdXDa6aP8XILG0jThspeOMRlB1IUC3yIWCZ swEyhbgSOV49JTywMJrODnCc7u4bYKMNWk/ZTtAn4jlE/qSBoeS6gnQhmOISmdYhsicT hv+UQszp8avxtmsIrnninBVWrvPdjhm37eQU53sSaxYhTcKtZ0QgecyWFxjbi9uOTD96 HCfXiVXAKR3OXOiwCQKS/hI0lN37hSjKxmU3aTbHAd2fk7aMPw55CqanJVLyHSFl5OxB QQyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tC9e56OkB9iMx5UogC2mae0NvXUXXZ3j9VUfeJ/X5wk=; b=axSnpFdcwMnUGm0hdnk7jdQaxBbNdQiz1kV+aS64ztk/JAHpAGKHpPU4DN1CVNvznv vLijLiPbhhpVZYfUwkBcSReq2Tu+jrOsRvPG0vklBusQ7wyLUhOb8+LD/EyH130xasV/ Nzy8Uhuw1i2sRe+zsqe2vqxuBnS6GutdNetS+cMSZrPM3RnP099UHwivXPEBKV2/ejuk A4A7pC21HNhSzaGKx4Xwf3CCfW9yzwjO4Kugb2vX4Z6TnyNQk9n29UEBiwd1Cc8m6Aju bE7xbPqaRvpHNcseB8/ADNQKPHXukadwE68UIlKbpTwGFYS0OdzXn9pDHi/IWXberkRm Cirg== X-Gm-Message-State: APjAAAV4kQ8T2OYNeGOM9kmtB5RQ0UCI0zlCWf6lyF2B1yDF1OQroqQt rv8U6eNoOJ8u5S9+MSf6d9A= X-Received: by 2002:a63:d358:: with SMTP id u24mr1975871pgi.218.1576274604884; Fri, 13 Dec 2019 14:03:24 -0800 (PST) Received: from dtor-ws ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id h7sm13693878pfq.36.2019.12.13.14.03.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2019 14:03:24 -0800 (PST) Date: Fri, 13 Dec 2019 14:03:21 -0800 From: Dmitry Torokhov To: Anson Huang 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 Message-ID: <20191213220321.GJ101194@dtor-ws> References: <1576202909-1661-1-git-send-email-Anson.Huang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1576202909-1661-1-git-send-email-Anson.Huang@nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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