Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
0002 /*
0003  * i2c-dev.h - I2C bus char device interface
0004  *
0005  * Copyright (C) 1995-97 Simon G. Vogl
0006  * Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl>
0007  */
0008 
0009 #ifndef _UAPI_LINUX_I2C_DEV_H
0010 #define _UAPI_LINUX_I2C_DEV_H
0011 
0012 #include <linux/types.h>
0013 #include <linux/compiler.h>
0014 
0015 /* /dev/i2c-X ioctl commands.  The ioctl's parameter is always an
0016  * unsigned long, except for:
0017  *  - I2C_FUNCS, takes pointer to an unsigned long
0018  *  - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data
0019  *  - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data
0020  */
0021 #define I2C_RETRIES 0x0701  /* number of times a device address should
0022                    be polled when not acknowledging */
0023 #define I2C_TIMEOUT 0x0702  /* set timeout in units of 10 ms */
0024 
0025 /* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses
0026  * are NOT supported! (due to code brokenness)
0027  */
0028 #define I2C_SLAVE   0x0703  /* Use this slave address */
0029 #define I2C_SLAVE_FORCE 0x0706  /* Use this slave address, even if it
0030                    is already in use by a driver! */
0031 #define I2C_TENBIT  0x0704  /* 0 for 7 bit addrs, != 0 for 10 bit */
0032 
0033 #define I2C_FUNCS   0x0705  /* Get the adapter functionality mask */
0034 
0035 #define I2C_RDWR    0x0707  /* Combined R/W transfer (one STOP only) */
0036 
0037 #define I2C_PEC     0x0708  /* != 0 to use PEC with SMBus */
0038 #define I2C_SMBUS   0x0720  /* SMBus transfer */
0039 
0040 
0041 /* This is the structure as used in the I2C_SMBUS ioctl call */
0042 struct i2c_smbus_ioctl_data {
0043     __u8 read_write;
0044     __u8 command;
0045     __u32 size;
0046     union i2c_smbus_data __user *data;
0047 };
0048 
0049 /* This is the structure as used in the I2C_RDWR ioctl call */
0050 struct i2c_rdwr_ioctl_data {
0051     struct i2c_msg __user *msgs;    /* pointers to i2c_msgs */
0052     __u32 nmsgs;            /* number of i2c_msgs */
0053 };
0054 
0055 #define  I2C_RDWR_IOCTL_MAX_MSGS    42
0056 /* Originally defined with a typo, keep it for compatibility */
0057 #define  I2C_RDRW_IOCTL_MAX_MSGS    I2C_RDWR_IOCTL_MAX_MSGS
0058 
0059 
0060 #endif /* _UAPI_LINUX_I2C_DEV_H */