Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp933089pxp; Wed, 16 Mar 2022 21:47:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyer7TA8NKMLuPL3p+NAA858G4pGJR8tiJSqxXNeiP159iba53/on0tRf3QdLVO1/mAix3d X-Received: by 2002:a17:902:b406:b0:14f:bb35:95ab with SMTP id x6-20020a170902b40600b0014fbb3595abmr2944389plr.140.1647492453407; Wed, 16 Mar 2022 21:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647492453; cv=none; d=google.com; s=arc-20160816; b=F7AtXc0gslwA7vHtY05M3uuBlP428LYAlWJWCLLjGlZNFHfxF7VmRfowv/UaAX6res a8vg0ZxZ0iKb2T9wE6se06d3cztbec5ry4IShRZA0gLpBvvOBLxghpoIPtzXzuUUxZZL dkODW8KPZ3p7PdAr4Ig3ZxQy73m+X18oY0sOmK97ubpuOQBpc/73Un4vpHIs/BoARKH5 m/2R1tF4mLPctYhMk7Os0ZWTXOaFoQ8jDjTkwLZwDqInLo4W86oYx8XPBN929dzFZrXd ytk2FZPCVk7z8fDGuXd9+AYKLdvJnguj9z5S0LBsuo471rQb/7HRkGhgijwkDO1nuXrV XC+Q== 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=jNl+yOJ5JFoudrGbmGg8Z2tvKr4s8RSAz/vgIjqCLxc=; b=NekguAAF6lSF0DAbYee0aiUFJPyNle65uk346VDK4n5E6gwGP3+XVb3ST3WUqpTcds D2PHqoodhIk7SnyoZrC6tjtk3Njc2uCx2wusdbRXOll2yFkOWsNlZv/l9ttzOsGjc7uz j3ZnjMt7PcorhxYGB4xJmdkvXALqpY9XAy+west/pvXMDG5rSqJo6Wc7jz3uUgxwD/l3 u4V/jibuXIlU3rkeiZqT6+DEzp9qtpja7u/06XnNpeih3jc0M09c4t4RT0AvOLpytq+F V5ingiJYO+5ppCKtHdtx8IuomTR6n/sIcHm/e9pJliUrBypWQHIPG/J2Ua2N6WAYVI1R nfxQ== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k2-20020a63ab42000000b003816043ef09si1200794pgp.254.2022.03.16.21.47.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 21:47:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=renesas.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EC7F26140; Wed, 16 Mar 2022 21:08:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358272AbiCQBZs (ORCPT + 99 others); Wed, 16 Mar 2022 21:25:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358265AbiCQBZp (ORCPT ); Wed, 16 Mar 2022 21:25:45 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6CC7B1EAC8; Wed, 16 Mar 2022 18:24:24 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.90,188,1643641200"; d="scan'208";a="114675307" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 17 Mar 2022 10:24:24 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 76F4F41A4262; Thu, 17 Mar 2022 10:24:21 +0900 (JST) From: Lad Prabhakar To: Thomas Gleixner , Marc Zyngier , Rob Herring , Linus Walleij , Bartosz Golaszewski , Geert Uytterhoeven , Philipp Zabel Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar , Biju Das , Lad Prabhakar Subject: [RFC PATCH v4 4/5] gpio: gpiolib: Add ngirq member to struct gpio_irq_chip Date: Thu, 17 Mar 2022 01:24:03 +0000 Message-Id: <20220317012404.8069-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220317012404.8069-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20220317012404.8069-1-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 aede442f610d..8784d11f8a15 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); @@ -1564,7 +1564,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 b0728c8ad90c..eada90d59657 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.17.1