drivers/iio/accel/bmi088-accel-i2c.c
Source file repositories/reference/linux-study-clean/drivers/iio/accel/bmi088-accel-i2c.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/iio/accel/bmi088-accel-i2c.c- Extension
.c- Size
- 1800 bytes
- Lines
- 71
- Domain
- Driver Families
- Bucket
- drivers/iio
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/i2c.hlinux/mod_devicetable.hlinux/module.hlinux/regmap.hlinux/slab.hbmi088-accel.h
Detected Declarations
function bmi088_accel_probefunction bmi088_accel_remove
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* 3-axis accelerometer driver supporting following Bosch-Sensortec chips:
* - BMI088
* - BMI085
* - BMI090L
*
* Copyright 2023 Jun Yan <jerrysteve1101@gmail.com>
*/
#include <linux/i2c.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include "bmi088-accel.h"
static int bmi088_accel_probe(struct i2c_client *i2c)
{
struct regmap *regmap;
const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
regmap = devm_regmap_init_i2c(i2c, &bmi088_regmap_conf);
if (IS_ERR(regmap)) {
dev_err(&i2c->dev, "Failed to initialize i2c regmap\n");
return PTR_ERR(regmap);
}
return bmi088_accel_core_probe(&i2c->dev, regmap, i2c->irq,
id->driver_data);
}
static void bmi088_accel_remove(struct i2c_client *i2c)
{
bmi088_accel_core_remove(&i2c->dev);
}
static const struct of_device_id bmi088_of_match[] = {
{ .compatible = "bosch,bmi085-accel" },
{ .compatible = "bosch,bmi088-accel" },
{ .compatible = "bosch,bmi090l-accel" },
{ }
};
MODULE_DEVICE_TABLE(of, bmi088_of_match);
static const struct i2c_device_id bmi088_accel_id[] = {
{ "bmi085-accel", BOSCH_BMI085 },
{ "bmi088-accel", BOSCH_BMI088 },
{ "bmi090l-accel", BOSCH_BMI090L },
{ }
};
MODULE_DEVICE_TABLE(i2c, bmi088_accel_id);
static struct i2c_driver bmi088_accel_driver = {
.driver = {
.name = "bmi088_accel_i2c",
.pm = pm_ptr(&bmi088_accel_pm_ops),
.of_match_table = bmi088_of_match,
},
.probe = bmi088_accel_probe,
.remove = bmi088_accel_remove,
.id_table = bmi088_accel_id,
};
module_i2c_driver(bmi088_accel_driver);
MODULE_AUTHOR("Jun Yan <jerrysteve1101@gmail.com>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("BMI088 accelerometer driver (I2C)");
MODULE_IMPORT_NS("IIO_BMI088");
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/regmap.h`, `linux/slab.h`, `bmi088-accel.h`.
- Detected declarations: `function bmi088_accel_probe`, `function bmi088_accel_remove`.
- Atlas domain: Driver Families / drivers/iio.
- Implementation status: source 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.