bme680.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef BME680_H_
  3. #define BME680_H_
  4. #define BME680_REG_CHIP_ID 0xD0
  5. #define BME680_CHIP_ID_VAL 0x61
  6. #define BME680_REG_SOFT_RESET 0xE0
  7. #define BME680_CMD_SOFTRESET 0xB6
  8. #define BME680_REG_STATUS 0x73
  9. #define BME680_SPI_MEM_PAGE_BIT BIT(4)
  10. #define BME680_SPI_MEM_PAGE_1_VAL 1
  11. #define BME680_REG_TEMP_MSB 0x22
  12. #define BME680_REG_PRESS_MSB 0x1F
  13. #define BM6880_REG_HUMIDITY_MSB 0x25
  14. #define BME680_REG_GAS_MSB 0x2A
  15. #define BME680_REG_GAS_R_LSB 0x2B
  16. #define BME680_GAS_STAB_BIT BIT(4)
  17. #define BME680_GAS_RANGE_MASK GENMASK(3, 0)
  18. #define BME680_REG_CTRL_HUMIDITY 0x72
  19. #define BME680_OSRS_HUMIDITY_MASK GENMASK(2, 0)
  20. #define BME680_REG_CTRL_MEAS 0x74
  21. #define BME680_OSRS_TEMP_MASK GENMASK(7, 5)
  22. #define BME680_OSRS_PRESS_MASK GENMASK(4, 2)
  23. #define BME680_MODE_MASK GENMASK(1, 0)
  24. #define BME680_MODE_FORCED 1
  25. #define BME680_MODE_SLEEP 0
  26. #define BME680_REG_CONFIG 0x75
  27. #define BME680_FILTER_MASK GENMASK(4, 2)
  28. #define BME680_FILTER_COEFF_VAL BIT(1)
  29. /* TEMP/PRESS/HUMID reading skipped */
  30. #define BME680_MEAS_SKIPPED 0x8000
  31. #define BME680_MAX_OVERFLOW_VAL 0x40000000
  32. #define BME680_HUM_REG_SHIFT_VAL 4
  33. #define BME680_BIT_H1_DATA_MASK GENMASK(3, 0)
  34. #define BME680_REG_RES_HEAT_RANGE 0x02
  35. #define BME680_RHRANGE_MASK GENMASK(5, 4)
  36. #define BME680_REG_RES_HEAT_VAL 0x00
  37. #define BME680_REG_RANGE_SW_ERR 0x04
  38. #define BME680_RSERROR_MASK GENMASK(7, 4)
  39. #define BME680_REG_RES_HEAT_0 0x5A
  40. #define BME680_REG_GAS_WAIT_0 0x64
  41. #define BME680_ADC_GAS_RES_SHIFT 6
  42. #define BME680_AMB_TEMP 25
  43. #define BME680_REG_CTRL_GAS_1 0x71
  44. #define BME680_RUN_GAS_MASK BIT(4)
  45. #define BME680_NB_CONV_MASK GENMASK(3, 0)
  46. #define BME680_REG_MEAS_STAT_0 0x1D
  47. #define BME680_GAS_MEAS_BIT BIT(6)
  48. /* Calibration Parameters */
  49. #define BME680_T2_LSB_REG 0x8A
  50. #define BME680_T3_REG 0x8C
  51. #define BME680_P1_LSB_REG 0x8E
  52. #define BME680_P2_LSB_REG 0x90
  53. #define BME680_P3_REG 0x92
  54. #define BME680_P4_LSB_REG 0x94
  55. #define BME680_P5_LSB_REG 0x96
  56. #define BME680_P7_REG 0x98
  57. #define BME680_P6_REG 0x99
  58. #define BME680_P8_LSB_REG 0x9C
  59. #define BME680_P9_LSB_REG 0x9E
  60. #define BME680_P10_REG 0xA0
  61. #define BME680_H2_LSB_REG 0xE2
  62. #define BME680_H2_MSB_REG 0xE1
  63. #define BME680_H1_MSB_REG 0xE3
  64. #define BME680_H1_LSB_REG 0xE2
  65. #define BME680_H3_REG 0xE4
  66. #define BME680_H4_REG 0xE5
  67. #define BME680_H5_REG 0xE6
  68. #define BME680_H6_REG 0xE7
  69. #define BME680_H7_REG 0xE8
  70. #define BME680_T1_LSB_REG 0xE9
  71. #define BME680_GH2_LSB_REG 0xEB
  72. #define BME680_GH1_REG 0xED
  73. #define BME680_GH3_REG 0xEE
  74. extern const struct regmap_config bme680_regmap_config;
  75. int bme680_core_probe(struct device *dev, struct regmap *regmap,
  76. const char *name);
  77. #endif /* BME680_H_ */