23 #include <linux/module.h>
26 #include <linux/slab.h>
27 #include <linux/i2c.h>
35 #define RTC_I2C_ADDR (0x0c >> 1)
37 static struct mfd_cell max8998_devs[] = {
39 .name =
"max8998-pmic",
41 .name =
"max8998-rtc",
43 .name =
"max8998-battery",
47 static struct mfd_cell lp3974_devs[] = {
49 .name =
"lp3974-pmic",
57 struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
74 struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
89 struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
101 struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
116 struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
122 u8 old_val = ret & 0xff;
123 u8 new_val = (val &
mask) | (old_val & (~mask));
142 i2c_set_clientdata(i2c, max8998);
146 max8998->
type =
id->driver_data;
148 max8998->
ono = pdata->
ono;
155 i2c_set_clientdata(max8998->
rtc, max8998);
159 pm_runtime_set_active(max8998->
dev);
161 switch (id->driver_data) {
191 static int max8998_i2c_remove(
struct i2c_client *i2c)
193 struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
210 static int max8998_suspend(
struct device *
dev)
213 struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
215 if (device_may_wakeup(dev))
220 static int max8998_resume(
struct device *dev)
223 struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
225 if (device_may_wakeup(dev))
239 #define SAVE_ITEM(x) { .addr = (x), .val = 0x0, }
280 static int max8998_freeze(
struct device *dev)
285 for (i = 0; i <
ARRAY_SIZE(max8998_dump); i++)
287 &max8998_dump[i].
val);
293 static int max8998_restore(
struct device *dev)
298 for (i = 0; i <
ARRAY_SIZE(max8998_dump); i++)
300 max8998_dump[i].
val);
306 .suspend = max8998_suspend,
307 .resume = max8998_resume,
308 .freeze = max8998_freeze,
309 .restore = max8998_restore,
312 static struct i2c_driver max8998_i2c_driver = {
318 .probe = max8998_i2c_probe,
319 .remove = max8998_i2c_remove,
320 .id_table = max8998_i2c_id,
323 static int __init max8998_i2c_init(
void)
325 return i2c_add_driver(&max8998_i2c_driver);
330 static void __exit max8998_i2c_exit(
void)