Lines Matching +full:mt6397 +full:- +full:regulator
1 // SPDX-License-Identifier: GPL-2.0
6 // Based on mt6323-regulator.c,
14 #include <linux/mfd/mt6397/core.h>
16 #include <linux/regulator/driver.h>
17 #include <linux/regulator/machine.h>
18 #include <linux/regulator/mt6331-regulator.h>
19 #include <linux/regulator/of_regulator.h>
27 * @desc: standard fields of regulator description.
32 * @status_reg: Register for regulator enable status where qi unavailable
33 * @status_mask: Mask for querying regulator enable status
57 .n_voltages = (max - min)/step + 1, \
212 ret = regmap_read(rdev->regmap, info->desc.enable_reg, ®val); in mt6331_get_status()
214 dev_err(&rdev->dev, "Failed to get enable reg: %d\n", ret); in mt6331_get_status()
218 return (regval & info->qi) ? REGULATOR_STATUS_ON : REGULATOR_STATUS_OFF; in mt6331_get_status()
234 return -EINVAL; in mt6331_ldo_set_mode()
237 val <<= ffs(info->modeset_mask) - 1; in mt6331_ldo_set_mode()
239 return regmap_update_bits(rdev->regmap, info->modeset_reg, in mt6331_ldo_set_mode()
240 info->modeset_mask, val); in mt6331_ldo_set_mode()
249 ret = regmap_read(rdev->regmap, info->modeset_reg, &val); in mt6331_ldo_get_mode()
253 val &= info->modeset_mask; in mt6331_ldo_get_mode()
254 val >>= ffs(info->modeset_mask) - 1; in mt6331_ldo_get_mode()
338 MT6331_BUCK("buck-vdvfs11", VDVFS11, 700000, 1493750, 6250,
342 MT6331_BUCK("buck-vdvfs12", VDVFS12, 700000, 1493750, 6250,
346 MT6331_BUCK("buck-vdvfs13", VDVFS13, 700000, 1493750, 6250,
350 MT6331_BUCK("buck-vdvfs14", VDVFS14, 700000, 1493750, 6250,
354 MT6331_BUCK("buck-vcore2", VCORE2, 700000, 1493750, 6250,
358 MT6331_REG_FIXED("buck-vio18", VIO18, MT6331_VIO18_CON9, 0, 13, 1800000, 0, 0),
359 MT6331_REG_FIXED("ldo-vrtc", VRTC, MT6331_DIGLDO_CON11, 8, 15, 2800000, 0, 0),
360 MT6331_REG_FIXED("ldo-vtcxo1", VTCXO1, MT6331_ANALDO_CON1, 10, 15, 2800000,
362 MT6331_REG_FIXED("ldo-vtcxo2", VTCXO2, MT6331_ANALDO_CON2, 10, 15, 2800000,
364 MT6331_REG_FIXED("ldo-vsram", VSRAM_DVFS1, MT6331_SYSLDO_CON4, 10, 15, 1012500,
366 MT6331_REG_FIXED("ldo-vio28", VIO28, MT6331_DIGLDO_CON1, 10, 15, 2800000,
368 MT6331_LDO("ldo-avdd32aud", AVDD32_AUD, ldo_volt_table1, MT6331_ANALDO_CON3, 10,
370 MT6331_LDO("ldo-vauxa32", VAUXA32, ldo_volt_table1, MT6331_ANALDO_CON4, 10,
372 MT6331_LDO("ldo-vemc33", VEMC33, ldo_volt_table6, MT6331_DIGLDO_CON5, 10,
374 MT6331_LDO("ldo-vibr", VIBR, ldo_volt_table3, MT6331_DIGLDO_CON12, 10,
376 MT6331_LDO("ldo-vmc", VMC, ldo_volt_table5, MT6331_DIGLDO_CON3, 10,
378 MT6331_LDO("ldo-vmch", VMCH, ldo_volt_table6, MT6331_DIGLDO_CON4, 10,
380 MT6331_LDO("ldo-vmipi", VMIPI, ldo_volt_table3, MT6331_SYSLDO_CON5, 10,
382 MT6331_LDO("ldo-vsim1", VSIM1, ldo_volt_table4, MT6331_DIGLDO_CON8, 10,
384 MT6331_LDO("ldo-vsim2", VSIM2, ldo_volt_table4, MT6331_DIGLDO_CON9, 10,
386 MT6331_LDO("ldo-vusb10", VUSB10, ldo_volt_table9, MT6331_SYSLDO_CON2, 10,
388 MT6331_LDO("ldo-vcama", VCAMA, ldo_volt_table2, MT6331_ANALDO_CON5, 15,
390 MT6331_LDO_S("ldo-vcamaf", VCAM_AF, ldo_volt_table3, MT6331_DIGLDO_CON2, 10,
393 MT6331_LDO_S("ldo-vcamd", VCAMD, ldo_volt_table8, MT6331_SYSLDO_CON1, 15,
396 MT6331_LDO_S("ldo-vcamio", VCAM_IO, ldo_volt_table10, MT6331_SYSLDO_CON3, 10,
399 MT6331_LDO_S("ldo-vgp1", VGP1, ldo_volt_table3, MT6331_DIGLDO_CON6, 10,
402 MT6331_LDO_S("ldo-vgp2", VGP2, ldo_volt_table10, MT6331_SYSLDO_CON6, 10,
405 MT6331_LDO_S("ldo-vgp3", VGP3, ldo_volt_table10, MT6331_SYSLDO_CON7, 10,
408 MT6331_LDO_S("ldo-vgp4", VGP4, ldo_volt_table7, MT6331_DIGLDO_CON7, 10,
411 MT6331_LDO_AO("ldo-vdig18", VDIG18, ldo_volt_table11,
417 struct mt6397_chip *mt6331 = dev_get_drvdata(pdev->dev.parent); in mt6331_set_buck_vosel_reg()
423 if (regmap_read(mt6331->regmap, in mt6331_set_buck_vosel_reg()
426 dev_err(&pdev->dev, in mt6331_set_buck_vosel_reg()
428 return -EIO; in mt6331_set_buck_vosel_reg()
443 struct mt6397_chip *mt6331 = dev_get_drvdata(pdev->dev.parent); in mt6331_regulator_probe()
451 return -EIO; in mt6331_regulator_probe()
454 if (regmap_read(mt6331->regmap, MT6331_HWCID, ®_value) < 0) { in mt6331_regulator_probe()
455 dev_err(&pdev->dev, "Failed to read Chip ID\n"); in mt6331_regulator_probe()
456 return -EIO; in mt6331_regulator_probe()
460 dev_info(&pdev->dev, "Chip ID = 0x%x\n", reg_value); in mt6331_regulator_probe()
470 dev_err(&pdev->dev, "Chip version not supported. Bailing out.\n"); in mt6331_regulator_probe()
471 return -EINVAL; in mt6331_regulator_probe()
475 config.dev = &pdev->dev; in mt6331_regulator_probe()
477 config.regmap = mt6331->regmap; in mt6331_regulator_probe()
478 rdev = devm_regulator_register(&pdev->dev, in mt6331_regulator_probe()
481 dev_err(&pdev->dev, "failed to register %s\n", in mt6331_regulator_probe()
490 {"mt6331-regulator", 0},
497 .name = "mt6331-regulator",
507 MODULE_DESCRIPTION("Regulator Driver for MediaTek MT6331 PMIC");