Skip to content

Commit 83b2a3c

Browse files
phhussonbroonie
authored andcommitted
regulator: rn5t618: add RC5T619 PMIC support
Extend the driver to support Ricoh RC5T619. Support the additional regulators and slightly different voltage ranges. Signed-off-by: Pierre-Hugues Husson <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 5771a8c commit 83b2a3c

File tree

3 files changed

+39
-6
lines changed

3 files changed

+39
-6
lines changed

drivers/regulator/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,8 @@ config REGULATOR_RN5T618
700700
tristate "Ricoh RN5T567/618 voltage regulators"
701701
depends on MFD_RN5T618
702702
help
703-
Say y here to support the regulators found on Ricoh RN5T567 or
704-
RN5T618 PMIC.
703+
Say y here to support the regulators found on Ricoh RN5T567,
704+
RN5T618 or RC5T619 PMIC.
705705

706706
config REGULATOR_RT5033
707707
tristate "Richtek RT5033 Regulators"

drivers/regulator/rn5t618-regulator.c

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,50 @@ static struct regulator_desc rn5t618_regulators[] = {
7979
REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 900000, 3500000, 25000),
8080
};
8181

82+
static struct regulator_desc rc5t619_regulators[] = {
83+
/* DCDC */
84+
REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500),
85+
REG(DCDC2, DC2CTL, BIT(0), DC2DAC, 0xff, 600000, 3500000, 12500),
86+
REG(DCDC3, DC3CTL, BIT(0), DC3DAC, 0xff, 600000, 3500000, 12500),
87+
REG(DCDC4, DC4CTL, BIT(0), DC4DAC, 0xff, 600000, 3500000, 12500),
88+
REG(DCDC5, DC5CTL, BIT(0), DC5DAC, 0xff, 600000, 3500000, 12500),
89+
/* LDO */
90+
REG(LDO1, LDOEN1, BIT(0), LDO1DAC, 0x7f, 900000, 3500000, 25000),
91+
REG(LDO2, LDOEN1, BIT(1), LDO2DAC, 0x7f, 900000, 3500000, 25000),
92+
REG(LDO3, LDOEN1, BIT(2), LDO3DAC, 0x7f, 900000, 3500000, 25000),
93+
REG(LDO4, LDOEN1, BIT(3), LDO4DAC, 0x7f, 900000, 3500000, 25000),
94+
REG(LDO5, LDOEN1, BIT(4), LDO5DAC, 0x7f, 600000, 3500000, 25000),
95+
REG(LDO6, LDOEN1, BIT(5), LDO6DAC, 0x7f, 600000, 3500000, 25000),
96+
REG(LDO7, LDOEN1, BIT(6), LDO7DAC, 0x7f, 900000, 3500000, 25000),
97+
REG(LDO8, LDOEN1, BIT(7), LDO8DAC, 0x7f, 900000, 3500000, 25000),
98+
REG(LDO9, LDOEN2, BIT(0), LDO9DAC, 0x7f, 900000, 3500000, 25000),
99+
REG(LDO10, LDOEN2, BIT(0), LDO10DAC, 0x7f, 900000, 3500000, 25000),
100+
/* LDO RTC */
101+
REG(LDORTC1, LDOEN2, BIT(4), LDORTCDAC, 0x7f, 1700000, 3500000, 25000),
102+
REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 900000, 3500000, 25000),
103+
};
104+
82105
static int rn5t618_regulator_probe(struct platform_device *pdev)
83106
{
84107
struct rn5t618 *rn5t618 = dev_get_drvdata(pdev->dev.parent);
85108
struct regulator_config config = { };
86109
struct regulator_dev *rdev;
87110
struct regulator_desc *regulators;
88111
int i;
112+
int num_regulators = 0;
89113

90114
switch (rn5t618->variant) {
91115
case RN5T567:
92116
regulators = rn5t567_regulators;
117+
num_regulators = ARRAY_SIZE(rn5t567_regulators);
93118
break;
94119
case RN5T618:
95120
regulators = rn5t618_regulators;
121+
num_regulators = ARRAY_SIZE(rn5t618_regulators);
122+
break;
123+
case RC5T619:
124+
regulators = rc5t619_regulators;
125+
num_regulators = ARRAY_SIZE(rc5t619_regulators);
96126
break;
97127
default:
98128
return -EINVAL;
@@ -101,10 +131,7 @@ static int rn5t618_regulator_probe(struct platform_device *pdev)
101131
config.dev = pdev->dev.parent;
102132
config.regmap = rn5t618->regmap;
103133

104-
for (i = 0; i < RN5T618_REG_NUM; i++) {
105-
if (!regulators[i].name)
106-
continue;
107-
134+
for (i = 0; i < num_regulators; i++) {
108135
rdev = devm_regulator_register(&pdev->dev,
109136
&regulators[i],
110137
&config);

include/linux/mfd/rn5t618.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,17 @@ enum {
226226
RN5T618_DCDC2,
227227
RN5T618_DCDC3,
228228
RN5T618_DCDC4,
229+
RN5T618_DCDC5,
229230
RN5T618_LDO1,
230231
RN5T618_LDO2,
231232
RN5T618_LDO3,
232233
RN5T618_LDO4,
233234
RN5T618_LDO5,
235+
RN5T618_LDO6,
236+
RN5T618_LDO7,
237+
RN5T618_LDO8,
238+
RN5T618_LDO9,
239+
RN5T618_LDO10,
234240
RN5T618_LDORTC1,
235241
RN5T618_LDORTC2,
236242
RN5T618_REG_NUM,

0 commit comments

Comments
 (0)