Lines Matching +full:pmic +full:- +full:specific
1 // SPDX-License-Identifier: GPL-2.0
3 // MCP16502 PMIC driver
9 // Inspired from tps65086-regulator.c
29 * The PMIC has four sets of registers corresponding to four power modes:
30 * Performance, Active, Low-power, Hibernate.
34 * for a specific regulator and mode BASE_* and OFFSET_* need to be added.
37 * In order for the PMIC to transition to operating modes it has to be
41 * a low-power state while the PMIC is in Active mode. They are supposed to be
42 * configured at startup and then simply transition to/from a global low-power
45 * This driver keeps the PMIC in Active mode, Low-power state is set for the
48 * The PMIC's Low-power and Hibernate modes are used during standby/suspend.
49 * To enter standby/suspend the PMIC will go to Low-power mode. From there, it
116 * struct mcp16502 - PMIC representation
126 * mcp16502_gpio_set_mode() - set the GPIO corresponding value
134 gpiod_set_value(mcp->lpm, 0); in mcp16502_gpio_set_mode()
138 gpiod_set_value(mcp->lpm, 1); in mcp16502_gpio_set_mode()
146 * mcp16502_get_reg() - get the PMIC's configuration register for opmode
149 * @opmode: the PMIC's operating mode ACTIVE, Low-power, Hibernate
163 return -EINVAL; in mcp16502_get_reg()
168 * mcp16502_get_mode() - return the current operating mode of a regulator
173 * Note: this is different from the PMIC's operatig mode, it is the
185 ret = regmap_read(rdev->regmap, reg, &val); in mcp16502_get_mode()
200 * _mcp16502_set_mode() - helper for set_mode and set_suspend_mode
204 * @opmode: the PMIC's operating mode: Active/Low-power/Hibernate
224 return -EINVAL; in _mcp16502_set_mode()
227 reg = regmap_update_bits(rdev->regmap, reg, MCP16502_MODE, val); in _mcp16502_set_mode()
232 * mcp16502_set_mode() - regulator_ops set_mode
240 * mcp16502_get_status() - regulator_ops get_status
247 ret = regmap_read(rdev->regmap, MCP16502_STAT_BASE(rdev_get_id(rdev)), in mcp16502_get_status()
264 * mcp16502_suspend_get_target_reg() - get the reg of the target suspend PMIC
276 dev_err(&rdev->dev, "invalid suspend target: %d\n", in mcp16502_suspend_get_target_reg()
280 return -EINVAL; in mcp16502_suspend_get_target_reg()
284 * mcp16502_set_suspend_voltage() - regulator_ops set_suspend_voltage
297 return regmap_update_bits(rdev->regmap, reg, MCP16502_VSEL, sel); in mcp16502_set_suspend_voltage()
301 * mcp16502_set_suspend_mode() - regulator_ops set_suspend_mode
313 dev_err(&rdev->dev, "invalid suspend target: %d\n", in mcp16502_set_suspend_mode()
317 return -EINVAL; in mcp16502_set_suspend_mode()
321 * mcp16502_set_suspend_enable() - regulator_ops set_suspend_enable
330 return regmap_update_bits(rdev->regmap, reg, MCP16502_EN, MCP16502_EN); in mcp16502_set_suspend_enable()
334 * mcp16502_set_suspend_disable() - regulator_ops set_suspend_disable
343 return regmap_update_bits(rdev->regmap, reg, MCP16502_EN, 0); in mcp16502_set_suspend_disable()
440 dev = &client->dev; in mcp16502_probe()
445 return -ENOMEM; in mcp16502_probe()
458 mcp->lpm = devm_gpiod_get(dev, "lpm", GPIOD_OUT_LOW); in mcp16502_probe()
459 if (IS_ERR(mcp->lpm)) { in mcp16502_probe()
460 dev_err(dev, "failed to get lpm pin: %ld\n", PTR_ERR(mcp->lpm)); in mcp16502_probe()
461 return PTR_ERR(mcp->lpm); in mcp16502_probe()
516 .name = "mcp16502-regulator",
528 MODULE_DESCRIPTION("MCP16502 PMIC driver");