/linux-4.1.27/drivers/mfd/ |
H A D | max14577.c | 2 * max14577.c - mfd core driver for the Maxim 14577/77836 26 #include <linux/mfd/max14577.h> 27 #include <linux/mfd/max14577-private.h> 112 .name = "max14577-muic", 113 .of_compatible = "maxim,max14577-muic", 116 .name = "max14577-regulator", 117 .of_compatible = "maxim,max14577-regulator", 120 .name = "max14577-charger", 121 .of_compatible = "maxim,max14577-charger", 146 .compatible = "maxim,max14577", 169 /* Any max14577 volatile registers are also max77836 volatile. */ max77836_muic_volatile_reg() 220 .name = "max14577", 274 static void max14577_print_dev_type(struct max14577 *max14577) max14577_print_dev_type() argument 279 ret = max14577_read_reg(max14577->regmap, MAX14577_REG_DEVICEID, max14577_print_dev_type() 282 dev_err(max14577->dev, max14577_print_dev_type() 292 dev_info(max14577->dev, "Device type: %u (ID: 0x%x, vendor: 0x%x)\n", max14577_print_dev_type() 293 max14577->dev_type, device_id, vendor_id); max14577_print_dev_type() 305 static int max77836_init(struct max14577 *max14577) max77836_init() argument 310 max14577->i2c_pmic = i2c_new_dummy(max14577->i2c->adapter, max77836_init() 312 if (!max14577->i2c_pmic) { max77836_init() 313 dev_err(max14577->dev, "Failed to register PMIC I2C device\n"); max77836_init() 316 i2c_set_clientdata(max14577->i2c_pmic, max14577); max77836_init() 318 max14577->regmap_pmic = devm_regmap_init_i2c(max14577->i2c_pmic, max77836_init() 320 if (IS_ERR(max14577->regmap_pmic)) { max77836_init() 321 ret = PTR_ERR(max14577->regmap_pmic); max77836_init() 322 dev_err(max14577->dev, "Failed to allocate PMIC register map: %d\n", max77836_init() 328 ret = max14577_read_reg(max14577->regmap_pmic, max77836_init() 331 dev_err(max14577->dev, "Failed to read PMIC register\n"); max77836_init() 337 ret = max14577_write_reg(max14577->regmap_pmic, max77836_init() 340 dev_err(max14577->dev, "Failed to write PMIC register\n"); max77836_init() 344 ret = regmap_add_irq_chip(max14577->regmap_pmic, max14577->irq, max77836_init() 347 &max14577->irq_data_pmic); max77836_init() 349 dev_err(max14577->dev, "Failed to request PMIC IRQ %d: %d\n", max77836_init() 350 max14577->irq, ret); max77836_init() 357 i2c_unregister_device(max14577->i2c_pmic); max77836_init() 365 static void max77836_remove(struct max14577 *max14577) max77836_remove() argument 367 regmap_del_irq_chip(max14577->irq, max14577->irq_data_pmic); max77836_remove() 368 i2c_unregister_device(max14577->i2c_pmic); max77836_remove() 374 struct max14577 *max14577; max14577_i2c_probe() local 395 max14577 = devm_kzalloc(&i2c->dev, sizeof(*max14577), GFP_KERNEL); max14577_i2c_probe() 396 if (!max14577) max14577_i2c_probe() 399 i2c_set_clientdata(i2c, max14577); max14577_i2c_probe() 400 max14577->dev = &i2c->dev; max14577_i2c_probe() 401 max14577->i2c = i2c; max14577_i2c_probe() 402 max14577->irq = i2c->irq; max14577_i2c_probe() 404 max14577->regmap = devm_regmap_init_i2c(i2c, max14577_i2c_probe() 406 if (IS_ERR(max14577->regmap)) { max14577_i2c_probe() 407 ret = PTR_ERR(max14577->regmap); max14577_i2c_probe() 408 dev_err(max14577->dev, "Failed to allocate register map: %d\n", max14577_i2c_probe() 418 max14577->dev_type = max14577_i2c_probe() 421 max14577->dev_type = id->driver_data; max14577_i2c_probe() 424 max14577_print_dev_type(max14577); max14577_i2c_probe() 426 switch (max14577->dev_type) { max14577_i2c_probe() 442 ret = regmap_add_irq_chip(max14577->regmap, max14577->irq, max14577_i2c_probe() 444 &max14577->irq_data); max14577_i2c_probe() 447 max14577->irq, ret); max14577_i2c_probe() 452 if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836) { max14577_i2c_probe() 453 ret = max77836_init(max14577); max14577_i2c_probe() 458 ret = mfd_add_devices(max14577->dev, -1, mfd_devs, max14577_i2c_probe() 463 device_init_wakeup(max14577->dev, 1); max14577_i2c_probe() 468 if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836) max14577_i2c_probe() 469 max77836_remove(max14577); max14577_i2c_probe() 471 regmap_del_irq_chip(max14577->irq, max14577->irq_data); max14577_i2c_probe() 478 struct max14577 *max14577 = i2c_get_clientdata(i2c); max14577_i2c_remove() local 480 mfd_remove_devices(max14577->dev); max14577_i2c_remove() 481 regmap_del_irq_chip(max14577->irq, max14577->irq_data); max14577_i2c_remove() 482 if (max14577->dev_type == MAXIM_DEVICE_TYPE_MAX77836) max14577_i2c_remove() 483 max77836_remove(max14577); max14577_i2c_remove() 489 { "max14577", MAXIM_DEVICE_TYPE_MAX14577, }, 499 struct max14577 *max14577 = i2c_get_clientdata(i2c); max14577_suspend() local 502 enable_irq_wake(max14577->irq); max14577_suspend() 512 disable_irq(max14577->irq); max14577_suspend() 520 struct max14577 *max14577 = i2c_get_clientdata(i2c); max14577_resume() local 523 disable_irq_wake(max14577->irq); max14577_resume() 524 enable_irq(max14577->irq); max14577_resume() 534 .name = "max14577",
|
H A D | Makefile | 117 obj-$(CONFIG_MFD_MAX14577) += max14577.o
|
/linux-4.1.27/drivers/regulator/ |
H A D | max14577.c | 2 * max14577.c - Regulator driver for the Maxim 14577/77836 21 #include <linux/mfd/max14577.h> 22 #include <linux/mfd/max14577-private.h> 50 struct max14577 *max14577 = rdev_get_drvdata(rdev); max14577_reg_get_current_limit() local 52 &maxim_charger_currents[max14577->dev_type]; max14577_reg_get_current_limit() 72 struct max14577 *max14577 = rdev_get_drvdata(rdev); max14577_reg_set_current_limit() local 74 &maxim_charger_currents[max14577->dev_type]; max14577_reg_set_current_limit() 258 static struct regmap *max14577_get_regmap(struct max14577 *max14577, max14577_get_regmap() argument 261 switch (max14577->dev_type) { max14577_get_regmap() 265 return max14577->regmap; max14577_get_regmap() 268 return max14577->regmap_pmic; max14577_get_regmap() 273 return max14577->regmap; max14577_get_regmap() 279 struct max14577 *max14577 = dev_get_drvdata(pdev->dev.parent); max14577_regulator_probe() local 280 struct max14577_platform_data *pdata = dev_get_platdata(max14577->dev); max14577_regulator_probe() 285 enum maxim_device_type dev_type = max14577->dev_type; max14577_regulator_probe() 298 config.dev = max14577->dev; max14577_regulator_probe() 299 config.driver_data = max14577; max14577_regulator_probe() 314 config.regmap = max14577_get_regmap(max14577, max14577_regulator_probe() 332 { "max14577-regulator", MAXIM_DEVICE_TYPE_MAX14577, }, 340 .name = "max14577-regulator", 369 MODULE_ALIAS("platform:max14577-regulator");
|
/linux-4.1.27/drivers/power/ |
H A D | max14577_charger.c | 21 #include <linux/mfd/max14577-private.h> 22 #include <linux/mfd/max14577.h> 26 struct max14577 *max14577; member in struct:max14577_charger 33 * Helper function for mapping values of STATUS2/CHGTYP register on max14577 52 WARN_ONCE(1, "max14577: Unsupported chgtyp register value 0x%02x", val); maxim_get_charger_type() 59 struct regmap *rmap = chg->max14577->regmap; max14577_get_charger_state() 133 struct regmap *rmap = chg->max14577->regmap; max14577_get_online() 143 chg_type = maxim_get_charger_type(chg->max14577->dev_type, reg_data); max14577_get_online() 172 struct regmap *rmap = chg->max14577->regmap; max14577_get_battery_health() 182 chg_type = maxim_get_charger_type(chg->max14577->dev_type, reg_data); max14577_get_battery_health() 206 * The max14577 chip doesn't report any status of battery presence. 236 return max14577_update_reg(chg->max14577->regmap, max14577_set_fast_charge_timer() 267 return max14577_write_reg(chg->max14577->regmap, max14577_init_constant_voltage() 277 switch (chg->max14577->dev_type) { max14577_init_eoc() 306 return max14577_update_reg(chg->max14577->regmap, max14577_init_eoc() 317 &maxim_charger_currents[chg->max14577->dev_type]; max14577_init_fast_charge() 325 return max14577_update_reg(chg->max14577->regmap, max14577_init_fast_charge() 338 struct regmap *rmap = chg->max14577->regmap; max14577_charger_reg_init() 445 val->strval = model_names[chg->max14577->dev_type]; max14577_charger_get_property() 458 .name = "max14577-charger", 526 ret = max14577_read_reg(chg->max14577->regmap, MAX14577_REG_CHGCTRL1, show_fast_charge_timer() 573 struct max14577 *max14577 = dev_get_drvdata(pdev->dev.parent); max14577_charger_probe() local 582 chg->max14577 = max14577; max14577_charger_probe() 630 { "max14577-charger", MAXIM_DEVICE_TYPE_MAX14577, }, 638 .name = "max14577-charger",
|
/linux-4.1.27/drivers/extcon/ |
H A D | extcon-max14577.c | 2 * extcon-max14577.c - MAX14577/77836 extcon driver to support MUIC 24 #include <linux/mfd/max14577.h> 25 #include <linux/mfd/max14577-private.h> 81 struct max14577 *max14577; member in struct:max14577_muic_info 151 /* max14577 MUIC device support below list of accessories(external connector) */ 182 * @info: the instance including private data of max14577 MUIC 195 ret = max14577_update_reg(info->max14577->regmap, max14577_muic_set_debounce_time() 214 * @info: the instance including private data of max14577 MUIC 218 * The max14577 MUIC device share outside H/W line among a varity of cables 229 ret = max14577_update_reg(info->max14577->regmap, max14577_muic_set_path() 242 ret = max14577_update_reg(info->max14577->regmap, max14577_muic_set_path() 255 ret = max14577_update_reg(info->max14577->regmap, max14577_muic_set_path() 272 * @info: the instance including private data of max14577 MUIC 521 ret = max14577_bulk_read(info->max14577->regmap, max14577_muic_irq_work() 577 /* First check common max14577 interrupts */ max77836_parse_irq() 610 switch (info->max14577->dev_type) { max14577_muic_irq_handler() 640 ret = max14577_bulk_read(info->max14577->regmap, max14577_muic_detect_accessory() 685 struct max14577 *max14577 = dev_get_drvdata(pdev->dev.parent); max14577_muic_probe() local 697 info->max14577 = max14577; max14577_muic_probe() 704 switch (max14577->dev_type) { max14577_muic_probe() 715 /* Support irq domain for max14577 MUIC device */ max14577_muic_probe() 720 virq = regmap_irq_get_virq(max14577->irq_data, muic_irq->irq); max14577_muic_probe() 762 ret = max14577_read_reg(info->max14577->regmap, max14577_muic_probe() 798 { "max14577-muic", MAXIM_DEVICE_TYPE_MAX14577, }, 806 .name = "max14577-muic", 818 MODULE_ALIAS("platform:extcon-max14577");
|
/linux-4.1.27/include/linux/mfd/ |
H A D | max14577.h | 2 * max14577.h - Driver for the Maxim 14577/77836 85 * Valid limits of current for max14577 and max77836 chargers.
|
H A D | max14577-private.h | 2 * max14577-private.h - Common API for the Maxim 14577/77836 internal sub chip 76 * Combined charger types for max14577 and max77836. 78 * On max14577 three lower bits map to STATUS2/CHGTYP field. 91 /* max14577: reserved, used on max77836 */ 93 /* max14577: dead-battery charing with maximum current 100mA */ 436 struct max14577 { struct
|