Lines Matching +full:mt6323 +full:- +full:regulator

1 // SPDX-License-Identifier: GPL-2.0
11 #include <linux/mfd/mt6323/registers.h>
12 #include <linux/regulator/driver.h>
13 #include <linux/regulator/machine.h>
14 #include <linux/regulator/mt6323-regulator.h>
15 #include <linux/regulator/of_regulator.h>
21 * MT6323 regulators' information
23 * @desc: standard fields of regulator description.
49 .n_voltages = (max - min)/step + 1, \
163 ret = regmap_read(rdev->regmap, info->desc.enable_reg, &regval); in mt6323_get_status()
165 dev_err(&rdev->dev, "Failed to get enable reg: %d\n", ret); in mt6323_get_status()
169 return (regval & info->qi) ? REGULATOR_STATUS_ON : REGULATOR_STATUS_OFF; in mt6323_get_status()
177 if (!info->modeset_mask) { in mt6323_ldo_set_mode()
178 dev_err(&rdev->dev, "regulator %s doesn't support set_mode\n", in mt6323_ldo_set_mode()
179 info->desc.name); in mt6323_ldo_set_mode()
180 return -EINVAL; in mt6323_ldo_set_mode()
191 return -EINVAL; in mt6323_ldo_set_mode()
194 val <<= ffs(info->modeset_mask) - 1; in mt6323_ldo_set_mode()
196 ret = regmap_update_bits(rdev->regmap, info->modeset_reg, in mt6323_ldo_set_mode()
197 info->modeset_mask, val); in mt6323_ldo_set_mode()
209 if (!info->modeset_mask) { in mt6323_ldo_get_mode()
210 dev_err(&rdev->dev, "regulator %s doesn't support get_mode\n", in mt6323_ldo_get_mode()
211 info->desc.name); in mt6323_ldo_get_mode()
212 return -EINVAL; in mt6323_ldo_get_mode()
215 ret = regmap_read(rdev->regmap, info->modeset_reg, &val); in mt6323_ldo_get_mode()
219 val &= info->modeset_mask; in mt6323_ldo_get_mode()
220 val >>= ffs(info->modeset_mask) - 1; in mt6323_ldo_get_mode()
290 MT6323_ANALDO_CON4, 15, MT6323_ANALDO_CON10, 0x60, -1, 0),
322 -1, 0),
345 struct mt6397_chip *mt6323 = dev_get_drvdata(pdev->dev.parent); in mt6323_set_buck_vosel_reg() local
351 if (regmap_read(mt6323->regmap, in mt6323_set_buck_vosel_reg()
354 dev_err(&pdev->dev, in mt6323_set_buck_vosel_reg()
356 return -EIO; in mt6323_set_buck_vosel_reg()
371 struct mt6397_chip *mt6323 = dev_get_drvdata(pdev->dev.parent); in mt6323_regulator_probe() local
379 return -EIO; in mt6323_regulator_probe()
382 if (regmap_read(mt6323->regmap, MT6323_CID, &reg_value) < 0) { in mt6323_regulator_probe()
383 dev_err(&pdev->dev, "Failed to read Chip ID\n"); in mt6323_regulator_probe()
384 return -EIO; in mt6323_regulator_probe()
386 dev_info(&pdev->dev, "Chip ID = 0x%x\n", reg_value); in mt6323_regulator_probe()
389 config.dev = &pdev->dev; in mt6323_regulator_probe()
391 config.regmap = mt6323->regmap; in mt6323_regulator_probe()
392 rdev = devm_regulator_register(&pdev->dev, in mt6323_regulator_probe()
395 dev_err(&pdev->dev, "failed to register %s\n", in mt6323_regulator_probe()
404 {"mt6323-regulator", 0},
411 .name = "mt6323-regulator",
421 MODULE_DESCRIPTION("Regulator Driver for MediaTek MT6323 PMIC");