Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: adc: ad7780: remove IIO_CHAN_INFO_SAMP_FREQ support

The `ad7780` driver does not implement setting/getting the sampling
frequency.
For the ad7780/ad7781 devices, the control is done via an external pin,
and the ad7170/ad7171 devices have a fixed sampling rate (so, no control).

For these devices, and similar other that may be added later on,
a AD_SD_CHANNEL_NO_SAMPLE_FREQ() macro has been added, which doesn't set
the IIO_CHAN_INFO_SAMP_FREQ flag.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Alexandru Ardelean and committed by
Jonathan Cameron
192af06a 381522c0

+18 -8
+1 -1
drivers/staging/iio/adc/ad7780.c
··· 128 128 }; 129 129 130 130 #define AD7780_CHANNEL(bits, wordsize) \ 131 - AD_SD_CHANNEL(1, 0, 0, bits, 32, wordsize - bits) 131 + AD_SD_CHANNEL_NO_SAMP_FREQ(1, 0, 0, bits, 32, wordsize - bits) 132 132 133 133 static const struct ad7780_chip_info ad7780_chip_info_tbl[] = { 134 134 [ID_AD7170] = {
+17 -7
include/linux/iio/adc/ad_sigma_delta.h
··· 127 127 int ad_sd_validate_trigger(struct iio_dev *indio_dev, struct iio_trigger *trig); 128 128 129 129 #define __AD_SD_CHANNEL(_si, _channel1, _channel2, _address, _bits, \ 130 - _storagebits, _shift, _extend_name, _type) \ 130 + _storagebits, _shift, _extend_name, _type, _mask_all) \ 131 131 { \ 132 132 .type = (_type), \ 133 133 .differential = (_channel2 == -1 ? 0 : 1), \ ··· 139 139 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 140 140 BIT(IIO_CHAN_INFO_OFFSET), \ 141 141 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ 142 - .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \ 142 + .info_mask_shared_by_all = _mask_all, \ 143 143 .scan_index = (_si), \ 144 144 .scan_type = { \ 145 145 .sign = 'u', \ ··· 153 153 #define AD_SD_DIFF_CHANNEL(_si, _channel1, _channel2, _address, _bits, \ 154 154 _storagebits, _shift) \ 155 155 __AD_SD_CHANNEL(_si, _channel1, _channel2, _address, _bits, \ 156 - _storagebits, _shift, NULL, IIO_VOLTAGE) 156 + _storagebits, _shift, NULL, IIO_VOLTAGE, \ 157 + BIT(IIO_CHAN_INFO_SAMP_FREQ)) 157 158 158 159 #define AD_SD_SHORTED_CHANNEL(_si, _channel, _address, _bits, \ 159 160 _storagebits, _shift) \ 160 161 __AD_SD_CHANNEL(_si, _channel, _channel, _address, _bits, \ 161 - _storagebits, _shift, "shorted", IIO_VOLTAGE) 162 + _storagebits, _shift, "shorted", IIO_VOLTAGE, \ 163 + BIT(IIO_CHAN_INFO_SAMP_FREQ)) 162 164 163 165 #define AD_SD_CHANNEL(_si, _channel, _address, _bits, \ 164 166 _storagebits, _shift) \ 165 167 __AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \ 166 - _storagebits, _shift, NULL, IIO_VOLTAGE) 168 + _storagebits, _shift, NULL, IIO_VOLTAGE, \ 169 + BIT(IIO_CHAN_INFO_SAMP_FREQ)) 170 + 171 + #define AD_SD_CHANNEL_NO_SAMP_FREQ(_si, _channel, _address, _bits, \ 172 + _storagebits, _shift) \ 173 + __AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \ 174 + _storagebits, _shift, NULL, IIO_VOLTAGE, 0) 167 175 168 176 #define AD_SD_TEMP_CHANNEL(_si, _address, _bits, _storagebits, _shift) \ 169 177 __AD_SD_CHANNEL(_si, 0, -1, _address, _bits, \ 170 - _storagebits, _shift, NULL, IIO_TEMP) 178 + _storagebits, _shift, NULL, IIO_TEMP, \ 179 + BIT(IIO_CHAN_INFO_SAMP_FREQ)) 171 180 172 181 #define AD_SD_SUPPLY_CHANNEL(_si, _channel, _address, _bits, _storagebits, \ 173 182 _shift) \ 174 183 __AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \ 175 - _storagebits, _shift, "supply", IIO_VOLTAGE) 184 + _storagebits, _shift, "supply", IIO_VOLTAGE, \ 185 + BIT(IIO_CHAN_INFO_SAMP_FREQ)) 176 186 177 187 #endif