Lines Matching +full:max77843 +full:- +full:regulator
1 // SPDX-License-Identifier: GPL-2.0+
3 // MFD core driver for the Maxim MAX77843
14 #include <linux/mfd/max77693-common.h>
15 #include <linux/mfd/max77843-private.h>
21 .name = "max77843-muic",
22 .of_compatible = "maxim,max77843-muic",
24 .name = "max77843-regulator",
25 .of_compatible = "maxim,max77843-regulator",
27 .name = "max77843-charger",
28 .of_compatible = "maxim,max77843-charger"
30 .name = "max77843-fuelgauge",
31 .of_compatible = "maxim,max77843-fuelgauge",
33 .name = "max77843-haptic",
34 .of_compatible = "maxim,max77843-haptic",
59 .name = "max77843",
68 /* Charger and Charger regulator use same regmap. */
69 static int max77843_chg_init(struct max77693_dev *max77843) in max77843_chg_init() argument
73 max77843->i2c_chg = i2c_new_dummy_device(max77843->i2c->adapter, I2C_ADDR_CHG); in max77843_chg_init()
74 if (IS_ERR(max77843->i2c_chg)) { in max77843_chg_init()
75 dev_err(&max77843->i2c->dev, in max77843_chg_init()
77 return PTR_ERR(max77843->i2c_chg); in max77843_chg_init()
79 i2c_set_clientdata(max77843->i2c_chg, max77843); in max77843_chg_init()
81 max77843->regmap_chg = devm_regmap_init_i2c(max77843->i2c_chg, in max77843_chg_init()
83 if (IS_ERR(max77843->regmap_chg)) { in max77843_chg_init()
84 ret = PTR_ERR(max77843->regmap_chg); in max77843_chg_init()
91 i2c_unregister_device(max77843->i2c_chg); in max77843_chg_init()
99 struct max77693_dev *max77843; in max77843_probe() local
103 max77843 = devm_kzalloc(&i2c->dev, sizeof(*max77843), GFP_KERNEL); in max77843_probe()
104 if (!max77843) in max77843_probe()
105 return -ENOMEM; in max77843_probe()
107 i2c_set_clientdata(i2c, max77843); in max77843_probe()
108 max77843->dev = &i2c->dev; in max77843_probe()
109 max77843->i2c = i2c; in max77843_probe()
110 max77843->irq = i2c->irq; in max77843_probe()
111 max77843->type = id->driver_data; in max77843_probe()
113 max77843->regmap = devm_regmap_init_i2c(i2c, in max77843_probe()
115 if (IS_ERR(max77843->regmap)) { in max77843_probe()
116 dev_err(&i2c->dev, "Failed to allocate topsys register map\n"); in max77843_probe()
117 return PTR_ERR(max77843->regmap); in max77843_probe()
120 ret = regmap_add_irq_chip(max77843->regmap, max77843->irq, in max77843_probe()
122 0, &max77843_irq_chip, &max77843->irq_data_topsys); in max77843_probe()
124 dev_err(&i2c->dev, "Failed to add TOPSYS IRQ chip\n"); in max77843_probe()
128 ret = regmap_read(max77843->regmap, in max77843_probe()
131 dev_err(&i2c->dev, "Failed to read PMIC ID\n"); in max77843_probe()
134 dev_info(&i2c->dev, "device ID: 0x%x\n", reg_data); in max77843_probe()
136 ret = max77843_chg_init(max77843); in max77843_probe()
138 dev_err(&i2c->dev, "Failed to init Charger\n"); in max77843_probe()
142 ret = regmap_update_bits(max77843->regmap, in max77843_probe()
147 dev_err(&i2c->dev, "Failed to unmask interrupt source\n"); in max77843_probe()
151 ret = mfd_add_devices(max77843->dev, -1, max77843_devs, in max77843_probe()
154 dev_err(&i2c->dev, "Failed to add mfd device\n"); in max77843_probe()
158 device_init_wakeup(max77843->dev, true); in max77843_probe()
163 regmap_del_irq_chip(max77843->irq, max77843->irq_data_topsys); in max77843_probe()
169 { .compatible = "maxim,max77843", },
174 { "max77843", TYPE_MAX77843, },
181 struct max77693_dev *max77843 = i2c_get_clientdata(i2c); in max77843_suspend() local
183 disable_irq(max77843->irq); in max77843_suspend()
185 enable_irq_wake(max77843->irq); in max77843_suspend()
193 struct max77693_dev *max77843 = i2c_get_clientdata(i2c); in max77843_resume() local
196 disable_irq_wake(max77843->irq); in max77843_resume()
197 enable_irq(max77843->irq); in max77843_resume()
206 .name = "max77843",