Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 #ifndef _INDUSTRIAL_IO_OPAQUE_H_
0004 #define _INDUSTRIAL_IO_OPAQUE_H_
0005 
0006 /**
0007  * struct iio_dev_opaque - industrial I/O device opaque information
0008  * @indio_dev:          public industrial I/O device information
0009  * @id:         used to identify device internally
0010  * @currentmode:        operating mode currently in use, may be eventually
0011  *              checked by device drivers but should be considered
0012  *              read-only as this is a core internal bit
0013  * @driver_module:      used to make it harder to undercut users
0014  * @info_exist_lock:        lock to prevent use during removal
0015  * @trig_readonly:      mark the current trigger immutable
0016  * @event_interface:        event chrdevs associated with interrupt lines
0017  * @attached_buffers:       array of buffers statically attached by the driver
0018  * @attached_buffers_cnt:   number of buffers in the array of statically attached buffers
0019  * @buffer_ioctl_handler:   ioctl() handler for this IIO device's buffer interface
0020  * @buffer_list:        list of all buffers currently attached
0021  * @channel_attr_list:      keep track of automatically created channel
0022  *              attributes
0023  * @chan_attr_group:        group for all attrs in base directory
0024  * @ioctl_handlers:     ioctl handlers registered with the core handler
0025  * @groups:         attribute groups
0026  * @groupcounter:       index of next attribute group
0027  * @legacy_scan_el_group:   attribute group for legacy scan elements attribute group
0028  * @legacy_buffer_group:    attribute group for legacy buffer attributes group
0029  * @bounce_buffer:      for devices that call iio_push_to_buffers_with_timestamp_unaligned()
0030  * @bounce_buffer_size:     size of currently allocate bounce buffer
0031  * @scan_index_timestamp:   cache of the index to the timestamp
0032  * @clock_id:           timestamping clock posix identifier
0033  * @chrdev:         associated character device
0034  * @flags:          file ops related flags including busy flag.
0035  * @debugfs_dentry:     device specific debugfs dentry
0036  * @cached_reg_addr:        cached register address for debugfs reads
0037  * @read_buf:           read buffer to be used for the initial reg read
0038  * @read_buf_len:       data length in @read_buf
0039  */
0040 struct iio_dev_opaque {
0041     struct iio_dev          indio_dev;
0042     int             currentmode;
0043     int             id;
0044     struct module           *driver_module;
0045     struct mutex            info_exist_lock;
0046     bool                trig_readonly;
0047     struct iio_event_interface  *event_interface;
0048     struct iio_buffer       **attached_buffers;
0049     unsigned int            attached_buffers_cnt;
0050     struct iio_ioctl_handler    *buffer_ioctl_handler;
0051     struct list_head        buffer_list;
0052     struct list_head        channel_attr_list;
0053     struct attribute_group      chan_attr_group;
0054     struct list_head        ioctl_handlers;
0055     const struct attribute_group    **groups;
0056     int             groupcounter;
0057     struct attribute_group      legacy_scan_el_group;
0058     struct attribute_group      legacy_buffer_group;
0059     void                *bounce_buffer;
0060     size_t              bounce_buffer_size;
0061 
0062     unsigned int            scan_index_timestamp;
0063     clockid_t           clock_id;
0064     struct cdev         chrdev;
0065     unsigned long           flags;
0066 
0067 #if defined(CONFIG_DEBUG_FS)
0068     struct dentry           *debugfs_dentry;
0069     unsigned            cached_reg_addr;
0070     char                read_buf[20];
0071     unsigned int            read_buf_len;
0072 #endif
0073 };
0074 
0075 #define to_iio_dev_opaque(_indio_dev)       \
0076     container_of((_indio_dev), struct iio_dev_opaque, indio_dev)
0077 
0078 #endif