Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regulator: rn5t618: Add RN5T567 PMIC support

Extend the driver to support Ricoh RN5T567. Support the additional
DCDC and slightly different voltage range of LDORTC1.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Reviewed-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Stefan Agner and committed by
Lee Jones
ed6d362d a99ab50d

+40 -6
+3 -2
drivers/regulator/Kconfig
··· 636 636 outputs which can be controlled by i2c communication. 637 637 638 638 config REGULATOR_RN5T618 639 - tristate "Ricoh RN5T618 voltage regulators" 639 + tristate "Ricoh RN5T567/618 voltage regulators" 640 640 depends on MFD_RN5T618 641 641 help 642 - Say y here to support the regulators found on Ricoh RN5T618 PMIC. 642 + Say y here to support the regulators found on Ricoh RN5T567 or 643 + RN5T618 PMIC. 643 644 644 645 config REGULATOR_RT5033 645 646 tristate "Richtek RT5033 Regulators"
+36 -4
drivers/regulator/rn5t618-regulator.c
··· 46 46 .vsel_mask = (vmask), \ 47 47 } 48 48 49 + static struct regulator_desc rn5t567_regulators[] = { 50 + /* DCDC */ 51 + REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500), 52 + REG(DCDC2, DC2CTL, BIT(0), DC2DAC, 0xff, 600000, 3500000, 12500), 53 + REG(DCDC3, DC3CTL, BIT(0), DC3DAC, 0xff, 600000, 3500000, 12500), 54 + REG(DCDC4, DC4CTL, BIT(0), DC4DAC, 0xff, 600000, 3500000, 12500), 55 + /* LDO */ 56 + REG(LDO1, LDOEN1, BIT(0), LDO1DAC, 0x7f, 900000, 3500000, 25000), 57 + REG(LDO2, LDOEN1, BIT(1), LDO2DAC, 0x7f, 900000, 3500000, 25000), 58 + REG(LDO3, LDOEN1, BIT(2), LDO3DAC, 0x7f, 600000, 3500000, 25000), 59 + REG(LDO4, LDOEN1, BIT(3), LDO4DAC, 0x7f, 900000, 3500000, 25000), 60 + REG(LDO5, LDOEN1, BIT(4), LDO5DAC, 0x7f, 900000, 3500000, 25000), 61 + /* LDO RTC */ 62 + REG(LDORTC1, LDOEN2, BIT(4), LDORTCDAC, 0x7f, 1200000, 3500000, 25000), 63 + REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 900000, 3500000, 25000), 64 + }; 65 + 49 66 static struct regulator_desc rn5t618_regulators[] = { 50 67 /* DCDC */ 51 68 REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500), ··· 84 67 struct rn5t618 *rn5t618 = dev_get_drvdata(pdev->dev.parent); 85 68 struct regulator_config config = { }; 86 69 struct regulator_dev *rdev; 70 + struct regulator_desc *regulators; 87 71 int i; 88 72 73 + switch (rn5t618->variant) { 74 + case RN5T567: 75 + regulators = rn5t567_regulators; 76 + break; 77 + case RN5T618: 78 + regulators = rn5t618_regulators; 79 + break; 80 + default: 81 + return -EINVAL; 82 + } 83 + 84 + config.dev = pdev->dev.parent; 85 + config.regmap = rn5t618->regmap; 86 + 89 87 for (i = 0; i < RN5T618_REG_NUM; i++) { 90 - config.dev = pdev->dev.parent; 91 - config.regmap = rn5t618->regmap; 88 + if (!regulators[i].name) 89 + continue; 92 90 93 91 rdev = devm_regulator_register(&pdev->dev, 94 - &rn5t618_regulators[i], 92 + &regulators[i], 95 93 &config); 96 94 if (IS_ERR(rdev)) { 97 95 dev_err(&pdev->dev, "failed to register %s regulator\n", 98 - rn5t618_regulators[i].name); 96 + regulators[i].name); 99 97 return PTR_ERR(rdev); 100 98 } 101 99 }
+1
include/linux/mfd/rn5t618.h
··· 217 217 RN5T618_DCDC1, 218 218 RN5T618_DCDC2, 219 219 RN5T618_DCDC3, 220 + RN5T618_DCDC4, 220 221 RN5T618_LDO1, 221 222 RN5T618_LDO2, 222 223 RN5T618_LDO3,