[PATCH v1 2/2] pinctrl: Kconfig/Makefile for building MediaTek pinctrl v2 driver as kernel module

light.hsieh
2020-02-13T06:08:49Z

From: Light Hsieh <light.hsieh@mediatek.com>

1. drivers/pinctrl/mediatek/Kconfig:
1.1 PINCTRL_MT6765: change from bool to tristate. It is specified in
defconfig file.
1.2 PINCTRL_MTK_PARIS: change from bool to tristate and select
PINCTRL_MTK_V2. No need to specify in defconfig file.
* PINCTRL_MTK_PARIS will be y if any PINCTRL_MTXXXX selecting
PINCTRL_MTK_PARIS is y.
* PINCTRL_MTK_PARIS will be n if all PINCTRL_MTXXXX selecting
PINCTRL_MTK_PARIS are n.
* PINCTRL_MTK_PARIS will be m if all PINCTRL_MTXXXX selecting
PINCTRL_MTK_PARIS are m.
1.3 PINCTRL_MTK_MOORE: select EINT_MTK and PINCTRL_MTK_V2.
1.4 PINCTRL_MTK_V2: add this tristate config which depends on
PINCTRL_MTK_PARIS and PINCTRL_MTK_MOORE. No need to specify in
defconfig file.
* PINCTRL_MTK_V2 will be y if either PINCTRL_MTK_PARIS or
PINCTRL_MTK_MOORE is y.
* PINCTRL_MTK_V2 will be n if both PINCTRL_MTK_PARIS and
PINCTRL_MTK_MOORE are n.
* PINCTRL_MTK_V2 will be m if both PINCTRL_MTK_PARIS is m and
PINCTRL_MTK_MOORE is n.
1.5 EINT_MTK: change from bool to tristate and add rule for default.
No need to specify in defconfig file.
* First rule: determine if EINT_MTK is y or n according to
selection of PINCTRL_MTK or PINCTRL_MTK_MORE.
* Second rule: determine if EINT_MTK is y, m, or n according to
selection of PINCTRL_MTK_PARIS.

2. drivers/pinctrl/mediatek/Makefile: Use PINCTRL_MTK_V2 to determine
if pinctrl-mtk-common-v2.c is built as kernel module or
built-in.

Signed-off-by: Light Hsieh <light.hsieh@mediatek.com>
---
drivers/pinctrl/mediatek/Kconfig | 17 +++++++++++++----
drivers/pinctrl/mediatek/Makefile | 5 +++--
2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
index 701f9af..d48c313 100644
--- a/drivers/pinctrl/mediatek/Kconfig
+++ b/drivers/pinctrl/mediatek/Kconfig
@@ -3,10 +3,12 @@ menu "MediaTek pinctrl drivers"
depends on ARCH_MEDIATEK || COMPILE_TEST

config EINT_MTK
- bool "MediaTek External Interrupt Support"
+ tristate "MediaTek External Interrupt Support"
depends on PINCTRL_MTK || PINCTRL_MTK_MOORE || PINCTRL_MTK_PARIS || COMPILE_TEST
select GPIOLIB
select IRQ_DOMAIN
+ default y if PINCTRL_MTK || PINCTRL_MTK_MOORE
+ default PINCTRL_MTK_PARIS

config PINCTRL_MTK
bool
@@ -17,23 +19,30 @@ config PINCTRL_MTK
select EINT_MTK
select OF_GPIO

+config PINCTRL_MTK_V2
+ tristate
+ depends on PINCTRL_MTK_MOORE || PINCTRL_MTK_PARIS
+
config PINCTRL_MTK_MOORE
- bool
+ tristate
depends on OF
select GENERIC_PINCONF
select GENERIC_PINCTRL_GROUPS
select GENERIC_PINMUX_FUNCTIONS
+ select EINT_MTK
select GPIOLIB
select OF_GPIO
+ select PINCTRL_MTK_V2

config PINCTRL_MTK_PARIS
- bool
+ tristate
depends on OF
select PINMUX
select GENERIC_PINCONF
select GPIOLIB
select EINT_MTK
select OF_GPIO
+ select PINCTRL_MTK_V2

# For ARMv7 SoCs
config PINCTRL_MT2701
@@ -80,7 +89,7 @@ config PINCTRL_MT2712
select PINCTRL_MTK

config PINCTRL_MT6765
- bool "Mediatek MT6765 pin control"
+ tristate "Mediatek MT6765 pin control"
depends on OF
depends on ARM64 || COMPILE_TEST
default ARM64 && ARCH_MEDIATEK
diff --git a/drivers/pinctrl/mediatek/Makefile b/drivers/pinctrl/mediatek/Makefile
index a74325a..4b71328 100644
--- a/drivers/pinctrl/mediatek/Makefile
+++ b/drivers/pinctrl/mediatek/Makefile
@@ -2,8 +2,9 @@
# Core
obj-$(CONFIG_EINT_MTK) += mtk-eint.o
obj-$(CONFIG_PINCTRL_MTK) += pinctrl-mtk-common.o
-obj-$(CONFIG_PINCTRL_MTK_MOORE) += pinctrl-moore.o pinctrl-mtk-common-v2.o
-obj-$(CONFIG_PINCTRL_MTK_PARIS) += pinctrl-paris.o pinctrl-mtk-common-v2.o
+obj-$(CONFIG_PINCTRL_MTK_V2) += pinctrl-mtk-common-v2.o
+obj-$(CONFIG_PINCTRL_MTK_MOORE) += pinctrl-moore.o
+obj-$(CONFIG_PINCTRL_MTK_PARIS) += pinctrl-paris.o

# SoC Drivers
obj-$(CONFIG_PINCTRL_MT2701) += pinctrl-mt2701.o
--
1.8.1.1.dirty