aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-13 12:36:45 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-13 12:36:45 -0500
commit5f194bf4853bcb6e7442518b70fb20a875ed34f0 (patch)
tree97b9381352a892d8de757897322b2493015e32c1
parent1e19bded7f5d5152b7f53ee7356241ecb18905b0 (diff)
parent50b7baefe3e5a96f5aa8e9565fcfb0bda240b905 (diff)
Merge tag 'regulator-v4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown: "A very quiet release for regulator, there's some new device support in existing drivers here and a few fixes but nothing in the core. Summary: - New device support for Allwinner AXP813, Dialog DA223/4/5 and Qualcomm PMI8994" * tag 'regulator-v4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: regulator: tps65218: remove unused tps_info structure regulator: tps65218: Fix strobe assignment regulator: qcom_spmi: Include offset when translating voltages regulator: qcom_spmi: Add support for pmi8994 regulator: da9211: update for supporting da9223/4/5 ASoC: pfuze100: Remove leading zero from '@08' notation regulator: axp20x: Simplify axp20x_is_polyphase_slave implementation regulator: axp20x: Add support for AXP813 regulators
-rw-r--r--Documentation/devicetree/bindings/regulator/da9211.txt82
-rw-r--r--Documentation/devicetree/bindings/regulator/pfuze100.txt6
-rw-r--r--Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt13
-rw-r--r--drivers/regulator/Kconfig2
-rw-r--r--drivers/regulator/axp20x-regulator.c92
-rw-r--r--drivers/regulator/da9211-regulator.c14
-rw-r--r--drivers/regulator/da9211-regulator.h2
-rw-r--r--drivers/regulator/qcom_spmi-regulator.c48
-rw-r--r--drivers/regulator/tps65218-regulator.c2
-rw-r--r--include/linux/mfd/axp20x.h3
-rw-r--r--include/linux/mfd/tps65218.h19
-rw-r--r--include/linux/regulator/da9211.h5
12 files changed, 241 insertions, 47 deletions
diff --git a/Documentation/devicetree/bindings/regulator/da9211.txt b/Documentation/devicetree/bindings/regulator/da9211.txt
index 0f2a6f8fcafd..27717e816e71 100644
--- a/Documentation/devicetree/bindings/regulator/da9211.txt
+++ b/Documentation/devicetree/bindings/regulator/da9211.txt
@@ -1,8 +1,9 @@
1* Dialog Semiconductor DA9211/DA9212/DA9213/DA9214/DA9215 Voltage Regulator 1* Dialog Semiconductor DA9211/DA9212/DA9213/DA9223/DA9214/DA9224/DA9215/DA9225
2 Voltage Regulator
2 3
3Required properties: 4Required properties:
4- compatible: "dlg,da9211" or "dlg,da9212" or "dlg,da9213" 5- compatible: "dlg,da9211" or "dlg,da9212" or "dlg,da9213" or "dlg,da9223"
5 or "dlg,da9214" or "dlg,da9215" 6 or "dlg,da9214" or "dlg,da9224" or "dlg,da9215" or "dlg,da9225"
6- reg: I2C slave address, usually 0x68. 7- reg: I2C slave address, usually 0x68.
7- interrupts: the interrupt outputs of the controller 8- interrupts: the interrupt outputs of the controller
8- regulators: A node that houses a sub-node for each regulator within the 9- regulators: A node that houses a sub-node for each regulator within the
@@ -16,7 +17,6 @@ Optional properties:
16- Any optional property defined in regulator.txt 17- Any optional property defined in regulator.txt
17 18
18Example 1) DA9211 19Example 1) DA9211
19
20 pmic: da9211@68 { 20 pmic: da9211@68 {
21 compatible = "dlg,da9211"; 21 compatible = "dlg,da9211";
22 reg = <0x68>; 22 reg = <0x68>;
@@ -35,7 +35,6 @@ Example 1) DA9211
35 }; 35 };
36 36
37Example 2) DA9212 37Example 2) DA9212
38
39 pmic: da9212@68 { 38 pmic: da9212@68 {
40 compatible = "dlg,da9212"; 39 compatible = "dlg,da9212";
41 reg = <0x68>; 40 reg = <0x68>;
@@ -79,7 +78,25 @@ Example 3) DA9213
79 }; 78 };
80 }; 79 };
81 80
82Example 4) DA9214 81Example 4) DA9223
82 pmic: da9223@68 {
83 compatible = "dlg,da9223";
84 reg = <0x68>;
85 interrupts = <3 27>;
86
87 regulators {
88 BUCKA {
89 regulator-name = "VBUCKA";
90 regulator-min-microvolt = < 300000>;
91 regulator-max-microvolt = <1570000>;
92 regulator-min-microamp = <3000000>;
93 regulator-max-microamp = <6000000>;
94 enable-gpios = <&gpio 27 0>;
95 };
96 };
97 };
98
99Example 5) DA9214
83 pmic: da9214@68 { 100 pmic: da9214@68 {
84 compatible = "dlg,da9214"; 101 compatible = "dlg,da9214";
85 reg = <0x68>; 102 reg = <0x68>;
@@ -105,7 +122,33 @@ Example 4) DA9214
105 }; 122 };
106 }; 123 };
107 124
108Example 5) DA9215 125Example 6) DA9224
126 pmic: da9224@68 {
127 compatible = "dlg,da9224";
128 reg = <0x68>;
129 interrupts = <3 27>;
130
131 regulators {
132 BUCKA {
133 regulator-name = "VBUCKA";
134 regulator-min-microvolt = < 300000>;
135 regulator-max-microvolt = <1570000>;
136 regulator-min-microamp = <3000000>;
137 regulator-max-microamp = <6000000>;
138 enable-gpios = <&gpio 27 0>;
139 };
140 BUCKB {
141 regulator-name = "VBUCKB";
142 regulator-min-microvolt = < 300000>;
143 regulator-max-microvolt = <1570000>;
144 regulator-min-microamp = <3000000>;
145 regulator-max-microamp = <6000000>;
146 enable-gpios = <&gpio 17 0>;
147 };
148 };
149 };
150
151Example 7) DA9215
109 pmic: da9215@68 { 152 pmic: da9215@68 {
110 compatible = "dlg,da9215"; 153 compatible = "dlg,da9215";
111 reg = <0x68>; 154 reg = <0x68>;
@@ -131,3 +174,28 @@ Example 5) DA9215
131 }; 174 };
132 }; 175 };
133 176
177Example 8) DA9225
178 pmic: da9225@68 {
179 compatible = "dlg,da9225";
180 reg = <0x68>;
181 interrupts = <3 27>;
182
183 regulators {
184 BUCKA {
185 regulator-name = "VBUCKA";
186 regulator-min-microvolt = < 300000>;
187 regulator-max-microvolt = <1570000>;
188 regulator-min-microamp = <4000000>;
189 regulator-max-microamp = <7000000>;
190 enable-gpios = <&gpio 27 0>;
191 };
192 BUCKB {
193 regulator-name = "VBUCKB";
194 regulator-min-microvolt = < 300000>;
195 regulator-max-microvolt = <1570000>;
196 regulator-min-microamp = <4000000>;
197 regulator-max-microamp = <7000000>;
198 enable-gpios = <&gpio 17 0>;
199 };
200 };
201 };
diff --git a/Documentation/devicetree/bindings/regulator/pfuze100.txt b/Documentation/devicetree/bindings/regulator/pfuze100.txt
index 444c47831a40..c6dd3f5e485b 100644
--- a/Documentation/devicetree/bindings/regulator/pfuze100.txt
+++ b/Documentation/devicetree/bindings/regulator/pfuze100.txt
@@ -21,7 +21,7 @@ Each regulator is defined using the standard binding for regulators.
21 21
22Example 1: PFUZE100 22Example 1: PFUZE100
23 23
24 pmic: pfuze100@08 { 24 pmic: pfuze100@8 {
25 compatible = "fsl,pfuze100"; 25 compatible = "fsl,pfuze100";
26 reg = <0x08>; 26 reg = <0x08>;
27 27
@@ -122,7 +122,7 @@ Example 1: PFUZE100
122 122
123Example 2: PFUZE200 123Example 2: PFUZE200
124 124
125 pmic: pfuze200@08 { 125 pmic: pfuze200@8 {
126 compatible = "fsl,pfuze200"; 126 compatible = "fsl,pfuze200";
127 reg = <0x08>; 127 reg = <0x08>;
128 128
@@ -216,7 +216,7 @@ Example 2: PFUZE200
216 216
217Example 3: PFUZE3000 217Example 3: PFUZE3000
218 218
219 pmic: pfuze3000@08 { 219 pmic: pfuze3000@8 {
220 compatible = "fsl,pfuze3000"; 220 compatible = "fsl,pfuze3000";
221 reg = <0x08>; 221 reg = <0x08>;
222 222
diff --git a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
index 0fa3b0fac129..57d2c65899df 100644
--- a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
@@ -8,6 +8,7 @@ Qualcomm SPMI Regulators
8 "qcom,pm8916-regulators" 8 "qcom,pm8916-regulators"
9 "qcom,pm8941-regulators" 9 "qcom,pm8941-regulators"
10 "qcom,pm8994-regulators" 10 "qcom,pm8994-regulators"
11 "qcom,pmi8994-regulators"
11 12
12- interrupts: 13- interrupts:
13 Usage: optional 14 Usage: optional
@@ -100,6 +101,15 @@ Qualcomm SPMI Regulators
100 Definition: Reference to regulator supplying the input pin, as 101 Definition: Reference to regulator supplying the input pin, as
101 described in the data sheet. 102 described in the data sheet.
102 103
104- vdd_s1-supply:
105- vdd_s2-supply:
106- vdd_s3-supply:
107- vdd_l1-supply:
108 Usage: optional (pmi8994 only)
109 Value type: <phandle>
110 Definition: Reference to regulator supplying the input pin, as
111 described in the data sheet.
112
103 113
104The regulator node houses sub-nodes for each regulator within the device. Each 114The regulator node houses sub-nodes for each regulator within the device. Each
105sub-node is identified using the node's name, with valid values listed for each 115sub-node is identified using the node's name, with valid values listed for each
@@ -122,6 +132,9 @@ pm8994:
122 l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19, l20, 132 l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19, l20,
123 l21, l22, l23, l24, l25, l26, l27, l28, l29, l30, l31, l32, lvs1, lvs2 133 l21, l22, l23, l24, l25, l26, l27, l28, l29, l30, l31, l32, lvs1, lvs2
124 134
135pmi8994:
136 s1, s2, s3, l1
137
125The content of each sub-node is defined by the standard binding for regulators - 138The content of each sub-node is defined by the standard binding for regulators -
126see regulator.txt - with additional custom properties described below: 139see regulator.txt - with additional custom properties described below:
127 140
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 0fd6195601ba..96cd55f9e3c5 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -244,7 +244,7 @@ config REGULATOR_DA9210
244 interface. 244 interface.
245 245
246config REGULATOR_DA9211 246config REGULATOR_DA9211
247 tristate "Dialog Semiconductor DA9211/DA9212/DA9213/DA9214/DA9215 regulator" 247 tristate "Dialog Semiconductor DA9211/DA9212/DA9213/DA9223/DA9214/DA9224/DA9215/DA9225 regulator"
248 depends on I2C 248 depends on I2C
249 select REGMAP_I2C 249 select REGMAP_I2C
250 help 250 help
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c
index 376a99b7cf5d..181622b2813d 100644
--- a/drivers/regulator/axp20x-regulator.c
+++ b/drivers/regulator/axp20x-regulator.c
@@ -244,6 +244,7 @@ static const struct regulator_desc axp22x_drivevbus_regulator = {
244 .ops = &axp20x_ops_sw, 244 .ops = &axp20x_ops_sw,
245}; 245};
246 246
247/* DCDC ranges shared with AXP813 */
247static const struct regulator_linear_range axp803_dcdc234_ranges[] = { 248static const struct regulator_linear_range axp803_dcdc234_ranges[] = {
248 REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000), 249 REGULATOR_LINEAR_RANGE(500000, 0x0, 0x46, 10000),
249 REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x4b, 20000), 250 REGULATOR_LINEAR_RANGE(1220000, 0x47, 0x4b, 20000),
@@ -426,6 +427,69 @@ static const struct regulator_desc axp809_regulators[] = {
426 AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)), 427 AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)),
427}; 428};
428 429
430static const struct regulator_desc axp813_regulators[] = {
431 AXP_DESC(AXP813, DCDC1, "dcdc1", "vin1", 1600, 3400, 100,
432 AXP803_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(0)),
433 AXP_DESC_RANGES(AXP813, DCDC2, "dcdc2", "vin2", axp803_dcdc234_ranges,
434 76, AXP803_DCDC2_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
435 BIT(1)),
436 AXP_DESC_RANGES(AXP813, DCDC3, "dcdc3", "vin3", axp803_dcdc234_ranges,
437 76, AXP803_DCDC3_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
438 BIT(2)),
439 AXP_DESC_RANGES(AXP813, DCDC4, "dcdc4", "vin4", axp803_dcdc234_ranges,
440 76, AXP803_DCDC4_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
441 BIT(3)),
442 AXP_DESC_RANGES(AXP813, DCDC5, "dcdc5", "vin5", axp803_dcdc5_ranges,
443 68, AXP803_DCDC5_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
444 BIT(4)),
445 AXP_DESC_RANGES(AXP813, DCDC6, "dcdc6", "vin6", axp803_dcdc6_ranges,
446 72, AXP803_DCDC6_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
447 BIT(5)),
448 AXP_DESC_RANGES(AXP813, DCDC7, "dcdc7", "vin7", axp803_dcdc6_ranges,
449 72, AXP813_DCDC7_V_OUT, 0x7f, AXP22X_PWR_OUT_CTRL1,
450 BIT(6)),
451 AXP_DESC(AXP813, ALDO1, "aldo1", "aldoin", 700, 3300, 100,
452 AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(5)),
453 AXP_DESC(AXP813, ALDO2, "aldo2", "aldoin", 700, 3300, 100,
454 AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(6)),
455 AXP_DESC(AXP813, ALDO3, "aldo3", "aldoin", 700, 3300, 100,
456 AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL3, BIT(7)),
457 AXP_DESC(AXP813, DLDO1, "dldo1", "dldoin", 700, 3300, 100,
458 AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(3)),
459 AXP_DESC_RANGES(AXP813, DLDO2, "dldo2", "dldoin", axp803_dldo2_ranges,
460 32, AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2,
461 BIT(4)),
462 AXP_DESC(AXP813, DLDO3, "dldo3", "dldoin", 700, 3300, 100,
463 AXP22X_DLDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)),
464 AXP_DESC(AXP813, DLDO4, "dldo4", "dldoin", 700, 3300, 100,
465 AXP22X_DLDO4_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(6)),
466 AXP_DESC(AXP813, ELDO1, "eldo1", "eldoin", 700, 1900, 50,
467 AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)),
468 AXP_DESC(AXP813, ELDO2, "eldo2", "eldoin", 700, 1900, 50,
469 AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)),
470 AXP_DESC(AXP813, ELDO3, "eldo3", "eldoin", 700, 1900, 50,
471 AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)),
472 /* to do / check ... */
473 AXP_DESC(AXP813, FLDO1, "fldo1", "fldoin", 700, 1450, 50,
474 AXP803_FLDO1_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(2)),
475 AXP_DESC(AXP813, FLDO2, "fldo2", "fldoin", 700, 1450, 50,
476 AXP803_FLDO2_V_OUT, 0x0f, AXP22X_PWR_OUT_CTRL3, BIT(3)),
477 /*
478 * TODO: FLDO3 = {DCDC5, FLDOIN} / 2
479 *
480 * This means FLDO3 effectively switches supplies at runtime,
481 * something the regulator subsystem does not support.
482 */
483 AXP_DESC_FIXED(AXP813, RTC_LDO, "rtc-ldo", "ips", 1800),
484 AXP_DESC_IO(AXP813, LDO_IO0, "ldo-io0", "ips", 700, 3300, 100,
485 AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07,
486 AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
487 AXP_DESC_IO(AXP813, LDO_IO1, "ldo-io1", "ips", 700, 3300, 100,
488 AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07,
489 AXP22X_IO_ENABLED, AXP22X_IO_DISABLED),
490 AXP_DESC_SW(AXP813, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(7)),
491};
492
429static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) 493static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
430{ 494{
431 struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); 495 struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
@@ -441,9 +505,10 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq)
441 step = 75; 505 step = 75;
442 break; 506 break;
443 case AXP803_ID: 507 case AXP803_ID:
508 case AXP813_ID:
444 /* 509 /*
445 * AXP803 DCDC work frequency setting has the same range and 510 * AXP803/AXP813 DCDC work frequency setting has the same
446 * step as AXP22X, but at a different register. 511 * range and step as AXP22X, but at a different register.
447 * Fall through to the check below. 512 * Fall through to the check below.
448 * (See include/linux/mfd/axp20x.h) 513 * (See include/linux/mfd/axp20x.h)
449 */ 514 */
@@ -561,6 +626,14 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work
561 workmode <<= id - AXP803_DCDC1; 626 workmode <<= id - AXP803_DCDC1;
562 break; 627 break;
563 628
629 case AXP813_ID:
630 if (id < AXP813_DCDC1 || id > AXP813_DCDC7)
631 return -EINVAL;
632
633 mask = AXP22X_WORKMODE_DCDCX_MASK(id - AXP813_DCDC1);
634 workmode <<= id - AXP813_DCDC1;
635 break;
636
564 default: 637 default:
565 /* should not happen */ 638 /* should not happen */
566 WARN_ON(1); 639 WARN_ON(1);
@@ -579,11 +652,12 @@ static bool axp20x_is_polyphase_slave(struct axp20x_dev *axp20x, int id)
579 u32 reg = 0; 652 u32 reg = 0;
580 653
581 /* 654 /*
582 * Currently in our supported AXP variants, only AXP803 and AXP806 655 * Currently in our supported AXP variants, only AXP803, AXP806,
583 * have polyphase regulators. 656 * and AXP813 have polyphase regulators.
584 */ 657 */
585 switch (axp20x->variant) { 658 switch (axp20x->variant) {
586 case AXP803_ID: 659 case AXP803_ID:
660 case AXP813_ID:
587 regmap_read(axp20x->regmap, AXP803_POLYPHASE_CTRL, &reg); 661 regmap_read(axp20x->regmap, AXP803_POLYPHASE_CTRL, &reg);
588 662
589 switch (id) { 663 switch (id) {
@@ -656,6 +730,12 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
656 regulators = axp809_regulators; 730 regulators = axp809_regulators;
657 nregulators = AXP809_REG_ID_MAX; 731 nregulators = AXP809_REG_ID_MAX;
658 break; 732 break;
733 case AXP813_ID:
734 regulators = axp813_regulators;
735 nregulators = AXP813_REG_ID_MAX;
736 drivevbus = of_property_read_bool(pdev->dev.parent->of_node,
737 "x-powers,drive-vbus-en");
738 break;
659 default: 739 default:
660 dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n", 740 dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n",
661 axp20x->variant); 741 axp20x->variant);
@@ -677,6 +757,10 @@ static int axp20x_regulator_probe(struct platform_device *pdev)
677 if (axp20x_is_polyphase_slave(axp20x, i)) 757 if (axp20x_is_polyphase_slave(axp20x, i))
678 continue; 758 continue;
679 759
760 /* Support for AXP813's FLDO3 is not implemented */
761 if (axp20x->variant == AXP813_ID && i == AXP813_FLDO3)
762 continue;
763
680 /* 764 /*
681 * Regulators DC1SW and DC5LDO are connected internally, 765 * Regulators DC1SW and DC5LDO are connected internally,
682 * so we have to handle their supply names separately. 766 * so we have to handle their supply names separately.
diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c
index aa47280efd32..9b8f47617724 100644
--- a/drivers/regulator/da9211-regulator.c
+++ b/drivers/regulator/da9211-regulator.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * da9211-regulator.c - Regulator device driver for DA9211/DA9212 2 * da9211-regulator.c - Regulator device driver for DA9211/DA9212
3 * /DA9213/DA9214/DA9215 3 * /DA9213/DA9223/DA9214/DA9224/DA9215/DA9225
4 * Copyright (C) 2015 Dialog Semiconductor Ltd. 4 * Copyright (C) 2015 Dialog Semiconductor Ltd.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
@@ -496,8 +496,11 @@ static const struct i2c_device_id da9211_i2c_id[] = {
496 {"da9211", DA9211}, 496 {"da9211", DA9211},
497 {"da9212", DA9212}, 497 {"da9212", DA9212},
498 {"da9213", DA9213}, 498 {"da9213", DA9213},
499 {"da9223", DA9223},
499 {"da9214", DA9214}, 500 {"da9214", DA9214},
501 {"da9224", DA9224},
500 {"da9215", DA9215}, 502 {"da9215", DA9215},
503 {"da9225", DA9225},
501 {}, 504 {},
502}; 505};
503MODULE_DEVICE_TABLE(i2c, da9211_i2c_id); 506MODULE_DEVICE_TABLE(i2c, da9211_i2c_id);
@@ -507,8 +510,11 @@ static const struct of_device_id da9211_dt_ids[] = {
507 { .compatible = "dlg,da9211", .data = &da9211_i2c_id[0] }, 510 { .compatible = "dlg,da9211", .data = &da9211_i2c_id[0] },
508 { .compatible = "dlg,da9212", .data = &da9211_i2c_id[1] }, 511 { .compatible = "dlg,da9212", .data = &da9211_i2c_id[1] },
509 { .compatible = "dlg,da9213", .data = &da9211_i2c_id[2] }, 512 { .compatible = "dlg,da9213", .data = &da9211_i2c_id[2] },
510 { .compatible = "dlg,da9214", .data = &da9211_i2c_id[3] }, 513 { .compatible = "dlg,da9223", .data = &da9211_i2c_id[3] },
511 { .compatible = "dlg,da9215", .data = &da9211_i2c_id[4] }, 514 { .compatible = "dlg,da9214", .data = &da9211_i2c_id[4] },
515 { .compatible = "dlg,da9224", .data = &da9211_i2c_id[5] },
516 { .compatible = "dlg,da9215", .data = &da9211_i2c_id[6] },
517 { .compatible = "dlg,da9225", .data = &da9211_i2c_id[7] },
512 {}, 518 {},
513}; 519};
514MODULE_DEVICE_TABLE(of, da9211_dt_ids); 520MODULE_DEVICE_TABLE(of, da9211_dt_ids);
@@ -526,5 +532,5 @@ static struct i2c_driver da9211_regulator_driver = {
526module_i2c_driver(da9211_regulator_driver); 532module_i2c_driver(da9211_regulator_driver);
527 533
528MODULE_AUTHOR("James Ban <James.Ban.opensource@diasemi.com>"); 534MODULE_AUTHOR("James Ban <James.Ban.opensource@diasemi.com>");
529MODULE_DESCRIPTION("DA9211/DA9212/DA9213/DA9214/DA9215 regulator driver"); 535MODULE_DESCRIPTION("DA9211/DA9212/DA9213/DA9223/DA9214/DA9224/DA9215/DA9225 regulator driver");
530MODULE_LICENSE("GPL"); 536MODULE_LICENSE("GPL");
diff --git a/drivers/regulator/da9211-regulator.h b/drivers/regulator/da9211-regulator.h
index b841bbf330cc..2cb32aab4f82 100644
--- a/drivers/regulator/da9211-regulator.h
+++ b/drivers/regulator/da9211-regulator.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * da9211-regulator.h - Regulator definitions for DA9211/DA9212 2 * da9211-regulator.h - Regulator definitions for DA9211/DA9212
3 * /DA9213/DA9214/DA9215 3 * /DA9213/DA9223/DA9214/DA9224/DA9215/DA9225
4 * Copyright (C) 2015 Dialog Semiconductor Ltd. 4 * Copyright (C) 2015 Dialog Semiconductor Ltd.
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c
index 16c5f84e06a7..0241ada47d04 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -593,13 +593,20 @@ static int spmi_sw_selector_to_hw(struct spmi_regulator *vreg,
593 u8 *voltage_sel) 593 u8 *voltage_sel)
594{ 594{
595 const struct spmi_voltage_range *range, *end; 595 const struct spmi_voltage_range *range, *end;
596 unsigned offset;
596 597
597 range = vreg->set_points->range; 598 range = vreg->set_points->range;
598 end = range + vreg->set_points->count; 599 end = range + vreg->set_points->count;
599 600
600 for (; range < end; range++) { 601 for (; range < end; range++) {
601 if (selector < range->n_voltages) { 602 if (selector < range->n_voltages) {
602 *voltage_sel = selector; 603 /*
604 * hardware selectors between set point min and real
605 * min are invalid so we ignore them
606 */
607 offset = range->set_point_min_uV - range->min_uV;
608 offset /= range->step_uV;
609 *voltage_sel = selector + offset;
603 *range_sel = range->range_sel; 610 *range_sel = range->range_sel;
604 return 0; 611 return 0;
605 } 612 }
@@ -613,15 +620,35 @@ static int spmi_sw_selector_to_hw(struct spmi_regulator *vreg,
613static int spmi_hw_selector_to_sw(struct spmi_regulator *vreg, u8 hw_sel, 620static int spmi_hw_selector_to_sw(struct spmi_regulator *vreg, u8 hw_sel,
614 const struct spmi_voltage_range *range) 621 const struct spmi_voltage_range *range)
615{ 622{
616 int sw_sel = hw_sel; 623 unsigned sw_sel = 0;
624 unsigned offset, max_hw_sel;
617 const struct spmi_voltage_range *r = vreg->set_points->range; 625 const struct spmi_voltage_range *r = vreg->set_points->range;
618 626 const struct spmi_voltage_range *end = r + vreg->set_points->count;
619 while (r != range) { 627
628 for (; r < end; r++) {
629 if (r == range && range->n_voltages) {
630 /*
631 * hardware selectors between set point min and real
632 * min and between set point max and real max are
633 * invalid so we return an error if they're
634 * programmed into the hardware
635 */
636 offset = range->set_point_min_uV - range->min_uV;
637 offset /= range->step_uV;
638 if (hw_sel < offset)
639 return -EINVAL;
640
641 max_hw_sel = range->set_point_max_uV - range->min_uV;
642 max_hw_sel /= range->step_uV;
643 if (hw_sel > max_hw_sel)
644 return -EINVAL;
645
646 return sw_sel + hw_sel - offset;
647 }
620 sw_sel += r->n_voltages; 648 sw_sel += r->n_voltages;
621 r++;
622 } 649 }
623 650
624 return sw_sel; 651 return -EINVAL;
625} 652}
626 653
627static const struct spmi_voltage_range * 654static const struct spmi_voltage_range *
@@ -1619,11 +1646,20 @@ static const struct spmi_regulator_data pm8994_regulators[] = {
1619 { } 1646 { }
1620}; 1647};
1621 1648
1649static const struct spmi_regulator_data pmi8994_regulators[] = {
1650 { "s1", 0x1400, "vdd_s1", },
1651 { "s2", 0x1700, "vdd_s2", },
1652 { "s3", 0x1a00, "vdd_s3", },
1653 { "l1", 0x4000, "vdd_l1", },
1654 { }
1655};
1656
1622static const struct of_device_id qcom_spmi_regulator_match[] = { 1657static const struct of_device_id qcom_spmi_regulator_match[] = {
1623 { .compatible = "qcom,pm8841-regulators", .data = &pm8841_regulators }, 1658 { .compatible = "qcom,pm8841-regulators", .data = &pm8841_regulators },
1624 { .compatible = "qcom,pm8916-regulators", .data = &pm8916_regulators }, 1659 { .compatible = "qcom,pm8916-regulators", .data = &pm8916_regulators },
1625 { .compatible = "qcom,pm8941-regulators", .data = &pm8941_regulators }, 1660 { .compatible = "qcom,pm8941-regulators", .data = &pm8941_regulators },
1626 { .compatible = "qcom,pm8994-regulators", .data = &pm8994_regulators }, 1661 { .compatible = "qcom,pm8994-regulators", .data = &pm8994_regulators },
1662 { .compatible = "qcom,pmi8994-regulators", .data = &pmi8994_regulators },
1627 { } 1663 { }
1628}; 1664};
1629MODULE_DEVICE_TABLE(of, qcom_spmi_regulator_match); 1665MODULE_DEVICE_TABLE(of, qcom_spmi_regulator_match);
diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c
index 9aafbb03482d..bc489958fed7 100644
--- a/drivers/regulator/tps65218-regulator.c
+++ b/drivers/regulator/tps65218-regulator.c
@@ -154,7 +154,7 @@ static int tps65218_pmic_set_suspend_disable(struct regulator_dev *dev)
154 154
155 if (!tps->strobes[rid]) { 155 if (!tps->strobes[rid]) {
156 if (rid == TPS65218_DCDC_3) 156 if (rid == TPS65218_DCDC_3)
157 tps->info[rid]->strobe = 3; 157 tps->strobes[rid] = 3;
158 else 158 else
159 return -EINVAL; 159 return -EINVAL;
160 } 160 }
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index e9c908c4fba8..78dc85365c4f 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -131,6 +131,9 @@ enum axp20x_variants {
131#define AXP803_DCDC6_V_OUT 0x25 131#define AXP803_DCDC6_V_OUT 0x25
132#define AXP803_DCDC_FREQ_CTRL 0x3b 132#define AXP803_DCDC_FREQ_CTRL 0x3b
133 133
134/* Other DCDC regulator control registers are the same as AXP803 */
135#define AXP813_DCDC7_V_OUT 0x26
136
134/* Interrupt */ 137/* Interrupt */
135#define AXP152_IRQ1_EN 0x40 138#define AXP152_IRQ1_EN 0x40
136#define AXP152_IRQ2_EN 0x41 139#define AXP152_IRQ2_EN 0x41
diff --git a/include/linux/mfd/tps65218.h b/include/linux/mfd/tps65218.h
index bccd2d68b1e3..f069c518c0ed 100644
--- a/include/linux/mfd/tps65218.h
+++ b/include/linux/mfd/tps65218.h
@@ -246,24 +246,6 @@ enum tps65218_irqs {
246}; 246};
247 247
248/** 248/**
249 * struct tps_info - packages regulator constraints
250 * @id: Id of the regulator
251 * @name: Voltage regulator name
252 * @min_uV: minimum micro volts
253 * @max_uV: minimum micro volts
254 * @strobe: sequencing strobe value for the regulator
255 *
256 * This data is used to check the regualtor voltage limits while setting.
257 */
258struct tps_info {
259 int id;
260 const char *name;
261 int min_uV;
262 int max_uV;
263 int strobe;
264};
265
266/**
267 * struct tps65218 - tps65218 sub-driver chip access routines 249 * struct tps65218 - tps65218 sub-driver chip access routines
268 * 250 *
269 * Device data may be used to access the TPS65218 chip 251 * Device data may be used to access the TPS65218 chip
@@ -280,7 +262,6 @@ struct tps65218 {
280 u32 irq_mask; 262 u32 irq_mask;
281 struct regmap_irq_chip_data *irq_data; 263 struct regmap_irq_chip_data *irq_data;
282 struct regulator_desc desc[TPS65218_NUM_REGULATOR]; 264 struct regulator_desc desc[TPS65218_NUM_REGULATOR];
283 struct tps_info *info[TPS65218_NUM_REGULATOR];
284 struct regmap *regmap; 265 struct regmap *regmap;
285 u8 *strobes; 266 u8 *strobes;
286}; 267};
diff --git a/include/linux/regulator/da9211.h b/include/linux/regulator/da9211.h
index 80cb40b7c88d..f2fd2d3bf58f 100644
--- a/include/linux/regulator/da9211.h
+++ b/include/linux/regulator/da9211.h
@@ -1,6 +1,6 @@
1/* 1/*
2 * da9211.h - Regulator device driver for DA9211/DA9212 2 * da9211.h - Regulator device driver for DA9211/DA9212
3 * /DA9213/DA9214/DA9215 3 * /DA9213/DA9223/DA9214/DA9224/DA9215/DA9225
4 * Copyright (C) 2015 Dialog Semiconductor Ltd. 4 * Copyright (C) 2015 Dialog Semiconductor Ltd.
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
@@ -25,8 +25,11 @@ enum da9211_chip_id {
25 DA9211, 25 DA9211,
26 DA9212, 26 DA9212,
27 DA9213, 27 DA9213,
28 DA9223,
28 DA9214, 29 DA9214,
30 DA9224,
29 DA9215, 31 DA9215,
32 DA9225,
30}; 33};
31 34
32struct da9211_pdata { 35struct da9211_pdata {