1 /* SPDX-License-Identifier: GPL-2.0 */
3 #ifndef _INDUSTRIAL_IO_OPAQUE_H_
4 #define _INDUSTRIAL_IO_OPAQUE_H_
7 * struct iio_dev_opaque - industrial I/O device opaque information
8 * @indio_dev: public industrial I/O device information
9 * @id: used to identify device internally
10 * @driver_module: used to make it harder to undercut users
11 * @info_exist_lock: lock to prevent use during removal
12 * @trig_readonly: mark the current trigger immutable
13 * @event_interface: event chrdevs associated with interrupt lines
14 * @attached_buffers: array of buffers statically attached by the driver
15 * @attached_buffers_cnt: number of buffers in the array of statically attached buffers
16 * @buffer_ioctl_handler: ioctl() handler for this IIO device's buffer interface
17 * @buffer_list: list of all buffers currently attached
18 * @channel_attr_list: keep track of automatically created channel
20 * @chan_attr_group: group for all attrs in base directory
21 * @ioctl_handlers: ioctl handlers registered with the core handler
22 * @groups: attribute groups
23 * @groupcounter: index of next attribute group
24 * @legacy_scan_el_group: attribute group for legacy scan elements attribute group
25 * @legacy_buffer_group: attribute group for legacy buffer attributes group
26 * @bounce_buffer: for devices that call iio_push_to_buffers_with_timestamp_unaligned()
27 * @bounce_buffer_size: size of currently allocate bounce buffer
28 * @scan_index_timestamp: cache of the index to the timestamp
29 * @clock_id: timestamping clock posix identifier
30 * @chrdev: associated character device
31 * @flags: file ops related flags including busy flag.
32 * @debugfs_dentry: device specific debugfs dentry
33 * @cached_reg_addr: cached register address for debugfs reads
34 * @read_buf: read buffer to be used for the initial reg read
35 * @read_buf_len: data length in @read_buf
37 struct iio_dev_opaque {
38 struct iio_dev indio_dev;
40 struct module *driver_module;
41 struct mutex info_exist_lock;
43 struct iio_event_interface *event_interface;
44 struct iio_buffer **attached_buffers;
45 unsigned int attached_buffers_cnt;
46 struct iio_ioctl_handler *buffer_ioctl_handler;
47 struct list_head buffer_list;
48 struct list_head channel_attr_list;
49 struct attribute_group chan_attr_group;
50 struct list_head ioctl_handlers;
51 const struct attribute_group **groups;
53 struct attribute_group legacy_scan_el_group;
54 struct attribute_group legacy_buffer_group;
56 size_t bounce_buffer_size;
58 unsigned int scan_index_timestamp;
63 #if defined(CONFIG_DEBUG_FS)
64 struct dentry *debugfs_dentry;
65 unsigned cached_reg_addr;
67 unsigned int read_buf_len;
71 #define to_iio_dev_opaque(_indio_dev) \
72 container_of((_indio_dev), struct iio_dev_opaque, indio_dev)