From patchwork Wed Jan 25 09:53:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 6399 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 456C823ECC for ; Wed, 25 Jan 2012 09:53:30 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 28001A1885B for ; Wed, 25 Jan 2012 09:53:30 +0000 (UTC) Received: by bkar19 with SMTP id r19so5080658bka.11 for ; Wed, 25 Jan 2012 01:53:30 -0800 (PST) Received: by 10.204.155.66 with SMTP id r2mr6532986bkw.38.1327485209806; Wed, 25 Jan 2012 01:53:29 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.204.130.220 with SMTP id u28cs3544bks; Wed, 25 Jan 2012 01:53:29 -0800 (PST) Received: by 10.14.126.202 with SMTP id b50mr5669374eei.66.1327485208240; Wed, 25 Jan 2012 01:53:28 -0800 (PST) Received: from eu1sys200aog105.obsmtp.com (eu1sys200aog105.obsmtp.com. [207.126.144.119]) by mx.google.com with SMTP id z18si11344128eeh.205.2012.01.25.01.53.22 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Jan 2012 01:53:28 -0800 (PST) Received-SPF: neutral (google.com: 207.126.144.119 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.119; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.119 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob105.postini.com ([207.126.147.11]) with SMTP ID DSNKTx/REjYt1TBdNi03GhV0QwWx9BlMEXLA@postini.com; Wed, 25 Jan 2012 09:53:27 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id D3E9FC6; Wed, 25 Jan 2012 09:44:50 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 6FD0DBF9; Wed, 25 Jan 2012 09:53:17 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id A056224C2AB; Wed, 25 Jan 2012 10:53:11 +0100 (CET) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.83.0; Wed, 25 Jan 2012 10:53:16 +0100 From: Linus Walleij To: Samuel Ortiz , Cc: Viresh Kumar , Chris Blair , Grant Likely Subject: [PATCH v2] gpio/stmpe: support no-irq mode Date: Wed, 25 Jan 2012 10:53:09 +0100 Message-ID: <1327485189-15522-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.8 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQl/zt/TqoMiOz51OOprk6Oo1RzWtKioPsUvvBmg8KGIVvyHdrG0LxHyV9t8IIng9G5nyV8l From: Chris Blair Adds support for boards which have an STMPE GPIO device without the interrupt pin connected. This means that no interrupt can be received but the GPIO pins can still be driven and read. Cc: Grant Likely Acked-by: Viresh Kumar Tested-by: Michel Jaouen Signed-off-by: Chris Blair --- This depends on the previous patch to the MFD code so should better be merged into the MFD tree with the previous patch. --- drivers/gpio/gpio-stmpe.c | 40 ++++++++++++++++++++++++---------------- 1 files changed, 24 insertions(+), 16 deletions(-) diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index 87a68a8..c747929 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c @@ -307,13 +307,15 @@ static int __devinit stmpe_gpio_probe(struct platform_device *pdev) struct stmpe_gpio_platform_data *pdata; struct stmpe_gpio *stmpe_gpio; int ret; - int irq; + int irq = 0; pdata = stmpe->pdata->gpio; - irq = platform_get_irq(pdev, 0); - if (irq < 0) - return irq; + if (!stmpe->pdata->no_irq) { + irq = platform_get_irq(pdev, 0); + if (irq < 0) + return irq; + } stmpe_gpio = kzalloc(sizeof(struct stmpe_gpio), GFP_KERNEL); if (!stmpe_gpio) @@ -336,15 +338,17 @@ static int __devinit stmpe_gpio_probe(struct platform_device *pdev) if (ret) goto out_free; - ret = stmpe_gpio_irq_init(stmpe_gpio); - if (ret) - goto out_disable; + if (!stmpe->pdata->no_irq) { + ret = stmpe_gpio_irq_init(stmpe_gpio); + if (ret) + goto out_disable; - ret = request_threaded_irq(irq, NULL, stmpe_gpio_irq, IRQF_ONESHOT, - "stmpe-gpio", stmpe_gpio); - if (ret) { - dev_err(&pdev->dev, "unable to get irq: %d\n", ret); - goto out_removeirq; + ret = request_threaded_irq(irq, NULL, stmpe_gpio_irq, + IRQF_ONESHOT, "stmpe-gpio", stmpe_gpio); + if (ret) { + dev_err(&pdev->dev, "unable to get irq: %d\n", ret); + goto out_removeirq; + } } ret = gpiochip_add(&stmpe_gpio->chip); @@ -361,9 +365,11 @@ static int __devinit stmpe_gpio_probe(struct platform_device *pdev) return 0; out_freeirq: - free_irq(irq, stmpe_gpio); + if (!stmpe->pdata->no_irq) + free_irq(irq, stmpe_gpio); out_removeirq: - stmpe_gpio_irq_remove(stmpe_gpio); + if (!stmpe->pdata->no_irq) + stmpe_gpio_irq_remove(stmpe_gpio); out_disable: stmpe_disable(stmpe, STMPE_BLOCK_GPIO); out_free: @@ -391,8 +397,10 @@ static int __devexit stmpe_gpio_remove(struct platform_device *pdev) stmpe_disable(stmpe, STMPE_BLOCK_GPIO); - free_irq(irq, stmpe_gpio); - stmpe_gpio_irq_remove(stmpe_gpio); + if (!stmpe->pdata->no_irq) { + free_irq(irq, stmpe_gpio); + stmpe_gpio_irq_remove(stmpe_gpio); + } platform_set_drvdata(pdev, NULL); kfree(stmpe_gpio);