1. 09 Jul, 2012 4 commits
    • Lars-Peter Clausen's avatar
      staging:iio:ad7793: Use iio_validate_scan_mask_onehot · 8c2c6ba6
      Lars-Peter Clausen authored
      Only one of the channels of the ad7793 may be sampled at a time. Use the new
      validate_scan_mask callback and the iio_validate_scan_mask_onehot function to
      implement this restriction. Previously this was implemented using
      available_scan_masks, but this requires a individual scan mask for each channel.
      
      Also the previous code was adding the scan index of the timestamp channel to
      each available scan mask, this is not required though since the timestamp
      channel is not restricted by the available scan masks and can be enabled or
      disabled independently. So the new code does not have to take care of this.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      8c2c6ba6
    • Lars-Peter Clausen's avatar
      staging:iio:ad7192: Use iio_validate_scan_mask_onehot · f6aea554
      Lars-Peter Clausen authored
      Only one of the channels of the ad7192 may be sampled at a time. Use the new
      validate_scan_mask callback and the iio_validate_scan_mask_onehot function to
      implement this restriction. Previously this was implemented using
      available_scan_masks, but this requires a individual scan mask for each channel.
      
      Also the previous code was adding the scan index of the timestamp channel to
      each available scan mask, this is not required though since the timestamp
      channel is not restricted by the available scan masks and can be enabled or
      disabled independently. So the new code does not have to take care of this.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      f6aea554
    • Lars-Peter Clausen's avatar
      iio: Introduce iio_validate_scan_mask_onehot · 81636632
      Lars-Peter Clausen authored
      Add a helper function for validating a scan mask for devices where exactly one
      channel must be selected during sampling. This is a common case among devices
      which have scan mask restrictions so it makes sense to provide this function in
      the core.
      Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      81636632
    • Lars-Peter Clausen's avatar
      iio: Add callback to check whether a scan mask is valid · 939546d1
      Lars-Peter Clausen authored
      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: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      939546d1
  2. 08 Jul, 2012 5 commits
  3. 07 Jul, 2012 3 commits
  4. 06 Jul, 2012 28 commits