2 * BMI160 - Bosch IMU, I2C bits
4 * Copyright (c) 2016, Intel Corporation.
6 * This file is subject to the terms and conditions of version 2 of
7 * the GNU General Public License. See the file COPYING in the main
8 * directory of this archive for more details.
10 * 7-bit I2C slave address is:
11 * - 0x68 if SDO is pulled to GND
12 * - 0x69 if SDO is pulled to VDDIO
14 #include <linux/module.h>
15 #include <linux/i2c.h>
16 #include <linux/regmap.h>
17 #include <linux/acpi.h>
21 static int bmi160_i2c_probe(struct i2c_client
*client
,
22 const struct i2c_device_id
*id
)
24 struct regmap
*regmap
;
25 const char *name
= NULL
;
27 regmap
= devm_regmap_init_i2c(client
, &bmi160_regmap_config
);
29 dev_err(&client
->dev
, "Failed to register i2c regmap %d\n",
30 (int)PTR_ERR(regmap
));
31 return PTR_ERR(regmap
);
37 return bmi160_core_probe(&client
->dev
, regmap
, name
, false);
40 static int bmi160_i2c_remove(struct i2c_client
*client
)
42 bmi160_core_remove(&client
->dev
);
47 static const struct i2c_device_id bmi160_i2c_id
[] = {
51 MODULE_DEVICE_TABLE(i2c
, bmi160_i2c_id
);
53 static const struct acpi_device_id bmi160_acpi_match
[] = {
57 MODULE_DEVICE_TABLE(acpi
, bmi160_acpi_match
);
59 static struct i2c_driver bmi160_i2c_driver
= {
62 .acpi_match_table
= ACPI_PTR(bmi160_acpi_match
),
64 .probe
= bmi160_i2c_probe
,
65 .remove
= bmi160_i2c_remove
,
66 .id_table
= bmi160_i2c_id
,
68 module_i2c_driver(bmi160_i2c_driver
);
70 MODULE_AUTHOR("Daniel Baluta <daniel.baluta@intel.com>");
71 MODULE_DESCRIPTION("BMI160 I2C driver");
72 MODULE_LICENSE("GPL v2");