1e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ 2607ca46eSDavid Howells /* 3*1713d66cSWolfram Sang * i2c-dev.h - I2C bus char device interface 4*1713d66cSWolfram Sang * 5*1713d66cSWolfram Sang * Copyright (C) 1995-97 Simon G. Vogl 6*1713d66cSWolfram Sang * Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl> 7607ca46eSDavid Howells */ 8607ca46eSDavid Howells 9607ca46eSDavid Howells #ifndef _UAPI_LINUX_I2C_DEV_H 10607ca46eSDavid Howells #define _UAPI_LINUX_I2C_DEV_H 11607ca46eSDavid Howells 12607ca46eSDavid Howells #include <linux/types.h> 13607ca46eSDavid Howells #include <linux/compiler.h> 14607ca46eSDavid Howells 15607ca46eSDavid Howells /* /dev/i2c-X ioctl commands. The ioctl's parameter is always an 16607ca46eSDavid Howells * unsigned long, except for: 17607ca46eSDavid Howells * - I2C_FUNCS, takes pointer to an unsigned long 18607ca46eSDavid Howells * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data 19607ca46eSDavid Howells * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data 20607ca46eSDavid Howells */ 21607ca46eSDavid Howells #define I2C_RETRIES 0x0701 /* number of times a device address should 22607ca46eSDavid Howells be polled when not acknowledging */ 23607ca46eSDavid Howells #define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */ 24607ca46eSDavid Howells 25607ca46eSDavid Howells /* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses 26607ca46eSDavid Howells * are NOT supported! (due to code brokenness) 27607ca46eSDavid Howells */ 28607ca46eSDavid Howells #define I2C_SLAVE 0x0703 /* Use this slave address */ 29607ca46eSDavid Howells #define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it 30607ca46eSDavid Howells is already in use by a driver! */ 31607ca46eSDavid Howells #define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ 32607ca46eSDavid Howells 33607ca46eSDavid Howells #define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */ 34607ca46eSDavid Howells 35607ca46eSDavid Howells #define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */ 36607ca46eSDavid Howells 37607ca46eSDavid Howells #define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */ 38607ca46eSDavid Howells #define I2C_SMBUS 0x0720 /* SMBus transfer */ 39607ca46eSDavid Howells 40607ca46eSDavid Howells 41607ca46eSDavid Howells /* This is the structure as used in the I2C_SMBUS ioctl call */ 42607ca46eSDavid Howells struct i2c_smbus_ioctl_data { 43607ca46eSDavid Howells __u8 read_write; 44607ca46eSDavid Howells __u8 command; 45607ca46eSDavid Howells __u32 size; 46607ca46eSDavid Howells union i2c_smbus_data __user *data; 47607ca46eSDavid Howells }; 48607ca46eSDavid Howells 49607ca46eSDavid Howells /* This is the structure as used in the I2C_RDWR ioctl call */ 50607ca46eSDavid Howells struct i2c_rdwr_ioctl_data { 51607ca46eSDavid Howells struct i2c_msg __user *msgs; /* pointers to i2c_msgs */ 52607ca46eSDavid Howells __u32 nmsgs; /* number of i2c_msgs */ 53607ca46eSDavid Howells }; 54607ca46eSDavid Howells 55c57d3e7aSJean Delvare #define I2C_RDWR_IOCTL_MAX_MSGS 42 56c57d3e7aSJean Delvare /* Originally defined with a typo, keep it for compatibility */ 57c57d3e7aSJean Delvare #define I2C_RDRW_IOCTL_MAX_MSGS I2C_RDWR_IOCTL_MAX_MSGS 58607ca46eSDavid Howells 59607ca46eSDavid Howells 60607ca46eSDavid Howells #endif /* _UAPI_LINUX_I2C_DEV_H */ 61