From patchwork Fri Feb 5 12:36:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 61268 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1064448lbl; Fri, 5 Feb 2016 04:37:01 -0800 (PST) X-Received: by 10.66.218.40 with SMTP id pd8mr19645160pac.159.1454675821094; Fri, 05 Feb 2016 04:37:01 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e90si23809155pfj.89.2016.02.05.04.37.00; Fri, 05 Feb 2016 04:37:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-input-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751798AbcBEMhA (ORCPT + 1 other); Fri, 5 Feb 2016 07:37:00 -0500 Received: from mail-lb0-f173.google.com ([209.85.217.173]:33944 "EHLO mail-lb0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751572AbcBEMg7 (ORCPT ); Fri, 5 Feb 2016 07:36:59 -0500 Received: by mail-lb0-f173.google.com with SMTP id cw1so48707497lbb.1 for ; Fri, 05 Feb 2016 04:36:58 -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=yO6MxYQE+LLHoQNvorIVcT2CPML+g8BVM4a05VXn5G0=; b=Mu122ph0iQQBvUE723vbXWsDHPrZpWgJ7xIKizdivcMLjWXQc/zgwjvPLz0AKSXZ6q hnB3f3G98qQqUGRvhv2MhYQnTPcrDJM2FYOyja5O7BPyET85j7SgV1tRPNB72HjRk9C1 fO2fz6fuT5QjyA4P0fTrqVKb+mh1Kve5VUQbk= 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=yO6MxYQE+LLHoQNvorIVcT2CPML+g8BVM4a05VXn5G0=; b=Nk699LNxe7PoRIzJ11gbcNDG6acw9fxYziBsFrDzgih5slkCNsqfXsYXjuLJvrMtME hH+PPX7gUS2HsQG9uk74DXKMLvxGu7+ZrVsTQpZRzxMaOJxDEyWO313kHURgA0lDzeWh tRl2Pu5mwzO9SLrwE3RTp3whKFbXaiXaPrSrB3fAuzmC+4fZEGAlwIL1pPnV+fHZzdBp CH/4YxvjewhYf3S1XoxMEOkXWrQpR9/4uGNZOurpINMNozgrBXR8WZCLCFaL1y7QbVP4 piwHr1lbjV8Y8QMdcQExgZc8+WWwNfbJYTcb6m7I1xM5hZCtfDjtrtp/Dbx0Qg5NhxYu vA/g== X-Gm-Message-State: AG10YOTNGW/O/rX7fmIYC97Y7i+Xu7yotoEwl0gFi3Kw+uT9aKRP/N8SgaqUjirId2l1pj2T X-Received: by 10.112.213.70 with SMTP id nq6mr1742128lbc.8.1454675817651; Fri, 05 Feb 2016 04:36:57 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i1sm2190880lbs.38.2016.02.05.04.36.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Feb 2016 04:36:56 -0800 (PST) From: Linus Walleij To: Andrew Duggan , Dmitry Torokhov , linux-input@vger.kernel.org Cc: Christopher Heiny , Vincent Huang , Linus Walleij Subject: [PATCH] Input: synaptics-rmi4: Get IRQ flags from the IRQ subsystem Date: Fri, 5 Feb 2016 13:36:37 +0100 Message-Id: <1454675797-10065-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org I don't understand what the irq_flags in the platform data is there for other than being default 0. The trigger type is specified by device tree or ACPI or similar so before forcing it to LEVEL_LOW, ask the descriptor what flags it already have. Without this my RMI4 touchscreen fails like this: input: Synaptics TM1217 as /devices/rmi4-00/input/input2 genirq: Setting trigger mode 8 for irq 163 failed (nmk_gpio_irq_set_type+0x0/0x138) rmi4_i2c 3-004b: Failed to register interrupt 163 rmi4_i2c: probe of 3-004b failed with error -22 And that is because my GPIO controller does not support level IRQs, only edges. And that is also what is specified in the device tree: interrupts = <20 IRQ_TYPE_EDGE_FALLING>; but it is not falling through to the driver because of this hardcoding. This patch makes the driver respect the flags from the IRQ subsystem and only shoehorn it into LEVEL_LOW if none is specified. Signed-off-by: Linus Walleij --- This goes on top of the v3 patchset and was necessary for my testing. Feel free to apply this on top of the RMI4 patches OR squash it into the series, I don't care as long as the result works for me. --- drivers/input/rmi4/rmi_i2c.c | 3 ++- drivers/input/rmi4/rmi_spi.c | 2 +- include/linux/rmi.h | 4 ---- 3 files changed, 3 insertions(+), 6 deletions(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c index 75020f246158..c21e6c133069 100644 --- a/drivers/input/rmi4/rmi_i2c.c +++ b/drivers/input/rmi4/rmi_i2c.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "rmi_driver.h" #define BUFFER_SIZE_INCREMENT 32 @@ -188,7 +189,7 @@ static irqreturn_t rmi_i2c_irq(int irq, void *dev_id) static int rmi_i2c_init_irq(struct i2c_client *client) { struct rmi_i2c_xport *rmi_i2c = i2c_get_clientdata(client); - int irq_flags = rmi_i2c->xport.pdata.irq_flags; + int irq_flags = irqd_get_trigger_type(irq_get_irq_data(rmi_i2c->irq)); int ret; if (!irq_flags) diff --git a/drivers/input/rmi4/rmi_spi.c b/drivers/input/rmi4/rmi_spi.c index 5be321cf906d..e87978d2cbbb 100644 --- a/drivers/input/rmi4/rmi_spi.c +++ b/drivers/input/rmi4/rmi_spi.c @@ -342,7 +342,7 @@ static irqreturn_t rmi_spi_irq(int irq, void *dev_id) static int rmi_spi_init_irq(struct spi_device *spi) { struct rmi_spi_xport *rmi_spi = spi_get_drvdata(spi); - int irq_flags = rmi_spi->xport.pdata.irq_flags; + int irq_flags = irqd_get_trigger_type(irq_get_irq_data(rmi_i2c->irq)); int ret; if (!irq_flags) diff --git a/include/linux/rmi.h b/include/linux/rmi.h index 7b9d15f1db06..e0aca1476001 100644 --- a/include/linux/rmi.h +++ b/include/linux/rmi.h @@ -201,15 +201,11 @@ struct rmi_device_platform_data_spi { /** * struct rmi_device_platform_data - system specific configuration info. * - * @irq_flags - this is used to specify intrerrupt type flags. - * * @reset_delay_ms - after issuing a reset command to the touch sensor, the * driver waits a few milliseconds to give the firmware a chance to * to re-initialize. You can override the default wait period here. */ struct rmi_device_platform_data { - int irq_flags; - int reset_delay_ms; struct rmi_device_platform_data_spi spi_data;