From: Justin Yeh <justin.yeh@mediatek.com>
To: Sean Wang <sean.wang@kernel.org>,
Linus Walleij <linusw@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>
Cc: <Project_Global_Chrome_Upstream_Group@mediatek.com>,
<linux-mediatek@lists.infradead.org>,
<linux-gpio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
Justin Yeh <justin.yeh@mediatek.com>
Subject: [PATCH v5 2/4] pinctrl: mediatek: allow common drivers to be built as modules
Date: Thu, 9 Jul 2026 14:33:47 +0800 [thread overview]
Message-ID: <20260709063450.1615041-3-justin.yeh@mediatek.com> (raw)
In-Reply-To: <20260709063450.1615041-1-justin.yeh@mediatek.com>
The MediaTek SoC pinctrl drivers link against the shared implementations
in pinctrl-mtk-common.c (v1), pinctrl-moore.c and pinctrl-mtmips.c. These
were built-in only: their Kconfig symbols were bool, they did not export
their entry points and they carried no MODULE_LICENSE().
To let the individual SoC drivers be built as loadable modules (required
for Android GKI + vendor_dlkm, where vendor drivers must live outside the
GKI vmlinux), the shared code they depend on has to be modular too.
Otherwise selecting a SoC driver as =m forces the common symbol to =y and
the resulting module fails to link against the unexported common entry
points.
Convert PINCTRL_MTK, PINCTRL_MTK_MOORE and PINCTRL_MTK_MTMIPS to
tristate, export the entry points used by the SoC drivers, and add
MODULE_DESCRIPTION()/MODULE_LICENSE() to the three common files.
The v2 common code (PINCTRL_MTK_V2) is already modular, but mtk_rmw() was
never exported. It is called directly by SoC drivers such as mt7623, so
export it as well to keep those drivers linking once they are modular.
Signed-off-by: Justin Yeh <justin.yeh@mediatek.com>
---
drivers/pinctrl/mediatek/Kconfig | 6 +++---
drivers/pinctrl/mediatek/pinctrl-moore.c | 5 +++++
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c | 1 +
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 8 ++++++++
drivers/pinctrl/mediatek/pinctrl-mtmips.c | 4 ++++
5 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
index 97980cc28b9c..864e7ffc6044 100644
--- a/drivers/pinctrl/mediatek/Kconfig
+++ b/drivers/pinctrl/mediatek/Kconfig
@@ -11,7 +11,7 @@ config EINT_MTK
default PINCTRL_MTK_PARIS
config PINCTRL_MTK
- bool
+ tristate
depends on OF
select PINMUX
select GENERIC_PINCONF
@@ -22,13 +22,13 @@ config PINCTRL_MTK_V2
tristate
config PINCTRL_MTK_MTMIPS
- bool
+ tristate
depends on RALINK
select PINMUX
select GENERIC_PINCONF
config PINCTRL_MTK_MOORE
- bool
+ tristate
depends on OF
select GENERIC_PINCONF
select GENERIC_PINCTRL_GROUPS
diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c
index 38f15dbe9a28..3247622911cd 100644
--- a/drivers/pinctrl/mediatek/pinctrl-moore.c
+++ b/drivers/pinctrl/mediatek/pinctrl-moore.c
@@ -10,6 +10,7 @@
#include <dt-bindings/pinctrl/mt65xx.h>
#include <linux/gpio/driver.h>
+#include <linux/module.h>
#include <linux/pinctrl/consumer.h>
@@ -743,3 +744,7 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev,
return 0;
}
+EXPORT_SYMBOL_GPL(mtk_moore_pinctrl_probe);
+
+MODULE_DESCRIPTION("MediaTek Pinctrl Common Driver V2 Moore");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
index 4918d38abfc2..3813dfb0fa7d 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
@@ -69,6 +69,7 @@ void mtk_rmw(struct mtk_pinctrl *pctl, u8 i, u32 reg, u32 mask, u32 set)
spin_unlock_irqrestore(&pctl->lock, flags);
}
+EXPORT_SYMBOL_GPL(mtk_rmw);
static int mtk_hw_pin_field_lookup(struct mtk_pinctrl *hw,
const struct mtk_pin_desc *desc,
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 791eddd7a2c6..a58015b508af 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -7,6 +7,7 @@
#include <linux/io.h>
#include <linux/gpio/driver.h>
+#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/pinctrl/consumer.h>
@@ -190,6 +191,7 @@ int mtk_pconf_spec_set_ies_smt_range(struct regmap *regmap,
regmap_write(regmap, reg_addr, bit);
return 0;
}
+EXPORT_SYMBOL_GPL(mtk_pconf_spec_set_ies_smt_range);
static const struct mtk_pin_drv_grp *mtk_find_pin_drv_grp_by_pin(
struct mtk_pinctrl *pctl, unsigned long pin) {
@@ -297,6 +299,7 @@ int mtk_pctrl_spec_pull_set_samereg(struct regmap *regmap,
return 0;
}
+EXPORT_SYMBOL_GPL(mtk_pctrl_spec_pull_set_samereg);
static int mtk_pconf_set_pull_select(struct mtk_pinctrl *pctl,
unsigned int pin, bool enable, bool isup, unsigned int arg)
@@ -1149,6 +1152,7 @@ int mtk_pctrl_init(struct platform_device *pdev,
return 0;
}
+EXPORT_SYMBOL_GPL(mtk_pctrl_init);
int mtk_pctrl_common_probe(struct platform_device *pdev)
{
@@ -1160,3 +1164,7 @@ int mtk_pctrl_common_probe(struct platform_device *pdev)
return mtk_pctrl_init(pdev, data, NULL);
}
+EXPORT_SYMBOL_GPL(mtk_pctrl_common_probe);
+
+MODULE_DESCRIPTION("MediaTek Pinctrl Common Driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtmips.c b/drivers/pinctrl/mediatek/pinctrl-mtmips.c
index efd77b6c56a1..c9d9de68e282 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtmips.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtmips.c
@@ -349,3 +349,7 @@ int mtmips_pinctrl_init(struct platform_device *pdev,
return PTR_ERR_OR_ZERO(dev);
}
+EXPORT_SYMBOL_GPL(mtmips_pinctrl_init);
+
+MODULE_DESCRIPTION("MediaTek MIPS Pinctrl Common Driver");
+MODULE_LICENSE("GPL v2");
--
2.45.2
next prev parent reply other threads:[~2026-07-09 6:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 6:33 [PATCH v5 0/4] pinctrl: mediatek: Enable module build support Justin Yeh
2026-07-09 6:33 ` [PATCH v5 1/4] pinctrl: mediatek: use devm_gpiochip_add_data() for GPIO chip Justin Yeh
2026-07-09 8:26 ` Chen-Yu Tsai
2026-07-09 6:33 ` Justin Yeh [this message]
2026-07-09 8:23 ` [PATCH v5 2/4] pinctrl: mediatek: allow common drivers to be built as modules Chen-Yu Tsai
2026-07-09 6:33 ` [PATCH v5 3/4] pinctrl: mediatek: mt7986: register both platform drivers from a single initcall Justin Yeh
2026-07-09 7:02 ` Chen-Yu Tsai
2026-07-09 6:33 ` [PATCH v5 4/4] pinctrl: mediatek: enable module build support for all SoC drivers Justin Yeh
2026-07-10 20:29 ` [PATCH v5 0/4] pinctrl: mediatek: Enable module build support Linus Walleij
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=20260709063450.1615041-3-justin.yeh@mediatek.com \
--to=justin.yeh@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linusw@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=sean.wang@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox