Skip to content

Commit fe9e313

Browse files
committed
Merge tag 'regulator-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown: "This is an extremely quiet release for the regulator subsystem, it's all fairly minor fixes and cleanups plus a few new drivers and ddevice ID additions: - Support for MediaTek MT6380, Ricoh RC5T619 and ST Voltage Reference Buffers" * tag 'regulator-v4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (24 commits) regulator: Add support for stm32-vrefbuf regulator: Add STM32 Voltage Reference Buffer regulator: pv88090: Exception handling for out of bounds regulator: da9063: Return an error code on probe failure regulator: rn5t618: add RC5T619 PMIC support regulator: ltc3589: constify i2c_device_id regulator: fan53555: fix I2C device ids regulator: add fixes with MT6397 dt-bindings shouldn't reference driver regulator: add fixes with MT6323 dt-bindings shouldn't reference driver regulator: add fixes with MT6311 dt-bindings shouldn't reference driver regulator: Add document for MediaTek MT6380 regulator regulator: mt6380: Add support for MT6380 regulator: pwm-regulator: Remove unneeded gpiod NULL check regulator: core: fix a possible race in disable_work handling regulator: fan53555: Use of_device_get_match_data() to simplify probe regulator: of: regulator_of_get_init_data() missing of_node_get() regulator: pwm-regulator: fix example syntax regulator: Convert to using %pOF instead of full_name regulator: cpcap: Add OF mode mapping regulator: cpcap: Fix standby mode ...
2 parents b88f557 + 00ee929 commit fe9e313

28 files changed

+835
-45
lines changed

Documentation/devicetree/bindings/regulator/mt6311-regulator.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Mediatek MT6311 Regulator Driver
1+
Mediatek MT6311 Regulator
22

33
Required properties:
44
- compatible: "mediatek,mt6311-regulator"

Documentation/devicetree/bindings/regulator/mt6323-regulator.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Mediatek MT6323 Regulator Driver
1+
Mediatek MT6323 Regulator
22

33
All voltage regulators are defined as subnodes of the regulators node. A list
44
of regulators provided by this controller are defined as subnodes of the
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
MediaTek MT6380 Regulator
2+
3+
All voltage regulators provided by the MT6380 PMIC are described as the
4+
subnodes of the MT6380 regulators node. Each regulator is named according
5+
to its regulator type, buck-<name> and ldo-<name>. The definition for each
6+
of these nodes is defined using the standard binding for regulators at
7+
Documentation/devicetree/bindings/regulator/regulator.txt.
8+
9+
The valid names for regulators are:
10+
BUCK:
11+
buck-core1, buck-vcore, buck-vrf
12+
LDO:
13+
ldo-vm ,ldo-va , ldo-vphy, ldo-vddr, ldo-vt
14+
15+
Example:
16+
17+
regulators {
18+
compatible = "mediatek,mt6380-regulator";
19+
20+
mt6380_vcpu_reg: buck-vcore1 {
21+
regulator-name = "vcore1";
22+
regulator-min-microvolt = < 600000>;
23+
regulator-max-microvolt = <1393750>;
24+
regulator-ramp-delay = <6250>;
25+
regulator-always-on;
26+
regulator-boot-on;
27+
};
28+
29+
mt6380_vcore_reg: buck-vcore {
30+
regulator-name = "vcore";
31+
regulator-min-microvolt = <600000>;
32+
regulator-max-microvolt = <1393750>;
33+
regulator-ramp-delay = <6250>;
34+
};
35+
36+
mt6380_vrf_reg: buck-vrf {
37+
regulator-name = "vrf";
38+
regulator-min-microvolt = <1200000>;
39+
regulator-max-microvolt = <1575000>;
40+
regulator-ramp-delay = <0>;
41+
regulator-always-on;
42+
regulator-boot-on;
43+
};
44+
45+
mt6380_vm_reg: ldo-vm {
46+
regulator-name = "vm";
47+
regulator-min-microvolt = <1050000>;
48+
regulator-max-microvolt = <1400000>;
49+
regulator-ramp-delay = <0>;
50+
regulator-always-on;
51+
regulator-boot-on;
52+
};
53+
54+
mt6380_va_reg: ldo-va {
55+
regulator-name = "va";
56+
regulator-min-microvolt = <2200000>;
57+
regulator-max-microvolt = <3300000>;
58+
regulator-ramp-delay = <0>;
59+
regulator-always-on;
60+
regulator-boot-on;
61+
};
62+
63+
mt6380_vphy_reg: ldo-vphy {
64+
regulator-name = "vphy";
65+
regulator-min-microvolt = <1800000>;
66+
regulator-max-microvolt = <1800000>;
67+
regulator-ramp-delay = <0>;
68+
regulator-always-on;
69+
regulator-boot-on;
70+
};
71+
72+
mt6380_vddr_reg: ldo-vddr {
73+
regulator-name = "vddr";
74+
regulator-min-microvolt = <1240000>;
75+
regulator-max-microvolt = <1840000>;
76+
regulator-ramp-delay = <0>;
77+
regulator-always-on;
78+
regulator-boot-on;
79+
};
80+
81+
mt6380_vt_reg: ldo-vt {
82+
regulator-name = "vt";
83+
regulator-min-microvolt = <2200000>;
84+
regulator-max-microvolt = <3300000>;
85+
regulator-ramp-delay = <0>;
86+
regulator-always-on;
87+
regulator-boot-on;
88+
};
89+
};

Documentation/devicetree/bindings/regulator/mt6397-regulator.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Mediatek MT6397 Regulator Driver
1+
Mediatek MT6397 Regulator
22

33
Required properties:
44
- compatible: "mediatek,mt6397-regulator"

Documentation/devicetree/bindings/regulator/pwm-regulator.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Continuous Voltage With Enable GPIO Example:
7171
* Inverted PWM logic, and the duty cycle range is limited
7272
* to 30%-70%.
7373
*/
74-
pwm-dutycycle-range <700 300>; /* */
74+
pwm-dutycycle-range = <700 300>; /* */
7575
};
7676

7777
Voltage Table Example:
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
STM32 VREFBUF - Voltage reference buffer
2+
3+
Some STM32 devices embed a voltage reference buffer which can be used as
4+
voltage reference for ADCs, DACs and also as voltage reference for external
5+
components through the dedicated VREF+ pin.
6+
7+
Required properties:
8+
- compatible: Must be "st,stm32-vrefbuf".
9+
- reg: Offset and length of VREFBUF register set.
10+
- clocks: Must contain an entry for peripheral clock.
11+
12+
Example:
13+
vrefbuf: regulator@58003C00 {
14+
compatible = "st,stm32-vrefbuf";
15+
reg = <0x58003C00 0x8>;
16+
clocks = <&rcc VREF_CK>;
17+
regulator-min-microvolt = <1500000>;
18+
regulator-max-microvolt = <2500000>;
19+
vdda-supply = <&vdda>;
20+
};

drivers/regulator/Kconfig

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,15 @@ config REGULATOR_MT6323
559559
This driver supports the control of different power rails of device
560560
through regulator interface.
561561

562+
config REGULATOR_MT6380
563+
tristate "MediaTek MT6380 PMIC"
564+
depends on MTK_PMIC_WRAP
565+
help
566+
Say y here to select this option to enable the power regulator of
567+
MediaTek MT6380 PMIC.
568+
This driver supports the control of different power rails of device
569+
through regulator interface.
570+
562571
config REGULATOR_MT6397
563572
tristate "MediaTek MT6397 PMIC"
564573
depends on MFD_MT6397
@@ -700,8 +709,8 @@ config REGULATOR_RN5T618
700709
tristate "Ricoh RN5T567/618 voltage regulators"
701710
depends on MFD_RN5T618
702711
help
703-
Say y here to support the regulators found on Ricoh RN5T567 or
704-
RN5T618 PMIC.
712+
Say y here to support the regulators found on Ricoh RN5T567,
713+
RN5T618 or RC5T619 PMIC.
705714

706715
config REGULATOR_RT5033
707716
tristate "Richtek RT5033 Regulators"
@@ -746,6 +755,18 @@ config REGULATOR_SKY81452
746755
This driver can also be built as a module. If so, the module
747756
will be called sky81452-regulator.
748757

758+
config REGULATOR_STM32_VREFBUF
759+
tristate "STMicroelectronics STM32 VREFBUF"
760+
depends on ARCH_STM32 || COMPILE_TEST
761+
help
762+
This driver supports STMicroelectronics STM32 VREFBUF (voltage
763+
reference buffer) which can be used as voltage reference for
764+
internal ADCs, DACs and also for external components through
765+
dedicated Vref+ pin.
766+
767+
This driver can also be built as a module. If so, the module
768+
will be called stm32-vrefbuf.
769+
749770
config REGULATOR_TI_ABB
750771
tristate "TI Adaptive Body Bias on-chip LDO"
751772
depends on ARCH_OMAP

drivers/regulator/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o
7272
obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o
7373
obj-$(CONFIG_REGULATOR_MT6311) += mt6311-regulator.o
7474
obj-$(CONFIG_REGULATOR_MT6323) += mt6323-regulator.o
75+
obj-$(CONFIG_REGULATOR_MT6380) += mt6380-regulator.o
7576
obj-$(CONFIG_REGULATOR_MT6397) += mt6397-regulator.o
7677
obj-$(CONFIG_REGULATOR_QCOM_RPM) += qcom_rpm-regulator.o
7778
obj-$(CONFIG_REGULATOR_QCOM_SMD_RPM) += qcom_smd-regulator.o
@@ -94,6 +95,7 @@ obj-$(CONFIG_REGULATOR_S2MPA01) += s2mpa01.o
9495
obj-$(CONFIG_REGULATOR_S2MPS11) += s2mps11.o
9596
obj-$(CONFIG_REGULATOR_S5M8767) += s5m8767.o
9697
obj-$(CONFIG_REGULATOR_SKY81452) += sky81452-regulator.o
98+
obj-$(CONFIG_REGULATOR_STM32_VREFBUF) += stm32-vrefbuf.o
9799
obj-$(CONFIG_REGULATOR_STW481X_VMMC) += stw481x-vmmc.o
98100
obj-$(CONFIG_REGULATOR_TI_ABB) += ti-abb-regulator.o
99101
obj-$(CONFIG_REGULATOR_TPS6105X) += tps6105x-regulator.o

drivers/regulator/axp20x-regulator.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,9 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
691691
(regulators == axp809_regulators && i == AXP809_DC1SW)) {
692692
new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
693693
GFP_KERNEL);
694+
if (!new_desc)
695+
return -ENOMEM;
696+
694697
*new_desc = regulators[i];
695698
new_desc->supply_name = dcdc1_name;
696699
desc = new_desc;
@@ -700,6 +703,9 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
700703
(regulators == axp809_regulators && i == AXP809_DC5LDO)) {
701704
new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc),
702705
GFP_KERNEL);
706+
if (!new_desc)
707+
return -ENOMEM;
708+
703709
*new_desc = regulators[i];
704710
new_desc->supply_name = dcdc5_name;
705711
desc = new_desc;

drivers/regulator/core.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ static struct device_node *of_get_regulator(struct device *dev, const char *supp
204204
regnode = of_parse_phandle(dev->of_node, prop_name, 0);
205205

206206
if (!regnode) {
207-
dev_dbg(dev, "Looking up %s property in node %s failed\n",
208-
prop_name, dev->of_node->full_name);
207+
dev_dbg(dev, "Looking up %s property in node %pOF failed\n",
208+
prop_name, dev->of_node);
209209
return NULL;
210210
}
211211
return regnode;
@@ -2396,6 +2396,14 @@ static void regulator_disable_work(struct work_struct *work)
23962396
count = rdev->deferred_disables;
23972397
rdev->deferred_disables = 0;
23982398

2399+
/*
2400+
* Workqueue functions queue the new work instance while the previous
2401+
* work instance is being processed. Cancel the queued work instance
2402+
* as the work instance under processing does the job of the queued
2403+
* work instance.
2404+
*/
2405+
cancel_delayed_work(&rdev->disable_work);
2406+
23992407
for (i = 0; i < count; i++) {
24002408
ret = _regulator_disable(rdev);
24012409
if (ret != 0)
@@ -2439,10 +2447,10 @@ int regulator_disable_deferred(struct regulator *regulator, int ms)
24392447

24402448
mutex_lock(&rdev->mutex);
24412449
rdev->deferred_disables++;
2450+
mod_delayed_work(system_power_efficient_wq, &rdev->disable_work,
2451+
msecs_to_jiffies(ms));
24422452
mutex_unlock(&rdev->mutex);
24432453

2444-
queue_delayed_work(system_power_efficient_wq, &rdev->disable_work,
2445-
msecs_to_jiffies(ms));
24462454
return 0;
24472455
}
24482456
EXPORT_SYMBOL_GPL(regulator_disable_deferred);

drivers/regulator/cpcap-regulator.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
#define CPCAP_BIT_VAUDIO_MODE0 BIT(1)
7878
#define CPCAP_BIT_V_AUDIO_EN BIT(0)
7979

80+
#define CPCAP_BIT_AUDIO_NORMAL_MODE 0x00
81+
8082
/*
8183
* Off mode configuration bit. Used currently only by SW5 on omap4. There's
8284
* the following comment in Motorola Linux kernel tree for it:
@@ -121,6 +123,7 @@ struct cpcap_regulator {
121123
.enable_val = (mode_val), \
122124
.disable_val = (off_val), \
123125
.ramp_delay = (volt_trans_time), \
126+
.of_map_mode = cpcap_map_mode, \
124127
}, \
125128
.assign_reg = (assignment_reg), \
126129
.assign_mask = (assignment_mask), \
@@ -211,13 +214,25 @@ static int cpcap_regulator_disable(struct regulator_dev *rdev)
211214
return error;
212215
}
213216

217+
static unsigned int cpcap_map_mode(unsigned int mode)
218+
{
219+
switch (mode) {
220+
case CPCAP_BIT_AUDIO_NORMAL_MODE:
221+
return REGULATOR_MODE_NORMAL;
222+
case CPCAP_BIT_AUDIO_LOW_PWR:
223+
return REGULATOR_MODE_STANDBY;
224+
default:
225+
return -EINVAL;
226+
}
227+
}
228+
214229
static unsigned int cpcap_regulator_get_mode(struct regulator_dev *rdev)
215230
{
216231
int value;
217232

218233
regmap_read(rdev->regmap, rdev->desc->enable_reg, &value);
219234

220-
if (!(value & CPCAP_BIT_AUDIO_LOW_PWR))
235+
if (value & CPCAP_BIT_AUDIO_LOW_PWR)
221236
return REGULATOR_MODE_STANDBY;
222237

223238
return REGULATOR_MODE_NORMAL;
@@ -230,10 +245,10 @@ static int cpcap_regulator_set_mode(struct regulator_dev *rdev,
230245

231246
switch (mode) {
232247
case REGULATOR_MODE_NORMAL:
233-
value = CPCAP_BIT_AUDIO_LOW_PWR;
248+
value = CPCAP_BIT_AUDIO_NORMAL_MODE;
234249
break;
235250
case REGULATOR_MODE_STANDBY:
236-
value = 0;
251+
value = CPCAP_BIT_AUDIO_LOW_PWR;
237252
break;
238253
default:
239254
return -EINVAL;

drivers/regulator/da9063-regulator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ static int da9063_regulator_probe(struct platform_device *pdev)
736736
if (IS_ERR(regl_pdata) || regl_pdata->n_regulators == 0) {
737737
dev_err(&pdev->dev,
738738
"No regulators defined for the platform\n");
739-
return PTR_ERR(regl_pdata);
739+
return -ENODEV;
740740
}
741741

742742
/* Find regulators set for particular device model */

drivers/regulator/fan53555.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -407,14 +407,8 @@ static int fan53555_regulator_probe(struct i2c_client *client,
407407

408408
di->regulator = pdata->regulator;
409409
if (client->dev.of_node) {
410-
const struct of_device_id *match;
411-
412-
match = of_match_device(of_match_ptr(fan53555_dt_ids),
413-
&client->dev);
414-
if (!match)
415-
return -ENODEV;
416-
417-
di->vendor = (unsigned long) match->data;
410+
di->vendor =
411+
(unsigned long)of_device_get_match_data(&client->dev);
418412
} else {
419413
/* if no ramp constraint set, get the pdata ramp_delay */
420414
if (!di->regulator->constraints.ramp_delay) {
@@ -476,7 +470,10 @@ static const struct i2c_device_id fan53555_id[] = {
476470
.name = "fan53555",
477471
.driver_data = FAN53555_VENDOR_FAIRCHILD
478472
}, {
479-
.name = "syr82x",
473+
.name = "syr827",
474+
.driver_data = FAN53555_VENDOR_SILERGY
475+
}, {
476+
.name = "syr828",
480477
.driver_data = FAN53555_VENDOR_SILERGY
481478
},
482479
{ },

drivers/regulator/ltc3589.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ static int ltc3589_probe(struct i2c_client *client,
539539
return 0;
540540
}
541541

542-
static struct i2c_device_id ltc3589_i2c_id[] = {
542+
static const struct i2c_device_id ltc3589_i2c_id[] = {
543543
{ "ltc3589", LTC3589 },
544544
{ "ltc3589-1", LTC3589_1 },
545545
{ "ltc3589-2", LTC3589_2 },

drivers/regulator/max1586.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static int of_get_max1586_platform_data(struct device *dev,
169169

170170
if (of_property_read_u32(np, "v3-gain",
171171
&pdata->v3_gain) < 0) {
172-
dev_err(dev, "%s has no 'v3-gain' property\n", np->full_name);
172+
dev_err(dev, "%pOF has no 'v3-gain' property\n", np);
173173
return -EINVAL;
174174
}
175175

0 commit comments

Comments
 (0)