1 // SPDX-License-Identifier: GPL-2.0
3 * BMI160 - Bosch IMU, I2C bits
5 * Copyright (c) 2016, Intel Corporation.
7 * 7-bit I2C slave address is:
8 * - 0x68 if SDO is pulled to GND
9 * - 0x69 if SDO is pulled to VDDIO
11 #include <linux/i2c.h>
12 #include <linux/mod_devicetable.h>
13 #include <linux/module.h>
14 #include <linux/regmap.h>
18 static int bmi160_i2c_probe(struct i2c_client *client)
20 const struct i2c_device_id *id = i2c_client_get_device_id(client);
21 struct regmap *regmap;
24 regmap = devm_regmap_init_i2c(client, &bmi160_regmap_config);
26 dev_err(&client->dev, "Failed to register i2c regmap: %pe\n",
28 return PTR_ERR(regmap);
34 name = dev_name(&client->dev);
36 return bmi160_core_probe(&client->dev, regmap, name, false);
39 static const struct i2c_device_id bmi160_i2c_id[] = {
43 MODULE_DEVICE_TABLE(i2c, bmi160_i2c_id);
45 static const struct acpi_device_id bmi160_acpi_match[] = {
49 MODULE_DEVICE_TABLE(acpi, bmi160_acpi_match);
51 static const struct of_device_id bmi160_of_match[] = {
52 { .compatible = "bosch,bmi160" },
55 MODULE_DEVICE_TABLE(of, bmi160_of_match);
57 static struct i2c_driver bmi160_i2c_driver = {
60 .acpi_match_table = bmi160_acpi_match,
61 .of_match_table = bmi160_of_match,
63 .probe = bmi160_i2c_probe,
64 .id_table = bmi160_i2c_id,
66 module_i2c_driver(bmi160_i2c_driver);
68 MODULE_AUTHOR("Daniel Baluta <daniel.baluta@intel.com>");
69 MODULE_DESCRIPTION("BMI160 I2C driver");
70 MODULE_LICENSE("GPL v2");
71 MODULE_IMPORT_NS(IIO_BMI160);