1 #include <linux/device.h>
2 #include <linux/module.h>
3 #include <linux/regmap.h>
7 static bool bmp180_is_writeable_reg(struct device *dev, unsigned int reg)
10 case BMP280_REG_CTRL_MEAS:
11 case BMP280_REG_RESET:
18 static bool bmp180_is_volatile_reg(struct device *dev, unsigned int reg)
21 case BMP180_REG_OUT_XLSB:
22 case BMP180_REG_OUT_LSB:
23 case BMP180_REG_OUT_MSB:
24 case BMP280_REG_CTRL_MEAS:
31 const struct regmap_config bmp180_regmap_config = {
35 .max_register = BMP180_REG_OUT_XLSB,
36 .cache_type = REGCACHE_RBTREE,
38 .writeable_reg = bmp180_is_writeable_reg,
39 .volatile_reg = bmp180_is_volatile_reg,
41 EXPORT_SYMBOL(bmp180_regmap_config);
43 static bool bmp280_is_writeable_reg(struct device *dev, unsigned int reg)
46 case BMP280_REG_CONFIG:
47 case BMP280_REG_CTRL_HUMIDITY:
48 case BMP280_REG_CTRL_MEAS:
49 case BMP280_REG_RESET:
56 static bool bmp280_is_volatile_reg(struct device *dev, unsigned int reg)
59 case BMP280_REG_HUMIDITY_LSB:
60 case BMP280_REG_HUMIDITY_MSB:
61 case BMP280_REG_TEMP_XLSB:
62 case BMP280_REG_TEMP_LSB:
63 case BMP280_REG_TEMP_MSB:
64 case BMP280_REG_PRESS_XLSB:
65 case BMP280_REG_PRESS_LSB:
66 case BMP280_REG_PRESS_MSB:
67 case BMP280_REG_STATUS:
74 const struct regmap_config bmp280_regmap_config = {
78 .max_register = BMP280_REG_HUMIDITY_LSB,
79 .cache_type = REGCACHE_RBTREE,
81 .writeable_reg = bmp280_is_writeable_reg,
82 .volatile_reg = bmp280_is_volatile_reg,
84 EXPORT_SYMBOL(bmp280_regmap_config);