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