Change the MediaTek power domain Kconfig to just have a single option
for all targets. This will simplify adding new targets in the future.

Targets that have no power domain driver simply do not enable
POWER_DOMAIN, so the option can default to y.

In the Makefile, use the target config symbol to automatically select the
correct SoC data file, so a new SoC only needs a new .c file and one
Makefile line rather than a Kconfig option of its own. The SoC files are
guarded by the common option because this Makefile is shared with the
other vendors.

Note that some drivers are named after the first SoC they supported
rather than after a target, so mt2701-power-domain.c is selected by
TARGET_MT7623 and mt7622-power-domain.c by either TARGET_MT7622 or
TARGET_MT7629. Only one target can be selected at a time, so
concatenating the two symbols is safe.

Signed-off-by: David Lechner <[email protected]>
---
 drivers/power/domain/Kconfig  | 47 +++++++------------------------------------
 drivers/power/domain/Makefile | 11 ++++++----
 2 files changed, 14 insertions(+), 44 deletions(-)

diff --git a/drivers/power/domain/Kconfig b/drivers/power/domain/Kconfig
index bd8b1f8cf5b..13a661ce04f 100644
--- a/drivers/power/domain/Kconfig
+++ b/drivers/power/domain/Kconfig
@@ -83,49 +83,16 @@ config MESON_SECURE_POWER_DOMAIN
          Enable support for manipulating Amlogic Meson Secure power domains.
          Support for Amlogic A1 series.
 
-config MT2701_POWER_DOMAIN
-       bool "Enable the MediaTek power domain driver for MT2701 compatible SoC"
-       depends on POWER_DOMAIN && ARCH_MEDIATEK
-       select MTK_POWER_DOMAIN
-       help
-         Enable support for manipulating MediaTek power domains via MMIO
-         mapped registers for MT2701 compatible SoC. The driver powers
-         the SoC power domains on and off and handles the associated bus
-         protection bits. It is also used on MT7623.
-
-config MT7622_POWER_DOMAIN
-       bool "Enable the MediaTek power domain driver for MT7622 compatible SoC"
-       depends on POWER_DOMAIN && ARCH_MEDIATEK
-       select MTK_POWER_DOMAIN
-       help
-         Enable support for manipulating MediaTek power domains via MMIO
-         mapped registers for MT7622 compatible SoC. The driver powers
-         the SoC power domains on and off and handles the associated bus
-         protection bits. It is also used on MT7629.
-
-config MT8188_POWER_DOMAIN
-       bool "Enable the MediaTek power domain driver for MT8188 compatible SoC"
-       depends on POWER_DOMAIN && ARCH_MEDIATEK
-       select MTK_POWER_DOMAIN
-       help
-         Enable support for manipulating MediaTek power domains via MMIO
-         mapped registers for MT8188 compatible SoC. The driver powers
-         the SoC power domains on and off and handles the associated bus
-         protection steps, per-domain clocks and parent domains.
-
-config MT8366_POWER_DOMAIN
-       bool "Enable the MediaTek power domain driver for MT8366 compatible SoC"
+config MTK_POWER_DOMAIN
+       bool "Enable the MediaTek power domain driver"
        depends on POWER_DOMAIN && ARCH_MEDIATEK
-       select MTK_POWER_DOMAIN
+       default y
        help
          Enable support for manipulating MediaTek power domains via MMIO
-         mapped registers for MT8366 compatible SoC. The driver powers
-         the SoC power domains on and off and handles the associated bus
-         protection steps, per-domain clocks and parent domains.
-
-config MTK_POWER_DOMAIN
-       bool
-       depends on POWER_DOMAIN && ARCH_MEDIATEK
+         mapped registers. The driver powers the SoC power domains on and
+         off and handles the associated bus protection steps, per-domain
+         clocks and parent domains. The data for the SoC selected by
+         TARGET_MTxxxx is built in automatically.
 
 config QCOM_RPMH_POWER_DOMAIN
        bool "Enable the QCOM RPMH Power domain driver"
diff --git a/drivers/power/domain/Makefile b/drivers/power/domain/Makefile
index 74f22d57981..dd14981fca9 100644
--- a/drivers/power/domain/Makefile
+++ b/drivers/power/domain/Makefile
@@ -14,11 +14,14 @@ obj-$(CONFIG_IMX8MP_MEDIAMIX_BLKCTRL) += imx8mp-mediamix.o
 obj-$(CONFIG_MESON_EE_POWER_DOMAIN) += meson-ee-pwrc.o
 obj-$(CONFIG_MESON_GX_VPU_POWER_DOMAIN) += meson-gx-pwrc-vpu.o
 obj-$(CONFIG_MESON_SECURE_POWER_DOMAIN) += meson-secure-pwrc.o
-obj-$(CONFIG_MT2701_POWER_DOMAIN) += mt2701-power-domain.o
-obj-$(CONFIG_MT7622_POWER_DOMAIN) += mt7622-power-domain.o
-obj-$(CONFIG_MT8188_POWER_DOMAIN) += mt8188-power-domain.o
-obj-$(CONFIG_MT8366_POWER_DOMAIN) += mt8366-power-domain.o
 obj-$(CONFIG_MTK_POWER_DOMAIN) += mtk-power-domain.o
+ifdef CONFIG_MTK_POWER_DOMAIN
+# Some drivers are named after the first SoC they supported, not after a 
target.
+obj-$(CONFIG_TARGET_MT7623) += mt2701-power-domain.o
+obj-$(CONFIG_TARGET_MT7622)$(CONFIG_TARGET_MT7629) += mt7622-power-domain.o
+obj-$(CONFIG_TARGET_MT8188) += mt8188-power-domain.o
+obj-$(CONFIG_TARGET_MT8366) += mt8366-power-domain.o
+endif
 obj-$(CONFIG_QCOM_RPMH_POWER_DOMAIN) += qcom-rpmhpd.o
 obj-$(CONFIG_RENESAS_R8A78000_POWER_DOMAIN) += renesas-r8a78000-power-domain.o
 obj-$(CONFIG_SANDBOX_POWER_DOMAIN) += sandbox-power-domain.o

-- 
2.43.0

Reply via email to