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"
120# zephyr-keep-sorted-start
121source "drivers/i2c/Kconfig.ambiq"
122source "drivers/i2c/Kconfig.andes_atciic100"
123source "drivers/i2c/Kconfig.b91"
124source "drivers/i2c/Kconfig.bcm_iproc"
125source "drivers/i2c/Kconfig.cc13xx_cc26xx"
126source "drivers/i2c/Kconfig.cdns"
127source "drivers/i2c/Kconfig.dw"
128source "drivers/i2c/Kconfig.ene"
129source "drivers/i2c/Kconfig.esp32"
130source "drivers/i2c/Kconfig.gd32"
131source "drivers/i2c/Kconfig.gpio"
132source "drivers/i2c/Kconfig.i2c_emul"
133source "drivers/i2c/Kconfig.ifx_cat1"
134source "drivers/i2c/Kconfig.ifx_xmc4"
135source "drivers/i2c/Kconfig.it8xxx2"
136source "drivers/i2c/Kconfig.litex"
137source "drivers/i2c/Kconfig.lpc11u6x"
138source "drivers/i2c/Kconfig.max32"
139source "drivers/i2c/Kconfig.mchp_mss"
140source "drivers/i2c/Kconfig.mcux"
141source "drivers/i2c/Kconfig.npcx"
142source "drivers/i2c/Kconfig.nrfx"
143source "drivers/i2c/Kconfig.numaker"
144source "drivers/i2c/Kconfig.omap"
145source "drivers/i2c/Kconfig.rcar"
146source "drivers/i2c/Kconfig.renesas_ra"
147source "drivers/i2c/Kconfig.renesas_rz"
148source "drivers/i2c/Kconfig.sam0"
149source "drivers/i2c/Kconfig.sam_twihs"
150source "drivers/i2c/Kconfig.sbcon"
151source "drivers/i2c/Kconfig.sc18im704"
152source "drivers/i2c/Kconfig.sedi"
153source "drivers/i2c/Kconfig.sifive"
154source "drivers/i2c/Kconfig.smartbond"
155source "drivers/i2c/Kconfig.stm32"
156source "drivers/i2c/Kconfig.sy1xx"
157source "drivers/i2c/Kconfig.tca954x"
158source "drivers/i2c/Kconfig.test"
159source "drivers/i2c/Kconfig.xec"
160source "drivers/i2c/Kconfig.xilinx_axi"
161# zephyr-keep-sorted-stop
162
163config I2C_INIT_PRIORITY
164	int "Init priority"
165	default KERNEL_INIT_PRIORITY_DEVICE
166	help
167	  I2C device driver initialization priority.
168
169
170module = I2C
171module-str = i2c
172source "subsys/logging/Kconfig.template.log_config"
173
174config I2C_GECKO
175	bool "Gecko I2C driver"
176	default y
177	depends on DT_HAS_SILABS_GECKO_I2C_ENABLED
178	select SOC_GECKO_I2C
179	select PINCTRL if SOC_FAMILY_SILABS_S2
180	help
181	  Enable the SiLabs Gecko I2C bus driver.
182
183config I2C_SAM_TWIM
184	bool "Atmel SAM (TWIM) I2C driver"
185	default y
186	depends on DT_HAS_ATMEL_SAM_I2C_TWIM_ENABLED
187	select PINCTRL
188	help
189	  Enable Atmel SAM MCU Family (TWIM) I2C bus driver.
190
191config I2C_SAM_TWI
192	bool "Atmel SAM (TWI) I2C driver"
193	default y
194	depends on DT_HAS_ATMEL_SAM_I2C_TWI_ENABLED
195	select PINCTRL
196	help
197	  Enable Atmel SAM MCU Family (TWI) I2C bus driver.
198
199config I2C_MCUX
200	bool "MCUX I2C driver"
201	default y
202	depends on DT_HAS_NXP_KINETIS_I2C_ENABLED
203	select PINCTRL
204	help
205	  Enable the mcux I2C driver.
206
207config I2C_MCUX_LPI2C
208	bool "MCUX LPI2C driver"
209	default y
210	depends on DT_HAS_NXP_LPI2C_ENABLED
211	depends on CLOCK_CONTROL
212	select PINCTRL
213	help
214	  Enable the mcux LPI2C driver.
215
216config I2C_MCUX_LPI2C_BUS_RECOVERY
217	bool "Bus recovery support"
218	depends on I2C_MCUX_LPI2C && PINCTRL
219	select I2C_BITBANG
220	help
221	  Enable LPI2C driver bus recovery support via GPIO bitbanging.
222
223config I2C_IMX
224	bool "i.MX I2C driver"
225	default y
226	depends on DT_HAS_FSL_IMX21_I2C_ENABLED
227	select PINCTRL
228	help
229	  Enable the i.MX I2C driver.
230
231config I2C_CC32XX
232	bool "CC32XX I2C driver"
233	default y
234	depends on DT_HAS_TI_CC32XX_I2C_ENABLED
235	select PINCTRL
236	help
237	  Enable the CC32XX I2C driver.
238
239config I2C_BITBANG
240	bool
241	help
242	  Enable library used for software driven (bit banging) I2C support
243
244config I2C_NIOS2
245	bool "Nios-II I2C driver"
246	default y
247	depends on DT_HAS_ALTR_NIOS2_I2C_ENABLED
248	help
249	  Enable the Nios-II I2C driver.
250
251config I2C_RV32M1_LPI2C
252	bool "RV32M1 LPI2C driver"
253	default y
254	depends on DT_HAS_OPENISA_RV32M1_LPI2C_ENABLED
255	depends on CLOCK_CONTROL
256	select PINCTRL
257	help
258	  Enable the RV32M1 LPI2C driver.
259
260config GPIO_I2C_SWITCH
261	bool "GPIO controlled I2C bus switch"
262	default y
263	depends on DT_HAS_GPIO_I2C_SWITCH_ENABLED
264	help
265	  Enable GPIO controlled I2C bus switch driver.
266
267config I2C_NXP_II2C
268	bool "NXP i.MX8M serial I2C driver"
269	default y
270	depends on DT_HAS_NXP_II2C_ENABLED
271	help
272	  Enable the NXP II2C driver.
273
274endif # I2C
275