18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef BME680_H_ 38c2ecf20Sopenharmony_ci#define BME680_H_ 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#define BME680_REG_CHIP_ID 0xD0 68c2ecf20Sopenharmony_ci#define BME680_CHIP_ID_VAL 0x61 78c2ecf20Sopenharmony_ci#define BME680_REG_SOFT_RESET 0xE0 88c2ecf20Sopenharmony_ci#define BME680_CMD_SOFTRESET 0xB6 98c2ecf20Sopenharmony_ci#define BME680_REG_STATUS 0x73 108c2ecf20Sopenharmony_ci#define BME680_SPI_MEM_PAGE_BIT BIT(4) 118c2ecf20Sopenharmony_ci#define BME680_SPI_MEM_PAGE_1_VAL 1 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define BME680_REG_TEMP_MSB 0x22 148c2ecf20Sopenharmony_ci#define BME680_REG_PRESS_MSB 0x1F 158c2ecf20Sopenharmony_ci#define BM6880_REG_HUMIDITY_MSB 0x25 168c2ecf20Sopenharmony_ci#define BME680_REG_GAS_MSB 0x2A 178c2ecf20Sopenharmony_ci#define BME680_REG_GAS_R_LSB 0x2B 188c2ecf20Sopenharmony_ci#define BME680_GAS_STAB_BIT BIT(4) 198c2ecf20Sopenharmony_ci#define BME680_GAS_RANGE_MASK GENMASK(3, 0) 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#define BME680_REG_CTRL_HUMIDITY 0x72 228c2ecf20Sopenharmony_ci#define BME680_OSRS_HUMIDITY_MASK GENMASK(2, 0) 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#define BME680_REG_CTRL_MEAS 0x74 258c2ecf20Sopenharmony_ci#define BME680_OSRS_TEMP_MASK GENMASK(7, 5) 268c2ecf20Sopenharmony_ci#define BME680_OSRS_PRESS_MASK GENMASK(4, 2) 278c2ecf20Sopenharmony_ci#define BME680_MODE_MASK GENMASK(1, 0) 288c2ecf20Sopenharmony_ci#define BME680_MODE_FORCED 1 298c2ecf20Sopenharmony_ci#define BME680_MODE_SLEEP 0 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#define BME680_REG_CONFIG 0x75 328c2ecf20Sopenharmony_ci#define BME680_FILTER_MASK GENMASK(4, 2) 338c2ecf20Sopenharmony_ci#define BME680_FILTER_COEFF_VAL BIT(1) 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci/* TEMP/PRESS/HUMID reading skipped */ 368c2ecf20Sopenharmony_ci#define BME680_MEAS_SKIPPED 0x8000 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#define BME680_MAX_OVERFLOW_VAL 0x40000000 398c2ecf20Sopenharmony_ci#define BME680_HUM_REG_SHIFT_VAL 4 408c2ecf20Sopenharmony_ci#define BME680_BIT_H1_DATA_MASK GENMASK(3, 0) 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define BME680_REG_RES_HEAT_RANGE 0x02 438c2ecf20Sopenharmony_ci#define BME680_RHRANGE_MASK GENMASK(5, 4) 448c2ecf20Sopenharmony_ci#define BME680_REG_RES_HEAT_VAL 0x00 458c2ecf20Sopenharmony_ci#define BME680_REG_RANGE_SW_ERR 0x04 468c2ecf20Sopenharmony_ci#define BME680_RSERROR_MASK GENMASK(7, 4) 478c2ecf20Sopenharmony_ci#define BME680_REG_RES_HEAT_0 0x5A 488c2ecf20Sopenharmony_ci#define BME680_REG_GAS_WAIT_0 0x64 498c2ecf20Sopenharmony_ci#define BME680_ADC_GAS_RES_SHIFT 6 508c2ecf20Sopenharmony_ci#define BME680_AMB_TEMP 25 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#define BME680_REG_CTRL_GAS_1 0x71 538c2ecf20Sopenharmony_ci#define BME680_RUN_GAS_MASK BIT(4) 548c2ecf20Sopenharmony_ci#define BME680_NB_CONV_MASK GENMASK(3, 0) 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#define BME680_REG_MEAS_STAT_0 0x1D 578c2ecf20Sopenharmony_ci#define BME680_GAS_MEAS_BIT BIT(6) 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci/* Calibration Parameters */ 608c2ecf20Sopenharmony_ci#define BME680_T2_LSB_REG 0x8A 618c2ecf20Sopenharmony_ci#define BME680_T3_REG 0x8C 628c2ecf20Sopenharmony_ci#define BME680_P1_LSB_REG 0x8E 638c2ecf20Sopenharmony_ci#define BME680_P2_LSB_REG 0x90 648c2ecf20Sopenharmony_ci#define BME680_P3_REG 0x92 658c2ecf20Sopenharmony_ci#define BME680_P4_LSB_REG 0x94 668c2ecf20Sopenharmony_ci#define BME680_P5_LSB_REG 0x96 678c2ecf20Sopenharmony_ci#define BME680_P7_REG 0x98 688c2ecf20Sopenharmony_ci#define BME680_P6_REG 0x99 698c2ecf20Sopenharmony_ci#define BME680_P8_LSB_REG 0x9C 708c2ecf20Sopenharmony_ci#define BME680_P9_LSB_REG 0x9E 718c2ecf20Sopenharmony_ci#define BME680_P10_REG 0xA0 728c2ecf20Sopenharmony_ci#define BME680_H2_LSB_REG 0xE2 738c2ecf20Sopenharmony_ci#define BME680_H2_MSB_REG 0xE1 748c2ecf20Sopenharmony_ci#define BME680_H1_MSB_REG 0xE3 758c2ecf20Sopenharmony_ci#define BME680_H1_LSB_REG 0xE2 768c2ecf20Sopenharmony_ci#define BME680_H3_REG 0xE4 778c2ecf20Sopenharmony_ci#define BME680_H4_REG 0xE5 788c2ecf20Sopenharmony_ci#define BME680_H5_REG 0xE6 798c2ecf20Sopenharmony_ci#define BME680_H6_REG 0xE7 808c2ecf20Sopenharmony_ci#define BME680_H7_REG 0xE8 818c2ecf20Sopenharmony_ci#define BME680_T1_LSB_REG 0xE9 828c2ecf20Sopenharmony_ci#define BME680_GH2_LSB_REG 0xEB 838c2ecf20Sopenharmony_ci#define BME680_GH1_REG 0xED 848c2ecf20Sopenharmony_ci#define BME680_GH3_REG 0xEE 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ciextern const struct regmap_config bme680_regmap_config; 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ciint bme680_core_probe(struct device *dev, struct regmap *regmap, 898c2ecf20Sopenharmony_ci const char *name); 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci#endif /* BME680_H_ */ 92