ad714x.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * AD714X CapTouch Programmable Controller driver (bus interfaces)
  3. *
  4. * Copyright 2009-2011 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #ifndef _AD714X_H_
  9. #define _AD714X_H_
  10. #include <linux/types.h>
  11. #define STAGE_NUM 12
  12. struct device;
  13. struct ad714x_platform_data;
  14. struct ad714x_driver_data;
  15. struct ad714x_chip;
  16. typedef int (*ad714x_read_t)(struct ad714x_chip *, unsigned short, unsigned short *, size_t);
  17. typedef int (*ad714x_write_t)(struct ad714x_chip *, unsigned short, unsigned short);
  18. struct ad714x_chip {
  19. unsigned short l_state;
  20. unsigned short h_state;
  21. unsigned short c_state;
  22. unsigned short adc_reg[STAGE_NUM];
  23. unsigned short amb_reg[STAGE_NUM];
  24. unsigned short sensor_val[STAGE_NUM];
  25. struct ad714x_platform_data *hw;
  26. struct ad714x_driver_data *sw;
  27. int irq;
  28. struct device *dev;
  29. ad714x_read_t read;
  30. ad714x_write_t write;
  31. struct mutex mutex;
  32. unsigned product;
  33. unsigned version;
  34. __be16 xfer_buf[16] ____cacheline_aligned;
  35. };
  36. int ad714x_disable(struct ad714x_chip *ad714x);
  37. int ad714x_enable(struct ad714x_chip *ad714x);
  38. struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
  39. ad714x_read_t read, ad714x_write_t write);
  40. #endif