1# I2C configuration options
2
3# Copyright (c) 2015 Intel Corporation
4# SPDX-License-Identifier: Apache-2.0
5
6#
7# I2C options
8#
9menuconfig I2C
10	bool "Inter-Integrated Circuit (I2C) bus drivers"
11	help
12	  Enable I2C Driver Configuration
13
14if I2C
15
16config I2C_SHELL
17	bool "I2C Shell"
18	depends on SHELL
19	help
20	  Enable I2C Shell.
21
22	  The I2C shell supports scanning, bus recovery, I2C read and write
23	  operations.
24
25config I2C_STATS
26	bool "I2C device Stats"
27	depends on STATS
28	help
29	  Enable I2C Stats.
30
31config I2C_DUMP_MESSAGES
32	bool "Log I2C transactions"
33	depends on LOG
34	depends on I2C_LOG_LEVEL_DBG
35	help
36	  Dump every I2C transaction to the system log as debug level log messages.
37
38config I2C_DUMP_MESSAGES_ALLOWLIST
39	bool "Use allowlist for logging of I2C transactions"
40	depends on I2C_DUMP_MESSAGES
41	depends on DT_HAS_ZEPHYR_I2C_DUMP_ALLOWLIST_ENABLED
42	help
43	  Use allowlist to specify which devices transactions should be logged.
44	  The allowlist is defined in the devicetree using the compatible string of
45	  "zephyr,i2c-dump-allowlist" and phandles to the devices that need to be traced.
46	  Example of devicetree node:
47	  i2c-dump-allowlist {
48	    compatible = "zephyr,i2c-dump-allowlist";
49	    devices = < &display0 >, < &sensor3 >;
50	  };
51
52config I2C_CALLBACK
53	bool "I2C asynchronous callback API"
54	help
55	  API and implementations of i2c_transfer_cb.
56
57config I2C_ALLOW_NO_STOP_TRANSACTIONS
58	bool "Allows I2C transfers with no STOP on the last transaction [DEPRECATED]"
59	depends on !I2C_NRFX_TWI
60	depends on !I2C_NRFX_TWIM
61	depends on !I2C_STM32
62	depends on !I2C_GD32
63	depends on !I2C_ESP32
64	depends on !I2C_DW
65	select DEPRECATED
66	help
67	  Allow I2C transactions with no STOP on the last message. This is
68	  unsupported and can leave the bus in an unexpected state. The option
69	  will be removed in Zephyr 4.1.
70
71config I2C_RTIO
72	bool "I2C RTIO API"
73	select EXPERIMENTAL
74	select RTIO
75	select RTIO_WORKQ
76	help
77	  API and implementations of I2C for RTIO
78
79if I2C_RTIO
80config I2C_RTIO_SQ_SIZE
81	int "Submission queue size for blocking calls"
82	default 4
83	help
84	  Blocking i2c calls when I2C_RTIO is enabled are copied into a per driver
85	  submission queue. The queue depth determines the number of possible i2c_msg
86	  structs that may be in the array given to i2c_transfer. A sensible default
87	  is going to be 4 given the device address, register address, and a value
88	  to be read or written.
89
90config I2C_RTIO_CQ_SIZE
91	int "Completion queue size for blocking calls"
92	default 4
93	help
94	  Blocking i2c calls when I2C_RTIO is enabled are copied into a per driver
95	  submission queue. The queue depth determines the number of possible i2c_msg
96	  structs that may be in the array given to i2c_transfer. A sensible default
97	  is going to be 4 given the device address, register address, and a value
98	  to be read or written.
99
100config I2C_RTIO_FALLBACK_MSGS
101	int "Number of available i2c_msg structs for the default handler to use"
102	default 4
103	help
104		When RTIO is used with a driver that does not yet implement the submit API
105		natively the submissions are converted back to struct i2c_msg values that
106		are given to i2c_transfer. This requires some number of msgs be available to convert
107		the submissions into on the stack. MISRA rules dictate we must know this in
108		advance.
109
110		In all likelihood 4 is going to work for everyone, but in case you do end up with
111		an issue where you are using RTIO, your driver does not implement submit natively,
112		and get an error relating to not enough i2c msgs this is the Kconfig to manipulate.
113
114endif # I2C_RTIO
115
116
117# Include these first so that any properties (e.g. defaults) below can be
118# overridden (by defining symbols in multiple locations)
119source "drivers/i2c/target/Kconfig"
120source "drivers/i2c/Kconfig.ambiq"
121source "drivers/i2c/Kconfig.andes_atciic100"
122source "drivers/i2c/Kconfig.b91"
123source "drivers/i2c/Kconfig.bcm_iproc"
124source "drivers/i2c/Kconfig.cc13xx_cc26xx"
125source "drivers/i2c/Kconfig.dw"
126source "drivers/i2c/Kconfig.ene"
127source "drivers/i2c/Kconfig.esp32"
128source "drivers/i2c/Kconfig.gd32"
129source "drivers/i2c/Kconfig.gpio"
130source "drivers/i2c/Kconfig.ifx_cat1"
131source "drivers/i2c/Kconfig.ifx_xmc4"
132source "drivers/i2c/Kconfig.it8xxx2"
133source "drivers/i2c/Kconfig.i2c_emul"
134source "drivers/i2c/Kconfig.litex"
135source "drivers/i2c/Kconfig.lpc11u6x"
136source "drivers/i2c/Kconfig.max32"
137source "drivers/i2c/Kconfig.mchp_mss"
138source "drivers/i2c/Kconfig.mcux"
139source "drivers/i2c/Kconfig.npcx"
140source "drivers/i2c/Kconfig.nrfx"
141source "drivers/i2c/Kconfig.numaker"
142source "drivers/i2c/Kconfig.renesas_ra"
143source "drivers/i2c/Kconfig.rcar"
144source "drivers/i2c/Kconfig.sam0"
145source "drivers/i2c/Kconfig.sam_twihs"
146source "drivers/i2c/Kconfig.sbcon"
147source "drivers/i2c/Kconfig.sc18im704"
148source "drivers/i2c/Kconfig.sedi"
149source "drivers/i2c/Kconfig.sifive"
150source "drivers/i2c/Kconfig.smartbond"
151source "drivers/i2c/Kconfig.stm32"
152
153source "drivers/i2c/Kconfig.tca954x"
154source "drivers/i2c/Kconfig.test"
155source "drivers/i2c/Kconfig.xec"
156source "drivers/i2c/Kconfig.xilinx_axi"
157
158config I2C_INIT_PRIORITY
159	int "Init priority"
160	default KERNEL_INIT_PRIORITY_DEVICE
161	help
162	  I2C device driver initialization priority.
163
164
165module = I2C
166module-str = i2c
167source "subsys/logging/Kconfig.template.log_config"
168
169config I2C_GECKO
170	bool "Gecko I2C driver"
171	default y
172	depends on DT_HAS_SILABS_GECKO_I2C_ENABLED
173	select SOC_GECKO_I2C
174	select PINCTRL if SOC_FAMILY_SILABS_S2
175	help
176	  Enable the SiLabs Gecko I2C bus driver.
177
178config I2C_SAM_TWIM
179	bool "Atmel SAM (TWIM) I2C driver"
180	default y
181	depends on DT_HAS_ATMEL_SAM_I2C_TWIM_ENABLED
182	select PINCTRL
183	help
184	  Enable Atmel SAM MCU Family (TWIM) I2C bus driver.
185
186config I2C_SAM_TWI
187	bool "Atmel SAM (TWI) I2C driver"
188	default y
189	depends on DT_HAS_ATMEL_SAM_I2C_TWI_ENABLED
190	select PINCTRL
191	help
192	  Enable Atmel SAM MCU Family (TWI) I2C bus driver.
193
194config I2C_MCUX
195	bool "MCUX I2C driver"
196	default y
197	depends on DT_HAS_NXP_KINETIS_I2C_ENABLED
198	select PINCTRL
199	help
200	  Enable the mcux I2C driver.
201
202config I2C_MCUX_LPI2C
203	bool "MCUX LPI2C driver"
204	default y
205	depends on DT_HAS_NXP_LPI2C_ENABLED
206	depends on CLOCK_CONTROL
207	select PINCTRL
208	help
209	  Enable the mcux LPI2C driver.
210
211config I2C_MCUX_LPI2C_BUS_RECOVERY
212	bool "Bus recovery support"
213	depends on I2C_MCUX_LPI2C && PINCTRL
214	select I2C_BITBANG
215	help
216	  Enable LPI2C driver bus recovery support via GPIO bitbanging.
217
218config I2C_IMX
219	bool "i.MX I2C driver"
220	default y
221	depends on DT_HAS_FSL_IMX21_I2C_ENABLED
222	select PINCTRL
223	help
224	  Enable the i.MX I2C driver.
225
226config I2C_CC32XX
227	bool "CC32XX I2C driver"
228	default y
229	depends on DT_HAS_TI_CC32XX_I2C_ENABLED
230	select PINCTRL
231	help
232	  Enable the CC32XX I2C driver.
233
234config I2C_BITBANG
235	bool
236	help
237	  Enable library used for software driven (bit banging) I2C support
238
239config I2C_NIOS2
240	bool "Nios-II I2C driver"
241	default y
242	depends on DT_HAS_ALTR_NIOS2_I2C_ENABLED
243	help
244	  Enable the Nios-II I2C driver.
245
246config I2C_RV32M1_LPI2C
247	bool "RV32M1 LPI2C driver"
248	default y
249	depends on DT_HAS_OPENISA_RV32M1_LPI2C_ENABLED
250	depends on CLOCK_CONTROL
251	select PINCTRL
252	help
253	  Enable the RV32M1 LPI2C driver.
254
255config GPIO_I2C_SWITCH
256	bool "GPIO controlled I2C bus switch"
257	default y
258	depends on DT_HAS_GPIO_I2C_SWITCH_ENABLED
259	help
260	  Enable GPIO controlled I2C bus switch driver.
261
262endif # I2C
263