26 #include <linux/module.h>
27 #include <linux/slab.h>
28 #include <linux/i2c.h>
39 #define I2C_ADDR_PMIC (0xCC >> 1)
40 #define I2C_ADDR_MUIC (0x4A >> 1)
41 #define I2C_ADDR_HAPTIC (0x90 >> 1)
43 static struct mfd_cell max77693_devs[] = {
44 { .name =
"max77693-pmic", },
45 { .name =
"max77693-charger", },
46 { .name =
"max77693-flash", },
47 { .name =
"max77693-muic", },
48 { .name =
"max77693-haptic", },
103 static const struct regmap_config max77693_regmap_config = {
109 static int max77693_i2c_probe(
struct i2c_client *i2c,
119 if (max77693 ==
NULL)
123 if (IS_ERR(max77693->
regmap)) {
124 ret = PTR_ERR(max77693->
regmap);
125 dev_err(max77693->
dev,
"failed to allocate register map: %d\n",
130 i2c_set_clientdata(i2c, max77693);
131 max77693->
dev = &i2c->
dev;
134 max77693->
type =
id->driver_data;
143 dev_err(max77693->
dev,
"device not found on this channel\n");
147 dev_info(max77693->
dev,
"device ID: 0x%x\n", reg_data);
150 i2c_set_clientdata(max77693->
muic, max77693);
153 i2c_set_clientdata(max77693->
haptic, max77693);
161 &max77693_regmap_config);
165 "failed to allocate register map: %d\n", ret);
173 pm_runtime_set_active(max77693->
dev);
193 static int max77693_i2c_remove(
struct i2c_client *i2c)
195 struct max77693_dev *max77693 = i2c_get_clientdata(i2c);
211 static int max77693_suspend(
struct device *
dev)
214 struct max77693_dev *max77693 = i2c_get_clientdata(i2c);
216 if (device_may_wakeup(dev))
221 static int max77693_resume(
struct device *dev)
224 struct max77693_dev *max77693 = i2c_get_clientdata(i2c);
226 if (device_may_wakeup(dev))
231 static const struct dev_pm_ops max77693_pm = {
232 .suspend = max77693_suspend,
233 .resume = max77693_resume,
236 static struct i2c_driver max77693_i2c_driver = {
242 .probe = max77693_i2c_probe,
243 .remove = max77693_i2c_remove,
244 .id_table = max77693_i2c_id,
247 static int __init max77693_i2c_init(
void)
249 return i2c_add_driver(&max77693_i2c_driver);
254 static void __exit max77693_i2c_exit(
void)