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