aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/iio
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 13:50:03 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 13:50:03 -0400
commitef994fda44d6b55ffef7bfdf06f645ff2ab1ab1a (patch)
tree564a62822ebb1f6f7e1f86b0eefc34bc769dff7d /include/linux/iio
parent25eeb667599b192ea850a062d69383ee864c06ab (diff)
parent51b53dc991ae7eebc5d45b06d576da6486fbf823 (diff)
Merge tag 'iio-for-3.10a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes: First set of IIO new drivers and cleanup for the 3.10 cycle. New stuff 1) Add OF support for specifying mappings between iio devices and their in kernel consumers. 2) Driver for AD7923 (extra functionality and support for ad7904, ad7914 and ad7924 added later in series) 3) Driver for Exynos adc (dt suppor for phy added later in series). 4) Make iio_push_event save IRQ context - necessary if it is to be used within an interrupt handler. Users of this functionality to follow. 5) For iio use the device tree node name to provide the hwmon name attribute if available. Removal and moves out of staging 1) Drop the adt7410 driver from IIO now that there is a hmwon driver with equivalent support. This device is very much targeted at hardware monitoring so hwmon is a more appropriate host for the driver. 2) Move iio_hwmon driver to drivers/hwmon. Cleanups 1) Minor cleanup in ST common library. 2) Large set of patches to break the info_mask element which previously used odd and even bits to specify if a channel attribute was either shared across similar channels or specific to only one. Now we have two bitmaps, one for those parameters that are specific to this channel and one for those shared by all channels with the same type as this one. This has no effect on the userspace abi. It simplifies the core code and provides more space for new channel parameters. It has been on the todo list for a long time! Conflicts: drivers/iio/dac/ad5064.c
Diffstat (limited to 'include/linux/iio')
-rw-r--r--include/linux/iio/adc/ad_sigma_delta.h6
-rw-r--r--include/linux/iio/common/st_sensors.h5
-rw-r--r--include/linux/iio/iio.h79
-rw-r--r--include/linux/iio/imu/adis.h34
4 files changed, 31 insertions, 93 deletions
diff --git a/include/linux/iio/adc/ad_sigma_delta.h b/include/linux/iio/adc/ad_sigma_delta.h
index 2e4eab9868a3..e7fdec4db9da 100644
--- a/include/linux/iio/adc/ad_sigma_delta.h
+++ b/include/linux/iio/adc/ad_sigma_delta.h
@@ -133,9 +133,9 @@ int ad_sd_validate_trigger(struct iio_dev *indio_dev, struct iio_trigger *trig);
133 .channel2 = (_channel2), \ 133 .channel2 = (_channel2), \
134 .address = (_address), \ 134 .address = (_address), \
135 .extend_name = (_extend_name), \ 135 .extend_name = (_extend_name), \
136 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ 136 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
137 IIO_CHAN_INFO_SCALE_SHARED_BIT | \ 137 BIT(IIO_CHAN_INFO_OFFSET), \
138 IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \ 138 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
139 .scan_index = (_si), \ 139 .scan_index = (_si), \
140 .scan_type = { \ 140 .scan_type = { \
141 .sign = 'u', \ 141 .sign = 'u', \
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 8bd12be0b02f..172c5b23cb84 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -15,6 +15,7 @@
15#include <linux/spi/spi.h> 15#include <linux/spi/spi.h>
16#include <linux/irqreturn.h> 16#include <linux/irqreturn.h>
17#include <linux/iio/trigger.h> 17#include <linux/iio/trigger.h>
18#include <linux/bitops.h>
18 19
19#define ST_SENSORS_TX_MAX_LENGTH 2 20#define ST_SENSORS_TX_MAX_LENGTH 2
20#define ST_SENSORS_RX_MAX_LENGTH 6 21#define ST_SENSORS_RX_MAX_LENGTH 6
@@ -45,8 +46,8 @@
45{ \ 46{ \
46 .type = device_type, \ 47 .type = device_type, \
47 .modified = 1, \ 48 .modified = 1, \
48 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ 49 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
49 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ 50 BIT(IIO_CHAN_INFO_SCALE), \
50 .scan_index = index, \ 51 .scan_index = index, \
51 .channel2 = mod, \ 52 .channel2 = mod, \
52 .address = addr, \ 53 .address = addr, \
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index da8c776ba0bd..8d171f427632 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -38,76 +38,6 @@ enum iio_chan_info_enum {
38 IIO_CHAN_INFO_HYSTERESIS, 38 IIO_CHAN_INFO_HYSTERESIS,
39}; 39};
40 40
41#define IIO_CHAN_INFO_SHARED_BIT(type) BIT(type*2)
42#define IIO_CHAN_INFO_SEPARATE_BIT(type) BIT(type*2 + 1)
43#define IIO_CHAN_INFO_BITS(type) (IIO_CHAN_INFO_SHARED_BIT(type) | \
44 IIO_CHAN_INFO_SEPARATE_BIT(type))
45
46#define IIO_CHAN_INFO_RAW_SEPARATE_BIT \
47 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_RAW)
48#define IIO_CHAN_INFO_PROCESSED_SEPARATE_BIT \
49 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PROCESSED)
50#define IIO_CHAN_INFO_SCALE_SEPARATE_BIT \
51 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SCALE)
52#define IIO_CHAN_INFO_SCALE_SHARED_BIT \
53 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SCALE)
54#define IIO_CHAN_INFO_OFFSET_SEPARATE_BIT \
55 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_OFFSET)
56#define IIO_CHAN_INFO_OFFSET_SHARED_BIT \
57 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_OFFSET)
58#define IIO_CHAN_INFO_CALIBSCALE_SEPARATE_BIT \
59 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBSCALE)
60#define IIO_CHAN_INFO_CALIBSCALE_SHARED_BIT \
61 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBSCALE)
62#define IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT \
63 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_CALIBBIAS)
64#define IIO_CHAN_INFO_CALIBBIAS_SHARED_BIT \
65 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_CALIBBIAS)
66#define IIO_CHAN_INFO_PEAK_SEPARATE_BIT \
67 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAK)
68#define IIO_CHAN_INFO_PEAK_SHARED_BIT \
69 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAK)
70#define IIO_CHAN_INFO_PEAKSCALE_SEPARATE_BIT \
71 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PEAKSCALE)
72#define IIO_CHAN_INFO_PEAKSCALE_SHARED_BIT \
73 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PEAKSCALE)
74#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT \
75 IIO_CHAN_INFO_SEPARATE_BIT( \
76 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW)
77#define IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SHARED_BIT \
78 IIO_CHAN_INFO_SHARED_BIT( \
79 IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW)
80#define IIO_CHAN_INFO_AVERAGE_RAW_SEPARATE_BIT \
81 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
82#define IIO_CHAN_INFO_AVERAGE_RAW_SHARED_BIT \
83 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_AVERAGE_RAW)
84#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SHARED_BIT \
85 IIO_CHAN_INFO_SHARED_BIT( \
86 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
87#define IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY_SEPARATE_BIT \
88 IIO_CHAN_INFO_SEPARATE_BIT( \
89 IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY)
90#define IIO_CHAN_INFO_SAMP_FREQ_SEPARATE_BIT \
91 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_SAMP_FREQ)
92#define IIO_CHAN_INFO_SAMP_FREQ_SHARED_BIT \
93 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_SAMP_FREQ)
94#define IIO_CHAN_INFO_FREQUENCY_SEPARATE_BIT \
95 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_FREQUENCY)
96#define IIO_CHAN_INFO_FREQUENCY_SHARED_BIT \
97 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_FREQUENCY)
98#define IIO_CHAN_INFO_PHASE_SEPARATE_BIT \
99 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_PHASE)
100#define IIO_CHAN_INFO_PHASE_SHARED_BIT \
101 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_PHASE)
102#define IIO_CHAN_INFO_HARDWAREGAIN_SEPARATE_BIT \
103 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
104#define IIO_CHAN_INFO_HARDWAREGAIN_SHARED_BIT \
105 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HARDWAREGAIN)
106#define IIO_CHAN_INFO_HYSTERESIS_SEPARATE_BIT \
107 IIO_CHAN_INFO_SEPARATE_BIT(IIO_CHAN_INFO_HYSTERESIS)
108#define IIO_CHAN_INFO_HYSTERESIS_SHARED_BIT \
109 IIO_CHAN_INFO_SHARED_BIT(IIO_CHAN_INFO_HYSTERESIS)
110
111enum iio_endian { 41enum iio_endian {
112 IIO_CPU, 42 IIO_CPU,
113 IIO_BE, 43 IIO_BE,
@@ -218,6 +148,10 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
218 * endianness: little or big endian 148 * endianness: little or big endian
219 * @info_mask: What information is to be exported about this channel. 149 * @info_mask: What information is to be exported about this channel.
220 * This includes calibbias, scale etc. 150 * This includes calibbias, scale etc.
151 * @info_mask_separate: What information is to be exported that is specific to
152 * this channel.
153 * @info_mask_shared_by_type: What information is to be exported that is shared
154* by all channels of the same type.
221 * @event_mask: What events can this channel produce. 155 * @event_mask: What events can this channel produce.
222 * @ext_info: Array of extended info attributes for this channel. 156 * @ext_info: Array of extended info attributes for this channel.
223 * The array is NULL terminated, the last element should 157 * The array is NULL terminated, the last element should
@@ -253,6 +187,8 @@ struct iio_chan_spec {
253 enum iio_endian endianness; 187 enum iio_endian endianness;
254 } scan_type; 188 } scan_type;
255 long info_mask; 189 long info_mask;
190 long info_mask_separate;
191 long info_mask_shared_by_type;
256 long event_mask; 192 long event_mask;
257 const struct iio_chan_spec_ext_info *ext_info; 193 const struct iio_chan_spec_ext_info *ext_info;
258 const char *extend_name; 194 const char *extend_name;
@@ -275,7 +211,8 @@ struct iio_chan_spec {
275static inline bool iio_channel_has_info(const struct iio_chan_spec *chan, 211static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
276 enum iio_chan_info_enum type) 212 enum iio_chan_info_enum type)
277{ 213{
278 return chan->info_mask & IIO_CHAN_INFO_BITS(type); 214 return (chan->info_mask_separate & type) |
215 (chan->info_mask_shared_by_type & type);
279} 216}
280 217
281#define IIO_ST(si, rb, sb, sh) \ 218#define IIO_ST(si, rb, sb, sh) \
diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h
index ff781dca2e9a..b665dc7f017b 100644
--- a/include/linux/iio/imu/adis.h
+++ b/include/linux/iio/imu/adis.h
@@ -162,8 +162,8 @@ int adis_single_conversion(struct iio_dev *indio_dev,
162 .indexed = 1, \ 162 .indexed = 1, \
163 .channel = (chan), \ 163 .channel = (chan), \
164 .extend_name = name, \ 164 .extend_name = name, \
165 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ 165 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
166 IIO_CHAN_INFO_SCALE_SEPARATE_BIT, \ 166 BIT(IIO_CHAN_INFO_SCALE), \
167 .address = (addr), \ 167 .address = (addr), \
168 .scan_index = (si), \ 168 .scan_index = (si), \
169 .scan_type = { \ 169 .scan_type = { \
@@ -184,9 +184,9 @@ int adis_single_conversion(struct iio_dev *indio_dev,
184 .type = IIO_TEMP, \ 184 .type = IIO_TEMP, \
185 .indexed = 1, \ 185 .indexed = 1, \
186 .channel = 0, \ 186 .channel = 0, \
187 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ 187 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
188 IIO_CHAN_INFO_SCALE_SEPARATE_BIT | \ 188 BIT(IIO_CHAN_INFO_SCALE) | \
189 IIO_CHAN_INFO_OFFSET_SEPARATE_BIT, \ 189 BIT(IIO_CHAN_INFO_OFFSET), \
190 .address = (addr), \ 190 .address = (addr), \
191 .scan_index = (si), \ 191 .scan_index = (si), \
192 .scan_type = { \ 192 .scan_type = { \
@@ -197,13 +197,13 @@ int adis_single_conversion(struct iio_dev *indio_dev,
197 }, \ 197 }, \
198} 198}
199 199
200#define ADIS_MOD_CHAN(_type, mod, addr, si, info, bits) { \ 200#define ADIS_MOD_CHAN(_type, mod, addr, si, info_sep, bits) { \
201 .type = (_type), \ 201 .type = (_type), \
202 .modified = 1, \ 202 .modified = 1, \
203 .channel2 = IIO_MOD_ ## mod, \ 203 .channel2 = IIO_MOD_ ## mod, \
204 .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | \ 204 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
205 IIO_CHAN_INFO_SCALE_SHARED_BIT | \ 205 info_sep, \
206 info, \ 206 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
207 .address = (addr), \ 207 .address = (addr), \
208 .scan_index = (si), \ 208 .scan_index = (si), \
209 .scan_type = { \ 209 .scan_type = { \
@@ -214,17 +214,17 @@ int adis_single_conversion(struct iio_dev *indio_dev,
214 }, \ 214 }, \
215} 215}
216 216
217#define ADIS_ACCEL_CHAN(mod, addr, si, info, bits) \ 217#define ADIS_ACCEL_CHAN(mod, addr, si, info_sep, bits) \
218 ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info, bits) 218 ADIS_MOD_CHAN(IIO_ACCEL, mod, addr, si, info_sep, bits)
219 219
220#define ADIS_GYRO_CHAN(mod, addr, si, info, bits) \ 220#define ADIS_GYRO_CHAN(mod, addr, si, info_sep, bits) \
221 ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info, bits) 221 ADIS_MOD_CHAN(IIO_ANGL_VEL, mod, addr, si, info_sep, bits)
222 222
223#define ADIS_INCLI_CHAN(mod, addr, si, info, bits) \ 223#define ADIS_INCLI_CHAN(mod, addr, si, info_sep, bits) \
224 ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info, bits) 224 ADIS_MOD_CHAN(IIO_INCLI, mod, addr, si, info_sep, bits)
225 225
226#define ADIS_ROT_CHAN(mod, addr, si, info, bits) \ 226#define ADIS_ROT_CHAN(mod, addr, si, info_sep, bits) \
227 ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info, bits) 227 ADIS_MOD_CHAN(IIO_ROT, mod, addr, si, info_sep, bits)
228 228
229#ifdef CONFIG_IIO_ADIS_LIB_BUFFER 229#ifdef CONFIG_IIO_ADIS_LIB_BUFFER
230 230