Lines Matching +full:max77650 +full:- +full:charger

1 // SPDX-License-Identifier: GPL-2.0
6 // Battery charger driver for MAXIM 77650/77651 charger/power-supply.
10 #include <linux/mfd/max77650.h>
24 /* Charger is OFF. */
26 /* Charger is in prequalification mode. */
28 /* Charger is in fast-charge constant current mode. */
30 /* Charger is in JEITA modified fast-charge constant-current mode. */
32 /* Charger is in fast-charge constant-voltage mode. */
34 /* Charger is in JEITA modified fast-charge constant-voltage mode. */
36 /* Charger is in top-off mode. */
38 /* Charger is in JEITA modified top-off mode. */
40 /* Charger is done. */
42 /* Charger is JEITA modified done. */
44 /* Charger is suspended due to a prequalification timer fault. */
46 /* Charger is suspended due to a fast-charge timer fault. */
48 /* Charger is suspended due to a battery temperature fault. */
95 rv = regmap_update_bits(chg->map, in max77650_charger_set_vchgin_min()
106 return -EINVAL; in max77650_charger_set_vchgin_min()
116 rv = regmap_update_bits(chg->map, in max77650_charger_set_ichgin_lim()
127 return -EINVAL; in max77650_charger_set_ichgin_lim()
134 rv = regmap_update_bits(chg->map, in max77650_charger_enable()
139 dev_err(chg->dev, "unable to enable the charger: %d\n", rv); in max77650_charger_enable()
148 rv = regmap_update_bits(chg->map, in max77650_charger_disable()
153 dev_err(chg->dev, "unable to disable the charger: %d\n", rv); in max77650_charger_disable()
161 rv = regmap_read(chg->map, MAX77650_REG_STAT_CHG_B, &reg); in max77650_charger_check_status()
163 dev_err(chg->dev, in max77650_charger_check_status()
164 "unable to read the charger status: %d\n", rv); in max77650_charger_check_status()
170 dev_err(chg->dev, "undervoltage lockout detected, disabling charger\n"); in max77650_charger_check_status()
174 dev_err(chg->dev, "overvoltage lockout detected, disabling charger\n"); in max77650_charger_check_status()
181 /* May be 0x10 - debouncing */ in max77650_charger_check_status()
197 rv = regmap_read(chg->map, MAX77650_REG_STAT_CHG_B, &reg); in max77650_charger_get_property()
202 val->intval = POWER_SUPPLY_STATUS_CHARGING; in max77650_charger_get_property()
211 val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; in max77650_charger_get_property()
220 val->intval = POWER_SUPPLY_STATUS_CHARGING; in max77650_charger_get_property()
223 val->intval = POWER_SUPPLY_STATUS_FULL; in max77650_charger_get_property()
226 val->intval = POWER_SUPPLY_STATUS_UNKNOWN; in max77650_charger_get_property()
230 rv = regmap_read(chg->map, MAX77650_REG_STAT_CHG_B, &reg); in max77650_charger_get_property()
234 val->intval = MAX77650_CHARGER_CHG_CHARGING(reg); in max77650_charger_get_property()
237 rv = regmap_read(chg->map, MAX77650_REG_STAT_CHG_B, &reg); in max77650_charger_get_property()
242 val->intval = POWER_SUPPLY_CHARGE_TYPE_NONE; in max77650_charger_get_property()
252 val->intval = POWER_SUPPLY_CHARGE_TYPE_FAST; in max77650_charger_get_property()
256 val->intval = POWER_SUPPLY_CHARGE_TYPE_TRICKLE; in max77650_charger_get_property()
259 val->intval = POWER_SUPPLY_CHARGE_TYPE_UNKNOWN; in max77650_charger_get_property()
263 return -EINVAL; in max77650_charger_get_property()
270 .name = "max77650",
286 dev = &pdev->dev; in max77650_charger_probe()
287 parent = dev->parent; in max77650_charger_probe()
291 return -ENOMEM; in max77650_charger_probe()
295 chg->map = dev_get_regmap(parent, NULL); in max77650_charger_probe()
296 if (!chg->map) in max77650_charger_probe()
297 return -ENODEV; in max77650_charger_probe()
299 chg->dev = dev; in max77650_charger_probe()
301 pscfg.of_node = dev->of_node; in max77650_charger_probe()
329 rv = of_property_read_u32(dev->of_node, in max77650_charger_probe()
330 "input-voltage-min-microvolt", &prop); in max77650_charger_probe()
337 rv = of_property_read_u32(dev->of_node, in max77650_charger_probe()
338 "input-current-limit-microamp", &prop); in max77650_charger_probe()
356 { .compatible = "maxim,max77650-charger" },
363 .name = "max77650-charger",
371 MODULE_DESCRIPTION("MAXIM 77650/77651 charger driver");
374 MODULE_ALIAS("platform:max77650-charger");