This source file includes following definitions.
- tps65912_i2c_probe
- tps65912_i2c_remove
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #include <linux/i2c.h>
21 #include <linux/module.h>
22 #include <linux/regmap.h>
23
24 #include <linux/mfd/tps65912.h>
25
26 static const struct of_device_id tps65912_i2c_of_match_table[] = {
27 { .compatible = "ti,tps65912", },
28 { }
29 };
30 MODULE_DEVICE_TABLE(of, tps65912_i2c_of_match_table);
31
32 static int tps65912_i2c_probe(struct i2c_client *client,
33 const struct i2c_device_id *ids)
34 {
35 struct tps65912 *tps;
36
37 tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
38 if (!tps)
39 return -ENOMEM;
40
41 i2c_set_clientdata(client, tps);
42 tps->dev = &client->dev;
43 tps->irq = client->irq;
44
45 tps->regmap = devm_regmap_init_i2c(client, &tps65912_regmap_config);
46 if (IS_ERR(tps->regmap)) {
47 dev_err(tps->dev, "Failed to initialize register map\n");
48 return PTR_ERR(tps->regmap);
49 }
50
51 return tps65912_device_init(tps);
52 }
53
54 static int tps65912_i2c_remove(struct i2c_client *client)
55 {
56 struct tps65912 *tps = i2c_get_clientdata(client);
57
58 return tps65912_device_exit(tps);
59 }
60
61 static const struct i2c_device_id tps65912_i2c_id_table[] = {
62 { "tps65912", 0 },
63 { }
64 };
65 MODULE_DEVICE_TABLE(i2c, tps65912_i2c_id_table);
66
67 static struct i2c_driver tps65912_i2c_driver = {
68 .driver = {
69 .name = "tps65912",
70 .of_match_table = tps65912_i2c_of_match_table,
71 },
72 .probe = tps65912_i2c_probe,
73 .remove = tps65912_i2c_remove,
74 .id_table = tps65912_i2c_id_table,
75 };
76 module_i2c_driver(tps65912_i2c_driver);
77
78 MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>");
79 MODULE_DESCRIPTION("TPS65912x I2C Interface Driver");
80 MODULE_LICENSE("GPL v2");