ad714x.h 1.2 KB

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