From patchwork Wed Nov 23 22:21:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 83770 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp2883648qge; Wed, 23 Nov 2016 14:21:26 -0800 (PST) X-Received: by 10.98.29.205 with SMTP id d196mr5066924pfd.111.1479939686473; Wed, 23 Nov 2016 14:21:26 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 206si35812027pfw.94.2016.11.23.14.21.26; Wed, 23 Nov 2016 14:21:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933571AbcKWWVZ (ORCPT + 3 others); Wed, 23 Nov 2016 17:21:25 -0500 Received: from mail-lf0-f50.google.com ([209.85.215.50]:33769 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933559AbcKWWVY (ORCPT ); Wed, 23 Nov 2016 17:21:24 -0500 Received: by mail-lf0-f50.google.com with SMTP id c13so14735251lfg.0 for ; Wed, 23 Nov 2016 14:21:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=tUAaHjij9DuIJCQMYjQjTHjLEqn2yAgtujJnKCdycKE=; b=O4HQYceL5WCjCoXg4peEYeSH54206VGhZwR7jfC9UhekAJXAZKhh4ijqt+kxDZGPTy UXvmbgzVrLxUhpPgGMlZKLzl3yJwB8D/JfMmNy/Z/r7Jjus9IARY93UjoyIeQXMFCh6D sGOG4EJ/kjss+9FysV9pWKUEF+Ab0vpvYa+xM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=tUAaHjij9DuIJCQMYjQjTHjLEqn2yAgtujJnKCdycKE=; b=AfDL6Gk4MebQ1KLXeM41MXKhG/A152+O2vLgLBnYXlEKlKXYpLrTPkDVKVJGVzy7XD /dHoa1hhpyVdRdkwnIz+1OolZuLUmxszPPK0Jha/airKe440MoXL6EpKVaYDjw6A4YJT niT5i0jBAYluuQJ3zgyoGNJ+5FOQTprZRRkrW13Pog8kpIl3ssK3bQnxWAmrHnW/o7iM rPb4tBWr3hS5vnC9M5TlppnYoivZrgR4/jl/scYza6IcWs3KVSNe51Hf/vmafExPiXWf RxPIsj6Tco7xNCqFTFBOl1soTjPOu6LzVYkd6NciMxj/+d9P5ZomjIxmUyzowlJrwnHs Nr3w== X-Gm-Message-State: AKaTC01P6Bzi9qbKK8fc/r+LeXArsDYg2WMpqN92qlGK+WP4ZD+5cW7obKyyoP7NbeiAZYV4 X-Received: by 10.25.75.80 with SMTP id y77mr1773433lfa.173.1479939682877; Wed, 23 Nov 2016 14:21:22 -0800 (PST) Received: from fecusa.localdomain (c-357171d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.113.53]) by smtp.gmail.com with ESMTPSA id 23sm7646152ljf.48.2016.11.23.14.21.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Nov 2016 14:21:22 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Alexandre Courbot Cc: Linus Walleij , stable@vger.kernel.org, Patrice Chotard Subject: [PATCH] gpio: stmpe: fix interrupt handling bug Date: Wed, 23 Nov 2016 23:21:17 +0100 Message-Id: <1479939677-8617-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org commit 43db289d00c6 ("gpio: stmpe: Rework registers access") reworked the STMPE register access so as to use [STMPE_IDX_*_LSB + i] to access the 8bit register for a certain bank, assuming the CSB and MSB will follow after the enumerator. For this to work the index needs to go from (size-1) to 0 not 0 to (size-1). However for the GPIO IRQ handler, the status registers we read register MSB + 3 bytes ahead for the 24 bit GPIOs and index registers from MSB upwards and run an index i over the registers UNLESS we are STMPE1600. This is not working when we get to clearing the interrupt EDGE status register STMPE_IDX_GPEDR_[LCM]SB: it is indexed like all other registers [STMPE_IDX_*_LSB + i] but in this loop we index from 0 to get the right bank index for the calculations, and we need to just add i to the MSB. Before this, interrupts on the STMPE2401 were broken, this patch fixes it so it works again. Cc: stable@vger.kernel.org Cc: Patrice Chotard Fixes: 43db289d00c6 ("gpio: stmpe: Rework registers access") Signed-off-by: Linus Walleij --- drivers/gpio/gpio-stmpe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Patrice Chotard diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index e7d422a6b90b..e2e1b16a42db 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c @@ -413,7 +413,7 @@ static irqreturn_t stmpe_gpio_irq(int irq, void *dev) stmpe->partnum != STMPE1801) { stmpe_reg_write(stmpe, statmsbreg + i, status[i]); stmpe_reg_write(stmpe, - stmpe->regs[STMPE_IDX_GPEDR_LSB + i], + stmpe->regs[STMPE_IDX_GPEDR_MSB] + i, status[i]); } }