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_NS(bmp180_regmap_config, IIO_BMP280);
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 static bool bmp380_is_writeable_reg(struct device *dev, unsigned int reg)
79 case BMP380_REG_CONFIG:
80 case BMP380_REG_FIFO_CONFIG_1:
81 case BMP380_REG_FIFO_CONFIG_2:
82 case BMP380_REG_FIFO_WATERMARK_LSB:
83 case BMP380_REG_FIFO_WATERMARK_MSB:
84 case BMP380_REG_POWER_CONTROL:
85 case BMP380_REG_INT_CONTROL:
86 case BMP380_REG_IF_CONFIG:
95 static bool bmp380_is_volatile_reg(struct device *dev, unsigned int reg)
98 case BMP380_REG_TEMP_XLSB:
99 case BMP380_REG_TEMP_LSB:
100 case BMP380_REG_TEMP_MSB:
101 case BMP380_REG_PRESS_XLSB:
102 case BMP380_REG_PRESS_LSB:
103 case BMP380_REG_PRESS_MSB:
104 case BMP380_REG_SENSOR_TIME_XLSB:
105 case BMP380_REG_SENSOR_TIME_LSB:
106 case BMP380_REG_SENSOR_TIME_MSB:
107 case BMP380_REG_INT_STATUS:
108 case BMP380_REG_FIFO_DATA:
109 case BMP380_REG_STATUS:
110 case BMP380_REG_ERROR:
111 case BMP380_REG_EVENT:
118 static bool bmp580_is_writeable_reg(struct device *dev, unsigned int reg)
121 case BMP580_REG_NVM_DATA_MSB:
122 case BMP580_REG_NVM_DATA_LSB:
123 case BMP580_REG_NVM_ADDR:
124 case BMP580_REG_ODR_CONFIG:
125 case BMP580_REG_OSR_CONFIG:
126 case BMP580_REG_INT_SOURCE:
127 case BMP580_REG_INT_CONFIG:
128 case BMP580_REG_OOR_THR_MSB:
129 case BMP580_REG_OOR_THR_LSB:
130 case BMP580_REG_OOR_CONFIG:
131 case BMP580_REG_OOR_RANGE:
132 case BMP580_REG_IF_CONFIG:
133 case BMP580_REG_FIFO_CONFIG:
134 case BMP580_REG_FIFO_SEL:
135 case BMP580_REG_DSP_CONFIG:
136 case BMP580_REG_DSP_IIR:
144 static bool bmp580_is_volatile_reg(struct device *dev, unsigned int reg)
147 case BMP580_REG_NVM_DATA_MSB:
148 case BMP580_REG_NVM_DATA_LSB:
149 case BMP580_REG_FIFO_COUNT:
150 case BMP580_REG_INT_STATUS:
151 case BMP580_REG_PRESS_XLSB:
152 case BMP580_REG_PRESS_LSB:
153 case BMP580_REG_PRESS_MSB:
154 case BMP580_REG_FIFO_DATA:
155 case BMP580_REG_TEMP_XLSB:
156 case BMP580_REG_TEMP_LSB:
157 case BMP580_REG_TEMP_MSB:
158 case BMP580_REG_EFF_OSR:
159 case BMP580_REG_STATUS:
166 const struct regmap_config bmp280_regmap_config = {
170 .max_register = BMP280_REG_HUMIDITY_LSB,
171 .cache_type = REGCACHE_RBTREE,
173 .writeable_reg = bmp280_is_writeable_reg,
174 .volatile_reg = bmp280_is_volatile_reg,
176 EXPORT_SYMBOL_NS(bmp280_regmap_config, IIO_BMP280);
178 const struct regmap_config bmp380_regmap_config = {
182 .max_register = BMP380_REG_CMD,
183 .cache_type = REGCACHE_RBTREE,
185 .writeable_reg = bmp380_is_writeable_reg,
186 .volatile_reg = bmp380_is_volatile_reg,
188 EXPORT_SYMBOL_NS(bmp380_regmap_config, IIO_BMP280);
190 const struct regmap_config bmp580_regmap_config = {
194 .max_register = BMP580_REG_CMD,
195 .cache_type = REGCACHE_RBTREE,
197 .writeable_reg = bmp580_is_writeable_reg,
198 .volatile_reg = bmp580_is_volatile_reg,
200 EXPORT_SYMBOL_NS(bmp580_regmap_config, IIO_BMP280);