aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/iio/common
diff options
context:
space:
mode:
authorKarol Wrona <k.wrona@samsung.com>2015-01-28 09:05:50 -0500
committerJonathan Cameron <jic23@kernel.org>2015-01-29 13:49:05 -0500
commit50dd64d57eee8aed1a86e875ce77d078e44fad00 (patch)
tree9ff907c4488b35999f28c8d1fa55fc1c46e8e628 /include/linux/iio/common
parent1664f6a5b0c85a006126c398988d06a0059a50a4 (diff)
iio: common: ssp_sensors: Add sensorhub driver
Sensorhub is MCU dedicated to collect data and manage several sensors. Sensorhub is a spi device which provides a layer for IIO devices. It provides some data parsing and common mechanism for sensorhub sensors. Adds common sensorhub library for sensorhub driver and iio drivers which uses sensorhub MCU to communicate with sensors. Signed-off-by: Karol Wrona <k.wrona@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'include/linux/iio/common')
-rw-r--r--include/linux/iio/common/ssp_sensors.h82
1 files changed, 82 insertions, 0 deletions
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_ */