mpu.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * Copyright (C) 2012 Invensense, Inc.
  3. *
  4. * This software is licensed under the terms of the GNU General Public
  5. * License version 2, as published by the Free Software Foundation, and
  6. * may be copied, distributed, and modified under those terms.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef __MPU_H_
  14. #define __MPU_H_
  15. #ifdef __KERNEL__
  16. #include <linux/types.h>
  17. #include <linux/ioctl.h>
  18. #endif
  19. enum secondary_slave_type {
  20. SECONDARY_SLAVE_TYPE_NONE,
  21. SECONDARY_SLAVE_TYPE_ACCEL,
  22. SECONDARY_SLAVE_TYPE_COMPASS,
  23. SECONDARY_SLAVE_TYPE_PRESSURE,
  24. SECONDARY_SLAVE_TYPE_TYPES
  25. };
  26. enum ext_slave_id {
  27. ID_INVALID = 0,
  28. GYRO_ID_MPU3050,
  29. GYRO_ID_MPU6050A2,
  30. GYRO_ID_MPU6050B1,
  31. GYRO_ID_MPU6050B1_NO_ACCEL,
  32. GYRO_ID_ITG3500,
  33. ACCEL_ID_LIS331,
  34. ACCEL_ID_LSM303DLX,
  35. ACCEL_ID_LIS3DH,
  36. ACCEL_ID_KXSD9,
  37. ACCEL_ID_KXTF9,
  38. ACCEL_ID_BMA150,
  39. ACCEL_ID_BMA222,
  40. ACCEL_ID_BMA250,
  41. ACCEL_ID_ADXL34X,
  42. ACCEL_ID_MMA8450,
  43. ACCEL_ID_MMA845X,
  44. ACCEL_ID_MPU6050,
  45. COMPASS_ID_AK8963,
  46. COMPASS_ID_AK8975,
  47. COMPASS_ID_AK8972,
  48. COMPASS_ID_AMI30X,
  49. COMPASS_ID_AMI306,
  50. COMPASS_ID_YAS529,
  51. COMPASS_ID_YAS530,
  52. COMPASS_ID_HMC5883,
  53. COMPASS_ID_LSM303DLH,
  54. COMPASS_ID_LSM303DLM,
  55. COMPASS_ID_MMC314X,
  56. COMPASS_ID_HSCDTD002B,
  57. COMPASS_ID_HSCDTD004A,
  58. COMPASS_ID_MLX90399,
  59. COMPASS_ID_AK09911,
  60. PRESSURE_ID_BMP085,
  61. PRESSURE_ID_BMP280,
  62. };
  63. #define INV_PROD_KEY(ver, rev) (ver * 100 + rev)
  64. /**
  65. * struct mpu_platform_data - Platform data for the mpu driver
  66. * @int_config: Bits [7:3] of the int config register.
  67. * @level_shifter: 0: VLogic, 1: VDD
  68. * @orientation: Orientation matrix of the gyroscope
  69. * @sec_slave_type: secondary slave device type, can be compass, accel, etc
  70. * @sec_slave_id: id of the secondary slave device
  71. * @secondary_i2c_address: secondary device's i2c address
  72. * @secondary_orientation: secondary device's orientation matrix
  73. * @key: key for MPL library.
  74. *
  75. * Contains platform specific information on how to configure the MPU3050 to
  76. * work on this platform. The orientation matricies are 3x3 rotation matricies
  77. * that are applied to the data to rotate from the mounting orientation to the
  78. * platform orientation. The values must be one of 0, 1, or -1 and each row and
  79. * column should have exactly 1 non-zero value.
  80. */
  81. struct mpu_platform_data {
  82. __u8 int_config;
  83. __u8 level_shifter;
  84. __s8 orientation[9];
  85. enum secondary_slave_type sec_slave_type;
  86. enum ext_slave_id sec_slave_id;
  87. __u16 secondary_i2c_addr;
  88. __s8 secondary_orientation[9];
  89. __u8 dev_rev;
  90. __u8 key[16];
  91. enum secondary_slave_type aux_slave_type;
  92. enum ext_slave_id aux_slave_id;
  93. __u16 aux_i2c_addr;
  94. short irq;
  95. int mag_rst;
  96. };
  97. #endif /* __MPU_H_ */