18 #include <linux/kernel.h>
19 #include <linux/device.h>
20 #include <linux/module.h>
23 #include <linux/i2c.h>
24 #include <linux/slab.h>
33 static struct mfd_cell tps65217s[] = {
35 .name =
"tps65217-pmic",
38 .name =
"tps65217-bl",
65 unsigned int val,
unsigned int level)
68 unsigned int xor_reg_val;
110 static int tps65217_update_bits(
struct tps65217 *
tps,
unsigned int reg,
111 unsigned int mask,
unsigned int val,
unsigned int level)
118 dev_err(tps->
dev,
"Read from reg 0x%x failed\n", reg);
127 dev_err(tps->
dev,
"Write for reg 0x%x failed\n", reg);
133 unsigned int mask,
unsigned int val,
unsigned int level)
135 return tps65217_update_bits(tps, reg, mask, val, level);
140 unsigned int mask,
unsigned int level)
142 return tps65217_update_bits(tps, reg, mask, 0, level);
146 static struct regmap_config tps65217_regmap_config = {
151 static const struct of_device_id tps65217_of_match[] = {
152 { .compatible =
"ti,tps65217", .data = (
void *)
TPS65217 },
161 unsigned int chip_id = ids->driver_data;
165 if (client->
dev.of_node) {
169 "Failed to find matching dt id\n");
172 chip_id = (
unsigned int)match->
data;
184 i2c_set_clientdata(client, tps);
189 if (IS_ERR(tps->
regmap)) {
190 ret = PTR_ERR(tps->
regmap);
191 dev_err(tps->
dev,
"Failed to allocate register map: %d\n",
199 dev_err(tps->
dev,
"mfd_add_devices failed: %d\n", ret);
205 dev_err(tps->
dev,
"Failed to read revision register: %d\n",
210 dev_info(tps->
dev,
"TPS65217 ID %#x version 1.%d\n",
219 struct tps65217 *tps = i2c_get_clientdata(client);
238 .id_table = tps65217_id_table,
239 .probe = tps65217_probe,
243 static int __init tps65217_init(
void)
245 return i2c_add_driver(&tps65217_driver);
249 static void __exit tps65217_exit(
void)