diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/device.h | 6 | ||||
| -rw-r--r-- | include/linux/goldfish.h | 15 | ||||
| -rw-r--r-- | include/linux/hid-sensor-hub.h | 8 | ||||
| -rw-r--r-- | include/linux/hid-sensor-ids.h | 1 | ||||
| -rw-r--r-- | include/linux/iio/common/st_sensors.h | 4 | ||||
| -rw-r--r-- | include/linux/iio/consumer.h | 13 | ||||
| -rw-r--r-- | include/linux/iio/iio.h | 24 | ||||
| -rw-r--r-- | include/linux/iio/types.h | 4 |
8 files changed, 74 insertions, 1 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 1b18c886445c..580e3eed4b78 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -623,6 +623,12 @@ static inline void *devm_kcalloc(struct device *dev, | |||
| 623 | } | 623 | } |
| 624 | extern void devm_kfree(struct device *dev, void *p); | 624 | extern void devm_kfree(struct device *dev, void *p); |
| 625 | extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp); | 625 | extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp); |
| 626 | extern void *devm_kmemdup(struct device *dev, const void *src, size_t len, | ||
| 627 | gfp_t gfp); | ||
| 628 | |||
| 629 | extern unsigned long devm_get_free_pages(struct device *dev, | ||
| 630 | gfp_t gfp_mask, unsigned int order); | ||
| 631 | extern void devm_free_pages(struct device *dev, unsigned long addr); | ||
| 626 | 632 | ||
| 627 | void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); | 633 | void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); |
| 628 | void __iomem *devm_request_and_ioremap(struct device *dev, | 634 | void __iomem *devm_request_and_ioremap(struct device *dev, |
diff --git a/include/linux/goldfish.h b/include/linux/goldfish.h new file mode 100644 index 000000000000..569236e6b2bc --- /dev/null +++ b/include/linux/goldfish.h | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | #ifndef __LINUX_GOLDFISH_H | ||
| 2 | #define __LINUX_GOLDFISH_H | ||
| 3 | |||
| 4 | /* Helpers for Goldfish virtual platform */ | ||
| 5 | |||
| 6 | static inline void gf_write64(unsigned long data, | ||
| 7 | void __iomem *portl, void __iomem *porth) | ||
| 8 | { | ||
| 9 | writel((u32)data, portl); | ||
| 10 | #ifdef CONFIG_64BIT | ||
| 11 | writel(data>>32, porth); | ||
| 12 | #endif | ||
| 13 | } | ||
| 14 | |||
| 15 | #endif /* __LINUX_GOLDFISH_H */ | ||
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 { | |||
| 189 | struct hid_sensor_hub_device *hsdev; | 189 | struct hid_sensor_hub_device *hsdev; |
| 190 | struct platform_device *pdev; | 190 | struct platform_device *pdev; |
| 191 | unsigned usage_id; | 191 | unsigned usage_id; |
| 192 | bool data_ready; | 192 | atomic_t data_ready; |
| 193 | struct iio_trigger *trigger; | 193 | struct iio_trigger *trigger; |
| 194 | struct hid_sensor_hub_attribute_info poll; | 194 | struct hid_sensor_hub_attribute_info poll; |
| 195 | struct hid_sensor_hub_attribute_info report_state; | 195 | struct hid_sensor_hub_attribute_info report_state; |
| @@ -223,4 +223,10 @@ int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st, | |||
| 223 | int hid_sensor_get_usage_index(struct hid_sensor_hub_device *hsdev, | 223 | int hid_sensor_get_usage_index(struct hid_sensor_hub_device *hsdev, |
| 224 | u32 report_id, int field_index, u32 usage_id); | 224 | u32 report_id, int field_index, u32 usage_id); |
| 225 | 225 | ||
| 226 | int hid_sensor_format_scale(u32 usage_id, | ||
| 227 | struct hid_sensor_hub_attribute_info *attr_info, | ||
| 228 | int *val0, int *val1); | ||
| 229 | |||
| 230 | s32 hid_sensor_read_poll_value(struct hid_sensor_common *st); | ||
| 231 | |||
| 226 | #endif | 232 | #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 @@ | |||
| 76 | #define HID_USAGE_SENSOR_ORIENT_TILT_Y 0x200480 | 76 | #define HID_USAGE_SENSOR_ORIENT_TILT_Y 0x200480 |
| 77 | #define HID_USAGE_SENSOR_ORIENT_TILT_Z 0x200481 | 77 | #define HID_USAGE_SENSOR_ORIENT_TILT_Z 0x200481 |
| 78 | 78 | ||
| 79 | #define HID_USAGE_SENSOR_DEVICE_ORIENTATION 0x20008A | ||
| 79 | #define HID_USAGE_SENSOR_ORIENT_ROTATION_MATRIX 0x200482 | 80 | #define HID_USAGE_SENSOR_ORIENT_ROTATION_MATRIX 0x200482 |
| 80 | #define HID_USAGE_SENSOR_ORIENT_QUATERNION 0x200483 | 81 | #define HID_USAGE_SENSOR_ORIENT_QUATERNION 0x200483 |
| 81 | #define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX 0x200484 | 82 | #define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX 0x200484 |
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index 3c005eb3a0a4..96f51f0e0096 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h | |||
| @@ -269,6 +269,10 @@ int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable); | |||
| 269 | 269 | ||
| 270 | int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable); | 270 | int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable); |
| 271 | 271 | ||
| 272 | void st_sensors_power_enable(struct iio_dev *indio_dev); | ||
| 273 | |||
| 274 | void st_sensors_power_disable(struct iio_dev *indio_dev); | ||
| 275 | |||
| 272 | int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr); | 276 | int st_sensors_set_odr(struct iio_dev *indio_dev, unsigned int odr); |
| 273 | 277 | ||
| 274 | int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable); | 278 | int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable); |
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h index 2752b1fd12be..651f9a0e2765 100644 --- a/include/linux/iio/consumer.h +++ b/include/linux/iio/consumer.h | |||
| @@ -123,6 +123,19 @@ int iio_read_channel_raw(struct iio_channel *chan, | |||
| 123 | int *val); | 123 | int *val); |
| 124 | 124 | ||
| 125 | /** | 125 | /** |
| 126 | * iio_read_channel_average_raw() - read from a given channel | ||
| 127 | * @chan: The channel being queried. | ||
| 128 | * @val: Value read back. | ||
| 129 | * | ||
| 130 | * Note raw reads from iio channels are in adc counts and hence | ||
| 131 | * scale will need to be applied if standard units required. | ||
| 132 | * | ||
| 133 | * In opposit to the normal iio_read_channel_raw this function | ||
| 134 | * returns the average of multiple reads. | ||
| 135 | */ | ||
| 136 | int iio_read_channel_average_raw(struct iio_channel *chan, int *val); | ||
| 137 | |||
| 138 | /** | ||
| 126 | * iio_read_channel_processed() - read processed value from a given channel | 139 | * iio_read_channel_processed() - read processed value from a given channel |
| 127 | * @chan: The channel being queried. | 140 | * @chan: The channel being queried. |
| 128 | * @val: Value read back. | 141 | * @val: Value read back. |
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 { | |||
| 177 | * shift: Shift right by this before masking out | 177 | * shift: Shift right by this before masking out |
| 178 | * realbits. | 178 | * realbits. |
| 179 | * endianness: little or big endian | 179 | * endianness: little or big endian |
| 180 | * repeat: Number of times real/storage bits | ||
| 181 | * repeats. When the repeat element is | ||
| 182 | * more than 1, then the type element in | ||
| 183 | * sysfs will show a repeat value. | ||
| 184 | * Otherwise, the number of repetitions is | ||
| 185 | * omitted. | ||
| 180 | * @info_mask_separate: What information is to be exported that is specific to | 186 | * @info_mask_separate: What information is to be exported that is specific to |
| 181 | * this channel. | 187 | * this channel. |
| 182 | * @info_mask_shared_by_type: What information is to be exported that is shared | 188 | * @info_mask_shared_by_type: What information is to be exported that is shared |
| @@ -219,6 +225,7 @@ struct iio_chan_spec { | |||
| 219 | u8 realbits; | 225 | u8 realbits; |
| 220 | u8 storagebits; | 226 | u8 storagebits; |
| 221 | u8 shift; | 227 | u8 shift; |
| 228 | u8 repeat; | ||
| 222 | enum iio_endian endianness; | 229 | enum iio_endian endianness; |
| 223 | } scan_type; | 230 | } scan_type; |
| 224 | long info_mask_separate; | 231 | long info_mask_separate; |
| @@ -288,6 +295,8 @@ static inline s64 iio_get_time_ns(void) | |||
| 288 | #define INDIO_ALL_BUFFER_MODES \ | 295 | #define INDIO_ALL_BUFFER_MODES \ |
| 289 | (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE) | 296 | (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE) |
| 290 | 297 | ||
| 298 | #define INDIO_MAX_RAW_ELEMENTS 4 | ||
| 299 | |||
| 291 | struct iio_trigger; /* forward declaration */ | 300 | struct iio_trigger; /* forward declaration */ |
| 292 | struct iio_dev; | 301 | struct iio_dev; |
| 293 | 302 | ||
| @@ -302,6 +311,14 @@ struct iio_dev; | |||
| 302 | * the channel in question. Return value will specify the | 311 | * the channel in question. Return value will specify the |
| 303 | * type of value returned by the device. val and val2 will | 312 | * type of value returned by the device. val and val2 will |
| 304 | * contain the elements making up the returned value. | 313 | * contain the elements making up the returned value. |
| 314 | * @read_raw_multi: function to return values from the device. | ||
| 315 | * mask specifies which value. Note 0 means a reading of | ||
| 316 | * the channel in question. Return value will specify the | ||
| 317 | * type of value returned by the device. vals pointer | ||
| 318 | * contain the elements making up the returned value. | ||
| 319 | * max_len specifies maximum number of elements | ||
| 320 | * vals pointer can contain. val_len is used to return | ||
| 321 | * length of valid elements in vals. | ||
| 305 | * @write_raw: function to write a value to the device. | 322 | * @write_raw: function to write a value to the device. |
| 306 | * Parameters are the same as for read_raw. | 323 | * Parameters are the same as for read_raw. |
| 307 | * @write_raw_get_fmt: callback function to query the expected | 324 | * @write_raw_get_fmt: callback function to query the expected |
| @@ -328,6 +345,13 @@ struct iio_info { | |||
| 328 | int *val2, | 345 | int *val2, |
| 329 | long mask); | 346 | long mask); |
| 330 | 347 | ||
| 348 | int (*read_raw_multi)(struct iio_dev *indio_dev, | ||
| 349 | struct iio_chan_spec const *chan, | ||
| 350 | int max_len, | ||
| 351 | int *vals, | ||
| 352 | int *val_len, | ||
| 353 | long mask); | ||
| 354 | |||
| 331 | int (*write_raw)(struct iio_dev *indio_dev, | 355 | int (*write_raw)(struct iio_dev *indio_dev, |
| 332 | struct iio_chan_spec const *chan, | 356 | struct iio_chan_spec const *chan, |
| 333 | int val, | 357 | 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 { | |||
| 53 | IIO_MOD_LIGHT_RED, | 53 | IIO_MOD_LIGHT_RED, |
| 54 | IIO_MOD_LIGHT_GREEN, | 54 | IIO_MOD_LIGHT_GREEN, |
| 55 | IIO_MOD_LIGHT_BLUE, | 55 | IIO_MOD_LIGHT_BLUE, |
| 56 | IIO_MOD_QUATERNION, | ||
| 57 | IIO_MOD_TEMP_AMBIENT, | ||
| 58 | IIO_MOD_TEMP_OBJECT, | ||
| 56 | }; | 59 | }; |
| 57 | 60 | ||
| 58 | enum iio_event_type { | 61 | enum iio_event_type { |
| @@ -79,6 +82,7 @@ enum iio_event_direction { | |||
| 79 | #define IIO_VAL_INT_PLUS_MICRO 2 | 82 | #define IIO_VAL_INT_PLUS_MICRO 2 |
| 80 | #define IIO_VAL_INT_PLUS_NANO 3 | 83 | #define IIO_VAL_INT_PLUS_NANO 3 |
| 81 | #define IIO_VAL_INT_PLUS_MICRO_DB 4 | 84 | #define IIO_VAL_INT_PLUS_MICRO_DB 4 |
| 85 | #define IIO_VAL_INT_MULTIPLE 5 | ||
| 82 | #define IIO_VAL_FRACTIONAL 10 | 86 | #define IIO_VAL_FRACTIONAL 10 |
| 83 | #define IIO_VAL_FRACTIONAL_LOG2 11 | 87 | #define IIO_VAL_FRACTIONAL_LOG2 11 |
| 84 | 88 | ||
