trigger_consumer.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* The industrial I/O core, trigger consumer functions
  3. *
  4. * Copyright (c) 2008-2011 Jonathan Cameron
  5. */
  6. #ifndef __LINUX_IIO_TRIGGER_CONSUMER_H__
  7. #define __LINUX_IIO_TRIGGER_CONSUMER_H__
  8. #include <linux/interrupt.h>
  9. #include <linux/types.h>
  10. struct iio_dev;
  11. struct iio_trigger;
  12. /**
  13. * struct iio_poll_func - poll function pair
  14. *
  15. * @indio_dev: data specific to device (passed into poll func)
  16. * @h: the function that is actually run on trigger
  17. * @thread: threaded interrupt part
  18. * @type: the type of interrupt (basically if oneshot)
  19. * @name: name used to identify the trigger consumer.
  20. * @irq: the corresponding irq as allocated from the
  21. * trigger pool
  22. * @timestamp: some devices need a timestamp grabbed as soon
  23. * as possible after the trigger - hence handler
  24. * passes it via here.
  25. **/
  26. struct iio_poll_func {
  27. struct iio_dev *indio_dev;
  28. irqreturn_t (*h)(int irq, void *p);
  29. irqreturn_t (*thread)(int irq, void *p);
  30. int type;
  31. char *name;
  32. int irq;
  33. s64 timestamp;
  34. };
  35. __printf(5, 6) struct iio_poll_func
  36. *iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
  37. irqreturn_t (*thread)(int irq, void *p),
  38. int type,
  39. struct iio_dev *indio_dev,
  40. const char *fmt,
  41. ...);
  42. void iio_dealloc_pollfunc(struct iio_poll_func *pf);
  43. irqreturn_t iio_pollfunc_store_time(int irq, void *p);
  44. void iio_trigger_notify_done(struct iio_trigger *trig);
  45. #endif