Lines Matching +full:ldo6 +full:- +full:8

1 // SPDX-License-Identifier: GPL-2.0+
3 // da9052-regulator.c: Regulator driver for DA9052
45 #define DA9052_ID_LDO5 8
53 {700000, 800000, 1000000, 1200000}, /* DA9052-BC BUCKs */
54 {1600000, 2000000, 2400000, 3000000}, /* DA9053-AA/Bx BUCK-CORE */
55 {800000, 1000000, 1200000, 1500000}, /* DA9053-AA/Bx BUCK-PRO,
56 * BUCK-MEM and BUCK-PERI
77 if (min_uV > info->max_uV || max_uV < info->min_uV) in verify_range()
78 return -EINVAL; in verify_range()
89 ret = da9052_reg_read(regulator->da9052, DA9052_BUCKA_REG + offset/2); in da9052_dcdc_get_current_limit()
102 if (regulator->da9052->chip_id == DA9052) in da9052_dcdc_get_current_limit()
119 if (regulator->da9052->chip_id == DA9052) in da9052_dcdc_set_current_limit()
124 for (i = DA9052_CURRENT_RANGE - 1; i >= 0; i--) { in da9052_dcdc_set_current_limit()
133 return -EINVAL; in da9052_dcdc_set_current_limit()
139 return da9052_reg_update(regulator->da9052, in da9052_dcdc_set_current_limit()
144 return da9052_reg_update(regulator->da9052, in da9052_dcdc_set_current_limit()
154 const struct da9052_regulator_info *info = regulator->info; in da9052_list_voltage()
158 if ((id == DA9052_ID_BUCK4) && (regulator->da9052->chip_id == DA9052) in da9052_list_voltage()
160 volt_uV = ((DA9052_BUCK_PERI_REG_MAP_UPTO_3uV * info->step_uV) in da9052_list_voltage()
161 + info->min_uV); in da9052_list_voltage()
162 volt_uV += (selector - DA9052_BUCK_PERI_REG_MAP_UPTO_3uV) in da9052_list_voltage()
165 volt_uV = (selector * info->step_uV) + info->min_uV; in da9052_list_voltage()
168 if (volt_uV > info->max_uV) in da9052_list_voltage()
169 return -EINVAL; in da9052_list_voltage()
178 const struct da9052_regulator_info *info = regulator->info; in da9052_map_voltage()
186 if (min_uV < info->min_uV) in da9052_map_voltage()
187 min_uV = info->min_uV; in da9052_map_voltage()
189 if ((id == DA9052_ID_BUCK4) && (regulator->da9052->chip_id == DA9052) in da9052_map_voltage()
192 DIV_ROUND_UP(min_uV - DA9052_CONST_3uV, in da9052_map_voltage()
195 sel = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV); in da9052_map_voltage()
209 const struct da9052_regulator_info *info = regulator->info; in da9052_regulator_set_voltage_sel()
213 ret = da9052_reg_update(regulator->da9052, rdev->desc->vsel_reg, in da9052_regulator_set_voltage_sel()
214 rdev->desc->vsel_mask, selector); in da9052_regulator_set_voltage_sel()
227 ret = da9052_reg_update(regulator->da9052, DA9052_SUPPLY_REG, in da9052_regulator_set_voltage_sel()
228 info->activate_bit, info->activate_bit); in da9052_regulator_set_voltage_sel()
240 const struct da9052_regulator_info *info = regulator->info; in da9052_regulator_set_voltage_time_sel()
253 ret = DIV_ROUND_UP(abs(new_sel - old_sel) * info->step_uV, in da9052_regulator_set_voltage_time_sel()
295 .n_voltages = (max - min) / step + 1, \
298 .vsel_mask = (1 << (sbits)) - 1,\
317 .n_voltages = (max - min) / step + 1, \
320 .vsel_mask = (1 << (sbits)) - 1,\
340 DA9052_LDO(LDO6, ldo6, 50, 1200, 3600, 6, 6, 0),
357 DA9052_LDO(LDO6, ldo6, 50, 1200, 3600, 6, 6, 0),
374 if (info->reg_desc.id == id) in find_regulator_info()
384 if (info->reg_desc.id == id) in find_regulator_info()
401 regulator = devm_kzalloc(&pdev->dev, sizeof(struct da9052_regulator), in da9052_regulator_probe()
404 return -ENOMEM; in da9052_regulator_probe()
406 da9052 = dev_get_drvdata(pdev->dev.parent); in da9052_regulator_probe()
407 pdata = dev_get_platdata(da9052->dev); in da9052_regulator_probe()
408 regulator->da9052 = da9052; in da9052_regulator_probe()
410 regulator->info = find_regulator_info(regulator->da9052->chip_id, in da9052_regulator_probe()
411 cell->id); in da9052_regulator_probe()
412 if (regulator->info == NULL) { in da9052_regulator_probe()
413 dev_err(&pdev->dev, "invalid regulator ID specified\n"); in da9052_regulator_probe()
414 return -EINVAL; in da9052_regulator_probe()
417 config.dev = da9052->dev; in da9052_regulator_probe()
419 config.regmap = da9052->regmap; in da9052_regulator_probe()
421 config.init_data = pdata->regulators[cell->id]; in da9052_regulator_probe()
423 regulator->rdev = devm_regulator_register(&pdev->dev, in da9052_regulator_probe()
424 &regulator->info->reg_desc, in da9052_regulator_probe()
426 if (IS_ERR(regulator->rdev)) { in da9052_regulator_probe()
427 dev_err(&pdev->dev, "failed to register regulator %s\n", in da9052_regulator_probe()
428 regulator->info->reg_desc.name); in da9052_regulator_probe()
429 return PTR_ERR(regulator->rdev); in da9052_regulator_probe()
440 .name = "da9052-regulator",
460 MODULE_ALIAS("platform:da9052-regulator");