9 #ifndef __AD_SIGMA_DELTA_H__
10 #define __AD_SIGMA_DELTA_H__
84 if (sd->
info->set_channel)
85 return sd->
info->set_channel(sd, channel);
93 if (sd->
info->set_mode)
94 return sd->
info->set_mode(sd, mode);
99 static inline int ad_sigma_delta_postprocess_sample(
struct ad_sigma_delta *sd,
100 unsigned int raw_sample)
102 if (sd->
info->postprocess_sample)
103 return sd->
info->postprocess_sample(sd, raw_sample);
110 unsigned int size,
unsigned int val);
112 unsigned int size,
unsigned int *
val);
126 #define __AD_SD_CHANNEL(_si, _channel1, _channel2, _address, _bits, \
127 _storagebits, _shift, _extend_name, _type) \
130 .differential = (_channel2 == -1 ? 0 : 1), \
132 .channel = (_channel1), \
133 .channel2 = (_channel2), \
134 .address = (_address), \
135 .extend_name = (_extend_name), \
136 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \
137 IIO_CHAN_INFO_SCALE_SHARED_BIT | \
138 IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \
139 .scan_index = (_si), \
142 .realbits = (_bits), \
143 .storagebits = (_storagebits), \
145 .endianness = IIO_BE, \
149 #define AD_SD_DIFF_CHANNEL(_si, _channel1, _channel2, _address, _bits, \
150 _storagebits, _shift) \
151 __AD_SD_CHANNEL(_si, _channel1, _channel2, _address, _bits, \
152 _storagebits, _shift, NULL, IIO_VOLTAGE)
154 #define AD_SD_SHORTED_CHANNEL(_si, _channel, _address, _bits, \
155 _storagebits, _shift) \
156 __AD_SD_CHANNEL(_si, _channel, _channel, _address, _bits, \
157 _storagebits, _shift, "shorted", IIO_VOLTAGE)
159 #define AD_SD_CHANNEL(_si, _channel, _address, _bits, \
160 _storagebits, _shift) \
161 __AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \
162 _storagebits, _shift, NULL, IIO_VOLTAGE)
164 #define AD_SD_TEMP_CHANNEL(_si, _address, _bits, _storagebits, _shift) \
165 __AD_SD_CHANNEL(_si, 0, -1, _address, _bits, \
166 _storagebits, _shift, NULL, IIO_TEMP)
168 #define AD_SD_SUPPLY_CHANNEL(_si, _channel, _address, _bits, _storagebits, \
170 __AD_SD_CHANNEL(_si, _channel, -1, _address, _bits, \
171 _storagebits, _shift, "supply", IIO_VOLTAGE)