i2c-algo-bit.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* ------------------------------------------------------------------------- */
  2. /* i2c-algo-bit.h i2c driver algorithms for bit-shift adapters */
  3. /* ------------------------------------------------------------------------- */
  4. /* Copyright (C) 1995-99 Simon G. Vogl
  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. /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even
  19. Frodo Looijaard <frodol@dds.nl> */
  20. #ifndef _LINUX_I2C_ALGO_BIT_H
  21. #define _LINUX_I2C_ALGO_BIT_H
  22. /* --- Defines for bit-adapters --------------------------------------- */
  23. /*
  24. * This struct contains the hw-dependent functions of bit-style adapters to
  25. * manipulate the line states, and to init any hw-specific features. This is
  26. * only used if you have more than one hw-type of adapter running.
  27. */
  28. struct i2c_algo_bit_data {
  29. void *data; /* private data for lowlevel routines */
  30. void (*setsda) (void *data, int state);
  31. void (*setscl) (void *data, int state);
  32. int (*getsda) (void *data);
  33. int (*getscl) (void *data);
  34. int (*pre_xfer) (struct i2c_adapter *);
  35. void (*post_xfer) (struct i2c_adapter *);
  36. /* local settings */
  37. int udelay; /* half clock cycle time in us,
  38. minimum 2 us for fast-mode I2C,
  39. minimum 5 us for standard-mode I2C and SMBus,
  40. maximum 50 us for SMBus */
  41. int timeout; /* in jiffies */
  42. };
  43. int i2c_bit_add_bus(struct i2c_adapter *);
  44. int i2c_bit_add_numbered_bus(struct i2c_adapter *);
  45. extern const struct i2c_algorithm i2c_bit_algo;
  46. #endif /* _LINUX_I2C_ALGO_BIT_H */