Lines Matching +full:max77693 +full:- +full:haptic

1 // SPDX-License-Identifier: GPL-2.0+
3 // max77693.c - mfd core driver for the MAX 77693
21 #include <linux/mfd/max77693.h>
22 #include <linux/mfd/max77693-common.h>
23 #include <linux/mfd/max77693-private.h>
32 { .name = "max77693-pmic", },
34 .name = "max77693-charger",
35 .of_compatible = "maxim,max77693-charger",
38 .name = "max77693-muic",
39 .of_compatible = "maxim,max77693-muic",
42 .name = "max77693-haptic",
43 .of_compatible = "maxim,max77693-haptic",
46 .name = "max77693-led",
47 .of_compatible = "maxim,max77693-led",
66 .name = "max77693-led",
82 .name = "max77693-topsys",
100 .name = "max77693-charger",
137 .name = "max77693-muic",
155 struct max77693_dev *max77693; in max77693_i2c_probe() local
159 max77693 = devm_kzalloc(&i2c->dev, in max77693_i2c_probe()
161 if (max77693 == NULL) in max77693_i2c_probe()
162 return -ENOMEM; in max77693_i2c_probe()
164 i2c_set_clientdata(i2c, max77693); in max77693_i2c_probe()
165 max77693->dev = &i2c->dev; in max77693_i2c_probe()
166 max77693->i2c = i2c; in max77693_i2c_probe()
167 max77693->irq = i2c->irq; in max77693_i2c_probe()
168 max77693->type = id->driver_data; in max77693_i2c_probe()
170 max77693->regmap = devm_regmap_init_i2c(i2c, &max77693_regmap_config); in max77693_i2c_probe()
171 if (IS_ERR(max77693->regmap)) { in max77693_i2c_probe()
172 ret = PTR_ERR(max77693->regmap); in max77693_i2c_probe()
173 dev_err(max77693->dev, "failed to allocate register map: %d\n", in max77693_i2c_probe()
178 ret = regmap_read(max77693->regmap, MAX77693_PMIC_REG_PMIC_ID2, in max77693_i2c_probe()
181 dev_err(max77693->dev, "device not found on this channel\n"); in max77693_i2c_probe()
184 dev_info(max77693->dev, "device ID: 0x%x\n", reg_data); in max77693_i2c_probe()
186 max77693->i2c_muic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_MUIC); in max77693_i2c_probe()
187 if (IS_ERR(max77693->i2c_muic)) { in max77693_i2c_probe()
188 dev_err(max77693->dev, "Failed to allocate I2C device for MUIC\n"); in max77693_i2c_probe()
189 return PTR_ERR(max77693->i2c_muic); in max77693_i2c_probe()
191 i2c_set_clientdata(max77693->i2c_muic, max77693); in max77693_i2c_probe()
193 max77693->i2c_haptic = i2c_new_dummy_device(i2c->adapter, I2C_ADDR_HAPTIC); in max77693_i2c_probe()
194 if (IS_ERR(max77693->i2c_haptic)) { in max77693_i2c_probe()
195 dev_err(max77693->dev, "Failed to allocate I2C device for Haptic\n"); in max77693_i2c_probe()
196 ret = PTR_ERR(max77693->i2c_haptic); in max77693_i2c_probe()
199 i2c_set_clientdata(max77693->i2c_haptic, max77693); in max77693_i2c_probe()
201 max77693->regmap_haptic = devm_regmap_init_i2c(max77693->i2c_haptic, in max77693_i2c_probe()
203 if (IS_ERR(max77693->regmap_haptic)) { in max77693_i2c_probe()
204 ret = PTR_ERR(max77693->regmap_haptic); in max77693_i2c_probe()
205 dev_err(max77693->dev, in max77693_i2c_probe()
206 "failed to initialize haptic register map: %d\n", ret); in max77693_i2c_probe()
211 * Initialize register map for MUIC device because use regmap-muic in max77693_i2c_probe()
212 * instance of MUIC device when irq of max77693 is initialized in max77693_i2c_probe()
213 * before call max77693-muic probe() function. in max77693_i2c_probe()
215 max77693->regmap_muic = devm_regmap_init_i2c(max77693->i2c_muic, in max77693_i2c_probe()
217 if (IS_ERR(max77693->regmap_muic)) { in max77693_i2c_probe()
218 ret = PTR_ERR(max77693->regmap_muic); in max77693_i2c_probe()
219 dev_err(max77693->dev, in max77693_i2c_probe()
224 ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, in max77693_i2c_probe()
227 &max77693->irq_data_led); in max77693_i2c_probe()
229 dev_err(max77693->dev, "failed to add irq chip: %d\n", ret); in max77693_i2c_probe()
233 ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, in max77693_i2c_probe()
236 &max77693->irq_data_topsys); in max77693_i2c_probe()
238 dev_err(max77693->dev, "failed to add irq chip: %d\n", ret); in max77693_i2c_probe()
242 ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, in max77693_i2c_probe()
245 &max77693->irq_data_chg); in max77693_i2c_probe()
247 dev_err(max77693->dev, "failed to add irq chip: %d\n", ret); in max77693_i2c_probe()
251 ret = regmap_add_irq_chip(max77693->regmap_muic, max77693->irq, in max77693_i2c_probe()
254 &max77693->irq_data_muic); in max77693_i2c_probe()
256 dev_err(max77693->dev, "failed to add irq chip: %d\n", ret); in max77693_i2c_probe()
261 ret = regmap_update_bits(max77693->regmap, in max77693_i2c_probe()
265 dev_err(max77693->dev, in max77693_i2c_probe()
271 pm_runtime_set_active(max77693->dev); in max77693_i2c_probe()
273 ret = mfd_add_devices(max77693->dev, -1, max77693_devs, in max77693_i2c_probe()
281 mfd_remove_devices(max77693->dev); in max77693_i2c_probe()
283 regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); in max77693_i2c_probe()
285 regmap_del_irq_chip(max77693->irq, max77693->irq_data_chg); in max77693_i2c_probe()
287 regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys); in max77693_i2c_probe()
289 regmap_del_irq_chip(max77693->irq, max77693->irq_data_led); in max77693_i2c_probe()
291 i2c_unregister_device(max77693->i2c_haptic); in max77693_i2c_probe()
293 i2c_unregister_device(max77693->i2c_muic); in max77693_i2c_probe()
299 struct max77693_dev *max77693 = i2c_get_clientdata(i2c); in max77693_i2c_remove() local
301 mfd_remove_devices(max77693->dev); in max77693_i2c_remove()
303 regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); in max77693_i2c_remove()
304 regmap_del_irq_chip(max77693->irq, max77693->irq_data_chg); in max77693_i2c_remove()
305 regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys); in max77693_i2c_remove()
306 regmap_del_irq_chip(max77693->irq, max77693->irq_data_led); in max77693_i2c_remove()
308 i2c_unregister_device(max77693->i2c_muic); in max77693_i2c_remove()
309 i2c_unregister_device(max77693->i2c_haptic); in max77693_i2c_remove()
313 { "max77693", TYPE_MAX77693 },
321 struct max77693_dev *max77693 = i2c_get_clientdata(i2c); in max77693_suspend() local
324 enable_irq_wake(max77693->irq); in max77693_suspend()
325 disable_irq(max77693->irq); in max77693_suspend()
334 struct max77693_dev *max77693 = i2c_get_clientdata(i2c); in max77693_resume() local
337 disable_irq_wake(max77693->irq); in max77693_resume()
338 enable_irq(max77693->irq); in max77693_resume()
351 { .compatible = "maxim,max77693" },
359 .name = "max77693",
370 MODULE_DESCRIPTION("MAXIM 77693 multi-function core driver");