1 // SPDX-License-Identifier: GPL-2.0
2 #include <linux/device.h>
3 #include <linux/module.h>
4 #include <linux/regmap.h>
8 static bool bmp180_is_writeable_reg(struct device *dev, unsigned int reg)
11 case BMP280_REG_CTRL_MEAS:
12 case BMP280_REG_RESET:
19 static bool bmp180_is_volatile_reg(struct device *dev, unsigned int reg)
22 case BMP180_REG_OUT_XLSB:
23 case BMP180_REG_OUT_LSB:
24 case BMP180_REG_OUT_MSB:
25 case BMP280_REG_CTRL_MEAS:
32 const struct regmap_config bmp180_regmap_config = {
36 .max_register = BMP180_REG_OUT_XLSB,
37 .cache_type = REGCACHE_RBTREE,
39 .writeable_reg = bmp180_is_writeable_reg,
40 .volatile_reg = bmp180_is_volatile_reg,
42 EXPORT_SYMBOL(bmp180_regmap_config);
44 static bool bmp280_is_writeable_reg(struct device *dev, unsigned int reg)
47 case BMP280_REG_CONFIG:
48 case BMP280_REG_CTRL_HUMIDITY:
49 case BMP280_REG_CTRL_MEAS:
50 case BMP280_REG_RESET:
57 static bool bmp280_is_volatile_reg(struct device *dev, unsigned int reg)
60 case BMP280_REG_HUMIDITY_LSB:
61 case BMP280_REG_HUMIDITY_MSB:
62 case BMP280_REG_TEMP_XLSB:
63 case BMP280_REG_TEMP_LSB:
64 case BMP280_REG_TEMP_MSB:
65 case BMP280_REG_PRESS_XLSB:
66 case BMP280_REG_PRESS_LSB:
67 case BMP280_REG_PRESS_MSB:
68 case BMP280_REG_STATUS:
75 const struct regmap_config bmp280_regmap_config = {
79 .max_register = BMP280_REG_HUMIDITY_LSB,
80 .cache_type = REGCACHE_RBTREE,
82 .writeable_reg = bmp280_is_writeable_reg,
83 .volatile_reg = bmp280_is_volatile_reg,
85 EXPORT_SYMBOL(bmp280_regmap_config);