blob: bf7481c97661695d10fea481c22d216f619491c0 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
2 * This file is auto-generated. Modifications will be lost.
3 *
4 * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5 * for more information.
6 */
Ben Cheng655a7c02013-10-16 16:09:24 -07007#ifndef _UAPI_LINUX_I2C_H
8#define _UAPI_LINUX_I2C_H
9#include <linux/types.h>
10struct i2c_msg {
Tao Baod7db5942015-01-28 10:07:51 -080011 __u16 addr;
12 __u16 flags;
Ben Cheng655a7c02013-10-16 16:09:24 -070013#define I2C_M_RD 0x0001
Christopher Ferris106b3a82016-08-24 12:15:38 -070014#define I2C_M_TEN 0x0010
Christopher Ferris76a1d452018-06-27 14:12:29 -070015#define I2C_M_DMA_SAFE 0x0200
Ben Cheng655a7c02013-10-16 16:09:24 -070016#define I2C_M_RECV_LEN 0x0400
Christopher Ferris106b3a82016-08-24 12:15:38 -070017#define I2C_M_NO_RD_ACK 0x0800
18#define I2C_M_IGNORE_NAK 0x1000
19#define I2C_M_REV_DIR_ADDR 0x2000
Christopher Ferris106b3a82016-08-24 12:15:38 -070020#define I2C_M_NOSTART 0x4000
21#define I2C_M_STOP 0x8000
Tao Baod7db5942015-01-28 10:07:51 -080022 __u16 len;
23 __u8 * buf;
Ben Cheng655a7c02013-10-16 16:09:24 -070024};
25#define I2C_FUNC_I2C 0x00000001
26#define I2C_FUNC_10BIT_ADDR 0x00000002
27#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004
Ben Cheng655a7c02013-10-16 16:09:24 -070028#define I2C_FUNC_SMBUS_PEC 0x00000008
29#define I2C_FUNC_NOSTART 0x00000010
Christopher Ferris05d08e92016-02-04 13:16:38 -080030#define I2C_FUNC_SLAVE 0x00000020
Ben Cheng655a7c02013-10-16 16:09:24 -070031#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000
Christopher Ferris05d08e92016-02-04 13:16:38 -080032#define I2C_FUNC_SMBUS_QUICK 0x00010000
Ben Cheng655a7c02013-10-16 16:09:24 -070033#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
34#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000
35#define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000
Christopher Ferris05d08e92016-02-04 13:16:38 -080036#define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000
Ben Cheng655a7c02013-10-16 16:09:24 -070037#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000
38#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000
39#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000
Christopher Ferris05d08e92016-02-04 13:16:38 -080040#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000
Ben Cheng655a7c02013-10-16 16:09:24 -070041#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
42#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000
43#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000
Christopher Ferris49f525c2016-12-12 14:55:36 -080044#define I2C_FUNC_SMBUS_HOST_NOTIFY 0x10000000
Christopher Ferris05d08e92016-02-04 13:16:38 -080045#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE)
Tao Baod7db5942015-01-28 10:07:51 -080046#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)
47#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | I2C_FUNC_SMBUS_WRITE_WORD_DATA)
Christopher Ferris49f525c2016-12-12 14:55:36 -080048#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)
Christopher Ferris05d08e92016-02-04 13:16:38 -080049#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)
Tao Baod7db5942015-01-28 10:07:51 -080050#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 Ferrisa9750ed2021-05-03 14:02:49 -070051#define I2C_FUNC_SMBUS_EMUL_ALL (I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SMBUS_READ_BLOCK_DATA | I2C_FUNC_SMBUS_BLOCK_PROC_CALL)
Ben Cheng655a7c02013-10-16 16:09:24 -070052#define I2C_SMBUS_BLOCK_MAX 32
Christopher Ferris49f525c2016-12-12 14:55:36 -080053union i2c_smbus_data {
Christopher Ferris05d08e92016-02-04 13:16:38 -080054 __u8 byte;
Tao Baod7db5942015-01-28 10:07:51 -080055 __u16 word;
56 __u8 block[I2C_SMBUS_BLOCK_MAX + 2];
Christopher Ferris49f525c2016-12-12 14:55:36 -080057};
Christopher Ferris05d08e92016-02-04 13:16:38 -080058#define I2C_SMBUS_READ 1
Ben Cheng655a7c02013-10-16 16:09:24 -070059#define I2C_SMBUS_WRITE 0
60#define I2C_SMBUS_QUICK 0
Christopher Ferris49f525c2016-12-12 14:55:36 -080061#define I2C_SMBUS_BYTE 1
Christopher Ferris05d08e92016-02-04 13:16:38 -080062#define I2C_SMBUS_BYTE_DATA 2
Ben Cheng655a7c02013-10-16 16:09:24 -070063#define I2C_SMBUS_WORD_DATA 3
64#define I2C_SMBUS_PROC_CALL 4
Christopher Ferris49f525c2016-12-12 14:55:36 -080065#define I2C_SMBUS_BLOCK_DATA 5
Christopher Ferris05d08e92016-02-04 13:16:38 -080066#define I2C_SMBUS_I2C_BLOCK_BROKEN 6
Ben Cheng655a7c02013-10-16 16:09:24 -070067#define I2C_SMBUS_BLOCK_PROC_CALL 7
68#define I2C_SMBUS_I2C_BLOCK_DATA 8
Christopher Ferris49f525c2016-12-12 14:55:36 -080069#endif