16 #include <linux/module.h>
19 #include <linux/slab.h>
21 #include <linux/i2c.h>
33 xfer[0].addr = i2c->
addr;
39 xfer[1].addr = i2c->
addr;
52 static int tps65912_i2c_write(
struct tps65912 *tps65912,
u8 reg,
64 memcpy(&msg[1], src, bytes);
75 static int tps65912_i2c_probe(
struct i2c_client *i2c,
78 struct tps65912 *tps65912;
80 tps65912 = kzalloc(
sizeof(
struct tps65912),
GFP_KERNEL);
84 i2c_set_clientdata(i2c, tps65912);
87 tps65912->
read = tps65912_i2c_read;
88 tps65912->
write = tps65912_i2c_write;
93 static int tps65912_i2c_remove(
struct i2c_client *i2c)
95 struct tps65912 *tps65912 = i2c_get_clientdata(i2c);
108 static struct i2c_driver tps65912_i2c_driver = {
113 .probe = tps65912_i2c_probe,
114 .remove = tps65912_i2c_remove,
115 .id_table = tps65912_i2c_id,
118 static int __init tps65912_i2c_init(
void)
122 ret = i2c_add_driver(&tps65912_i2c_driver);
124 pr_err(
"Failed to register TPS65912 I2C driver: %d\n", ret);
131 static void __exit tps65912_i2c_exit(
void)