lkml.org 
[lkml]   [2022]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Allow configuration of ARCH_NR_GPIO
Date
From: Billie R Alsup <balsup@cisco.com>

Problem: Some systems support a high number of GPIO pins. Allow
the kernel builder to configure the maximum number of pins, rather
than forcing a large value on everyone.

Impact: Once a .config is generated, the ARCH_NR_GPIO setting
will persist. To return to a default setting, the CONFIG_ARCH_NR_GPIO
must be removed from .config file first.

Trade-offs: It is possible to achieve similar via command line
parameters, e.g.

make KBUILD_CFLAGS_KERNEL=-DARCH_NR_GPIOS=16384

to the build. This is problematic because the setting does not
show up in /proc/config.gz. It is also problematic for out-of-tree
module builds, which require similar if they invoke the API
gpio_is_valid(). In both cases, one could envision one system
working normally, and another failing, even though they both have
the same kernel version and /proc/config.gz. Therefore, it is
better to have the setting available in .config

Signed-off-by: Billie R Alsup <balsup@cisco.com>
---
arch/arm/Kconfig | 2 +-
arch/x86/Kconfig | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7630ba9cb6cc..7fc6e52d1d3c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1226,7 +1226,7 @@ config ARM_PSCI
# a multiplatform kernel, we just want the highest value required by the
# selected platforms.
config ARCH_NR_GPIO
- int
+ int "Maximum number of GPIOs supported"
default 2048 if ARCH_INTEL_SOCFPGA
default 1024 if ARCH_BRCMSTB || ARCH_RENESAS || ARCH_TEGRA || \
ARCH_ZYNQ || ARCH_ASPEED
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 52a7f91527fe..a59cef517f56 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -347,9 +347,13 @@ config ARCH_HIBERNATION_POSSIBLE
def_bool y

config ARCH_NR_GPIO
- int
+ int "Maximum number of GPIOs supported"
default 1024 if X86_64
default 512
+ help
+ Maximum number of GPIOs in the system.
+
+ If unsure, leave the default value.

config ARCH_SUSPEND_POSSIBLE
def_bool y
--
2.27.0
\
 
 \ /
  Last update: 2022-07-30 02:41    [W:0.073 / U:22.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site