i2c-algo-ite.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* ------------------------------------------------------------------------- */
  2. /* i2c-algo-ite.h i2c driver algorithms for ITE IIC adapters */
  3. /* ------------------------------------------------------------------------- */
  4. /* Copyright (C) 1995-97 Simon G. Vogl
  5. 1998-99 Hans Berglund
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
  17. /* ------------------------------------------------------------------------- */
  18. /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
  19. Frodo Looijaard <frodol@dds.nl> */
  20. /* Modifications by MontaVista Software, 2001
  21. Changes made to support the ITE IIC peripheral */
  22. #ifndef I2C_ALGO_ITE_H
  23. #define I2C_ALGO_ITE_H 1
  24. #include <linux/types.h>
  25. /* Example of a sequential read request:
  26. struct i2c_iic_msg s_msg;
  27. s_msg.addr=device_address;
  28. s_msg.len=length;
  29. s_msg.buf=buffer;
  30. s_msg.waddr=word_address;
  31. ioctl(file,I2C_SREAD, &s_msg);
  32. */
  33. #define I2C_SREAD 0x780 /* SREAD ioctl command */
  34. struct i2c_iic_msg {
  35. __u16 addr; /* device address */
  36. __u16 waddr; /* word address */
  37. short len; /* msg length */
  38. char *buf; /* pointer to msg data */
  39. };
  40. #ifdef __KERNEL__
  41. struct i2c_adapter;
  42. struct i2c_algo_iic_data {
  43. void *data; /* private data for lolevel routines */
  44. void (*setiic) (void *data, int ctl, int val);
  45. int (*getiic) (void *data, int ctl);
  46. int (*getown) (void *data);
  47. int (*getclock) (void *data);
  48. void (*waitforpin) (void);
  49. /* local settings */
  50. int udelay;
  51. int mdelay;
  52. int timeout;
  53. };
  54. int i2c_iic_add_bus(struct i2c_adapter *);
  55. int i2c_iic_del_bus(struct i2c_adapter *);
  56. #endif /* __KERNEL__ */
  57. #endif /* I2C_ALGO_ITE_H */