From patchwork Tue Nov 1 09:22:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 80315 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp531223qge; Tue, 1 Nov 2016 02:23:14 -0700 (PDT) X-Received: by 10.99.55.12 with SMTP id e12mr47369963pga.99.1477992194502; Tue, 01 Nov 2016 02:23:14 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10si8380467pgc.217.2016.11.01.02.23.13; Tue, 01 Nov 2016 02:23:14 -0700 (PDT) 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=@linaro.org; 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 dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1168119AbcKAJXF (ORCPT + 27 others); Tue, 1 Nov 2016 05:23:05 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:36350 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161766AbcKAJXD (ORCPT ); Tue, 1 Nov 2016 05:23:03 -0400 Received: by mail-lf0-f53.google.com with SMTP id t196so35610341lff.3 for ; Tue, 01 Nov 2016 02:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=x23ErWncp8X7wVFJeEE4soUKOZS5Y5D5ia5Qu0mPrxw=; b=Ync6zti28kn/6XnPqPNPMNIW04Vo00+l2CQIr1ToqmnxcozmFo7oeVBGp38H5F0uQi WraQgVxiqmjQRQ60F8pCzNQ2nQ+e2EFiDWRwB/UC2C0u8o2ti2kvs7RJQHZSypdyF3W6 Sr0038yoD8/pAu488jb4SOF+P3JJ2dgTcWkkg= 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=x23ErWncp8X7wVFJeEE4soUKOZS5Y5D5ia5Qu0mPrxw=; b=S4n1jKCY8DmCItzGRZLsQV0BatStescgguSbotml/KUYMDatnMuinPTuVnStZib9Ib EgeFujUqlKhvtg2wbSW9cFAKMLQVMHnk35xwOdcL+jTgZujrisB6PifexG8BCtu5picu g3b79CclHrfVBKpNANJCysukzDuHGG5Cbyzv/UQxtRMFS87q5fbpQkuysNopdZvzn4xr wX3h1Cp0GoPTkF/q4FW6QiH8Gk9X7XzGS69v+EUDcxqdu8Z/t/YDk+BNquUfax8c7WJ/ 0Jc3IyyGnzCRqR4LPCyRJjTUqXCnMsk7uXDf4Zr5vHI4eaEVcFApwsQXNMUSpDtJKa88 f+gw== X-Gm-Message-State: ABUngvdkfEy9n3Ps8M0s5T15kyyeKl1LAZyeDc+u3K2dYv6t99Xt6xkHv+g2Q59r0SoxXaaP X-Received: by 10.25.56.22 with SMTP id f22mr3091176lfa.0.1477992181686; Tue, 01 Nov 2016 02:23:01 -0700 (PDT) Received: from fecusa.localdomain (c-357171d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.113.53]) by smtp.gmail.com with ESMTPSA id 198sm5323305ljf.17.2016.11.01.02.23.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Nov 2016 02:23:01 -0700 (PDT) From: Linus Walleij To: lee.jones@linaro.org, linux-kernel@vger.kernel.org Cc: Linus Walleij , stable@vger.kernel.org, Patrice Chotard , Amelie Delaunay Subject: [PATCH] mfd: stmpe: Fix RESET regression on STMPE2401 Date: Tue, 1 Nov 2016 10:22:53 +0100 Message-Id: <1477992173-30964-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit c4dd1ba355aae2bc3d1213da6c66c53e3c31e028 ("mfd: stmpe: Add reset support for all STMPE variant") we're resetting the STMPE expanders before use. This caused a regression on the STMP2401 on the Nomadik NHK8815: stmpe-i2c 0-0043: stmpe2401 detected, chip id: 0x101 nmk-i2c 101f8000.i2c0: write to slave 0x43 timed out nmk-i2c 101f8000.i2c0: no ack received after address transmission stmpe-i2c 0-0044: stmpe2401 detected, chip id: 0x101 nmk-i2c 101f8000.i2c0: write to slave 0x44 timed out nmk-i2c 101f8000.i2c0: no ack received after address transmission It turns out that we start to poll for the reset bit to go low again too quickly: the STMPE2401 is not yet online and ready to be asked for the status of the RESET bit. By introducing a 10ms delay before starting to hammer the register for information, we get back to normal: stmpe-i2c 0-0043: stmpe2401 detected, chip id: 0x101 stmpe-i2c 0-0044: stmpe2401 detected, chip id: 0x101 Cc: stable@vger.kernel.org Cc: Patrice Chotard Cc: Amelie Delaunay Cc: Lee Jones Fixes: c4dd1ba355aa ("mfd: stmpe: Add reset support for all STMPE variant") Signed-off-by: Linus Walleij --- drivers/mfd/stmpe.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.7.4 diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index cfdae8a3d779..b0c7bcdaf5df 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -851,6 +851,8 @@ static int stmpe_reset(struct stmpe *stmpe) if (ret < 0) return ret; + msleep(10); + timeout = jiffies + msecs_to_jiffies(100); while (time_before(jiffies, timeout)) { ret = __stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_SYS_CTRL]);