[OpenWrt-Devel] kernel: Build: Split kmod-regmap
diff mbox series

Message ID 20190111170511.9616-1-hauke.mehrtens@intel.com
State Accepted
Delegated to: Hauke Mehrtens
Headers show
Series
  • [OpenWrt-Devel] kernel: Build: Split kmod-regmap
Related show

Commit Message

Hauke Mehrtens Jan. 11, 2019, 5:05 p.m. UTC
This reduces the needed modifications to the mainline Linux kernel and
also makes the regmap package work with an out of tree kernel which
does not have these modifications.

The regmap-core is only added when it is really build as a module.
The regmap-core is normally bool so it cannot be built as a module in an
unmodified kernel. When it is selected by on other kernel module it will
always be selected as build in and it also does not show up in
$(LINUX_DIR)/modules.builtin as it is not supposed to be a kernel module.
When it is not in $(LINUX_DIR)/modules.builtin the build system expects
it to be built as a .ko file.
Just check if the module is really there and only add it in that case.

This splits the regmap package into multiple packages, one for each bus type.
This way only the bus maps which are really needed have to be added.
This also splits the I2C, SPI and MMIO regmap into separate packages to not
require all these subsystems to build them, on an unmodified upstream kernel
this also causes problems in some situations.

Signed-off-by: Hauke Mehrtens <hauke.mehrtens@intel.com>
---
 package/kernel/linux/modules/can.mk                |  2 +-
 package/kernel/linux/modules/hwmon.mk              | 10 +--
 package/kernel/linux/modules/iio.mk                |  6 +-
 package/kernel/linux/modules/other.mk              | 87 ++++++++++++++++------
 package/kernel/linux/modules/sound.mk              |  4 +-
 package/kernel/linux/modules/wpan.mk               |  4 +-
 target/linux/at91/modules.mk                       |  2 +-
 target/linux/brcm2708/modules.mk                   |  4 +-
 .../generic/hack-4.14/259-regmap_dynamic.patch     | 14 ++--
 .../generic/hack-4.19/259-regmap_dynamic.patch     | 17 ++---
 .../generic/hack-4.9/259-regmap_dynamic.patch      | 14 ++--
 .../generic/pending-3.18/259-regmap_dynamic.patch  | 14 ++--
 target/linux/ramips/modules.mk                     |  2 +-
 13 files changed, 101 insertions(+), 79 deletions(-)

Patch
diff mbox series

diff --git a/package/kernel/linux/modules/can.mk b/package/kernel/linux/modules/can.mk
index 4154ceb..b0d2545 100644
--- a/package/kernel/linux/modules/can.mk
+++ b/package/kernel/linux/modules/can.mk
@@ -99,7 +99,7 @@  $(eval $(call KernelPackage,can-c-can-pci))
 define KernelPackage/can-c-can-platform
   TITLE:=Platform Bus based BOSCH C_CAN/D_CAN driver
   KCONFIG:=CONFIG_CAN_C_CAN_PLATFORM
-  DEPENDS:=kmod-can-c-can +!LINUX_3_18:kmod-regmap
+  DEPENDS:=kmod-can-c-can +!LINUX_3_18:kmod-regmap-core
   FILES:=$(LINUX_DIR)/drivers/net/can/c_can/c_can_platform.ko
   AUTOLOAD:=$(call AutoProbe,c_can_platform)
   $(call AddDepends/can)
diff --git a/package/kernel/linux/modules/hwmon.mk b/package/kernel/linux/modules/hwmon.mk
index 00bb185..5f54b4a 100644
--- a/package/kernel/linux/modules/hwmon.mk
+++ b/package/kernel/linux/modules/hwmon.mk
@@ -112,7 +112,7 @@  define KernelPackage/hwmon-ina2xx
   KCONFIG:=CONFIG_SENSORS_INA2XX
   FILES:=$(LINUX_DIR)/drivers/hwmon/ina2xx.ko
   AUTOLOAD:=$(call AutoProbe,ina2xx)
-  $(call AddDepends/hwmon,+kmod-i2c-core +!LINUX_3_18:kmod-regmap)
+  $(call AddDepends/hwmon,+kmod-i2c-core +!LINUX_3_18:kmod-regmap-i2c)
 endef
 
 define KernelPackage/hwmon-ina2xx/description
@@ -142,7 +142,7 @@  define KernelPackage/hwmon-lm63
   KCONFIG:=CONFIG_SENSORS_LM63
   FILES:=$(LINUX_DIR)/drivers/hwmon/lm63.ko
   AUTOLOAD:=$(call AutoProbe,lm63)
-  $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap)
+  $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap-i2c)
 endef
 
 define KernelPackage/hwmon-lm63/description
@@ -157,7 +157,7 @@  define KernelPackage/hwmon-lm75
   KCONFIG:=CONFIG_SENSORS_LM75
   FILES:=$(LINUX_DIR)/drivers/hwmon/lm75.ko
   AUTOLOAD:=$(call AutoProbe,lm75)
-  $(call AddDepends/hwmon,+kmod-i2c-core +PACKAGE_kmod-thermal:kmod-thermal +kmod-regmap)
+  $(call AddDepends/hwmon,+kmod-i2c-core +PACKAGE_kmod-thermal:kmod-thermal +kmod-regmap-i2c)
 endef
 
 define KernelPackage/hwmon-lm75/description
@@ -339,7 +339,7 @@  define KernelPackage/hwmon-tmp102
   KCONFIG:=CONFIG_SENSORS_TMP102
   FILES:=$(LINUX_DIR)/drivers/hwmon/tmp102.ko
   AUTOLOAD:=$(call AutoProbe,tmp102)
-  $(call AddDepends/hwmon,+kmod-i2c-core +PACKAGE_kmod-thermal:kmod-thermal +kmod-regmap)
+  $(call AddDepends/hwmon,+kmod-i2c-core +PACKAGE_kmod-thermal:kmod-thermal +kmod-regmap-i2c)
 endef
 
 define KernelPackage/hwmon-tmp102/description
@@ -354,7 +354,7 @@  define KernelPackage/hwmon-tmp103
   KCONFIG:=CONFIG_SENSORS_TMP103
   FILES:=$(LINUX_DIR)/drivers/hwmon/tmp103.ko
   AUTOLOAD:=$(call AutoProbe,tmp103)
-  $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap)
+  $(call AddDepends/hwmon,+kmod-i2c-core +kmod-regmap-i2c)
 endef
 
 define KernelPackage/hwmon-tmp103/description
diff --git a/package/kernel/linux/modules/iio.mk b/package/kernel/linux/modules/iio.mk
index ee82eee..fe682b3 100644
--- a/package/kernel/linux/modules/iio.mk
+++ b/package/kernel/linux/modules/iio.mk
@@ -54,7 +54,7 @@  $(eval $(call KernelPackage,iio-ad799x))
 
 define KernelPackage/iio-hmc5843
   SUBMENU:=$(IIO_MENU)
-  DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-regmap
+  DEPENDS:=+kmod-i2c-core +kmod-iio-core +kmod-regmap-i2c
   TITLE:=Honeywell HMC58x3 Magnetometer
   KCONFIG:= CONFIG_SENSORS_HMC5843_I2C
   FILES:= \
@@ -132,7 +132,7 @@  $(eval $(call KernelPackage,iio-dht11))
 define KernelPackage/iio-bmp280
   SUBMENU:=$(IIO_MENU)
   TITLE:=BMP180/BMP280/BME280 pressure/temperatur sensor
-  DEPENDS:=@!LINUX_3_18 +kmod-iio-core +kmod-regmap
+  DEPENDS:=@!LINUX_3_18 +kmod-iio-core +kmod-regmap-core
   KCONFIG:=CONFIG_BMP280
   FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280.ko
 endef
@@ -149,7 +149,7 @@  $(eval $(call KernelPackage,iio-bmp280))
 define KernelPackage/iio-bmp280-i2c
   SUBMENU:=$(IIO_MENU)
   TITLE:=BMP180/BMP280/BME280 pressure/temperatur sensor (I2C)
-  DEPENDS:=+kmod-iio-bmp280 +kmod-i2c-core
+  DEPENDS:=+kmod-iio-bmp280 +kmod-i2c-core +kmod-regmap-i2c
   KCONFIG:=CONFIG_BMP280_I2C
   FILES:=$(LINUX_DIR)/drivers/iio/pressure/bmp280-i2c.ko
   AUTOLOAD:=$(call AutoProbe,iio-bmp280-i2c)
diff --git a/package/kernel/linux/modules/other.mk b/package/kernel/linux/modules/other.mk
index cfb7055..220452d 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -30,7 +30,7 @@  $(eval $(call KernelPackage,6lowpan))
 define KernelPackage/bluetooth
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Bluetooth support
-  DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-crypto-hash +kmod-crypto-ecb +kmod-lib-crc16 +kmod-hid +!LINUX_3_18:kmod-crypto-cmac +!LINUX_3_18:kmod-regmap +!(LINUX_3_18||LINUX_4_9):kmod-crypto-ecdh
+  DEPENDS:=@USB_SUPPORT +kmod-usb-core +kmod-crypto-hash +kmod-crypto-ecb +kmod-lib-crc16 +kmod-hid +!LINUX_3_18:kmod-crypto-cmac +!LINUX_3_18:kmod-regmap-core +!(LINUX_3_18||LINUX_4_9):kmod-crypto-ecdh
   KCONFIG:= \
 	CONFIG_BT \
 	CONFIG_BT_BREDR=y \
@@ -172,7 +172,7 @@  define KernelPackage/eeprom-at24
   SUBMENU:=$(OTHER_MENU)
   TITLE:=EEPROM AT24 support
   KCONFIG:=CONFIG_EEPROM_AT24
-  DEPENDS:=+kmod-i2c-core +kmod-nvmem +LINUX_4_19:kmod-regmap
+  DEPENDS:=+kmod-i2c-core +kmod-nvmem +LINUX_4_19:kmod-regmap-i2c
   FILES:=$(LINUX_DIR)/drivers/misc/eeprom/at24.ko
   AUTOLOAD:=$(call AutoProbe,at24)
 endef
@@ -219,7 +219,7 @@  $(eval $(call KernelPackage,gpio-dev))
 define KernelPackage/gpio-mcp23s08
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Microchip MCP23xxx I/O expander
-  DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core +!(LINUX_3_18||LINUX_4_9):kmod-regmap
+  DEPENDS:=@GPIO_SUPPORT +kmod-i2c-core +!(LINUX_3_18||LINUX_4_9):kmod-regmap-i2c
   KCONFIG:= \
 	CONFIG_GPIO_MCP23S08 \
 	CONFIG_PINCTRL_MCP23S08
@@ -476,7 +476,7 @@  define KernelPackage/rtc-ds1307
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Dallas/Maxim DS1307 (and compatible) RTC support
   DEFAULT:=m if ALL_KMODS && RTC_SUPPORT
-  DEPENDS:=+kmod-i2c-core +!(LINUX_3_18||LINUX_4_9):kmod-regmap +!(LINUX_3_18||LINUX_4_9):kmod-hwmon-core
+  DEPENDS:=+kmod-i2c-core +!(LINUX_3_18||LINUX_4_9):kmod-regmap-i2c +!(LINUX_3_18||LINUX_4_9):kmod-hwmon-core
   KCONFIG:=CONFIG_RTC_DRV_DS1307 \
 	CONFIG_RTC_CLASS=y
   FILES:=$(LINUX_DIR)/drivers/rtc/rtc-ds1307.ko
@@ -710,32 +710,71 @@  endef
 $(eval $(call KernelPackage,serial-8250-exar))
 
 
-define KernelPackage/regmap
+define KernelPackage/regmap-core
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Generic register map support
-  DEPENDS:=+kmod-lib-lzo +kmod-i2c-core
-  KCONFIG:=CONFIG_REGMAP \
-	   CONFIG_REGMAP_MMIO \
-	   CONFIG_REGMAP_SPI \
-	   CONFIG_REGMAP_I2C \
-	   CONFIG_SPI=y
-  FILES:= \
-	$(LINUX_DIR)/drivers/base/regmap/regmap-i2c.ko \
-	$(LINUX_DIR)/drivers/base/regmap/regmap-mmio.ko \
-	$(if $(CONFIG_SPI),$(LINUX_DIR)/drivers/base/regmap/regmap-spi.ko)
-  AUTOLOAD:=$(call AutoLoad,21,regmap-core regmap-i2c regmap-mmio regmap-spi)
-  ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
-   ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
-    FILES += $(LINUX_DIR)/drivers/base/regmap/regmap-core.ko
-   endif
-  endif
+  HIDDEN:=1
+  KCONFIG:=CONFIG_REGMAP
+ifneq ($(wildcard $(LINUX_DIR)/drivers/base/regmap/regmap-core.ko),)
+  FILES:=$(LINUX_DIR)/drivers/base/regmap/regmap-core.ko
+endif
 endef
 
-define KernelPackage/regmap/description
+define KernelPackage/regmap-core/description
  Generic register map support
 endef
 
-$(eval $(call KernelPackage,regmap))
+$(eval $(call KernelPackage,regmap-core))
+
+
+define KernelPackage/regmap-spi
+  SUBMENU:=$(OTHER_MENU)
+  TITLE:=SPI register map support
+  DEPENDS:=+kmod-regmap-core
+  HIDDEN:=1
+  KCONFIG:=CONFIG_REGMAP_SPI \
+	   CONFIG_SPI=y
+  FILES:=$(LINUX_DIR)/drivers/base/regmap/regmap-spi.ko
+endef
+
+define KernelPackage/regmap-spi/description
+ SPI register map support
+endef
+
+$(eval $(call KernelPackage,regmap-spi))
+
+
+define KernelPackage/regmap-i2c
+  SUBMENU:=$(OTHER_MENU)
+  TITLE:=I2C register map support
+  DEPENDS:=+kmod-regmap-core +kmod-i2c-core
+  HIDDEN:=1
+  KCONFIG:=CONFIG_REGMAP_I2C
+  FILES:=$(LINUX_DIR)/drivers/base/regmap/regmap-i2c.ko
+endef
+
+define KernelPackage/regmap-i2c/description
+ I2C register map support
+endef
+
+$(eval $(call KernelPackage,regmap-i2c))
+
+
+define KernelPackage/regmap-mmio
+  SUBMENU:=$(OTHER_MENU)
+  TITLE:=MMIO register map support
+  DEPENDS:=+kmod-regmap-core
+  HIDDEN:=1
+  KCONFIG:=CONFIG_REGMAP_MMIO
+  FILES:=$(LINUX_DIR)/drivers/base/regmap/regmap-mmio.ko
+endef
+
+define KernelPackage/regmap-mmio/description
+ MMIO register map support
+endef
+
+$(eval $(call KernelPackage,regmap-mmio))
+
 
 define KernelPackage/ikconfig
   SUBMENU:=$(OTHER_MENU)
@@ -996,7 +1035,7 @@  $(eval $(call KernelPackage,echo))
 define KernelPackage/bmp085
   SUBMENU:=$(OTHER_MENU)
   TITLE:=BMP085/BMP18x pressure sensor
-  DEPENDS:= +kmod-regmap @!LINUX_3_18
+  DEPENDS:= +kmod-regmap-core @!LINUX_3_18
   KCONFIG:= CONFIG_BMP085
   FILES:= $(LINUX_DIR)/drivers/misc/bmp085.ko
 endef
diff --git a/package/kernel/linux/modules/sound.mk b/package/kernel/linux/modules/sound.mk
index 177140e..bf4bd5d 100644
--- a/package/kernel/linux/modules/sound.mk
+++ b/package/kernel/linux/modules/sound.mk
@@ -188,7 +188,7 @@  $(eval $(call KernelPackage,sound-via82xx))
 
 define KernelPackage/sound-soc-core
   TITLE:=SoC sound support
-  DEPENDS:=+kmod-regmap +kmod-ac97
+  DEPENDS:=+kmod-regmap-core +kmod-ac97
   KCONFIG:= \
 	CONFIG_SND_SOC \
 	CONFIG_SND_SOC_DMAENGINE_PCM=y \
@@ -321,7 +321,7 @@  define KernelPackage/sound-hda-core
 	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec.ko \
 	$(LINUX_DIR)/sound/pci/hda/snd-hda-codec-generic.ko
   AUTOLOAD:=$(call AutoProbe,snd-hda-core@ge4.1 snd-hda-codec snd-hda-codec-generic)
-  $(call AddDepends/sound,+kmod-regmap)
+  $(call AddDepends/sound,+kmod-regmap-core)
 endef
 
 define KernelPackage/sound-hda-core/description
diff --git a/package/kernel/linux/modules/wpan.mk b/package/kernel/linux/modules/wpan.mk
index 199044f..d8d58fa 100644
--- a/package/kernel/linux/modules/wpan.mk
+++ b/package/kernel/linux/modules/wpan.mk
@@ -72,7 +72,7 @@  $(eval $(call KernelPackage,fakelb))
 define KernelPackage/at86rf230
   SUBMENU:=$(WPAN_MENU)
   TITLE:=AT86RF230 transceiver driver
-  DEPENDS:=+kmod-mac802154 +kmod-regmap
+  DEPENDS:=+kmod-mac802154 +kmod-regmap-spi
   KCONFIG:=CONFIG_IEEE802154_AT86RF230 \
 	CONFIG_IEEE802154_AT86RF230_DEBUGFS=n \
 	CONFIG_SPI=y \
@@ -85,7 +85,7 @@  $(eval $(call KernelPackage,at86rf230))
 define KernelPackage/mrf24j40
   SUBMENU:=$(WPAN_MENU)
   TITLE:=MRF24J40 transceiver driver
-  DEPENDS:=+kmod-mac802154 +kmod-regmap
+  DEPENDS:=+kmod-mac802154 +kmod-regmap-spi
   KCONFIG:=CONFIG_IEEE802154_MRF24J40 \
 	CONFIG_SPI=y \
 	CONFIG_SPI_MASTER=y
diff --git a/target/linux/at91/modules.mk b/target/linux/at91/modules.mk
index 30858ce..998c042 100644
--- a/target/linux/at91/modules.mk
+++ b/target/linux/at91/modules.mk
@@ -53,7 +53,7 @@  $(eval $(call KernelPackage,at91-adc))
 define KernelPackage/at91-udc
   SUBMENU:=$(USB_MENU)
   TITLE:=USB Device Controller on atmel SoC
-  DEPENDS:=@TARGET_at91 +kmod-usb-gadget +kmod-regmap
+  DEPENDS:=@TARGET_at91 +kmod-usb-gadget +kmod-regmap-core
   KCONFIG:=CONFIG_USB_AT91
 ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/gadget/udc/at91_udc.ko),)
   FILES:=$(LINUX_DIR)/drivers/usb/gadget/udc/at91_udc.ko
diff --git a/target/linux/brcm2708/modules.mk b/target/linux/brcm2708/modules.mk
index 9a5e7c2..0788a6e 100644
--- a/target/linux/brcm2708/modules.mk
+++ b/target/linux/brcm2708/modules.mk
@@ -75,7 +75,7 @@  define KernelPackage/sound-soc-bcm2835-i2s
   FILES:= \
 	$(LINUX_DIR)/sound/soc/bcm/snd-soc-bcm2835-i2s.ko
   AUTOLOAD:=$(call AutoLoad,68,snd-soc-bcm2835-i2s)
-  DEPENDS:=@TARGET_brcm2708 +kmod-regmap +kmod-sound-soc-core
+  DEPENDS:=@TARGET_brcm2708 +kmod-regmap-mmio +kmod-sound-soc-core
   $(call AddDepends/sound)
 endef
 
@@ -248,7 +248,7 @@  define KernelPackage/sound-soc-allo-katana-codec
   DEPENDS:= \
 	@LINUX_4_14 \
 	+kmod-i2c-bcm2708 \
-	+kmod-regmap \
+	+kmod-regmap-core \
 	kmod-sound-soc-bcm2835-i2s
   $(call AddDepends/sound)
 endef
diff --git a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
index 458b7c3..59dfbf3 100644
--- a/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
+++ b/target/linux/generic/hack-4.14/259-regmap_dynamic.patch
@@ -21,22 +21,19 @@  Signed-off-by: Felix Fietkau <nbd@nbd.name>
 -	default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ)
  	select IRQ_DOMAIN if REGMAP_IRQ
 -	bool
-+	tristate "Regmap"
++	tristate
  
  config REGCACHE_COMPRESSED
  	select LZO_COMPRESS
-@@ -17,23 +16,30 @@ config REGMAP_AC97
- 	tristate
+@@ -18,22 +17,29 @@ config REGMAP_AC97
  
  config REGMAP_I2C
--	tristate
-+	tristate "Regmap I2C"
+ 	tristate
 +	select REGMAP
  	depends on I2C
  
  config REGMAP_SPI
--	tristate
-+	tristate "Regmap SPI"
+ 	tristate
 +	select REGMAP
 +	depends on SPI_MASTER
  	depends on SPI
@@ -52,8 +49,7 @@  Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	depends on W1
  
  config REGMAP_MMIO
--	tristate
-+	tristate "Regmap MMIO"
+ 	tristate
 +	select REGMAP
  
  config REGMAP_IRQ
diff --git a/target/linux/generic/hack-4.19/259-regmap_dynamic.patch b/target/linux/generic/hack-4.19/259-regmap_dynamic.patch
index 1c5e116..335ec4a 100644
--- a/target/linux/generic/hack-4.19/259-regmap_dynamic.patch
+++ b/target/linux/generic/hack-4.19/259-regmap_dynamic.patch
@@ -21,26 +21,22 @@  Signed-off-by: Felix Fietkau <nbd@nbd.name>
 -	default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ)
  	select IRQ_DOMAIN if REGMAP_IRQ
 -	bool
-+	tristate "Regmap"
++	tristate
  
  config REGCACHE_COMPRESSED
  	select LZO_COMPRESS
-@@ -17,7 +16,8 @@ config REGMAP_AC97
- 	tristate
+@@ -18,6 +17,7 @@ config REGMAP_AC97
  
  config REGMAP_I2C
--	tristate
-+	tristate "Regmap I2C"
+ 	tristate
 +	select REGMAP
  	depends on I2C
  
  config REGMAP_SLIMBUS
-@@ -25,21 +25,27 @@ config REGMAP_SLIMBUS
- 	depends on SLIMBUS
+@@ -26,20 +26,26 @@ config REGMAP_SLIMBUS
  
  config REGMAP_SPI
--	tristate
-+	tristate "Regmap SPI"
+ 	tristate
 +	select REGMAP
 +	depends on SPI_MASTER
  	depends on SPI
@@ -56,8 +52,7 @@  Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	depends on W1
  
  config REGMAP_MMIO
--	tristate
-+	tristate "Regmap MMIO"
+ 	tristate
 +	select REGMAP
  
  config REGMAP_IRQ
diff --git a/target/linux/generic/hack-4.9/259-regmap_dynamic.patch b/target/linux/generic/hack-4.9/259-regmap_dynamic.patch
index 85c9d79..237c209 100644
--- a/target/linux/generic/hack-4.9/259-regmap_dynamic.patch
+++ b/target/linux/generic/hack-4.9/259-regmap_dynamic.patch
@@ -21,22 +21,19 @@  Signed-off-by: Felix Fietkau <nbd@nbd.name>
 -	default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ)
  	select IRQ_DOMAIN if REGMAP_IRQ
 -	bool
-+	tristate "Regmap"
++	tristate
  
  config REGCACHE_COMPRESSED
  	select LZO_COMPRESS
-@@ -16,19 +15,25 @@ config REGMAP_AC97
- 	tristate
+@@ -17,18 +16,24 @@ config REGMAP_AC97
  
  config REGMAP_I2C
--	tristate
-+	tristate "Regmap I2C"
+ 	tristate
 +	select REGMAP
  	depends on I2C
  
  config REGMAP_SPI
--	tristate
-+	tristate "Regmap SPI"
+ 	tristate
 +	select REGMAP
 +	depends on SPI_MASTER
  	depends on SPI
@@ -47,8 +44,7 @@  Signed-off-by: Felix Fietkau <nbd@nbd.name>
  	depends on SPMI
  
  config REGMAP_MMIO
--	tristate
-+	tristate "Regmap MMIO"
+ 	tristate
 +	select REGMAP
  
  config REGMAP_IRQ
diff --git a/target/linux/generic/pending-3.18/259-regmap_dynamic.patch b/target/linux/generic/pending-3.18/259-regmap_dynamic.patch
index 5e422eb..0748919 100644
--- a/target/linux/generic/pending-3.18/259-regmap_dynamic.patch
+++ b/target/linux/generic/pending-3.18/259-regmap_dynamic.patch
@@ -7,22 +7,19 @@ 
 -	default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_MMIO || REGMAP_IRQ)
  	select IRQ_DOMAIN if REGMAP_IRQ
 -	bool
-+	tristate "Regmap"
++	tristate
  
  config REGCACHE_COMPRESSED
  	select LZO_COMPRESS
-@@ -13,19 +12,25 @@ config REGCACHE_COMPRESSED
- 	bool
+@@ -14,18 +13,24 @@ config REGCACHE_COMPRESSED
  
  config REGMAP_I2C
--	tristate
-+	tristate "Regmap I2C"
+ 	tristate
 +	select REGMAP
  	depends on I2C
  
  config REGMAP_SPI
--	tristate
-+	tristate "Regmap SPI"
+ 	tristate
 +	select REGMAP
 +	depends on SPI_MASTER
  	depends on SPI
@@ -33,8 +30,7 @@ 
  	depends on SPMI
  
  config REGMAP_MMIO
--	tristate
-+	tristate "Regmap MMIO"
+ 	tristate
 +	select REGMAP
  
  config REGMAP_IRQ
diff --git a/target/linux/ramips/modules.mk b/target/linux/ramips/modules.mk
index 88e83a4..36f46e2 100644
--- a/target/linux/ramips/modules.mk
+++ b/target/linux/ramips/modules.mk
@@ -116,7 +116,7 @@  $(eval $(call KernelPackage,hsdma-mtk))
 
 define KernelPackage/sound-mt7620
   TITLE:=MT7620 PCM/I2S Alsa Driver
-  DEPENDS:=@TARGET_ramips +kmod-sound-soc-core +kmod-regmap +kmod-dma-ralink @!TARGET_ramips_rt288x
+  DEPENDS:=@TARGET_ramips +kmod-sound-soc-core +kmod-regmap-mmio +kmod-dma-ralink @!TARGET_ramips_rt288x
   KCONFIG:= \
 	CONFIG_SND_RALINK_SOC_I2S \
 	CONFIG_SND_SIMPLE_CARD \