Lines Matching +full:buck +full:- +full:c
1 // SPDX-License-Identifier: GPL-2.0
3 // Copyright (c) 2022 Collabora Ltd.
6 // Based on mt6323-regulator.c,
7 // Copyright (c) 2016 MediaTek Inc.
18 #include <linux/regulator/mt6332-regulator.h>
30 * @vselctrl_reg: Register for controlling the buck control mode.
31 * @vselctrl_mask: Mask for query buck's voltage control mode.
57 .n_voltages = (max - min)/step + 1, \
83 .n_voltages = (max - min)/step + 1, \
188 if (info->qi > 0) { in mt6332_get_status()
189 reg = info->desc.enable_reg; in mt6332_get_status()
190 en_mask = info->qi; in mt6332_get_status()
192 reg = info->status_reg; in mt6332_get_status()
193 en_mask = info->status_mask; in mt6332_get_status()
196 ret = regmap_read(rdev->regmap, reg, ®val); in mt6332_get_status()
198 dev_err(&rdev->dev, "Failed to get enable reg: %d\n", ret); in mt6332_get_status()
218 return -EINVAL; in mt6332_ldo_set_mode()
221 val <<= ffs(info->modeset_mask) - 1; in mt6332_ldo_set_mode()
223 return regmap_update_bits(rdev->regmap, info->modeset_reg, in mt6332_ldo_set_mode()
224 info->modeset_mask, val); in mt6332_ldo_set_mode()
233 ret = regmap_read(rdev->regmap, info->modeset_reg, &val); in mt6332_ldo_get_mode()
237 val &= info->modeset_mask; in mt6332_ldo_get_mode()
238 val >>= ffs(info->modeset_mask) - 1; in mt6332_ldo_get_mode()
301 MT6332_BUCK("buck-vdram", VDRAM, 700000, 1493750, 6250, buck_volt_range,
304 MT6332_BUCK("buck-vdvfs2", VDVFS2, 700000, 1312500, 6250, buck_volt_range,
307 MT6332_BUCK("buck-vpa", VPA, 500000, 3400000, 50000, buck_pa_volt_range,
310 MT6332_BUCK("buck-vrf18a", VRF1, 1050000, 2240625, 9375, buck_rf_volt_range,
313 MT6332_BUCK("buck-vrf18b", VRF2, 1050000, 2240625, 9375, buck_rf_volt_range,
316 MT6332_BUCK("buck-vsbst", VSBST, 3500000, 7468750, 31250, boost_volt_range,
319 MT6332_LDO("ldo-vauxb32", VAUXB32, ldo_volt_table1, MT6332_LDO_CON1, 10,
321 MT6332_REG_FIXED("ldo-vbif28", VBIF28, MT6332_LDO_CON2, 10, 0, 2800000, 1),
322 MT6332_REG_FIXED("ldo-vusb33", VUSB33, MT6332_LDO_CON3, 10, 0, 3300000, 2),
323 MT6332_LDO_LINEAR("ldo-vsram", VSRAM_DVFS2, 700000, 1493750, 6250, buck_volt_range,
327 MT6332_LDO_AO("ldo-vdig18", VDIG18, ldo_volt_table2, MT6332_LDO_CON12, GENMASK(11, 9)),
332 struct mt6397_chip *mt6332 = dev_get_drvdata(pdev->dev.parent); in mt6332_set_buck_vosel_reg()
338 if (regmap_read(mt6332->regmap, in mt6332_set_buck_vosel_reg()
341 dev_err(&pdev->dev, in mt6332_set_buck_vosel_reg()
342 "Failed to read buck ctrl\n"); in mt6332_set_buck_vosel_reg()
343 return -EIO; in mt6332_set_buck_vosel_reg()
358 struct mt6397_chip *mt6332 = dev_get_drvdata(pdev->dev.parent); in mt6332_regulator_probe()
364 /* Query buck controller to select activated voltage register part */ in mt6332_regulator_probe()
366 return -EIO; in mt6332_regulator_probe()
369 if (regmap_read(mt6332->regmap, MT6332_HWCID, ®_value) < 0) { in mt6332_regulator_probe()
370 dev_err(&pdev->dev, "Failed to read Chip ID\n"); in mt6332_regulator_probe()
371 return -EIO; in mt6332_regulator_probe()
375 dev_info(&pdev->dev, "Chip ID = 0x%x\n", reg_value); in mt6332_regulator_probe()
385 dev_err(&pdev->dev, "Chip version not supported. Bailing out.\n"); in mt6332_regulator_probe()
386 return -EINVAL; in mt6332_regulator_probe()
390 config.dev = &pdev->dev; in mt6332_regulator_probe()
392 config.regmap = mt6332->regmap; in mt6332_regulator_probe()
393 rdev = devm_regulator_register(&pdev->dev, in mt6332_regulator_probe()
396 dev_err(&pdev->dev, "failed to register %s\n", in mt6332_regulator_probe()
405 {"mt6332-regulator", 0},
412 .name = "mt6332-regulator",