Lines Matching +full:max14577 +full:- +full:regulator

1 // SPDX-License-Identifier: GPL-2.0+
3 // max14577.c - Regulator driver for the Maxim 14577/77836
10 #include <linux/regulator/driver.h>
11 #include <linux/mfd/max14577.h>
12 #include <linux/mfd/max14577-private.h>
13 #include <linux/regulator/of_regulator.h>
18 struct regmap *rmap = rdev->regmap; in max14577_reg_is_enabled()
32 return -EINVAL; in max14577_reg_is_enabled()
39 struct regmap *rmap = rdev->regmap; in max14577_reg_get_current_limit()
40 struct max14577 *max14577 = rdev_get_drvdata(rdev); in max14577_reg_get_current_limit() local
42 &maxim_charger_currents[max14577->dev_type]; in max14577_reg_get_current_limit()
45 return -EINVAL; in max14577_reg_get_current_limit()
50 return limits->min; in max14577_reg_get_current_limit()
54 return limits->high_start + reg_data * limits->high_step; in max14577_reg_get_current_limit()
62 struct max14577 *max14577 = rdev_get_drvdata(rdev); in max14577_reg_set_current_limit() local
64 &maxim_charger_currents[max14577->dev_type]; in max14577_reg_set_current_limit()
67 return -EINVAL; in max14577_reg_set_current_limit()
73 return max14577_update_reg(rdev->regmap, MAX14577_CHG_REG_CHG_CTRL4, in max14577_reg_set_current_limit()
162 * Returns proper regmap for accessing regulator passed by id.
164 static struct regmap *max14577_get_regmap(struct max14577 *max14577, in max14577_get_regmap() argument
167 switch (max14577->dev_type) { in max14577_get_regmap()
171 return max14577->regmap; in max14577_get_regmap()
174 return max14577->regmap_pmic; in max14577_get_regmap()
179 return max14577->regmap; in max14577_get_regmap()
185 struct max14577 *max14577 = dev_get_drvdata(pdev->dev.parent); in max14577_regulator_probe() local
186 struct max14577_platform_data *pdata = dev_get_platdata(max14577->dev); in max14577_regulator_probe()
191 enum maxim_device_type dev_type = max14577->dev_type; in max14577_regulator_probe()
204 config.dev = max14577->dev; in max14577_regulator_probe()
205 config.driver_data = max14577; in max14577_regulator_probe()
208 struct regulator_dev *regulator; in max14577_regulator_probe() local
211 * match index of pdata->regulators[]. in max14577_regulator_probe()
213 if (pdata && pdata->regulators) { in max14577_regulator_probe()
214 config.init_data = pdata->regulators[i].initdata; in max14577_regulator_probe()
215 config.of_node = pdata->regulators[i].of_node; in max14577_regulator_probe()
217 config.regmap = max14577_get_regmap(max14577, in max14577_regulator_probe()
220 regulator = devm_regulator_register(&pdev->dev, in max14577_regulator_probe()
222 if (IS_ERR(regulator)) { in max14577_regulator_probe()
223 ret = PTR_ERR(regulator); in max14577_regulator_probe()
224 dev_err(&pdev->dev, in max14577_regulator_probe()
225 "Regulator init failed for %d/%s with error: %d\n", in max14577_regulator_probe()
235 { "max14577-regulator", MAXIM_DEVICE_TYPE_MAX14577, },
236 { "max77836-regulator", MAXIM_DEVICE_TYPE_MAX77836, },
243 .name = "max14577-regulator",
257 (MAX77836_REGULATOR_LDO_VOLTAGE_STEPS_NUM - 1)) != in max14577_regulator_init()
271 MODULE_DESCRIPTION("Maxim 14577/77836 regulator driver");