Received: by 10.223.164.202 with SMTP id h10csp1879265wrb; Thu, 16 Nov 2017 05:59:34 -0800 (PST) X-Google-Smtp-Source: AGs4zMbrsl7f1KFexd4GqBbgTM+GheDSS2K4Dl0HmjJfRn4Z7fv0vG/BNXM6Othhik1dHn4Ni3pl X-Received: by 10.84.174.1 with SMTP id q1mr1847703plb.220.1510840773881; Thu, 16 Nov 2017 05:59:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510840773; cv=none; d=google.com; s=arc-20160816; b=H2BTGXQxwiVuUf+rpLBpm39PM2qi+4Qx8uAVcQH5XdxMd5IMgV0lWskUzWDGjGVvFn 89jNqjx/QrtM5jvBM1NonsV0kITPIELkRcRCNISxxFZakflD2x+zrHzVWvu9kGDrcuXZ 997Q59j941IbCd2Sn6aj3YY3+QaojkL8xEhvq5epUTRprKeE7fU+3H3RIHvz/cA2ZtTK v1FwGj0lYRal3VdRNhjoSwea65HCh91blxiF1+ICNgepTE4Ap8aBJDEzlqilsVCTEJ95 rwrwCAvAvcy9KGOvRQkltNg7+/jEfSpy8e3GBJvfKwlJYG2fqad5gfldG3TxQmVM665s VlAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :mime-version:dkim-signature:arc-authentication-results; bh=U7VxeXcjYzRbo5getYsqUhocGWu2eJ8qzINIimR8dr4=; b=QmYfYfwa8pxhvoBb33Ph9sPVHaCcW0GfzTGPiCTpnutnVRj+LnDNRwUwifPktZE2GU 2Rxt8NPqUDcxyas4npZ+jC+yrwfHzQYYgABrCgONul2x3p4lmwhSYXRIRAM6Z+B+vC+k d5S5pbmqkorlAv3ulnQi8nVaBUxg9DI8fbw8nCFosulm2nMZyPeiWlorizXBoaNFXQdS sqOWwI4J84ryKyLru6dpJf/uB3TE0A2i2J3snhK9WUEGA1UQ891BneyfSoHwJJh712Qy djZqNarS7f6EQ8rZkRpH7MbLzozfee0fmYDEo07DihdTucw7TBxaV7H6NphU29YEl9eX 7Eog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@endlessm-com.20150623.gappssmtp.com header.s=20150623 header.b=S74RNuNg; 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 u2si887202plm.424.2017.11.16.05.59.20; Thu, 16 Nov 2017 05:59:33 -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=@endlessm-com.20150623.gappssmtp.com header.s=20150623 header.b=S74RNuNg; 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 S1759421AbdKPLiz (ORCPT + 91 others); Thu, 16 Nov 2017 06:38:55 -0500 Received: from mail-ot0-f169.google.com ([74.125.82.169]:43191 "EHLO mail-ot0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934388AbdKPLie (ORCPT ); Thu, 16 Nov 2017 06:38:34 -0500 Received: by mail-ot0-f169.google.com with SMTP id s12so15890470otc.0 for ; Thu, 16 Nov 2017 03:38:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessm-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to:cc; bh=U7VxeXcjYzRbo5getYsqUhocGWu2eJ8qzINIimR8dr4=; b=S74RNuNg/hANwK9rmpwEQtd512Vi9SeppQHVG83wknoOMH9QLwIt5Vz/H8ZgotYqsQ KqV5BGRouYAzxkQ6lwoqOyMuc9YqEr4R+jymyFJj37Z/tIOqfcpMI5fblahcgvP3E5qi EmnEiMhafjnh/CcVsVbLzoJTYLyGwwSbnybZFSO7zBw0yFT7BwwRKfsVQ16L548wXyd+ btvUZsnLKiUcDA1dazoOMcDbkzYNOLcQKK8qobXbe46jlMEHBgWL5EwmjBrbq4h8uE4D ZAY8szsZLRfEKeg2tjy9niZBMEgDdBZ9KXerVdTJe74kEBGvyS96FVMEUkaukZEfBFKy 50jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=U7VxeXcjYzRbo5getYsqUhocGWu2eJ8qzINIimR8dr4=; b=C5rzkWYYdxaNK26VauqtKCM8Is9KkWb0o1vl128fbnyqBSyAT1aMTAYUQG2QGJjjYL +1lzmJzlV8Pv2sbXWeRTo1D9vlCsse2CgBt0voCk9M/WDOspmKVD8ZSSEJozIf5SNMx2 ztujS5HYKNPhNu8UQSA6IH3w1kZYS1cDHIf7va89Opea52cXDhSd0RkxRRO/2iz92LmP 6+0iZR0mHRZk8E9G0rMgEMqQi//0FXQ99qSZ8ACBhokc/MfArxE+u0YKTSA3OWzKd4ce 36fiVNrC8zPdtwYNHFCPRcK5m9ClGHaWnzoIHd07U1cmbnkRvgfY4co+sGlKHnNBZ5hf LpQg== X-Gm-Message-State: AJaThX4RVMunRhFutlEnIgrYeZSrz9nBbfI/TiFe6veTX6lPBchmwC8p ZPLTDYdEZt0G5dRlaGglr9GqyxCzIyd8RkJZUD5HPw== X-Received: by 10.157.11.106 with SMTP id p39mr927990otd.310.1510832313616; Thu, 16 Nov 2017 03:38:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.0.216 with HTTP; Thu, 16 Nov 2017 03:38:33 -0800 (PST) From: Daniel Drake Date: Thu, 16 Nov 2017 11:38:33 +0000 Message-ID: Subject: intel-gpio interrupts stop firing with Focaltech I2C-HID touchpad To: mika.westerberg@linux.intel.com, heikki.krogerus@linux.intel.com Cc: Chris Chiu , linux-gpio@vger.kernel.org, Linux Kernel , Endless Linux Upstreaming Team 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 Hi, We have 2 new laptop samples which use ACPI GpioInt for the I2C-HID touchpad interrupt (via intel-gpio) and both models face different issues related to this interrupt, which is level-triggered active low (as defined by i2c-hid spec), and ultimately handled by a threaded interrupt handler in the i2c-hid driver. The first model that we are looking at is Asus X540NA SKU3 using a Focaltech touchpad, Intel Apollo Lake using pinctrl-broxton. The touchpad stops responding after a short period of usage. An easy reproducer is to touch with 2 fingers. At this point, no more intel-gpio interrupts appear and the touchpad can no longer be used. Is there any documentation available for the registers that intel-gpio works with? We have tried several experiments but have been unable to really understand the behaviour of the hardware here. We are using this base patch for debugging: https://gist.github.com/dsd/1f10c6c818569ceec11f910ad8a07228 It logs the register values before and after each operation, and also has a timer showing the same reg values every 1 second. With this patch applied, here are the boot logs showing initial (succesful) probing of the touchpad: https://gist.github.com/dsd/2d7cd918e13b7cbabccd53a4e0c28c88 And here is a later log snippet showing the touchpad being used, before interrupts stop arriving @ 130.883810 on line 3341 https://gist.github.com/dsd/dc6cbdb4690285977004cf076c7a8f55 On line 3342 onwards, the debug timer is logging the state of the hardware, showing that the GPIO is low (PADCFG0=40900100), the interrupt is enabled (IE=40000), the interrupt is pending (IS=40000) but yet no interrupt arrives. When interrupts do work, the basic sequence of events is: - intel-gpio hardware interrupt fires - call generic_handle_irq() - mask (unset bit in IE register) - ack (unset bit in IS register) - Enter i2c_hid threaded IRQ handler some time later - i2c_hid threaded IRQ handler returns - unmask (set bit in IE register) I experimented with this sequence of events, and I found that if I don't mask/unmask, but instead move the ack until several seconds later, then no more interrupts will arrive til the ack. So if is it the ack that seems to make the hardware start re-sampling the GPIO level in order to generate more interupts, should that be done only after the IRQ handler has finished? 3 experiments with that idea, each link both with the incremental patch and the resultant logs: 1. Move the ack to happen right after unmask in the above sequence https://gist.github.com/dsd/7d1de6ce43602fd4181c456c528fad7e 2. Move the ack to happen right before unmask https://gist.github.com/dsd/eefffcb1d55078e7d7a6525115400412 3. Ack at that same point in the sequence but don't mask/unmask at all https://gist.github.com/dsd/3372599ea5f925a1e9bbf76c5c3d7a96 Unfortunately in 3 all cases the problem is the same, the interrupts soon stop firing even though IE/IS/PADCFG0 all suggest that another interrupt is pending. Maybe it is not the ack behaviour that is wrong here. Ultimately we found a nasty workaround where we detect the above conditions and then mask and unmask the interrupt and that is enough to kick things off again. https://github.com/endlessm/linux/commit/34d7fb46383f9f91d5d2514e155fba913fa02440 Any ideas? We would like to find a correct and upstreamable solution. I'll also start another thread for the other product (with i2c-hid ELAN touchpad) which is also having trouble with intel-gpio, although that one is getting too many interrupts rather than too few. We are still studying it. Daniel From 1584644236250023693@xxx Tue Nov 21 03:21:48 +0000 2017 X-GM-THRID: 1584605710783078756 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread