pcf857x.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef __LINUX_PCF857X_H
  2. #define __LINUX_PCF857X_H
  3. /**
  4. * struct pcf857x_platform_data - data to set up pcf857x driver
  5. * @gpio_base: number of the chip's first GPIO
  6. * @n_latch: optional bit-inverse of initial register value; if
  7. * you leave this initialized to zero the driver will act
  8. * like the chip was just reset
  9. * @setup: optional callback issued once the GPIOs are valid
  10. * @teardown: optional callback issued before the GPIOs are invalidated
  11. * @context: optional parameter passed to setup() and teardown()
  12. *
  13. * In addition to the I2C_BOARD_INFO() state appropriate to each chip,
  14. * the i2c_board_info used with the pcf875x driver must provide its
  15. * platform_data (pointer to one of these structures) with at least
  16. * the gpio_base value initialized.
  17. *
  18. * The @setup callback may be used with the kind of board-specific glue
  19. * which hands the (now-valid) GPIOs to other drivers, or which puts
  20. * devices in their initial states using these GPIOs.
  21. *
  22. * These GPIO chips are only "quasi-bidirectional"; read the chip specs
  23. * to understand the behavior. They don't have separate registers to
  24. * record which pins are used for input or output, record which output
  25. * values are driven, or provide access to input values. That must be
  26. * inferred by reading the chip's value and knowing the last value written
  27. * to it. If you leave n_latch initialized to zero, that last written
  28. * value is presumed to be all ones (as if the chip were just reset).
  29. */
  30. struct pcf857x_platform_data {
  31. unsigned gpio_base;
  32. unsigned n_latch;
  33. int (*setup)(struct i2c_client *client,
  34. int gpio, unsigned ngpio,
  35. void *context);
  36. int (*teardown)(struct i2c_client *client,
  37. int gpio, unsigned ngpio,
  38. void *context);
  39. void *context;
  40. };
  41. #endif /* __LINUX_PCF857X_H */