Received: by 10.223.164.202 with SMTP id h10csp191036wrb; Mon, 13 Nov 2017 05:02:44 -0800 (PST) X-Google-Smtp-Source: AGs4zMaHCq8V1KeEz2Avm7o5phLt8rDmyNycRajZH4pgSTThlNYHM+rstpkF/WbK2S/3IsoRAnay X-Received: by 10.101.73.136 with SMTP id r8mr8644732pgs.411.1510578164072; Mon, 13 Nov 2017 05:02:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510578164; cv=none; d=google.com; s=arc-20160816; b=aYCgYE7Wf4+dupW5oq0fFJlODHepn5MJMZvA7OLMnduwuX8ECbGc+3QIbwaDyOUNut 3wt8jFBW9rYAPUG5N0LQJBe5l5k0q61xTU/EYdcAoCIQ5mM1A4Oe2Rrn3bii44Czga9S U0EcbPA7s9scslY4vBlcJENPxiZDGM4sD9Sa2E0n2H+cV1c97oPszMY85Ju+d4f7wQtQ qyO0VC5UvKDvO0R1CyJA5wmHkU4UgJnPfuqWxLq9vAz9uZG6f1fFjZ/x8cVLqo18M0Lc 2KTEDo9bXaGUZZKBx5yEuT29dXSHJ4V7FfgYaAWSCi/G+htPVyuDA5pH0sBIt+RFJhp7 6FAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=f8rA+w2teVbNjTxHcSIDIiZXuUUOPk2E4Zlx4GUezLk=; b=Jew3XIeOrNkk+gG77YrQTzKA0n3CE1w8AENu6YWXIb7oWRUDWyjmsUd/JNm1tl3S4w WmKvcdnC68xXmC7+An0bUhOq6P/3uvqQteHcD1/Ri0Ec3yEshxIkFBhsRUdc61lSPQ60 JEWSMTDSSih6obG56V0mfvHgJSbfSdNU/zpagvmsZroyJ5vZypgA5akLZ9pELf2OaFhj sHdN4X+P3rCOdIkZLtylpY7ltR9oK4gnfKhrDBehnLuYD8GO9Homwk9WOrqcJlwDHz/4 g6GVUX3/YfoFvAP35RB/lHfwTGDw8vTSIINqG8J1rk/uLvYGd2KXo6EibfIwQ6CV0mv4 SiPg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t19si13656030plo.425.2017.11.13.05.02.29; Mon, 13 Nov 2017 05:02:44 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754746AbdKMNBv (ORCPT + 95 others); Mon, 13 Nov 2017 08:01:51 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50314 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752944AbdKMNBs (ORCPT ); Mon, 13 Nov 2017 08:01:48 -0500 Received: from localhost (LFbn-1-12253-150.w90-92.abo.wanadoo.fr [90.92.67.150]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id D93D8AA5; Mon, 13 Nov 2017 13:01:47 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Akinobu Mita , Dmitry Torokhov , Sasha Levin Subject: [PATCH 4.9 38/87] Input: mpr121 - handle multiple bits change of status register Date: Mon, 13 Nov 2017 13:55:55 +0100 Message-Id: <20171113125618.800612252@linuxfoundation.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171113125615.304035578@linuxfoundation.org> References: <20171113125615.304035578@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Akinobu Mita [ Upstream commit 08fea55e37f58371bffc5336a59e55d1f155955a ] This driver reports input events on their interrupts which are triggered by the sensor's status register changes. But only single bit change is reported in the interrupt handler. So if there are multiple bits are changed at almost the same time, other press or release events are ignored. This fixes it by detecting all changed bits in the status register. Signed-off-by: Akinobu Mita Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/input/keyboard/mpr121_touchkey.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) --- a/drivers/input/keyboard/mpr121_touchkey.c +++ b/drivers/input/keyboard/mpr121_touchkey.c @@ -87,7 +87,8 @@ static irqreturn_t mpr_touchkey_interrup struct mpr121_touchkey *mpr121 = dev_id; struct i2c_client *client = mpr121->client; struct input_dev *input = mpr121->input_dev; - unsigned int key_num, key_val, pressed; + unsigned long bit_changed; + unsigned int key_num; int reg; reg = i2c_smbus_read_byte_data(client, ELE_TOUCH_STATUS_1_ADDR); @@ -105,18 +106,22 @@ static irqreturn_t mpr_touchkey_interrup reg &= TOUCH_STATUS_MASK; /* use old press bit to figure out which bit changed */ - key_num = ffs(reg ^ mpr121->statusbits) - 1; - pressed = reg & (1 << key_num); + bit_changed = reg ^ mpr121->statusbits; mpr121->statusbits = reg; + for_each_set_bit(key_num, &bit_changed, mpr121->keycount) { + unsigned int key_val, pressed; - key_val = mpr121->keycodes[key_num]; + pressed = reg & BIT(key_num); + key_val = mpr121->keycodes[key_num]; - input_event(input, EV_MSC, MSC_SCAN, key_num); - input_report_key(input, key_val, pressed); - input_sync(input); + input_event(input, EV_MSC, MSC_SCAN, key_num); + input_report_key(input, key_val, pressed); + + dev_dbg(&client->dev, "key %d %d %s\n", key_num, key_val, + pressed ? "pressed" : "released"); - dev_dbg(&client->dev, "key %d %d %s\n", key_num, key_val, - pressed ? "pressed" : "released"); + } + input_sync(input); out: return IRQ_HANDLED; From 1584175675833261238@xxx Wed Nov 15 23:14:14 +0000 2017 X-GM-THRID: 1583989650746469242 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread