aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/iio
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-02-23 14:02:19 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-02-23 14:02:19 -0500
commit99a85b901eb54f62ff0c3fd6eb56e60b7b9f15c8 (patch)
tree0c6637b7d2172e079c30e966847326767cbaf45c /include/linux/iio
parent135f9be9194cf7778eb73594aa55791b229cf27c (diff)
parentc517d838eb7d07bbe9507871fab3931deccff539 (diff)
Merge tag 'v4.0-rc1' into patchwork
Linux 34.0-rc1 * tag 'v4.0-rc1': (8947 commits) Linux 4.0-rc1 autofs4 copy_dev_ioctl(): keep the value of ->size we'd used for allocation procfs: fix race between symlink removals and traversals debugfs: leave freeing a symlink body until inode eviction Documentation/filesystems/Locking: ->get_sb() is long gone trylock_super(): replacement for grab_super_passive() fanotify: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions Cachefiles: Fix up scripted S_ISDIR/S_ISREG/S_ISLNK conversions VFS: (Scripted) Convert S_ISLNK/DIR/REG(dentry->d_inode) to d_is_*(dentry) SELinux: Use d_is_positive() rather than testing dentry->d_inode Smack: Use d_is_positive() rather than testing dentry->d_inode TOMOYO: Use d_is_dir() rather than d_inode and S_ISDIR() Apparmor: Use d_is_positive/negative() rather than testing dentry->d_inode Apparmor: mediated_filesystem() should use dentry->d_sb not inode->i_sb VFS: Split DCACHE_FILE_TYPE into regular and special types VFS: Add a fallthrough flag for marking virtual dentries VFS: Add a whiteout dentry type VFS: Introduce inode-getting helpers for layered/unioned fs environments kernel: make READ_ONCE() valid on const arguments blk-throttle: check stats_cpu before reading it from sysfs ...
Diffstat (limited to 'include/linux/iio')
-rw-r--r--include/linux/iio/buffer.h76
-rw-r--r--include/linux/iio/common/ssp_sensors.h82
-rw-r--r--include/linux/iio/consumer.h12
-rw-r--r--include/linux/iio/iio.h11
-rw-r--r--include/linux/iio/kfifo_buf.h5
-rw-r--r--include/linux/iio/types.h14
6 files changed, 121 insertions, 79 deletions
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index 519392763393..b65850a41127 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -25,9 +25,7 @@ struct iio_buffer;
25 * available. 25 * available.
26 * @request_update: if a parameter change has been marked, update underlying 26 * @request_update: if a parameter change has been marked, update underlying
27 * storage. 27 * storage.
28 * @get_bytes_per_datum:get current bytes per datum
29 * @set_bytes_per_datum:set number of bytes per datum 28 * @set_bytes_per_datum:set number of bytes per datum
30 * @get_length: get number of datums in buffer
31 * @set_length: set number of datums in buffer 29 * @set_length: set number of datums in buffer
32 * @release: called when the last reference to the buffer is dropped, 30 * @release: called when the last reference to the buffer is dropped,
33 * should free all resources allocated by the buffer. 31 * should free all resources allocated by the buffer.
@@ -49,9 +47,7 @@ struct iio_buffer_access_funcs {
49 47
50 int (*request_update)(struct iio_buffer *buffer); 48 int (*request_update)(struct iio_buffer *buffer);
51 49
52 int (*get_bytes_per_datum)(struct iio_buffer *buffer);
53 int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd); 50 int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd);
54 int (*get_length)(struct iio_buffer *buffer);
55 int (*set_length)(struct iio_buffer *buffer, int length); 51 int (*set_length)(struct iio_buffer *buffer, int length);
56 52
57 void (*release)(struct iio_buffer *buffer); 53 void (*release)(struct iio_buffer *buffer);
@@ -85,10 +81,11 @@ struct iio_buffer {
85 bool scan_timestamp; 81 bool scan_timestamp;
86 const struct iio_buffer_access_funcs *access; 82 const struct iio_buffer_access_funcs *access;
87 struct list_head scan_el_dev_attr_list; 83 struct list_head scan_el_dev_attr_list;
84 struct attribute_group buffer_group;
88 struct attribute_group scan_el_group; 85 struct attribute_group scan_el_group;
89 wait_queue_head_t pollq; 86 wait_queue_head_t pollq;
90 bool stufftoread; 87 bool stufftoread;
91 const struct attribute_group *attrs; 88 const struct attribute **attrs;
92 struct list_head demux_list; 89 struct list_head demux_list;
93 void *demux_bounce; 90 void *demux_bounce;
94 struct list_head buffer_list; 91 struct list_head buffer_list;
@@ -117,15 +114,6 @@ int iio_scan_mask_query(struct iio_dev *indio_dev,
117 struct iio_buffer *buffer, int bit); 114 struct iio_buffer *buffer, int bit);
118 115
119/** 116/**
120 * iio_scan_mask_set() - set particular bit in the scan mask
121 * @indio_dev IIO device structure
122 * @buffer: the buffer whose scan mask we are interested in
123 * @bit: the bit to be set.
124 **/
125int iio_scan_mask_set(struct iio_dev *indio_dev,
126 struct iio_buffer *buffer, int bit);
127
128/**
129 * iio_push_to_buffers() - push to a registered buffer. 117 * iio_push_to_buffers() - push to a registered buffer.
130 * @indio_dev: iio_dev structure for device. 118 * @indio_dev: iio_dev structure for device.
131 * @data: Full scan. 119 * @data: Full scan.
@@ -159,56 +147,6 @@ static inline int iio_push_to_buffers_with_timestamp(struct iio_dev *indio_dev,
159 147
160int iio_update_demux(struct iio_dev *indio_dev); 148int iio_update_demux(struct iio_dev *indio_dev);
161 149
162/**
163 * iio_buffer_register() - register the buffer with IIO core
164 * @indio_dev: device with the buffer to be registered
165 * @channels: the channel descriptions used to construct buffer
166 * @num_channels: the number of channels
167 **/
168int iio_buffer_register(struct iio_dev *indio_dev,
169 const struct iio_chan_spec *channels,
170 int num_channels);
171
172/**
173 * iio_buffer_unregister() - unregister the buffer from IIO core
174 * @indio_dev: the device with the buffer to be unregistered
175 **/
176void iio_buffer_unregister(struct iio_dev *indio_dev);
177
178/**
179 * iio_buffer_read_length() - attr func to get number of datums in the buffer
180 **/
181ssize_t iio_buffer_read_length(struct device *dev,
182 struct device_attribute *attr,
183 char *buf);
184/**
185 * iio_buffer_write_length() - attr func to set number of datums in the buffer
186 **/
187ssize_t iio_buffer_write_length(struct device *dev,
188 struct device_attribute *attr,
189 const char *buf,
190 size_t len);
191/**
192 * iio_buffer_store_enable() - attr to turn the buffer on
193 **/
194ssize_t iio_buffer_store_enable(struct device *dev,
195 struct device_attribute *attr,
196 const char *buf,
197 size_t len);
198/**
199 * iio_buffer_show_enable() - attr to see if the buffer is on
200 **/
201ssize_t iio_buffer_show_enable(struct device *dev,
202 struct device_attribute *attr,
203 char *buf);
204#define IIO_BUFFER_LENGTH_ATTR DEVICE_ATTR(length, S_IRUGO | S_IWUSR, \
205 iio_buffer_read_length, \
206 iio_buffer_write_length)
207
208#define IIO_BUFFER_ENABLE_ATTR DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, \
209 iio_buffer_show_enable, \
210 iio_buffer_store_enable)
211
212bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev, 150bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev,
213 const unsigned long *mask); 151 const unsigned long *mask);
214 152
@@ -232,16 +170,6 @@ static inline void iio_device_attach_buffer(struct iio_dev *indio_dev,
232 170
233#else /* CONFIG_IIO_BUFFER */ 171#else /* CONFIG_IIO_BUFFER */
234 172
235static inline int iio_buffer_register(struct iio_dev *indio_dev,
236 const struct iio_chan_spec *channels,
237 int num_channels)
238{
239 return 0;
240}
241
242static inline void iio_buffer_unregister(struct iio_dev *indio_dev)
243{}
244
245static inline void iio_buffer_get(struct iio_buffer *buffer) {} 173static inline void iio_buffer_get(struct iio_buffer *buffer) {}
246static inline void iio_buffer_put(struct iio_buffer *buffer) {} 174static inline void iio_buffer_put(struct iio_buffer *buffer) {}
247 175
diff --git a/include/linux/iio/common/ssp_sensors.h b/include/linux/iio/common/ssp_sensors.h
new file mode 100644
index 000000000000..f4d1b0edb432
--- /dev/null
+++ b/include/linux/iio/common/ssp_sensors.h
@@ -0,0 +1,82 @@
1/*
2 * Copyright (C) 2014, Samsung Electronics Co. Ltd. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15#ifndef _SSP_SENSORS_H_
16#define _SSP_SENSORS_H_
17
18#include <linux/iio/iio.h>
19
20#define SSP_TIME_SIZE 4
21#define SSP_ACCELEROMETER_SIZE 6
22#define SSP_GYROSCOPE_SIZE 6
23#define SSP_BIO_HRM_RAW_SIZE 8
24#define SSP_BIO_HRM_RAW_FAC_SIZE 36
25#define SSP_BIO_HRM_LIB_SIZE 8
26
27/**
28 * enum ssp_sensor_type - SSP sensor type
29 */
30enum ssp_sensor_type {
31 SSP_ACCELEROMETER_SENSOR = 0,
32 SSP_GYROSCOPE_SENSOR,
33 SSP_GEOMAGNETIC_UNCALIB_SENSOR,
34 SSP_GEOMAGNETIC_RAW,
35 SSP_GEOMAGNETIC_SENSOR,
36 SSP_PRESSURE_SENSOR,
37 SSP_GESTURE_SENSOR,
38 SSP_PROXIMITY_SENSOR,
39 SSP_TEMPERATURE_HUMIDITY_SENSOR,
40 SSP_LIGHT_SENSOR,
41 SSP_PROXIMITY_RAW,
42 SSP_ORIENTATION_SENSOR,
43 SSP_STEP_DETECTOR,
44 SSP_SIG_MOTION_SENSOR,
45 SSP_GYRO_UNCALIB_SENSOR,
46 SSP_GAME_ROTATION_VECTOR,
47 SSP_ROTATION_VECTOR,
48 SSP_STEP_COUNTER,
49 SSP_BIO_HRM_RAW,
50 SSP_BIO_HRM_RAW_FAC,
51 SSP_BIO_HRM_LIB,
52 SSP_SENSOR_MAX,
53};
54
55struct ssp_data;
56
57/**
58 * struct ssp_sensor_data - Sensor object
59 * @process_data: Callback to feed sensor data.
60 * @type: Used sensor type.
61 * @buffer: Received data buffer.
62 */
63struct ssp_sensor_data {
64 int (*process_data)(struct iio_dev *indio_dev, void *buf,
65 int64_t timestamp);
66 enum ssp_sensor_type type;
67 u8 *buffer;
68};
69
70void ssp_register_consumer(struct iio_dev *indio_dev,
71 enum ssp_sensor_type type);
72
73int ssp_enable_sensor(struct ssp_data *data, enum ssp_sensor_type type,
74 u32 delay);
75
76int ssp_disable_sensor(struct ssp_data *data, enum ssp_sensor_type type);
77
78u32 ssp_get_sensor_delay(struct ssp_data *data, enum ssp_sensor_type);
79
80int ssp_change_delay(struct ssp_data *data, enum ssp_sensor_type type,
81 u32 delay);
82#endif /* _SSP_SENSORS_H_ */
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
index 651f9a0e2765..26fb8f6342bb 100644
--- a/include/linux/iio/consumer.h
+++ b/include/linux/iio/consumer.h
@@ -151,6 +151,16 @@ int iio_read_channel_average_raw(struct iio_channel *chan, int *val);
151int iio_read_channel_processed(struct iio_channel *chan, int *val); 151int iio_read_channel_processed(struct iio_channel *chan, int *val);
152 152
153/** 153/**
154 * iio_write_channel_raw() - write to a given channel
155 * @chan: The channel being queried.
156 * @val: Value being written.
157 *
158 * Note raw writes to iio channels are in dac counts and hence
159 * scale will need to be applied if standard units required.
160 */
161int iio_write_channel_raw(struct iio_channel *chan, int val);
162
163/**
154 * iio_get_channel_type() - get the type of a channel 164 * iio_get_channel_type() - get the type of a channel
155 * @channel: The channel being queried. 165 * @channel: The channel being queried.
156 * @type: The type of the channel. 166 * @type: The type of the channel.
@@ -191,7 +201,7 @@ int iio_read_channel_scale(struct iio_channel *chan, int *val,
191 * The scale factor allows to increase the precession of the returned value. For 201 * The scale factor allows to increase the precession of the returned value. For
192 * a scale factor of 1 the function will return the result in the normal IIO 202 * a scale factor of 1 the function will return the result in the normal IIO
193 * unit for the channel type. E.g. millivolt for voltage channels, if you want 203 * unit for the channel type. E.g. millivolt for voltage channels, if you want
194 * nanovolts instead pass 1000 as the scale factor. 204 * nanovolts instead pass 1000000 as the scale factor.
195 */ 205 */
196int iio_convert_raw_to_processed(struct iio_channel *chan, int raw, 206int iio_convert_raw_to_processed(struct iio_channel *chan, int raw,
197 int *processed, unsigned int scale); 207 int *processed, unsigned int scale);
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 3642ce7ef512..80d855061064 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -38,6 +38,11 @@ enum iio_chan_info_enum {
38 IIO_CHAN_INFO_HARDWAREGAIN, 38 IIO_CHAN_INFO_HARDWAREGAIN,
39 IIO_CHAN_INFO_HYSTERESIS, 39 IIO_CHAN_INFO_HYSTERESIS,
40 IIO_CHAN_INFO_INT_TIME, 40 IIO_CHAN_INFO_INT_TIME,
41 IIO_CHAN_INFO_ENABLE,
42 IIO_CHAN_INFO_CALIBHEIGHT,
43 IIO_CHAN_INFO_CALIBWEIGHT,
44 IIO_CHAN_INFO_DEBOUNCE_COUNT,
45 IIO_CHAN_INFO_DEBOUNCE_TIME,
41}; 46};
42 47
43enum iio_shared_by { 48enum iio_shared_by {
@@ -284,10 +289,11 @@ static inline s64 iio_get_time_ns(void)
284/* Device operating modes */ 289/* Device operating modes */
285#define INDIO_DIRECT_MODE 0x01 290#define INDIO_DIRECT_MODE 0x01
286#define INDIO_BUFFER_TRIGGERED 0x02 291#define INDIO_BUFFER_TRIGGERED 0x02
292#define INDIO_BUFFER_SOFTWARE 0x04
287#define INDIO_BUFFER_HARDWARE 0x08 293#define INDIO_BUFFER_HARDWARE 0x08
288 294
289#define INDIO_ALL_BUFFER_MODES \ 295#define INDIO_ALL_BUFFER_MODES \
290 (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE) 296 (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE | INDIO_BUFFER_SOFTWARE)
291 297
292#define INDIO_MAX_RAW_ELEMENTS 4 298#define INDIO_MAX_RAW_ELEMENTS 4
293 299
@@ -591,7 +597,8 @@ void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig);
591static inline bool iio_buffer_enabled(struct iio_dev *indio_dev) 597static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
592{ 598{
593 return indio_dev->currentmode 599 return indio_dev->currentmode
594 & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE); 600 & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE |
601 INDIO_BUFFER_SOFTWARE);
595} 602}
596 603
597/** 604/**
diff --git a/include/linux/iio/kfifo_buf.h b/include/linux/iio/kfifo_buf.h
index 25eeac762e84..1683bc710d14 100644
--- a/include/linux/iio/kfifo_buf.h
+++ b/include/linux/iio/kfifo_buf.h
@@ -5,7 +5,10 @@
5#include <linux/iio/iio.h> 5#include <linux/iio/iio.h>
6#include <linux/iio/buffer.h> 6#include <linux/iio/buffer.h>
7 7
8struct iio_buffer *iio_kfifo_allocate(struct iio_dev *indio_dev); 8struct iio_buffer *iio_kfifo_allocate(void);
9void iio_kfifo_free(struct iio_buffer *r); 9void iio_kfifo_free(struct iio_buffer *r);
10 10
11struct iio_buffer *devm_iio_kfifo_allocate(struct device *dev);
12void devm_iio_kfifo_free(struct device *dev, struct iio_buffer *r);
13
11#endif 14#endif
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 4a2af8adf874..580ed5bdb3fa 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -30,6 +30,11 @@ enum iio_chan_type {
30 IIO_CCT, 30 IIO_CCT,
31 IIO_PRESSURE, 31 IIO_PRESSURE,
32 IIO_HUMIDITYRELATIVE, 32 IIO_HUMIDITYRELATIVE,
33 IIO_ACTIVITY,
34 IIO_STEPS,
35 IIO_ENERGY,
36 IIO_DISTANCE,
37 IIO_VELOCITY,
33}; 38};
34 39
35enum iio_modifier { 40enum iio_modifier {
@@ -59,7 +64,12 @@ enum iio_modifier {
59 IIO_MOD_NORTH_MAGN, 64 IIO_MOD_NORTH_MAGN,
60 IIO_MOD_NORTH_TRUE, 65 IIO_MOD_NORTH_TRUE,
61 IIO_MOD_NORTH_MAGN_TILT_COMP, 66 IIO_MOD_NORTH_MAGN_TILT_COMP,
62 IIO_MOD_NORTH_TRUE_TILT_COMP 67 IIO_MOD_NORTH_TRUE_TILT_COMP,
68 IIO_MOD_RUNNING,
69 IIO_MOD_JOGGING,
70 IIO_MOD_WALKING,
71 IIO_MOD_STILL,
72 IIO_MOD_ROOT_SUM_SQUARED_X_Y_Z,
63}; 73};
64 74
65enum iio_event_type { 75enum iio_event_type {
@@ -68,6 +78,7 @@ enum iio_event_type {
68 IIO_EV_TYPE_ROC, 78 IIO_EV_TYPE_ROC,
69 IIO_EV_TYPE_THRESH_ADAPTIVE, 79 IIO_EV_TYPE_THRESH_ADAPTIVE,
70 IIO_EV_TYPE_MAG_ADAPTIVE, 80 IIO_EV_TYPE_MAG_ADAPTIVE,
81 IIO_EV_TYPE_CHANGE,
71}; 82};
72 83
73enum iio_event_info { 84enum iio_event_info {
@@ -81,6 +92,7 @@ enum iio_event_direction {
81 IIO_EV_DIR_EITHER, 92 IIO_EV_DIR_EITHER,
82 IIO_EV_DIR_RISING, 93 IIO_EV_DIR_RISING,
83 IIO_EV_DIR_FALLING, 94 IIO_EV_DIR_FALLING,
95 IIO_EV_DIR_NONE,
84}; 96};
85 97
86#define IIO_VAL_INT 1 98#define IIO_VAL_INT 1