1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***
11  ****************************************************************************
12  ****************************************************************************/
13 #ifndef _UAPI_LINUX_I2C_DEV_H
14 #define _UAPI_LINUX_I2C_DEV_H
15 #include <linux/types.h>
16 #include "compiler.h"
17 
18 #define I2C_RETRIES 0x0701
19 #define I2C_TIMEOUT 0x0702
20 #define I2C_SLAVE 0x0703
21 #define I2C_SLAVE_FORCE 0x0706
22 
23 #define I2C_TENBIT 0x0704
24 #define I2C_FUNCS 0x0705
25 #define I2C_RDWR 0x0707
26 #define I2C_PEC 0x0708
27 
28 #define I2C_SMBUS 0x0720
29 
30 struct i2c_smbus_ioctl_data {
31  char read_write;
32  __u8 command;
33  int size;
34  union i2c_smbus_data __user *data;
35 };
36 struct i2c_rdwr_ioctl_data {
37  struct i2c_msg __user *msgs;
38  int nmsgs;
39 };
40 
41 #define I2C_SMBUS_BLOCK_MAX	32
42 #define I2C_SMBUS_I2C_BLOCK_MAX	32
43 union i2c_smbus_data {
44  __u8 byte;
45  __u16 word;
46  __u8 block[I2C_SMBUS_BLOCK_MAX + 2];
47 };
48 
49 #define I2C_RDRW_IOCTL_MAX_MSGS 42
50 
51 struct i2c_msg {
52  __u16 addr;
53  unsigned short flags;
54 #define I2C_M_TEN 0x10
55 #define I2C_M_RD 0x01
56 #define I2C_M_NOSTART 0x4000
57 #define I2C_M_REV_DIR_ADDR 0x2000
58 #define I2C_M_IGNORE_NAK 0x1000
59 #define I2C_M_NO_RD_ACK 0x0800
60  short len;
61  char *buf;
62 };
63 
64 #define I2C_NOCMD 0
65 #define I2C_SMBUS_READ	1
66 #define I2C_SMBUS_WRITE	0
67 
68 #define I2C_SMBUS_QUICK 0
69 #define I2C_SMBUS_BYTE 1
70 #define I2C_SMBUS_BYTE_DATA 2
71 #define I2C_SMBUS_WORD_DATA 3
72 #define I2C_SMBUS_PROC_CALL 4
73 #define I2C_SMBUS_BLOCK_DATA 5
74 #define I2C_SMBUS_I2C_BLOCK_BROKEN 6
75 #define I2C_SMBUS_BLOCK_PROC_CALL 7
76 #define I2C_SMBUS_I2C_BLOCK_DATA 8
77 
78 #define I2C_FUNC_I2C 0x00000001
79 #define I2C_FUNC_10BIT_ADDR 0x00000002
80 #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004
81 #define I2C_FUNC_SMBUS_PEC 0x00000008
82 #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000
83 #define I2C_FUNC_SMBUS_QUICK 0x00010000
84 #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
85 #define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000
86 #define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000
87 #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000
88 #define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000
89 #define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000
90 #define I2C_FUNC_SMBUS_PROC_CALL 0x00800000
91 #define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000
92 #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
93 #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000
94 #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000
95 
96 #endif
97