Lines Matching refs:chg

223 	struct max77693_charger *chg = power_supply_get_drvdata(psy);  in max77693_charger_get_property()  local
224 struct regmap *regmap = chg->max77693->regmap; in max77693_charger_get_property()
268 struct max77693_charger *chg = dev_get_drvdata(dev); in device_attr_store() local
276 ret = fn(chg, val); in device_attr_store()
286 struct max77693_charger *chg = dev_get_drvdata(dev); in fast_charge_timer_show() local
290 ret = regmap_read(chg->max77693->regmap, MAX77693_CHG_REG_CHG_CNFG_01, in fast_charge_timer_show()
311 static int max77693_set_fast_charge_timer(struct max77693_charger *chg, in max77693_set_fast_charge_timer() argument
337 return regmap_update_bits(chg->max77693->regmap, in max77693_set_fast_charge_timer()
352 struct max77693_charger *chg = dev_get_drvdata(dev); in top_off_threshold_current_show() local
356 ret = regmap_read(chg->max77693->regmap, MAX77693_CHG_REG_CHG_CNFG_03, in top_off_threshold_current_show()
372 static int max77693_set_top_off_threshold_current(struct max77693_charger *chg, in max77693_set_top_off_threshold_current() argument
388 return regmap_update_bits(chg->max77693->regmap, in max77693_set_top_off_threshold_current()
403 struct max77693_charger *chg = dev_get_drvdata(dev); in top_off_timer_show() local
407 ret = regmap_read(chg->max77693->regmap, MAX77693_CHG_REG_CHG_CNFG_03, in top_off_timer_show()
420 static int max77693_set_top_off_timer(struct max77693_charger *chg, in max77693_set_top_off_timer() argument
431 return regmap_update_bits(chg->max77693->regmap, in max77693_set_top_off_timer()
447 static int max77693_set_constant_volt(struct max77693_charger *chg, in max77693_set_constant_volt() argument
469 dev_err(chg->dev, "Wrong value for charging constant voltage\n"); in max77693_set_constant_volt()
475 dev_dbg(chg->dev, "Charging constant voltage: %u (0x%x)\n", uvolt, in max77693_set_constant_volt()
478 return regmap_update_bits(chg->max77693->regmap, in max77693_set_constant_volt()
483 static int max77693_set_min_system_volt(struct max77693_charger *chg, in max77693_set_min_system_volt() argument
489 dev_err(chg->dev, "Wrong value for minimum system regulation voltage\n"); in max77693_set_min_system_volt()
497 dev_dbg(chg->dev, "Minimum system regulation voltage: %u (0x%x)\n", in max77693_set_min_system_volt()
500 return regmap_update_bits(chg->max77693->regmap, in max77693_set_min_system_volt()
505 static int max77693_set_thermal_regulation_temp(struct max77693_charger *chg, in max77693_set_thermal_regulation_temp() argument
518 dev_err(chg->dev, "Wrong value for thermal regulation loop temperature\n"); in max77693_set_thermal_regulation_temp()
524 dev_dbg(chg->dev, "Thermal regulation loop temperature: %u (0x%x)\n", in max77693_set_thermal_regulation_temp()
527 return regmap_update_bits(chg->max77693->regmap, in max77693_set_thermal_regulation_temp()
532 static int max77693_set_batttery_overcurrent(struct max77693_charger *chg, in max77693_set_batttery_overcurrent() argument
538 dev_err(chg->dev, "Wrong value for battery overcurrent\n"); in max77693_set_batttery_overcurrent()
549 dev_dbg(chg->dev, "Battery overcurrent: %u (0x%x)\n", uamp, data); in max77693_set_batttery_overcurrent()
551 return regmap_update_bits(chg->max77693->regmap, in max77693_set_batttery_overcurrent()
556 static int max77693_set_charge_input_threshold_volt(struct max77693_charger *chg, in max77693_set_charge_input_threshold_volt() argument
570 dev_err(chg->dev, "Wrong value for charge input voltage regulation threshold\n"); in max77693_set_charge_input_threshold_volt()
576 dev_dbg(chg->dev, "Charge input voltage regulation threshold: %u (0x%x)\n", in max77693_set_charge_input_threshold_volt()
579 return regmap_update_bits(chg->max77693->regmap, in max77693_set_charge_input_threshold_volt()
587 static int max77693_reg_init(struct max77693_charger *chg) in max77693_reg_init() argument
594 ret = regmap_update_bits(chg->max77693->regmap, in max77693_reg_init()
598 dev_err(chg->dev, "Error unlocking registers: %d\n", ret); in max77693_reg_init()
602 ret = max77693_set_fast_charge_timer(chg, DEFAULT_FAST_CHARGE_TIMER); in max77693_reg_init()
606 ret = max77693_set_top_off_threshold_current(chg, in max77693_reg_init()
611 ret = max77693_set_top_off_timer(chg, DEFAULT_TOP_OFF_TIMER); in max77693_reg_init()
615 ret = max77693_set_constant_volt(chg, chg->constant_volt); in max77693_reg_init()
619 ret = max77693_set_min_system_volt(chg, chg->min_system_volt); in max77693_reg_init()
623 ret = max77693_set_thermal_regulation_temp(chg, in max77693_reg_init()
624 chg->thermal_regulation_temp); in max77693_reg_init()
628 ret = max77693_set_batttery_overcurrent(chg, chg->batttery_overcurrent); in max77693_reg_init()
632 return max77693_set_charge_input_threshold_volt(chg, in max77693_reg_init()
633 chg->charge_input_threshold_volt); in max77693_reg_init()
637 static int max77693_dt_init(struct device *dev, struct max77693_charger *chg) in max77693_dt_init() argument
647 &chg->constant_volt)) in max77693_dt_init()
648 chg->constant_volt = DEFAULT_CONSTANT_VOLT; in max77693_dt_init()
651 &chg->min_system_volt)) in max77693_dt_init()
652 chg->min_system_volt = DEFAULT_MIN_SYSTEM_VOLT; in max77693_dt_init()
655 &chg->thermal_regulation_temp)) in max77693_dt_init()
656 chg->thermal_regulation_temp = DEFAULT_THERMAL_REGULATION_TEMP; in max77693_dt_init()
659 &chg->batttery_overcurrent)) in max77693_dt_init()
660 chg->batttery_overcurrent = DEFAULT_BATTERY_OVERCURRENT; in max77693_dt_init()
663 &chg->charge_input_threshold_volt)) in max77693_dt_init()
664 chg->charge_input_threshold_volt = in max77693_dt_init()
670 static int max77693_dt_init(struct device *dev, struct max77693_charger *chg) in max77693_dt_init() argument
678 struct max77693_charger *chg; in max77693_charger_probe() local
683 chg = devm_kzalloc(&pdev->dev, sizeof(*chg), GFP_KERNEL); in max77693_charger_probe()
684 if (!chg) in max77693_charger_probe()
687 platform_set_drvdata(pdev, chg); in max77693_charger_probe()
688 chg->dev = &pdev->dev; in max77693_charger_probe()
689 chg->max77693 = max77693; in max77693_charger_probe()
691 ret = max77693_dt_init(&pdev->dev, chg); in max77693_charger_probe()
695 ret = max77693_reg_init(chg); in max77693_charger_probe()
699 psy_cfg.drv_data = chg; in max77693_charger_probe()
720 chg->charger = power_supply_register(&pdev->dev, in max77693_charger_probe()
723 if (IS_ERR(chg->charger)) { in max77693_charger_probe()
725 ret = PTR_ERR(chg->charger); in max77693_charger_probe()
741 struct max77693_charger *chg = platform_get_drvdata(pdev); in max77693_charger_remove() local
747 power_supply_unregister(chg->charger); in max77693_charger_remove()