i2c-algo-bit.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * i2c-algo-bit.h: i2c driver algorithms for bit-shift adapters
  4. *
  5. * Copyright (C) 1995-99 Simon G. Vogl
  6. * With some changes from Kyösti Mälkki <[email protected]> and even
  7. * Frodo Looijaard <[email protected]>
  8. */
  9. #ifndef _LINUX_I2C_ALGO_BIT_H
  10. #define _LINUX_I2C_ALGO_BIT_H
  11. #include <linux/i2c.h>
  12. /* --- Defines for bit-adapters --------------------------------------- */
  13. /*
  14. * This struct contains the hw-dependent functions of bit-style adapters to
  15. * manipulate the line states, and to init any hw-specific features. This is
  16. * only used if you have more than one hw-type of adapter running.
  17. */
  18. struct i2c_algo_bit_data {
  19. void *data; /* private data for lowlevel routines */
  20. void (*setsda) (void *data, int state);
  21. void (*setscl) (void *data, int state);
  22. int (*getsda) (void *data);
  23. int (*getscl) (void *data);
  24. int (*pre_xfer) (struct i2c_adapter *);
  25. void (*post_xfer) (struct i2c_adapter *);
  26. /* local settings */
  27. int udelay; /* half clock cycle time in us,
  28. minimum 2 us for fast-mode I2C,
  29. minimum 5 us for standard-mode I2C and SMBus,
  30. maximum 50 us for SMBus */
  31. int timeout; /* in jiffies */
  32. bool can_do_atomic; /* callbacks don't sleep, we can be atomic */
  33. };
  34. int i2c_bit_add_bus(struct i2c_adapter *);
  35. int i2c_bit_add_numbered_bus(struct i2c_adapter *);
  36. extern const struct i2c_algorithm i2c_bit_algo;
  37. #endif /* _LINUX_I2C_ALGO_BIT_H */