drivers/iio/pressure/bmp280-core.c
Source file repositories/reference/linux-study-clean/drivers/iio/pressure/bmp280-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/pressure/bmp280-core.c- Extension
.c- Size
- 90197 bytes
- Lines
- 3344
- 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/bitops.hlinux/bitfield.hlinux/cleanup.hlinux/completion.hlinux/delay.hlinux/device.hlinux/gpio/consumer.hlinux/interrupt.hlinux/irq.hlinux/module.hlinux/nvmem-provider.hlinux/pm_runtime.hlinux/property.hlinux/random.hlinux/regmap.hlinux/regulator/consumer.hlinux/types.hlinux/iio/buffer.hlinux/iio/iio.hlinux/iio/trigger.hlinux/iio/trigger_consumer.hlinux/iio/triggered_buffer.hlinux/unaligned.hbmp280.h
Detected Declarations
enum bmp380_odrenum bmp580_odrenum bmp280_scanfunction bmp280_read_calibfunction bme280_read_calibfunction bme280_read_humid_adcfunction bme280_compensate_humidityfunction bmp280_read_temp_adcfunction bmp280_calc_t_finefunction bmp280_get_t_finefunction bmp280_compensate_tempfunction bmp280_read_press_adcfunction bmp280_compensate_pressfunction bmp280_read_tempfunction bmp280_read_pressfunction bme280_read_humidfunction bmp280_read_raw_implfunction bmp280_read_rawfunction bme280_write_oversampling_ratio_humidfunction bmp280_write_oversampling_ratio_tempfunction bmp280_write_oversampling_ratio_pressfunction bmp280_write_sampling_frequencyfunction bmp280_write_iir_filter_coeffsfunction bmp280_write_raw_implfunction bmp280_write_rawfunction bmp280_read_availfunction bmp280_preinitfunction bmp280_set_modefunction bmp280_wait_convfunction bmp280_chip_configfunction bmp280_trigger_handlerfunction bme280_chip_configfunction bme280_trigger_handlerfunction __bmp280_trigger_probefunction bmp380_cmdfunction bmp380_read_temp_adcfunction bmp380_calc_t_finefunction bmp380_get_t_finefunction bmp380_compensate_tempfunction bmp380_read_press_adcfunction bmp380_compensate_pressfunction bmp380_read_tempfunction bmp380_read_pressfunction bmp380_read_calibfunction bmp380_preinitfunction bmp380_set_modefunction bmp380_wait_convfunction bmp380_chip_config
Annotated Snippet
switch (chan->type) {
case IIO_HUMIDITYRELATIVE:
ret = data->chip_info->read_humid(data, &chan_value);
if (ret)
return ret;
*val = data->chip_info->humid_coeffs[0] * chan_value;
*val2 = data->chip_info->humid_coeffs[1];
return data->chip_info->humid_coeffs_type;
case IIO_PRESSURE:
ret = data->chip_info->read_press(data, &chan_value);
if (ret)
return ret;
*val = data->chip_info->press_coeffs[0] * chan_value;
*val2 = data->chip_info->press_coeffs[1];
return data->chip_info->press_coeffs_type;
case IIO_TEMP:
ret = data->chip_info->read_temp(data, &chan_value);
if (ret)
return ret;
*val = data->chip_info->temp_coeffs[0] * chan_value;
*val2 = data->chip_info->temp_coeffs[1];
return data->chip_info->temp_coeffs_type;
default:
return -EINVAL;
}
case IIO_CHAN_INFO_RAW:
ret = data->chip_info->set_mode(data, BMP280_FORCED);
if (ret)
return ret;
ret = data->chip_info->wait_conv(data);
if (ret)
return ret;
switch (chan->type) {
case IIO_HUMIDITYRELATIVE:
ret = data->chip_info->read_humid(data, &chan_value);
if (ret)
return ret;
*val = chan_value;
return IIO_VAL_INT;
case IIO_PRESSURE:
ret = data->chip_info->read_press(data, &chan_value);
if (ret)
return ret;
*val = chan_value;
return IIO_VAL_INT;
case IIO_TEMP:
ret = data->chip_info->read_temp(data, &chan_value);
if (ret)
return ret;
*val = chan_value;
return IIO_VAL_INT;
default:
return -EINVAL;
}
case IIO_CHAN_INFO_SCALE:
switch (chan->type) {
case IIO_HUMIDITYRELATIVE:
*val = data->chip_info->humid_coeffs[0];
*val2 = data->chip_info->humid_coeffs[1];
return data->chip_info->humid_coeffs_type;
case IIO_PRESSURE:
*val = data->chip_info->press_coeffs[0];
*val2 = data->chip_info->press_coeffs[1];
return data->chip_info->press_coeffs_type;
case IIO_TEMP:
*val = data->chip_info->temp_coeffs[0];
*val2 = data->chip_info->temp_coeffs[1];
return data->chip_info->temp_coeffs_type;
default:
return -EINVAL;
}
case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
switch (chan->type) {
case IIO_HUMIDITYRELATIVE:
*val = 1 << data->oversampling_humid;
return IIO_VAL_INT;
case IIO_PRESSURE:
*val = 1 << data->oversampling_press;
return IIO_VAL_INT;
case IIO_TEMP:
*val = 1 << data->oversampling_temp;
return IIO_VAL_INT;
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/bitfield.h`, `linux/cleanup.h`, `linux/completion.h`, `linux/delay.h`, `linux/device.h`, `linux/gpio/consumer.h`, `linux/interrupt.h`.
- Detected declarations: `enum bmp380_odr`, `enum bmp580_odr`, `enum bmp280_scan`, `function bmp280_read_calib`, `function bme280_read_calib`, `function bme280_read_humid_adc`, `function bme280_compensate_humidity`, `function bmp280_read_temp_adc`, `function bmp280_calc_t_fine`, `function bmp280_get_t_fine`.
- 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.