xref: /freebsd-src/sys/compat/linuxkpi/common/include/linux/i2c-algo-bit.h (revision 1961a14a47437595fb7fcdc20e327440e3eb51e2)
1*1961a14aSEmmanuel Vadot /*-
2*1961a14aSEmmanuel Vadot  * Copyright (c) 2021 Beckhoff Automation GmbH & Co. KG
3*1961a14aSEmmanuel Vadot  *
4*1961a14aSEmmanuel Vadot  * Redistribution and use in source and binary forms, with or without
5*1961a14aSEmmanuel Vadot  * modification, are permitted provided that the following conditions
6*1961a14aSEmmanuel Vadot  * are met:
7*1961a14aSEmmanuel Vadot  * 1. Redistributions of source code must retain the above copyright
8*1961a14aSEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer.
9*1961a14aSEmmanuel Vadot  * 2. Redistributions in binary form must reproduce the above copyright
10*1961a14aSEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer in the
11*1961a14aSEmmanuel Vadot  *    documentation and/or other materials provided with the distribution.
12*1961a14aSEmmanuel Vadot  *
13*1961a14aSEmmanuel Vadot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14*1961a14aSEmmanuel Vadot  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15*1961a14aSEmmanuel Vadot  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16*1961a14aSEmmanuel Vadot  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17*1961a14aSEmmanuel Vadot  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18*1961a14aSEmmanuel Vadot  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19*1961a14aSEmmanuel Vadot  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20*1961a14aSEmmanuel Vadot  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21*1961a14aSEmmanuel Vadot  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22*1961a14aSEmmanuel Vadot  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23*1961a14aSEmmanuel Vadot  * SUCH DAMAGE.
24*1961a14aSEmmanuel Vadot  *
25*1961a14aSEmmanuel Vadot  */
26*1961a14aSEmmanuel Vadot 
27*1961a14aSEmmanuel Vadot #ifndef _LINUX_I2C_ALGO_BIT_H_
28*1961a14aSEmmanuel Vadot #define	_LINUX_I2C_ALGO_BIT_H_
29*1961a14aSEmmanuel Vadot 
30*1961a14aSEmmanuel Vadot #include <linux/i2c.h>
31*1961a14aSEmmanuel Vadot 
32*1961a14aSEmmanuel Vadot struct i2c_algo_bit_data {
33*1961a14aSEmmanuel Vadot 	void *data;
34*1961a14aSEmmanuel Vadot 	void (*setsda) (void *data, int state);
35*1961a14aSEmmanuel Vadot 	void (*setscl) (void *data, int state);
36*1961a14aSEmmanuel Vadot 	int (*getsda) (void *data);
37*1961a14aSEmmanuel Vadot 	int (*getscl) (void *data);
38*1961a14aSEmmanuel Vadot 	int (*pre_xfer)  (struct i2c_adapter *);
39*1961a14aSEmmanuel Vadot 	void (*post_xfer) (struct i2c_adapter *);
40*1961a14aSEmmanuel Vadot 
41*1961a14aSEmmanuel Vadot 	int udelay;
42*1961a14aSEmmanuel Vadot 	int timeout;
43*1961a14aSEmmanuel Vadot };
44*1961a14aSEmmanuel Vadot 
45*1961a14aSEmmanuel Vadot int lkpi_i2c_bit_add_bus(struct i2c_adapter *adapter);
46*1961a14aSEmmanuel Vadot 
47*1961a14aSEmmanuel Vadot #define	i2c_bit_add_bus(adapter)	lkpi_i2c_bit_add_bus(adapter)
48*1961a14aSEmmanuel Vadot 
49*1961a14aSEmmanuel Vadot #endif	/*_LINUX_I2C_ALGO_BIT_H_ */
50