Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 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 | *** To edit the content of this header, modify the corresponding |
| 11 | *** source file (e.g. under external/kernel-headers/original/) then |
| 12 | *** run bionic/libc/kernel/tools/update_all.py |
| 13 | *** |
| 14 | *** Any manual change here will be lost the next time this script will |
| 15 | *** be run. You've been warned! |
| 16 | *** |
| 17 | **************************************************************************** |
| 18 | ****************************************************************************/ |
| 19 | #ifndef _UAPI_LINUX_I2C_H |
| 20 | #define _UAPI_LINUX_I2C_H |
| 21 | #include <linux/types.h> |
| 22 | struct i2c_msg { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 23 | __u16 addr; |
| 24 | __u16 flags; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 25 | #define I2C_M_RD 0x0001 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 26 | #define I2C_M_TEN 0x0010 |
Christopher Ferris | 76a1d45 | 2018-06-27 14:12:29 -0700 | [diff] [blame] | 27 | #define I2C_M_DMA_SAFE 0x0200 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 28 | #define I2C_M_RECV_LEN 0x0400 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 29 | #define I2C_M_NO_RD_ACK 0x0800 |
| 30 | #define I2C_M_IGNORE_NAK 0x1000 |
| 31 | #define I2C_M_REV_DIR_ADDR 0x2000 |
Christopher Ferris | 106b3a8 | 2016-08-24 12:15:38 -0700 | [diff] [blame] | 32 | #define I2C_M_NOSTART 0x4000 |
| 33 | #define I2C_M_STOP 0x8000 |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 34 | __u16 len; |
| 35 | __u8 * buf; |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 36 | }; |
| 37 | #define I2C_FUNC_I2C 0x00000001 |
| 38 | #define I2C_FUNC_10BIT_ADDR 0x00000002 |
| 39 | #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 40 | #define I2C_FUNC_SMBUS_PEC 0x00000008 |
| 41 | #define I2C_FUNC_NOSTART 0x00000010 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 42 | #define I2C_FUNC_SLAVE 0x00000020 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 43 | #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 44 | #define I2C_FUNC_SMBUS_QUICK 0x00010000 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 45 | #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 |
| 46 | #define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 |
| 47 | #define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 48 | #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 49 | #define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 |
| 50 | #define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 |
| 51 | #define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 52 | #define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 53 | #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 |
| 54 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 |
| 55 | #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 56 | #define I2C_FUNC_SMBUS_HOST_NOTIFY 0x10000000 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 57 | #define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 58 | #define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | I2C_FUNC_SMBUS_WRITE_BYTE_DATA) |
| 59 | #define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | I2C_FUNC_SMBUS_WRITE_WORD_DATA) |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 60 | #define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA) |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 61 | #define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK) |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 62 | #define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_PROC_CALL | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | I2C_FUNC_SMBUS_I2C_BLOCK | I2C_FUNC_SMBUS_PEC) |
Christopher Ferris | a9750ed | 2021-05-03 14:02:49 -0700 | [diff] [blame] | 63 | #define I2C_FUNC_SMBUS_EMUL_ALL (I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_BLOCK_PROC_CALL) |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 64 | #define I2C_SMBUS_BLOCK_MAX 32 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 65 | union i2c_smbus_data { |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 66 | __u8 byte; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 67 | __u16 word; |
| 68 | __u8 block[I2C_SMBUS_BLOCK_MAX + 2]; |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 69 | }; |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 70 | #define I2C_SMBUS_READ 1 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 71 | #define I2C_SMBUS_WRITE 0 |
| 72 | #define I2C_SMBUS_QUICK 0 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 73 | #define I2C_SMBUS_BYTE 1 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 74 | #define I2C_SMBUS_BYTE_DATA 2 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 75 | #define I2C_SMBUS_WORD_DATA 3 |
| 76 | #define I2C_SMBUS_PROC_CALL 4 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 77 | #define I2C_SMBUS_BLOCK_DATA 5 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 78 | #define I2C_SMBUS_I2C_BLOCK_BROKEN 6 |
Ben Cheng | 655a7c0 | 2013-10-16 16:09:24 -0700 | [diff] [blame] | 79 | #define I2C_SMBUS_BLOCK_PROC_CALL 7 |
| 80 | #define I2C_SMBUS_I2C_BLOCK_DATA 8 |
Christopher Ferris | 49f525c | 2016-12-12 14:55:36 -0800 | [diff] [blame] | 81 | #endif |