Lines Matching +full:semi +full:- +full:static

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Voltage regulation driver for active-semi ACT8945A PMIC
16 #include <dt-bindings/regulator/active-semi,8945a-regulator.h>
52 #define ACT8945A_ENA 0x80 /* ON - [7] */
53 #define ACT8945A_VSEL_MASK 0x3F /* VSET - [5:0] */
76 static const struct linear_range act8945a_voltage_ranges[] = {
82 static int act8945a_set_suspend_state(struct regulator_dev *rdev, bool enable) in act8945a_set_suspend_state()
84 struct regmap *regmap = rdev->regmap; in act8945a_set_suspend_state()
118 return -EINVAL; in act8945a_set_suspend_state()
131 static int act8945a_set_suspend_enable(struct regulator_dev *rdev) in act8945a_set_suspend_enable()
136 static int act8945a_set_suspend_disable(struct regulator_dev *rdev) in act8945a_set_suspend_disable()
141 static unsigned int act8945a_of_map_mode(unsigned int mode) in act8945a_of_map_mode()
154 static int act8945a_set_mode(struct regulator_dev *rdev, unsigned int mode) in act8945a_set_mode()
157 struct regmap *regmap = rdev->regmap; in act8945a_set_mode()
184 return -EINVAL; in act8945a_set_mode()
197 return -EINVAL; in act8945a_set_mode()
204 act8945a->op_mode[id] = mode; in act8945a_set_mode()
209 static unsigned int act8945a_get_mode(struct regulator_dev *rdev) in act8945a_get_mode()
215 return -EINVAL; in act8945a_get_mode()
217 return act8945a->op_mode[id]; in act8945a_get_mode()
220 static const struct regulator_ops act8945a_ops = {
254 static const struct regulator_desc act8945a_regulators[] = {
264 static const struct regulator_desc act8945a_alt_regulators[] = {
274 static int act8945a_pmic_probe(struct platform_device *pdev) in act8945a_pmic_probe()
283 act8945a = devm_kzalloc(&pdev->dev, sizeof(*act8945a), GFP_KERNEL); in act8945a_pmic_probe()
285 return -ENOMEM; in act8945a_pmic_probe()
287 act8945a->regmap = dev_get_regmap(pdev->dev.parent, NULL); in act8945a_pmic_probe()
288 if (!act8945a->regmap) { in act8945a_pmic_probe()
289 dev_err(&pdev->dev, in act8945a_pmic_probe()
291 return -EINVAL; in act8945a_pmic_probe()
294 voltage_select = of_property_read_bool(pdev->dev.parent->of_node, in act8945a_pmic_probe()
295 "active-semi,vsel-high"); in act8945a_pmic_probe()
305 config.dev = &pdev->dev; in act8945a_pmic_probe()
306 config.dev->of_node = pdev->dev.parent->of_node; in act8945a_pmic_probe()
309 rdev = devm_regulator_register(&pdev->dev, &regulators[i], in act8945a_pmic_probe()
312 dev_err(&pdev->dev, in act8945a_pmic_probe()
322 return regmap_write(act8945a->regmap, ACT8945A_SYS_UNLK_REGS, 0xef); in act8945a_pmic_probe()
325 static int __maybe_unused act8945a_suspend(struct device *pdev) in act8945a_suspend()
333 return regmap_write(act8945a->regmap, ACT8945A_SYS_CTRL, 0x42); in act8945a_suspend()
336 static SIMPLE_DEV_PM_OPS(act8945a_pm, act8945a_suspend, NULL);
338 static void act8945a_pmic_shutdown(struct platform_device *pdev) in act8945a_pmic_shutdown()
345 regmap_write(act8945a->regmap, ACT8945A_SYS_CTRL, 0x0); in act8945a_pmic_shutdown()
348 static struct platform_driver act8945a_pmic_driver = {
350 .name = "act8945a-regulator",
359 MODULE_DESCRIPTION("Active-semi ACT8945A voltage regulator driver");