1 /*
2  * This header was generated from the Linux kernel headers by update_headers.py,
3  * to provide necessary information from kernel to userspace, such as constants,
4  * structures, and macros, and thus, contains no copyrightable information.
5  */
6 #ifndef _UAPI_LINUX_I2C_H
7 #define _UAPI_LINUX_I2C_H
8 #include <linux/types.h>
9 struct i2c_msg {
10 	__u16 addr;
11 	__u16 flags;
12 #define I2C_M_RD		0x0001
13 
14 #define I2C_M_TEN		0x0010
15 #define I2C_M_DMA_SAFE		0x0200
16 
17 
18 #define I2C_M_RECV_LEN		0x0400
19 #define I2C_M_NO_RD_ACK		0x0800
20 #define I2C_M_IGNORE_NAK	0x1000
21 #define I2C_M_REV_DIR_ADDR	0x2000
22 #define I2C_M_NOSTART		0x4000
23 #define I2C_M_STOP		0x8000
24 	__u16 len;
25 	__u8 *buf;
26 };
27 #define I2C_FUNC_I2C			0x00000001
28 #define I2C_FUNC_10BIT_ADDR		0x00000002
29 #define I2C_FUNC_PROTOCOL_MANGLING	0x00000004
30 #define I2C_FUNC_SMBUS_PEC		0x00000008
31 #define I2C_FUNC_NOSTART		0x00000010
32 #define I2C_FUNC_SLAVE			0x00000020
33 #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL	0x00008000
34 #define I2C_FUNC_SMBUS_QUICK		0x00010000
35 #define I2C_FUNC_SMBUS_READ_BYTE	0x00020000
36 #define I2C_FUNC_SMBUS_WRITE_BYTE	0x00040000
37 #define I2C_FUNC_SMBUS_READ_BYTE_DATA	0x00080000
38 #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA	0x00100000
39 #define I2C_FUNC_SMBUS_READ_WORD_DATA	0x00200000
40 #define I2C_FUNC_SMBUS_WRITE_WORD_DATA	0x00400000
41 #define I2C_FUNC_SMBUS_PROC_CALL	0x00800000
42 #define I2C_FUNC_SMBUS_READ_BLOCK_DATA	0x01000000
43 #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
44 #define I2C_FUNC_SMBUS_READ_I2C_BLOCK	0x04000000
45 #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK	0x08000000
46 #define I2C_FUNC_SMBUS_HOST_NOTIFY	0x10000000
47 #define I2C_FUNC_SMBUS_BYTE		(I2C_FUNC_SMBUS_READ_BYTE | \
48 					 I2C_FUNC_SMBUS_WRITE_BYTE)
49 #define I2C_FUNC_SMBUS_BYTE_DATA	(I2C_FUNC_SMBUS_READ_BYTE_DATA | \
50 					 I2C_FUNC_SMBUS_WRITE_BYTE_DATA)
51 #define I2C_FUNC_SMBUS_WORD_DATA	(I2C_FUNC_SMBUS_READ_WORD_DATA | \
52 					 I2C_FUNC_SMBUS_WRITE_WORD_DATA)
53 #define I2C_FUNC_SMBUS_BLOCK_DATA	(I2C_FUNC_SMBUS_READ_BLOCK_DATA | \
54 					 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)
55 #define I2C_FUNC_SMBUS_I2C_BLOCK	(I2C_FUNC_SMBUS_READ_I2C_BLOCK | \
56 					 I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)
57 #define I2C_FUNC_SMBUS_EMUL		(I2C_FUNC_SMBUS_QUICK | \
58 					 I2C_FUNC_SMBUS_BYTE | \
59 					 I2C_FUNC_SMBUS_BYTE_DATA | \
60 					 I2C_FUNC_SMBUS_WORD_DATA | \
61 					 I2C_FUNC_SMBUS_PROC_CALL | \
62 					 I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \
63 					 I2C_FUNC_SMBUS_I2C_BLOCK | \
64 					 I2C_FUNC_SMBUS_PEC)
65 #define I2C_SMBUS_BLOCK_MAX	32
66 union i2c_smbus_data {
67 	__u8 byte;
68 	__u16 word;
69 	__u8 block[I2C_SMBUS_BLOCK_MAX + 2];
70 
71 };
72 #define I2C_SMBUS_READ	1
73 #define I2C_SMBUS_WRITE	0
74 #define I2C_SMBUS_QUICK		    0
75 #define I2C_SMBUS_BYTE		    1
76 #define I2C_SMBUS_BYTE_DATA	    2
77 #define I2C_SMBUS_WORD_DATA	    3
78 #define I2C_SMBUS_PROC_CALL	    4
79 #define I2C_SMBUS_BLOCK_DATA	    5
80 #define I2C_SMBUS_I2C_BLOCK_BROKEN  6
81 #define I2C_SMBUS_BLOCK_PROC_CALL   7
82 #define I2C_SMBUS_I2C_BLOCK_DATA    8
83 #endif
84