iio_core.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* The industrial I/O core function defs.
  2. *
  3. * Copyright (c) 2008 Jonathan Cameron
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License version 2 as published by
  7. * the Free Software Foundation.
  8. *
  9. * These definitions are meant for use only within the IIO core, not individual
  10. * drivers.
  11. */
  12. #ifndef _IIO_CORE_H_
  13. #define _IIO_CORE_H_
  14. #include <linux/kernel.h>
  15. #include <linux/device.h>
  16. struct iio_chan_spec;
  17. struct iio_dev;
  18. extern struct device_type iio_device_type;
  19. int __iio_add_chan_devattr(const char *postfix,
  20. struct iio_chan_spec const *chan,
  21. ssize_t (*func)(struct device *dev,
  22. struct device_attribute *attr,
  23. char *buf),
  24. ssize_t (*writefunc)(struct device *dev,
  25. struct device_attribute *attr,
  26. const char *buf,
  27. size_t len),
  28. u64 mask,
  29. bool generic,
  30. struct device *dev,
  31. struct list_head *attr_list);
  32. /* Event interface flags */
  33. #define IIO_BUSY_BIT_POS 1
  34. #ifdef CONFIG_IIO_BUFFER
  35. struct poll_table_struct;
  36. unsigned int iio_buffer_poll(struct file *filp,
  37. struct poll_table_struct *wait);
  38. ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf,
  39. size_t n, loff_t *f_ps);
  40. #define iio_buffer_poll_addr (&iio_buffer_poll)
  41. #define iio_buffer_read_first_n_outer_addr (&iio_buffer_read_first_n_outer)
  42. void iio_disable_all_buffers(struct iio_dev *indio_dev);
  43. #else
  44. #define iio_buffer_poll_addr NULL
  45. #define iio_buffer_read_first_n_outer_addr NULL
  46. static inline void iio_disable_all_buffers(struct iio_dev *indio_dev) {}
  47. #endif
  48. int iio_device_register_eventset(struct iio_dev *indio_dev);
  49. void iio_device_unregister_eventset(struct iio_dev *indio_dev);
  50. int iio_event_getfd(struct iio_dev *indio_dev);
  51. #endif