xref: /src/sys/compat/linuxkpi/common/include/linux/i2c-algo-bit.h (revision 1961a14a47437595fb7fcdc20e327440e3eb51e2)
11961a14aSEmmanuel Vadot /*-
21961a14aSEmmanuel Vadot  * Copyright (c) 2021 Beckhoff Automation GmbH & Co. KG
31961a14aSEmmanuel Vadot  *
41961a14aSEmmanuel Vadot  * Redistribution and use in source and binary forms, with or without
51961a14aSEmmanuel Vadot  * modification, are permitted provided that the following conditions
61961a14aSEmmanuel Vadot  * are met:
71961a14aSEmmanuel Vadot  * 1. Redistributions of source code must retain the above copyright
81961a14aSEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer.
91961a14aSEmmanuel Vadot  * 2. Redistributions in binary form must reproduce the above copyright
101961a14aSEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer in the
111961a14aSEmmanuel Vadot  *    documentation and/or other materials provided with the distribution.
121961a14aSEmmanuel Vadot  *
131961a14aSEmmanuel Vadot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
141961a14aSEmmanuel Vadot  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
151961a14aSEmmanuel Vadot  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
161961a14aSEmmanuel Vadot  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
171961a14aSEmmanuel Vadot  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
181961a14aSEmmanuel Vadot  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
191961a14aSEmmanuel Vadot  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
201961a14aSEmmanuel Vadot  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
211961a14aSEmmanuel Vadot  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
221961a14aSEmmanuel Vadot  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
231961a14aSEmmanuel Vadot  * SUCH DAMAGE.
241961a14aSEmmanuel Vadot  *
251961a14aSEmmanuel Vadot  */
261961a14aSEmmanuel Vadot 
271961a14aSEmmanuel Vadot #ifndef _LINUX_I2C_ALGO_BIT_H_
281961a14aSEmmanuel Vadot #define	_LINUX_I2C_ALGO_BIT_H_
291961a14aSEmmanuel Vadot 
301961a14aSEmmanuel Vadot #include <linux/i2c.h>
311961a14aSEmmanuel Vadot 
321961a14aSEmmanuel Vadot struct i2c_algo_bit_data {
331961a14aSEmmanuel Vadot 	void *data;
341961a14aSEmmanuel Vadot 	void (*setsda) (void *data, int state);
351961a14aSEmmanuel Vadot 	void (*setscl) (void *data, int state);
361961a14aSEmmanuel Vadot 	int (*getsda) (void *data);
371961a14aSEmmanuel Vadot 	int (*getscl) (void *data);
381961a14aSEmmanuel Vadot 	int (*pre_xfer)  (struct i2c_adapter *);
391961a14aSEmmanuel Vadot 	void (*post_xfer) (struct i2c_adapter *);
401961a14aSEmmanuel Vadot 
411961a14aSEmmanuel Vadot 	int udelay;
421961a14aSEmmanuel Vadot 	int timeout;
431961a14aSEmmanuel Vadot };
441961a14aSEmmanuel Vadot 
451961a14aSEmmanuel Vadot int lkpi_i2c_bit_add_bus(struct i2c_adapter *adapter);
461961a14aSEmmanuel Vadot 
471961a14aSEmmanuel Vadot #define	i2c_bit_add_bus(adapter)	lkpi_i2c_bit_add_bus(adapter)
481961a14aSEmmanuel Vadot 
491961a14aSEmmanuel Vadot #endif	/*_LINUX_I2C_ALGO_BIT_H_ */
50