aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/iio
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@kernel.org>2013-09-08 09:57:00 -0400
committerJonathan Cameron <jic23@kernel.org>2013-09-15 12:45:49 -0400
commitc006ec838414d910bdd63ba8d919e602425e194e (patch)
treec288247b0237759d7ef4d11caf675a180413de96 /include/linux/iio
parent3704432fb1fd8ab2df114bad6df752381246b609 (diff)
iio: add info_mask_[shared_by_dir/shared_by_all]
These two additional info_mask bitmaps should allow all 'standard' numeric attributes to be handled using the read_raw and write_raw callbacks. Whilst this should reduce code, the more important element is that this makes these values easily accessible to in kernel users of IIO devices. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Diffstat (limited to 'include/linux/iio')
-rw-r--r--include/linux/iio/iio.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 21de272f1eb6..ac1cb8f1858c 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -41,7 +41,9 @@ enum iio_chan_info_enum {
41 41
42enum iio_shared_by { 42enum iio_shared_by {
43 IIO_SEPARATE, 43 IIO_SEPARATE,
44 IIO_SHARED_BY_TYPE 44 IIO_SHARED_BY_TYPE,
45 IIO_SHARED_BY_DIR,
46 IIO_SHARED_BY_ALL
45}; 47};
46 48
47enum iio_endian { 49enum iio_endian {
@@ -156,6 +158,10 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
156 * this channel. 158 * this channel.
157 * @info_mask_shared_by_type: What information is to be exported that is shared 159 * @info_mask_shared_by_type: What information is to be exported that is shared
158 * by all channels of the same type. 160 * by all channels of the same type.
161 * @info_mask_shared_by_dir: What information is to be exported that is shared
162 * by all channels of the same direction.
163 * @info_mask_shared_by_all: What information is to be exported that is shared
164 * by all channels.
159 * @event_mask: What events can this channel produce. 165 * @event_mask: What events can this channel produce.
160 * @ext_info: Array of extended info attributes for this channel. 166 * @ext_info: Array of extended info attributes for this channel.
161 * The array is NULL terminated, the last element should 167 * The array is NULL terminated, the last element should
@@ -192,6 +198,8 @@ struct iio_chan_spec {
192 } scan_type; 198 } scan_type;
193 long info_mask_separate; 199 long info_mask_separate;
194 long info_mask_shared_by_type; 200 long info_mask_shared_by_type;
201 long info_mask_shared_by_dir;
202 long info_mask_shared_by_all;
195 long event_mask; 203 long event_mask;
196 const struct iio_chan_spec_ext_info *ext_info; 204 const struct iio_chan_spec_ext_info *ext_info;
197 const char *extend_name; 205 const char *extend_name;
@@ -215,7 +223,9 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
215 enum iio_chan_info_enum type) 223 enum iio_chan_info_enum type)
216{ 224{
217 return (chan->info_mask_separate & BIT(type)) | 225 return (chan->info_mask_separate & BIT(type)) |
218 (chan->info_mask_shared_by_type & BIT(type)); 226 (chan->info_mask_shared_by_type & BIT(type)) |
227 (chan->info_mask_shared_by_dir & BIT(type)) |
228 (chan->info_mask_shared_by_all & BIT(type));
219} 229}
220 230
221#define IIO_ST(si, rb, sb, sh) \ 231#define IIO_ST(si, rb, sb, sh) \