i2c-dev.h 2.3 KB

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