Lines Matching +full:regulator +full:- +full:v4
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Regulator driver for TI TPS6586x
9 * Copyright (C) 2006-2008 Marvell International Ltd.
20 #include <linux/regulator/driver.h>
21 #include <linux/regulator/machine.h>
22 #include <linux/regulator/of_regulator.h>
113 .name = "REG-" #_id, \
123 .vsel_mask = ((1 << (nbits)) - 1) << (shift), \
137 .name = "REG-" #_id, \
148 .vsel_mask = ((1 << (nbits)) - 1) << (shift), \
192 .name = "REG-SYS", \
206 TPS6586X_LDO(LDO_5, "REG-SYS", tps6586x_ldo, SUPPLYV6, 0, 3, ENE, 6,
216 TPS6586X_LDO(LDO_RTC, "REG-SYS", tps6586x_ldo, SUPPLYV4, 3, 3, V4, 7,
217 V4, 7),
220 TPS6586X_LDO_LINEAR(SM_2, "vin-sm2", 32, 3000000, 50000, SUPPLYV2,
226 TPS6586X_DVM(SM_0, "vin-sm0", 32, 725000, 25000, SM0V1, 0, 5,
228 TPS6586X_DVM(SM_1, "vin-sm1", 32, 725000, 25000, SM1V1, 0, 5,
233 TPS6586X_LDO_LINEAR(SM_2, "vin-sm2", 32, 1700000, 25000, SUPPLYV2,
240 TPS6586X_LDO(LDO_5, "REG-SYS", tps6586x_ldo0, SUPPLYV6, 0, 3,
250 TPS6586X_LDO_LINEAR(SM_2, "vin-sm2", 32, 2150000, 50000, SUPPLYV2,
253 TPS6586X_FIXED_LDO(LDO_RTC, "REG-SYS", tps658640_rtc, SUPPLYV4, 3, 2,
254 V4, 7, V4, 7),
258 TPS6586X_LDO_LINEAR(SM_2, "vin-sm2", 32, 1025000, 25000, SUPPLYV2,
264 * regulator state. Clearing one of this bits allows switching
265 * regulator on and of with single register write.
273 if (ri->enable_reg[0] == ri->enable_reg[1] && in tps6586x_regulator_preinit()
274 ri->enable_bit[0] == ri->enable_bit[1]) in tps6586x_regulator_preinit()
277 ret = tps6586x_read(parent, ri->enable_reg[0], &val1); in tps6586x_regulator_preinit()
281 ret = tps6586x_read(parent, ri->enable_reg[1], &val2); in tps6586x_regulator_preinit()
285 if (!(val2 & (1 << ri->enable_bit[1]))) in tps6586x_regulator_preinit()
289 * The regulator is on, but it's enabled with the bit we don't in tps6586x_regulator_preinit()
292 if (!(val1 & (1 << ri->enable_bit[0]))) { in tps6586x_regulator_preinit()
293 ret = tps6586x_set_bits(parent, ri->enable_reg[0], in tps6586x_regulator_preinit()
294 1 << ri->enable_bit[0]); in tps6586x_regulator_preinit()
299 return tps6586x_clr_bits(parent, ri->enable_reg[1], in tps6586x_regulator_preinit()
300 1 << ri->enable_bit[1]); in tps6586x_regulator_preinit()
306 struct device *parent = pdev->dev.parent; in tps6586x_regulator_set_slew_rate()
307 struct tps6586x_settings *setting = p->driver_data; in tps6586x_regulator_set_slew_rate()
313 if (!(setting->slew_rate & TPS6586X_SLEW_RATE_SET)) in tps6586x_regulator_set_slew_rate()
325 dev_err(&pdev->dev, "Only SM0/SM1 can set slew rate\n"); in tps6586x_regulator_set_slew_rate()
326 return -EINVAL; in tps6586x_regulator_set_slew_rate()
330 setting->slew_rate & TPS6586X_SLEW_RATE_MASK); in tps6586x_regulator_set_slew_rate()
361 if (ri->desc.id == id) in find_regulator_info()
368 if (ri->desc.id == id) in find_regulator_info()
398 struct device_node *np = pdev->dev.parent->of_node; in tps6586x_parse_regulator_dt()
407 dev_err(&pdev->dev, "regulator node not found\n"); in tps6586x_parse_regulator_dt()
411 err = of_regulator_match(&pdev->dev, regs, tps6586x_matches, num); in tps6586x_parse_regulator_dt()
414 dev_err(&pdev->dev, "Regulator match failed, e %d\n", err); in tps6586x_parse_regulator_dt()
418 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); in tps6586x_parse_regulator_dt()
427 pdata->reg_init_data[i] = tps6586x_matches[i].init_data; in tps6586x_parse_regulator_dt()
430 sys_rail = pdata->reg_init_data[i]->constraints.name; in tps6586x_parse_regulator_dt()
433 pdata->reg_init_data[i]->supply_regulator = sys_rail; in tps6586x_parse_regulator_dt()
460 dev_dbg(&pdev->dev, "Probing regulator\n"); in tps6586x_regulator_probe()
462 pdata = dev_get_platdata(pdev->dev.parent); in tps6586x_regulator_probe()
463 if ((!pdata) && (pdev->dev.parent->of_node)) in tps6586x_regulator_probe()
468 dev_err(&pdev->dev, "Platform data not available, exiting\n"); in tps6586x_regulator_probe()
469 return -ENODEV; in tps6586x_regulator_probe()
472 version = tps6586x_get_version(pdev->dev.parent); in tps6586x_regulator_probe()
475 reg_data = pdata->reg_init_data[id]; in tps6586x_regulator_probe()
480 dev_err(&pdev->dev, "invalid regulator ID specified\n"); in tps6586x_regulator_probe()
481 return -EINVAL; in tps6586x_regulator_probe()
484 err = tps6586x_regulator_preinit(pdev->dev.parent, ri); in tps6586x_regulator_probe()
486 dev_err(&pdev->dev, in tps6586x_regulator_probe()
487 "regulator %d preinit failed, e %d\n", id, err); in tps6586x_regulator_probe()
491 config.dev = pdev->dev.parent; in tps6586x_regulator_probe()
498 rdev = devm_regulator_register(&pdev->dev, &ri->desc, &config); in tps6586x_regulator_probe()
500 dev_err(&pdev->dev, "failed to register regulator %s\n", in tps6586x_regulator_probe()
501 ri->desc.name); in tps6586x_regulator_probe()
509 dev_err(&pdev->dev, in tps6586x_regulator_probe()
522 .name = "tps6586x-regulator",
542 MODULE_DESCRIPTION("Regulator Driver for TI TPS6586X PMIC");
543 MODULE_ALIAS("platform:tps6586x-regulator");