iio-opaque.h 3.1 KB

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