Lines Matching +full:charger +full:- +full:disable
1 // SPDX-License-Identifier: GPL-2.0+
3 // max77693.c - Regulator driver for the Maxim 77693 and 77843
5 // Copyright (C) 2013-2015 Samsung Electronics
19 #include <linux/mfd/max77693-common.h>
20 #include <linux/mfd/max77693-private.h>
21 #include <linux/mfd/max77843-private.h>
46 * MAX77693 CHARGER regulator - Min : 20mA, Max : 2580mA, step : 20mA
48 * 0x04 ~ 0x7E = (60 + (X - 3) * 20) mA
58 unsigned int chg_min_uA = rdev->constraints->min_uA; in max77693_chg_get_current_limit()
59 unsigned int chg_max_uA = rdev->constraints->max_uA; in max77693_chg_get_current_limit()
64 ret = regmap_read(rdev->regmap, reg_data->linear_reg, ®); in max77693_chg_get_current_limit()
68 sel = reg & reg_data->linear_mask; in max77693_chg_get_current_limit()
70 /* the first four codes for charger current are all 60mA */ in max77693_chg_get_current_limit()
71 if (sel <= reg_data->min_sel) in max77693_chg_get_current_limit()
74 sel -= reg_data->min_sel; in max77693_chg_get_current_limit()
76 val = chg_min_uA + reg_data->uA_step * sel; in max77693_chg_get_current_limit()
78 return -EINVAL; in max77693_chg_get_current_limit()
87 unsigned int chg_min_uA = rdev->constraints->min_uA; in max77693_chg_set_current_limit()
90 while (chg_min_uA + reg_data->uA_step * sel < min_uA) in max77693_chg_set_current_limit()
93 if (chg_min_uA + reg_data->uA_step * sel > max_uA) in max77693_chg_set_current_limit()
94 return -EINVAL; in max77693_chg_set_current_limit()
96 /* the first four codes for charger current are all 60mA */ in max77693_chg_set_current_limit()
97 sel += reg_data->min_sel; in max77693_chg_set_current_limit()
99 return regmap_write(rdev->regmap, reg_data->linear_reg, sel); in max77693_chg_set_current_limit()
101 /* end of CHARGER regulator ops */
109 return max77693->regmap; in max77693_get_regmap()
115 return max77693->regmap; in max77693_get_regmap()
117 return max77693->regmap_chg; in max77693_get_regmap()
119 return max77693->regmap; in max77693_get_regmap()
134 .disable = regulator_disable_regmap,
142 .disable = regulator_disable_regmap,
167 .name = "CHARGER",
169 .of_match = of_match_ptr("CHARGER"),
208 .name = "CHARGER",
211 .of_match = of_match_ptr("CHARGER"),
230 enum max77693_types type = platform_get_device_id(pdev)->driver_data; in max77693_pmic_probe()
231 struct max77693_dev *iodev = dev_get_drvdata(pdev->dev.parent); in max77693_pmic_probe()
237 config.dev = iodev->dev; in max77693_pmic_probe()
251 dev_err(&pdev->dev, "Unsupported device type: %u\n", type); in max77693_pmic_probe()
252 return -ENODEV; in max77693_pmic_probe()
261 rdev = devm_regulator_register(&pdev->dev, in max77693_pmic_probe()
264 dev_err(&pdev->dev, in max77693_pmic_probe()
265 "Failed to initialize regulator-%d\n", i); in max77693_pmic_probe()
274 { "max77693-pmic", TYPE_MAX77693 },
275 { "max77843-regulator", TYPE_MAX77843 },
283 .name = "max77693-pmic",