/** * struct iio_dev_attr - iio specific device attribute * @dev_attr: underlying device attribute * @address: associated register address * @l: list head for maintaining list of dynamically created attrs * @c: specification for the underlying channel * @buffer: the IIO buffer to which this attribute belongs to (if any)
*/ struct iio_dev_attr { struct device_attribute dev_attr;
u64 address; struct list_head l; struct iio_chan_spec const *c; struct iio_buffer *buffer;
};
/* Some attributes will be hard coded (device dependent) and not require an
address, in these cases pass a negative */ #define IIO_ATTR(_name, _mode, _show, _store, _addr) \
{ .dev_attr = __ATTR(_name, _mode, _show, _store), \
.address = _addr }
/** * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency * @_mode: sysfs file mode/permissions * @_show: output method for the attribute * @_store: input method for the attribute
**/ #define IIO_DEV_ATTR_SAMP_FREQ(_mode, _show, _store) \
IIO_DEVICE_ATTR(sampling_frequency, _mode, _show, _store, 0)
/** * IIO_DEV_ATTR_SAMP_FREQ_AVAIL - list available sampling frequencies * @_show: output method for the attribute * * May be mode dependent on some devices
**/ #define IIO_DEV_ATTR_SAMP_FREQ_AVAIL(_show) \
IIO_DEVICE_ATTR(sampling_frequency_available, S_IRUGO, _show, NULL, 0) /** * IIO_CONST_ATTR_SAMP_FREQ_AVAIL - list available sampling frequencies * @_string: frequency string for the attribute * * Constant version
**/ #define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string) \
IIO_CONST_ATTR(sampling_frequency_available, _string)
/** * IIO_DEV_ATTR_INT_TIME_AVAIL - list available integration times * @_show: output method for the attribute
**/ #define IIO_DEV_ATTR_INT_TIME_AVAIL(_show) \
IIO_DEVICE_ATTR(integration_time_available, S_IRUGO, _show, NULL, 0) /** * IIO_CONST_ATTR_INT_TIME_AVAIL - list available integration times * @_string: frequency string for the attribute * * Constant version
**/ #define IIO_CONST_ATTR_INT_TIME_AVAIL(_string) \
IIO_CONST_ATTR(integration_time_available, _string)