Lines Matching refs:chg

260 	struct max77693_charger *chg = power_supply_get_drvdata(psy);  in max77693_charger_get_property()  local
261 struct regmap *regmap = chg->max77693->regmap; in max77693_charger_get_property()
311 struct max77693_charger *chg = dev_get_drvdata(dev); in device_attr_store() local
319 ret = fn(chg, val); in device_attr_store()
329 struct max77693_charger *chg = dev_get_drvdata(dev); in fast_charge_timer_show() local
333 ret = regmap_read(chg->max77693->regmap, MAX77693_CHG_REG_CHG_CNFG_01, in fast_charge_timer_show()
354 static int max77693_set_fast_charge_timer(struct max77693_charger *chg, in max77693_set_fast_charge_timer() argument
380 return regmap_update_bits(chg->max77693->regmap, in max77693_set_fast_charge_timer()
395 struct max77693_charger *chg = dev_get_drvdata(dev); in top_off_threshold_current_show() local
399 ret = regmap_read(chg->max77693->regmap, MAX77693_CHG_REG_CHG_CNFG_03, in top_off_threshold_current_show()
415 static int max77693_set_top_off_threshold_current(struct max77693_charger *chg, in max77693_set_top_off_threshold_current() argument
431 return regmap_update_bits(chg->max77693->regmap, in max77693_set_top_off_threshold_current()
446 struct max77693_charger *chg = dev_get_drvdata(dev); in top_off_timer_show() local
450 ret = regmap_read(chg->max77693->regmap, MAX77693_CHG_REG_CHG_CNFG_03, in top_off_timer_show()
463 static int max77693_set_top_off_timer(struct max77693_charger *chg, in max77693_set_top_off_timer() argument
474 return regmap_update_bits(chg->max77693->regmap, in max77693_set_top_off_timer()
490 static int max77693_set_constant_volt(struct max77693_charger *chg, in max77693_set_constant_volt() argument
512 dev_err(chg->dev, "Wrong value for charging constant voltage\n"); in max77693_set_constant_volt()
518 dev_dbg(chg->dev, "Charging constant voltage: %u (0x%x)\n", uvolt, in max77693_set_constant_volt()
521 return regmap_update_bits(chg->max77693->regmap, in max77693_set_constant_volt()
526 static int max77693_set_min_system_volt(struct max77693_charger *chg, in max77693_set_min_system_volt() argument
532 dev_err(chg->dev, "Wrong value for minimum system regulation voltage\n"); in max77693_set_min_system_volt()
540 dev_dbg(chg->dev, "Minimum system regulation voltage: %u (0x%x)\n", in max77693_set_min_system_volt()
543 return regmap_update_bits(chg->max77693->regmap, in max77693_set_min_system_volt()
548 static int max77693_set_thermal_regulation_temp(struct max77693_charger *chg, in max77693_set_thermal_regulation_temp() argument
561 dev_err(chg->dev, "Wrong value for thermal regulation loop temperature\n"); in max77693_set_thermal_regulation_temp()
567 dev_dbg(chg->dev, "Thermal regulation loop temperature: %u (0x%x)\n", in max77693_set_thermal_regulation_temp()
570 return regmap_update_bits(chg->max77693->regmap, in max77693_set_thermal_regulation_temp()
575 static int max77693_set_batttery_overcurrent(struct max77693_charger *chg, in max77693_set_batttery_overcurrent() argument
581 dev_err(chg->dev, "Wrong value for battery overcurrent\n"); in max77693_set_batttery_overcurrent()
592 dev_dbg(chg->dev, "Battery overcurrent: %u (0x%x)\n", uamp, data); in max77693_set_batttery_overcurrent()
594 return regmap_update_bits(chg->max77693->regmap, in max77693_set_batttery_overcurrent()
599 static int max77693_set_charge_input_threshold_volt(struct max77693_charger *chg, in max77693_set_charge_input_threshold_volt() argument
614 dev_err(chg->dev, "Wrong value for charge input voltage regulation threshold\n"); in max77693_set_charge_input_threshold_volt()
620 dev_dbg(chg->dev, "Charge input voltage regulation threshold: %u (0x%x)\n", in max77693_set_charge_input_threshold_volt()
623 return regmap_update_bits(chg->max77693->regmap, in max77693_set_charge_input_threshold_volt()
631 static int max77693_reg_init(struct max77693_charger *chg) in max77693_reg_init() argument
638 ret = regmap_update_bits(chg->max77693->regmap, in max77693_reg_init()
642 dev_err(chg->dev, "Error unlocking registers: %d\n", ret); in max77693_reg_init()
646 ret = max77693_set_fast_charge_timer(chg, DEFAULT_FAST_CHARGE_TIMER); in max77693_reg_init()
650 ret = max77693_set_top_off_threshold_current(chg, in max77693_reg_init()
655 ret = max77693_set_top_off_timer(chg, DEFAULT_TOP_OFF_TIMER); in max77693_reg_init()
659 ret = max77693_set_constant_volt(chg, chg->constant_volt); in max77693_reg_init()
663 ret = max77693_set_min_system_volt(chg, chg->min_system_volt); in max77693_reg_init()
667 ret = max77693_set_thermal_regulation_temp(chg, in max77693_reg_init()
668 chg->thermal_regulation_temp); in max77693_reg_init()
672 ret = max77693_set_batttery_overcurrent(chg, chg->batttery_overcurrent); in max77693_reg_init()
676 return max77693_set_charge_input_threshold_volt(chg, in max77693_reg_init()
677 chg->charge_input_threshold_volt); in max77693_reg_init()
681 static int max77693_dt_init(struct device *dev, struct max77693_charger *chg) in max77693_dt_init() argument
691 &chg->constant_volt)) in max77693_dt_init()
692 chg->constant_volt = DEFAULT_CONSTANT_VOLT; in max77693_dt_init()
695 &chg->min_system_volt)) in max77693_dt_init()
696 chg->min_system_volt = DEFAULT_MIN_SYSTEM_VOLT; in max77693_dt_init()
699 &chg->thermal_regulation_temp)) in max77693_dt_init()
700 chg->thermal_regulation_temp = DEFAULT_THERMAL_REGULATION_TEMP; in max77693_dt_init()
703 &chg->batttery_overcurrent)) in max77693_dt_init()
704 chg->batttery_overcurrent = DEFAULT_BATTERY_OVERCURRENT; in max77693_dt_init()
707 &chg->charge_input_threshold_volt)) in max77693_dt_init()
708 chg->charge_input_threshold_volt = in max77693_dt_init()
714 static int max77693_dt_init(struct device *dev, struct max77693_charger *chg) in max77693_dt_init() argument
722 struct max77693_charger *chg; in max77693_charger_probe() local
727 chg = devm_kzalloc(&pdev->dev, sizeof(*chg), GFP_KERNEL); in max77693_charger_probe()
728 if (!chg) in max77693_charger_probe()
731 platform_set_drvdata(pdev, chg); in max77693_charger_probe()
732 chg->dev = &pdev->dev; in max77693_charger_probe()
733 chg->max77693 = max77693; in max77693_charger_probe()
735 ret = max77693_dt_init(&pdev->dev, chg); in max77693_charger_probe()
739 ret = max77693_reg_init(chg); in max77693_charger_probe()
743 psy_cfg.drv_data = chg; in max77693_charger_probe()
764 chg->charger = devm_power_supply_register(&pdev->dev, in max77693_charger_probe()
767 if (IS_ERR(chg->charger)) { in max77693_charger_probe()
769 ret = PTR_ERR(chg->charger); in max77693_charger_probe()