Blame view

drivers/iio/iio_core.h 2.49 KB
df9c1c42c   Jonathan Cameron   staging:iio: Intr...
1
2
3
4
5
6
7
8
  /* The industrial I/O core function defs.
   *
   * Copyright (c) 2008 Jonathan Cameron
   *
   * This program is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 as published by
   * the Free Software Foundation.
   *
cecfb931c   Michael Hennerich   staging:iio: fix ...
9
   * These definitions are meant for use only within the IIO core, not individual
df9c1c42c   Jonathan Cameron   staging:iio: Intr...
10
11
   * drivers.
   */
1aa042783   Jonathan Cameron   staging: iio: pus...
12
13
  #ifndef _IIO_CORE_H_
  #define _IIO_CORE_H_
ef97d4217   Jonathan Cameron   staging:iio:iio_c...
14
15
16
17
18
  #include <linux/kernel.h>
  #include <linux/device.h>
  
  struct iio_chan_spec;
  struct iio_dev;
17d82b47a   Guenter Roeck   iio: Add OF support
19
  extern struct device_type iio_device_type;
1aa042783   Jonathan Cameron   staging: iio: pus...
20

df9c1c42c   Jonathan Cameron   staging:iio: Intr...
21
  int __iio_add_chan_devattr(const char *postfix,
df9c1c42c   Jonathan Cameron   staging:iio: Intr...
22
23
24
25
26
27
28
29
  			   struct iio_chan_spec const *chan,
  			   ssize_t (*func)(struct device *dev,
  					   struct device_attribute *attr,
  					   char *buf),
  			   ssize_t (*writefunc)(struct device *dev,
  						struct device_attribute *attr,
  						const char *buf,
  						size_t len),
e614a54b2   Jonathan Cameron   staging:iio:attrs...
30
  			   u64 mask,
3704432fb   Jonathan Cameron   iio: refactor inf...
31
  			   enum iio_shared_by shared_by,
df9c1c42c   Jonathan Cameron   staging:iio: Intr...
32
33
  			   struct device *dev,
  			   struct list_head *attr_list);
84088ebd1   Lars-Peter Clausen   iio: Add a helper...
34
  void iio_free_chan_devattr_list(struct list_head *attr_list);
df9c1c42c   Jonathan Cameron   staging:iio: Intr...
35

9fbfb4b37   Srinivas Pandruvada   IIO: core: Introd...
36
  ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals);
3661f3f5e   Lars-Peter Clausen   iio: Factor IIO v...
37

df9c1c42c   Jonathan Cameron   staging:iio: Intr...
38
39
  /* Event interface flags */
  #define IIO_BUSY_BIT_POS 1
1aa042783   Jonathan Cameron   staging: iio: pus...
40

f2a96245b   Jonathan Cameron   staging:iio: tree...
41
  #ifdef CONFIG_IIO_BUFFER
1aa042783   Jonathan Cameron   staging: iio: pus...
42
  struct poll_table_struct;
14555b144   Jonathan Cameron   staging:iio: repl...
43
44
45
46
  unsigned int iio_buffer_poll(struct file *filp,
  			     struct poll_table_struct *wait);
  ssize_t iio_buffer_read_first_n_outer(struct file *filp, char __user *buf,
  				      size_t n, loff_t *f_ps);
1aa042783   Jonathan Cameron   staging: iio: pus...
47

3e1b6c95b   Lars-Peter Clausen   iio: Move buffer ...
48
49
  int iio_buffer_alloc_sysfs_and_mask(struct iio_dev *indio_dev);
  void iio_buffer_free_sysfs_and_mask(struct iio_dev *indio_dev);
1aa042783   Jonathan Cameron   staging: iio: pus...
50

14555b144   Jonathan Cameron   staging:iio: repl...
51
52
  #define iio_buffer_poll_addr (&iio_buffer_poll)
  #define iio_buffer_read_first_n_outer_addr (&iio_buffer_read_first_n_outer)
1aa042783   Jonathan Cameron   staging: iio: pus...
53

a87c82e45   Lars-Peter Clausen   iio: Stop samplin...
54
  void iio_disable_all_buffers(struct iio_dev *indio_dev);
d2f0a48f3   Lars-Peter Clausen   iio: Wakeup poll ...
55
  void iio_buffer_wakeup_poll(struct iio_dev *indio_dev);
a87c82e45   Lars-Peter Clausen   iio: Stop samplin...
56

1aa042783   Jonathan Cameron   staging: iio: pus...
57
  #else
14555b144   Jonathan Cameron   staging:iio: repl...
58
59
  #define iio_buffer_poll_addr NULL
  #define iio_buffer_read_first_n_outer_addr NULL
1aa042783   Jonathan Cameron   staging: iio: pus...
60

3e1b6c95b   Lars-Peter Clausen   iio: Move buffer ...
61
62
63
64
65
66
  static inline int iio_buffer_alloc_sysfs_and_mask(struct iio_dev *indio_dev)
  {
  	return 0;
  }
  
  static inline void iio_buffer_free_sysfs_and_mask(struct iio_dev *indio_dev) {}
a87c82e45   Lars-Peter Clausen   iio: Stop samplin...
67
  static inline void iio_disable_all_buffers(struct iio_dev *indio_dev) {}
d2f0a48f3   Lars-Peter Clausen   iio: Wakeup poll ...
68
  static inline void iio_buffer_wakeup_poll(struct iio_dev *indio_dev) {}
a87c82e45   Lars-Peter Clausen   iio: Stop samplin...
69

1aa042783   Jonathan Cameron   staging: iio: pus...
70
  #endif
0a769a953   Lars-Peter Clausen   staging:iio: Fact...
71
72
  int iio_device_register_eventset(struct iio_dev *indio_dev);
  void iio_device_unregister_eventset(struct iio_dev *indio_dev);
d2f0a48f3   Lars-Peter Clausen   iio: Wakeup poll ...
73
  void iio_device_wakeup_eventset(struct iio_dev *indio_dev);
0a769a953   Lars-Peter Clausen   staging:iio: Fact...
74
  int iio_event_getfd(struct iio_dev *indio_dev);
bc2b7dab6   Gregor Boirie   iio:core: timesta...
75
76
  struct iio_event_interface;
  bool iio_event_enabled(const struct iio_event_interface *ev_int);
1aa042783   Jonathan Cameron   staging: iio: pus...
77
  #endif