drivers/iio/chemical/bme680_core.c
Source file repositories/reference/linux-study-clean/drivers/iio/chemical/bme680_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/chemical/bme680_core.c- Extension
.c- Size
- 32502 bytes
- Lines
- 1267
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/cleanup.hlinux/delay.hlinux/device.hlinux/log2.hlinux/module.hlinux/pm.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hlinux/iio/buffer.hlinux/iio/iio.hlinux/iio/sysfs.hlinux/iio/trigger_consumer.hlinux/iio/triggered_buffer.hlinux/unaligned.hbme680.h
Detected Declarations
struct bme680_calibstruct bme680_dataenum bme680_op_modeenum bme680_scanfunction bme680_read_calibfunction bme680_read_temp_adcfunction bme680_calc_t_finefunction bme680_get_t_finefunction bme680_compensate_tempfunction bme680_read_press_adcfunction bme680_compensate_pressfunction bme680_read_humid_adcfunction bme680_compensate_humidfunction bme680_compensate_gasfunction bme680_calc_heater_resfunction bme680_calc_heater_durfunction bme680_calc_heater_preheat_currentfunction bme680_set_modefunction bme680_oversampling_to_regfunction bme680_wait_for_eocfunction bme680_chip_configfunction bme680_preheat_curr_configfunction bme680_gas_configfunction bme680_read_tempfunction bme680_read_pressfunction bme680_read_humidfunction bme680_read_gasfunction __bme680_read_rawfunction bme680_read_rawfunction bme680_is_valid_oversamplingfunction __bme680_write_rawfunction bme680_write_rawfunction bme680_trigger_handlerfunction bme680_buffer_preenablefunction bme680_buffer_postdisablefunction bme680_core_probefunction bme680_runtime_suspendfunction bme680_runtime_resume
Annotated Snippet
struct bme680_calib {
u16 par_t1;
s16 par_t2;
s8 par_t3;
u16 par_p1;
s16 par_p2;
s8 par_p3;
s16 par_p4;
s16 par_p5;
s8 par_p6;
s8 par_p7;
s16 par_p8;
s16 par_p9;
u8 par_p10;
u16 par_h1;
u16 par_h2;
s8 par_h3;
s8 par_h4;
s8 par_h5;
u8 par_h6;
s8 par_h7;
s8 par_gh1;
s16 par_gh2;
s8 par_gh3;
u8 res_heat_range;
s8 res_heat_val;
s8 range_sw_err;
};
/* values of CTRL_MEAS register */
enum bme680_op_mode {
BME680_MODE_SLEEP = 0,
BME680_MODE_FORCED = 1,
};
enum bme680_scan {
BME680_TEMP,
BME680_PRESS,
BME680_HUMID,
BME680_GAS,
};
static const char *const bme680_supply_names[] = { "vdd", "vddio" };
struct bme680_data {
struct regmap *regmap;
struct bme680_calib bme680;
struct mutex lock; /* Protect multiple serial R/W ops to device. */
u8 oversampling_temp;
u8 oversampling_press;
u8 oversampling_humid;
u8 preheat_curr_mA;
u16 heater_dur;
u16 heater_temp;
struct {
s32 chan[4];
aligned_s64 ts;
} scan;
union {
u8 buf[BME680_NUM_BULK_READ_REGS];
unsigned int check;
__be16 be16;
u8 bme680_cal_buf_1[BME680_CALIB_RANGE_1_LEN];
u8 bme680_cal_buf_2[BME680_CALIB_RANGE_2_LEN];
u8 bme680_cal_buf_3[BME680_CALIB_RANGE_3_LEN];
};
};
static const struct regmap_range bme680_volatile_ranges[] = {
regmap_reg_range(BME680_REG_MEAS_STAT_0, BME680_REG_GAS_R_LSB),
regmap_reg_range(BME680_REG_STATUS, BME680_REG_STATUS),
regmap_reg_range(BME680_T2_LSB_REG, BME680_GH3_REG),
};
static const struct regmap_access_table bme680_volatile_table = {
.yes_ranges = bme680_volatile_ranges,
.n_yes_ranges = ARRAY_SIZE(bme680_volatile_ranges),
};
const struct regmap_config bme680_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = 0xef,
.volatile_table = &bme680_volatile_table,
.cache_type = REGCACHE_MAPLE,
};
EXPORT_SYMBOL_NS(bme680_regmap_config, "IIO_BME680");
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/cleanup.h`, `linux/delay.h`, `linux/device.h`, `linux/log2.h`, `linux/module.h`, `linux/pm.h`, `linux/pm_runtime.h`.
- Detected declarations: `struct bme680_calib`, `struct bme680_data`, `enum bme680_op_mode`, `enum bme680_scan`, `function bme680_read_calib`, `function bme680_read_temp_adc`, `function bme680_calc_t_fine`, `function bme680_get_t_fine`, `function bme680_compensate_temp`, `function bme680_read_press_adc`.
- Atlas domain: Driver Families / drivers/iio.
- Implementation status: integration implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.