Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp767625iob; Wed, 18 May 2022 12:30:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvyprn9AJeuOsQvRhB6Dj5bWQ8CHyC0RjCr+jKi8A4VcWrpSFv6JDQa8QXrrtmKlLM6a3i X-Received: by 2002:a17:902:8ecc:b0:15e:f63f:233f with SMTP id x12-20020a1709028ecc00b0015ef63f233fmr1201475plo.86.1652902223391; Wed, 18 May 2022 12:30:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652902223; cv=none; d=google.com; s=arc-20160816; b=tqKSnMY7PSuPXy7EcJnaxDdV5V7AY6A3JZv9bU5zOz+ZM7wYsjk4wUQ4IWGfBnfNB9 PgtS0lyUfx9S8jbbDPWLVUIp71pZk/TZitFB6XoMgTJemcABGHp8du7Zl/Sb0jERR2Nx kqshTNHbnMzYctg5RkUcwPLiRqH0ceylCJ5FPDm/SJbHGs9KmfHeNt+ep+adN83Ef5Vw rtcB+1xs2zzlUL4mhWz5Fr+V+jXrZ2ULrJJqQF+XGiI6MFUSTWiw1yEJ+ogDFQ+S1epR Y5UKnQPdrsFMCI/MCHnfrk68Uu3+Jth2OK1SHY03/KBYuhT3K66ZfZ+M4skIMLJdhLj4 NTUA== 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=Y8JS8MJT06ar4+4yFMK2WD865cTX43nd6SdsMJePwKw=; b=b19ZQS3rcpI5yiP/H/UclE6mIc9pU4rKKp9wxGkoLvRXV9wURVjxPLyZycnSbr01Rw 4GZq80k4ayDaVEfuqhV4TVj3EIxRUiCqoOx9WeJmesWHWi4OozZcgBNfwcXivH5IUIJ/ OukmYGMjYbZx/wkVYy0rm5Vf9ajdIhh0OBDiBtTR0ibe87OgxstHZd8kS8C6BU3orFrl HWiDlzOJBIU2if1q97aPbkeP4GTsFwov5ynScsJASo2+HMlj56bCQzVPDy4a8Uv9ilKt pGTNe35psO5/3G8aquc05DZYlZodphf2WszKCyk845KeiVOfeifPXWr8x4no7BqHJXP3 iakg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id d4-20020a056a00244400b005104bf71586si4536068pfj.278.2022.05.18.12.30.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 12:30:23 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 F14191BB995; Wed, 18 May 2022 12:30:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241996AbiERTaN (ORCPT + 99 others); Wed, 18 May 2022 15:30:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241926AbiERTaK (ORCPT ); Wed, 18 May 2022 15:30:10 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EBEF11BDD88; Wed, 18 May 2022 12:30:08 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.91,235,1647270000"; d="scan'208";a="121409036" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 19 May 2022 04:30:08 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 29E3A4004CF5; Thu, 19 May 2022 04:30:00 +0900 (JST) From: Lad Prabhakar To: Marc Zyngier , Geert Uytterhoeven , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Linus Walleij , Bartosz Golaszewski , Thierry Reding , Jonathan Hunter , Bjorn Andersson , Andy Gross , Philipp Zabel , Andy Shevchenko , linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Prabhakar , linux-renesas-soc@vger.kernel.org, Phil Edworthy , Biju Das , Lad Prabhakar Subject: [PATCH v4 3/7] gpio: gpiolib: Add ngirq member to struct gpio_irq_chip Date: Wed, 18 May 2022 20:29:20 +0100 Message-Id: <20220518192924.20948-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220518192924.20948-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20220518192924.20948-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 given 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 690035124faa..43dbc4ee9d67 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1218,7 +1218,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); @@ -1578,7 +1578,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 cb689264f3e9..4ec3f010df7c 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. If not set, ngpio will be used. + */ + u16 ngirq; + #ifdef CONFIG_IRQ_DOMAIN_HIERARCHY /** * @fwnode: -- 2.25.1