From patchwork Fri Nov 17 01:24:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 10062221 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 F145460235 for ; Fri, 17 Nov 2017 01:24:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2DB52A965 for ; Fri, 17 Nov 2017 01:24:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D47C82A96D; Fri, 17 Nov 2017 01:24:47 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 7E6B22A965 for ; Fri, 17 Nov 2017 01:24:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754638AbdKQBYp (ORCPT ); Thu, 16 Nov 2017 20:24:45 -0500 Received: from mail-io0-f194.google.com ([209.85.223.194]:46981 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753684AbdKQBYn (ORCPT ); Thu, 16 Nov 2017 20:24:43 -0500 Received: by mail-io0-f194.google.com with SMTP id t11so7196825iof.13; Thu, 16 Nov 2017 17:24:43 -0800 (PST) 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=B8J3GE+xpBxhnUab7Jw0mZy8cZPjPBiNZQj40vK0GNA=; b=n5u6FEBuF8ihSJWFyM4Z6vtPL4AmXUHFWwIu03zlIIyX/bLv+cndXscmfpogUc6HFW DKU8ZdXsYSxd+TZnIJsSa1sR0oYSqchGjPC1gwTY6ZrKwcj3bW8Y5QOMyCwOSFLSHYCQ ZEpru8XjsFl/cCOrBsQIWQneSlFkP1jEyOf+rBD9wDlZPz37dLZm+8ywNNQNvi9g1qrQ nniKO2yOjluSokzc4deGDiV8aIAxEpix5vF1BecufzeaVCqUoKhZWMNIqb/mU5C3juTH DN8jw36yVB5UiDug46GDQ40Evy5PwRTfZTHQBgZI6hthiLGQOsp8LxJVYE3jR8PLfGRk ALeA== 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=B8J3GE+xpBxhnUab7Jw0mZy8cZPjPBiNZQj40vK0GNA=; b=o+rPLGwjyKlY+N7rw7LlWfj2gucNLo2coJA/64cieK7aR9wdumpLFvh/XRg29nrLrt MOyMFvbroKso1kfUxtpkLHaBzro+7MZz1bSKr56c0vAyc8eG6SuSZfnyrjnPxBjF80u/ 51uHQbFcN4iztSIW24SSJxYl9m/JS0RTHuVZslwmFCyZEef8p/Q4RDJHq2Ad0R+XmcXY BLUPNRwGt2+ZM6lA6QRpXxEvpXkNBdAZUFVzL9wnh8mYlD93RyoUmevUmOFneWARppqs PbHStHkikYfdVaOn6kFCMWjsS2g5AkyAr9BFSo6Bxu2WcX3K8a3SVdYHIHOPXSWojMBu rjyg== X-Gm-Message-State: AJaThX4SyYk+yb5pe5PxMdK6OHIA0XwcIr3kvdqfRHjV0MqJqWGn2OHp PK8DjiQnBWn5WCO85sVVNmrWN+Lm X-Google-Smtp-Source: AGs4zMYqs+KWaZfms3g8TlsA15a6o54iaTEi/gbUjUy5iHqVDRRULjFdTyvyHxieOHc7YnH9uI+Zzg== X-Received: by 10.107.40.68 with SMTP id o65mr1054547ioo.120.1510881882013; Thu, 16 Nov 2017 17:24:42 -0800 (PST) Received: from dtor-ws ([2620:0:1000:1611:da80:8749:c06f:9515]) by smtp.gmail.com with ESMTPSA id f68sm1126035iod.36.2017.11.16.17.24.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 Nov 2017 17:24:41 -0800 (PST) Date: Thu, 16 Nov 2017 17:24:39 -0800 From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Guenter Roeck , Johnny Chuang , linux-kernel@vger.kernel.org Subject: [PATCH] Input: elants_i2c - do not clobber interrupt trigger on x86 Message-ID: <20171117012439.bfnczk2mqwsf4iua@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170609 (1.8.3) 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 This is similar to commit a4b0a58bb142 ("Input: elan_i2c - do not clobber interrupt trigger on x86") 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. Signed-off-by: Dmitry Torokhov Reviewed-by: Guenter Roeck --- drivers/input/touchscreen/elants_i2c.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index e102d7764bc2..1cc3e6b135e7 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -1261,10 +1261,13 @@ static int elants_i2c_probe(struct i2c_client *client, } /* - * 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 = client->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(&client->dev, client->irq, NULL, elants_i2c_irq,