1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
21e9d4219SWolfram Sang /*
31e9d4219SWolfram Sang  * i2c-gpio interface to platform code
41e9d4219SWolfram Sang  *
51e9d4219SWolfram Sang  * Copyright (C) 2007 Atmel Corporation
61e9d4219SWolfram Sang  */
71e9d4219SWolfram Sang #ifndef _LINUX_I2C_GPIO_H
81e9d4219SWolfram Sang #define _LINUX_I2C_GPIO_H
91e9d4219SWolfram Sang 
101e9d4219SWolfram Sang /**
111e9d4219SWolfram Sang  * struct i2c_gpio_platform_data - Platform-dependent data for i2c-gpio
121e9d4219SWolfram Sang  * @udelay: signal toggle delay. SCL frequency is (500 / udelay) kHz
131e9d4219SWolfram Sang  * @timeout: clock stretching timeout in jiffies. If the slave keeps
141e9d4219SWolfram Sang  *	SCL low for longer than this, the transfer will time out.
151e9d4219SWolfram Sang  * @sda_is_open_drain: SDA is configured as open drain, i.e. the pin
161e9d4219SWolfram Sang  *	isn't actively driven high when setting the output value high.
171e9d4219SWolfram Sang  *	gpio_get_value() must return the actual pin state even if the
181e9d4219SWolfram Sang  *	pin is configured as an output.
19*8786b095SHeiner Kallweit  * @sda_is_output_only: SDA output drivers can't be turned off.
20*8786b095SHeiner Kallweit  *	This is for clients that can only read SDA/SCL.
21*8786b095SHeiner Kallweit  * @sda_has_no_pullup: SDA is used in a non-compliant way and has no pull-up.
22*8786b095SHeiner Kallweit  *	Therefore disable open-drain.
231e9d4219SWolfram Sang  * @scl_is_open_drain: SCL is set up as open drain. Same requirements
241e9d4219SWolfram Sang  *	as for sda_is_open_drain apply.
251e9d4219SWolfram Sang  * @scl_is_output_only: SCL output drivers cannot be turned off.
26*8786b095SHeiner Kallweit  * @scl_has_no_pullup: SCL is used in a non-compliant way and has no pull-up.
27*8786b095SHeiner Kallweit  *	Therefore disable open-drain.
281e9d4219SWolfram Sang  */
291e9d4219SWolfram Sang struct i2c_gpio_platform_data {
301e9d4219SWolfram Sang 	int		udelay;
311e9d4219SWolfram Sang 	int		timeout;
321e9d4219SWolfram Sang 	unsigned int	sda_is_open_drain:1;
33*8786b095SHeiner Kallweit 	unsigned int	sda_is_output_only:1;
34*8786b095SHeiner Kallweit 	unsigned int	sda_has_no_pullup:1;
351e9d4219SWolfram Sang 	unsigned int	scl_is_open_drain:1;
361e9d4219SWolfram Sang 	unsigned int	scl_is_output_only:1;
37*8786b095SHeiner Kallweit 	unsigned int	scl_has_no_pullup:1;
381e9d4219SWolfram Sang };
391e9d4219SWolfram Sang 
401e9d4219SWolfram Sang #endif /* _LINUX_I2C_GPIO_H */
41