All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Crispin <john@phrozen.org>
To: "Lorenzo Bianconi" <lorenzo@kernel.org>,
	"Lee Jones" <lee@kernel.org>, "Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Uwe Kleine-König" <ukleinek@kernel.org>
Cc: Christian Marangi <ansuelsmth@gmail.com>,
	devicetree@vger.kernel.org, lei.dong@airoha.com,
	Linqi.zhang@airoha.com, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org, linux-pwm@vger.kernel.org,
	mfd@lists.linux.dev, Rajeev.kumar@airoha.com,
	upstream@airoha.com, Weifeng.xu@airoha.com,
	zhengping.zhang@airoha.com
Subject: [PATCH 2/3] mfd: add Airoha GPIO system controller driver
Date: Tue,  1 Dec 2026 20:44:33 +0100	[thread overview]
Message-ID: <20261201194434.3132187-3-john@phrozen.org> (raw)
In-Reply-To: <20261201194434.3132187-1-john@phrozen.org>

The GPIO system controller of the AN7589 holds the pin controller and
the PWM controller. The pin controller is a child node. The PWM
controller has no node, so register it as an MFD cell.

Signed-off-by: John Crispin <john@phrozen.org>
---
 MAINTAINERS                      |  1 +
 drivers/mfd/Kconfig              | 11 ++++++++
 drivers/mfd/Makefile             |  1 +
 drivers/mfd/airoha-gpio-sysctl.c | 43 ++++++++++++++++++++++++++++++++
 4 files changed, 56 insertions(+)
 create mode 100644 drivers/mfd/airoha-gpio-sysctl.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 857ad039c997..196b0be1ab8b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -22334,6 +22334,7 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/mfd/airoha,an7589-gpio-sysctl.yaml
 F:	Documentation/devicetree/bindings/pinctrl/airoha,an7589-pinctrl.yaml
 F:	Documentation/devicetree/bindings/pinctrl/airoha,en7581-pinctrl.yaml
+F:	drivers/mfd/airoha-gpio-sysctl.c
 F:	drivers/pinctrl/airoha/pinctrl-airoha.c
 F:	drivers/pinctrl/airoha/pinctrl-an7589.c
 
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 81b5cb566996..65afbb32ad16 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -32,6 +32,17 @@ config MFD_ADP5585
 	  the core APIs _only_, you have to select individual components like
 	  the GPIO and PWM functions under the corresponding menus.
 
+config MFD_AIROHA_GPIO_SYSCTL
+	tristate "Airoha GPIO system controller"
+	select MFD_CORE
+	depends on ARCH_AIROHA || COMPILE_TEST
+	depends on OF
+	help
+	  Say yes here to add support for the GPIO system controller of the
+	  Airoha AN7589 SoC. The block holds the pin controller and the PWM
+	  controller. This driver registers the PWM controller, you have to
+	  select the PWM driver under the corresponding menu.
+
 config MFD_ALTERA_A10SR
 	bool "Altera Arria10 DevKit System Resource chip"
 	depends on ARCH_INTEL_SOCFPGA && SPI_MASTER=y && OF
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 0697f8bbb65f..02e01adbc261 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -200,6 +200,7 @@ obj-$(CONFIG_AB8500_CORE)	+= ab8500-core.o ab8500-sysctrl.o
 obj-$(CONFIG_MFD_TIMBERDALE)    += timberdale.o
 obj-$(CONFIG_PMIC_ADP5520)	+= adp5520.o
 obj-$(CONFIG_MFD_ADP5585)	+= adp5585.o
+obj-$(CONFIG_MFD_AIROHA_GPIO_SYSCTL)	+= airoha-gpio-sysctl.o
 obj-$(CONFIG_MFD_KEMPLD)	+= kempld-core.o
 obj-$(CONFIG_MFD_INTEL_QUARK_I2C_GPIO)	+= intel_quark_i2c_gpio.o
 obj-$(CONFIG_LPC_SCH)		+= lpc_sch.o
diff --git a/drivers/mfd/airoha-gpio-sysctl.c b/drivers/mfd/airoha-gpio-sysctl.c
new file mode 100644
index 000000000000..b1cd312dffd9
--- /dev/null
+++ b/drivers/mfd/airoha-gpio-sysctl.c
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Airoha GPIO system controller
+ *
+ * Copyright (C) 2026 John Crispin <john@phrozen.org>
+ */
+
+#include <linux/array_size.h>
+#include <linux/mfd/core.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+static const struct mfd_cell an7589_gpio_sysctl_cells[] = {
+	MFD_CELL_NAME("airoha-an7589-pwm"),
+};
+
+static int airoha_gpio_sysctl_probe(struct platform_device *pdev)
+{
+	return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE,
+				    an7589_gpio_sysctl_cells,
+				    ARRAY_SIZE(an7589_gpio_sysctl_cells),
+				    NULL, 0, NULL);
+}
+
+static const struct of_device_id airoha_gpio_sysctl_of_match[] = {
+	{ .compatible = "airoha,an7589-gpio-sysctl" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, airoha_gpio_sysctl_of_match);
+
+static struct platform_driver airoha_gpio_sysctl_driver = {
+	.probe = airoha_gpio_sysctl_probe,
+	.driver = {
+		.name = "airoha-gpio-sysctl",
+		.of_match_table = airoha_gpio_sysctl_of_match,
+	},
+};
+module_platform_driver(airoha_gpio_sysctl_driver);
+
+MODULE_AUTHOR("John Crispin <john@phrozen.org>");
+MODULE_DESCRIPTION("Airoha GPIO system controller driver");
+MODULE_LICENSE("GPL");
-- 
2.34.1


  parent reply	other threads:[~2026-12-01 19:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 19:44 [PATCH 0/3] pwm: airoha: add AN7589 support John Crispin
2026-12-01 19:44 ` [PATCH 1/3] dt-bindings: mfd: airoha: add #pwm-cells to AN7589 gpio-sysctl John Crispin
2026-12-01 19:44 ` John Crispin [this message]
2026-12-01 19:52   ` [PATCH 2/3] mfd: add Airoha GPIO system controller driver sashiko-bot
2026-12-01 19:44 ` [PATCH 3/3] pwm: airoha: add support for AN7589 John Crispin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201194434.3132187-3-john@phrozen.org \
    --to=john@phrozen.org \
    --cc=Linqi.zhang@airoha.com \
    --cc=Rajeev.kumar@airoha.com \
    --cc=Weifeng.xu@airoha.com \
    --cc=ansuelsmth@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=lei.dong@airoha.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=ukleinek@kernel.org \
    --cc=upstream@airoha.com \
    --cc=zhengping.zhang@airoha.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.