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 bme280_is_writeable_reg(struct device
*dev
, unsigned int reg
)
47 case BMP280_REG_CONFIG
:
48 case BME280_REG_CTRL_HUMIDITY
:
49 case BMP280_REG_CTRL_MEAS
:
50 case BMP280_REG_RESET
:
57 static bool bmp280_is_writeable_reg(struct device
*dev
, unsigned int reg
)
60 case BMP280_REG_CONFIG
:
61 case BMP280_REG_CTRL_MEAS
:
62 case BMP280_REG_RESET
:
69 static bool bmp280_is_volatile_reg(struct device
*dev
, unsigned int reg
)
72 case BMP280_REG_TEMP_XLSB
:
73 case BMP280_REG_TEMP_LSB
:
74 case BMP280_REG_TEMP_MSB
:
75 case BMP280_REG_PRESS_XLSB
:
76 case BMP280_REG_PRESS_LSB
:
77 case BMP280_REG_PRESS_MSB
:
78 case BMP280_REG_STATUS
:
85 static bool bme280_is_volatile_reg(struct device
*dev
, unsigned int reg
)
88 case BME280_REG_HUMIDITY_LSB
:
89 case BME280_REG_HUMIDITY_MSB
:
90 case BMP280_REG_TEMP_XLSB
:
91 case BMP280_REG_TEMP_LSB
:
92 case BMP280_REG_TEMP_MSB
:
93 case BMP280_REG_PRESS_XLSB
:
94 case BMP280_REG_PRESS_LSB
:
95 case BMP280_REG_PRESS_MSB
:
96 case BMP280_REG_STATUS
:
102 static bool bmp380_is_writeable_reg(struct device
*dev
, unsigned int reg
)
106 case BMP380_REG_CONFIG
:
107 case BMP380_REG_FIFO_CONFIG_1
:
108 case BMP380_REG_FIFO_CONFIG_2
:
109 case BMP380_REG_FIFO_WATERMARK_LSB
:
110 case BMP380_REG_FIFO_WATERMARK_MSB
:
111 case BMP380_REG_POWER_CONTROL
:
112 case BMP380_REG_INT_CONTROL
:
113 case BMP380_REG_IF_CONFIG
:
122 static bool bmp380_is_volatile_reg(struct device
*dev
, unsigned int reg
)
125 case BMP380_REG_TEMP_XLSB
:
126 case BMP380_REG_TEMP_LSB
:
127 case BMP380_REG_TEMP_MSB
:
128 case BMP380_REG_PRESS_XLSB
:
129 case BMP380_REG_PRESS_LSB
:
130 case BMP380_REG_PRESS_MSB
:
131 case BMP380_REG_SENSOR_TIME_XLSB
:
132 case BMP380_REG_SENSOR_TIME_LSB
:
133 case BMP380_REG_SENSOR_TIME_MSB
:
134 case BMP380_REG_INT_STATUS
:
135 case BMP380_REG_FIFO_DATA
:
136 case BMP380_REG_STATUS
:
137 case BMP380_REG_ERROR
:
138 case BMP380_REG_EVENT
:
145 static bool bmp580_is_writeable_reg(struct device
*dev
, unsigned int reg
)
148 case BMP580_REG_NVM_DATA_MSB
:
149 case BMP580_REG_NVM_DATA_LSB
:
150 case BMP580_REG_NVM_ADDR
:
151 case BMP580_REG_ODR_CONFIG
:
152 case BMP580_REG_OSR_CONFIG
:
153 case BMP580_REG_INT_SOURCE
:
154 case BMP580_REG_INT_CONFIG
:
155 case BMP580_REG_OOR_THR_MSB
:
156 case BMP580_REG_OOR_THR_LSB
:
157 case BMP580_REG_OOR_CONFIG
:
158 case BMP580_REG_OOR_RANGE
:
159 case BMP580_REG_IF_CONFIG
:
160 case BMP580_REG_FIFO_CONFIG
:
161 case BMP580_REG_FIFO_SEL
:
162 case BMP580_REG_DSP_CONFIG
:
163 case BMP580_REG_DSP_IIR
:
171 static bool bmp580_is_volatile_reg(struct device
*dev
, unsigned int reg
)
174 case BMP580_REG_NVM_DATA_MSB
:
175 case BMP580_REG_NVM_DATA_LSB
:
176 case BMP580_REG_FIFO_COUNT
:
177 case BMP580_REG_INT_STATUS
:
178 case BMP580_REG_PRESS_XLSB
:
179 case BMP580_REG_PRESS_LSB
:
180 case BMP580_REG_PRESS_MSB
:
181 case BMP580_REG_FIFO_DATA
:
182 case BMP580_REG_TEMP_XLSB
:
183 case BMP580_REG_TEMP_LSB
:
184 case BMP580_REG_TEMP_MSB
:
185 case BMP580_REG_EFF_OSR
:
186 case BMP580_REG_STATUS
:
193 const struct regmap_config bmp280_regmap_config
= {
197 .max_register
= BMP280_REG_TEMP_XLSB
,
198 .cache_type
= REGCACHE_RBTREE
,
200 .writeable_reg
= bmp280_is_writeable_reg
,
201 .volatile_reg
= bmp280_is_volatile_reg
,
203 EXPORT_SYMBOL_NS(bmp280_regmap_config
, "IIO_BMP280");
205 const struct regmap_config bme280_regmap_config
= {
209 .max_register
= BME280_REG_HUMIDITY_LSB
,
210 .cache_type
= REGCACHE_RBTREE
,
212 .writeable_reg
= bme280_is_writeable_reg
,
213 .volatile_reg
= bme280_is_volatile_reg
,
215 EXPORT_SYMBOL_NS(bme280_regmap_config
, "IIO_BMP280");
217 const struct regmap_config bmp380_regmap_config
= {
221 .max_register
= BMP380_REG_CMD
,
222 .cache_type
= REGCACHE_RBTREE
,
224 .writeable_reg
= bmp380_is_writeable_reg
,
225 .volatile_reg
= bmp380_is_volatile_reg
,
227 EXPORT_SYMBOL_NS(bmp380_regmap_config
, "IIO_BMP280");
229 const struct regmap_config bmp580_regmap_config
= {
233 .max_register
= BMP580_REG_CMD
,
234 .cache_type
= REGCACHE_RBTREE
,
236 .writeable_reg
= bmp580_is_writeable_reg
,
237 .volatile_reg
= bmp580_is_volatile_reg
,
239 EXPORT_SYMBOL_NS(bmp580_regmap_config
, "IIO_BMP280");