150dd64d5SKarol Wrona /* 250dd64d5SKarol Wrona * Copyright (C) 2014, Samsung Electronics Co. Ltd. All Rights Reserved. 350dd64d5SKarol Wrona * 450dd64d5SKarol Wrona * This program is free software; you can redistribute it and/or modify 550dd64d5SKarol Wrona * it under the terms of the GNU General Public License as published by 650dd64d5SKarol Wrona * the Free Software Foundation; either version 2 of the License, or 750dd64d5SKarol Wrona * (at your option) any later version. 850dd64d5SKarol Wrona * 950dd64d5SKarol Wrona * This program is distributed in the hope that it will be useful, 1050dd64d5SKarol Wrona * but WITHOUT ANY WARRANTY; without even the implied warranty of 1150dd64d5SKarol Wrona * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1250dd64d5SKarol Wrona * GNU General Public License for more details. 1350dd64d5SKarol Wrona * 1450dd64d5SKarol Wrona */ 1550dd64d5SKarol Wrona #ifndef _SSP_SENSORS_H_ 1650dd64d5SKarol Wrona #define _SSP_SENSORS_H_ 1750dd64d5SKarol Wrona 1850dd64d5SKarol Wrona #include <linux/iio/iio.h> 1950dd64d5SKarol Wrona 2050dd64d5SKarol Wrona #define SSP_TIME_SIZE 4 2150dd64d5SKarol Wrona #define SSP_ACCELEROMETER_SIZE 6 2250dd64d5SKarol Wrona #define SSP_GYROSCOPE_SIZE 6 2350dd64d5SKarol Wrona #define SSP_BIO_HRM_RAW_SIZE 8 2450dd64d5SKarol Wrona #define SSP_BIO_HRM_RAW_FAC_SIZE 36 2550dd64d5SKarol Wrona #define SSP_BIO_HRM_LIB_SIZE 8 2650dd64d5SKarol Wrona 2750dd64d5SKarol Wrona /** 2850dd64d5SKarol Wrona * enum ssp_sensor_type - SSP sensor type 2950dd64d5SKarol Wrona */ 3050dd64d5SKarol Wrona enum ssp_sensor_type { 3150dd64d5SKarol Wrona SSP_ACCELEROMETER_SENSOR = 0, 3250dd64d5SKarol Wrona SSP_GYROSCOPE_SENSOR, 3350dd64d5SKarol Wrona SSP_GEOMAGNETIC_UNCALIB_SENSOR, 3450dd64d5SKarol Wrona SSP_GEOMAGNETIC_RAW, 3550dd64d5SKarol Wrona SSP_GEOMAGNETIC_SENSOR, 3650dd64d5SKarol Wrona SSP_PRESSURE_SENSOR, 3750dd64d5SKarol Wrona SSP_GESTURE_SENSOR, 3850dd64d5SKarol Wrona SSP_PROXIMITY_SENSOR, 3950dd64d5SKarol Wrona SSP_TEMPERATURE_HUMIDITY_SENSOR, 4050dd64d5SKarol Wrona SSP_LIGHT_SENSOR, 4150dd64d5SKarol Wrona SSP_PROXIMITY_RAW, 4250dd64d5SKarol Wrona SSP_ORIENTATION_SENSOR, 4350dd64d5SKarol Wrona SSP_STEP_DETECTOR, 4450dd64d5SKarol Wrona SSP_SIG_MOTION_SENSOR, 4550dd64d5SKarol Wrona SSP_GYRO_UNCALIB_SENSOR, 4650dd64d5SKarol Wrona SSP_GAME_ROTATION_VECTOR, 4750dd64d5SKarol Wrona SSP_ROTATION_VECTOR, 4850dd64d5SKarol Wrona SSP_STEP_COUNTER, 4950dd64d5SKarol Wrona SSP_BIO_HRM_RAW, 5050dd64d5SKarol Wrona SSP_BIO_HRM_RAW_FAC, 5150dd64d5SKarol Wrona SSP_BIO_HRM_LIB, 5250dd64d5SKarol Wrona SSP_SENSOR_MAX, 5350dd64d5SKarol Wrona }; 5450dd64d5SKarol Wrona 5550dd64d5SKarol Wrona struct ssp_data; 5650dd64d5SKarol Wrona 5750dd64d5SKarol Wrona /** 5850dd64d5SKarol Wrona * struct ssp_sensor_data - Sensor object 5950dd64d5SKarol Wrona * @process_data: Callback to feed sensor data. 6050dd64d5SKarol Wrona * @type: Used sensor type. 6150dd64d5SKarol Wrona * @buffer: Received data buffer. 6250dd64d5SKarol Wrona */ 6350dd64d5SKarol Wrona struct ssp_sensor_data { 6450dd64d5SKarol Wrona int (*process_data)(struct iio_dev *indio_dev, void *buf, 6550dd64d5SKarol Wrona int64_t timestamp); 6650dd64d5SKarol Wrona enum ssp_sensor_type type; 6750dd64d5SKarol Wrona u8 *buffer; 6850dd64d5SKarol Wrona }; 6950dd64d5SKarol Wrona 7050dd64d5SKarol Wrona void ssp_register_consumer(struct iio_dev *indio_dev, 7150dd64d5SKarol Wrona enum ssp_sensor_type type); 7250dd64d5SKarol Wrona 7350dd64d5SKarol Wrona int ssp_enable_sensor(struct ssp_data *data, enum ssp_sensor_type type, 7450dd64d5SKarol Wrona u32 delay); 7550dd64d5SKarol Wrona 7650dd64d5SKarol Wrona int ssp_disable_sensor(struct ssp_data *data, enum ssp_sensor_type type); 7750dd64d5SKarol Wrona 7850dd64d5SKarol Wrona u32 ssp_get_sensor_delay(struct ssp_data *data, enum ssp_sensor_type); 7950dd64d5SKarol Wrona 8050dd64d5SKarol Wrona int ssp_change_delay(struct ssp_data *data, enum ssp_sensor_type type, 8150dd64d5SKarol Wrona u32 delay); 8250dd64d5SKarol Wrona #endif /* _SSP_SENSORS_H_ */ 83