[PATCH 07/11] drivers: base: regmap: introduce REGMAP_I2C

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Jan 11 00:01:15 PST 2023


regmap_init_i2c is quite limited right now and only supports 8-bit
registers and values. In future, we may want to expand this further, but
that would require us to format the regmap_config appropriately, pulling
in more code that's not required in the general case, where reg_read and
reg_write can be used directly. Add a new Kconfig symbol and select it
where appropriate to allow us to split formatted regmap handling from
the more basic handling we currently have.

We intentionally don't provide a stub function, so out-of-tree users
without the select fail to link and can be fixed.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/base/regmap/Kconfig  | 4 ++++
 drivers/base/regmap/Makefile | 2 +-
 drivers/mfd/Kconfig          | 4 ++++
 drivers/rtc/Kconfig          | 1 +
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig
index afe59a538c87..78a00a085f05 100644
--- a/drivers/base/regmap/Kconfig
+++ b/drivers/base/regmap/Kconfig
@@ -3,6 +3,10 @@
 config REGMAP_FORMATTED
 	bool
 
+config REGMAP_I2C
+	bool "I2C regmaps" if COMPILE_TEST
+	depends on I2C
+
 config REGMAP_SPI
 	bool "SPI regmaps" if COMPILE_TEST
 	depends on SPI
diff --git a/drivers/base/regmap/Makefile b/drivers/base/regmap/Makefile
index fe5beaaaa382..6911e07f0e62 100644
--- a/drivers/base/regmap/Makefile
+++ b/drivers/base/regmap/Makefile
@@ -3,5 +3,5 @@ obj-y	+= regmap.o
 obj-y	+= regmap-multi.o
 obj-y	+= regmap-mmio.o
 obj-$(CONFIG_REGMAP_FORMATTED)	+= regmap-fmt.o
-obj-$(CONFIG_I2C)	+= regmap-i2c.o
+obj-$(CONFIG_REGMAP_I2C)	+= regmap-i2c.o
 obj-$(CONFIG_REGMAP_SPI)	+= regmap-spi.o
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 5fd1a0aaa84e..c33fa262236c 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -64,12 +64,14 @@ config RAVE_SP_CORE
 
 config MFD_STPMIC1
 	depends on I2C
+	select REGMAP_I2C
 	bool "STPMIC1 MFD driver"
 	help
 	  Select this to support communication with the STPMIC1.
 
 config MFD_RN568PMIC
 	depends on I2C
+	select REGMAP_I2C
 	bool "Ricoh RN5T568 MFD driver"
 	help
 	  Select this to support communication with the Ricoh RN5T568 PMIC.
@@ -111,6 +113,7 @@ config MFD_ATMEL_FLEXCOM
 config MFD_RK808
 	tristate "Rockchip RK805/RK808/RK809/RK817/RK818 Power Management Chip"
 	depends on I2C && OFDEVICE
+	select REGMAP_I2C
 	help
 	  If you say yes here you get support for the RK805, RK808, RK809,
 	  RK817 and RK818 Power Management chips.
@@ -120,6 +123,7 @@ config MFD_RK808
 config MFD_AXP20X_I2C
 	tristate "X-Powers AXP series PMICs with I2C"
 	depends on I2C && OFDEVICE
+	select REGMAP_I2C
 	help
 	  If you say Y here you get support for the X-Powers AXP series power
 	  management ICs (PMICs) controlled with I2C.
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index db87aee1f320..98e58da89bd8 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -40,6 +40,7 @@ config RTC_DRV_ABRACON
 config RTC_DRV_PCF85363
 	tristate "NXP PCF85363"
 	depends on I2C
+	select REGMAP_I2C
 	help
 	  If you say yes here you get support for the PCF85363 RTC chip.
 
-- 
2.30.2




More information about the barebox mailing list