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 _LINUX_I2C_DEV_H
  19. #define _LINUX_I2C_DEV_H
  20. #include <linux/types.h>
  21. /* /dev/i2c-X ioctl commands. The ioctl's parameter is always an
  22. * unsigned long, except for:
  23. * - I2C_FUNCS, takes pointer to an unsigned long
  24. * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data
  25. * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data
  26. */
  27. #define I2C_RETRIES 0x0701 /* number of times a device address should
  28. be polled when not acknowledging */
  29. #define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */
  30. /* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses
  31. * are NOT supported! (due to code brokenness)
  32. */
  33. #define I2C_SLAVE 0x0703 /* Use this slave address */
  34. #define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it
  35. is already in use by a driver! */
  36. #define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */
  37. #define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */
  38. #define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */
  39. #define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */
  40. #define I2C_SMBUS 0x0720 /* SMBus transfer */
  41. /* This is the structure as used in the I2C_SMBUS ioctl call */
  42. struct i2c_smbus_ioctl_data {
  43. __u8 read_write;
  44. __u8 command;
  45. __u32 size;
  46. union i2c_smbus_data *data;
  47. };
  48. /* This is the structure as used in the I2C_RDWR ioctl call */
  49. struct i2c_rdwr_ioctl_data {
  50. struct i2c_msg *msgs; /* pointers to i2c_msgs */
  51. __u32 nmsgs; /* number of i2c_msgs */
  52. };
  53. #define I2C_RDWR_IOCTL_MAX_MSGS 42
  54. /* Originally defined with a typo, keep it for compatibility */
  55. #define I2C_RDRW_IOCTL_MAX_MSGS I2C_RDWR_IOCTL_MAX_MSGS
  56. #endif /* _LINUX_I2C_DEV_H */