From patchwork Fri Feb 15 12:57:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 14920 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 E5AC523E01 for ; Fri, 15 Feb 2013 12:58:34 +0000 (UTC) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by fiordland.canonical.com (Postfix) with ESMTP id 5F74DA18742 for ; Fri, 15 Feb 2013 12:58:34 +0000 (UTC) Received: by mail-vc0-f169.google.com with SMTP id n10so2187126vcn.0 for ; Fri, 15 Feb 2013 04:58:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=awJ0Tx5T4+AwJX74mf71ISLRpBWNb/8orQc/v0RKK0Y=; b=NKgKQt8m618WIZ4hkYYJGbI4ezM1vsMlh8p33W2SbiyxRIyRoOPyVQcetQozI3xZEB x9xYuWnKL882WElravnPrDpjY2XvKG6aJTGux+WMftge2CAVWhMNgK7rRarTTx7tn3Qy kbL00qDoNq0y+N1OCwiYRER3aYc2knuqodc7SLrMfyHVy3s25BWPAFSEhN0We8W/Xx2Y bktpn4JG0wAU9+ozME6EZn3K+KKCrtJ61D1by2q7jXljHykwhiA1uZa5Sl8X2svG7Zd6 YrdRGnitAJQVX1CfuCZzNgDeNOl696oetqDDZunn4LRPGrO7v8Cotzc5cy0BLGnLLIlw mPkg== X-Received: by 10.58.213.37 with SMTP id np5mr2870676vec.54.1360933113811; Fri, 15 Feb 2013 04:58:33 -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.221.4.5 with SMTP id oa5csp11446vcb; Fri, 15 Feb 2013 04:58:33 -0800 (PST) X-Received: by 10.180.83.10 with SMTP id m10mr5882481wiy.5.1360933112772; Fri, 15 Feb 2013 04:58:32 -0800 (PST) Received: from mail-we0-x230.google.com ([2a00:1450:400c:c03::230]) by mx.google.com with ESMTPS id g2si1053154wiv.49.2013.02.15.04.58.32 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:58:32 -0800 (PST) Received-SPF: neutral (google.com: 2a00:1450:400c:c03::230 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c03::230; Authentication-Results: mx.google.com; spf=neutral (google.com: 2a00:1450:400c:c03::230 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-f176.google.com with SMTP id s43so2756632wey.21 for ; Fri, 15 Feb 2013 04:58:32 -0800 (PST) X-Received: by 10.194.76.137 with SMTP id k9mr4045867wjw.29.1360933112356; Fri, 15 Feb 2013 04:58:32 -0800 (PST) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id j4sm2852410wiz.10.2013.02.15.04.58.30 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:58:31 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, sameo@linux.intel.com Cc: arnd@arndb.de, linus.walleij@stericsson.com, Dariusz Szymczak , Lee Jones Subject: [PATCH 35/35] mfd: ab8500-core: Hierarchical interrupt registers Date: Fri, 15 Feb 2013 12:57:06 +0000 Message-Id: <1360933026-30325-36-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360933026-30325-1-git-send-email-lee.jones@linaro.org> References: <1360933026-30325-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQnfjJCRtK3if48Zh25zvLyxnQ+pZevHJlQheArLh8Tg9vnPvy7wTtVz3xfok31zbxQjhLnB From: Dariusz Szymczak Make use of the hierarchical interrupt rergister called ITLatchHier1 - 3 also for the 8500 platform (currently the hierarchical interrupt registers are used only for the 8540 and 9540 platforms). This will make the interrupt routing go faster since fewer i2c reads need to made in the most common cases. Signed-off-by: Dariusz Szymczak Signed-off-by: Lee Jones Reviewed-by: Mian Yousaf KAUKAB --- drivers/mfd/ab8500-core.c | 82 ++++----------------------------------------- 1 file changed, 6 insertions(+), 76 deletions(-) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index 2716c6c..fd87e0a 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -502,66 +502,6 @@ static irqreturn_t ab8500_hierarchical_irq(int irq, void *dev) return IRQ_HANDLED; } -/** - * ab8500_irq_get_virq(): Map an interrupt on a chip to a virtual IRQ - * - * @ab8500: ab8500_irq controller to operate on. - * @irq: index of the interrupt requested in the chip IRQs - * - * Useful for drivers to request their own IRQs. - */ -static int ab8500_irq_get_virq(struct ab8500 *ab8500, int irq) -{ - if (!ab8500) - return -EINVAL; - - return irq_create_mapping(ab8500->domain, irq); -} - -static irqreturn_t ab8500_irq(int irq, void *dev) -{ - struct ab8500 *ab8500 = dev; - int i; - - dev_vdbg(ab8500->dev, "interrupt\n"); - - atomic_inc(&ab8500->transfer_ongoing); - - for (i = 0; i < ab8500->mask_size; i++) { - int regoffset = ab8500->irq_reg_offset[i]; - int status; - u8 value; - - /* - * Interrupt register 12 doesn't exist prior to AB8500 version - * 2.0 - */ - if (regoffset == 11 && is_ab8500_1p1_or_earlier(ab8500)) - continue; - - if (regoffset < 0) - continue; - - status = get_register_interruptible(ab8500, AB8500_INTERRUPT, - AB8500_IT_LATCH1_REG + regoffset, &value); - if (status < 0 || value == 0) - continue; - - do { - int bit = __ffs(value); - int line = i * 8 + bit; - int virq = ab8500_irq_get_virq(ab8500, line); - - handle_nested_irq(virq); - ab8500_debug_register_interrupt(line); - value &= ~(1 << bit); - - } while (value); - } - atomic_dec(&ab8500->transfer_ongoing); - return IRQ_HANDLED; -} - static int ab8500_irq_map(struct irq_domain *d, unsigned int virq, irq_hw_number_t hwirq) { @@ -1697,22 +1637,12 @@ static int ab8500_probe(struct platform_device *pdev) if (ret) return ret; - /* Activate this feature only in ab9540 */ - /* till tests are done on ab8500 1p2 or later*/ - if (is_ab9540(ab8500) || is_ab8540(ab8500)) - ret = devm_request_threaded_irq(&pdev->dev, ab8500->irq, NULL, - ab8500_hierarchical_irq, - IRQF_ONESHOT | IRQF_NO_SUSPEND, - "ab8500", ab8500); - } - else { - ret = devm_request_threaded_irq(&pdev->dev, ab8500->irq, NULL, - ab8500_irq, - IRQF_ONESHOT | IRQF_NO_SUSPEND, - "ab8500", ab8500); - if (ret) - return ret; - } + ret = devm_request_threaded_irq(&pdev->dev, ab8500->irq, NULL, + ab8500_hierarchical_irq, + IRQF_ONESHOT | IRQF_NO_SUSPEND, + "ab8500", ab8500); + if (ret) + return ret; if (is_ab9540(ab8500)) ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs,