sh_eth: fix EESIPR values for SH77{34|63}
[linux/fpc-iii.git] / drivers / iio / pressure / bmp280-regmap.c
blob6807113ec09f89c8746e47b8f05b54474637ed17
1 #include <linux/device.h>
2 #include <linux/module.h>
3 #include <linux/regmap.h>
5 #include "bmp280.h"
7 static bool bmp180_is_writeable_reg(struct device *dev, unsigned int reg)
9 switch (reg) {
10 case BMP280_REG_CTRL_MEAS:
11 case BMP280_REG_RESET:
12 return true;
13 default:
14 return false;
18 static bool bmp180_is_volatile_reg(struct device *dev, unsigned int reg)
20 switch (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:
25 return true;
26 default:
27 return false;
31 const struct regmap_config bmp180_regmap_config = {
32 .reg_bits = 8,
33 .val_bits = 8,
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)
45 switch (reg) {
46 case BMP280_REG_CONFIG:
47 case BMP280_REG_CTRL_HUMIDITY:
48 case BMP280_REG_CTRL_MEAS:
49 case BMP280_REG_RESET:
50 return true;
51 default:
52 return false;
56 static bool bmp280_is_volatile_reg(struct device *dev, unsigned int reg)
58 switch (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:
68 return true;
69 default:
70 return false;
74 const struct regmap_config bmp280_regmap_config = {
75 .reg_bits = 8,
76 .val_bits = 8,
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);