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