xref: /utopia/UTPA2-700.0.x/projects/tools/lint/mips-linux-gnu_include/linux/i2c-dev.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1*53ee8cc1Swenshuai.xi /*
2*53ee8cc1Swenshuai.xi     i2c-dev.h - i2c-bus driver, char device interface
3*53ee8cc1Swenshuai.xi 
4*53ee8cc1Swenshuai.xi     Copyright (C) 1995-97 Simon G. Vogl
5*53ee8cc1Swenshuai.xi     Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl>
6*53ee8cc1Swenshuai.xi 
7*53ee8cc1Swenshuai.xi     This program is free software; you can redistribute it and/or modify
8*53ee8cc1Swenshuai.xi     it under the terms of the GNU General Public License as published by
9*53ee8cc1Swenshuai.xi     the Free Software Foundation; either version 2 of the License, or
10*53ee8cc1Swenshuai.xi     (at your option) any later version.
11*53ee8cc1Swenshuai.xi 
12*53ee8cc1Swenshuai.xi     This program is distributed in the hope that it will be useful,
13*53ee8cc1Swenshuai.xi     but WITHOUT ANY WARRANTY; without even the implied warranty of
14*53ee8cc1Swenshuai.xi     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15*53ee8cc1Swenshuai.xi     GNU General Public License for more details.
16*53ee8cc1Swenshuai.xi 
17*53ee8cc1Swenshuai.xi     You should have received a copy of the GNU General Public License
18*53ee8cc1Swenshuai.xi     along with this program; if not, write to the Free Software
19*53ee8cc1Swenshuai.xi     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*53ee8cc1Swenshuai.xi */
21*53ee8cc1Swenshuai.xi 
22*53ee8cc1Swenshuai.xi #ifndef _LINUX_I2C_DEV_H
23*53ee8cc1Swenshuai.xi #define _LINUX_I2C_DEV_H
24*53ee8cc1Swenshuai.xi 
25*53ee8cc1Swenshuai.xi #include <linux/types.h>
26*53ee8cc1Swenshuai.xi 
27*53ee8cc1Swenshuai.xi /* /dev/i2c-X ioctl commands.  The ioctl's parameter is always an
28*53ee8cc1Swenshuai.xi  * unsigned long, except for:
29*53ee8cc1Swenshuai.xi  *	- I2C_FUNCS, takes pointer to an unsigned long
30*53ee8cc1Swenshuai.xi  *	- I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data
31*53ee8cc1Swenshuai.xi  *	- I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data
32*53ee8cc1Swenshuai.xi  */
33*53ee8cc1Swenshuai.xi #define I2C_RETRIES	0x0701	/* number of times a device address should
34*53ee8cc1Swenshuai.xi 				   be polled when not acknowledging */
35*53ee8cc1Swenshuai.xi #define I2C_TIMEOUT	0x0702	/* set timeout in jiffies - call with int */
36*53ee8cc1Swenshuai.xi 
37*53ee8cc1Swenshuai.xi /* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses
38*53ee8cc1Swenshuai.xi  * are NOT supported! (due to code brokenness)
39*53ee8cc1Swenshuai.xi  */
40*53ee8cc1Swenshuai.xi #define I2C_SLAVE	0x0703	/* Use this slave address */
41*53ee8cc1Swenshuai.xi #define I2C_SLAVE_FORCE	0x0706	/* Use this slave address, even if it
42*53ee8cc1Swenshuai.xi 				   is already in use by a driver! */
43*53ee8cc1Swenshuai.xi #define I2C_TENBIT	0x0704	/* 0 for 7 bit addrs, != 0 for 10 bit */
44*53ee8cc1Swenshuai.xi 
45*53ee8cc1Swenshuai.xi #define I2C_FUNCS	0x0705	/* Get the adapter functionality mask */
46*53ee8cc1Swenshuai.xi 
47*53ee8cc1Swenshuai.xi #define I2C_RDWR	0x0707	/* Combined R/W transfer (one STOP only) */
48*53ee8cc1Swenshuai.xi 
49*53ee8cc1Swenshuai.xi #define I2C_PEC		0x0708	/* != 0 to use PEC with SMBus */
50*53ee8cc1Swenshuai.xi #define I2C_SMBUS	0x0720	/* SMBus transfer */
51*53ee8cc1Swenshuai.xi 
52*53ee8cc1Swenshuai.xi 
53*53ee8cc1Swenshuai.xi /* This is the structure as used in the I2C_SMBUS ioctl call */
54*53ee8cc1Swenshuai.xi struct i2c_smbus_ioctl_data {
55*53ee8cc1Swenshuai.xi 	__u8 read_write;
56*53ee8cc1Swenshuai.xi 	__u8 command;
57*53ee8cc1Swenshuai.xi 	__u32 size;
58*53ee8cc1Swenshuai.xi 	union i2c_smbus_data *data;
59*53ee8cc1Swenshuai.xi };
60*53ee8cc1Swenshuai.xi 
61*53ee8cc1Swenshuai.xi /* This is the structure as used in the I2C_RDWR ioctl call */
62*53ee8cc1Swenshuai.xi struct i2c_rdwr_ioctl_data {
63*53ee8cc1Swenshuai.xi 	struct i2c_msg *msgs;	/* pointers to i2c_msgs */
64*53ee8cc1Swenshuai.xi 	__u32 nmsgs;			/* number of i2c_msgs */
65*53ee8cc1Swenshuai.xi };
66*53ee8cc1Swenshuai.xi 
67*53ee8cc1Swenshuai.xi #define  I2C_RDRW_IOCTL_MAX_MSGS	42
68*53ee8cc1Swenshuai.xi 
69*53ee8cc1Swenshuai.xi 
70*53ee8cc1Swenshuai.xi #endif /* _LINUX_I2C_DEV_H */
71