summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-05 16:40:54 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-05 16:40:54 -0700
commita3476ac678dfec74075ce98396db7cb1d448fd4b (patch)
tree946b759331b5b6af20fb4f772d2cf524f1fec272 /include
parent09c3fbba88b444f5e46702cc90fd014d2df7b36d (diff)
parentcd5b700f998d9e1d8e6dbc62aeb0351bb2216e22 (diff)
Merge tag 'iio-for-3.16b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes: Second set of IIO new drivers, cleanups and functionality for the 3.16 cycle. This set contains a change to the ABI for the hid-sensors drivers to bring them in line with the long published documentation. Unfortunately, rather than reporting true scale and offset values via sysfs they were reporting some magic numbers that could only be converted to anything useful using the HID sensors specification. I missed this entirely through the introduction of a number of drivers, only picking up on it recently. Srinivas has had user feedback about this as well. The patch set is too large to go as a fix at this stage in the cycle and is not a regression fix as this was never right and so will have to wait for the next merge window. Srinivas assures me that there are relatively few pieces of hardware out there and he has had a number of people contact him to point out that the drivers did not obey the ABI. Hence hopefully the fallout of this, if any will be minor. If we don't fix it now, it will only get worse going forward. There is no sensible way of maintaining the incorrect ABI as it is simply returning the wrong values through the standard interfaces. Non IIO elements * Introduce devm_kmemdup. Does what it says on the tin. New drivers: * hid-sensors rotation devices (output as quaternion) * Freescale MPL115A2 presure and temperature sensor. * Melexis mlx90614 contactless infrared sensor. * Freescale MMA8452Q 3-axis accelerometer. New functionality: * Addition of multiple element callback to allow for sysfs interfaces to access elements such as quaternions which have no useful meaning if all 4 elements are not presented together. Other future usecases for this include rotation matrices. * Support for multiple element buffer entries for exactly the same uses as the sysfs related elements described above. * Quaternion support via the quaternion IIO modifier. * TEMP_AMBIENT and TEMP_OBJECT modifiers to distinguish cases with thermopile devices. * hid-sensors gain sysfs access to the sensor readings. Previously these drivers used the buffered interface only. This change involves some additional hid-sensors core support to read poll values back from the devices to allow the drivers to know roughly how long to wait for a result when polling the sensor. There is also an associated hid-sensors abi to allow the devices to be turned off between reads and powered up on demand. Cleanups and fixes * Hid sensors fix as described above. Result is to make the _scale and _offset attributes applicable in the same way as for all other IIO drivers. * Some additional documentation - mostly covering stuff that graduated from staging without managing to take it's ABI docs with it. * A series of little tidy ups to the exynos_adc driver that make the code nicer to read and improve handling of some corner cases. * A tidy up to mag3110 (logical fix rather than a real one ;). Also enable user offset calibration for this device. * Drop some left over IS_ERR() checks from ad799x that snuck through during the cleanup in the last IIO patch set. * Fix a naming issue from clashing patches in ak8975 - note the clash only occured in the last IIO patch set, hence the fix needs to go through this tree. * A format string missmatch fix in ad7280.c. Unlikely to have ever had an impact so not worth rushing through.
Diffstat (limited to 'include')
-rw-r--r--include/linux/device.h2
-rw-r--r--include/linux/hid-sensor-hub.h8
-rw-r--r--include/linux/hid-sensor-ids.h1
-rw-r--r--include/linux/iio/iio.h24
-rw-r--r--include/linux/iio/types.h4
5 files changed, 38 insertions, 1 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index d1d1c055b48e..ab871588da89 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -623,6 +623,8 @@ static inline void *devm_kcalloc(struct device *dev,
}
extern void devm_kfree(struct device *dev, void *p);
extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp);
+extern void *devm_kmemdup(struct device *dev, const void *src, size_t len,
+ gfp_t gfp);
void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
void __iomem *devm_request_and_ioremap(struct device *dev,
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index b70cfd7ff29c..51f7ccadf923 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -189,7 +189,7 @@ struct hid_sensor_common {
struct hid_sensor_hub_device *hsdev;
struct platform_device *pdev;
unsigned usage_id;
- bool data_ready;
+ atomic_t data_ready;
struct iio_trigger *trigger;
struct hid_sensor_hub_attribute_info poll;
struct hid_sensor_hub_attribute_info report_state;
@@ -223,4 +223,10 @@ int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st,
int hid_sensor_get_usage_index(struct hid_sensor_hub_device *hsdev,
u32 report_id, int field_index, u32 usage_id);
+int hid_sensor_format_scale(u32 usage_id,
+ struct hid_sensor_hub_attribute_info *attr_info,
+ int *val0, int *val1);
+
+s32 hid_sensor_read_poll_value(struct hid_sensor_common *st);
+
#endif
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 14ead9e8eda8..109f0e633e01 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -76,6 +76,7 @@
#define HID_USAGE_SENSOR_ORIENT_TILT_Y 0x200480
#define HID_USAGE_SENSOR_ORIENT_TILT_Z 0x200481
+#define HID_USAGE_SENSOR_DEVICE_ORIENTATION 0x20008A
#define HID_USAGE_SENSOR_ORIENT_ROTATION_MATRIX 0x200482
#define HID_USAGE_SENSOR_ORIENT_QUATERNION 0x200483
#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX 0x200484
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 5f2d00e7e488..ccde91725f98 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -177,6 +177,12 @@ struct iio_event_spec {
* shift: Shift right by this before masking out
* realbits.
* endianness: little or big endian
+ * repeat: Number of times real/storage bits
+ * repeats. When the repeat element is
+ * more than 1, then the type element in
+ * sysfs will show a repeat value.
+ * Otherwise, the number of repetitions is
+ * omitted.
* @info_mask_separate: What information is to be exported that is specific to
* this channel.
* @info_mask_shared_by_type: What information is to be exported that is shared
@@ -219,6 +225,7 @@ struct iio_chan_spec {
u8 realbits;
u8 storagebits;
u8 shift;
+ u8 repeat;
enum iio_endian endianness;
} scan_type;
long info_mask_separate;
@@ -288,6 +295,8 @@ static inline s64 iio_get_time_ns(void)
#define INDIO_ALL_BUFFER_MODES \
(INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE)
+#define INDIO_MAX_RAW_ELEMENTS 4
+
struct iio_trigger; /* forward declaration */
struct iio_dev;
@@ -302,6 +311,14 @@ struct iio_dev;
* the channel in question. Return value will specify the
* type of value returned by the device. val and val2 will
* contain the elements making up the returned value.
+ * @read_raw_multi: function to return values from the device.
+ * mask specifies which value. Note 0 means a reading of
+ * the channel in question. Return value will specify the
+ * type of value returned by the device. vals pointer
+ * contain the elements making up the returned value.
+ * max_len specifies maximum number of elements
+ * vals pointer can contain. val_len is used to return
+ * length of valid elements in vals.
* @write_raw: function to write a value to the device.
* Parameters are the same as for read_raw.
* @write_raw_get_fmt: callback function to query the expected
@@ -328,6 +345,13 @@ struct iio_info {
int *val2,
long mask);
+ int (*read_raw_multi)(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan,
+ int max_len,
+ int *vals,
+ int *val_len,
+ long mask);
+
int (*write_raw)(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan,
int val,
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 084d882fe01b..d480631eabc2 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -53,6 +53,9 @@ enum iio_modifier {
IIO_MOD_LIGHT_RED,
IIO_MOD_LIGHT_GREEN,
IIO_MOD_LIGHT_BLUE,
+ IIO_MOD_QUATERNION,
+ IIO_MOD_TEMP_AMBIENT,
+ IIO_MOD_TEMP_OBJECT,
};
enum iio_event_type {
@@ -79,6 +82,7 @@ enum iio_event_direction {
#define IIO_VAL_INT_PLUS_MICRO 2
#define IIO_VAL_INT_PLUS_NANO 3
#define IIO_VAL_INT_PLUS_MICRO_DB 4
+#define IIO_VAL_INT_MULTIPLE 5
#define IIO_VAL_FRACTIONAL 10
#define IIO_VAL_FRACTIONAL_LOG2 11