1 // SPDX-License-Identifier: GPL-2.0-only
3 #include <linux/regmap.h>
4 #include <linux/iio/iio.h>
5 #include <linux/module.h>
6 #include <linux/mod_devicetable.h>
10 static const struct regmap_config bmg160_regmap_i2c_conf
= {
16 static int bmg160_i2c_probe(struct i2c_client
*client
)
18 const struct i2c_device_id
*id
= i2c_client_get_device_id(client
);
19 struct regmap
*regmap
;
20 const char *name
= NULL
;
22 regmap
= devm_regmap_init_i2c(client
, &bmg160_regmap_i2c_conf
);
24 dev_err(&client
->dev
, "Failed to register i2c regmap: %pe\n",
26 return PTR_ERR(regmap
);
32 return bmg160_core_probe(&client
->dev
, regmap
, client
->irq
, name
);
35 static void bmg160_i2c_remove(struct i2c_client
*client
)
37 bmg160_core_remove(&client
->dev
);
40 static const struct acpi_device_id bmg160_acpi_match
[] = {
47 MODULE_DEVICE_TABLE(acpi
, bmg160_acpi_match
);
49 static const struct i2c_device_id bmg160_i2c_id
[] = {
56 MODULE_DEVICE_TABLE(i2c
, bmg160_i2c_id
);
58 static const struct of_device_id bmg160_of_match
[] = {
59 { .compatible
= "bosch,bmg160" },
60 { .compatible
= "bosch,bmi055_gyro" },
64 MODULE_DEVICE_TABLE(of
, bmg160_of_match
);
66 static struct i2c_driver bmg160_i2c_driver
= {
69 .acpi_match_table
= bmg160_acpi_match
,
70 .of_match_table
= bmg160_of_match
,
73 .probe
= bmg160_i2c_probe
,
74 .remove
= bmg160_i2c_remove
,
75 .id_table
= bmg160_i2c_id
,
77 module_i2c_driver(bmg160_i2c_driver
);
79 MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
80 MODULE_LICENSE("GPL v2");
81 MODULE_DESCRIPTION("BMG160 I2C Gyro driver");