This source file includes following definitions.
- bme680_i2c_probe
1
2
3
4
5
6
7
8
9
10
11
12
13
14 #include <linux/acpi.h>
15 #include <linux/i2c.h>
16 #include <linux/module.h>
17 #include <linux/regmap.h>
18
19 #include "bme680.h"
20
21 static int bme680_i2c_probe(struct i2c_client *client,
22 const struct i2c_device_id *id)
23 {
24 struct regmap *regmap;
25 const char *name = NULL;
26
27 regmap = devm_regmap_init_i2c(client, &bme680_regmap_config);
28 if (IS_ERR(regmap)) {
29 dev_err(&client->dev, "Failed to register i2c regmap %d\n",
30 (int)PTR_ERR(regmap));
31 return PTR_ERR(regmap);
32 }
33
34 if (id)
35 name = id->name;
36
37 return bme680_core_probe(&client->dev, regmap, name);
38 }
39
40 static const struct i2c_device_id bme680_i2c_id[] = {
41 {"bme680", 0},
42 {},
43 };
44 MODULE_DEVICE_TABLE(i2c, bme680_i2c_id);
45
46 static const struct acpi_device_id bme680_acpi_match[] = {
47 {"BME0680", 0},
48 {},
49 };
50 MODULE_DEVICE_TABLE(acpi, bme680_acpi_match);
51
52 static const struct of_device_id bme680_of_i2c_match[] = {
53 { .compatible = "bosch,bme680", },
54 {},
55 };
56 MODULE_DEVICE_TABLE(of, bme680_of_i2c_match);
57
58 static struct i2c_driver bme680_i2c_driver = {
59 .driver = {
60 .name = "bme680_i2c",
61 .acpi_match_table = ACPI_PTR(bme680_acpi_match),
62 .of_match_table = bme680_of_i2c_match,
63 },
64 .probe = bme680_i2c_probe,
65 .id_table = bme680_i2c_id,
66 };
67 module_i2c_driver(bme680_i2c_driver);
68
69 MODULE_AUTHOR("Himanshu Jha <himanshujha199640@gmail.com>");
70 MODULE_DESCRIPTION("BME680 I2C driver");
71 MODULE_LICENSE("GPL v2");