Linux 4.16-rc1
[cris-mirror.git] / include / linux / iio / common / ssp_sensors.h
blobf4d1b0edb432358da1abeef1392dac6c89739957
1 /*
2 * Copyright (C) 2014, Samsung Electronics Co. Ltd. All Rights Reserved.
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.
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.
15 #ifndef _SSP_SENSORS_H_
16 #define _SSP_SENSORS_H_
18 #include <linux/iio/iio.h>
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
27 /**
28 * enum ssp_sensor_type - SSP sensor type
30 enum 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,
55 struct ssp_data;
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.
63 struct 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;
70 void ssp_register_consumer(struct iio_dev *indio_dev,
71 enum ssp_sensor_type type);
73 int ssp_enable_sensor(struct ssp_data *data, enum ssp_sensor_type type,
74 u32 delay);
76 int ssp_disable_sensor(struct ssp_data *data, enum ssp_sensor_type type);
78 u32 ssp_get_sensor_delay(struct ssp_data *data, enum ssp_sensor_type);
80 int ssp_change_delay(struct ssp_data *data, enum ssp_sensor_type type,
81 u32 delay);
82 #endif /* _SSP_SENSORS_H_ */