From patchwork Thu Sep 28 17:09:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9976409 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 389EB60365 for ; Thu, 28 Sep 2017 17:09:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 223012964E for ; Thu, 28 Sep 2017 17:09:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 170992965C; Thu, 28 Sep 2017 17:09:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B10552964E for ; Thu, 28 Sep 2017 17:09:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751832AbdI1RJL (ORCPT ); Thu, 28 Sep 2017 13:09:11 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:32969 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751587AbdI1RJK (ORCPT ); Thu, 28 Sep 2017 13:09:10 -0400 Received: by mail-pg0-f65.google.com with SMTP id u136so2677736pgc.0; Thu, 28 Sep 2017 10:09:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=CdEN4vXa7kkteQQxivH1KyUyYNvbzqLSU9j7EfeaNqk=; b=mRMDWJ+W3ZHKL9NkEnHmde1WB2JyaKMPKgw7YvufF39T6RggaL2TdjUyx8qiWWFZOF nxFAa34R1A/iCvObqFhMDVcKIPn86o9q19NrDqI+J+0EubbZsR0puSFNOu1cVFXzAAN1 +g8sL7LAKfyliGZpMMJFwpkzJx9289Gw8sz1aCV7nkt3yU0liLd3W01QpCqebNhdmUUp bZ3jWtbloiV6ikEjwo6QCfCujfNnl88wBtFT4QeZ7sEyldqhJZNsDUbVAaw2RdvRQIuJ w5y5rvZwTeQEZiULxjOQyxH2woxSiBzsqswPqRMO8SqJBgxjytsoSuPD5ES9up4iAr/M rn3g== 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:mime-version :content-disposition:user-agent; bh=CdEN4vXa7kkteQQxivH1KyUyYNvbzqLSU9j7EfeaNqk=; b=cyK8yGn58YM15su4sF+keQjo1bMSw54Iida9U/1R2DwiKbsrairqC9wspNjRm3d4AS xxTgmBZciEWz4gX3B/7H17C8T+cZabPFTYEemRavcZ36qVM/VmvnLxC0lwizdKTotXly feSwSQutxQZsGtr6zUtRf6DXzjw8pA6hW/MXvgJrLmpxBnoHnzrPab0rH/7ntdL4/oK9 bPTZwLXBshyMf+097TgcfD4i4fD9EY+n903lRB7Z9FJPTkxfN/sdw6Yda3Q2GVfjm0hC tsVjQK2AMYeJ3EEEBtkpONvSMB/shNlWDQcwpWXdu/odDd3/ATp/IUsF7199bIOrUeI3 fhTA== X-Gm-Message-State: AHPjjUggW0LJWm2Ni43pIty9kcglV56pUMBBbfzdQXMEcmTpd6uKSDyp GFfV1seKtzXrkI+L47P9QDDwSN+2 X-Google-Smtp-Source: AOwi7QDLRiocI8v+bO1Zdz6eU3N0cAACR/OhLFmLFoFC10IHaGFzmk45goMQqwbteQiYcTXbi8DC4Q== X-Received: by 10.101.80.202 with SMTP id s10mr4792052pgp.34.1506618544941; Thu, 28 Sep 2017 10:09:04 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1611:2954:d25d:82e7:8669]) by smtp.gmail.com with ESMTPSA id a19sm3876885pfa.25.2017.09.28.10.09.04 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Thu, 28 Sep 2017 10:09:04 -0700 (PDT) Date: Thu, 28 Sep 2017 10:09:02 -0700 From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: KT Liao , Guenter Roeck , Aaron Durbin , Craig Bergstrom , linux-kernel@vger.kernel.org Subject: [PATCH] Input: elan_i2c - do not clobber interrupt trigger on x86 Message-ID: <20170928170902.GA18201@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On x86 we historically used falling edge interrupts in the driver because that's how first Chrome devices were configured. They also did not use ACPI to enumerate I2C devices (because back then there was no kernel support for that), so trigger was hard-coded in the driver. However the controller behavior is much more reliable if we use level triggers, and that is how we configured ARM devices, and how want to configure newer x86 devices as well. All newer x86 boxes have their I2C devices enumerated in ACPI. Let's see if platform code (ACPI, DT) described interrupt and specified particular trigger type, and if so, let's use it instead of always clobbering trigger with IRQF_TRIGGER_FALLING. We will still use this trigger type as a fallback if platform code left interrupt trigger unconfigured. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196761 Signed-off-by: Dmitry Torokhov Reviewed-by: Aaron Durbin --- drivers/input/mouse/elan_i2c_core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index a2d2077303cb..c33f2cce6ba9 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -1141,10 +1142,13 @@ static int elan_probe(struct i2c_client *client, return error; /* - * Systems using device tree should set up interrupt via DTS, - * the rest will use the default falling edge interrupts. + * Platform code (ACPI, DTS) should normally set up interrupt + * for us, but in case it did not let's fall back to using falling + * edge to be compatible with older Chromebooks. */ - irqflags = dev->of_node ? 0 : IRQF_TRIGGER_FALLING; + irqflags = irq_get_trigger_type(client->irq); + if (!irqflags) + irqflags = IRQF_TRIGGER_FALLING; error = devm_request_threaded_irq(dev, client->irq, NULL, elan_isr, irqflags | IRQF_ONESHOT,