3 * Copyright (c) 2012, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef _HID_SENSORS_ATTRIBUTES_H
20 #define _HID_SENSORS_ATTRIBUTES_H
22 /* Common hid sensor iio structure */
23 struct hid_sensor_iio_common {
24 struct hid_sensor_hub_device *hsdev;
25 struct platform_device *pdev;
28 struct hid_sensor_hub_attribute_info poll;
29 struct hid_sensor_hub_attribute_info report_state;
30 struct hid_sensor_hub_attribute_info power_state;
31 struct hid_sensor_hub_attribute_info sensitivity;
34 /*Convert from hid unit expo to regular exponent*/
35 static inline int hid_sensor_convert_exponent(int unit_expo)
39 else if (unit_expo <= 0x0f)
40 return -(0x0f-unit_expo+1);
45 int hid_sensor_parse_common_attributes(struct hid_sensor_hub_device *hsdev,
47 struct hid_sensor_iio_common *st);
48 int hid_sensor_write_raw_hyst_value(struct hid_sensor_iio_common *st,
50 int hid_sensor_read_raw_hyst_value(struct hid_sensor_iio_common *st,
51 int *val1, int *val2);
52 int hid_sensor_write_samp_freq_value(struct hid_sensor_iio_common *st,
54 int hid_sensor_read_samp_freq_value(struct hid_sensor_iio_common *st,
55 int *val1, int *val2);