Lines Matching +full:ext +full:- +full:active +full:- +full:high
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) ST-Ericsson SA 2010
11 * ab8500-ext supports the following regulators:
12 * - VextSupply3
35 bool hwreq; /* requires hw mode or high power mode */
41 REGULATOR_SUPPLY("vinvsim", "sim-detect.0"),
51 .name = "ab8500-ext-supply1",
62 .name = "ab8500-ext-supply2",
70 .name = "ab8500-ext-supply3",
83 * struct ab8500_ext_regulator_info - ab8500 regulator information
91 * @update_val_hp: bits to set EN pin active (LPn pin deactive)
92 * normally this means high power mode
93 * @update_val_lp: bits to set EN pin active and LPn pin active
119 return -EINVAL; in ab8500_ext_regulator_enable()
123 * To satisfy both HW high power request and SW request, the regulator in ab8500_ext_regulator_enable()
124 * must be on in high power. in ab8500_ext_regulator_enable()
126 if (info->cfg && info->cfg->hwreq) in ab8500_ext_regulator_enable()
127 regval = info->update_val_hp; in ab8500_ext_regulator_enable()
129 regval = info->update_val; in ab8500_ext_regulator_enable()
131 ret = abx500_mask_and_set_register_interruptible(info->dev, in ab8500_ext_regulator_enable()
132 info->update_bank, info->update_reg, in ab8500_ext_regulator_enable()
133 info->update_mask, regval); in ab8500_ext_regulator_enable()
141 "%s-enable (bank, reg, mask, value): 0x%02x, 0x%02x, 0x%02x, 0x%02x\n", in ab8500_ext_regulator_enable()
142 info->desc.name, info->update_bank, info->update_reg, in ab8500_ext_regulator_enable()
143 info->update_mask, regval); in ab8500_ext_regulator_enable()
156 return -EINVAL; in ab8500_ext_regulator_disable()
162 if (info->cfg && info->cfg->hwreq) in ab8500_ext_regulator_disable()
163 regval = info->update_val_hw; in ab8500_ext_regulator_disable()
167 ret = abx500_mask_and_set_register_interruptible(info->dev, in ab8500_ext_regulator_disable()
168 info->update_bank, info->update_reg, in ab8500_ext_regulator_disable()
169 info->update_mask, regval); in ab8500_ext_regulator_disable()
176 dev_dbg(rdev_get_dev(rdev), "%s-disable (bank, reg, mask, value):" in ab8500_ext_regulator_disable()
178 info->desc.name, info->update_bank, info->update_reg, in ab8500_ext_regulator_disable()
179 info->update_mask, regval); in ab8500_ext_regulator_disable()
192 return -EINVAL; in ab8500_ext_regulator_is_enabled()
195 ret = abx500_get_register_interruptible(info->dev, in ab8500_ext_regulator_is_enabled()
196 info->update_bank, info->update_reg, ®val); in ab8500_ext_regulator_is_enabled()
199 "couldn't read 0x%x register\n", info->update_reg); in ab8500_ext_regulator_is_enabled()
203 dev_dbg(rdev_get_dev(rdev), "%s-is_enabled (bank, reg, mask, value):" in ab8500_ext_regulator_is_enabled()
205 info->desc.name, info->update_bank, info->update_reg, in ab8500_ext_regulator_is_enabled()
206 info->update_mask, regval); in ab8500_ext_regulator_is_enabled()
208 if (((regval & info->update_mask) == info->update_val_lp) || in ab8500_ext_regulator_is_enabled()
209 ((regval & info->update_mask) == info->update_val_hp)) in ab8500_ext_regulator_is_enabled()
224 return -EINVAL; in ab8500_ext_regulator_set_mode()
229 regval = info->update_val_hp; in ab8500_ext_regulator_set_mode()
232 regval = info->update_val_lp; in ab8500_ext_regulator_set_mode()
236 return -EINVAL; in ab8500_ext_regulator_set_mode()
239 /* If regulator is enabled and info->cfg->hwreq is set, the regulator in ab8500_ext_regulator_set_mode()
240 must be on in high power, so we don't need to write the register with in ab8500_ext_regulator_set_mode()
244 !(info->cfg && info->cfg->hwreq)) { in ab8500_ext_regulator_set_mode()
245 ret = abx500_mask_and_set_register_interruptible(info->dev, in ab8500_ext_regulator_set_mode()
246 info->update_bank, info->update_reg, in ab8500_ext_regulator_set_mode()
247 info->update_mask, regval); in ab8500_ext_regulator_set_mode()
255 "%s-set_mode (bank, reg, mask, value): " in ab8500_ext_regulator_set_mode()
257 info->desc.name, info->update_bank, info->update_reg, in ab8500_ext_regulator_set_mode()
258 info->update_mask, regval); in ab8500_ext_regulator_set_mode()
261 info->update_val = regval; in ab8500_ext_regulator_set_mode()
273 return -EINVAL; in ab8500_ext_regulator_get_mode()
276 if (info->update_val == info->update_val_hp) in ab8500_ext_regulator_get_mode()
278 else if (info->update_val == info->update_val_lp) in ab8500_ext_regulator_get_mode()
281 ret = -EINVAL; in ab8500_ext_regulator_get_mode()
289 struct regulation_constraints *regu_constraints = rdev->constraints; in ab8500_ext_set_voltage()
293 return -EINVAL; in ab8500_ext_set_voltage()
296 if (regu_constraints->min_uV == min_uV && in ab8500_ext_set_voltage()
297 regu_constraints->max_uV == max_uV) in ab8500_ext_set_voltage()
303 regu_constraints->min_uV, regu_constraints->max_uV); in ab8500_ext_set_voltage()
305 return -EINVAL; in ab8500_ext_set_voltage()
311 struct regulation_constraints *regu_constraints = rdev->constraints; in ab8500_ext_list_voltage()
315 return -EINVAL; in ab8500_ext_list_voltage()
318 if (regu_constraints->min_uV && regu_constraints->max_uV) { in ab8500_ext_list_voltage()
319 if (regu_constraints->min_uV == regu_constraints->max_uV) in ab8500_ext_list_voltage()
320 return regu_constraints->min_uV; in ab8500_ext_list_voltage()
322 return -EINVAL; in ab8500_ext_list_voltage()
395 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); in ab8500_ext_regulator_probe()
401 dev_err(&pdev->dev, "null mfd parent\n"); in ab8500_ext_regulator_probe()
402 return -EINVAL; in ab8500_ext_regulator_probe()
411 info->update_val = 0x30; in ab8500_ext_regulator_probe()
412 info->update_val_hp = 0x30; in ab8500_ext_regulator_probe()
413 info->update_val_lp = 0x10; in ab8500_ext_regulator_probe()
420 /* assign per-regulator data */ in ab8500_ext_regulator_probe()
422 info->dev = &pdev->dev; in ab8500_ext_regulator_probe()
423 info->cfg = (struct ab8500_ext_regulator_cfg *) in ab8500_ext_regulator_probe()
426 config.dev = &pdev->dev; in ab8500_ext_regulator_probe()
431 rdev = devm_regulator_register(&pdev->dev, &info->desc, in ab8500_ext_regulator_probe()
434 dev_err(&pdev->dev, "failed to register regulator %s\n", in ab8500_ext_regulator_probe()
435 info->desc.name); in ab8500_ext_regulator_probe()
439 dev_dbg(&pdev->dev, "%s-probed\n", info->desc.name); in ab8500_ext_regulator_probe()
448 .name = "ab8500-ext-regulator",
459 pr_err("Failed to register ab8500 ext regulator: %d\n", ret); in ab8500_ext_regulator_init()
474 MODULE_ALIAS("platform:ab8500-ext-regulator");