drivers/iio/pressure/bmp280-regmap.c
Source file repositories/reference/linux-study-clean/drivers/iio/pressure/bmp280-regmap.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/pressure/bmp280-regmap.c- Extension
.c- Size
- 5364 bytes
- Lines
- 240
- Domain
- Driver Families
- Bucket
- drivers/iio
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/module.hlinux/regmap.hbmp280.h
Detected Declarations
function bmp180_is_writeable_regfunction bmp180_is_volatile_regfunction bme280_is_writeable_regfunction bmp280_is_writeable_regfunction bmp280_is_volatile_regfunction bme280_is_volatile_regfunction bmp380_is_writeable_regfunction bmp380_is_volatile_regfunction bmp580_is_writeable_regfunction bmp580_is_volatile_reg
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <linux/device.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include "bmp280.h"
static bool bmp180_is_writeable_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case BMP280_REG_CTRL_MEAS:
case BMP280_REG_RESET:
return true;
default:
return false;
}
}
static bool bmp180_is_volatile_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case BMP180_REG_OUT_XLSB:
case BMP180_REG_OUT_LSB:
case BMP180_REG_OUT_MSB:
case BMP280_REG_CTRL_MEAS:
return true;
default:
return false;
}
}
const struct regmap_config bmp180_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = BMP180_REG_OUT_XLSB,
.cache_type = REGCACHE_RBTREE,
.writeable_reg = bmp180_is_writeable_reg,
.volatile_reg = bmp180_is_volatile_reg,
};
EXPORT_SYMBOL_NS(bmp180_regmap_config, "IIO_BMP280");
static bool bme280_is_writeable_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case BMP280_REG_CONFIG:
case BME280_REG_CTRL_HUMIDITY:
case BMP280_REG_CTRL_MEAS:
case BMP280_REG_RESET:
return true;
default:
return false;
}
}
static bool bmp280_is_writeable_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case BMP280_REG_CONFIG:
case BMP280_REG_CTRL_MEAS:
case BMP280_REG_RESET:
return true;
default:
return false;
}
}
static bool bmp280_is_volatile_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case BMP280_REG_TEMP_XLSB:
case BMP280_REG_TEMP_LSB:
case BMP280_REG_TEMP_MSB:
case BMP280_REG_PRESS_XLSB:
case BMP280_REG_PRESS_LSB:
case BMP280_REG_PRESS_MSB:
case BMP280_REG_STATUS:
return true;
default:
return false;
}
}
static bool bme280_is_volatile_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case BME280_REG_HUMIDITY_LSB:
case BME280_REG_HUMIDITY_MSB:
case BMP280_REG_TEMP_XLSB:
Annotation
- Immediate include surface: `linux/device.h`, `linux/module.h`, `linux/regmap.h`, `bmp280.h`.
- Detected declarations: `function bmp180_is_writeable_reg`, `function bmp180_is_volatile_reg`, `function bme280_is_writeable_reg`, `function bmp280_is_writeable_reg`, `function bmp280_is_volatile_reg`, `function bme280_is_volatile_reg`, `function bmp380_is_writeable_reg`, `function bmp380_is_volatile_reg`, `function bmp580_is_writeable_reg`, `function bmp580_is_volatile_reg`.
- Atlas domain: Driver Families / drivers/iio.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.