forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/iio/gyro/bmg160_i2c.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 #include <linux/i2c.h>
23 #include <linux/regmap.h>
34 #include <linux/iio/iio.h>
....@@ -20,8 +21,8 @@
2021
2122 regmap = devm_regmap_init_i2c(client, &bmg160_regmap_i2c_conf);
2223 if (IS_ERR(regmap)) {
23
- dev_err(&client->dev, "Failed to register i2c regmap %d\n",
24
- (int)PTR_ERR(regmap));
24
+ dev_err(&client->dev, "Failed to register i2c regmap: %pe\n",
25
+ regmap);
2526 return PTR_ERR(regmap);
2627 }
2728
....@@ -41,6 +42,7 @@
4142 static const struct acpi_device_id bmg160_acpi_match[] = {
4243 {"BMG0160", 0},
4344 {"BMI055B", 0},
45
+ {"BMI088B", 0},
4446 {},
4547 };
4648
....@@ -49,15 +51,25 @@
4951 static const struct i2c_device_id bmg160_i2c_id[] = {
5052 {"bmg160", 0},
5153 {"bmi055_gyro", 0},
54
+ {"bmi088_gyro", 0},
5255 {}
5356 };
5457
5558 MODULE_DEVICE_TABLE(i2c, bmg160_i2c_id);
5659
60
+static const struct of_device_id bmg160_of_match[] = {
61
+ { .compatible = "bosch,bmg160" },
62
+ { .compatible = "bosch,bmi055_gyro" },
63
+ { }
64
+};
65
+
66
+MODULE_DEVICE_TABLE(of, bmg160_of_match);
67
+
5768 static struct i2c_driver bmg160_i2c_driver = {
5869 .driver = {
5970 .name = "bmg160_i2c",
6071 .acpi_match_table = ACPI_PTR(bmg160_acpi_match),
72
+ .of_match_table = bmg160_of_match,
6173 .pm = &bmg160_pm_ops,
6274 },
6375 .probe = bmg160_i2c_probe,