]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/iio/iio_core.h
merged selected files from staging-next
[karo-tx-linux.git] / drivers / staging / iio / iio_core.h
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
13 #ifndef _IIO_CORE_H_
14 #define _IIO_CORE_H_
15
16 int __iio_add_chan_devattr(const char *postfix,
17                            struct iio_chan_spec const *chan,
18                            ssize_t (*func)(struct device *dev,
19                                            struct device_attribute *attr,
20                                            char *buf),
21                            ssize_t (*writefunc)(struct device *dev,
22                                                 struct device_attribute *attr,
23                                                 const char *buf,
24                                                 size_t len),
25                            u64 mask,
26                            bool generic,
27                            struct device *dev,
28                            struct list_head *attr_list);
29
30 /* Event interface flags */
31 #define IIO_BUSY_BIT_POS 1
32
33 #ifdef CONFIG_IIO_BUFFER
34 struct poll_table_struct;
35
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
41
42 #define iio_buffer_poll_addr (&iio_buffer_poll)
43 #define iio_buffer_read_first_n_outer_addr (&iio_buffer_read_first_n_outer)
44
45 #else
46
47 #define iio_buffer_poll_addr NULL
48 #define iio_buffer_read_first_n_outer_addr NULL
49
50 #endif
51
52 int iio_device_register_eventset(struct iio_dev *indio_dev);
53 void iio_device_unregister_eventset(struct iio_dev *indio_dev);
54 int iio_event_getfd(struct iio_dev *indio_dev);
55
56 #endif