drm/tests: hdmi: Fix memory leaks in drm_display_mode_from_cea_vic()
[drm/drm-misc.git] / drivers / iio / accel / bmi088-accel-i2c.c
blob17e9156bbe89e252b82830d421fe80186096d5ed
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * 3-axis accelerometer driver supporting following Bosch-Sensortec chips:
4 * - BMI088
5 * - BMI085
6 * - BMI090L
8 * Copyright 2023 Jun Yan <jerrysteve1101@gmail.com>
9 */
11 #include <linux/i2c.h>
12 #include <linux/mod_devicetable.h>
13 #include <linux/module.h>
14 #include <linux/regmap.h>
15 #include <linux/slab.h>
17 #include "bmi088-accel.h"
19 static int bmi088_accel_probe(struct i2c_client *i2c)
21 struct regmap *regmap;
22 const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
24 regmap = devm_regmap_init_i2c(i2c, &bmi088_regmap_conf);
25 if (IS_ERR(regmap)) {
26 dev_err(&i2c->dev, "Failed to initialize i2c regmap\n");
27 return PTR_ERR(regmap);
30 return bmi088_accel_core_probe(&i2c->dev, regmap, i2c->irq,
31 id->driver_data);
34 static void bmi088_accel_remove(struct i2c_client *i2c)
36 bmi088_accel_core_remove(&i2c->dev);
39 static const struct of_device_id bmi088_of_match[] = {
40 { .compatible = "bosch,bmi085-accel" },
41 { .compatible = "bosch,bmi088-accel" },
42 { .compatible = "bosch,bmi090l-accel" },
45 MODULE_DEVICE_TABLE(of, bmi088_of_match);
47 static const struct i2c_device_id bmi088_accel_id[] = {
48 { "bmi085-accel", BOSCH_BMI085 },
49 { "bmi088-accel", BOSCH_BMI088 },
50 { "bmi090l-accel", BOSCH_BMI090L },
53 MODULE_DEVICE_TABLE(i2c, bmi088_accel_id);
55 static struct i2c_driver bmi088_accel_driver = {
56 .driver = {
57 .name = "bmi088_accel_i2c",
58 .pm = pm_ptr(&bmi088_accel_pm_ops),
59 .of_match_table = bmi088_of_match,
61 .probe = bmi088_accel_probe,
62 .remove = bmi088_accel_remove,
63 .id_table = bmi088_accel_id,
65 module_i2c_driver(bmi088_accel_driver);
67 MODULE_AUTHOR("Jun Yan <jerrysteve1101@gmail.com>");
68 MODULE_LICENSE("GPL");
69 MODULE_DESCRIPTION("BMI088 accelerometer driver (I2C)");
70 MODULE_IMPORT_NS(IIO_BMI088);