ssp_sensors.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. #include <linux/iio/iio.h>
  18. #define SSP_TIME_SIZE 4
  19. #define SSP_ACCELEROMETER_SIZE 6
  20. #define SSP_GYROSCOPE_SIZE 6
  21. #define SSP_BIO_HRM_RAW_SIZE 8
  22. #define SSP_BIO_HRM_RAW_FAC_SIZE 36
  23. #define SSP_BIO_HRM_LIB_SIZE 8
  24. /**
  25. * enum ssp_sensor_type - SSP sensor type
  26. */
  27. enum ssp_sensor_type {
  28. SSP_ACCELEROMETER_SENSOR = 0,
  29. SSP_GYROSCOPE_SENSOR,
  30. SSP_GEOMAGNETIC_UNCALIB_SENSOR,
  31. SSP_GEOMAGNETIC_RAW,
  32. SSP_GEOMAGNETIC_SENSOR,
  33. SSP_PRESSURE_SENSOR,
  34. SSP_GESTURE_SENSOR,
  35. SSP_PROXIMITY_SENSOR,
  36. SSP_TEMPERATURE_HUMIDITY_SENSOR,
  37. SSP_LIGHT_SENSOR,
  38. SSP_PROXIMITY_RAW,
  39. SSP_ORIENTATION_SENSOR,
  40. SSP_STEP_DETECTOR,
  41. SSP_SIG_MOTION_SENSOR,
  42. SSP_GYRO_UNCALIB_SENSOR,
  43. SSP_GAME_ROTATION_VECTOR,
  44. SSP_ROTATION_VECTOR,
  45. SSP_STEP_COUNTER,
  46. SSP_BIO_HRM_RAW,
  47. SSP_BIO_HRM_RAW_FAC,
  48. SSP_BIO_HRM_LIB,
  49. SSP_SENSOR_MAX,
  50. };
  51. struct ssp_data;
  52. /**
  53. * struct ssp_sensor_data - Sensor object
  54. * @process_data: Callback to feed sensor data.
  55. * @type: Used sensor type.
  56. * @buffer: Received data buffer.
  57. */
  58. struct ssp_sensor_data {
  59. int (*process_data)(struct iio_dev *indio_dev, void *buf,
  60. int64_t timestamp);
  61. enum ssp_sensor_type type;
  62. u8 *buffer;
  63. };
  64. void ssp_register_consumer(struct iio_dev *indio_dev,
  65. enum ssp_sensor_type type);
  66. int ssp_enable_sensor(struct ssp_data *data, enum ssp_sensor_type type,
  67. u32 delay);
  68. int ssp_disable_sensor(struct ssp_data *data, enum ssp_sensor_type type);
  69. u32 ssp_get_sensor_delay(struct ssp_data *data, enum ssp_sensor_type);
  70. int ssp_change_delay(struct ssp_data *data, enum ssp_sensor_type type,
  71. u32 delay);
  72. #endif /* _SSP_SENSORS_H_ */