Lines Matching +full:normal +full:- +full:power

1 // SPDX-License-Identifier: GPL-2.0+
3 // max77686.c - Regulator driver for the Maxim 77686
21 #include <linux/mfd/max77686-private.h>
43 * Forcing low power mode: LDO1, 3-5, 9, 13, 17-26
48 * - LDO2, 6-8, 10-12, 14-16
49 * - buck[1234]
52 /* Low power mode controlled by PWRREQ: All LDOs */
54 /* Forcing low power mode: buck[234] */
94 * replaces "normal" mode. Any change from low power mode to normal
96 * Map normal mode to proper value for such regulators.
105 if (test_bit(id, max77686->gpio_enabled)) in max77686_map_normal_mode()
112 /* Some BUCKs and LDOs supports Normal[ON/OFF] mode during suspend */
122 ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, in max77686_set_suspend_disable()
123 rdev->desc->enable_mask, val << shift); in max77686_set_suspend_disable()
127 max77686->opmode[id] = val; in max77686_set_suspend_disable()
131 /* Some LDOs supports [LPM/Normal]ON mode during suspend state */
139 /* BUCK[5-9] doesn't support this feature */ in max77686_set_suspend_mode()
147 case REGULATOR_MODE_NORMAL: /* ON in Normal Mode */ in max77686_set_suspend_mode()
152 rdev->desc->name, mode); in max77686_set_suspend_mode()
153 return -EINVAL; in max77686_set_suspend_mode()
156 ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, in max77686_set_suspend_mode()
157 rdev->desc->enable_mask, in max77686_set_suspend_mode()
162 max77686->opmode[id] = val; in max77686_set_suspend_mode()
166 /* Some LDOs supports LPM-ON/OFF/Normal-ON mode during suspend state */
181 case REGULATOR_MODE_NORMAL: /* ON in Normal Mode */ in max77686_ldo_set_suspend_mode()
186 rdev->desc->name, mode); in max77686_ldo_set_suspend_mode()
187 return -EINVAL; in max77686_ldo_set_suspend_mode()
190 ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, in max77686_ldo_set_suspend_mode()
191 rdev->desc->enable_mask, in max77686_ldo_set_suspend_mode()
196 max77686->opmode[id] = val; in max77686_ldo_set_suspend_mode()
208 if (max77686->opmode[id] == MAX77686_OFF_PWRREQ) in max77686_enable()
209 max77686->opmode[id] = max77686_map_normal_mode(max77686, id); in max77686_enable()
211 return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, in max77686_enable()
212 rdev->desc->enable_mask, in max77686_enable()
213 max77686->opmode[id] << shift); in max77686_enable()
220 struct max77686_data *max77686 = config->driver_data; in max77686_of_parse_cb()
223 switch (desc->id) { in max77686_of_parse_cb()
227 config->ena_gpiod = fwnode_gpiod_get_index( in max77686_of_parse_cb()
232 "max77686-regulator"); in max77686_of_parse_cb()
233 if (IS_ERR(config->ena_gpiod)) in max77686_of_parse_cb()
234 config->ena_gpiod = NULL; in max77686_of_parse_cb()
240 if (config->ena_gpiod) { in max77686_of_parse_cb()
241 set_bit(desc->id, max77686->gpio_enabled); in max77686_of_parse_cb()
243 ret = regmap_update_bits(config->regmap, desc->enable_reg, in max77686_of_parse_cb()
244 desc->enable_mask, in max77686_of_parse_cb()
247 gpiod_put(config->ena_gpiod); in max77686_of_parse_cb()
248 config->ena_gpiod = NULL; in max77686_of_parse_cb()
312 .regulators_node = of_match_ptr("voltage-regulators"), \
322 .vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
324 .enable_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
331 .regulators_node = of_match_ptr("voltage-regulators"), \
340 .vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
342 .enable_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
349 .regulators_node = of_match_ptr("voltage-regulators"), \
358 .vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
360 .enable_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
367 .regulators_node = of_match_ptr("voltage-regulators"), \
376 .vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
378 .enable_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
385 .regulators_node = of_match_ptr("voltage-regulators"), \
396 .vsel_reg = MAX77686_REG_BUCK5OUT + (num - 5) * 2, \
398 .enable_reg = MAX77686_REG_BUCK5CTRL + (num - 5) * 2, \
404 .regulators_node = of_match_ptr("voltage-regulators"), \
422 .regulators_node = of_match_ptr("voltage-regulators"), \
432 .vsel_reg = MAX77686_REG_BUCK2DVS1 + (num - 2) * 10, \
434 .enable_reg = MAX77686_REG_BUCK2CTRL1 + (num - 2) * 10, \
437 .ramp_reg = MAX77686_REG_BUCK2CTRL1 + (num - 2) * 10, \
483 struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); in max77686_pmic_probe()
488 dev_dbg(&pdev->dev, "%s\n", __func__); in max77686_pmic_probe()
490 max77686 = devm_kzalloc(&pdev->dev, sizeof(struct max77686_data), in max77686_pmic_probe()
493 return -ENOMEM; in max77686_pmic_probe()
495 max77686->dev = &pdev->dev; in max77686_pmic_probe()
496 config.dev = iodev->dev; in max77686_pmic_probe()
497 config.regmap = iodev->regmap; in max77686_pmic_probe()
505 max77686->opmode[id] = MAX77686_NORMAL; in max77686_pmic_probe()
506 rdev = devm_regulator_register(&pdev->dev, in max77686_pmic_probe()
510 dev_err(&pdev->dev, in max77686_pmic_probe()
520 {"max77686-pmic", 0},
527 .name = "max77686-pmic",