i2c-dev.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. i2c-dev.h - i2c-bus driver, char device interface
  3. Copyright (C) 1995-97 Simon G. Vogl
  4. Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl>
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  16. MA 02110-1301 USA.
  17. */
  18. #ifndef _UAPI_LINUX_I2C_DEV_H
  19. #define _UAPI_LINUX_I2C_DEV_H
  20. #include <linux/types.h>
  21. #include <linux/compiler.h>
  22. /* /dev/i2c-X ioctl commands. The ioctl's parameter is always an
  23. * unsigned long, except for:
  24. * - I2C_FUNCS, takes pointer to an unsigned long
  25. * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data
  26. * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data
  27. */
  28. #define I2C_RETRIES 0x0701 /* number of times a device address should
  29. be polled when not acknowledging */
  30. #define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */
  31. /* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses
  32. * are NOT supported! (due to code brokenness)
  33. */
  34. #define I2C_SLAVE 0x0703 /* Use this slave address */
  35. #define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it
  36. is already in use by a driver! */
  37. #define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
  38. #define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */
  39. #define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */
  40. #define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */
  41. #define I2C_SMBUS 0x0720 /* SMBus transfer */
  42. /* This is the structure as used in the I2C_SMBUS ioctl call */
  43. struct i2c_smbus_ioctl_data {
  44. __u8 read_write;
  45. __u8 command;
  46. __u32 size;
  47. union i2c_smbus_data __user *data;
  48. };
  49. /* This is the structure as used in the I2C_RDWR ioctl call */
  50. struct i2c_rdwr_ioctl_data {
  51. struct i2c_msg __user *msgs; /* pointers to i2c_msgs */
  52. __u32 nmsgs; /* number of i2c_msgs */
  53. };
  54. #define I2C_RDWR_IOCTL_MAX_MSGS 42
  55. /* Originally defined with a typo, keep it for compatibility */
  56. #define I2C_RDRW_IOCTL_MAX_MSGS I2C_RDWR_IOCTL_MAX_MSGS
  57. #endif /* _UAPI_LINUX_I2C_DEV_H */