20 #include <linux/kernel.h>
21 #include <linux/module.h>
24 #include <linux/slab.h>
28 #include <linux/i2c.h>
48 dev_err(&client->
dev,
"failed reading at 0x%02x\n", reg);
63 dev_err(&client->
dev,
"failed writing 0x%02x to 0x%02x\n",
70 static int __adp5520_ack_bits(
struct i2c_client *client,
int reg,
79 ret = __adp5520_read(client, reg, ®_val);
83 ret = __adp5520_write(client, reg, reg_val);
110 ret = __adp5520_read(chip->
client, reg, ®_val);
112 if (!ret && ((reg_val & bit_mask) != bit_mask)) {
114 ret = __adp5520_write(chip->
client, reg, reg_val);
130 ret = __adp5520_read(chip->
client, reg, ®_val);
132 if (!ret && (reg_val & bit_mask)) {
133 reg_val &= ~bit_mask;
134 ret = __adp5520_write(chip->
client, reg, reg_val);
201 static int adp5520_remove_subdevs(
struct adp5520_chip *chip)
214 if (!i2c_check_functionality(client->
adapter,
216 dev_err(&client->
dev,
"SMBUS Word Data not Supported\n");
221 dev_err(&client->
dev,
"missing platform data\n");
229 i2c_set_clientdata(client, chip);
234 chip->
id =
id->driver_data;
244 dev_err(&client->
dev,
"failed to request irq %d\n",
257 pdev = platform_device_register_data(chip->
dev,
"adp5520-keys",
261 goto out_remove_subdevs;
266 pdev = platform_device_register_data(chip->
dev,
"adp5520-gpio",
270 goto out_remove_subdevs;
275 pdev = platform_device_register_data(chip->
dev,
"adp5520-led",
279 goto out_remove_subdevs;
284 pdev = platform_device_register_data(chip->
dev,
291 goto out_remove_subdevs;
298 adp5520_remove_subdevs(chip);
317 adp5520_remove_subdevs(chip);
323 #ifdef CONFIG_PM_SLEEP
324 static int adp5520_suspend(
struct device *dev)
333 static int adp5520_resume(
struct device *dev)
358 .probe = adp5520_probe,
360 .id_table = adp5520_id,
363 static int __init adp5520_init(
void)
365 return i2c_add_driver(&adp5520_driver);
369 static void __exit adp5520_exit(
void)