diff options
author | Jiri Kosina | 2013-03-18 10:57:32 +0100 |
---|---|---|
committer | Jiri Kosina | 2013-03-18 10:57:57 +0100 |
commit | aa1262b3876ec5249ff464618a7dcd46b3ca54e2 (patch) | |
tree | b150bb2c83c073e1f0e298ba7899148f7d991ef7 /include/linux/hid-sensor-hub.h | |
parent | 806b2139db236e0cbd0b5833ab0ce139f0196bcd (diff) | |
parent | 6dbe51c251a327e012439c4772097a13df43c5b8 (diff) |
Merge branch 'master' into for-next
Sync with Linus' tree to be able to apply patch to the newly
added ITG-3200 driver.
Diffstat (limited to 'include/linux/hid-sensor-hub.h')
-rw-r--r-- | include/linux/hid-sensor-hub.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h index 0aa5f4c42ae6..ecefb7311dd6 100644 --- a/include/linux/hid-sensor-hub.h +++ b/include/linux/hid-sensor-hub.h @@ -157,4 +157,42 @@ int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, */ int sensor_hub_get_feature(struct hid_sensor_hub_device *hsdev, u32 report_id, u32 field_index, s32 *value); + +/* hid-sensor-attributes */ + +/* Common hid sensor iio structure */ +struct hid_sensor_common { + struct hid_sensor_hub_device *hsdev; + struct platform_device *pdev; + unsigned usage_id; + bool data_ready; + struct hid_sensor_hub_attribute_info poll; + struct hid_sensor_hub_attribute_info report_state; + struct hid_sensor_hub_attribute_info power_state; + struct hid_sensor_hub_attribute_info sensitivity; +}; + +/*Convert from hid unit expo to regular exponent*/ +static inline int hid_sensor_convert_exponent(int unit_expo) +{ + if (unit_expo < 0x08) + return unit_expo; + else if (unit_expo <= 0x0f) + return -(0x0f-unit_expo+1); + else + return 0; +} + +int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev, + u32 usage_id, + struct hid_sensor_common *st); +int hid_sensor_write_raw_hyst_value(struct hid_sensor_common *st, + int val1, int val2); +int hid_sensor_read_raw_hyst_value(struct hid_sensor_common *st, + int *val1, int *val2); +int hid_sensor_write_samp_freq_value(struct hid_sensor_common *st, + int val1, int val2); +int hid_sensor_read_samp_freq_value(struct hid_sensor_common *st, + int *val1, int *val2); + #endif |