From patchwork Fri Dec 14 16:19:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 13605 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 96FAE23FB4 for ; Fri, 14 Dec 2012 16:20:19 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 2CCB4A195DC for ; Fri, 14 Dec 2012 16:20:19 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so3226481iag.11 for ; Fri, 14 Dec 2012 08:20:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=8f2UBljt5oZP3d/kalgLQmjFfwCOPxkffhRU/6JdAmE=; b=c3cTsmbx2PntKJRwZMs+n4kJyy/GCmbsObZTK9sC4nMpqtUNwDNjNfjSNzBqtgq+uw 880nkaXoknHyEpaiLISfPzExu7foDjKnR4JT7NUTaOUAXt2MWxQa0lr2OXB7Iou7wHMO 8xfxWFszFRWxpaivGKPYiC1dN6aQFD0zYpnRjMknjTLT53U6d8tL/xkmtGRKLQehwArw NGUjrIeiwBAkuzLXNVEKCy/NNI3O05xGZQ3tOYERcOi37U6KLEiRKMQHkgA2QooNzDHy y+PR/F+h1hTto1JsZA8G0V+gc/lNhmKg9JyBNkSOHnZCJvWwrd4CPgKA9t2H3Kj2waDz hMsg== Received: by 10.50.185.166 with SMTP id fd6mr1994325igc.62.1355502017852; Fri, 14 Dec 2012 08:20:17 -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.50.67.148 with SMTP id n20csp81615igt; Fri, 14 Dec 2012 08:20:17 -0800 (PST) Received: by 10.194.78.162 with SMTP id c2mr4411384wjx.46.1355502016702; Fri, 14 Dec 2012 08:20:16 -0800 (PST) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) by mx.google.com with ESMTPS id en6si3731208wjd.50.2012.12.14.08.20.16 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Dec 2012 08:20:16 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.181 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.181; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.181 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-we0-f181.google.com with SMTP id t11so1664495wey.12 for ; Fri, 14 Dec 2012 08:20:16 -0800 (PST) Received: by 10.194.7.104 with SMTP id i8mr4501381wja.27.1355502016227; Fri, 14 Dec 2012 08:20:16 -0800 (PST) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id u6sm8325248wif.2.2012.12.14.08.20.14 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Dec 2012 08:20:15 -0800 (PST) From: Lee Jones To: linux-kernel@vger.kernel.org Cc: linus.walleij@linaro.org, Yang QU , Lee Jones Subject: [PATCH 19/21] gpio: ab8500: Update gpio ab8540 interrupt mapping Date: Fri, 14 Dec 2012 16:19:37 +0000 Message-Id: <1355501979-1157-20-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1355501979-1157-1-git-send-email-lee.jones@linaro.org> References: <1355501979-1157-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQl0KQRel5FX2rKpnXk4rlnoilrWsTsX1UAohysVyr8XOZRcpxqfUs9Eo3ZYpuqhw1cc4/Ix From: Yang QU Add some GPIOs used as interrupt on ab8540 and modify the setting strategy of the interrupt line. Signed-off-by: Lee Jones Signed-off-by: Yang QU Reviewed-by: Rabin VINCENT Reviewed-by: Xiao Mei ZHANG Tested-by: Yang QU --- drivers/gpio/gpio-ab8500.c | 50 +++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/drivers/gpio/gpio-ab8500.c b/drivers/gpio/gpio-ab8500.c index 833d4c2..edc3037 100644 --- a/drivers/gpio/gpio-ab8500.c +++ b/drivers/gpio/gpio-ab8500.c @@ -98,6 +98,7 @@ enum ab8500_gpio_action { struct ab8500_gpio_irq_cluster { int start; int end; + int offset; }; struct ab8500_gpio { @@ -155,10 +156,12 @@ static struct ab8500_gpio_irq_cluster ab8505_irq_clusters[] = { /* * For AB8540 Only some GPIOs are interrupt capable: + * GPIO43 to GPIO44 * GPIO51 to GPIO54 */ static struct ab8500_gpio_irq_cluster ab8540_irq_clusters[] = { - {.start = 50, .end = 53}, /* GPIO numbers start from 1 */ + {.start = 42, .end = 43, .offset = 2}, /* GPIO numbers start from 1 */ + {.start = 50, .end = 53}, }; @@ -253,7 +256,7 @@ static int ab8500_gpio_to_irq(struct gpio_chip *chip, unsigned offset) return base + offset - cluster->start; /* Advance by the number of gpios in this cluster */ - base += cluster->end - cluster->start + 1; + base += cluster->end + cluster->offset - cluster->start + 1; } return -EINVAL; @@ -273,7 +276,12 @@ static unsigned int irq_to_rising(unsigned int irq) { struct ab8500_gpio *ab8500_gpio = irq_get_chip_data(irq); int offset = irq - ab8500_gpio->irq_base; - int new_irq = offset + AB8500_INT_GPIO6R + int new_irq; + if (is_ab8540(ab8500_gpio->parent)) { + new_irq = offset * 2 + AB8540_INT_GPIO43R + + ab8500_gpio->parent->irq_base; + } else + new_irq = offset + AB8500_INT_GPIO6R + ab8500_gpio->parent->irq_base; return new_irq; } @@ -282,8 +290,13 @@ static unsigned int irq_to_falling(unsigned int irq) { struct ab8500_gpio *ab8500_gpio = irq_get_chip_data(irq); int offset = irq - ab8500_gpio->irq_base; - int new_irq = offset + AB8500_INT_GPIO6F - + ab8500_gpio->parent->irq_base; + int new_irq; + if (is_ab8540(ab8500_gpio->parent)) { + new_irq = offset * 2 + AB8540_INT_GPIO43F + + ab8500_gpio->parent->irq_base; + } else + new_irq = offset + AB8500_INT_GPIO6F + + ab8500_gpio->parent->irq_base; return new_irq; } @@ -291,20 +304,33 @@ static unsigned int irq_to_falling(unsigned int irq) static unsigned int rising_to_irq(unsigned int irq, void *dev) { struct ab8500_gpio *ab8500_gpio = dev; - int offset = irq - AB8500_INT_GPIO6R - - ab8500_gpio->parent->irq_base ; - int new_irq = offset + ab8500_gpio->irq_base; + int offset, new_irq; + if (is_ab8540(ab8500_gpio->parent)) { + offset = irq - AB8540_INT_GPIO43R + - ab8500_gpio->parent->irq_base; + new_irq = (offset >> 1) + ab8500_gpio->irq_base; + } else { + offset = irq - AB8500_INT_GPIO6R + - ab8500_gpio->parent->irq_base; + new_irq = offset + ab8500_gpio->irq_base; + } return new_irq; } static unsigned int falling_to_irq(unsigned int irq, void *dev) { struct ab8500_gpio *ab8500_gpio = dev; - int offset = irq - AB8500_INT_GPIO6F - - ab8500_gpio->parent->irq_base ; - int new_irq = offset + ab8500_gpio->irq_base; + int offset, new_irq; + if (is_ab8540(ab8500_gpio->parent)) { + offset = irq - AB8540_INT_GPIO43F + - ab8500_gpio->parent->irq_base; + new_irq = (offset >> 1) + ab8500_gpio->irq_base; + } else { + offset = irq - AB8500_INT_GPIO6F + - ab8500_gpio->parent->irq_base; + new_irq = offset + ab8500_gpio->irq_base; + } return new_irq; - } /*