linux/include/linux/iio/common/ssp_sensors.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0-or-later */
   2/*
   3 *  Copyright (C) 2014, Samsung Electronics Co. Ltd. All Rights Reserved.
   4 */
   5#ifndef _SSP_SENSORS_H_
   6#define _SSP_SENSORS_H_
   7
   8#include <linux/iio/iio.h>
   9
  10#define SSP_TIME_SIZE                           4
  11#define SSP_ACCELEROMETER_SIZE                  6
  12#define SSP_GYROSCOPE_SIZE                      6
  13#define SSP_BIO_HRM_RAW_SIZE                    8
  14#define SSP_BIO_HRM_RAW_FAC_SIZE                36
  15#define SSP_BIO_HRM_LIB_SIZE                    8
  16
  17/**
  18 * enum ssp_sensor_type - SSP sensor type
  19 */
  20enum ssp_sensor_type {
  21        SSP_ACCELEROMETER_SENSOR = 0,
  22        SSP_GYROSCOPE_SENSOR,
  23        SSP_GEOMAGNETIC_UNCALIB_SENSOR,
  24        SSP_GEOMAGNETIC_RAW,
  25        SSP_GEOMAGNETIC_SENSOR,
  26        SSP_PRESSURE_SENSOR,
  27        SSP_GESTURE_SENSOR,
  28        SSP_PROXIMITY_SENSOR,
  29        SSP_TEMPERATURE_HUMIDITY_SENSOR,
  30        SSP_LIGHT_SENSOR,
  31        SSP_PROXIMITY_RAW,
  32        SSP_ORIENTATION_SENSOR,
  33        SSP_STEP_DETECTOR,
  34        SSP_SIG_MOTION_SENSOR,
  35        SSP_GYRO_UNCALIB_SENSOR,
  36        SSP_GAME_ROTATION_VECTOR,
  37        SSP_ROTATION_VECTOR,
  38        SSP_STEP_COUNTER,
  39        SSP_BIO_HRM_RAW,
  40        SSP_BIO_HRM_RAW_FAC,
  41        SSP_BIO_HRM_LIB,
  42        SSP_SENSOR_MAX,
  43};
  44
  45struct ssp_data;
  46
  47/**
  48 * struct ssp_sensor_data - Sensor object
  49 * @process_data:       Callback to feed sensor data.
  50 * @type:               Used sensor type.
  51 * @buffer:             Received data buffer.
  52 */
  53struct ssp_sensor_data {
  54        int (*process_data)(struct iio_dev *indio_dev, void *buf,
  55                            int64_t timestamp);
  56        enum ssp_sensor_type type;
  57        u8 *buffer;
  58};
  59
  60void ssp_register_consumer(struct iio_dev *indio_dev,
  61                           enum ssp_sensor_type type);
  62
  63int ssp_enable_sensor(struct ssp_data *data, enum ssp_sensor_type type,
  64                      u32 delay);
  65
  66int ssp_disable_sensor(struct ssp_data *data, enum ssp_sensor_type type);
  67
  68u32 ssp_get_sensor_delay(struct ssp_data *data, enum ssp_sensor_type);
  69
  70int ssp_change_delay(struct ssp_data *data, enum ssp_sensor_type type,
  71                     u32 delay);
  72#endif /* _SSP_SENSORS_H_ */
  73