xref: /OK3568_Linux_fs/kernel/include/linux/platform_data/i2c-gpio.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * i2c-gpio interface to platform code
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright (C) 2007 Atmel Corporation
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun #ifndef _LINUX_I2C_GPIO_H
8*4882a593Smuzhiyun #define _LINUX_I2C_GPIO_H
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun /**
11*4882a593Smuzhiyun  * struct i2c_gpio_platform_data - Platform-dependent data for i2c-gpio
12*4882a593Smuzhiyun  * @udelay: signal toggle delay. SCL frequency is (500 / udelay) kHz
13*4882a593Smuzhiyun  * @timeout: clock stretching timeout in jiffies. If the slave keeps
14*4882a593Smuzhiyun  *	SCL low for longer than this, the transfer will time out.
15*4882a593Smuzhiyun  * @sda_is_open_drain: SDA is configured as open drain, i.e. the pin
16*4882a593Smuzhiyun  *	isn't actively driven high when setting the output value high.
17*4882a593Smuzhiyun  *	gpio_get_value() must return the actual pin state even if the
18*4882a593Smuzhiyun  *	pin is configured as an output.
19*4882a593Smuzhiyun  * @scl_is_open_drain: SCL is set up as open drain. Same requirements
20*4882a593Smuzhiyun  *	as for sda_is_open_drain apply.
21*4882a593Smuzhiyun  * @scl_is_output_only: SCL output drivers cannot be turned off.
22*4882a593Smuzhiyun  */
23*4882a593Smuzhiyun struct i2c_gpio_platform_data {
24*4882a593Smuzhiyun 	int		udelay;
25*4882a593Smuzhiyun 	int		timeout;
26*4882a593Smuzhiyun 	unsigned int	sda_is_open_drain:1;
27*4882a593Smuzhiyun 	unsigned int	scl_is_open_drain:1;
28*4882a593Smuzhiyun 	unsigned int	scl_is_output_only:1;
29*4882a593Smuzhiyun };
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun #endif /* _LINUX_I2C_GPIO_H */
32