Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp871557iob; Thu, 12 May 2022 06:30:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6E6qeIj7/qMZCQAyJ/lZI/tpRsh8zhRWqAwKf9VXAi7LTZicgWCoL618VfwnZDGQw3JFL X-Received: by 2002:a17:902:e844:b0:15e:b2f4:497e with SMTP id t4-20020a170902e84400b0015eb2f4497emr29273524plg.43.1652362234933; Thu, 12 May 2022 06:30:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652362234; cv=none; d=google.com; s=arc-20160816; b=m00y9YREYGPqTUqJoHe3Zb2gv38WNZ5fbAi+sv10havq/6CrVqSJJV+mDLfV+EWdDJ +ApzlkzNX5q4BpyYc9FTJE3dZt5/94TLtmsDRZ7c1AAGd53EzLk24M1jZSByZYY4j+H6 OGUjstw2OILUp+KkNDF0E87vaIbVf03++nJzNVmE4tgbQ9uX5QJLeJp3IwjahNOq8g1i Q6rlfGAGQ8X/hDdmJoIk6LYhl3H0NrEZSyt0+h/xIQBFdhG9NPxpe3/Of+S5W9itR4jY i9TL0Z0aDDSSKV+p3Vx+8lqTIlfWppYbh886IY6KDvBAOh5UXbQtNDTSqPJBmpRlciVw 1w2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=lnbKFkYjgh51LyvsBrZ6BV4l8C2CbP45CBt0vhgxYZ0=; b=n2RuL6T7uyhGiPsNtMpcfjbj1fu0lJVlu14EWFausIBOTfSQiDvVwbZmvbnocfJXbX A7Auy9UC4/UKpljoguLCxFyPYG3MvdLRnYUOGN/J2kWP8JxItv/ojpdowc1PUAay2YQ7 vsdYkA22FIrVS4MiQjaQh8l1LX8V/kB3LTsjsPlrMe1p2o7YeWZhQeMQOIpf+W4BI0DU LqfVmQfeFUxnIVO0xSMQBEe0aWBrC5L+pyiaHOJXMW5euo2qLqdkA9/88YPq0LzlDap6 Ye7IVFf5vNTDgA/EhyzgULbUzQgqPx24qhK20kdbguMO3nNgaYfz0mb9uDCJ1zYWG5AJ Gksw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j129-20020a636e87000000b003990deab146si3499316pgc.595.2022.05.12.06.30.21; Thu, 12 May 2022 06:30:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240309AbiEKScv (ORCPT + 99 others); Wed, 11 May 2022 14:32:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346327AbiEKScs (ORCPT ); Wed, 11 May 2022 14:32:48 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 250AF4092D; Wed, 11 May 2022 11:32:43 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.91,217,1647270000"; d="scan'208";a="119387764" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 12 May 2022 03:32:42 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id D915C40065C7; Thu, 12 May 2022 03:32:37 +0900 (JST) From: Lad Prabhakar To: Geert Uytterhoeven , Linus Walleij , Thomas Gleixner , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Bartosz Golaszewski , Philipp Zabel , linux-gpio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, Phil Edworthy , Biju Das , Prabhakar , Lad Prabhakar Subject: [PATCH v3 4/5] gpio: gpiolib: Add ngirq member to struct gpio_irq_chip Date: Wed, 11 May 2022 19:32:09 +0100 Message-Id: <20220511183210.5248-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220511183210.5248-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20220511183210.5248-1-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Supported GPIO IRQs by the chip is not always equal to the number of GPIO pins. For example on Renesas RZ/G2L SoC where it has GPIO0-122 pins but at a give point a maximum of only 32 GPIO pins can be used as IRQ lines in the IRQC domain. This patch adds ngirq member to struct gpio_irq_chip and passes this as a size to irq_domain_create_hierarchy()/irq_domain_create_simple() if it is being set in the driver otherwise fallbacks to using ngpio. Signed-off-by: Lad Prabhakar --- drivers/gpio/gpiolib.c | 4 ++-- include/linux/gpio/driver.h | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index d36c4a965efc..a98877f939ea 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1221,7 +1221,7 @@ static int gpiochip_hierarchy_add_domain(struct gpio_chip *gc) gc->irq.domain = irq_domain_create_hierarchy( gc->irq.parent_domain, 0, - gc->ngpio, + gc->irq.ngirq ?: gc->ngpio, gc->irq.fwnode, &gc->irq.child_irq_domain_ops, gc); @@ -1574,7 +1574,7 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc, } else { /* Some drivers provide custom irqdomain ops */ gc->irq.domain = irq_domain_create_simple(fwnode, - gc->ngpio, + gc->irq.ngirq ?: gc->ngpio, gc->irq.first, gc->irq.domain_ops ?: &gpiochip_domain_ops, gc); diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index 874aabd270c9..ed6df186907d 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -51,6 +51,14 @@ struct gpio_irq_chip { */ const struct irq_domain_ops *domain_ops; + /** + * @ngirq: + * + * The number of GPIO IRQ's handled by this IRQ domain; usually is + * equal to ngpio. + */ + u16 ngirq; + #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY /** * @fwnode: -- 2.25.1