From patchwork Tue Aug 14 04:18:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 1317881 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 7BD4CDF266 for ; Tue, 14 Aug 2012 04:22:01 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1T18aW-0006B4-8G; Tue, 14 Aug 2012 04:18:40 +0000 Received: from ch1ehsobe006.messaging.microsoft.com ([216.32.181.186] helo=ch1outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T18Zg-0006Aq-Qt for linux-arm-kernel@lists.infradead.org; Tue, 14 Aug 2012 04:17:51 +0000 Received: from mail31-ch1-R.bigfish.com (10.43.68.232) by CH1EHSOBE004.bigfish.com (10.43.70.54) with Microsoft SMTP Server id 14.1.225.23; Tue, 14 Aug 2012 04:17:46 +0000 Received: from mail31-ch1 (localhost [127.0.0.1]) by mail31-ch1-R.bigfish.com (Postfix) with ESMTP id EF198300320; Tue, 14 Aug 2012 04:17:45 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: -2 X-BigFish: VS-2(zz98dI1432Izz1202hzzz2dh87h2a8h668h839h944hd25he96hf0ah107ah) X-FB-DOMAIN-IP-MATCH: fail Received: from mail31-ch1 (localhost.localdomain [127.0.0.1]) by mail31-ch1 (MessageSwitch) id 1344917863729938_17384; Tue, 14 Aug 2012 04:17:43 +0000 (UTC) Received: from CH1EHSMHS003.bigfish.com (snatpool2.int.messaging.microsoft.com [10.43.68.230]) by mail31-ch1.bigfish.com (Postfix) with ESMTP id ADC6B420048; Tue, 14 Aug 2012 04:17:43 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS003.bigfish.com (10.43.70.3) with Microsoft SMTP Server (TLS) id 14.1.225.23; Tue, 14 Aug 2012 04:17:43 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server (TLS) id 14.2.298.5; Mon, 13 Aug 2012 23:17:42 -0500 Received: from S2101-09.ap.freescale.net ([10.192.185.14]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id q7E4HeTx018479; Mon, 13 Aug 2012 21:17:41 -0700 Date: Tue, 14 Aug 2012 12:18:43 +0800 From: Shawn Guo To: Knut Wohlrab Subject: Re: How to define gpio irq with device tree Message-ID: <20120814041841.GA30782@S2101-09.ap.freescale.net> References: <5024FF03.1070805@de.bosch.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5024FF03.1070805@de.bosch.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-OriginatorOrg: sigmatel.com X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [216.32.181.186 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: "linux-arm-kernel@lists.infradead.org >> \"linux-arm-kernel@lists.infradead.org\"" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Fri, Aug 10, 2012 at 02:30:59PM +0200, Knut Wohlrab wrote: > Hello, > > I try the touch screen of a iMX6 SabreLite evaluation board. The > used eGalax touch controller worked fine with a 3.2.x kernel [1]. As > mentioned there [2] I merge the basic device tree support to the > actual driver (see patch [4]) and add the touch definition to > arch/arm/boot/dts/imx6q-sabrelite.dts [3]. > > The driver seems to start but the interrupt never occurs. > > The pinmux and I2C configuration seems correct. I did a simple test > with polling the interrupt gpio (see "POLLTEST" in patch [4]) and > got coordinates matching to the movements on the screen. > > How to configure the gpio irq correctly? > > Anybody solved to work with the eGalax touch and iMX6 SabreLite with > kernel > 3.2? > I'm not interested in reviewing those out-of-tree codes to see what goes wrong there. But I just quickly enabled the driver for imx6q-sabrelite board with the following changes against latest mainline. And the interrupt seems working for me. Regards, Shawn --8<--- diff --git a/arch/arm/boot/dts/imx6q-sabrelite.dts b/arch/arm/boot/dts/imx6q-sabrelite.dts index 72f30f3..c8511c1 100644 --- a/arch/arm/boot/dts/imx6q-sabrelite.dts +++ b/arch/arm/boot/dts/imx6q-sabrelite.dts @@ -115,6 +115,21 @@ VDDIO-supply = <®_3p3v>; }; }; + + i2c@021a8000 { /* I2C3 */ + status = "okay"; + clock-frequency = <400000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c3_1>; + + egalax@04 { + compatible = "eeti,egalax"; + reg = <0x04>; + interrupt-parent = <&gpio1>; + interrupts = <9 0x8>; + wakeup-gpios = <&gpio1 9 0>; + }; + }; }; }; diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi index 3d3c64b..bbf5196 100644 --- a/arch/arm/boot/dts/imx6q.dtsi +++ b/arch/arm/boot/dts/imx6q.dtsi @@ -545,6 +545,13 @@ }; }; + i2c3 { + pinctrl_i2c3_1: i2c3grp-1 { + fsl,pins = <1013 0x4001b8b1 /* MX6Q_PAD_GPIO_5__I2C3_SCL */ + 1037 0x4001b8b1>; /* MX6Q_PAD_GPIO_16__I2C3_SDA */ + }; + }; + serial2 { pinctrl_serial2_1: serial2grp-1 { fsl,pins = <183 0x1b0b1 /* MX6Q_PAD_EIM_D26__UART2_TXD */ diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c index 70524dd..013011d 100644 --- a/drivers/input/touchscreen/egalax_ts.c +++ b/drivers/input/touchscreen/egalax_ts.c @@ -28,6 +28,8 @@ #include #include #include +#include +#include /* * Mouse Mode: some panel may configure the controller to mouse mode, @@ -122,7 +124,7 @@ static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id) /* wake up controller by an falling edge of interrupt gpio. */ static int egalax_wake_up_device(struct i2c_client *client) { - int gpio = irq_to_gpio(client->irq); + int gpio = of_get_named_gpio(client->dev.of_node, "wakeup-gpios", 0); int ret; ret = gpio_request(gpio, "egalax_irq"); @@ -251,6 +253,12 @@ static const struct i2c_device_id egalax_ts_id[] = { }; MODULE_DEVICE_TABLE(i2c, egalax_ts_id); +static struct of_device_id egalax_ts_dt_ids[] = { + { .compatible = "eeti,egalax" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, egalax_ts_dt_ids); + #ifdef CONFIG_PM_SLEEP static int egalax_ts_suspend(struct device *dev) { @@ -279,6 +287,7 @@ static struct i2c_driver egalax_ts_driver = { .name = "egalax_ts", .owner = THIS_MODULE, .pm = &egalax_ts_pm_ops, + .of_match_table = egalax_ts_dt_ids, }, .id_table = egalax_ts_id, .probe = egalax_ts_probe,