Lines Matching full:max14577

3 // max14577.c - mfd core driver for the Maxim 14577/77836
16 #include <linux/mfd/max14577.h>
17 #include <linux/mfd/max14577-private.h>
102 .name = "max14577-muic",
103 .of_compatible = "maxim,max14577-muic",
106 .name = "max14577-regulator",
107 .of_compatible = "maxim,max14577-regulator",
110 .name = "max14577-charger",
111 .of_compatible = "maxim,max14577-charger",
136 .compatible = "maxim,max14577",
159 /* Any max14577 volatile registers are also max77836 volatile. */ in max77836_muic_volatile_reg()
210 .name = "max14577",
261 static void max14577_print_dev_type(struct max14577 *max14577) in max14577_print_dev_type() argument
266 ret = max14577_read_reg(max14577->regmap, MAX14577_REG_DEVICEID, in max14577_print_dev_type()
269 dev_err(max14577->dev, in max14577_print_dev_type()
279 dev_info(max14577->dev, "Device type: %u (ID: 0x%x, vendor: 0x%x)\n", in max14577_print_dev_type()
280 max14577->dev_type, device_id, vendor_id); in max14577_print_dev_type()
292 static int max77836_init(struct max14577 *max14577) in max77836_init() argument
297 max14577->i2c_pmic = i2c_new_dummy_device(max14577->i2c->adapter, in max77836_init()
299 if (IS_ERR(max14577->i2c_pmic)) { in max77836_init()
300 dev_err(max14577->dev, "Failed to register PMIC I2C device\n"); in max77836_init()
301 return PTR_ERR(max14577->i2c_pmic); in max77836_init()
303 i2c_set_clientdata(max14577->i2c_pmic, max14577); in max77836_init()
305 max14577->regmap_pmic = devm_regmap_init_i2c(max14577->i2c_pmic, in max77836_init()
307 if (IS_ERR(max14577->regmap_pmic)) { in max77836_init()
308 ret = PTR_ERR(max14577->regmap_pmic); in max77836_init()
309 dev_err(max14577->dev, "Failed to allocate PMIC register map: %d\n", in max77836_init()
315 ret = max14577_read_reg(max14577->regmap_pmic, in max77836_init()
318 dev_err(max14577->dev, "Failed to read PMIC register\n"); in max77836_init()
324 ret = max14577_write_reg(max14577->regmap_pmic, in max77836_init()
327 dev_err(max14577->dev, "Failed to write PMIC register\n"); in max77836_init()
331 ret = regmap_add_irq_chip(max14577->regmap_pmic, max14577->irq, in max77836_init()
334 &max14577->irq_data_pmic); in max77836_init()
336 dev_err(max14577->dev, "Failed to request PMIC IRQ %d: %d\n", in max77836_init()
337 max14577->irq, ret); in max77836_init()
344 i2c_unregister_device(max14577->i2c_pmic); in max77836_init()
352 static void max77836_remove(struct max14577 *max14577) in max77836_remove() argument
354 regmap_del_irq_chip(max14577->irq, max14577->irq_data_pmic); in max77836_remove()
355 i2c_unregister_device(max14577->i2c_pmic); in max77836_remove()
361 struct max14577 *max14577; in max14577_i2c_probe() local
382 max14577 = devm_kzalloc(&i2c->dev, sizeof(*max14577), GFP_KERNEL); in max14577_i2c_probe()
383 if (!max14577) in max14577_i2c_probe()
386 i2c_set_clientdata(i2c, max14577); in max14577_i2c_probe()
387 max14577->dev = &i2c->dev; in max14577_i2c_probe()
388 max14577->i2c = i2c; in max14577_i2c_probe()
389 max14577->irq = i2c->irq; in max14577_i2c_probe()
391 max14577->regmap = devm_regmap_init_i2c(i2c, in max14577_i2c_probe()
393 if (IS_ERR(max14577->regmap)) { in max14577_i2c_probe()
394 ret = PTR_ERR(max14577->regmap); in max14577_i2c_probe()
395 dev_err(max14577->dev, "Failed to allocate register map: %d\n", in max14577_i2c_probe()
405 max14577->dev_type = (uintptr_t)of_id->data; in max14577_i2c_probe()
407 max14577->dev_type = id->driver_data; in max14577_i2c_probe()
410 max14577_print_dev_type(max14577); in max14577_i2c_probe()
412 switch (max14577->dev_type) { in max14577_i2c_probe()
428 ret = regmap_add_irq_chip(max14577->regmap, max14577->irq, in max14577_i2c_probe()
430 &max14577->irq_data); in max14577_i2c_probe()
433 max14577->irq, ret); in max14577_i2c_probe()
438 if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836) { in max14577_i2c_probe()
439 ret = max77836_init(max14577); in max14577_i2c_probe()
444 ret = mfd_add_devices(max14577->dev, -1, mfd_devs, in max14577_i2c_probe()
449 device_init_wakeup(max14577->dev, 1); in max14577_i2c_probe()
454 if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836) in max14577_i2c_probe()
455 max77836_remove(max14577); in max14577_i2c_probe()
457 regmap_del_irq_chip(max14577->irq, max14577->irq_data); in max14577_i2c_probe()
464 struct max14577 *max14577 = i2c_get_clientdata(i2c); in max14577_i2c_remove() local
466 mfd_remove_devices(max14577->dev); in max14577_i2c_remove()
467 regmap_del_irq_chip(max14577->irq, max14577->irq_data); in max14577_i2c_remove()
468 if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836) in max14577_i2c_remove()
469 max77836_remove(max14577); in max14577_i2c_remove()
473 { "max14577", MAXIM_DEVICE_TYPE_MAX14577, },
482 struct max14577 *max14577 = i2c_get_clientdata(i2c); in max14577_suspend() local
485 enable_irq_wake(max14577->irq); in max14577_suspend()
495 disable_irq(max14577->irq); in max14577_suspend()
503 struct max14577 *max14577 = i2c_get_clientdata(i2c); in max14577_resume() local
506 disable_irq_wake(max14577->irq); in max14577_resume()
507 enable_irq(max14577->irq); in max14577_resume()
516 .name = "max14577",