git: 8c7a3ccf54f9 - main - gpio: add Intel Alder Lake-N GPIO driver

Corvin Köhne <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a742ce6.31fa0.f84860d__40007.4835911923$1785998671$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by corvink:

URL: https://cgit.FreeBSD.org/src/commit/?id=8c7a3ccf54f93330830ef9ffd20e71d5834936ed

commit 8c7a3ccf54f93330830ef9ffd20e71d5834936ed
Author:     YannickV <[email protected]>
AuthorDate: 2026-04-29 13:02:08 +0000
Commit:     Corvin Köhne <[email protected]>
CommitDate: 2026-08-06 06:41:54 +0000

    gpio: add Intel Alder Lake-N GPIO driver
    
    Add a GPIO driver for the Intel Alder Lake-N platform based on the generic
    intelgpio framework. The driver provides pad group definitions for four GPIO
    communities covering groups GPP_A through GPP_T, vGPIO and HVCMOS, and matches
    ACPI hardware IDs INTC1056, INTC1057 and INTC1085. The kernel module build
    infrastructure and the wiring into files.x86 are included.
    
    Reviewed by:            vexeduxr
    MFC after:              1 week
    Sponsored by:           Beckhoff Automation GmbH & Co. KG
    Pull Request:           https://github.com/freebsd/freebsd-src/pull/2205
---
 sys/conf/files.x86            |  2 +
 sys/dev/gpio/intel/adlngpio.c | 94 +++++++++++++++++++++++++++++++++++++++++++
 sys/modules/Makefile          |  2 +
 sys/modules/adlngpio/Makefile |  6 +++
 4 files changed, 104 insertions(+)

diff --git a/sys/conf/files.x86 b/sys/conf/files.x86
index 8c02edbb6a35..c5048ae9a38d 100644
--- a/sys/conf/files.x86
+++ b/sys/conf/files.x86
@@ -99,6 +99,8 @@ dev/fdc/fdc_acpi.c		optional	fdc
 dev/fdc/fdc_isa.c		optional	fdc isa
 dev/gpio/bytgpio.c		optional	bytgpio
 dev/gpio/chvgpio.c		optional	chvgpio
+dev/gpio/intel/adlngpio.c	optional	adlngpio
+dev/gpio/intel/intelgpio.c	optional	adlngpio
 dev/hpt27xx/hpt27xx_os_bsd.c	optional	hpt27xx
 dev/hpt27xx/hpt27xx_osm_bsd.c	optional	hpt27xx
 dev/hpt27xx/hpt27xx_config.c	optional	hpt27xx
diff --git a/sys/dev/gpio/intel/adlngpio.c b/sys/dev/gpio/intel/adlngpio.c
new file mode 100644
index 000000000000..55e903c95aaa
--- /dev/null
+++ b/sys/dev/gpio/intel/adlngpio.c
@@ -0,0 +1,94 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2026 Beckhoff Automation GmbH & Co. KG
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/gpio.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+
+#include <contrib/dev/acpica/include/acpi.h>
+
+#include <dev/acpica/acpivar.h>
+#include <dev/gpio/gpiobusvar.h>
+
+#include "intelgpio.h"
+
+#include "gpio_if.h"
+#include "opt_acpi.h"
+
+static const struct intelgpio_padgroup adln_com0_groups[] = {
+	{ .first_pad = 0, .npads = 26, .gpio_base = 0, .name = "GPP_B" },
+	{ .first_pad = 26, .npads = 16, .gpio_base = 32, .name = "GPP_T" },
+	{ .first_pad = 42, .npads = 25, .gpio_base = 64, .name = "GPP_A" },
+};
+
+static const struct intelgpio_padgroup adln_com1_groups[] = {
+	{ .first_pad = 67, .npads = 8, .gpio_base = 96, .name = "GPP_S" },
+	{ .first_pad = 75, .npads = 20, .gpio_base = 128, .name = "GPP_I" },
+	{ .first_pad = 95, .npads = 24, .gpio_base = 160, .name = "GPP_H" },
+	{ .first_pad = 119, .npads = 21, .gpio_base = 192, .name = "GPP_D" },
+	{ .first_pad = 140, .npads = 29, .gpio_base = 224, .name = "vGPIO" },
+};
+
+static const struct intelgpio_padgroup adln_com4_groups[] = {
+	{ .first_pad = 169, .npads = 24, .gpio_base = 256, .name = "GPP_C" },
+	{ .first_pad = 193, .npads = 25, .gpio_base = 288, .name = "GPP_F" },
+	{ .first_pad = 218,
+	    .npads = 6,
+	    .gpio_base = INTELGPIO_GPIO_NOMAP,
+	    .name = "HVCMOS" },
+	{ .first_pad = 224, .npads = 25, .gpio_base = 320, .name = "GPP_E" },
+};
+
+static const struct intelgpio_padgroup adln_com5_groups[] = {
+	{ .first_pad = 249, .npads = 8, .gpio_base = 352, .name = "GPP_R" },
+};
+
+static const struct intelgpio_community adln_communities[] = {
+	{ .ngroups = nitems(adln_com0_groups), .groups = adln_com0_groups },
+	{ .ngroups = nitems(adln_com1_groups), .groups = adln_com1_groups },
+	{ .ngroups = nitems(adln_com4_groups), .groups = adln_com4_groups },
+	{ .ngroups = nitems(adln_com5_groups), .groups = adln_com5_groups },
+};
+
+static char *adln_hids[] = { "INTC1056", "INTC1057", "INTC1085", NULL };
+
+static const struct intelgpio_platform adln_platform = {
+	.communities = adln_communities,
+	.ncommunities = nitems(adln_communities),
+	.hids = adln_hids,
+	.desc = "Intel Alder Lake-N GPIO",
+};
+
+static int
+adln_probe(device_t dev)
+{
+	return (intelgpio_probe(dev, &adln_platform));
+}
+
+static int
+adln_attach(device_t dev)
+{
+	return (intelgpio_attach(dev, &adln_platform));
+}
+
+static device_method_t adln_methods[] = {
+	DEVMETHOD(device_probe, adln_probe),
+	DEVMETHOD(device_attach, adln_attach),
+
+	DEVMETHOD_END
+};
+
+DEFINE_CLASS_1(gpio, adln_driver, adln_methods,
+    sizeof(struct intelgpio_softc), intelgpio_driver);
+
+DRIVER_MODULE(adlngpio, acpi, adln_driver, NULL, NULL);
+MODULE_DEPEND(adlngpio, acpi, 1, 1, 1);
+MODULE_DEPEND(adlngpio, gpiobus, 1, 1, 1);
+MODULE_VERSION(adlngpio, 1);
+ACPI_PNP_INFO(adln_hids);
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index df4cb4b63ded..bf2fda77ab1d 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -73,6 +73,7 @@ SUBDIR=	\
 	bridgestp \
 	bwi \
 	bwn \
+	${_adlngpio} \
 	${_bytgpio} \
 	${_chvgpio} \
 	cam \
@@ -797,6 +798,7 @@ _wdatwd=	wdatwd
 
 _aac=		aac
 _aacraid=	aacraid
+_adlngpio=	adlngpio
 .if ${MK_CRYPT} != "no" || defined(ALL_MODULES)
 _aesni=		aesni
 .endif
diff --git a/sys/modules/adlngpio/Makefile b/sys/modules/adlngpio/Makefile
new file mode 100644
index 000000000000..c1a276198efa
--- /dev/null
+++ b/sys/modules/adlngpio/Makefile
@@ -0,0 +1,6 @@
+.PATH:	${SRCTOP}/sys/dev/gpio/intel
+KMOD=	adlngpio
+SRCS=	intelgpio.c adlngpio.c
+SRCS+=	acpi_if.h device_if.h bus_if.h gpio_if.h opt_acpi.h opt_platform.h
+
+.include <bsd.kmod.mk>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.