aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/iio
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@kernel.org>2014-06-22 15:59:00 -0400
committerJonathan Cameron <jic23@kernel.org>2014-07-07 04:44:17 -0400
commit82695ef549b5299d3d9e088d6648289bda8ef3d8 (patch)
treea9f29217a52350fb3000db4f112723e1249a2bec /include/linux/iio
parent95bb8918f9bc87a69cb7a795b568e01afecff9cb (diff)
iio: adis: Switch sampling frequency attr to core support.
By using the info_mask_shared_by_all element of the channel spec, acce to the sampling frequency becomes available to in kernel users of the driver. It also shortens and simplifies the code. This particular conversion was made more complicated by the shared library and the fact that a number of the drivers do not actually have support for setting or reading the sampling frequency. The hardware, in those cases investigated supports it. It's just never been implemented. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Hartmut Knaack <knaack.h@gmx.de> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Diffstat (limited to 'include/linux/iio')
-rw-r--r--include/linux/iio/imu/adis.h33
1 files changed, 18 insertions, 15 deletions
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
index b665dc7f017b..fa2d01ef8f55 100644
--- a/include/linux/iio/imu/adis.h
+++ b/include/linux/iio/imu/adis.h
@@ -157,13 +157,14 @@ int adis_single_conversion(struct iio_dev *indio_dev,
157 const struct iio_chan_spec *chan, unsigned int error_mask, 157 const struct iio_chan_spec *chan, unsigned int error_mask,
158 int *val); 158 int *val);
159 159
160#define ADIS_VOLTAGE_CHAN(addr, si, chan, name, bits) { \ 160#define ADIS_VOLTAGE_CHAN(addr, si, chan, name, info_all, bits) { \
161 .type = IIO_VOLTAGE, \ 161 .type = IIO_VOLTAGE, \
162 .indexed = 1, \ 162 .indexed = 1, \
163 .channel = (chan), \ 163 .channel = (chan), \
164 .extend_name = name, \ 164 .extend_name = name, \
165 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 165 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
166 BIT(IIO_CHAN_INFO_SCALE), \ 166 BIT(IIO_CHAN_INFO_SCALE), \
167 .info_mask_shared_by_all = info_all, \
167 .address = (addr), \ 168 .address = (addr), \
168 .scan_index = (si), \ 169 .scan_index = (si), \
169 .scan_type = { \ 170 .scan_type = { \
@@ -174,19 +175,20 @@ int adis_single_conversion(struct iio_dev *indio_dev,
174 }, \ 175 }, \
175} 176}
176 177
177#define ADIS_SUPPLY_CHAN(addr, si, bits) \ 178#define ADIS_SUPPLY_CHAN(addr, si, info_all, bits) \
178 ADIS_VOLTAGE_CHAN(addr, si, 0, "supply", bits) 179 ADIS_VOLTAGE_CHAN(addr, si, 0, "supply", info_all, bits)
179 180
180#define ADIS_AUX_ADC_CHAN(addr, si, bits) \ 181#define ADIS_AUX_ADC_CHAN(addr, si, info_all, bits) \
181 ADIS_VOLTAGE_CHAN(addr, si, 1, NULL, bits) 182 ADIS_VOLTAGE_CHAN(addr, si, 1, NULL, info_all, bits)
182 183
183#define ADIS_TEMP_CHAN(addr, si, bits) { \ 184#define ADIS_TEMP_CHAN(addr, si, info_all, bits) { \
184 .type = IIO_TEMP, \ 185 .type = IIO_TEMP, \
185 .indexed = 1, \ 186 .indexed = 1, \
186 .channel = 0, \ 187 .channel = 0, \
187 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 188 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
188 BIT(IIO_CHAN_INFO_SCALE) | \ 189 BIT(IIO_CHAN_INFO_SCALE) | \
189 BIT(IIO_CHAN_INFO_OFFSET), \ 190 BIT(IIO_CHAN_INFO_OFFSET), \
191 .info_mask_shared_by_all = info_all, \
190 .address = (addr), \ 192 .address = (addr), \
191 .scan_index = (si), \ 193 .scan_index = (si), \
192 .scan_type = { \ 194 .scan_type = { \
@@ -197,13 +199,14 @@ int adis_single_conversion(struct iio_dev *indio_dev,
197 }, \ 199 }, \
198} 200}
199 201
200#define ADIS_MOD_CHAN(_type, mod, addr, si, info_sep, bits) { \ 202#define ADIS_MOD_CHAN(_type, mod, addr, si, info_sep, info_all, bits) { \
201 .type = (_type), \ 203 .type = (_type), \
202 .modified = 1, \ 204 .modified = 1, \
203 .channel2 = IIO_MOD_ ## mod, \ 205 .channel2 = IIO_MOD_ ## mod, \
204 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \ 206 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
205 info_sep, \ 207 info_sep, \
206 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \ 208 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
209 .info_mask_shared_by_all = info_all, \
207 .address = (addr), \ 210 .address = (addr), \
208 .scan_index = (si), \ 211 .scan_index = (si), \
209 .scan_type = { \ 212 .scan_type = { \
@@ -214,17 +217,17 @@ int adis_single_conversion(struct iio_dev *indio_dev,
214 }, \ 217 }, \
215} 218}
216 219
217#define ADIS_ACCEL_CHAN(mod, addr, si, info_sep, bits) \ 220#define ADIS_ACCEL_CHAN(mod, addr, si, info_sep, info_all, bits) \
218 ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info_sep, bits) 221 ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info_sep, info_all, bits)
219 222
220#define ADIS_GYRO_CHAN(mod, addr, si, info_sep, bits) \ 223#define ADIS_GYRO_CHAN(mod, addr, si, info_sep, info_all, bits) \
221 ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info_sep, bits) 224 ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info_sep, info_all, bits)
222 225
223#define ADIS_INCLI_CHAN(mod, addr, si, info_sep, bits) \ 226#define ADIS_INCLI_CHAN(mod, addr, si, info_sep, info_all, bits) \
224 ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info_sep, bits) 227 ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info_sep, info_all, bits)
225 228
226#define ADIS_ROT_CHAN(mod, addr, si, info_sep, bits) \ 229#define ADIS_ROT_CHAN(mod, addr, si, info_sep, info_all, bits) \
227 ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info_sep, bits) 230 ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info_sep, info_all, bits)
228 231
229#ifdef CONFIG_IIO_ADIS_LIB_BUFFER 232#ifdef CONFIG_IIO_ADIS_LIB_BUFFER
230 233