From patchwork Thu Oct 11 08:11:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 1581451 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 E4E10DFABE for ; Thu, 11 Oct 2012 08:20:07 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TMDxL-0001hk-9u; Thu, 11 Oct 2012 08:17:24 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TMDsk-0006uU-EK for linux-arm-kernel@lists.infradead.org; Thu, 11 Oct 2012 08:12:39 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBP00EIPYR2YEI0@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 11 Oct 2012 17:12:37 +0900 (KST) X-AuditID: cbfee61a-b7f726d000000ec7-6d-50767f75a22b Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id F4.84.03783.57F76705; Thu, 11 Oct 2012 17:12:37 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MBP005FVYR04E50@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 11 Oct 2012 17:12:37 +0900 (KST) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 14/15] pinctrl: samsung: Add GPIO to IRQ translation Date: Thu, 11 Oct 2012 10:11:20 +0200 Message-id: <1349943081-27939-15-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.7.10 In-reply-to: <1349943081-27939-1-git-send-email-t.figa@samsung.com> References: <1349943081-27939-1-git-send-email-t.figa@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrMJMWRmVeSWpSXmKPExsVy+t9jAd3S+rIAgzOHxC02Pb7G6sDosXlJ fQBjFJdNSmpOZllqkb5dAlfG4z872Qse8FacWXKSpYFxFXcXIyeHhICJxMPWe8wQtpjEhXvr 2boYuTiEBBYxSjx58ogFwtnMJPFn+S5WkCo2ATWJzw2P2EBsEQENiSldj9lBipgFljJJbFsy ASwhLOAi8fP1YyYQm0VAVWL376tgcV4BZ4mny+exQqyTl3h6vw8szgkU/7ppBVi9kICTxNnX j9knMPIuYGRYxSiaWpBcUJyUnmuoV5yYW1yal66XnJ+7iRHs9WdSOxhXNlgcYhTgYFTi4Z24 sjRAiDWxrLgy9xCjBAezkgjv5dqyACHelMTKqtSi/Pii0pzU4kOM0hwsSuK8zR4pAUIC6Ykl qdmpqQWpRTBZJg5OqQZGexVN9jb9z/snRJyfaOmtyJamc27X1lWfWsuFtPjczjczuE7YOlno rWib0vZ3/x4G664oXaYocGGX8dy0fOcn3/5NXr1D4FfP5LMR75yuX5F96pYQNCm10kBZ51OG fqnmfm5Xo0dGaw/Jul29OaXpBs9/xccu2xZovI3q4HttnXngydxkuThOJZbijERDLeai4kQA Xl+sV/YBAAA= X-Spam-Note: CRM114 invocation failed X-Spam-Score: -9.0 (---------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-9.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.34 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -2.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: kgene.kim@samsung.com, swarren@wwwdotorg.org, tony@atomide.com, devicetree-discuss@lists.ozlabs.org, tomasz.figa@gmail.com, t.figa@samsung.com, kyungmin.park@samsung.com, linux-samsung-soc@vger.kernel.org, thomas.abraham@linaro.org, linus.walleij@linaro.org, m.szyprowski@samsung.com 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: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Some drivers require a way to translate GPIO pins to their IRQ numbers. This patch adds the .to_irq() gpiolib callback to pinctrl-samsung driver, which creates (if not present yet) and returns an IRQ mapping for given GPIO pin. Signed-off-by: Tomasz Figa --- drivers/pinctrl/pinctrl-samsung.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c index 0a38368..0db88bb 100644 --- a/drivers/pinctrl/pinctrl-samsung.c +++ b/drivers/pinctrl/pinctrl-samsung.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "core.h" #include "pinctrl-samsung.h" @@ -528,6 +529,23 @@ static int samsung_gpio_direction_output(struct gpio_chip *gc, unsigned offset, } /* + * gpiolib gpio_to_irq callback function. Creates a mapping between a GPIO pin + * and a virtual IRQ, if not already present. + */ +static int samsung_gpio_to_irq(struct gpio_chip *gc, unsigned offset) +{ + struct samsung_pin_bank *bank = gc_to_pin_bank(gc); + unsigned int virq; + + if (!bank->irq_domain) + return -ENXIO; + + virq = irq_create_mapping(bank->irq_domain, offset); + + return (virq) ? : -ENXIO; +} + +/* * Parse the pin names listed in the 'samsung,pins' property and convert it * into a list of gpio numbers are create a pin group from it. */ @@ -755,6 +773,7 @@ static const struct gpio_chip samsung_gpiolib_chip = { .get = samsung_gpio_get, .direction_input = samsung_gpio_direction_input, .direction_output = samsung_gpio_direction_output, + .to_irq = samsung_gpio_to_irq, .owner = THIS_MODULE, };