mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
iio: Add callback to check whether a scan mask is valid
This is useful for cases where the number of valid scan masks grows exponentially, but it is rather easy to check whether a mask is valid or not programmatically. An example of such a case is a device with multiple ADCs where each ADC has a upstream MUX, which allows to select from a number of physical channels. +-------+ +-------+ | | | | --- Channel 1 | ADC 1 |---| MUX 1 | --- ... | | | | --- Channel M +-------+ +-------+ . . . . . . . . . +-------+ +-------+ | | | | --- Channel M * N + 1 | ADC N |---| MUX N | --- ... | | | | --- Channel M * N + M +-------+ +-------+ The number of necessary scan masks for this case is (M+1)**N - 1, on the other hand it is easy to check whether subsets for each ADC of the scanmask have only one bit set. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
c732a24c5a
commit
939546d1a9
2 changed files with 24 additions and 7 deletions
|
@ -363,12 +363,16 @@ struct iio_info {
|
|||
* @predisable: [DRIVER] function to run prior to marking buffer
|
||||
* disabled
|
||||
* @postdisable: [DRIVER] function to run after marking buffer disabled
|
||||
* @validate_scan_mask: [DRIVER] function callback to check whether a given
|
||||
* scan mask is valid for the device.
|
||||
*/
|
||||
struct iio_buffer_setup_ops {
|
||||
int (*preenable)(struct iio_dev *);
|
||||
int (*postenable)(struct iio_dev *);
|
||||
int (*predisable)(struct iio_dev *);
|
||||
int (*postdisable)(struct iio_dev *);
|
||||
bool (*validate_scan_mask)(struct iio_dev *indio_dev,
|
||||
const unsigned long *scan_mask);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue