diff options
51 files changed, 2010 insertions, 1849 deletions
diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt index 9455503b0299..d1762f3b30af 100644 --- a/Documentation/devicetree/bindings/mfd/axp20x.txt +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt | |||
| @@ -43,7 +43,7 @@ Optional properties: | |||
| 43 | regulator to drive the OTG VBus, rather then | 43 | regulator to drive the OTG VBus, rather then |
| 44 | as an input pin which signals whether the | 44 | as an input pin which signals whether the |
| 45 | board is driving OTG VBus or not. | 45 | board is driving OTG VBus or not. |
| 46 | (axp221 / axp223 / axp813 only) | 46 | (axp221 / axp223 / axp803/ axp813 only) |
| 47 | 47 | ||
| 48 | - x-powers,master-mode: Boolean (axp806 only). Set this when the PMIC is | 48 | - x-powers,master-mode: Boolean (axp806 only). Set this when the PMIC is |
| 49 | wired for master mode. The default is slave mode. | 49 | wired for master mode. The default is slave mode. |
| @@ -132,6 +132,7 @@ FLDO2 : LDO : fldoin-supply : shared supply | |||
| 132 | LDO_IO0 : LDO : ips-supply : GPIO 0 | 132 | LDO_IO0 : LDO : ips-supply : GPIO 0 |
| 133 | LDO_IO1 : LDO : ips-supply : GPIO 1 | 133 | LDO_IO1 : LDO : ips-supply : GPIO 1 |
| 134 | RTC_LDO : LDO : ips-supply : always on | 134 | RTC_LDO : LDO : ips-supply : always on |
| 135 | DRIVEVBUS : Enable output : drivevbus-supply : external regulator | ||
| 135 | 136 | ||
| 136 | AXP806 regulators, type, and corresponding input supply names: | 137 | AXP806 regulators, type, and corresponding input supply names: |
| 137 | 138 | ||
diff --git a/Documentation/devicetree/bindings/mfd/bd9571mwv.txt b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt index 9ab216a851d5..25d1f697eb25 100644 --- a/Documentation/devicetree/bindings/mfd/bd9571mwv.txt +++ b/Documentation/devicetree/bindings/mfd/bd9571mwv.txt | |||
| @@ -25,6 +25,25 @@ Required properties: | |||
| 25 | Each child node is defined using the standard | 25 | Each child node is defined using the standard |
| 26 | binding for regulators. | 26 | binding for regulators. |
| 27 | 27 | ||
| 28 | Optional properties: | ||
| 29 | - rohm,ddr-backup-power : Value to use for DDR-Backup Power (default 0). | ||
| 30 | This is a bitmask that specifies which DDR power | ||
| 31 | rails need to be kept powered when backup mode is | ||
| 32 | entered, for system suspend: | ||
| 33 | - bit 0: DDR0 | ||
| 34 | - bit 1: DDR1 | ||
| 35 | - bit 2: DDR0C | ||
| 36 | - bit 3: DDR1C | ||
| 37 | These bits match the KEEPON_DDR* bits in the | ||
| 38 | documentation for the "BKUP Mode Cnt" register. | ||
| 39 | - rohm,rstbmode-level: The RSTB signal is configured for level mode, to | ||
| 40 | accommodate a toggle power switch (the RSTBMODE pin is | ||
| 41 | strapped low). | ||
| 42 | - rohm,rstbmode-pulse: The RSTB signal is configured for pulse mode, to | ||
| 43 | accommodate a momentary power switch (the RSTBMODE pin | ||
| 44 | is strapped high). | ||
| 45 | The two properties above are mutually exclusive. | ||
| 46 | |||
| 28 | Example: | 47 | Example: |
| 29 | 48 | ||
| 30 | pmic: pmic@30 { | 49 | pmic: pmic@30 { |
| @@ -36,6 +55,8 @@ Example: | |||
| 36 | #interrupt-cells = <2>; | 55 | #interrupt-cells = <2>; |
| 37 | gpio-controller; | 56 | gpio-controller; |
| 38 | #gpio-cells = <2>; | 57 | #gpio-cells = <2>; |
| 58 | rohm,ddr-backup-power = <0xf>; | ||
| 59 | rohm,rstbmode-pulse; | ||
| 39 | 60 | ||
| 40 | regulators { | 61 | regulators { |
| 41 | dvfs: dvfs { | 62 | dvfs: dvfs { |
diff --git a/Documentation/devicetree/bindings/regulator/pfuze100.txt b/Documentation/devicetree/bindings/regulator/pfuze100.txt index c6dd3f5e485b..f0ada3b14d70 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 | ||
| 22 | Example 1: PFUZE100 | 22 | Example 1: PFUZE100 |
| 23 | 23 | ||
| 24 | pmic: pfuze100@8 { | 24 | pfuze100: pmic@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 | ||
| 123 | Example 2: PFUZE200 | 123 | Example 2: PFUZE200 |
| 124 | 124 | ||
| 125 | pmic: pfuze200@8 { | 125 | pfuze200: pmic@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 | ||
| 217 | Example 3: PFUZE3000 | 217 | Example 3: PFUZE3000 |
| 218 | 218 | ||
| 219 | pmic: pfuze3000@8 { | 219 | pfuze3000: pmic@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 57d2c65899df..406f2e570c50 100644 --- a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt | |||
| @@ -110,6 +110,11 @@ Qualcomm SPMI Regulators | |||
| 110 | Definition: Reference to regulator supplying the input pin, as | 110 | Definition: Reference to regulator supplying the input pin, as |
| 111 | described in the data sheet. | 111 | described in the data sheet. |
| 112 | 112 | ||
| 113 | - qcom,saw-reg: | ||
| 114 | Usage: optional | ||
| 115 | Value type: <phandle> | ||
| 116 | Description: Reference to syscon node defining the SAW registers. | ||
| 117 | |||
| 113 | 118 | ||
| 114 | The regulator node houses sub-nodes for each regulator within the device. Each | 119 | The regulator node houses sub-nodes for each regulator within the device. Each |
| 115 | sub-node is identified using the node's name, with valid values listed for each | 120 | sub-node is identified using the node's name, with valid values listed for each |
| @@ -201,6 +206,17 @@ see regulator.txt - with additional custom properties described below: | |||
| 201 | 2 = 0.55 uA | 206 | 2 = 0.55 uA |
| 202 | 3 = 0.75 uA | 207 | 3 = 0.75 uA |
| 203 | 208 | ||
| 209 | - qcom,saw-slave: | ||
| 210 | Usage: optional | ||
| 211 | Value type: <boo> | ||
| 212 | Description: SAW controlled gang slave. Will not be configured. | ||
| 213 | |||
| 214 | - qcom,saw-leader: | ||
| 215 | Usage: optional | ||
| 216 | Value type: <boo> | ||
| 217 | Description: SAW controlled gang leader. Will be configured as | ||
| 218 | SAW regulator. | ||
| 219 | |||
| 204 | Example: | 220 | Example: |
| 205 | 221 | ||
| 206 | regulators { | 222 | regulators { |
| @@ -221,3 +237,32 @@ Example: | |||
| 221 | 237 | ||
| 222 | .... | 238 | .... |
| 223 | }; | 239 | }; |
| 240 | |||
| 241 | Example 2: | ||
| 242 | |||
| 243 | saw3: syscon@9A10000 { | ||
| 244 | compatible = "syscon"; | ||
| 245 | reg = <0x9A10000 0x1000>; | ||
| 246 | }; | ||
| 247 | |||
| 248 | ... | ||
| 249 | |||
| 250 | spm-regulators { | ||
| 251 | compatible = "qcom,pm8994-regulators"; | ||
| 252 | qcom,saw-reg = <&saw3>; | ||
| 253 | s8 { | ||
| 254 | qcom,saw-slave; | ||
| 255 | }; | ||
| 256 | s9 { | ||
| 257 | qcom,saw-slave; | ||
| 258 | }; | ||
| 259 | s10 { | ||
| 260 | qcom,saw-slave; | ||
| 261 | }; | ||
| 262 | pm8994_s11_saw: s11 { | ||
| 263 | qcom,saw-leader; | ||
| 264 | regulator-always-on; | ||
| 265 | regulator-min-microvolt = <900000>; | ||
| 266 | regulator-max-microvolt = <1140000>; | ||
| 267 | }; | ||
| 268 | }; | ||
diff --git a/Documentation/devicetree/bindings/regulator/regulator.txt b/Documentation/devicetree/bindings/regulator/regulator.txt index 2babe15b618d..a7cd36877bfe 100644 --- a/Documentation/devicetree/bindings/regulator/regulator.txt +++ b/Documentation/devicetree/bindings/regulator/regulator.txt | |||
| @@ -59,6 +59,11 @@ Optional properties: | |||
| 59 | - regulator-initial-mode: initial operating mode. The set of possible operating | 59 | - regulator-initial-mode: initial operating mode. The set of possible operating |
| 60 | modes depends on the capabilities of every hardware so each device binding | 60 | modes depends on the capabilities of every hardware so each device binding |
| 61 | documentation explains which values the regulator supports. | 61 | documentation explains which values the regulator supports. |
| 62 | - regulator-allowed-modes: list of operating modes that software is allowed to | ||
| 63 | configure for the regulator at run-time. Elements may be specified in any | ||
| 64 | order. The set of possible operating modes depends on the capabilities of | ||
| 65 | every hardware so each device binding document explains which values the | ||
| 66 | regulator supports. | ||
| 62 | - regulator-system-load: Load in uA present on regulator that is not captured by | 67 | - regulator-system-load: Load in uA present on regulator that is not captured by |
| 63 | any consumer request. | 68 | any consumer request. |
| 64 | - regulator-pull-down: Enable pull down resistor when the regulator is disabled. | 69 | - regulator-pull-down: Enable pull down resistor when the regulator is disabled. |
| @@ -68,6 +73,11 @@ Optional properties: | |||
| 68 | 0: Disable active discharge. | 73 | 0: Disable active discharge. |
| 69 | 1: Enable active discharge. | 74 | 1: Enable active discharge. |
| 70 | Absence of this property will leave configuration to default. | 75 | Absence of this property will leave configuration to default. |
| 76 | - regulator-coupled-with: Regulators with which the regulator | ||
| 77 | is coupled. The linkage is 2-way - all coupled regulators should be linked | ||
| 78 | with each other. A regulator should not be coupled with its supplier. | ||
| 79 | - regulator-coupled-max-spread: Max spread between voltages of coupled regulators | ||
| 80 | in microvolts. | ||
| 71 | 81 | ||
| 72 | Deprecated properties: | 82 | Deprecated properties: |
| 73 | - regulator-compatible: If a regulator chip contains multiple | 83 | - regulator-compatible: If a regulator chip contains multiple |
diff --git a/Documentation/devicetree/bindings/regulator/rohm,bd71837-regulator.txt b/Documentation/devicetree/bindings/regulator/rohm,bd71837-regulator.txt new file mode 100644 index 000000000000..4edf3137d9f7 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/rohm,bd71837-regulator.txt | |||
| @@ -0,0 +1,126 @@ | |||
| 1 | ROHM BD71837 Power Management Integrated Circuit (PMIC) regulator bindings | ||
| 2 | |||
| 3 | BD71837MWV is a programmable Power Management | ||
| 4 | IC (PMIC) for powering single-core, dual-core, and | ||
| 5 | quad-core SoC’s such as NXP-i.MX 8M. It is optimized | ||
| 6 | for low BOM cost and compact solution footprint. It | ||
| 7 | integrates 8 Buck regulators and 7 LDO’s to provide all | ||
| 8 | the power rails required by the SoC and the commonly | ||
| 9 | used peripherals. | ||
| 10 | |||
| 11 | Required properties: | ||
| 12 | - regulator-name: should be "buck1", ..., "buck8" and "ldo1", ..., "ldo7" | ||
| 13 | |||
| 14 | List of regulators provided by this controller. BD71837 regulators node | ||
| 15 | should be sub node of the BD71837 MFD node. See BD71837 MFD bindings at | ||
| 16 | Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt | ||
| 17 | Regulator nodes should be named to BUCK_<number> and LDO_<number>. The | ||
| 18 | definition for each of these nodes is defined using the standard | ||
| 19 | binding for regulators at | ||
| 20 | Documentation/devicetree/bindings/regulator/regulator.txt. | ||
| 21 | Note that if BD71837 starts at RUN state you probably want to use | ||
| 22 | regulator-boot-on at least for BUCK6 and BUCK7 so that those are not | ||
| 23 | disabled by driver at startup. LDO5 and LDO6 are supplied by those and | ||
| 24 | if they are disabled at startup the voltage monitoring for LDO5/LDO6 will | ||
| 25 | cause PMIC to reset. | ||
| 26 | |||
| 27 | The valid names for regulator nodes are: | ||
| 28 | BUCK1, BUCK2, BUCK3, BUCK4, BUCK5, BUCK6, BUCK7, BUCK8 | ||
| 29 | LDO1, LDO2, LDO3, LDO4, LDO5, LDO6, LDO7 | ||
| 30 | |||
| 31 | Optional properties: | ||
| 32 | - Any optional property defined in bindings/regulator/regulator.txt | ||
| 33 | |||
| 34 | Example: | ||
| 35 | regulators { | ||
| 36 | buck1: BUCK1 { | ||
| 37 | regulator-name = "buck1"; | ||
| 38 | regulator-min-microvolt = <700000>; | ||
| 39 | regulator-max-microvolt = <1300000>; | ||
| 40 | regulator-boot-on; | ||
| 41 | regulator-ramp-delay = <1250>; | ||
| 42 | }; | ||
| 43 | buck2: BUCK2 { | ||
| 44 | regulator-name = "buck2"; | ||
| 45 | regulator-min-microvolt = <700000>; | ||
| 46 | regulator-max-microvolt = <1300000>; | ||
| 47 | regulator-boot-on; | ||
| 48 | regulator-always-on; | ||
| 49 | regulator-ramp-delay = <1250>; | ||
| 50 | }; | ||
| 51 | buck3: BUCK3 { | ||
| 52 | regulator-name = "buck3"; | ||
| 53 | regulator-min-microvolt = <700000>; | ||
| 54 | regulator-max-microvolt = <1300000>; | ||
| 55 | regulator-boot-on; | ||
| 56 | }; | ||
| 57 | buck4: BUCK4 { | ||
| 58 | regulator-name = "buck4"; | ||
| 59 | regulator-min-microvolt = <700000>; | ||
| 60 | regulator-max-microvolt = <1300000>; | ||
| 61 | regulator-boot-on; | ||
| 62 | }; | ||
| 63 | buck5: BUCK5 { | ||
| 64 | regulator-name = "buck5"; | ||
| 65 | regulator-min-microvolt = <700000>; | ||
| 66 | regulator-max-microvolt = <1350000>; | ||
| 67 | regulator-boot-on; | ||
| 68 | }; | ||
| 69 | buck6: BUCK6 { | ||
| 70 | regulator-name = "buck6"; | ||
| 71 | regulator-min-microvolt = <3000000>; | ||
| 72 | regulator-max-microvolt = <3300000>; | ||
| 73 | regulator-boot-on; | ||
| 74 | }; | ||
| 75 | buck7: BUCK7 { | ||
| 76 | regulator-name = "buck7"; | ||
| 77 | regulator-min-microvolt = <1605000>; | ||
| 78 | regulator-max-microvolt = <1995000>; | ||
| 79 | regulator-boot-on; | ||
| 80 | }; | ||
| 81 | buck8: BUCK8 { | ||
| 82 | regulator-name = "buck8"; | ||
| 83 | regulator-min-microvolt = <800000>; | ||
| 84 | regulator-max-microvolt = <1400000>; | ||
| 85 | }; | ||
| 86 | |||
| 87 | ldo1: LDO1 { | ||
| 88 | regulator-name = "ldo1"; | ||
| 89 | regulator-min-microvolt = <3000000>; | ||
| 90 | regulator-max-microvolt = <3300000>; | ||
| 91 | regulator-boot-on; | ||
| 92 | }; | ||
| 93 | ldo2: LDO2 { | ||
| 94 | regulator-name = "ldo2"; | ||
| 95 | regulator-min-microvolt = <900000>; | ||
| 96 | regulator-max-microvolt = <900000>; | ||
| 97 | regulator-boot-on; | ||
| 98 | }; | ||
| 99 | ldo3: LDO3 { | ||
| 100 | regulator-name = "ldo3"; | ||
| 101 | regulator-min-microvolt = <1800000>; | ||
| 102 | regulator-max-microvolt = <3300000>; | ||
| 103 | }; | ||
| 104 | ldo4: LDO4 { | ||
| 105 | regulator-name = "ldo4"; | ||
| 106 | regulator-min-microvolt = <900000>; | ||
| 107 | regulator-max-microvolt = <1800000>; | ||
| 108 | }; | ||
| 109 | ldo5: LDO5 { | ||
| 110 | regulator-name = "ldo5"; | ||
| 111 | regulator-min-microvolt = <1800000>; | ||
| 112 | regulator-max-microvolt = <3300000>; | ||
| 113 | }; | ||
| 114 | ldo6: LDO6 { | ||
| 115 | regulator-name = "ldo6"; | ||
| 116 | regulator-min-microvolt = <900000>; | ||
| 117 | regulator-max-microvolt = <1800000>; | ||
| 118 | }; | ||
| 119 | ldo7_reg: LDO7 { | ||
| 120 | regulator-name = "ldo7"; | ||
| 121 | regulator-min-microvolt = <1800000>; | ||
| 122 | regulator-max-microvolt = <3300000>; | ||
| 123 | }; | ||
| 124 | }; | ||
| 125 | |||
| 126 | |||
diff --git a/Documentation/devicetree/bindings/regulator/sy8106a-regulator.txt b/Documentation/devicetree/bindings/regulator/sy8106a-regulator.txt new file mode 100644 index 000000000000..39a8ca73f572 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/sy8106a-regulator.txt | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | SY8106A Voltage regulator | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | - compatible: Must be "silergy,sy8106a" | ||
| 5 | - reg: I2C slave address - must be <0x65> | ||
| 6 | - silergy,fixed-microvolt - the voltage when I2C regulating is disabled (set | ||
| 7 | by external resistor like a fixed voltage) | ||
| 8 | |||
| 9 | Any property defined as part of the core regulator binding, defined in | ||
| 10 | ./regulator.txt, can also be used. | ||
| 11 | |||
| 12 | Example: | ||
| 13 | |||
| 14 | sy8106a { | ||
| 15 | compatible = "silergy,sy8106a"; | ||
| 16 | reg = <0x65>; | ||
| 17 | regulator-name = "sy8106a-vdd"; | ||
| 18 | silergy,fixed-microvolt = <1200000>; | ||
| 19 | regulator-min-microvolt = <1000000>; | ||
| 20 | regulator-max-microvolt = <1400000>; | ||
| 21 | regulator-boot-on; | ||
| 22 | regulator-always-on; | ||
| 23 | }; | ||
diff --git a/MAINTAINERS b/MAINTAINERS index abec3381cf45..d51226a23345 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -13609,6 +13609,12 @@ S: Supported | |||
| 13609 | F: net/switchdev/ | 13609 | F: net/switchdev/ |
| 13610 | F: include/net/switchdev.h | 13610 | F: include/net/switchdev.h |
| 13611 | 13611 | ||
| 13612 | SY8106A REGULATOR DRIVER | ||
| 13613 | M: Icenowy Zheng <icenowy@aosc.io> | ||
| 13614 | S: Maintained | ||
| 13615 | F: drivers/regulator/sy8106a-regulator.c | ||
| 13616 | F: Documentation/devicetree/bindings/regulator/sy8106a-regulator.txt | ||
| 13617 | |||
| 13612 | SYNC FILE FRAMEWORK | 13618 | SYNC FILE FRAMEWORK |
| 13613 | M: Sumit Semwal <sumit.semwal@linaro.org> | 13619 | M: Sumit Semwal <sumit.semwal@linaro.org> |
| 13614 | R: Gustavo Padovan <gustavo@padovan.org> | 13620 | R: Gustavo Padovan <gustavo@padovan.org> |
diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c index f00988705408..5aa472892465 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <linux/interrupt.h> | 9 | #include <linux/interrupt.h> |
| 10 | #include <linux/i2c.h> | 10 | #include <linux/i2c.h> |
| 11 | #include <linux/spi/spi.h> | 11 | #include <linux/spi/spi.h> |
| 12 | #include <linux/gpio/machine.h> | ||
| 12 | 13 | ||
| 13 | #include <linux/mfd/wm831x/irq.h> | 14 | #include <linux/mfd/wm831x/irq.h> |
| 14 | #include <linux/mfd/wm831x/gpio.h> | 15 | #include <linux/mfd/wm831x/gpio.h> |
| @@ -206,9 +207,6 @@ static const struct i2c_board_info wm1277_devs[] = { | |||
| 206 | }; | 207 | }; |
| 207 | 208 | ||
| 208 | static struct arizona_pdata wm5102_reva_pdata = { | 209 | static struct arizona_pdata wm5102_reva_pdata = { |
| 209 | .ldo1 = { | ||
| 210 | .ldoena = S3C64XX_GPN(7), | ||
| 211 | }, | ||
| 212 | .gpio_base = CODEC_GPIO_BASE, | 210 | .gpio_base = CODEC_GPIO_BASE, |
| 213 | .irq_flags = IRQF_TRIGGER_HIGH, | 211 | .irq_flags = IRQF_TRIGGER_HIGH, |
| 214 | .micd_pol_gpio = CODEC_GPIO_BASE + 4, | 212 | .micd_pol_gpio = CODEC_GPIO_BASE + 4, |
| @@ -237,10 +235,16 @@ static struct spi_board_info wm5102_reva_spi_devs[] = { | |||
| 237 | }, | 235 | }, |
| 238 | }; | 236 | }; |
| 239 | 237 | ||
| 240 | static struct arizona_pdata wm5102_pdata = { | 238 | static struct gpiod_lookup_table wm5102_reva_gpiod_table = { |
| 241 | .ldo1 = { | 239 | .dev_id = "spi0.1", /* SPI device name */ |
| 242 | .ldoena = S3C64XX_GPN(7), | 240 | .table = { |
| 241 | GPIO_LOOKUP("GPION", 7, | ||
| 242 | "wlf,ldoena", GPIO_ACTIVE_HIGH), | ||
| 243 | { }, | ||
| 243 | }, | 244 | }, |
| 245 | }; | ||
| 246 | |||
| 247 | static struct arizona_pdata wm5102_pdata = { | ||
| 244 | .gpio_base = CODEC_GPIO_BASE, | 248 | .gpio_base = CODEC_GPIO_BASE, |
| 245 | .irq_flags = IRQF_TRIGGER_HIGH, | 249 | .irq_flags = IRQF_TRIGGER_HIGH, |
| 246 | .micd_pol_gpio = CODEC_GPIO_BASE + 2, | 250 | .micd_pol_gpio = CODEC_GPIO_BASE + 2, |
| @@ -264,6 +268,15 @@ static struct spi_board_info wm5102_spi_devs[] = { | |||
| 264 | }, | 268 | }, |
| 265 | }; | 269 | }; |
| 266 | 270 | ||
| 271 | static struct gpiod_lookup_table wm5102_gpiod_table = { | ||
| 272 | .dev_id = "spi0.1", /* SPI device name */ | ||
| 273 | .table = { | ||
| 274 | GPIO_LOOKUP("GPION", 7, | ||
| 275 | "wlf,ldo1ena", GPIO_ACTIVE_HIGH), | ||
| 276 | { }, | ||
| 277 | }, | ||
| 278 | }; | ||
| 279 | |||
| 267 | static struct spi_board_info wm5110_spi_devs[] = { | 280 | static struct spi_board_info wm5110_spi_devs[] = { |
| 268 | [0] = { | 281 | [0] = { |
| 269 | .modalias = "wm5110", | 282 | .modalias = "wm5110", |
| @@ -366,6 +379,9 @@ static int wlf_gf_module_probe(struct i2c_client *i2c, | |||
| 366 | rev == gf_mods[i].rev)) | 379 | rev == gf_mods[i].rev)) |
| 367 | break; | 380 | break; |
| 368 | 381 | ||
| 382 | gpiod_add_lookup_table(&wm5102_reva_gpiod_table); | ||
| 383 | gpiod_add_lookup_table(&wm5102_gpiod_table); | ||
| 384 | |||
| 369 | if (i < ARRAY_SIZE(gf_mods)) { | 385 | if (i < ARRAY_SIZE(gf_mods)) { |
| 370 | dev_info(&i2c->dev, "%s revision %d\n", | 386 | dev_info(&i2c->dev, "%s revision %d\n", |
| 371 | gf_mods[i].name, rev + 1); | 387 | gf_mods[i].name, rev + 1); |
diff --git a/drivers/mfd/bd9571mwv.c b/drivers/mfd/bd9571mwv.c index 64e088dfe7b0..503979c81dae 100644 --- a/drivers/mfd/bd9571mwv.c +++ b/drivers/mfd/bd9571mwv.c | |||
| @@ -29,6 +29,7 @@ static const struct mfd_cell bd9571mwv_cells[] = { | |||
| 29 | 29 | ||
| 30 | static const struct regmap_range bd9571mwv_readable_yes_ranges[] = { | 30 | static const struct regmap_range bd9571mwv_readable_yes_ranges[] = { |
| 31 | regmap_reg_range(BD9571MWV_VENDOR_CODE, BD9571MWV_PRODUCT_REVISION), | 31 | regmap_reg_range(BD9571MWV_VENDOR_CODE, BD9571MWV_PRODUCT_REVISION), |
| 32 | regmap_reg_range(BD9571MWV_BKUP_MODE_CNT, BD9571MWV_BKUP_MODE_CNT), | ||
| 32 | regmap_reg_range(BD9571MWV_AVS_SET_MONI, BD9571MWV_AVS_DVFS_VID(3)), | 33 | regmap_reg_range(BD9571MWV_AVS_SET_MONI, BD9571MWV_AVS_DVFS_VID(3)), |
| 33 | regmap_reg_range(BD9571MWV_VD18_VID, BD9571MWV_VD33_VID), | 34 | regmap_reg_range(BD9571MWV_VD18_VID, BD9571MWV_VD33_VID), |
| 34 | regmap_reg_range(BD9571MWV_DVFS_VINIT, BD9571MWV_DVFS_VINIT), | 35 | regmap_reg_range(BD9571MWV_DVFS_VINIT, BD9571MWV_DVFS_VINIT), |
| @@ -44,6 +45,7 @@ static const struct regmap_access_table bd9571mwv_readable_table = { | |||
| 44 | }; | 45 | }; |
| 45 | 46 | ||
| 46 | static const struct regmap_range bd9571mwv_writable_yes_ranges[] = { | 47 | static const struct regmap_range bd9571mwv_writable_yes_ranges[] = { |
| 48 | regmap_reg_range(BD9571MWV_BKUP_MODE_CNT, BD9571MWV_BKUP_MODE_CNT), | ||
| 47 | regmap_reg_range(BD9571MWV_AVS_VD09_VID(0), BD9571MWV_AVS_VD09_VID(3)), | 49 | regmap_reg_range(BD9571MWV_AVS_VD09_VID(0), BD9571MWV_AVS_VD09_VID(3)), |
| 48 | regmap_reg_range(BD9571MWV_DVFS_SETVID, BD9571MWV_DVFS_SETVID), | 50 | regmap_reg_range(BD9571MWV_DVFS_SETVID, BD9571MWV_DVFS_SETVID), |
| 49 | regmap_reg_range(BD9571MWV_GPIO_DIR, BD9571MWV_GPIO_OUT), | 51 | regmap_reg_range(BD9571MWV_GPIO_DIR, BD9571MWV_GPIO_OUT), |
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 097f61784a7d..5dbccf5f3037 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
| @@ -180,6 +180,17 @@ config REGULATOR_BCM590XX | |||
| 180 | BCM590xx PMUs. This will enable support for the software | 180 | BCM590xx PMUs. This will enable support for the software |
| 181 | controllable LDO/Switching regulators. | 181 | controllable LDO/Switching regulators. |
| 182 | 182 | ||
| 183 | config REGULATOR_BD71837 | ||
| 184 | tristate "ROHM BD71837 Power Regulator" | ||
| 185 | depends on MFD_BD71837 | ||
| 186 | help | ||
| 187 | This driver supports voltage regulators on ROHM BD71837 PMIC. | ||
| 188 | This will enable support for the software controllable buck | ||
| 189 | and LDO regulators. | ||
| 190 | |||
| 191 | This driver can also be built as a module. If so, the module | ||
| 192 | will be called bd71837-regulator. | ||
| 193 | |||
| 183 | config REGULATOR_BD9571MWV | 194 | config REGULATOR_BD9571MWV |
| 184 | tristate "ROHM BD9571MWV Regulators" | 195 | tristate "ROHM BD9571MWV Regulators" |
| 185 | depends on MFD_BD9571MWV | 196 | depends on MFD_BD9571MWV |
| @@ -801,6 +812,13 @@ config REGULATOR_STW481X_VMMC | |||
| 801 | This driver supports the internal VMMC regulator in the STw481x | 812 | This driver supports the internal VMMC regulator in the STw481x |
| 802 | PMIC chips. | 813 | PMIC chips. |
| 803 | 814 | ||
| 815 | config REGULATOR_SY8106A | ||
| 816 | tristate "Silergy SY8106A regulator" | ||
| 817 | depends on I2C && (OF || COMPILE_TEST) | ||
| 818 | select REGMAP_I2C | ||
| 819 | help | ||
| 820 | This driver supports SY8106A single output regulator. | ||
| 821 | |||
| 804 | config REGULATOR_TPS51632 | 822 | config REGULATOR_TPS51632 |
| 805 | tristate "TI TPS51632 Power Regulator" | 823 | tristate "TI TPS51632 Power Regulator" |
| 806 | depends on I2C | 824 | depends on I2C |
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 590674fbecd7..bd818ceb7c72 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile | |||
| @@ -27,6 +27,7 @@ obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o | |||
| 27 | obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o | 27 | obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o |
| 28 | obj-$(CONFIG_REGULATOR_AXP20X) += axp20x-regulator.o | 28 | obj-$(CONFIG_REGULATOR_AXP20X) += axp20x-regulator.o |
| 29 | obj-$(CONFIG_REGULATOR_BCM590XX) += bcm590xx-regulator.o | 29 | obj-$(CONFIG_REGULATOR_BCM590XX) += bcm590xx-regulator.o |
| 30 | obj-$(CONFIG_REGULATOR_BD71837) += bd71837-regulator.o | ||
| 30 | obj-$(CONFIG_REGULATOR_BD9571MWV) += bd9571mwv-regulator.o | 31 | obj-$(CONFIG_REGULATOR_BD9571MWV) += bd9571mwv-regulator.o |
| 31 | obj-$(CONFIG_REGULATOR_DA903X) += da903x.o | 32 | obj-$(CONFIG_REGULATOR_DA903X) += da903x.o |
| 32 | obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o | 33 | obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o |
| @@ -100,6 +101,7 @@ obj-$(CONFIG_REGULATOR_SC2731) += sc2731-regulator.o | |||
| 100 | obj-$(CONFIG_REGULATOR_SKY81452) += sky81452-regulator.o | 101 | obj-$(CONFIG_REGULATOR_SKY81452) += sky81452-regulator.o |
| 101 | obj-$(CONFIG_REGULATOR_STM32_VREFBUF) += stm32-vrefbuf.o | 102 | obj-$(CONFIG_REGULATOR_STM32_VREFBUF) += stm32-vrefbuf.o |
| 102 | obj-$(CONFIG_REGULATOR_STW481X_VMMC) += stw481x-vmmc.o | 103 | obj-$(CONFIG_REGULATOR_STW481X_VMMC) += stw481x-vmmc.o |
| 104 | obj-$(CONFIG_REGULATOR_SY8106A) += sy8106a-regulator.o | ||
| 103 | obj-$(CONFIG_REGULATOR_TI_ABB) += ti-abb-regulator.o | 105 | obj-$(CONFIG_REGULATOR_TI_ABB) += ti-abb-regulator.o |
| 104 | obj-$(CONFIG_REGULATOR_TPS6105X) += tps6105x-regulator.o | 106 | obj-$(CONFIG_REGULATOR_TPS6105X) += tps6105x-regulator.o |
| 105 | obj-$(CONFIG_REGULATOR_TPS62360) += tps62360-regulator.o | 107 | obj-$(CONFIG_REGULATOR_TPS62360) += tps62360-regulator.o |
| @@ -125,5 +127,4 @@ obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o | |||
| 125 | obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o | 127 | obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o |
| 126 | obj-$(CONFIG_REGULATOR_WM8994) += wm8994-regulator.o | 128 | obj-$(CONFIG_REGULATOR_WM8994) += wm8994-regulator.o |
| 127 | 129 | ||
| 128 | |||
| 129 | ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG | 130 | ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG |
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 0f97514e3474..83dba3fbfe0c 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c | |||
| @@ -132,33 +132,6 @@ static const unsigned int ldo_vaux56_voltages[] = { | |||
| 132 | 2790000, | 132 | 2790000, |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | static const unsigned int ldo_vaux3_ab8540_voltages[] = { | ||
| 136 | 1200000, | ||
| 137 | 1500000, | ||
| 138 | 1800000, | ||
| 139 | 2100000, | ||
| 140 | 2500000, | ||
| 141 | 2750000, | ||
| 142 | 2790000, | ||
| 143 | 2910000, | ||
| 144 | 3050000, | ||
| 145 | }; | ||
| 146 | |||
| 147 | static const unsigned int ldo_vaux56_ab8540_voltages[] = { | ||
| 148 | 750000, 760000, 770000, 780000, 790000, 800000, | ||
| 149 | 810000, 820000, 830000, 840000, 850000, 860000, | ||
| 150 | 870000, 880000, 890000, 900000, 910000, 920000, | ||
| 151 | 930000, 940000, 950000, 960000, 970000, 980000, | ||
| 152 | 990000, 1000000, 1010000, 1020000, 1030000, | ||
| 153 | 1040000, 1050000, 1060000, 1070000, 1080000, | ||
| 154 | 1090000, 1100000, 1110000, 1120000, 1130000, | ||
| 155 | 1140000, 1150000, 1160000, 1170000, 1180000, | ||
| 156 | 1190000, 1200000, 1210000, 1220000, 1230000, | ||
| 157 | 1240000, 1250000, 1260000, 1270000, 1280000, | ||
| 158 | 1290000, 1300000, 1310000, 1320000, 1330000, | ||
| 159 | 1340000, 1350000, 1360000, 1800000, 2790000, | ||
| 160 | }; | ||
| 161 | |||
| 162 | static const unsigned int ldo_vintcore_voltages[] = { | 135 | static const unsigned int ldo_vintcore_voltages[] = { |
| 163 | 1200000, | 136 | 1200000, |
| 164 | 1225000, | 137 | 1225000, |
| @@ -232,8 +205,6 @@ static const unsigned int ldo_vdmic_voltages[] = { | |||
| 232 | static DEFINE_MUTEX(shared_mode_mutex); | 205 | static DEFINE_MUTEX(shared_mode_mutex); |
| 233 | static struct ab8500_shared_mode ldo_anamic1_shared; | 206 | static struct ab8500_shared_mode ldo_anamic1_shared; |
| 234 | static struct ab8500_shared_mode ldo_anamic2_shared; | 207 | static struct ab8500_shared_mode ldo_anamic2_shared; |
| 235 | static struct ab8500_shared_mode ab8540_ldo_anamic1_shared; | ||
| 236 | static struct ab8500_shared_mode ab8540_ldo_anamic2_shared; | ||
| 237 | 208 | ||
| 238 | static int ab8500_regulator_enable(struct regulator_dev *rdev) | 209 | static int ab8500_regulator_enable(struct regulator_dev *rdev) |
| 239 | { | 210 | { |
| @@ -507,53 +478,6 @@ static int ab8500_regulator_get_voltage_sel(struct regulator_dev *rdev) | |||
| 507 | return (regval & info->voltage_mask) >> voltage_shift; | 478 | return (regval & info->voltage_mask) >> voltage_shift; |
| 508 | } | 479 | } |
| 509 | 480 | ||
| 510 | static int ab8540_aux3_regulator_get_voltage_sel(struct regulator_dev *rdev) | ||
| 511 | { | ||
| 512 | int ret, voltage_shift; | ||
| 513 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); | ||
| 514 | u8 regval, regval_expand; | ||
| 515 | |||
| 516 | if (info == NULL) { | ||
| 517 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); | ||
| 518 | return -EINVAL; | ||
| 519 | } | ||
| 520 | |||
| 521 | ret = abx500_get_register_interruptible(info->dev, | ||
| 522 | info->expand_register.voltage_bank, | ||
| 523 | info->expand_register.voltage_reg, ®val_expand); | ||
| 524 | if (ret < 0) { | ||
| 525 | dev_err(rdev_get_dev(rdev), | ||
| 526 | "couldn't read voltage expand reg for regulator\n"); | ||
| 527 | return ret; | ||
| 528 | } | ||
| 529 | |||
| 530 | dev_vdbg(rdev_get_dev(rdev), | ||
| 531 | "%s-get_voltage expand (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n", | ||
| 532 | info->desc.name, info->expand_register.voltage_bank, | ||
| 533 | info->expand_register.voltage_reg, | ||
| 534 | info->expand_register.voltage_mask, regval_expand); | ||
| 535 | |||
| 536 | if (regval_expand & info->expand_register.voltage_mask) | ||
| 537 | return info->expand_register.voltage_limit; | ||
| 538 | |||
| 539 | ret = abx500_get_register_interruptible(info->dev, | ||
| 540 | info->voltage_bank, info->voltage_reg, ®val); | ||
| 541 | if (ret < 0) { | ||
| 542 | dev_err(rdev_get_dev(rdev), | ||
| 543 | "couldn't read voltage reg for regulator\n"); | ||
| 544 | return ret; | ||
| 545 | } | ||
| 546 | |||
| 547 | dev_vdbg(rdev_get_dev(rdev), | ||
| 548 | "%s-get_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n", | ||
| 549 | info->desc.name, info->voltage_bank, info->voltage_reg, | ||
| 550 | info->voltage_mask, regval); | ||
| 551 | |||
| 552 | voltage_shift = ffs(info->voltage_mask) - 1; | ||
| 553 | |||
| 554 | return (regval & info->voltage_mask) >> voltage_shift; | ||
| 555 | } | ||
| 556 | |||
| 557 | static int ab8500_regulator_set_voltage_sel(struct regulator_dev *rdev, | 481 | static int ab8500_regulator_set_voltage_sel(struct regulator_dev *rdev, |
| 558 | unsigned selector) | 482 | unsigned selector) |
| 559 | { | 483 | { |
| @@ -586,61 +510,6 @@ static int ab8500_regulator_set_voltage_sel(struct regulator_dev *rdev, | |||
| 586 | return ret; | 510 | return ret; |
| 587 | } | 511 | } |
| 588 | 512 | ||
| 589 | static int ab8540_aux3_regulator_set_voltage_sel(struct regulator_dev *rdev, | ||
| 590 | unsigned selector) | ||
| 591 | { | ||
| 592 | int ret; | ||
| 593 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); | ||
| 594 | u8 regval, regval_expand; | ||
| 595 | |||
| 596 | if (info == NULL) { | ||
| 597 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); | ||
| 598 | return -EINVAL; | ||
| 599 | } | ||
| 600 | |||
| 601 | if (selector < info->expand_register.voltage_limit) { | ||
| 602 | int voltage_shift = ffs(info->voltage_mask) - 1; | ||
| 603 | |||
| 604 | regval = (u8)selector << voltage_shift; | ||
| 605 | ret = abx500_mask_and_set_register_interruptible(info->dev, | ||
| 606 | info->voltage_bank, info->voltage_reg, | ||
| 607 | info->voltage_mask, regval); | ||
| 608 | if (ret < 0) { | ||
| 609 | dev_err(rdev_get_dev(rdev), | ||
| 610 | "couldn't set voltage reg for regulator\n"); | ||
| 611 | return ret; | ||
| 612 | } | ||
| 613 | |||
| 614 | dev_vdbg(rdev_get_dev(rdev), | ||
| 615 | "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n", | ||
| 616 | info->desc.name, info->voltage_bank, info->voltage_reg, | ||
| 617 | info->voltage_mask, regval); | ||
| 618 | |||
| 619 | regval_expand = 0; | ||
| 620 | } else { | ||
| 621 | regval_expand = info->expand_register.voltage_mask; | ||
| 622 | } | ||
| 623 | |||
| 624 | ret = abx500_mask_and_set_register_interruptible(info->dev, | ||
| 625 | info->expand_register.voltage_bank, | ||
| 626 | info->expand_register.voltage_reg, | ||
| 627 | info->expand_register.voltage_mask, | ||
| 628 | regval_expand); | ||
| 629 | if (ret < 0) { | ||
| 630 | dev_err(rdev_get_dev(rdev), | ||
| 631 | "couldn't set expand voltage reg for regulator\n"); | ||
| 632 | return ret; | ||
| 633 | } | ||
| 634 | |||
| 635 | dev_vdbg(rdev_get_dev(rdev), | ||
| 636 | "%s-set_voltage expand (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n", | ||
| 637 | info->desc.name, info->expand_register.voltage_bank, | ||
| 638 | info->expand_register.voltage_reg, | ||
| 639 | info->expand_register.voltage_mask, regval_expand); | ||
| 640 | |||
| 641 | return 0; | ||
| 642 | } | ||
| 643 | |||
| 644 | static struct regulator_ops ab8500_regulator_volt_mode_ops = { | 513 | static struct regulator_ops ab8500_regulator_volt_mode_ops = { |
| 645 | .enable = ab8500_regulator_enable, | 514 | .enable = ab8500_regulator_enable, |
| 646 | .disable = ab8500_regulator_disable, | 515 | .disable = ab8500_regulator_disable, |
| @@ -653,18 +522,6 @@ static struct regulator_ops ab8500_regulator_volt_mode_ops = { | |||
| 653 | .list_voltage = regulator_list_voltage_table, | 522 | .list_voltage = regulator_list_voltage_table, |
| 654 | }; | 523 | }; |
| 655 | 524 | ||
| 656 | static struct regulator_ops ab8540_aux3_regulator_volt_mode_ops = { | ||
| 657 | .enable = ab8500_regulator_enable, | ||
| 658 | .disable = ab8500_regulator_disable, | ||
| 659 | .get_optimum_mode = ab8500_regulator_get_optimum_mode, | ||
| 660 | .set_mode = ab8500_regulator_set_mode, | ||
| 661 | .get_mode = ab8500_regulator_get_mode, | ||
| 662 | .is_enabled = ab8500_regulator_is_enabled, | ||
| 663 | .get_voltage_sel = ab8540_aux3_regulator_get_voltage_sel, | ||
| 664 | .set_voltage_sel = ab8540_aux3_regulator_set_voltage_sel, | ||
| 665 | .list_voltage = regulator_list_voltage_table, | ||
| 666 | }; | ||
| 667 | |||
| 668 | static struct regulator_ops ab8500_regulator_volt_ops = { | 525 | static struct regulator_ops ab8500_regulator_volt_ops = { |
| 669 | .enable = ab8500_regulator_enable, | 526 | .enable = ab8500_regulator_enable, |
| 670 | .disable = ab8500_regulator_disable, | 527 | .disable = ab8500_regulator_disable, |
| @@ -1217,562 +1074,6 @@ static struct ab8500_regulator_info | |||
| 1217 | }, | 1074 | }, |
| 1218 | }; | 1075 | }; |
| 1219 | 1076 | ||
| 1220 | /* AB9540 regulator information */ | ||
| 1221 | static struct ab8500_regulator_info | ||
| 1222 | ab9540_regulator_info[AB9540_NUM_REGULATORS] = { | ||
| 1223 | /* | ||
| 1224 | * Variable Voltage Regulators | ||
| 1225 | * name, min mV, max mV, | ||
| 1226 | * update bank, reg, mask, enable val | ||
| 1227 | * volt bank, reg, mask | ||
| 1228 | */ | ||
| 1229 | [AB9540_LDO_AUX1] = { | ||
| 1230 | .desc = { | ||
| 1231 | .name = "LDO-AUX1", | ||
| 1232 | .ops = &ab8500_regulator_volt_mode_ops, | ||
| 1233 | .type = REGULATOR_VOLTAGE, | ||
| 1234 | .id = AB9540_LDO_AUX1, | ||
| 1235 | .owner = THIS_MODULE, | ||
| 1236 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), | ||
| 1237 | .volt_table = ldo_vauxn_voltages, | ||
| 1238 | }, | ||
| 1239 | .load_lp_uA = 5000, | ||
| 1240 | .update_bank = 0x04, | ||
| 1241 | .update_reg = 0x09, | ||
| 1242 | .update_mask = 0x03, | ||
| 1243 | .update_val = 0x01, | ||
| 1244 | .update_val_idle = 0x03, | ||
| 1245 | .update_val_normal = 0x01, | ||
| 1246 | .voltage_bank = 0x04, | ||
| 1247 | .voltage_reg = 0x1f, | ||
| 1248 | .voltage_mask = 0x0f, | ||
| 1249 | }, | ||
| 1250 | [AB9540_LDO_AUX2] = { | ||
| 1251 | .desc = { | ||
| 1252 | .name = "LDO-AUX2", | ||
| 1253 | .ops = &ab8500_regulator_volt_mode_ops, | ||
| 1254 | .type = REGULATOR_VOLTAGE, | ||
| 1255 | .id = AB9540_LDO_AUX2, | ||
| 1256 | .owner = THIS_MODULE, | ||
| 1257 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), | ||
| 1258 | .volt_table = ldo_vauxn_voltages, | ||
| 1259 | }, | ||
| 1260 | .load_lp_uA = 5000, | ||
| 1261 | .update_bank = 0x04, | ||
| 1262 | .update_reg = 0x09, | ||
| 1263 | .update_mask = 0x0c, | ||
| 1264 | .update_val = 0x04, | ||
| 1265 | .update_val_idle = 0x0c, | ||
| 1266 | .update_val_normal = 0x04, | ||
| 1267 | .voltage_bank = 0x04, | ||
| 1268 | .voltage_reg = 0x20, | ||
| 1269 | .voltage_mask = 0x0f, | ||
| 1270 | }, | ||
| 1271 | [AB9540_LDO_AUX3] = { | ||
| 1272 | .desc = { | ||
| 1273 | .name = "LDO-AUX3", | ||
| 1274 | .ops = &ab8500_regulator_volt_mode_ops, | ||
| 1275 | .type = REGULATOR_VOLTAGE, | ||
| 1276 | .id = AB9540_LDO_AUX3, | ||
| 1277 | .owner = THIS_MODULE, | ||
| 1278 | .n_voltages = ARRAY_SIZE(ldo_vaux3_voltages), | ||
| 1279 | .volt_table = ldo_vaux3_voltages, | ||
| 1280 | }, | ||
| 1281 | .load_lp_uA = 5000, | ||
| 1282 | .update_bank = 0x04, | ||
| 1283 | .update_reg = 0x0a, | ||
| 1284 | .update_mask = 0x03, | ||
| 1285 | .update_val = 0x01, | ||
| 1286 | .update_val_idle = 0x03, | ||
| 1287 | .update_val_normal = 0x01, | ||
| 1288 | .voltage_bank = 0x04, | ||
| 1289 | .voltage_reg = 0x21, | ||
| 1290 | .voltage_mask = 0x07, | ||
| 1291 | }, | ||
| 1292 | [AB9540_LDO_AUX4] = { | ||
| 1293 | .desc = { | ||
| 1294 | .name = "LDO-AUX4", | ||
| 1295 | .ops = &ab8500_regulator_volt_mode_ops, | ||
| 1296 | .type = REGULATOR_VOLTAGE, | ||
| 1297 | .id = AB9540_LDO_AUX4, | ||
| 1298 | .owner = THIS_MODULE, | ||
| 1299 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), | ||
| 1300 | .volt_table = ldo_vauxn_voltages, | ||
| 1301 | }, | ||
| 1302 | .load_lp_uA = 5000, | ||
| 1303 | /* values for Vaux4Regu register */ | ||
| 1304 | .update_bank = 0x04, | ||
| 1305 | .update_reg = 0x2e, | ||
| 1306 | .update_mask = 0x03, | ||
| 1307 | .update_val = 0x01, | ||
| 1308 | .update_val_idle = 0x03, | ||
| 1309 | .update_val_normal = 0x01, | ||
| 1310 | /* values for Vaux4SEL register */ | ||
| 1311 | .voltage_bank = 0x04, | ||
| 1312 | .voltage_reg = 0x2f, | ||
| 1313 | .voltage_mask = 0x0f, | ||
| 1314 | }, | ||
| 1315 | [AB9540_LDO_INTCORE] = { | ||
| 1316 | .desc = { | ||
| 1317 | .name = "LDO-INTCORE", | ||
| 1318 | .ops = &ab8500_regulator_volt_mode_ops, | ||
| 1319 | .type = REGULATOR_VOLTAGE, | ||
| 1320 | .id = AB9540_LDO_INTCORE, | ||
| 1321 | .owner = THIS_MODULE, | ||
| 1322 | .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages), | ||
| 1323 | .volt_table = ldo_vintcore_voltages, | ||
| 1324 | }, | ||
| 1325 | .load_lp_uA = 5000, | ||
| 1326 | .update_bank = 0x03, | ||
| 1327 | .update_reg = 0x80, | ||
| 1328 | .update_mask = 0x44, | ||
| 1329 | .update_val = 0x44, | ||
| 1330 | .update_val_idle = 0x44, | ||
| 1331 | .update_val_normal = 0x04, | ||
| 1332 | .voltage_bank = 0x03, | ||
| 1333 | .voltage_reg = 0x80, | ||
| 1334 | .voltage_mask = 0x38, | ||
| 1335 | }, | ||
| 1336 | |||
| 1337 | /* | ||
| 1338 | * Fixed Voltage Regulators | ||
| 1339 | * name, fixed mV, | ||
| 1340 | * update bank, reg, mask, enable val | ||
| 1341 | */ | ||
| 1342 | [AB9540_LDO_TVOUT] = { | ||
| 1343 | .desc = { | ||
| 1344 | .name = "LDO-TVOUT", | ||
| 1345 | .ops = &ab8500_regulator_mode_ops, | ||
| 1346 | .type = REGULATOR_VOLTAGE, | ||
| 1347 | .id = AB9540_LDO_TVOUT, | ||
| 1348 | .owner = THIS_MODULE, | ||
| 1349 | .n_voltages = 1, | ||
| 1350 | .volt_table = fixed_2000000_voltage, | ||
| 1351 | .enable_time = 10000, | ||
| 1352 | }, | ||
| 1353 | .load_lp_uA = 1000, | ||
| 1354 | .update_bank = 0x03, | ||
| 1355 | .update_reg = 0x80, | ||
| 1356 | .update_mask = 0x82, | ||
| 1357 | .update_val = 0x02, | ||
| 1358 | .update_val_idle = 0x82, | ||
| 1359 | .update_val_normal = 0x02, | ||
| 1360 | }, | ||
| 1361 | [AB9540_LDO_USB] = { | ||
| 1362 | .desc = { | ||
| 1363 | .name = "LDO-USB", | ||
| 1364 | .ops = &ab8500_regulator_ops, | ||
| 1365 | .type = REGULATOR_VOLTAGE, | ||
| 1366 | .id = AB9540_LDO_USB, | ||
| 1367 | .owner = THIS_MODULE, | ||
| 1368 | .n_voltages = 1, | ||
| 1369 | .volt_table = fixed_3300000_voltage, | ||
| 1370 | }, | ||
| 1371 | .update_bank = 0x03, | ||
| 1372 | .update_reg = 0x82, | ||
| 1373 | .update_mask = 0x03, | ||
| 1374 | .update_val = 0x01, | ||
| 1375 | .update_val_idle = 0x03, | ||
| 1376 | .update_val_normal = 0x01, | ||
| 1377 | }, | ||
| 1378 | [AB9540_LDO_AUDIO] = { | ||
| 1379 | .desc = { | ||
| 1380 | .name = "LDO-AUDIO", | ||
| 1381 | .ops = &ab8500_regulator_ops, | ||
| 1382 | .type = REGULATOR_VOLTAGE, | ||
| 1383 | .id = AB9540_LDO_AUDIO, | ||
| 1384 | .owner = THIS_MODULE, | ||
| 1385 | .n_voltages = 1, | ||
| 1386 | .volt_table = fixed_2000000_voltage, | ||
| 1387 | }, | ||
| 1388 | .update_bank = 0x03, | ||
| 1389 | .update_reg = 0x83, | ||
| 1390 | .update_mask = 0x02, | ||
| 1391 | .update_val = 0x02, | ||
| 1392 | }, | ||
| 1393 | [AB9540_LDO_ANAMIC1] = { | ||
| 1394 | .desc = { | ||
| 1395 | .name = "LDO-ANAMIC1", | ||
| 1396 | .ops = &ab8500_regulator_ops, | ||
| 1397 | .type = REGULATOR_VOLTAGE, | ||
| 1398 | .id = AB9540_LDO_ANAMIC1, | ||
| 1399 | .owner = THIS_MODULE, | ||
| 1400 | .n_voltages = 1, | ||
| 1401 | .volt_table = fixed_2050000_voltage, | ||
| 1402 | }, | ||
| 1403 | .update_bank = 0x03, | ||
| 1404 | .update_reg = 0x83, | ||
| 1405 | .update_mask = 0x08, | ||
| 1406 | .update_val = 0x08, | ||
| 1407 | }, | ||
| 1408 | [AB9540_LDO_ANAMIC2] = { | ||
| 1409 | .desc = { | ||
| 1410 | .name = "LDO-ANAMIC2", | ||
| 1411 | .ops = &ab8500_regulator_ops, | ||
| 1412 | .type = REGULATOR_VOLTAGE, | ||
| 1413 | .id = AB9540_LDO_ANAMIC2, | ||
| 1414 | .owner = THIS_MODULE, | ||
| 1415 | .n_voltages = 1, | ||
| 1416 | .volt_table = fixed_2050000_voltage, | ||
| 1417 | }, | ||
| 1418 | .update_bank = 0x03, | ||
| 1419 | .update_reg = 0x83, | ||
| 1420 | .update_mask = 0x10, | ||
| 1421 | .update_val = 0x10, | ||
| 1422 | }, | ||
| 1423 | [AB9540_LDO_DMIC] = { | ||
| 1424 | .desc = { | ||
| 1425 | .name = "LDO-DMIC", | ||
| 1426 | .ops = &ab8500_regulator_ops, | ||
| 1427 | .type = REGULATOR_VOLTAGE, | ||
| 1428 | .id = AB9540_LDO_DMIC, | ||
| 1429 | .owner = THIS_MODULE, | ||
| 1430 | .n_voltages = 1, | ||
| 1431 | .volt_table = fixed_1800000_voltage, | ||
| 1432 | }, | ||
| 1433 | .update_bank = 0x03, | ||
| 1434 | .update_reg = 0x83, | ||
| 1435 | .update_mask = 0x04, | ||
| 1436 | .update_val = 0x04, | ||
| 1437 | }, | ||
| 1438 | |||
| 1439 | /* | ||
| 1440 | * Regulators with fixed voltage and normal/idle modes | ||
| 1441 | */ | ||
| 1442 | [AB9540_LDO_ANA] = { | ||
| 1443 | .desc = { | ||
| 1444 | .name = "LDO-ANA", | ||
| 1445 | .ops = &ab8500_regulator_mode_ops, | ||
| 1446 | .type = REGULATOR_VOLTAGE, | ||
| 1447 | .id = AB9540_LDO_ANA, | ||
| 1448 | .owner = THIS_MODULE, | ||
| 1449 | .n_voltages = 1, | ||
| 1450 | .volt_table = fixed_1200000_voltage, | ||
| 1451 | }, | ||
| 1452 | .load_lp_uA = 1000, | ||
| 1453 | .update_bank = 0x04, | ||
| 1454 | .update_reg = 0x06, | ||
| 1455 | .update_mask = 0x0c, | ||
| 1456 | .update_val = 0x08, | ||
| 1457 | .update_val_idle = 0x0c, | ||
| 1458 | .update_val_normal = 0x08, | ||
| 1459 | }, | ||
| 1460 | }; | ||
| 1461 | |||
| 1462 | /* AB8540 regulator information */ | ||
| 1463 | static struct ab8500_regulator_info | ||
| 1464 | ab8540_regulator_info[AB8540_NUM_REGULATORS] = { | ||
| 1465 | /* | ||
| 1466 | * Variable Voltage Regulators | ||
| 1467 | * name, min mV, max mV, | ||
| 1468 | * update bank, reg, mask, enable val | ||
| 1469 | * volt bank, reg, mask | ||
| 1470 | */ | ||
| 1471 | [AB8540_LDO_AUX1] = { | ||
| 1472 | .desc = { | ||
| 1473 | .name = "LDO-AUX1", | ||
| 1474 | .ops = &ab8500_regulator_volt_mode_ops, | ||
| 1475 | .type = REGULATOR_VOLTAGE, | ||
| 1476 | .id = AB8540_LDO_AUX1, | ||
| 1477 | .owner = THIS_MODULE, | ||
| 1478 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), | ||
| 1479 | .volt_table = ldo_vauxn_voltages, | ||
| 1480 | }, | ||
| 1481 | .load_lp_uA = 5000, | ||
| 1482 | .update_bank = 0x04, | ||
| 1483 | .update_reg = 0x09, | ||
| 1484 | .update_mask = 0x03, | ||
| 1485 | .update_val = 0x01, | ||
| 1486 | .update_val_idle = 0x03, | ||
| 1487 | .update_val_normal = 0x01, | ||
| 1488 | .voltage_bank = 0x04, | ||
| 1489 | .voltage_reg = 0x1f, | ||
| 1490 | .voltage_mask = 0x0f, | ||
| 1491 | }, | ||
| 1492 | [AB8540_LDO_AUX2] = { | ||
| 1493 | .desc = { | ||
| 1494 | .name = "LDO-AUX2", | ||
| 1495 | .ops = &ab8500_regulator_volt_mode_ops, | ||
| 1496 | .type = REGULATOR_VOLTAGE, | ||
| 1497 | .id = AB8540_LDO_AUX2, | ||
| 1498 | .owner = THIS_MODULE, | ||
| 1499 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), | ||
| 1500 | .volt_table = ldo_vauxn_voltages, | ||
| 1501 | }, | ||
| 1502 | .load_lp_uA = 5000, | ||
| 1503 | .update_bank = 0x04, | ||
| 1504 | .update_reg = 0x09, | ||
| 1505 | .update_mask = 0x0c, | ||
| 1506 | .update_val = 0x04, | ||
| 1507 | .update_val_idle = 0x0c, | ||
| 1508 | .update_val_normal = 0x04, | ||
| 1509 | .voltage_bank = 0x04, | ||
| 1510 | .voltage_reg = 0x20, | ||
| 1511 | .voltage_mask = 0x0f, | ||
| 1512 | }, | ||
| 1513 | [AB8540_LDO_AUX3] = { | ||
| 1514 | .desc = { | ||
| 1515 | .name = "LDO-AUX3", | ||
| 1516 | .ops = &ab8540_aux3_regulator_volt_mode_ops, | ||
| 1517 | .type = REGULATOR_VOLTAGE, | ||
| 1518 | .id = AB8540_LDO_AUX3, | ||
| 1519 | .owner = THIS_MODULE, | ||
| 1520 | .n_voltages = ARRAY_SIZE(ldo_vaux3_ab8540_voltages), | ||
| 1521 | .volt_table = ldo_vaux3_ab8540_voltages, | ||
| 1522 | }, | ||
| 1523 | .load_lp_uA = 5000, | ||
| 1524 | .update_bank = 0x04, | ||
| 1525 | .update_reg = 0x0a, | ||
| 1526 | .update_mask = 0x03, | ||
| 1527 | .update_val = 0x01, | ||
| 1528 | .update_val_idle = 0x03, | ||
| 1529 | .update_val_normal = 0x01, | ||
| 1530 | .voltage_bank = 0x04, | ||
| 1531 | .voltage_reg = 0x21, | ||
| 1532 | .voltage_mask = 0x07, | ||
| 1533 | .expand_register = { | ||
| 1534 | .voltage_limit = 8, | ||
| 1535 | .voltage_bank = 0x04, | ||
| 1536 | .voltage_reg = 0x01, | ||
| 1537 | .voltage_mask = 0x10, | ||
| 1538 | } | ||
| 1539 | }, | ||
| 1540 | [AB8540_LDO_AUX4] = { | ||
| 1541 | .desc = { | ||
| 1542 | .name = "LDO-AUX4", | ||
| 1543 | .ops = &ab8500_regulator_volt_mode_ops, | ||
| 1544 | .type = REGULATOR_VOLTAGE, | ||
| 1545 | .id = AB8540_LDO_AUX4, | ||
| 1546 | .owner = THIS_MODULE, | ||
| 1547 | .n_voltages = ARRAY_SIZE(ldo_vauxn_voltages), | ||
| 1548 | .volt_table = ldo_vauxn_voltages, | ||
| 1549 | }, | ||
| 1550 | .load_lp_uA = 5000, | ||
| 1551 | /* values for Vaux4Regu register */ | ||
| 1552 | .update_bank = 0x04, | ||
| 1553 | .update_reg = 0x2e, | ||
| 1554 | .update_mask = 0x03, | ||
| 1555 | .update_val = 0x01, | ||
| 1556 | .update_val_idle = 0x03, | ||
| 1557 | .update_val_normal = 0x01, | ||
| 1558 | /* values for Vaux4SEL register */ | ||
| 1559 | .voltage_bank = 0x04, | ||
| 1560 | .voltage_reg = 0x2f, | ||
| 1561 | .voltage_mask = 0x0f, | ||
| 1562 | }, | ||
| 1563 | [AB8540_LDO_AUX5] = { | ||
| 1564 | .desc = { | ||
| 1565 | .name = "LDO-AUX5", | ||
| 1566 | .ops = &ab8500_regulator_volt_mode_ops, | ||
| 1567 | .type = REGULATOR_VOLTAGE, | ||
| 1568 | .id = AB8540_LDO_AUX5, | ||
| 1569 | .owner = THIS_MODULE, | ||
| 1570 | .n_voltages = ARRAY_SIZE(ldo_vaux56_ab8540_voltages), | ||
| 1571 | .volt_table = ldo_vaux56_ab8540_voltages, | ||
| 1572 | }, | ||
| 1573 | .load_lp_uA = 20000, | ||
| 1574 | /* values for Vaux5Regu register */ | ||
| 1575 | .update_bank = 0x04, | ||
| 1576 | .update_reg = 0x32, | ||
| 1577 | .update_mask = 0x03, | ||
| 1578 | .update_val = 0x01, | ||
| 1579 | .update_val_idle = 0x03, | ||
| 1580 | .update_val_normal = 0x01, | ||
| 1581 | /* values for Vaux5SEL register */ | ||
| 1582 | .voltage_bank = 0x04, | ||
| 1583 | .voltage_reg = 0x33, | ||
| 1584 | .voltage_mask = 0x3f, | ||
| 1585 | }, | ||
| 1586 | [AB8540_LDO_AUX6] = { | ||
| 1587 | .desc = { | ||
| 1588 | .name = "LDO-AUX6", | ||
| 1589 | .ops = &ab8500_regulator_volt_mode_ops, | ||
| 1590 | .type = REGULATOR_VOLTAGE, | ||
| 1591 | .id = AB8540_LDO_AUX6, | ||
| 1592 | .owner = THIS_MODULE, | ||
| 1593 | .n_voltages = ARRAY_SIZE(ldo_vaux56_ab8540_voltages), | ||
| 1594 | .volt_table = ldo_vaux56_ab8540_voltages, | ||
| 1595 | }, | ||
| 1596 | .load_lp_uA = 20000, | ||
| 1597 | /* values for Vaux6Regu register */ | ||
| 1598 | .update_bank = 0x04, | ||
| 1599 | .update_reg = 0x35, | ||
| 1600 | .update_mask = 0x03, | ||
| 1601 | .update_val = 0x01, | ||
| 1602 | .update_val_idle = 0x03, | ||
| 1603 | .update_val_normal = 0x01, | ||
| 1604 | /* values for Vaux6SEL register */ | ||
| 1605 | .voltage_bank = 0x04, | ||
| 1606 | .voltage_reg = 0x36, | ||
| 1607 | .voltage_mask = 0x3f, | ||
| 1608 | }, | ||
| 1609 | [AB8540_LDO_INTCORE] = { | ||
| 1610 | .desc = { | ||
| 1611 | .name = "LDO-INTCORE", | ||
| 1612 | .ops = &ab8500_regulator_volt_mode_ops, | ||
| 1613 | .type = REGULATOR_VOLTAGE, | ||
| 1614 | .id = AB8540_LDO_INTCORE, | ||
| 1615 | .owner = THIS_MODULE, | ||
| 1616 | .n_voltages = ARRAY_SIZE(ldo_vintcore_voltages), | ||
| 1617 | .volt_table = ldo_vintcore_voltages, | ||
| 1618 | }, | ||
| 1619 | .load_lp_uA = 5000, | ||
| 1620 | .update_bank = 0x03, | ||
| 1621 | .update_reg = 0x80, | ||
| 1622 | .update_mask = 0x44, | ||
| 1623 | .update_val = 0x44, | ||
| 1624 | .update_val_idle = 0x44, | ||
| 1625 | .update_val_normal = 0x04, | ||
| 1626 | .voltage_bank = 0x03, | ||
| 1627 | .voltage_reg = 0x80, | ||
| 1628 | .voltage_mask = 0x38, | ||
| 1629 | }, | ||
| 1630 | |||
| 1631 | /* | ||
| 1632 | * Fixed Voltage Regulators | ||
| 1633 | * name, fixed mV, | ||
| 1634 | * update bank, reg, mask, enable val | ||
| 1635 | */ | ||
| 1636 | [AB8540_LDO_TVOUT] = { | ||
| 1637 | .desc = { | ||
| 1638 | .name = "LDO-TVOUT", | ||
| 1639 | .ops = &ab8500_regulator_mode_ops, | ||
| 1640 | .type = REGULATOR_VOLTAGE, | ||
| 1641 | .id = AB8540_LDO_TVOUT, | ||
| 1642 | .owner = THIS_MODULE, | ||
| 1643 | .n_voltages = 1, | ||
| 1644 | .volt_table = fixed_2000000_voltage, | ||
| 1645 | .enable_time = 10000, | ||
| 1646 | }, | ||
| 1647 | .load_lp_uA = 1000, | ||
| 1648 | .update_bank = 0x03, | ||
| 1649 | .update_reg = 0x80, | ||
| 1650 | .update_mask = 0x82, | ||
| 1651 | .update_val = 0x02, | ||
| 1652 | .update_val_idle = 0x82, | ||
| 1653 | .update_val_normal = 0x02, | ||
| 1654 | }, | ||
| 1655 | [AB8540_LDO_AUDIO] = { | ||
| 1656 | .desc = { | ||
| 1657 | .name = "LDO-AUDIO", | ||
| 1658 | .ops = &ab8500_regulator_ops, | ||
| 1659 | .type = REGULATOR_VOLTAGE, | ||
| 1660 | .id = AB8540_LDO_AUDIO, | ||
| 1661 | .owner = THIS_MODULE, | ||
| 1662 | .n_voltages = 1, | ||
| 1663 | .volt_table = fixed_2000000_voltage, | ||
| 1664 | }, | ||
| 1665 | .update_bank = 0x03, | ||
| 1666 | .update_reg = 0x83, | ||
| 1667 | .update_mask = 0x02, | ||
| 1668 | .update_val = 0x02, | ||
| 1669 | }, | ||
| 1670 | [AB8540_LDO_ANAMIC1] = { | ||
| 1671 | .desc = { | ||
| 1672 | .name = "LDO-ANAMIC1", | ||
| 1673 | .ops = &ab8500_regulator_anamic_mode_ops, | ||
| 1674 | .type = REGULATOR_VOLTAGE, | ||
| 1675 | .id = AB8540_LDO_ANAMIC1, | ||
| 1676 | .owner = THIS_MODULE, | ||
| 1677 | .n_voltages = 1, | ||
| 1678 | .volt_table = fixed_2050000_voltage, | ||
| 1679 | }, | ||
| 1680 | .shared_mode = &ab8540_ldo_anamic1_shared, | ||
| 1681 | .update_bank = 0x03, | ||
| 1682 | .update_reg = 0x83, | ||
| 1683 | .update_mask = 0x08, | ||
| 1684 | .update_val = 0x08, | ||
| 1685 | .mode_bank = 0x03, | ||
| 1686 | .mode_reg = 0x83, | ||
| 1687 | .mode_mask = 0x20, | ||
| 1688 | .mode_val_idle = 0x20, | ||
| 1689 | .mode_val_normal = 0x00, | ||
| 1690 | }, | ||
| 1691 | [AB8540_LDO_ANAMIC2] = { | ||
| 1692 | .desc = { | ||
| 1693 | .name = "LDO-ANAMIC2", | ||
| 1694 | .ops = &ab8500_regulator_anamic_mode_ops, | ||
| 1695 | .type = REGULATOR_VOLTAGE, | ||
| 1696 | .id = AB8540_LDO_ANAMIC2, | ||
| 1697 | .owner = THIS_MODULE, | ||
| 1698 | .n_voltages = 1, | ||
| 1699 | .volt_table = fixed_2050000_voltage, | ||
| 1700 | }, | ||
| 1701 | .shared_mode = &ab8540_ldo_anamic2_shared, | ||
| 1702 | .update_bank = 0x03, | ||
| 1703 | .update_reg = 0x83, | ||
| 1704 | .update_mask = 0x10, | ||
| 1705 | .update_val = 0x10, | ||
| 1706 | .mode_bank = 0x03, | ||
| 1707 | .mode_reg = 0x83, | ||
| 1708 | .mode_mask = 0x20, | ||
| 1709 | .mode_val_idle = 0x20, | ||
| 1710 | .mode_val_normal = 0x00, | ||
| 1711 | }, | ||
| 1712 | [AB8540_LDO_DMIC] = { | ||
| 1713 | .desc = { | ||
| 1714 | .name = "LDO-DMIC", | ||
| 1715 | .ops = &ab8500_regulator_volt_mode_ops, | ||
| 1716 | .type = REGULATOR_VOLTAGE, | ||
| 1717 | .id = AB8540_LDO_DMIC, | ||
| 1718 | .owner = THIS_MODULE, | ||
| 1719 | .n_voltages = ARRAY_SIZE(ldo_vdmic_voltages), | ||
| 1720 | .volt_table = ldo_vdmic_voltages, | ||
| 1721 | }, | ||
| 1722 | .load_lp_uA = 1000, | ||
| 1723 | .update_bank = 0x03, | ||
| 1724 | .update_reg = 0x83, | ||
| 1725 | .update_mask = 0x04, | ||
| 1726 | .update_val = 0x04, | ||
| 1727 | .voltage_bank = 0x03, | ||
| 1728 | .voltage_reg = 0x83, | ||
| 1729 | .voltage_mask = 0xc0, | ||
| 1730 | }, | ||
| 1731 | |||
| 1732 | /* | ||
| 1733 | * Regulators with fixed voltage and normal/idle modes | ||
| 1734 | */ | ||
| 1735 | [AB8540_LDO_ANA] = { | ||
| 1736 | .desc = { | ||
| 1737 | .name = "LDO-ANA", | ||
| 1738 | .ops = &ab8500_regulator_mode_ops, | ||
| 1739 | .type = REGULATOR_VOLTAGE, | ||
| 1740 | .id = AB8540_LDO_ANA, | ||
| 1741 | .owner = THIS_MODULE, | ||
| 1742 | .n_voltages = 1, | ||
| 1743 | .volt_table = fixed_1200000_voltage, | ||
| 1744 | }, | ||
| 1745 | .load_lp_uA = 1000, | ||
| 1746 | .update_bank = 0x04, | ||
| 1747 | .update_reg = 0x06, | ||
| 1748 | .update_mask = 0x0c, | ||
| 1749 | .update_val = 0x04, | ||
| 1750 | .update_val_idle = 0x0c, | ||
| 1751 | .update_val_normal = 0x04, | ||
| 1752 | }, | ||
| 1753 | [AB8540_LDO_SDIO] = { | ||
| 1754 | .desc = { | ||
| 1755 | .name = "LDO-SDIO", | ||
| 1756 | .ops = &ab8500_regulator_volt_mode_ops, | ||
| 1757 | .type = REGULATOR_VOLTAGE, | ||
| 1758 | .id = AB8540_LDO_SDIO, | ||
| 1759 | .owner = THIS_MODULE, | ||
| 1760 | .n_voltages = ARRAY_SIZE(ldo_sdio_voltages), | ||
| 1761 | .volt_table = ldo_sdio_voltages, | ||
| 1762 | }, | ||
| 1763 | .load_lp_uA = 5000, | ||
| 1764 | .update_bank = 0x03, | ||
| 1765 | .update_reg = 0x88, | ||
| 1766 | .update_mask = 0x30, | ||
| 1767 | .update_val = 0x10, | ||
| 1768 | .update_val_idle = 0x30, | ||
| 1769 | .update_val_normal = 0x10, | ||
| 1770 | .voltage_bank = 0x03, | ||
| 1771 | .voltage_reg = 0x88, | ||
| 1772 | .voltage_mask = 0x07, | ||
| 1773 | }, | ||
| 1774 | }; | ||
| 1775 | |||
| 1776 | static struct ab8500_shared_mode ldo_anamic1_shared = { | 1077 | static struct ab8500_shared_mode ldo_anamic1_shared = { |
| 1777 | .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC2], | 1078 | .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC2], |
| 1778 | }; | 1079 | }; |
| @@ -1781,14 +1082,6 @@ static struct ab8500_shared_mode ldo_anamic2_shared = { | |||
| 1781 | .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC1], | 1082 | .shared_regulator = &ab8505_regulator_info[AB8505_LDO_ANAMIC1], |
| 1782 | }; | 1083 | }; |
| 1783 | 1084 | ||
| 1784 | static struct ab8500_shared_mode ab8540_ldo_anamic1_shared = { | ||
| 1785 | .shared_regulator = &ab8540_regulator_info[AB8540_LDO_ANAMIC2], | ||
| 1786 | }; | ||
| 1787 | |||
| 1788 | static struct ab8500_shared_mode ab8540_ldo_anamic2_shared = { | ||
| 1789 | .shared_regulator = &ab8540_regulator_info[AB8540_LDO_ANAMIC1], | ||
| 1790 | }; | ||
| 1791 | |||
| 1792 | struct ab8500_reg_init { | 1085 | struct ab8500_reg_init { |
| 1793 | u8 bank; | 1086 | u8 bank; |
| 1794 | u8 addr; | 1087 | u8 addr; |
| @@ -2243,659 +1536,6 @@ static struct ab8500_reg_init ab8505_reg_init[] = { | |||
| 2243 | REG_INIT(AB8505_CTRLVAUX6, 0x01, 0x56, 0x9f), | 1536 | REG_INIT(AB8505_CTRLVAUX6, 0x01, 0x56, 0x9f), |
| 2244 | }; | 1537 | }; |
| 2245 | 1538 | ||
| 2246 | /* AB9540 register init */ | ||
| 2247 | static struct ab8500_reg_init ab9540_reg_init[] = { | ||
| 2248 | /* | ||
| 2249 | * 0x03, VarmRequestCtrl | ||
| 2250 | * 0x0c, VapeRequestCtrl | ||
| 2251 | * 0x30, Vsmps1RequestCtrl | ||
| 2252 | * 0xc0, Vsmps2RequestCtrl | ||
| 2253 | */ | ||
| 2254 | REG_INIT(AB9540_REGUREQUESTCTRL1, 0x03, 0x03, 0xff), | ||
| 2255 | /* | ||
| 2256 | * 0x03, Vsmps3RequestCtrl | ||
| 2257 | * 0x0c, VpllRequestCtrl | ||
| 2258 | * 0x30, VanaRequestCtrl | ||
| 2259 | * 0xc0, VextSupply1RequestCtrl | ||
| 2260 | */ | ||
| 2261 | REG_INIT(AB9540_REGUREQUESTCTRL2, 0x03, 0x04, 0xff), | ||
| 2262 | /* | ||
| 2263 | * 0x03, VextSupply2RequestCtrl | ||
| 2264 | * 0x0c, VextSupply3RequestCtrl | ||
| 2265 | * 0x30, Vaux1RequestCtrl | ||
| 2266 | * 0xc0, Vaux2RequestCtrl | ||
| 2267 | */ | ||
| 2268 | REG_INIT(AB9540_REGUREQUESTCTRL3, 0x03, 0x05, 0xff), | ||
| 2269 | /* | ||
| 2270 | * 0x03, Vaux3RequestCtrl | ||
| 2271 | * 0x04, SwHPReq | ||
| 2272 | */ | ||
| 2273 | REG_INIT(AB9540_REGUREQUESTCTRL4, 0x03, 0x06, 0x07), | ||
| 2274 | /* | ||
| 2275 | * 0x01, Vsmps1SysClkReq1HPValid | ||
| 2276 | * 0x02, Vsmps2SysClkReq1HPValid | ||
| 2277 | * 0x04, Vsmps3SysClkReq1HPValid | ||
| 2278 | * 0x08, VanaSysClkReq1HPValid | ||
| 2279 | * 0x10, VpllSysClkReq1HPValid | ||
| 2280 | * 0x20, Vaux1SysClkReq1HPValid | ||
| 2281 | * 0x40, Vaux2SysClkReq1HPValid | ||
| 2282 | * 0x80, Vaux3SysClkReq1HPValid | ||
| 2283 | */ | ||
| 2284 | REG_INIT(AB9540_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff), | ||
| 2285 | /* | ||
| 2286 | * 0x01, VapeSysClkReq1HPValid | ||
| 2287 | * 0x02, VarmSysClkReq1HPValid | ||
| 2288 | * 0x04, VbbSysClkReq1HPValid | ||
| 2289 | * 0x08, VmodSysClkReq1HPValid | ||
| 2290 | * 0x10, VextSupply1SysClkReq1HPValid | ||
| 2291 | * 0x20, VextSupply2SysClkReq1HPValid | ||
| 2292 | * 0x40, VextSupply3SysClkReq1HPValid | ||
| 2293 | */ | ||
| 2294 | REG_INIT(AB9540_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x7f), | ||
| 2295 | /* | ||
| 2296 | * 0x01, Vsmps1HwHPReq1Valid | ||
| 2297 | * 0x02, Vsmps2HwHPReq1Valid | ||
| 2298 | * 0x04, Vsmps3HwHPReq1Valid | ||
| 2299 | * 0x08, VanaHwHPReq1Valid | ||
| 2300 | * 0x10, VpllHwHPReq1Valid | ||
| 2301 | * 0x20, Vaux1HwHPReq1Valid | ||
| 2302 | * 0x40, Vaux2HwHPReq1Valid | ||
| 2303 | * 0x80, Vaux3HwHPReq1Valid | ||
| 2304 | */ | ||
| 2305 | REG_INIT(AB9540_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff), | ||
| 2306 | /* | ||
| 2307 | * 0x01, VextSupply1HwHPReq1Valid | ||
| 2308 | * 0x02, VextSupply2HwHPReq1Valid | ||
| 2309 | * 0x04, VextSupply3HwHPReq1Valid | ||
| 2310 | * 0x08, VmodHwHPReq1Valid | ||
| 2311 | */ | ||
| 2312 | REG_INIT(AB9540_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x0f), | ||
| 2313 | /* | ||
| 2314 | * 0x01, Vsmps1HwHPReq2Valid | ||
| 2315 | * 0x02, Vsmps2HwHPReq2Valid | ||
| 2316 | * 0x03, Vsmps3HwHPReq2Valid | ||
| 2317 | * 0x08, VanaHwHPReq2Valid | ||
| 2318 | * 0x10, VpllHwHPReq2Valid | ||
| 2319 | * 0x20, Vaux1HwHPReq2Valid | ||
| 2320 | * 0x40, Vaux2HwHPReq2Valid | ||
| 2321 | * 0x80, Vaux3HwHPReq2Valid | ||
| 2322 | */ | ||
| 2323 | REG_INIT(AB9540_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff), | ||
| 2324 | /* | ||
| 2325 | * 0x01, VextSupply1HwHPReq2Valid | ||
| 2326 | * 0x02, VextSupply2HwHPReq2Valid | ||
| 2327 | * 0x04, VextSupply3HwHPReq2Valid | ||
| 2328 | * 0x08, VmodHwHPReq2Valid | ||
| 2329 | */ | ||
| 2330 | REG_INIT(AB9540_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x0f), | ||
| 2331 | /* | ||
| 2332 | * 0x01, VapeSwHPReqValid | ||
| 2333 | * 0x02, VarmSwHPReqValid | ||
| 2334 | * 0x04, Vsmps1SwHPReqValid | ||
| 2335 | * 0x08, Vsmps2SwHPReqValid | ||
| 2336 | * 0x10, Vsmps3SwHPReqValid | ||
| 2337 | * 0x20, VanaSwHPReqValid | ||
| 2338 | * 0x40, VpllSwHPReqValid | ||
| 2339 | * 0x80, Vaux1SwHPReqValid | ||
| 2340 | */ | ||
| 2341 | REG_INIT(AB9540_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff), | ||
| 2342 | /* | ||
| 2343 | * 0x01, Vaux2SwHPReqValid | ||
| 2344 | * 0x02, Vaux3SwHPReqValid | ||
| 2345 | * 0x04, VextSupply1SwHPReqValid | ||
| 2346 | * 0x08, VextSupply2SwHPReqValid | ||
| 2347 | * 0x10, VextSupply3SwHPReqValid | ||
| 2348 | * 0x20, VmodSwHPReqValid | ||
| 2349 | */ | ||
| 2350 | REG_INIT(AB9540_REGUSWHPREQVALID2, 0x03, 0x0e, 0x3f), | ||
| 2351 | /* | ||
| 2352 | * 0x02, SysClkReq2Valid1 | ||
| 2353 | * ... | ||
| 2354 | * 0x80, SysClkReq8Valid1 | ||
| 2355 | */ | ||
| 2356 | REG_INIT(AB9540_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xfe), | ||
| 2357 | /* | ||
| 2358 | * 0x02, SysClkReq2Valid2 | ||
| 2359 | * ... | ||
| 2360 | * 0x80, SysClkReq8Valid2 | ||
| 2361 | */ | ||
| 2362 | REG_INIT(AB9540_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xfe), | ||
| 2363 | /* | ||
| 2364 | * 0x01, Vaux4SwHPReqValid | ||
| 2365 | * 0x02, Vaux4HwHPReq2Valid | ||
| 2366 | * 0x04, Vaux4HwHPReq1Valid | ||
| 2367 | * 0x08, Vaux4SysClkReq1HPValid | ||
| 2368 | */ | ||
| 2369 | REG_INIT(AB9540_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f), | ||
| 2370 | /* | ||
| 2371 | * 0x02, VTVoutEna | ||
| 2372 | * 0x04, Vintcore12Ena | ||
| 2373 | * 0x38, Vintcore12Sel | ||
| 2374 | * 0x40, Vintcore12LP | ||
| 2375 | * 0x80, VTVoutLP | ||
| 2376 | */ | ||
| 2377 | REG_INIT(AB9540_REGUMISC1, 0x03, 0x80, 0xfe), | ||
| 2378 | /* | ||
| 2379 | * 0x02, VaudioEna | ||
| 2380 | * 0x04, VdmicEna | ||
| 2381 | * 0x08, Vamic1Ena | ||
| 2382 | * 0x10, Vamic2Ena | ||
| 2383 | */ | ||
| 2384 | REG_INIT(AB9540_VAUDIOSUPPLY, 0x03, 0x83, 0x1e), | ||
| 2385 | /* | ||
| 2386 | * 0x01, Vamic1_dzout | ||
| 2387 | * 0x02, Vamic2_dzout | ||
| 2388 | */ | ||
| 2389 | REG_INIT(AB9540_REGUCTRL1VAMIC, 0x03, 0x84, 0x03), | ||
| 2390 | /* | ||
| 2391 | * 0x03, Vsmps1Regu | ||
| 2392 | * 0x0c, Vsmps1SelCtrl | ||
| 2393 | * 0x10, Vsmps1AutoMode | ||
| 2394 | * 0x20, Vsmps1PWMMode | ||
| 2395 | */ | ||
| 2396 | REG_INIT(AB9540_VSMPS1REGU, 0x04, 0x03, 0x3f), | ||
| 2397 | /* | ||
| 2398 | * 0x03, Vsmps2Regu | ||
| 2399 | * 0x0c, Vsmps2SelCtrl | ||
| 2400 | * 0x10, Vsmps2AutoMode | ||
| 2401 | * 0x20, Vsmps2PWMMode | ||
| 2402 | */ | ||
| 2403 | REG_INIT(AB9540_VSMPS2REGU, 0x04, 0x04, 0x3f), | ||
| 2404 | /* | ||
| 2405 | * 0x03, Vsmps3Regu | ||
| 2406 | * 0x0c, Vsmps3SelCtrl | ||
| 2407 | * NOTE! PRCMU register | ||
| 2408 | */ | ||
| 2409 | REG_INIT(AB9540_VSMPS3REGU, 0x04, 0x05, 0x0f), | ||
| 2410 | /* | ||
| 2411 | * 0x03, VpllRegu | ||
| 2412 | * 0x0c, VanaRegu | ||
| 2413 | */ | ||
| 2414 | REG_INIT(AB9540_VPLLVANAREGU, 0x04, 0x06, 0x0f), | ||
| 2415 | /* | ||
| 2416 | * 0x03, VextSupply1Regu | ||
| 2417 | * 0x0c, VextSupply2Regu | ||
| 2418 | * 0x30, VextSupply3Regu | ||
| 2419 | * 0x40, ExtSupply2Bypass | ||
| 2420 | * 0x80, ExtSupply3Bypass | ||
| 2421 | */ | ||
| 2422 | REG_INIT(AB9540_EXTSUPPLYREGU, 0x04, 0x08, 0xff), | ||
| 2423 | /* | ||
| 2424 | * 0x03, Vaux1Regu | ||
| 2425 | * 0x0c, Vaux2Regu | ||
| 2426 | */ | ||
| 2427 | REG_INIT(AB9540_VAUX12REGU, 0x04, 0x09, 0x0f), | ||
| 2428 | /* | ||
| 2429 | * 0x0c, Vrf1Regu | ||
| 2430 | * 0x03, Vaux3Regu | ||
| 2431 | */ | ||
| 2432 | REG_INIT(AB9540_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f), | ||
| 2433 | /* | ||
| 2434 | * 0x3f, Vsmps1Sel1 | ||
| 2435 | */ | ||
| 2436 | REG_INIT(AB9540_VSMPS1SEL1, 0x04, 0x13, 0x3f), | ||
| 2437 | /* | ||
| 2438 | * 0x3f, Vsmps1Sel2 | ||
| 2439 | */ | ||
| 2440 | REG_INIT(AB9540_VSMPS1SEL2, 0x04, 0x14, 0x3f), | ||
| 2441 | /* | ||
| 2442 | * 0x3f, Vsmps1Sel3 | ||
| 2443 | */ | ||
| 2444 | REG_INIT(AB9540_VSMPS1SEL3, 0x04, 0x15, 0x3f), | ||
| 2445 | /* | ||
| 2446 | * 0x3f, Vsmps2Sel1 | ||
| 2447 | */ | ||
| 2448 | REG_INIT(AB9540_VSMPS2SEL1, 0x04, 0x17, 0x3f), | ||
| 2449 | /* | ||
| 2450 | * 0x3f, Vsmps2Sel2 | ||
| 2451 | */ | ||
| 2452 | REG_INIT(AB9540_VSMPS2SEL2, 0x04, 0x18, 0x3f), | ||
| 2453 | /* | ||
| 2454 | * 0x3f, Vsmps2Sel3 | ||
| 2455 | */ | ||
| 2456 | REG_INIT(AB9540_VSMPS2SEL3, 0x04, 0x19, 0x3f), | ||
| 2457 | /* | ||
| 2458 | * 0x7f, Vsmps3Sel1 | ||
| 2459 | * NOTE! PRCMU register | ||
| 2460 | */ | ||
| 2461 | REG_INIT(AB9540_VSMPS3SEL1, 0x04, 0x1b, 0x7f), | ||
| 2462 | /* | ||
| 2463 | * 0x7f, Vsmps3Sel2 | ||
| 2464 | * NOTE! PRCMU register | ||
| 2465 | */ | ||
| 2466 | REG_INIT(AB9540_VSMPS3SEL2, 0x04, 0x1c, 0x7f), | ||
| 2467 | /* | ||
| 2468 | * 0x0f, Vaux1Sel | ||
| 2469 | */ | ||
| 2470 | REG_INIT(AB9540_VAUX1SEL, 0x04, 0x1f, 0x0f), | ||
| 2471 | /* | ||
| 2472 | * 0x0f, Vaux2Sel | ||
| 2473 | */ | ||
| 2474 | REG_INIT(AB9540_VAUX2SEL, 0x04, 0x20, 0x0f), | ||
| 2475 | /* | ||
| 2476 | * 0x07, Vaux3Sel | ||
| 2477 | * 0x30, Vrf1Sel | ||
| 2478 | */ | ||
| 2479 | REG_INIT(AB9540_VRF1VAUX3SEL, 0x04, 0x21, 0x37), | ||
| 2480 | /* | ||
| 2481 | * 0x01, VextSupply12LP | ||
| 2482 | */ | ||
| 2483 | REG_INIT(AB9540_REGUCTRL2SPARE, 0x04, 0x22, 0x01), | ||
| 2484 | /* | ||
| 2485 | * 0x03, Vaux4RequestCtrl | ||
| 2486 | */ | ||
| 2487 | REG_INIT(AB9540_VAUX4REQCTRL, 0x04, 0x2d, 0x03), | ||
| 2488 | /* | ||
| 2489 | * 0x03, Vaux4Regu | ||
| 2490 | */ | ||
| 2491 | REG_INIT(AB9540_VAUX4REGU, 0x04, 0x2e, 0x03), | ||
| 2492 | /* | ||
| 2493 | * 0x08, Vaux4Sel | ||
| 2494 | */ | ||
| 2495 | REG_INIT(AB9540_VAUX4SEL, 0x04, 0x2f, 0x0f), | ||
| 2496 | /* | ||
| 2497 | * 0x01, VpllDisch | ||
| 2498 | * 0x02, Vrf1Disch | ||
| 2499 | * 0x04, Vaux1Disch | ||
| 2500 | * 0x08, Vaux2Disch | ||
| 2501 | * 0x10, Vaux3Disch | ||
| 2502 | * 0x20, Vintcore12Disch | ||
| 2503 | * 0x40, VTVoutDisch | ||
| 2504 | * 0x80, VaudioDisch | ||
| 2505 | */ | ||
| 2506 | REG_INIT(AB9540_REGUCTRLDISCH, 0x04, 0x43, 0xff), | ||
| 2507 | /* | ||
| 2508 | * 0x01, VsimDisch | ||
| 2509 | * 0x02, VanaDisch | ||
| 2510 | * 0x04, VdmicPullDownEna | ||
| 2511 | * 0x08, VpllPullDownEna | ||
| 2512 | * 0x10, VdmicDisch | ||
| 2513 | */ | ||
| 2514 | REG_INIT(AB9540_REGUCTRLDISCH2, 0x04, 0x44, 0x1f), | ||
| 2515 | /* | ||
| 2516 | * 0x01, Vaux4Disch | ||
| 2517 | */ | ||
| 2518 | REG_INIT(AB9540_REGUCTRLDISCH3, 0x04, 0x48, 0x01), | ||
| 2519 | }; | ||
| 2520 | |||
| 2521 | /* AB8540 register init */ | ||
| 2522 | static struct ab8500_reg_init ab8540_reg_init[] = { | ||
| 2523 | /* | ||
| 2524 | * 0x01, VSimSycClkReq1Valid | ||
| 2525 | * 0x02, VSimSycClkReq2Valid | ||
| 2526 | * 0x04, VSimSycClkReq3Valid | ||
| 2527 | * 0x08, VSimSycClkReq4Valid | ||
| 2528 | * 0x10, VSimSycClkReq5Valid | ||
| 2529 | * 0x20, VSimSycClkReq6Valid | ||
| 2530 | * 0x40, VSimSycClkReq7Valid | ||
| 2531 | * 0x80, VSimSycClkReq8Valid | ||
| 2532 | */ | ||
| 2533 | REG_INIT(AB8540_VSIMSYSCLKCTRL, 0x02, 0x33, 0xff), | ||
| 2534 | /* | ||
| 2535 | * 0x03, VarmRequestCtrl | ||
| 2536 | * 0x0c, VapeRequestCtrl | ||
| 2537 | * 0x30, Vsmps1RequestCtrl | ||
| 2538 | * 0xc0, Vsmps2RequestCtrl | ||
| 2539 | */ | ||
| 2540 | REG_INIT(AB8540_REGUREQUESTCTRL1, 0x03, 0x03, 0xff), | ||
| 2541 | /* | ||
| 2542 | * 0x03, Vsmps3RequestCtrl | ||
| 2543 | * 0x0c, VpllRequestCtrl | ||
| 2544 | * 0x30, VanaRequestCtrl | ||
| 2545 | * 0xc0, VextSupply1RequestCtrl | ||
| 2546 | */ | ||
| 2547 | REG_INIT(AB8540_REGUREQUESTCTRL2, 0x03, 0x04, 0xff), | ||
| 2548 | /* | ||
| 2549 | * 0x03, VextSupply2RequestCtrl | ||
| 2550 | * 0x0c, VextSupply3RequestCtrl | ||
| 2551 | * 0x30, Vaux1RequestCtrl | ||
| 2552 | * 0xc0, Vaux2RequestCtrl | ||
| 2553 | */ | ||
| 2554 | REG_INIT(AB8540_REGUREQUESTCTRL3, 0x03, 0x05, 0xff), | ||
| 2555 | /* | ||
| 2556 | * 0x03, Vaux3RequestCtrl | ||
| 2557 | * 0x04, SwHPReq | ||
| 2558 | */ | ||
| 2559 | REG_INIT(AB8540_REGUREQUESTCTRL4, 0x03, 0x06, 0x07), | ||
| 2560 | /* | ||
| 2561 | * 0x01, Vsmps1SysClkReq1HPValid | ||
| 2562 | * 0x02, Vsmps2SysClkReq1HPValid | ||
| 2563 | * 0x04, Vsmps3SysClkReq1HPValid | ||
| 2564 | * 0x08, VanaSysClkReq1HPValid | ||
| 2565 | * 0x10, VpllSysClkReq1HPValid | ||
| 2566 | * 0x20, Vaux1SysClkReq1HPValid | ||
| 2567 | * 0x40, Vaux2SysClkReq1HPValid | ||
| 2568 | * 0x80, Vaux3SysClkReq1HPValid | ||
| 2569 | */ | ||
| 2570 | REG_INIT(AB8540_REGUSYSCLKREQ1HPVALID1, 0x03, 0x07, 0xff), | ||
| 2571 | /* | ||
| 2572 | * 0x01, VapeSysClkReq1HPValid | ||
| 2573 | * 0x02, VarmSysClkReq1HPValid | ||
| 2574 | * 0x04, VbbSysClkReq1HPValid | ||
| 2575 | * 0x10, VextSupply1SysClkReq1HPValid | ||
| 2576 | * 0x20, VextSupply2SysClkReq1HPValid | ||
| 2577 | * 0x40, VextSupply3SysClkReq1HPValid | ||
| 2578 | */ | ||
| 2579 | REG_INIT(AB8540_REGUSYSCLKREQ1HPVALID2, 0x03, 0x08, 0x77), | ||
| 2580 | /* | ||
| 2581 | * 0x01, Vsmps1HwHPReq1Valid | ||
| 2582 | * 0x02, Vsmps2HwHPReq1Valid | ||
| 2583 | * 0x04, Vsmps3HwHPReq1Valid | ||
| 2584 | * 0x08, VanaHwHPReq1Valid | ||
| 2585 | * 0x10, VpllHwHPReq1Valid | ||
| 2586 | * 0x20, Vaux1HwHPReq1Valid | ||
| 2587 | * 0x40, Vaux2HwHPReq1Valid | ||
| 2588 | * 0x80, Vaux3HwHPReq1Valid | ||
| 2589 | */ | ||
| 2590 | REG_INIT(AB8540_REGUHWHPREQ1VALID1, 0x03, 0x09, 0xff), | ||
| 2591 | /* | ||
| 2592 | * 0x01, VextSupply1HwHPReq1Valid | ||
| 2593 | * 0x02, VextSupply2HwHPReq1Valid | ||
| 2594 | * 0x04, VextSupply3HwHPReq1Valid | ||
| 2595 | */ | ||
| 2596 | REG_INIT(AB8540_REGUHWHPREQ1VALID2, 0x03, 0x0a, 0x07), | ||
| 2597 | /* | ||
| 2598 | * 0x01, Vsmps1HwHPReq2Valid | ||
| 2599 | * 0x02, Vsmps2HwHPReq2Valid | ||
| 2600 | * 0x03, Vsmps3HwHPReq2Valid | ||
| 2601 | * 0x08, VanaHwHPReq2Valid | ||
| 2602 | * 0x10, VpllHwHPReq2Valid | ||
| 2603 | * 0x20, Vaux1HwHPReq2Valid | ||
| 2604 | * 0x40, Vaux2HwHPReq2Valid | ||
| 2605 | * 0x80, Vaux3HwHPReq2Valid | ||
| 2606 | */ | ||
| 2607 | REG_INIT(AB8540_REGUHWHPREQ2VALID1, 0x03, 0x0b, 0xff), | ||
| 2608 | /* | ||
| 2609 | * 0x01, VextSupply1HwHPReq2Valid | ||
| 2610 | * 0x02, VextSupply2HwHPReq2Valid | ||
| 2611 | * 0x04, VextSupply3HwHPReq2Valid | ||
| 2612 | */ | ||
| 2613 | REG_INIT(AB8540_REGUHWHPREQ2VALID2, 0x03, 0x0c, 0x07), | ||
| 2614 | /* | ||
| 2615 | * 0x01, VapeSwHPReqValid | ||
| 2616 | * 0x02, VarmSwHPReqValid | ||
| 2617 | * 0x04, Vsmps1SwHPReqValid | ||
| 2618 | * 0x08, Vsmps2SwHPReqValid | ||
| 2619 | * 0x10, Vsmps3SwHPReqValid | ||
| 2620 | * 0x20, VanaSwHPReqValid | ||
| 2621 | * 0x40, VpllSwHPReqValid | ||
| 2622 | * 0x80, Vaux1SwHPReqValid | ||
| 2623 | */ | ||
| 2624 | REG_INIT(AB8540_REGUSWHPREQVALID1, 0x03, 0x0d, 0xff), | ||
| 2625 | /* | ||
| 2626 | * 0x01, Vaux2SwHPReqValid | ||
| 2627 | * 0x02, Vaux3SwHPReqValid | ||
| 2628 | * 0x04, VextSupply1SwHPReqValid | ||
| 2629 | * 0x08, VextSupply2SwHPReqValid | ||
| 2630 | * 0x10, VextSupply3SwHPReqValid | ||
| 2631 | */ | ||
| 2632 | REG_INIT(AB8540_REGUSWHPREQVALID2, 0x03, 0x0e, 0x1f), | ||
| 2633 | /* | ||
| 2634 | * 0x02, SysClkReq2Valid1 | ||
| 2635 | * ... | ||
| 2636 | * 0x80, SysClkReq8Valid1 | ||
| 2637 | */ | ||
| 2638 | REG_INIT(AB8540_REGUSYSCLKREQVALID1, 0x03, 0x0f, 0xff), | ||
| 2639 | /* | ||
| 2640 | * 0x02, SysClkReq2Valid2 | ||
| 2641 | * ... | ||
| 2642 | * 0x80, SysClkReq8Valid2 | ||
| 2643 | */ | ||
| 2644 | REG_INIT(AB8540_REGUSYSCLKREQVALID2, 0x03, 0x10, 0xff), | ||
| 2645 | /* | ||
| 2646 | * 0x01, Vaux4SwHPReqValid | ||
| 2647 | * 0x02, Vaux4HwHPReq2Valid | ||
| 2648 | * 0x04, Vaux4HwHPReq1Valid | ||
| 2649 | * 0x08, Vaux4SysClkReq1HPValid | ||
| 2650 | */ | ||
| 2651 | REG_INIT(AB8540_REGUVAUX4REQVALID, 0x03, 0x11, 0x0f), | ||
| 2652 | /* | ||
| 2653 | * 0x01, Vaux5SwHPReqValid | ||
| 2654 | * 0x02, Vaux5HwHPReq2Valid | ||
| 2655 | * 0x04, Vaux5HwHPReq1Valid | ||
| 2656 | * 0x08, Vaux5SysClkReq1HPValid | ||
| 2657 | */ | ||
| 2658 | REG_INIT(AB8540_REGUVAUX5REQVALID, 0x03, 0x12, 0x0f), | ||
| 2659 | /* | ||
| 2660 | * 0x01, Vaux6SwHPReqValid | ||
| 2661 | * 0x02, Vaux6HwHPReq2Valid | ||
| 2662 | * 0x04, Vaux6HwHPReq1Valid | ||
| 2663 | * 0x08, Vaux6SysClkReq1HPValid | ||
| 2664 | */ | ||
| 2665 | REG_INIT(AB8540_REGUVAUX6REQVALID, 0x03, 0x13, 0x0f), | ||
| 2666 | /* | ||
| 2667 | * 0x01, VclkbSwHPReqValid | ||
| 2668 | * 0x02, VclkbHwHPReq2Valid | ||
| 2669 | * 0x04, VclkbHwHPReq1Valid | ||
| 2670 | * 0x08, VclkbSysClkReq1HPValid | ||
| 2671 | */ | ||
| 2672 | REG_INIT(AB8540_REGUVCLKBREQVALID, 0x03, 0x14, 0x0f), | ||
| 2673 | /* | ||
| 2674 | * 0x01, Vrf1SwHPReqValid | ||
| 2675 | * 0x02, Vrf1HwHPReq2Valid | ||
| 2676 | * 0x04, Vrf1HwHPReq1Valid | ||
| 2677 | * 0x08, Vrf1SysClkReq1HPValid | ||
| 2678 | */ | ||
| 2679 | REG_INIT(AB8540_REGUVRF1REQVALID, 0x03, 0x15, 0x0f), | ||
| 2680 | /* | ||
| 2681 | * 0x02, VTVoutEna | ||
| 2682 | * 0x04, Vintcore12Ena | ||
| 2683 | * 0x38, Vintcore12Sel | ||
| 2684 | * 0x40, Vintcore12LP | ||
| 2685 | * 0x80, VTVoutLP | ||
| 2686 | */ | ||
| 2687 | REG_INIT(AB8540_REGUMISC1, 0x03, 0x80, 0xfe), | ||
| 2688 | /* | ||
| 2689 | * 0x02, VaudioEna | ||
| 2690 | * 0x04, VdmicEna | ||
| 2691 | * 0x08, Vamic1Ena | ||
| 2692 | * 0x10, Vamic2Ena | ||
| 2693 | * 0x20, Vamic12LP | ||
| 2694 | * 0xC0, VdmicSel | ||
| 2695 | */ | ||
| 2696 | REG_INIT(AB8540_VAUDIOSUPPLY, 0x03, 0x83, 0xfe), | ||
| 2697 | /* | ||
| 2698 | * 0x01, Vamic1_dzout | ||
| 2699 | * 0x02, Vamic2_dzout | ||
| 2700 | */ | ||
| 2701 | REG_INIT(AB8540_REGUCTRL1VAMIC, 0x03, 0x84, 0x03), | ||
| 2702 | /* | ||
| 2703 | * 0x07, VHSICSel | ||
| 2704 | * 0x08, VHSICOffState | ||
| 2705 | * 0x10, VHSIEna | ||
| 2706 | * 0x20, VHSICLP | ||
| 2707 | */ | ||
| 2708 | REG_INIT(AB8540_VHSIC, 0x03, 0x87, 0x3f), | ||
| 2709 | /* | ||
| 2710 | * 0x07, VSDIOSel | ||
| 2711 | * 0x08, VSDIOOffState | ||
| 2712 | * 0x10, VSDIOEna | ||
| 2713 | * 0x20, VSDIOLP | ||
| 2714 | */ | ||
| 2715 | REG_INIT(AB8540_VSDIO, 0x03, 0x88, 0x3f), | ||
| 2716 | /* | ||
| 2717 | * 0x03, Vsmps1Regu | ||
| 2718 | * 0x0c, Vsmps1SelCtrl | ||
| 2719 | * 0x10, Vsmps1AutoMode | ||
| 2720 | * 0x20, Vsmps1PWMMode | ||
| 2721 | */ | ||
| 2722 | REG_INIT(AB8540_VSMPS1REGU, 0x04, 0x03, 0x3f), | ||
| 2723 | /* | ||
| 2724 | * 0x03, Vsmps2Regu | ||
| 2725 | * 0x0c, Vsmps2SelCtrl | ||
| 2726 | * 0x10, Vsmps2AutoMode | ||
| 2727 | * 0x20, Vsmps2PWMMode | ||
| 2728 | */ | ||
| 2729 | REG_INIT(AB8540_VSMPS2REGU, 0x04, 0x04, 0x3f), | ||
| 2730 | /* | ||
| 2731 | * 0x03, Vsmps3Regu | ||
| 2732 | * 0x0c, Vsmps3SelCtrl | ||
| 2733 | * 0x10, Vsmps3AutoMode | ||
| 2734 | * 0x20, Vsmps3PWMMode | ||
| 2735 | * NOTE! PRCMU register | ||
| 2736 | */ | ||
| 2737 | REG_INIT(AB8540_VSMPS3REGU, 0x04, 0x05, 0x0f), | ||
| 2738 | /* | ||
| 2739 | * 0x03, VpllRegu | ||
| 2740 | * 0x0c, VanaRegu | ||
| 2741 | */ | ||
| 2742 | REG_INIT(AB8540_VPLLVANAREGU, 0x04, 0x06, 0x0f), | ||
| 2743 | /* | ||
| 2744 | * 0x03, VextSupply1Regu | ||
| 2745 | * 0x0c, VextSupply2Regu | ||
| 2746 | * 0x30, VextSupply3Regu | ||
| 2747 | * 0x40, ExtSupply2Bypass | ||
| 2748 | * 0x80, ExtSupply3Bypass | ||
| 2749 | */ | ||
| 2750 | REG_INIT(AB8540_EXTSUPPLYREGU, 0x04, 0x08, 0xff), | ||
| 2751 | /* | ||
| 2752 | * 0x03, Vaux1Regu | ||
| 2753 | * 0x0c, Vaux2Regu | ||
| 2754 | */ | ||
| 2755 | REG_INIT(AB8540_VAUX12REGU, 0x04, 0x09, 0x0f), | ||
| 2756 | /* | ||
| 2757 | * 0x0c, VRF1Regu | ||
| 2758 | * 0x03, Vaux3Regu | ||
| 2759 | */ | ||
| 2760 | REG_INIT(AB8540_VRF1VAUX3REGU, 0x04, 0x0a, 0x0f), | ||
| 2761 | /* | ||
| 2762 | * 0x3f, Vsmps1Sel1 | ||
| 2763 | */ | ||
| 2764 | REG_INIT(AB8540_VSMPS1SEL1, 0x04, 0x13, 0x3f), | ||
| 2765 | /* | ||
| 2766 | * 0x3f, Vsmps1Sel2 | ||
| 2767 | */ | ||
| 2768 | REG_INIT(AB8540_VSMPS1SEL2, 0x04, 0x14, 0x3f), | ||
| 2769 | /* | ||
| 2770 | * 0x3f, Vsmps1Sel3 | ||
| 2771 | */ | ||
| 2772 | REG_INIT(AB8540_VSMPS1SEL3, 0x04, 0x15, 0x3f), | ||
| 2773 | /* | ||
| 2774 | * 0x3f, Vsmps2Sel1 | ||
| 2775 | */ | ||
| 2776 | REG_INIT(AB8540_VSMPS2SEL1, 0x04, 0x17, 0x3f), | ||
| 2777 | /* | ||
| 2778 | * 0x3f, Vsmps2Sel2 | ||
| 2779 | */ | ||
| 2780 | REG_INIT(AB8540_VSMPS2SEL2, 0x04, 0x18, 0x3f), | ||
| 2781 | /* | ||
| 2782 | * 0x3f, Vsmps2Sel3 | ||
| 2783 | */ | ||
| 2784 | REG_INIT(AB8540_VSMPS2SEL3, 0x04, 0x19, 0x3f), | ||
| 2785 | /* | ||
| 2786 | * 0x7f, Vsmps3Sel1 | ||
| 2787 | * NOTE! PRCMU register | ||
| 2788 | */ | ||
| 2789 | REG_INIT(AB8540_VSMPS3SEL1, 0x04, 0x1b, 0x7f), | ||
| 2790 | /* | ||
| 2791 | * 0x7f, Vsmps3Sel2 | ||
| 2792 | * NOTE! PRCMU register | ||
| 2793 | */ | ||
| 2794 | REG_INIT(AB8540_VSMPS3SEL2, 0x04, 0x1c, 0x7f), | ||
| 2795 | /* | ||
| 2796 | * 0x0f, Vaux1Sel | ||
| 2797 | */ | ||
| 2798 | REG_INIT(AB8540_VAUX1SEL, 0x04, 0x1f, 0x0f), | ||
| 2799 | /* | ||
| 2800 | * 0x0f, Vaux2Sel | ||
| 2801 | */ | ||
| 2802 | REG_INIT(AB8540_VAUX2SEL, 0x04, 0x20, 0x0f), | ||
| 2803 | /* | ||
| 2804 | * 0x07, Vaux3Sel | ||
| 2805 | * 0x70, Vrf1Sel | ||
| 2806 | */ | ||
| 2807 | REG_INIT(AB8540_VRF1VAUX3SEL, 0x04, 0x21, 0x77), | ||
| 2808 | /* | ||
| 2809 | * 0x01, VextSupply12LP | ||
| 2810 | */ | ||
| 2811 | REG_INIT(AB8540_REGUCTRL2SPARE, 0x04, 0x22, 0x01), | ||
| 2812 | /* | ||
| 2813 | * 0x07, Vanasel | ||
| 2814 | * 0x30, Vpllsel | ||
| 2815 | */ | ||
| 2816 | REG_INIT(AB8540_VANAVPLLSEL, 0x04, 0x29, 0x37), | ||
| 2817 | /* | ||
| 2818 | * 0x03, Vaux4RequestCtrl | ||
| 2819 | */ | ||
| 2820 | REG_INIT(AB8540_VAUX4REQCTRL, 0x04, 0x2d, 0x03), | ||
| 2821 | /* | ||
| 2822 | * 0x03, Vaux4Regu | ||
| 2823 | */ | ||
| 2824 | REG_INIT(AB8540_VAUX4REGU, 0x04, 0x2e, 0x03), | ||
| 2825 | /* | ||
| 2826 | * 0x0f, Vaux4Sel | ||
| 2827 | */ | ||
| 2828 | REG_INIT(AB8540_VAUX4SEL, 0x04, 0x2f, 0x0f), | ||
| 2829 | /* | ||
| 2830 | * 0x03, Vaux5RequestCtrl | ||
| 2831 | */ | ||
| 2832 | REG_INIT(AB8540_VAUX5REQCTRL, 0x04, 0x31, 0x03), | ||
| 2833 | /* | ||
| 2834 | * 0x03, Vaux5Regu | ||
| 2835 | */ | ||
| 2836 | REG_INIT(AB8540_VAUX5REGU, 0x04, 0x32, 0x03), | ||
| 2837 | /* | ||
| 2838 | * 0x3f, Vaux5Sel | ||
| 2839 | */ | ||
| 2840 | REG_INIT(AB8540_VAUX5SEL, 0x04, 0x33, 0x3f), | ||
| 2841 | /* | ||
| 2842 | * 0x03, Vaux6RequestCtrl | ||
| 2843 | */ | ||
| 2844 | REG_INIT(AB8540_VAUX6REQCTRL, 0x04, 0x34, 0x03), | ||
| 2845 | /* | ||
| 2846 | * 0x03, Vaux6Regu | ||
| 2847 | */ | ||
| 2848 | REG_INIT(AB8540_VAUX6REGU, 0x04, 0x35, 0x03), | ||
| 2849 | /* | ||
| 2850 | * 0x3f, Vaux6Sel | ||
| 2851 | */ | ||
| 2852 | REG_INIT(AB8540_VAUX6SEL, 0x04, 0x36, 0x3f), | ||
| 2853 | /* | ||
| 2854 | * 0x03, VCLKBRequestCtrl | ||
| 2855 | */ | ||
| 2856 | REG_INIT(AB8540_VCLKBREQCTRL, 0x04, 0x37, 0x03), | ||
| 2857 | /* | ||
| 2858 | * 0x03, VCLKBRegu | ||
| 2859 | */ | ||
| 2860 | REG_INIT(AB8540_VCLKBREGU, 0x04, 0x38, 0x03), | ||
| 2861 | /* | ||
| 2862 | * 0x07, VCLKBSel | ||
| 2863 | */ | ||
| 2864 | REG_INIT(AB8540_VCLKBSEL, 0x04, 0x39, 0x07), | ||
| 2865 | /* | ||
| 2866 | * 0x03, Vrf1RequestCtrl | ||
| 2867 | */ | ||
| 2868 | REG_INIT(AB8540_VRF1REQCTRL, 0x04, 0x3a, 0x03), | ||
| 2869 | /* | ||
| 2870 | * 0x01, VpllDisch | ||
| 2871 | * 0x02, Vrf1Disch | ||
| 2872 | * 0x04, Vaux1Disch | ||
| 2873 | * 0x08, Vaux2Disch | ||
| 2874 | * 0x10, Vaux3Disch | ||
| 2875 | * 0x20, Vintcore12Disch | ||
| 2876 | * 0x40, VTVoutDisch | ||
| 2877 | * 0x80, VaudioDisch | ||
| 2878 | */ | ||
| 2879 | REG_INIT(AB8540_REGUCTRLDISCH, 0x04, 0x43, 0xff), | ||
| 2880 | /* | ||
| 2881 | * 0x02, VanaDisch | ||
| 2882 | * 0x04, VdmicPullDownEna | ||
| 2883 | * 0x08, VpllPullDownEna | ||
| 2884 | * 0x10, VdmicDisch | ||
| 2885 | */ | ||
| 2886 | REG_INIT(AB8540_REGUCTRLDISCH2, 0x04, 0x44, 0x1e), | ||
| 2887 | /* | ||
| 2888 | * 0x01, Vaux4Disch | ||
| 2889 | */ | ||
| 2890 | REG_INIT(AB8540_REGUCTRLDISCH3, 0x04, 0x48, 0x01), | ||
| 2891 | /* | ||
| 2892 | * 0x01, Vaux5Disch | ||
| 2893 | * 0x02, Vaux6Disch | ||
| 2894 | * 0x04, VCLKBDisch | ||
| 2895 | */ | ||
| 2896 | REG_INIT(AB8540_REGUCTRLDISCH4, 0x04, 0x49, 0x07), | ||
| 2897 | }; | ||
| 2898 | |||
| 2899 | static struct of_regulator_match ab8500_regulator_match[] = { | 1539 | static struct of_regulator_match ab8500_regulator_match[] = { |
| 2900 | { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8500_LDO_AUX1, }, | 1540 | { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8500_LDO_AUX1, }, |
| 2901 | { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8500_LDO_AUX2, }, | 1541 | { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8500_LDO_AUX2, }, |
| @@ -2925,37 +1565,6 @@ static struct of_regulator_match ab8505_regulator_match[] = { | |||
| 2925 | { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8505_LDO_ANA, }, | 1565 | { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8505_LDO_ANA, }, |
| 2926 | }; | 1566 | }; |
| 2927 | 1567 | ||
| 2928 | static struct of_regulator_match ab8540_regulator_match[] = { | ||
| 2929 | { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB8540_LDO_AUX1, }, | ||
| 2930 | { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB8540_LDO_AUX2, }, | ||
| 2931 | { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB8540_LDO_AUX3, }, | ||
| 2932 | { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB8540_LDO_AUX4, }, | ||
| 2933 | { .name = "ab8500_ldo_aux5", .driver_data = (void *) AB8540_LDO_AUX5, }, | ||
| 2934 | { .name = "ab8500_ldo_aux6", .driver_data = (void *) AB8540_LDO_AUX6, }, | ||
| 2935 | { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB8540_LDO_INTCORE, }, | ||
| 2936 | { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB8540_LDO_TVOUT, }, | ||
| 2937 | { .name = "ab8500_ldo_audio", .driver_data = (void *) AB8540_LDO_AUDIO, }, | ||
| 2938 | { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB8540_LDO_ANAMIC1, }, | ||
| 2939 | { .name = "ab8500_ldo_anamic2", .driver_data = (void *) AB8540_LDO_ANAMIC2, }, | ||
| 2940 | { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB8540_LDO_DMIC, }, | ||
| 2941 | { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8540_LDO_ANA, }, | ||
| 2942 | { .name = "ab8500_ldo_sdio", .driver_data = (void *) AB8540_LDO_SDIO, }, | ||
| 2943 | }; | ||
| 2944 | |||
| 2945 | static struct of_regulator_match ab9540_regulator_match[] = { | ||
| 2946 | { .name = "ab8500_ldo_aux1", .driver_data = (void *) AB9540_LDO_AUX1, }, | ||
| 2947 | { .name = "ab8500_ldo_aux2", .driver_data = (void *) AB9540_LDO_AUX2, }, | ||
| 2948 | { .name = "ab8500_ldo_aux3", .driver_data = (void *) AB9540_LDO_AUX3, }, | ||
| 2949 | { .name = "ab8500_ldo_aux4", .driver_data = (void *) AB9540_LDO_AUX4, }, | ||
| 2950 | { .name = "ab8500_ldo_intcore", .driver_data = (void *) AB9540_LDO_INTCORE, }, | ||
| 2951 | { .name = "ab8500_ldo_tvout", .driver_data = (void *) AB9540_LDO_TVOUT, }, | ||
| 2952 | { .name = "ab8500_ldo_audio", .driver_data = (void *) AB9540_LDO_AUDIO, }, | ||
| 2953 | { .name = "ab8500_ldo_anamic1", .driver_data = (void *) AB9540_LDO_ANAMIC1, }, | ||
| 2954 | { .name = "ab8500_ldo_anamic2", .driver_data = (void *) AB9540_LDO_ANAMIC2, }, | ||
| 2955 | { .name = "ab8500_ldo_dmic", .driver_data = (void *) AB9540_LDO_DMIC, }, | ||
| 2956 | { .name = "ab8500_ldo_ana", .driver_data = (void *) AB9540_LDO_ANA, }, | ||
| 2957 | }; | ||
| 2958 | |||
| 2959 | static struct { | 1568 | static struct { |
| 2960 | struct ab8500_regulator_info *info; | 1569 | struct ab8500_regulator_info *info; |
| 2961 | int info_size; | 1570 | int info_size; |
| @@ -2967,27 +1576,13 @@ static struct { | |||
| 2967 | 1576 | ||
| 2968 | static void abx500_get_regulator_info(struct ab8500 *ab8500) | 1577 | static void abx500_get_regulator_info(struct ab8500 *ab8500) |
| 2969 | { | 1578 | { |
| 2970 | if (is_ab9540(ab8500)) { | 1579 | if (is_ab8505(ab8500)) { |
| 2971 | abx500_regulator.info = ab9540_regulator_info; | ||
| 2972 | abx500_regulator.info_size = ARRAY_SIZE(ab9540_regulator_info); | ||
| 2973 | abx500_regulator.init = ab9540_reg_init; | ||
| 2974 | abx500_regulator.init_size = AB9540_NUM_REGULATOR_REGISTERS; | ||
| 2975 | abx500_regulator.match = ab9540_regulator_match; | ||
| 2976 | abx500_regulator.match_size = ARRAY_SIZE(ab9540_regulator_match); | ||
| 2977 | } else if (is_ab8505(ab8500)) { | ||
| 2978 | abx500_regulator.info = ab8505_regulator_info; | 1580 | abx500_regulator.info = ab8505_regulator_info; |
| 2979 | abx500_regulator.info_size = ARRAY_SIZE(ab8505_regulator_info); | 1581 | abx500_regulator.info_size = ARRAY_SIZE(ab8505_regulator_info); |
| 2980 | abx500_regulator.init = ab8505_reg_init; | 1582 | abx500_regulator.init = ab8505_reg_init; |
| 2981 | abx500_regulator.init_size = AB8505_NUM_REGULATOR_REGISTERS; | 1583 | abx500_regulator.init_size = AB8505_NUM_REGULATOR_REGISTERS; |
| 2982 | abx500_regulator.match = ab8505_regulator_match; | 1584 | abx500_regulator.match = ab8505_regulator_match; |
| 2983 | abx500_regulator.match_size = ARRAY_SIZE(ab8505_regulator_match); | 1585 | abx500_regulator.match_size = ARRAY_SIZE(ab8505_regulator_match); |
| 2984 | } else if (is_ab8540(ab8500)) { | ||
| 2985 | abx500_regulator.info = ab8540_regulator_info; | ||
| 2986 | abx500_regulator.info_size = ARRAY_SIZE(ab8540_regulator_info); | ||
| 2987 | abx500_regulator.init = ab8540_reg_init; | ||
| 2988 | abx500_regulator.init_size = AB8540_NUM_REGULATOR_REGISTERS; | ||
| 2989 | abx500_regulator.match = ab8540_regulator_match; | ||
| 2990 | abx500_regulator.match_size = ARRAY_SIZE(ab8540_regulator_match); | ||
| 2991 | } else { | 1586 | } else { |
| 2992 | abx500_regulator.info = ab8500_regulator_info; | 1587 | abx500_regulator.info = ab8500_regulator_info; |
| 2993 | abx500_regulator.info_size = ARRAY_SIZE(ab8500_regulator_info); | 1588 | abx500_regulator.info_size = ARRAY_SIZE(ab8500_regulator_info); |
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 7d6478e6a503..d9d8155ed8cb 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c | |||
| @@ -1,22 +1,6 @@ | |||
| 1 | /* | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved. | 2 | // |
| 3 | */ | 3 | // Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved. |
| 4 | |||
| 5 | /* | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | |||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | |||
| 16 | * You should have received a copy of the GNU General Public License along | ||
| 17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | */ | ||
| 20 | 4 | ||
| 21 | #include <linux/slab.h> | 5 | #include <linux/slab.h> |
| 22 | #include <linux/device.h> | 6 | #include <linux/device.h> |
diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c index 96fddfff5dc4..f6d6a4ad9e8a 100644 --- a/drivers/regulator/arizona-ldo1.c +++ b/drivers/regulator/arizona-ldo1.c | |||
| @@ -17,12 +17,11 @@ | |||
| 17 | #include <linux/bitops.h> | 17 | #include <linux/bitops.h> |
| 18 | #include <linux/err.h> | 18 | #include <linux/err.h> |
| 19 | #include <linux/of.h> | 19 | #include <linux/of.h> |
| 20 | #include <linux/of_gpio.h> | 20 | #include <linux/gpio/consumer.h> |
| 21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
| 22 | #include <linux/regulator/driver.h> | 22 | #include <linux/regulator/driver.h> |
| 23 | #include <linux/regulator/machine.h> | 23 | #include <linux/regulator/machine.h> |
| 24 | #include <linux/regulator/of_regulator.h> | 24 | #include <linux/regulator/of_regulator.h> |
| 25 | #include <linux/gpio.h> | ||
| 26 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 27 | 26 | ||
| 28 | #include <linux/regulator/arizona-ldo1.h> | 27 | #include <linux/regulator/arizona-ldo1.h> |
| @@ -198,16 +197,6 @@ static int arizona_ldo1_of_get_pdata(struct arizona_ldo1_pdata *pdata, | |||
| 198 | struct device_node *init_node, *dcvdd_node; | 197 | struct device_node *init_node, *dcvdd_node; |
| 199 | struct regulator_init_data *init_data; | 198 | struct regulator_init_data *init_data; |
| 200 | 199 | ||
| 201 | pdata->ldoena = of_get_named_gpio(np, "wlf,ldoena", 0); | ||
| 202 | if (pdata->ldoena < 0) { | ||
| 203 | dev_warn(config->dev, | ||
| 204 | "LDOENA GPIO property missing/malformed: %d\n", | ||
| 205 | pdata->ldoena); | ||
| 206 | pdata->ldoena = 0; | ||
| 207 | } else { | ||
| 208 | config->ena_gpio_initialized = true; | ||
| 209 | } | ||
| 210 | |||
| 211 | init_node = of_get_child_by_name(np, "ldo1"); | 200 | init_node = of_get_child_by_name(np, "ldo1"); |
| 212 | dcvdd_node = of_parse_phandle(np, "DCVDD-supply", 0); | 201 | dcvdd_node = of_parse_phandle(np, "DCVDD-supply", 0); |
| 213 | 202 | ||
| @@ -264,7 +253,11 @@ static int arizona_ldo1_common_init(struct platform_device *pdev, | |||
| 264 | } | 253 | } |
| 265 | } | 254 | } |
| 266 | 255 | ||
| 267 | config.ena_gpio = pdata->ldoena; | 256 | /* We assume that high output = regulator off */ |
| 257 | config.ena_gpiod = devm_gpiod_get_optional(&pdev->dev, "wlf,ldoena", | ||
| 258 | GPIOD_OUT_HIGH); | ||
| 259 | if (IS_ERR(config.ena_gpiod)) | ||
| 260 | return PTR_ERR(config.ena_gpiod); | ||
| 268 | 261 | ||
| 269 | if (pdata->init_data) | 262 | if (pdata->init_data) |
| 270 | config.init_data = pdata->init_data; | 263 | config.init_data = pdata->init_data; |
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c index 181622b2813d..91b8ff8bac15 100644 --- a/drivers/regulator/axp20x-regulator.c +++ b/drivers/regulator/axp20x-regulator.c | |||
| @@ -721,6 +721,8 @@ static int axp20x_regulator_probe(struct platform_device *pdev) | |||
| 721 | case AXP803_ID: | 721 | case AXP803_ID: |
| 722 | regulators = axp803_regulators; | 722 | regulators = axp803_regulators; |
| 723 | nregulators = AXP803_REG_ID_MAX; | 723 | nregulators = AXP803_REG_ID_MAX; |
| 724 | drivevbus = of_property_read_bool(pdev->dev.parent->of_node, | ||
| 725 | "x-powers,drive-vbus-en"); | ||
| 724 | break; | 726 | break; |
| 725 | case AXP806_ID: | 727 | case AXP806_ID: |
| 726 | regulators = axp806_regulators; | 728 | regulators = axp806_regulators; |
diff --git a/drivers/regulator/bd71837-regulator.c b/drivers/regulator/bd71837-regulator.c new file mode 100644 index 000000000000..6eae4d0432a2 --- /dev/null +++ b/drivers/regulator/bd71837-regulator.c | |||
| @@ -0,0 +1,640 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | // Copyright (C) 2018 ROHM Semiconductors | ||
| 3 | // bd71837-regulator.c ROHM BD71837MWV regulator driver | ||
| 4 | |||
| 5 | #include <linux/kernel.h> | ||
| 6 | #include <linux/module.h> | ||
| 7 | #include <linux/init.h> | ||
| 8 | #include <linux/err.h> | ||
| 9 | #include <linux/interrupt.h> | ||
| 10 | #include <linux/platform_device.h> | ||
| 11 | #include <linux/regulator/driver.h> | ||
| 12 | #include <linux/regulator/machine.h> | ||
| 13 | #include <linux/delay.h> | ||
| 14 | #include <linux/slab.h> | ||
| 15 | #include <linux/gpio.h> | ||
| 16 | #include <linux/mfd/bd71837.h> | ||
| 17 | #include <linux/regulator/of_regulator.h> | ||
| 18 | |||
| 19 | struct bd71837_pmic { | ||
| 20 | struct regulator_desc descs[BD71837_REGULATOR_CNT]; | ||
| 21 | struct bd71837 *mfd; | ||
| 22 | struct platform_device *pdev; | ||
| 23 | struct regulator_dev *rdev[BD71837_REGULATOR_CNT]; | ||
| 24 | }; | ||
| 25 | |||
| 26 | /* | ||
| 27 | * BUCK1/2/3/4 | ||
| 28 | * BUCK1RAMPRATE[1:0] BUCK1 DVS ramp rate setting | ||
| 29 | * 00: 10.00mV/usec 10mV 1uS | ||
| 30 | * 01: 5.00mV/usec 10mV 2uS | ||
| 31 | * 10: 2.50mV/usec 10mV 4uS | ||
| 32 | * 11: 1.25mV/usec 10mV 8uS | ||
| 33 | */ | ||
| 34 | static int bd71837_buck1234_set_ramp_delay(struct regulator_dev *rdev, | ||
| 35 | int ramp_delay) | ||
| 36 | { | ||
| 37 | struct bd71837_pmic *pmic = rdev_get_drvdata(rdev); | ||
| 38 | struct bd71837 *mfd = pmic->mfd; | ||
| 39 | int id = rdev->desc->id; | ||
| 40 | unsigned int ramp_value = BUCK_RAMPRATE_10P00MV; | ||
| 41 | |||
| 42 | dev_dbg(&(pmic->pdev->dev), "Buck[%d] Set Ramp = %d\n", id + 1, | ||
| 43 | ramp_delay); | ||
| 44 | switch (ramp_delay) { | ||
| 45 | case 1 ... 1250: | ||
| 46 | ramp_value = BUCK_RAMPRATE_1P25MV; | ||
| 47 | break; | ||
| 48 | case 1251 ... 2500: | ||
| 49 | ramp_value = BUCK_RAMPRATE_2P50MV; | ||
| 50 | break; | ||
| 51 | case 2501 ... 5000: | ||
| 52 | ramp_value = BUCK_RAMPRATE_5P00MV; | ||
| 53 | break; | ||
| 54 | case 5001 ... 10000: | ||
| 55 | ramp_value = BUCK_RAMPRATE_10P00MV; | ||
| 56 | break; | ||
| 57 | default: | ||
| 58 | ramp_value = BUCK_RAMPRATE_10P00MV; | ||
| 59 | dev_err(&pmic->pdev->dev, | ||
| 60 | "%s: ramp_delay: %d not supported, setting 10000mV//us\n", | ||
| 61 | rdev->desc->name, ramp_delay); | ||
| 62 | } | ||
| 63 | |||
| 64 | return regmap_update_bits(mfd->regmap, BD71837_REG_BUCK1_CTRL + id, | ||
| 65 | BUCK_RAMPRATE_MASK, ramp_value << 6); | ||
| 66 | } | ||
| 67 | |||
| 68 | /* Bucks 1 to 4 support DVS. PWM mode is used when voltage is changed. | ||
| 69 | * Bucks 5 to 8 and LDOs can use PFM and must be disabled when voltage | ||
| 70 | * is changed. Hence we return -EBUSY for these if voltage is changed | ||
| 71 | * when BUCK/LDO is enabled. | ||
| 72 | */ | ||
| 73 | static int bd71837_set_voltage_sel_restricted(struct regulator_dev *rdev, | ||
| 74 | unsigned int sel) | ||
| 75 | { | ||
| 76 | int ret; | ||
| 77 | |||
| 78 | ret = regulator_is_enabled_regmap(rdev); | ||
| 79 | if (!ret) | ||
| 80 | ret = regulator_set_voltage_sel_regmap(rdev, sel); | ||
| 81 | else if (ret == 1) | ||
| 82 | ret = -EBUSY; | ||
| 83 | return ret; | ||
| 84 | } | ||
| 85 | |||
| 86 | static struct regulator_ops bd71837_ldo_regulator_ops = { | ||
| 87 | .enable = regulator_enable_regmap, | ||
| 88 | .disable = regulator_disable_regmap, | ||
| 89 | .is_enabled = regulator_is_enabled_regmap, | ||
| 90 | .list_voltage = regulator_list_voltage_linear_range, | ||
| 91 | .set_voltage_sel = bd71837_set_voltage_sel_restricted, | ||
| 92 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
| 93 | }; | ||
| 94 | |||
| 95 | static struct regulator_ops bd71837_ldo_regulator_nolinear_ops = { | ||
| 96 | .enable = regulator_enable_regmap, | ||
| 97 | .disable = regulator_disable_regmap, | ||
| 98 | .is_enabled = regulator_is_enabled_regmap, | ||
| 99 | .list_voltage = regulator_list_voltage_table, | ||
| 100 | .set_voltage_sel = bd71837_set_voltage_sel_restricted, | ||
| 101 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
| 102 | }; | ||
| 103 | |||
| 104 | static struct regulator_ops bd71837_buck_regulator_ops = { | ||
| 105 | .enable = regulator_enable_regmap, | ||
| 106 | .disable = regulator_disable_regmap, | ||
| 107 | .is_enabled = regulator_is_enabled_regmap, | ||
| 108 | .list_voltage = regulator_list_voltage_linear_range, | ||
| 109 | .set_voltage_sel = bd71837_set_voltage_sel_restricted, | ||
| 110 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
| 111 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | ||
| 112 | }; | ||
| 113 | |||
| 114 | static struct regulator_ops bd71837_buck_regulator_nolinear_ops = { | ||
| 115 | .enable = regulator_enable_regmap, | ||
| 116 | .disable = regulator_disable_regmap, | ||
| 117 | .is_enabled = regulator_is_enabled_regmap, | ||
| 118 | .list_voltage = regulator_list_voltage_table, | ||
| 119 | .set_voltage_sel = bd71837_set_voltage_sel_restricted, | ||
| 120 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
| 121 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | ||
| 122 | }; | ||
| 123 | |||
| 124 | static struct regulator_ops bd71837_buck1234_regulator_ops = { | ||
| 125 | .enable = regulator_enable_regmap, | ||
| 126 | .disable = regulator_disable_regmap, | ||
| 127 | .is_enabled = regulator_is_enabled_regmap, | ||
| 128 | .list_voltage = regulator_list_voltage_linear_range, | ||
| 129 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | ||
| 130 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
| 131 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | ||
| 132 | .set_ramp_delay = bd71837_buck1234_set_ramp_delay, | ||
| 133 | }; | ||
| 134 | |||
| 135 | /* | ||
| 136 | * BUCK1/2/3/4 | ||
| 137 | * 0.70 to 1.30V (10mV step) | ||
| 138 | */ | ||
| 139 | static const struct regulator_linear_range bd71837_buck1234_voltage_ranges[] = { | ||
| 140 | REGULATOR_LINEAR_RANGE(700000, 0x00, 0x3C, 10000), | ||
| 141 | REGULATOR_LINEAR_RANGE(1300000, 0x3D, 0x3F, 0), | ||
| 142 | }; | ||
| 143 | |||
| 144 | /* | ||
| 145 | * BUCK5 | ||
| 146 | * 0.9V to 1.35V () | ||
| 147 | */ | ||
| 148 | static const struct regulator_linear_range bd71837_buck5_voltage_ranges[] = { | ||
| 149 | REGULATOR_LINEAR_RANGE(700000, 0x00, 0x03, 100000), | ||
| 150 | REGULATOR_LINEAR_RANGE(1050000, 0x04, 0x05, 50000), | ||
| 151 | REGULATOR_LINEAR_RANGE(1200000, 0x06, 0x07, 150000), | ||
| 152 | }; | ||
| 153 | |||
| 154 | /* | ||
| 155 | * BUCK6 | ||
| 156 | * 3.0V to 3.3V (step 100mV) | ||
| 157 | */ | ||
| 158 | static const struct regulator_linear_range bd71837_buck6_voltage_ranges[] = { | ||
| 159 | REGULATOR_LINEAR_RANGE(3000000, 0x00, 0x03, 100000), | ||
| 160 | }; | ||
| 161 | |||
| 162 | /* | ||
| 163 | * BUCK7 | ||
| 164 | * 000 = 1.605V | ||
| 165 | * 001 = 1.695V | ||
| 166 | * 010 = 1.755V | ||
| 167 | * 011 = 1.8V (Initial) | ||
| 168 | * 100 = 1.845V | ||
| 169 | * 101 = 1.905V | ||
| 170 | * 110 = 1.95V | ||
| 171 | * 111 = 1.995V | ||
| 172 | */ | ||
| 173 | static const unsigned int buck_7_volts[] = { | ||
| 174 | 1605000, 1695000, 1755000, 1800000, 1845000, 1905000, 1950000, 1995000 | ||
| 175 | }; | ||
| 176 | |||
| 177 | /* | ||
| 178 | * BUCK8 | ||
| 179 | * 0.8V to 1.40V (step 10mV) | ||
| 180 | */ | ||
| 181 | static const struct regulator_linear_range bd71837_buck8_voltage_ranges[] = { | ||
| 182 | REGULATOR_LINEAR_RANGE(800000, 0x00, 0x3C, 10000), | ||
| 183 | REGULATOR_LINEAR_RANGE(1400000, 0x3D, 0x3F, 0), | ||
| 184 | }; | ||
| 185 | |||
| 186 | /* | ||
| 187 | * LDO1 | ||
| 188 | * 3.0 to 3.3V (100mV step) | ||
| 189 | */ | ||
| 190 | static const struct regulator_linear_range bd71837_ldo1_voltage_ranges[] = { | ||
| 191 | REGULATOR_LINEAR_RANGE(3000000, 0x00, 0x03, 100000), | ||
| 192 | }; | ||
| 193 | |||
| 194 | /* | ||
| 195 | * LDO2 | ||
| 196 | * 0.8 or 0.9V | ||
| 197 | */ | ||
| 198 | const unsigned int ldo_2_volts[] = { | ||
| 199 | 900000, 800000 | ||
| 200 | }; | ||
| 201 | |||
| 202 | /* | ||
| 203 | * LDO3 | ||
| 204 | * 1.8 to 3.3V (100mV step) | ||
| 205 | */ | ||
| 206 | static const struct regulator_linear_range bd71837_ldo3_voltage_ranges[] = { | ||
| 207 | REGULATOR_LINEAR_RANGE(1800000, 0x00, 0x0F, 100000), | ||
| 208 | }; | ||
| 209 | |||
| 210 | /* | ||
| 211 | * LDO4 | ||
| 212 | * 0.9 to 1.8V (100mV step) | ||
| 213 | */ | ||
| 214 | static const struct regulator_linear_range bd71837_ldo4_voltage_ranges[] = { | ||
| 215 | REGULATOR_LINEAR_RANGE(900000, 0x00, 0x09, 100000), | ||
| 216 | REGULATOR_LINEAR_RANGE(1800000, 0x0A, 0x0F, 0), | ||
| 217 | }; | ||
| 218 | |||
| 219 | /* | ||
| 220 | * LDO5 | ||
| 221 | * 1.8 to 3.3V (100mV step) | ||
| 222 | */ | ||
| 223 | static const struct regulator_linear_range bd71837_ldo5_voltage_ranges[] = { | ||
| 224 | REGULATOR_LINEAR_RANGE(1800000, 0x00, 0x0F, 100000), | ||
| 225 | }; | ||
| 226 | |||
| 227 | /* | ||
| 228 | * LDO6 | ||
| 229 | * 0.9 to 1.8V (100mV step) | ||
| 230 | */ | ||
| 231 | static const struct regulator_linear_range bd71837_ldo6_voltage_ranges[] = { | ||
| 232 | REGULATOR_LINEAR_RANGE(900000, 0x00, 0x09, 100000), | ||
| 233 | REGULATOR_LINEAR_RANGE(1800000, 0x0A, 0x0F, 0), | ||
| 234 | }; | ||
| 235 | |||
| 236 | /* | ||
| 237 | * LDO7 | ||
| 238 | * 1.8 to 3.3V (100mV step) | ||
| 239 | */ | ||
| 240 | static const struct regulator_linear_range bd71837_ldo7_voltage_ranges[] = { | ||
| 241 | REGULATOR_LINEAR_RANGE(1800000, 0x00, 0x0F, 100000), | ||
| 242 | }; | ||
| 243 | |||
| 244 | static const struct regulator_desc bd71837_regulators[] = { | ||
| 245 | { | ||
| 246 | .name = "buck1", | ||
| 247 | .of_match = of_match_ptr("BUCK1"), | ||
| 248 | .regulators_node = of_match_ptr("regulators"), | ||
| 249 | .id = BD71837_BUCK1, | ||
| 250 | .ops = &bd71837_buck1234_regulator_ops, | ||
| 251 | .type = REGULATOR_VOLTAGE, | ||
| 252 | .n_voltages = BD71837_BUCK1_VOLTAGE_NUM, | ||
| 253 | .linear_ranges = bd71837_buck1234_voltage_ranges, | ||
| 254 | .n_linear_ranges = ARRAY_SIZE(bd71837_buck1234_voltage_ranges), | ||
| 255 | .vsel_reg = BD71837_REG_BUCK1_VOLT_RUN, | ||
| 256 | .vsel_mask = BUCK1_RUN_MASK, | ||
| 257 | .enable_reg = BD71837_REG_BUCK1_CTRL, | ||
| 258 | .enable_mask = BD71837_BUCK_EN, | ||
| 259 | .owner = THIS_MODULE, | ||
| 260 | }, | ||
| 261 | { | ||
| 262 | .name = "buck2", | ||
| 263 | .of_match = of_match_ptr("BUCK2"), | ||
| 264 | .regulators_node = of_match_ptr("regulators"), | ||
| 265 | .id = BD71837_BUCK2, | ||
| 266 | .ops = &bd71837_buck1234_regulator_ops, | ||
| 267 | .type = REGULATOR_VOLTAGE, | ||
| 268 | .n_voltages = BD71837_BUCK2_VOLTAGE_NUM, | ||
| 269 | .linear_ranges = bd71837_buck1234_voltage_ranges, | ||
| 270 | .n_linear_ranges = ARRAY_SIZE(bd71837_buck1234_voltage_ranges), | ||
| 271 | .vsel_reg = BD71837_REG_BUCK2_VOLT_RUN, | ||
| 272 | .vsel_mask = BUCK2_RUN_MASK, | ||
| 273 | .enable_reg = BD71837_REG_BUCK2_CTRL, | ||
| 274 | .enable_mask = BD71837_BUCK_EN, | ||
| 275 | .owner = THIS_MODULE, | ||
| 276 | }, | ||
| 277 | { | ||
| 278 | .name = "buck3", | ||
| 279 | .of_match = of_match_ptr("BUCK3"), | ||
| 280 | .regulators_node = of_match_ptr("regulators"), | ||
| 281 | .id = BD71837_BUCK3, | ||
| 282 | .ops = &bd71837_buck1234_regulator_ops, | ||
| 283 | .type = REGULATOR_VOLTAGE, | ||
| 284 | .n_voltages = BD71837_BUCK3_VOLTAGE_NUM, | ||
| 285 | .linear_ranges = bd71837_buck1234_voltage_ranges, | ||
| 286 | .n_linear_ranges = ARRAY_SIZE(bd71837_buck1234_voltage_ranges), | ||
| 287 | .vsel_reg = BD71837_REG_BUCK3_VOLT_RUN, | ||
| 288 | .vsel_mask = BUCK3_RUN_MASK, | ||
| 289 | .enable_reg = BD71837_REG_BUCK3_CTRL, | ||
| 290 | .enable_mask = BD71837_BUCK_EN, | ||
| 291 | .owner = THIS_MODULE, | ||
| 292 | }, | ||
| 293 | { | ||
| 294 | .name = "buck4", | ||
| 295 | .of_match = of_match_ptr("BUCK4"), | ||
| 296 | .regulators_node = of_match_ptr("regulators"), | ||
| 297 | .id = BD71837_BUCK4, | ||
| 298 | .ops = &bd71837_buck1234_regulator_ops, | ||
| 299 | .type = REGULATOR_VOLTAGE, | ||
| 300 | .n_voltages = BD71837_BUCK4_VOLTAGE_NUM, | ||
| 301 | .linear_ranges = bd71837_buck1234_voltage_ranges, | ||
| 302 | .n_linear_ranges = ARRAY_SIZE(bd71837_buck1234_voltage_ranges), | ||
| 303 | .vsel_reg = BD71837_REG_BUCK4_VOLT_RUN, | ||
| 304 | .vsel_mask = BUCK4_RUN_MASK, | ||
| 305 | .enable_reg = BD71837_REG_BUCK4_CTRL, | ||
| 306 | .enable_mask = BD71837_BUCK_EN, | ||
| 307 | .owner = THIS_MODULE, | ||
| 308 | }, | ||
| 309 | { | ||
| 310 | .name = "buck5", | ||
| 311 | .of_match = of_match_ptr("BUCK5"), | ||
| 312 | .regulators_node = of_match_ptr("regulators"), | ||
| 313 | .id = BD71837_BUCK5, | ||
| 314 | .ops = &bd71837_buck_regulator_ops, | ||
| 315 | .type = REGULATOR_VOLTAGE, | ||
| 316 | .n_voltages = BD71837_BUCK5_VOLTAGE_NUM, | ||
| 317 | .linear_ranges = bd71837_buck5_voltage_ranges, | ||
| 318 | .n_linear_ranges = ARRAY_SIZE(bd71837_buck5_voltage_ranges), | ||
| 319 | .vsel_reg = BD71837_REG_BUCK5_VOLT, | ||
| 320 | .vsel_mask = BUCK5_MASK, | ||
| 321 | .enable_reg = BD71837_REG_BUCK5_CTRL, | ||
| 322 | .enable_mask = BD71837_BUCK_EN, | ||
| 323 | .owner = THIS_MODULE, | ||
| 324 | }, | ||
| 325 | { | ||
| 326 | .name = "buck6", | ||
| 327 | .of_match = of_match_ptr("BUCK6"), | ||
| 328 | .regulators_node = of_match_ptr("regulators"), | ||
| 329 | .id = BD71837_BUCK6, | ||
| 330 | .ops = &bd71837_buck_regulator_ops, | ||
| 331 | .type = REGULATOR_VOLTAGE, | ||
| 332 | .n_voltages = BD71837_BUCK6_VOLTAGE_NUM, | ||
| 333 | .linear_ranges = bd71837_buck6_voltage_ranges, | ||
| 334 | .n_linear_ranges = ARRAY_SIZE(bd71837_buck6_voltage_ranges), | ||
| 335 | .vsel_reg = BD71837_REG_BUCK6_VOLT, | ||
| 336 | .vsel_mask = BUCK6_MASK, | ||
| 337 | .enable_reg = BD71837_REG_BUCK6_CTRL, | ||
| 338 | .enable_mask = BD71837_BUCK_EN, | ||
| 339 | .owner = THIS_MODULE, | ||
| 340 | }, | ||
| 341 | { | ||
| 342 | .name = "buck7", | ||
| 343 | .of_match = of_match_ptr("BUCK7"), | ||
| 344 | .regulators_node = of_match_ptr("regulators"), | ||
| 345 | .id = BD71837_BUCK7, | ||
| 346 | .ops = &bd71837_buck_regulator_nolinear_ops, | ||
| 347 | .type = REGULATOR_VOLTAGE, | ||
| 348 | .volt_table = &buck_7_volts[0], | ||
| 349 | .n_voltages = ARRAY_SIZE(buck_7_volts), | ||
| 350 | .vsel_reg = BD71837_REG_BUCK7_VOLT, | ||
| 351 | .vsel_mask = BUCK7_MASK, | ||
| 352 | .enable_reg = BD71837_REG_BUCK7_CTRL, | ||
| 353 | .enable_mask = BD71837_BUCK_EN, | ||
| 354 | .owner = THIS_MODULE, | ||
| 355 | }, | ||
| 356 | { | ||
| 357 | .name = "buck8", | ||
| 358 | .of_match = of_match_ptr("BUCK8"), | ||
| 359 | .regulators_node = of_match_ptr("regulators"), | ||
| 360 | .id = BD71837_BUCK8, | ||
| 361 | .ops = &bd71837_buck_regulator_ops, | ||
| 362 | .type = REGULATOR_VOLTAGE, | ||
| 363 | .n_voltages = BD71837_BUCK8_VOLTAGE_NUM, | ||
| 364 | .linear_ranges = bd71837_buck8_voltage_ranges, | ||
| 365 | .n_linear_ranges = ARRAY_SIZE(bd71837_buck8_voltage_ranges), | ||
| 366 | .vsel_reg = BD71837_REG_BUCK8_VOLT, | ||
| 367 | .vsel_mask = BUCK8_MASK, | ||
| 368 | .enable_reg = BD71837_REG_BUCK8_CTRL, | ||
| 369 | .enable_mask = BD71837_BUCK_EN, | ||
| 370 | .owner = THIS_MODULE, | ||
| 371 | }, | ||
| 372 | { | ||
| 373 | .name = "ldo1", | ||
| 374 | .of_match = of_match_ptr("LDO1"), | ||
| 375 | .regulators_node = of_match_ptr("regulators"), | ||
| 376 | .id = BD71837_LDO1, | ||
| 377 | .ops = &bd71837_ldo_regulator_ops, | ||
| 378 | .type = REGULATOR_VOLTAGE, | ||
| 379 | .n_voltages = BD71837_LDO1_VOLTAGE_NUM, | ||
| 380 | .linear_ranges = bd71837_ldo1_voltage_ranges, | ||
| 381 | .n_linear_ranges = ARRAY_SIZE(bd71837_ldo1_voltage_ranges), | ||
| 382 | .vsel_reg = BD71837_REG_LDO1_VOLT, | ||
| 383 | .vsel_mask = LDO1_MASK, | ||
| 384 | .enable_reg = BD71837_REG_LDO1_VOLT, | ||
| 385 | .enable_mask = BD71837_LDO_EN, | ||
| 386 | .owner = THIS_MODULE, | ||
| 387 | }, | ||
| 388 | { | ||
| 389 | .name = "ldo2", | ||
| 390 | .of_match = of_match_ptr("LDO2"), | ||
| 391 | .regulators_node = of_match_ptr("regulators"), | ||
| 392 | .id = BD71837_LDO2, | ||
| 393 | .ops = &bd71837_ldo_regulator_nolinear_ops, | ||
| 394 | .type = REGULATOR_VOLTAGE, | ||
| 395 | .volt_table = &ldo_2_volts[0], | ||
| 396 | .vsel_reg = BD71837_REG_LDO2_VOLT, | ||
| 397 | .vsel_mask = LDO2_MASK, | ||
| 398 | .n_voltages = ARRAY_SIZE(ldo_2_volts), | ||
| 399 | .n_voltages = BD71837_LDO2_VOLTAGE_NUM, | ||
| 400 | .enable_reg = BD71837_REG_LDO2_VOLT, | ||
| 401 | .enable_mask = BD71837_LDO_EN, | ||
| 402 | .owner = THIS_MODULE, | ||
| 403 | }, | ||
| 404 | { | ||
| 405 | .name = "ldo3", | ||
| 406 | .of_match = of_match_ptr("LDO3"), | ||
| 407 | .regulators_node = of_match_ptr("regulators"), | ||
| 408 | .id = BD71837_LDO3, | ||
| 409 | .ops = &bd71837_ldo_regulator_ops, | ||
| 410 | .type = REGULATOR_VOLTAGE, | ||
| 411 | .n_voltages = BD71837_LDO3_VOLTAGE_NUM, | ||
| 412 | .linear_ranges = bd71837_ldo3_voltage_ranges, | ||
| 413 | .n_linear_ranges = ARRAY_SIZE(bd71837_ldo3_voltage_ranges), | ||
| 414 | .vsel_reg = BD71837_REG_LDO3_VOLT, | ||
| 415 | .vsel_mask = LDO3_MASK, | ||
| 416 | .enable_reg = BD71837_REG_LDO3_VOLT, | ||
| 417 | .enable_mask = BD71837_LDO_EN, | ||
| 418 | .owner = THIS_MODULE, | ||
| 419 | }, | ||
| 420 | { | ||
| 421 | .name = "ldo4", | ||
| 422 | .of_match = of_match_ptr("LDO4"), | ||
| 423 | .regulators_node = of_match_ptr("regulators"), | ||
| 424 | .id = BD71837_LDO4, | ||
| 425 | .ops = &bd71837_ldo_regulator_ops, | ||
| 426 | .type = REGULATOR_VOLTAGE, | ||
| 427 | .n_voltages = BD71837_LDO4_VOLTAGE_NUM, | ||
| 428 | .linear_ranges = bd71837_ldo4_voltage_ranges, | ||
| 429 | .n_linear_ranges = ARRAY_SIZE(bd71837_ldo4_voltage_ranges), | ||
| 430 | .vsel_reg = BD71837_REG_LDO4_VOLT, | ||
| 431 | .vsel_mask = LDO4_MASK, | ||
| 432 | .enable_reg = BD71837_REG_LDO4_VOLT, | ||
| 433 | .enable_mask = BD71837_LDO_EN, | ||
| 434 | .owner = THIS_MODULE, | ||
| 435 | }, | ||
| 436 | { | ||
| 437 | .name = "ldo5", | ||
| 438 | .of_match = of_match_ptr("LDO5"), | ||
| 439 | .regulators_node = of_match_ptr("regulators"), | ||
| 440 | .id = BD71837_LDO5, | ||
| 441 | .ops = &bd71837_ldo_regulator_ops, | ||
| 442 | .type = REGULATOR_VOLTAGE, | ||
| 443 | .n_voltages = BD71837_LDO5_VOLTAGE_NUM, | ||
| 444 | .linear_ranges = bd71837_ldo5_voltage_ranges, | ||
| 445 | .n_linear_ranges = ARRAY_SIZE(bd71837_ldo5_voltage_ranges), | ||
| 446 | /* LDO5 is supplied by buck6 */ | ||
| 447 | .supply_name = "buck6", | ||
| 448 | .vsel_reg = BD71837_REG_LDO5_VOLT, | ||
| 449 | .vsel_mask = LDO5_MASK, | ||
| 450 | .enable_reg = BD71837_REG_LDO5_VOLT, | ||
| 451 | .enable_mask = BD71837_LDO_EN, | ||
| 452 | .owner = THIS_MODULE, | ||
| 453 | }, | ||
| 454 | { | ||
| 455 | .name = "ldo6", | ||
| 456 | .of_match = of_match_ptr("LDO6"), | ||
| 457 | .regulators_node = of_match_ptr("regulators"), | ||
| 458 | .id = BD71837_LDO6, | ||
| 459 | .ops = &bd71837_ldo_regulator_ops, | ||
| 460 | .type = REGULATOR_VOLTAGE, | ||
| 461 | .n_voltages = BD71837_LDO6_VOLTAGE_NUM, | ||
| 462 | .linear_ranges = bd71837_ldo6_voltage_ranges, | ||
| 463 | .n_linear_ranges = ARRAY_SIZE(bd71837_ldo6_voltage_ranges), | ||
| 464 | /* LDO6 is supplied by buck7 */ | ||
| 465 | .supply_name = "buck7", | ||
| 466 | .vsel_reg = BD71837_REG_LDO6_VOLT, | ||
| 467 | .vsel_mask = LDO6_MASK, | ||
| 468 | .enable_reg = BD71837_REG_LDO6_VOLT, | ||
| 469 | .enable_mask = BD71837_LDO_EN, | ||
| 470 | .owner = THIS_MODULE, | ||
| 471 | }, | ||
| 472 | { | ||
| 473 | .name = "ldo7", | ||
| 474 | .of_match = of_match_ptr("LDO7"), | ||
| 475 | .regulators_node = of_match_ptr("regulators"), | ||
| 476 | .id = BD71837_LDO7, | ||
| 477 | .ops = &bd71837_ldo_regulator_ops, | ||
| 478 | .type = REGULATOR_VOLTAGE, | ||
| 479 | .n_voltages = BD71837_LDO7_VOLTAGE_NUM, | ||
| 480 | .linear_ranges = bd71837_ldo7_voltage_ranges, | ||
| 481 | .n_linear_ranges = ARRAY_SIZE(bd71837_ldo7_voltage_ranges), | ||
| 482 | .vsel_reg = BD71837_REG_LDO7_VOLT, | ||
| 483 | .vsel_mask = LDO7_MASK, | ||
| 484 | .enable_reg = BD71837_REG_LDO7_VOLT, | ||
| 485 | .enable_mask = BD71837_LDO_EN, | ||
| 486 | .owner = THIS_MODULE, | ||
| 487 | }, | ||
| 488 | }; | ||
| 489 | |||
| 490 | struct reg_init { | ||
| 491 | unsigned int reg; | ||
| 492 | unsigned int mask; | ||
| 493 | }; | ||
| 494 | |||
| 495 | static int bd71837_probe(struct platform_device *pdev) | ||
| 496 | { | ||
| 497 | struct bd71837_pmic *pmic; | ||
| 498 | struct bd71837_board *pdata; | ||
| 499 | struct regulator_config config = { 0 }; | ||
| 500 | struct reg_init pmic_regulator_inits[] = { | ||
| 501 | { | ||
| 502 | .reg = BD71837_REG_BUCK1_CTRL, | ||
| 503 | .mask = BD71837_BUCK_SEL, | ||
| 504 | }, { | ||
| 505 | .reg = BD71837_REG_BUCK2_CTRL, | ||
| 506 | .mask = BD71837_BUCK_SEL, | ||
| 507 | }, { | ||
| 508 | .reg = BD71837_REG_BUCK3_CTRL, | ||
| 509 | .mask = BD71837_BUCK_SEL, | ||
| 510 | }, { | ||
| 511 | .reg = BD71837_REG_BUCK4_CTRL, | ||
| 512 | .mask = BD71837_BUCK_SEL, | ||
| 513 | }, { | ||
| 514 | .reg = BD71837_REG_BUCK5_CTRL, | ||
| 515 | .mask = BD71837_BUCK_SEL, | ||
| 516 | }, { | ||
| 517 | .reg = BD71837_REG_BUCK6_CTRL, | ||
| 518 | .mask = BD71837_BUCK_SEL, | ||
| 519 | }, { | ||
| 520 | .reg = BD71837_REG_BUCK7_CTRL, | ||
| 521 | .mask = BD71837_BUCK_SEL, | ||
| 522 | }, { | ||
| 523 | .reg = BD71837_REG_BUCK8_CTRL, | ||
| 524 | .mask = BD71837_BUCK_SEL, | ||
| 525 | }, { | ||
| 526 | .reg = BD71837_REG_LDO1_VOLT, | ||
| 527 | .mask = BD71837_LDO_SEL, | ||
| 528 | }, { | ||
| 529 | .reg = BD71837_REG_LDO2_VOLT, | ||
| 530 | .mask = BD71837_LDO_SEL, | ||
| 531 | }, { | ||
| 532 | .reg = BD71837_REG_LDO3_VOLT, | ||
| 533 | .mask = BD71837_LDO_SEL, | ||
| 534 | }, { | ||
| 535 | .reg = BD71837_REG_LDO4_VOLT, | ||
| 536 | .mask = BD71837_LDO_SEL, | ||
| 537 | }, { | ||
| 538 | .reg = BD71837_REG_LDO5_VOLT, | ||
| 539 | .mask = BD71837_LDO_SEL, | ||
| 540 | }, { | ||
| 541 | .reg = BD71837_REG_LDO6_VOLT, | ||
| 542 | .mask = BD71837_LDO_SEL, | ||
| 543 | }, { | ||
| 544 | .reg = BD71837_REG_LDO7_VOLT, | ||
| 545 | .mask = BD71837_LDO_SEL, | ||
| 546 | } | ||
| 547 | }; | ||
| 548 | |||
| 549 | int i, err; | ||
| 550 | |||
| 551 | pmic = devm_kzalloc(&pdev->dev, sizeof(struct bd71837_pmic), | ||
| 552 | GFP_KERNEL); | ||
| 553 | if (!pmic) | ||
| 554 | return -ENOMEM; | ||
| 555 | |||
| 556 | memcpy(pmic->descs, bd71837_regulators, sizeof(pmic->descs)); | ||
| 557 | |||
| 558 | pmic->pdev = pdev; | ||
| 559 | pmic->mfd = dev_get_drvdata(pdev->dev.parent); | ||
| 560 | |||
| 561 | if (!pmic->mfd) { | ||
| 562 | dev_err(&pdev->dev, "No MFD driver data\n"); | ||
| 563 | err = -EINVAL; | ||
| 564 | goto err; | ||
| 565 | } | ||
| 566 | platform_set_drvdata(pdev, pmic); | ||
| 567 | pdata = dev_get_platdata(pmic->mfd->dev); | ||
| 568 | |||
| 569 | /* Register LOCK release */ | ||
| 570 | err = regmap_update_bits(pmic->mfd->regmap, BD71837_REG_REGLOCK, | ||
| 571 | (REGLOCK_PWRSEQ | REGLOCK_VREG), 0); | ||
| 572 | if (err) { | ||
| 573 | dev_err(&pmic->pdev->dev, "Failed to unlock PMIC (%d)\n", err); | ||
| 574 | goto err; | ||
| 575 | } else { | ||
| 576 | dev_dbg(&pmic->pdev->dev, "%s: Unlocked lock register 0x%x\n", | ||
| 577 | __func__, BD71837_REG_REGLOCK); | ||
| 578 | } | ||
| 579 | |||
| 580 | for (i = 0; i < ARRAY_SIZE(pmic_regulator_inits); i++) { | ||
| 581 | |||
| 582 | struct regulator_desc *desc; | ||
| 583 | struct regulator_dev *rdev; | ||
| 584 | |||
| 585 | desc = &pmic->descs[i]; | ||
| 586 | |||
| 587 | if (pdata) | ||
| 588 | config.init_data = pdata->init_data[i]; | ||
| 589 | |||
| 590 | config.dev = pdev->dev.parent; | ||
| 591 | config.driver_data = pmic; | ||
| 592 | config.regmap = pmic->mfd->regmap; | ||
| 593 | |||
| 594 | rdev = devm_regulator_register(&pdev->dev, desc, &config); | ||
| 595 | if (IS_ERR(rdev)) { | ||
| 596 | dev_err(pmic->mfd->dev, | ||
| 597 | "failed to register %s regulator\n", | ||
| 598 | desc->name); | ||
| 599 | err = PTR_ERR(rdev); | ||
| 600 | goto err; | ||
| 601 | } | ||
| 602 | /* Regulator register gets the regulator constraints and | ||
| 603 | * applies them (set_machine_constraints). This should have | ||
| 604 | * turned the control register(s) to correct values and we | ||
| 605 | * can now switch the control from PMIC state machine to the | ||
| 606 | * register interface | ||
| 607 | */ | ||
| 608 | err = regmap_update_bits(pmic->mfd->regmap, | ||
| 609 | pmic_regulator_inits[i].reg, | ||
| 610 | pmic_regulator_inits[i].mask, | ||
| 611 | 0xFFFFFFFF); | ||
| 612 | if (err) { | ||
| 613 | dev_err(&pmic->pdev->dev, | ||
| 614 | "Failed to write BUCK/LDO SEL bit for (%s)\n", | ||
| 615 | desc->name); | ||
| 616 | goto err; | ||
| 617 | } | ||
| 618 | |||
| 619 | pmic->rdev[i] = rdev; | ||
| 620 | } | ||
| 621 | |||
| 622 | return 0; | ||
| 623 | |||
| 624 | err: | ||
| 625 | return err; | ||
| 626 | } | ||
| 627 | |||
| 628 | static struct platform_driver bd71837_regulator = { | ||
| 629 | .driver = { | ||
| 630 | .name = "bd71837-pmic", | ||
| 631 | .owner = THIS_MODULE, | ||
| 632 | }, | ||
| 633 | .probe = bd71837_probe, | ||
| 634 | }; | ||
| 635 | |||
| 636 | module_platform_driver(bd71837_regulator); | ||
| 637 | |||
| 638 | MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>"); | ||
| 639 | MODULE_DESCRIPTION("BD71837 voltage regulator driver"); | ||
| 640 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/regulator/bd9571mwv-regulator.c b/drivers/regulator/bd9571mwv-regulator.c index c67a83d53c4c..be574eb444eb 100644 --- a/drivers/regulator/bd9571mwv-regulator.c +++ b/drivers/regulator/bd9571mwv-regulator.c | |||
| @@ -24,6 +24,18 @@ | |||
| 24 | 24 | ||
| 25 | #include <linux/mfd/bd9571mwv.h> | 25 | #include <linux/mfd/bd9571mwv.h> |
| 26 | 26 | ||
| 27 | struct bd9571mwv_reg { | ||
| 28 | struct bd9571mwv *bd; | ||
| 29 | |||
| 30 | /* DDR Backup Power */ | ||
| 31 | u8 bkup_mode_cnt_keepon; /* from "rohm,ddr-backup-power" */ | ||
| 32 | u8 bkup_mode_cnt_saved; | ||
| 33 | |||
| 34 | /* Power switch type */ | ||
| 35 | bool rstbmode_level; | ||
| 36 | bool rstbmode_pulse; | ||
| 37 | }; | ||
| 38 | |||
| 27 | enum bd9571mwv_regulators { VD09, VD18, VD25, VD33, DVFS }; | 39 | enum bd9571mwv_regulators { VD09, VD18, VD25, VD33, DVFS }; |
| 28 | 40 | ||
| 29 | #define BD9571MWV_REG(_name, _of, _id, _ops, _vr, _vm, _nv, _min, _step, _lmin)\ | 41 | #define BD9571MWV_REG(_name, _of, _id, _ops, _vr, _vm, _nv, _min, _step, _lmin)\ |
| @@ -131,14 +143,99 @@ static struct regulator_desc regulators[] = { | |||
| 131 | 0x80, 600000, 10000, 0x3c), | 143 | 0x80, 600000, 10000, 0x3c), |
| 132 | }; | 144 | }; |
| 133 | 145 | ||
| 146 | #ifdef CONFIG_PM_SLEEP | ||
| 147 | static int bd9571mwv_bkup_mode_read(struct bd9571mwv *bd, unsigned int *mode) | ||
| 148 | { | ||
| 149 | int ret; | ||
| 150 | |||
| 151 | ret = regmap_read(bd->regmap, BD9571MWV_BKUP_MODE_CNT, mode); | ||
| 152 | if (ret) { | ||
| 153 | dev_err(bd->dev, "failed to read backup mode (%d)\n", ret); | ||
| 154 | return ret; | ||
| 155 | } | ||
| 156 | |||
| 157 | return 0; | ||
| 158 | } | ||
| 159 | |||
| 160 | static int bd9571mwv_bkup_mode_write(struct bd9571mwv *bd, unsigned int mode) | ||
| 161 | { | ||
| 162 | int ret; | ||
| 163 | |||
| 164 | ret = regmap_write(bd->regmap, BD9571MWV_BKUP_MODE_CNT, mode); | ||
| 165 | if (ret) { | ||
| 166 | dev_err(bd->dev, "failed to configure backup mode 0x%x (%d)\n", | ||
| 167 | mode, ret); | ||
| 168 | return ret; | ||
| 169 | } | ||
| 170 | |||
| 171 | return 0; | ||
| 172 | } | ||
| 173 | |||
| 174 | static int bd9571mwv_suspend(struct device *dev) | ||
| 175 | { | ||
| 176 | struct bd9571mwv_reg *bdreg = dev_get_drvdata(dev); | ||
| 177 | unsigned int mode; | ||
| 178 | int ret; | ||
| 179 | |||
| 180 | if (!device_may_wakeup(dev)) | ||
| 181 | return 0; | ||
| 182 | |||
| 183 | /* Save DDR Backup Mode */ | ||
| 184 | ret = bd9571mwv_bkup_mode_read(bdreg->bd, &mode); | ||
| 185 | if (ret) | ||
| 186 | return ret; | ||
| 187 | |||
| 188 | bdreg->bkup_mode_cnt_saved = mode; | ||
| 189 | |||
| 190 | if (!bdreg->rstbmode_pulse) | ||
| 191 | return 0; | ||
| 192 | |||
| 193 | /* Enable DDR Backup Mode */ | ||
| 194 | mode &= ~BD9571MWV_BKUP_MODE_CNT_KEEPON_MASK; | ||
| 195 | mode |= bdreg->bkup_mode_cnt_keepon; | ||
| 196 | |||
| 197 | if (mode != bdreg->bkup_mode_cnt_saved) | ||
| 198 | return bd9571mwv_bkup_mode_write(bdreg->bd, mode); | ||
| 199 | |||
| 200 | return 0; | ||
| 201 | } | ||
| 202 | |||
| 203 | static int bd9571mwv_resume(struct device *dev) | ||
| 204 | { | ||
| 205 | struct bd9571mwv_reg *bdreg = dev_get_drvdata(dev); | ||
| 206 | |||
| 207 | if (!device_may_wakeup(dev)) | ||
| 208 | return 0; | ||
| 209 | |||
| 210 | /* Restore DDR Backup Mode */ | ||
| 211 | return bd9571mwv_bkup_mode_write(bdreg->bd, bdreg->bkup_mode_cnt_saved); | ||
| 212 | } | ||
| 213 | |||
| 214 | static const struct dev_pm_ops bd9571mwv_pm = { | ||
| 215 | SET_SYSTEM_SLEEP_PM_OPS(bd9571mwv_suspend, bd9571mwv_resume) | ||
| 216 | }; | ||
| 217 | |||
| 218 | #define DEV_PM_OPS &bd9571mwv_pm | ||
| 219 | #else | ||
| 220 | #define DEV_PM_OPS NULL | ||
| 221 | #endif /* CONFIG_PM_SLEEP */ | ||
| 222 | |||
| 134 | static int bd9571mwv_regulator_probe(struct platform_device *pdev) | 223 | static int bd9571mwv_regulator_probe(struct platform_device *pdev) |
| 135 | { | 224 | { |
| 136 | struct bd9571mwv *bd = dev_get_drvdata(pdev->dev.parent); | 225 | struct bd9571mwv *bd = dev_get_drvdata(pdev->dev.parent); |
| 137 | struct regulator_config config = { }; | 226 | struct regulator_config config = { }; |
| 227 | struct bd9571mwv_reg *bdreg; | ||
| 138 | struct regulator_dev *rdev; | 228 | struct regulator_dev *rdev; |
| 229 | unsigned int val; | ||
| 139 | int i; | 230 | int i; |
| 140 | 231 | ||
| 141 | platform_set_drvdata(pdev, bd); | 232 | bdreg = devm_kzalloc(&pdev->dev, sizeof(*bdreg), GFP_KERNEL); |
| 233 | if (!bdreg) | ||
| 234 | return -ENOMEM; | ||
| 235 | |||
| 236 | bdreg->bd = bd; | ||
| 237 | |||
| 238 | platform_set_drvdata(pdev, bdreg); | ||
| 142 | 239 | ||
| 143 | config.dev = &pdev->dev; | 240 | config.dev = &pdev->dev; |
| 144 | config.dev->of_node = bd->dev->of_node; | 241 | config.dev->of_node = bd->dev->of_node; |
| @@ -155,6 +252,33 @@ static int bd9571mwv_regulator_probe(struct platform_device *pdev) | |||
| 155 | } | 252 | } |
| 156 | } | 253 | } |
| 157 | 254 | ||
| 255 | val = 0; | ||
| 256 | of_property_read_u32(bd->dev->of_node, "rohm,ddr-backup-power", &val); | ||
| 257 | if (val & ~BD9571MWV_BKUP_MODE_CNT_KEEPON_MASK) { | ||
| 258 | dev_err(bd->dev, "invalid %s mode %u\n", | ||
| 259 | "rohm,ddr-backup-power", val); | ||
| 260 | return -EINVAL; | ||
| 261 | } | ||
| 262 | bdreg->bkup_mode_cnt_keepon = val; | ||
| 263 | |||
| 264 | bdreg->rstbmode_level = of_property_read_bool(bd->dev->of_node, | ||
| 265 | "rohm,rstbmode-level"); | ||
| 266 | bdreg->rstbmode_pulse = of_property_read_bool(bd->dev->of_node, | ||
| 267 | "rohm,rstbmode-pulse"); | ||
| 268 | if (bdreg->rstbmode_level && bdreg->rstbmode_pulse) { | ||
| 269 | dev_err(bd->dev, "only one rohm,rstbmode-* may be specified"); | ||
| 270 | return -EINVAL; | ||
| 271 | } | ||
| 272 | |||
| 273 | if (bdreg->bkup_mode_cnt_keepon) { | ||
| 274 | device_set_wakeup_capable(&pdev->dev, true); | ||
| 275 | /* | ||
| 276 | * Wakeup is enabled by default in pulse mode, but needs | ||
| 277 | * explicit user setup in level mode. | ||
| 278 | */ | ||
| 279 | device_set_wakeup_enable(&pdev->dev, bdreg->rstbmode_pulse); | ||
| 280 | } | ||
| 281 | |||
| 158 | return 0; | 282 | return 0; |
| 159 | } | 283 | } |
| 160 | 284 | ||
| @@ -167,6 +291,7 @@ MODULE_DEVICE_TABLE(platform, bd9571mwv_regulator_id_table); | |||
| 167 | static struct platform_driver bd9571mwv_regulator_driver = { | 291 | static struct platform_driver bd9571mwv_regulator_driver = { |
| 168 | .driver = { | 292 | .driver = { |
| 169 | .name = "bd9571mwv-regulator", | 293 | .name = "bd9571mwv-regulator", |
| 294 | .pm = DEV_PM_OPS, | ||
| 170 | }, | 295 | }, |
| 171 | .probe = bd9571mwv_regulator_probe, | 296 | .probe = bd9571mwv_regulator_probe, |
| 172 | .id_table = bd9571mwv_regulator_id_table, | 297 | .id_table = bd9571mwv_regulator_id_table, |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index d4803460a557..6ed568b96c0e 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
| @@ -147,6 +147,56 @@ static inline struct regulator_dev *rdev_get_supply(struct regulator_dev *rdev) | |||
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | /** | 149 | /** |
| 150 | * regulator_lock_nested - lock a single regulator | ||
| 151 | * @rdev: regulator source | ||
| 152 | * @subclass: mutex subclass used for lockdep | ||
| 153 | * | ||
| 154 | * This function can be called many times by one task on | ||
| 155 | * a single regulator and its mutex will be locked only | ||
| 156 | * once. If a task, which is calling this function is other | ||
| 157 | * than the one, which initially locked the mutex, it will | ||
| 158 | * wait on mutex. | ||
| 159 | */ | ||
| 160 | static void regulator_lock_nested(struct regulator_dev *rdev, | ||
| 161 | unsigned int subclass) | ||
| 162 | { | ||
| 163 | if (!mutex_trylock(&rdev->mutex)) { | ||
| 164 | if (rdev->mutex_owner == current) { | ||
| 165 | rdev->ref_cnt++; | ||
| 166 | return; | ||
| 167 | } | ||
| 168 | mutex_lock_nested(&rdev->mutex, subclass); | ||
| 169 | } | ||
| 170 | |||
| 171 | rdev->ref_cnt = 1; | ||
| 172 | rdev->mutex_owner = current; | ||
| 173 | } | ||
| 174 | |||
| 175 | static inline void regulator_lock(struct regulator_dev *rdev) | ||
| 176 | { | ||
| 177 | regulator_lock_nested(rdev, 0); | ||
| 178 | } | ||
| 179 | |||
| 180 | /** | ||
| 181 | * regulator_unlock - unlock a single regulator | ||
| 182 | * @rdev: regulator_source | ||
| 183 | * | ||
| 184 | * This function unlocks the mutex when the | ||
| 185 | * reference counter reaches 0. | ||
| 186 | */ | ||
| 187 | static void regulator_unlock(struct regulator_dev *rdev) | ||
| 188 | { | ||
| 189 | if (rdev->ref_cnt != 0) { | ||
| 190 | rdev->ref_cnt--; | ||
| 191 | |||
| 192 | if (!rdev->ref_cnt) { | ||
| 193 | rdev->mutex_owner = NULL; | ||
| 194 | mutex_unlock(&rdev->mutex); | ||
| 195 | } | ||
| 196 | } | ||
| 197 | } | ||
| 198 | |||
| 199 | /** | ||
| 150 | * regulator_lock_supply - lock a regulator and its supplies | 200 | * regulator_lock_supply - lock a regulator and its supplies |
| 151 | * @rdev: regulator source | 201 | * @rdev: regulator source |
| 152 | */ | 202 | */ |
| @@ -155,7 +205,7 @@ static void regulator_lock_supply(struct regulator_dev *rdev) | |||
| 155 | int i; | 205 | int i; |
| 156 | 206 | ||
| 157 | for (i = 0; rdev; rdev = rdev_get_supply(rdev), i++) | 207 | for (i = 0; rdev; rdev = rdev_get_supply(rdev), i++) |
| 158 | mutex_lock_nested(&rdev->mutex, i); | 208 | regulator_lock_nested(rdev, i); |
| 159 | } | 209 | } |
| 160 | 210 | ||
| 161 | /** | 211 | /** |
| @@ -167,7 +217,7 @@ static void regulator_unlock_supply(struct regulator_dev *rdev) | |||
| 167 | struct regulator *supply; | 217 | struct regulator *supply; |
| 168 | 218 | ||
| 169 | while (1) { | 219 | while (1) { |
| 170 | mutex_unlock(&rdev->mutex); | 220 | regulator_unlock(rdev); |
| 171 | supply = rdev->supply; | 221 | supply = rdev->supply; |
| 172 | 222 | ||
| 173 | if (!rdev->supply) | 223 | if (!rdev->supply) |
| @@ -350,9 +400,9 @@ static ssize_t regulator_uV_show(struct device *dev, | |||
| 350 | struct regulator_dev *rdev = dev_get_drvdata(dev); | 400 | struct regulator_dev *rdev = dev_get_drvdata(dev); |
| 351 | ssize_t ret; | 401 | ssize_t ret; |
| 352 | 402 | ||
| 353 | mutex_lock(&rdev->mutex); | 403 | regulator_lock(rdev); |
| 354 | ret = sprintf(buf, "%d\n", _regulator_get_voltage(rdev)); | 404 | ret = sprintf(buf, "%d\n", _regulator_get_voltage(rdev)); |
| 355 | mutex_unlock(&rdev->mutex); | 405 | regulator_unlock(rdev); |
| 356 | 406 | ||
| 357 | return ret; | 407 | return ret; |
| 358 | } | 408 | } |
| @@ -416,9 +466,9 @@ static ssize_t regulator_state_show(struct device *dev, | |||
| 416 | struct regulator_dev *rdev = dev_get_drvdata(dev); | 466 | struct regulator_dev *rdev = dev_get_drvdata(dev); |
| 417 | ssize_t ret; | 467 | ssize_t ret; |
| 418 | 468 | ||
| 419 | mutex_lock(&rdev->mutex); | 469 | regulator_lock(rdev); |
| 420 | ret = regulator_print_state(buf, _regulator_is_enabled(rdev)); | 470 | ret = regulator_print_state(buf, _regulator_is_enabled(rdev)); |
| 421 | mutex_unlock(&rdev->mutex); | 471 | regulator_unlock(rdev); |
| 422 | 472 | ||
| 423 | return ret; | 473 | return ret; |
| 424 | } | 474 | } |
| @@ -526,10 +576,10 @@ static ssize_t regulator_total_uA_show(struct device *dev, | |||
| 526 | struct regulator *regulator; | 576 | struct regulator *regulator; |
| 527 | int uA = 0; | 577 | int uA = 0; |
| 528 | 578 | ||
| 529 | mutex_lock(&rdev->mutex); | 579 | regulator_lock(rdev); |
| 530 | list_for_each_entry(regulator, &rdev->consumer_list, list) | 580 | list_for_each_entry(regulator, &rdev->consumer_list, list) |
| 531 | uA += regulator->uA_load; | 581 | uA += regulator->uA_load; |
| 532 | mutex_unlock(&rdev->mutex); | 582 | regulator_unlock(rdev); |
| 533 | return sprintf(buf, "%d\n", uA); | 583 | return sprintf(buf, "%d\n", uA); |
| 534 | } | 584 | } |
| 535 | static DEVICE_ATTR(requested_microamps, 0444, regulator_total_uA_show, NULL); | 585 | static DEVICE_ATTR(requested_microamps, 0444, regulator_total_uA_show, NULL); |
| @@ -886,6 +936,18 @@ static int machine_constraints_voltage(struct regulator_dev *rdev, | |||
| 886 | rdev->constraints->min_uV && rdev->constraints->max_uV) { | 936 | rdev->constraints->min_uV && rdev->constraints->max_uV) { |
| 887 | int target_min, target_max; | 937 | int target_min, target_max; |
| 888 | int current_uV = _regulator_get_voltage(rdev); | 938 | int current_uV = _regulator_get_voltage(rdev); |
| 939 | |||
| 940 | if (current_uV == -ENOTRECOVERABLE) { | ||
| 941 | /* This regulator can't be read and must be initted */ | ||
| 942 | rdev_info(rdev, "Setting %d-%duV\n", | ||
| 943 | rdev->constraints->min_uV, | ||
| 944 | rdev->constraints->max_uV); | ||
| 945 | _regulator_do_set_voltage(rdev, | ||
| 946 | rdev->constraints->min_uV, | ||
| 947 | rdev->constraints->max_uV); | ||
| 948 | current_uV = _regulator_get_voltage(rdev); | ||
| 949 | } | ||
| 950 | |||
| 889 | if (current_uV < 0) { | 951 | if (current_uV < 0) { |
| 890 | rdev_err(rdev, | 952 | rdev_err(rdev, |
| 891 | "failed to get the current voltage(%d)\n", | 953 | "failed to get the current voltage(%d)\n", |
| @@ -1321,7 +1383,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, | |||
| 1321 | if (regulator == NULL) | 1383 | if (regulator == NULL) |
| 1322 | return NULL; | 1384 | return NULL; |
| 1323 | 1385 | ||
| 1324 | mutex_lock(&rdev->mutex); | 1386 | regulator_lock(rdev); |
| 1325 | regulator->rdev = rdev; | 1387 | regulator->rdev = rdev; |
| 1326 | list_add(®ulator->list, &rdev->consumer_list); | 1388 | list_add(®ulator->list, &rdev->consumer_list); |
| 1327 | 1389 | ||
| @@ -1376,12 +1438,12 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, | |||
| 1376 | _regulator_is_enabled(rdev)) | 1438 | _regulator_is_enabled(rdev)) |
| 1377 | regulator->always_on = true; | 1439 | regulator->always_on = true; |
| 1378 | 1440 | ||
| 1379 | mutex_unlock(&rdev->mutex); | 1441 | regulator_unlock(rdev); |
| 1380 | return regulator; | 1442 | return regulator; |
| 1381 | overflow_err: | 1443 | overflow_err: |
| 1382 | list_del(®ulator->list); | 1444 | list_del(®ulator->list); |
| 1383 | kfree(regulator); | 1445 | kfree(regulator); |
| 1384 | mutex_unlock(&rdev->mutex); | 1446 | regulator_unlock(rdev); |
| 1385 | return NULL; | 1447 | return NULL; |
| 1386 | } | 1448 | } |
| 1387 | 1449 | ||
| @@ -1770,13 +1832,13 @@ static void _regulator_put(struct regulator *regulator) | |||
| 1770 | /* remove any sysfs entries */ | 1832 | /* remove any sysfs entries */ |
| 1771 | if (regulator->dev) | 1833 | if (regulator->dev) |
| 1772 | sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name); | 1834 | sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name); |
| 1773 | mutex_lock(&rdev->mutex); | 1835 | regulator_lock(rdev); |
| 1774 | list_del(®ulator->list); | 1836 | list_del(®ulator->list); |
| 1775 | 1837 | ||
| 1776 | rdev->open_count--; | 1838 | rdev->open_count--; |
| 1777 | rdev->exclusive = 0; | 1839 | rdev->exclusive = 0; |
| 1778 | put_device(&rdev->dev); | 1840 | put_device(&rdev->dev); |
| 1779 | mutex_unlock(&rdev->mutex); | 1841 | regulator_unlock(rdev); |
| 1780 | 1842 | ||
| 1781 | kfree_const(regulator->supply_name); | 1843 | kfree_const(regulator->supply_name); |
| 1782 | kfree(regulator); | 1844 | kfree(regulator); |
| @@ -2384,7 +2446,7 @@ static void regulator_disable_work(struct work_struct *work) | |||
| 2384 | disable_work.work); | 2446 | disable_work.work); |
| 2385 | int count, i, ret; | 2447 | int count, i, ret; |
| 2386 | 2448 | ||
| 2387 | mutex_lock(&rdev->mutex); | 2449 | regulator_lock(rdev); |
| 2388 | 2450 | ||
| 2389 | BUG_ON(!rdev->deferred_disables); | 2451 | BUG_ON(!rdev->deferred_disables); |
| 2390 | 2452 | ||
| @@ -2405,7 +2467,7 @@ static void regulator_disable_work(struct work_struct *work) | |||
| 2405 | rdev_err(rdev, "Deferred disable failed: %d\n", ret); | 2467 | rdev_err(rdev, "Deferred disable failed: %d\n", ret); |
| 2406 | } | 2468 | } |
| 2407 | 2469 | ||
| 2408 | mutex_unlock(&rdev->mutex); | 2470 | regulator_unlock(rdev); |
| 2409 | 2471 | ||
| 2410 | if (rdev->supply) { | 2472 | if (rdev->supply) { |
| 2411 | for (i = 0; i < count; i++) { | 2473 | for (i = 0; i < count; i++) { |
| @@ -2440,11 +2502,11 @@ int regulator_disable_deferred(struct regulator *regulator, int ms) | |||
| 2440 | if (!ms) | 2502 | if (!ms) |
| 2441 | return regulator_disable(regulator); | 2503 | return regulator_disable(regulator); |
| 2442 | 2504 | ||
| 2443 | mutex_lock(&rdev->mutex); | 2505 | regulator_lock(rdev); |
| 2444 | rdev->deferred_disables++; | 2506 | rdev->deferred_disables++; |
| 2445 | mod_delayed_work(system_power_efficient_wq, &rdev->disable_work, | 2507 | mod_delayed_work(system_power_efficient_wq, &rdev->disable_work, |
| 2446 | msecs_to_jiffies(ms)); | 2508 | msecs_to_jiffies(ms)); |
| 2447 | mutex_unlock(&rdev->mutex); | 2509 | regulator_unlock(rdev); |
| 2448 | 2510 | ||
| 2449 | return 0; | 2511 | return 0; |
| 2450 | } | 2512 | } |
| @@ -2476,10 +2538,10 @@ static int _regulator_list_voltage(struct regulator_dev *rdev, | |||
| 2476 | if (selector >= rdev->desc->n_voltages) | 2538 | if (selector >= rdev->desc->n_voltages) |
| 2477 | return -EINVAL; | 2539 | return -EINVAL; |
| 2478 | if (lock) | 2540 | if (lock) |
| 2479 | mutex_lock(&rdev->mutex); | 2541 | regulator_lock(rdev); |
| 2480 | ret = ops->list_voltage(rdev, selector); | 2542 | ret = ops->list_voltage(rdev, selector); |
| 2481 | if (lock) | 2543 | if (lock) |
| 2482 | mutex_unlock(&rdev->mutex); | 2544 | regulator_unlock(rdev); |
| 2483 | } else if (rdev->is_switch && rdev->supply) { | 2545 | } else if (rdev->is_switch && rdev->supply) { |
| 2484 | ret = _regulator_list_voltage(rdev->supply->rdev, | 2546 | ret = _regulator_list_voltage(rdev->supply->rdev, |
| 2485 | selector, lock); | 2547 | selector, lock); |
| @@ -3252,7 +3314,7 @@ int regulator_sync_voltage(struct regulator *regulator) | |||
| 3252 | struct regulator_voltage *voltage = ®ulator->voltage[PM_SUSPEND_ON]; | 3314 | struct regulator_voltage *voltage = ®ulator->voltage[PM_SUSPEND_ON]; |
| 3253 | int ret, min_uV, max_uV; | 3315 | int ret, min_uV, max_uV; |
| 3254 | 3316 | ||
| 3255 | mutex_lock(&rdev->mutex); | 3317 | regulator_lock(rdev); |
| 3256 | 3318 | ||
| 3257 | if (!rdev->desc->ops->set_voltage && | 3319 | if (!rdev->desc->ops->set_voltage && |
| 3258 | !rdev->desc->ops->set_voltage_sel) { | 3320 | !rdev->desc->ops->set_voltage_sel) { |
| @@ -3281,7 +3343,7 @@ int regulator_sync_voltage(struct regulator *regulator) | |||
| 3281 | ret = _regulator_do_set_voltage(rdev, min_uV, max_uV); | 3343 | ret = _regulator_do_set_voltage(rdev, min_uV, max_uV); |
| 3282 | 3344 | ||
| 3283 | out: | 3345 | out: |
| 3284 | mutex_unlock(&rdev->mutex); | 3346 | regulator_unlock(rdev); |
| 3285 | return ret; | 3347 | return ret; |
| 3286 | } | 3348 | } |
| 3287 | EXPORT_SYMBOL_GPL(regulator_sync_voltage); | 3349 | EXPORT_SYMBOL_GPL(regulator_sync_voltage); |
| @@ -3374,7 +3436,7 @@ int regulator_set_current_limit(struct regulator *regulator, | |||
| 3374 | struct regulator_dev *rdev = regulator->rdev; | 3436 | struct regulator_dev *rdev = regulator->rdev; |
| 3375 | int ret; | 3437 | int ret; |
| 3376 | 3438 | ||
| 3377 | mutex_lock(&rdev->mutex); | 3439 | regulator_lock(rdev); |
| 3378 | 3440 | ||
| 3379 | /* sanity check */ | 3441 | /* sanity check */ |
| 3380 | if (!rdev->desc->ops->set_current_limit) { | 3442 | if (!rdev->desc->ops->set_current_limit) { |
| @@ -3389,7 +3451,7 @@ int regulator_set_current_limit(struct regulator *regulator, | |||
| 3389 | 3451 | ||
| 3390 | ret = rdev->desc->ops->set_current_limit(rdev, min_uA, max_uA); | 3452 | ret = rdev->desc->ops->set_current_limit(rdev, min_uA, max_uA); |
| 3391 | out: | 3453 | out: |
| 3392 | mutex_unlock(&rdev->mutex); | 3454 | regulator_unlock(rdev); |
| 3393 | return ret; | 3455 | return ret; |
| 3394 | } | 3456 | } |
| 3395 | EXPORT_SYMBOL_GPL(regulator_set_current_limit); | 3457 | EXPORT_SYMBOL_GPL(regulator_set_current_limit); |
| @@ -3398,7 +3460,7 @@ static int _regulator_get_current_limit(struct regulator_dev *rdev) | |||
| 3398 | { | 3460 | { |
| 3399 | int ret; | 3461 | int ret; |
| 3400 | 3462 | ||
| 3401 | mutex_lock(&rdev->mutex); | 3463 | regulator_lock(rdev); |
| 3402 | 3464 | ||
| 3403 | /* sanity check */ | 3465 | /* sanity check */ |
| 3404 | if (!rdev->desc->ops->get_current_limit) { | 3466 | if (!rdev->desc->ops->get_current_limit) { |
| @@ -3408,7 +3470,7 @@ static int _regulator_get_current_limit(struct regulator_dev *rdev) | |||
| 3408 | 3470 | ||
| 3409 | ret = rdev->desc->ops->get_current_limit(rdev); | 3471 | ret = rdev->desc->ops->get_current_limit(rdev); |
| 3410 | out: | 3472 | out: |
| 3411 | mutex_unlock(&rdev->mutex); | 3473 | regulator_unlock(rdev); |
| 3412 | return ret; | 3474 | return ret; |
| 3413 | } | 3475 | } |
| 3414 | 3476 | ||
| @@ -3444,7 +3506,7 @@ int regulator_set_mode(struct regulator *regulator, unsigned int mode) | |||
| 3444 | int ret; | 3506 | int ret; |
| 3445 | int regulator_curr_mode; | 3507 | int regulator_curr_mode; |
| 3446 | 3508 | ||
| 3447 | mutex_lock(&rdev->mutex); | 3509 | regulator_lock(rdev); |
| 3448 | 3510 | ||
| 3449 | /* sanity check */ | 3511 | /* sanity check */ |
| 3450 | if (!rdev->desc->ops->set_mode) { | 3512 | if (!rdev->desc->ops->set_mode) { |
| @@ -3468,7 +3530,7 @@ int regulator_set_mode(struct regulator *regulator, unsigned int mode) | |||
| 3468 | 3530 | ||
| 3469 | ret = rdev->desc->ops->set_mode(rdev, mode); | 3531 | ret = rdev->desc->ops->set_mode(rdev, mode); |
| 3470 | out: | 3532 | out: |
| 3471 | mutex_unlock(&rdev->mutex); | 3533 | regulator_unlock(rdev); |
| 3472 | return ret; | 3534 | return ret; |
| 3473 | } | 3535 | } |
| 3474 | EXPORT_SYMBOL_GPL(regulator_set_mode); | 3536 | EXPORT_SYMBOL_GPL(regulator_set_mode); |
| @@ -3477,7 +3539,7 @@ static unsigned int _regulator_get_mode(struct regulator_dev *rdev) | |||
| 3477 | { | 3539 | { |
| 3478 | int ret; | 3540 | int ret; |
| 3479 | 3541 | ||
| 3480 | mutex_lock(&rdev->mutex); | 3542 | regulator_lock(rdev); |
| 3481 | 3543 | ||
| 3482 | /* sanity check */ | 3544 | /* sanity check */ |
| 3483 | if (!rdev->desc->ops->get_mode) { | 3545 | if (!rdev->desc->ops->get_mode) { |
| @@ -3487,7 +3549,7 @@ static unsigned int _regulator_get_mode(struct regulator_dev *rdev) | |||
| 3487 | 3549 | ||
| 3488 | ret = rdev->desc->ops->get_mode(rdev); | 3550 | ret = rdev->desc->ops->get_mode(rdev); |
| 3489 | out: | 3551 | out: |
| 3490 | mutex_unlock(&rdev->mutex); | 3552 | regulator_unlock(rdev); |
| 3491 | return ret; | 3553 | return ret; |
| 3492 | } | 3554 | } |
| 3493 | 3555 | ||
| @@ -3508,7 +3570,7 @@ static int _regulator_get_error_flags(struct regulator_dev *rdev, | |||
| 3508 | { | 3570 | { |
| 3509 | int ret; | 3571 | int ret; |
| 3510 | 3572 | ||
| 3511 | mutex_lock(&rdev->mutex); | 3573 | regulator_lock(rdev); |
| 3512 | 3574 | ||
| 3513 | /* sanity check */ | 3575 | /* sanity check */ |
| 3514 | if (!rdev->desc->ops->get_error_flags) { | 3576 | if (!rdev->desc->ops->get_error_flags) { |
| @@ -3518,7 +3580,7 @@ static int _regulator_get_error_flags(struct regulator_dev *rdev, | |||
| 3518 | 3580 | ||
| 3519 | ret = rdev->desc->ops->get_error_flags(rdev, flags); | 3581 | ret = rdev->desc->ops->get_error_flags(rdev, flags); |
| 3520 | out: | 3582 | out: |
| 3521 | mutex_unlock(&rdev->mutex); | 3583 | regulator_unlock(rdev); |
| 3522 | return ret; | 3584 | return ret; |
| 3523 | } | 3585 | } |
| 3524 | 3586 | ||
| @@ -3567,10 +3629,10 @@ int regulator_set_load(struct regulator *regulator, int uA_load) | |||
| 3567 | struct regulator_dev *rdev = regulator->rdev; | 3629 | struct regulator_dev *rdev = regulator->rdev; |
| 3568 | int ret; | 3630 | int ret; |
| 3569 | 3631 | ||
| 3570 | mutex_lock(&rdev->mutex); | 3632 | regulator_lock(rdev); |
| 3571 | regulator->uA_load = uA_load; | 3633 | regulator->uA_load = uA_load; |
| 3572 | ret = drms_uA_update(rdev); | 3634 | ret = drms_uA_update(rdev); |
| 3573 | mutex_unlock(&rdev->mutex); | 3635 | regulator_unlock(rdev); |
| 3574 | 3636 | ||
| 3575 | return ret; | 3637 | return ret; |
| 3576 | } | 3638 | } |
| @@ -3598,7 +3660,7 @@ int regulator_allow_bypass(struct regulator *regulator, bool enable) | |||
| 3598 | if (!regulator_ops_is_valid(rdev, REGULATOR_CHANGE_BYPASS)) | 3660 | if (!regulator_ops_is_valid(rdev, REGULATOR_CHANGE_BYPASS)) |
| 3599 | return 0; | 3661 | return 0; |
| 3600 | 3662 | ||
| 3601 | mutex_lock(&rdev->mutex); | 3663 | regulator_lock(rdev); |
| 3602 | 3664 | ||
| 3603 | if (enable && !regulator->bypass) { | 3665 | if (enable && !regulator->bypass) { |
| 3604 | rdev->bypass_count++; | 3666 | rdev->bypass_count++; |
| @@ -3622,7 +3684,7 @@ int regulator_allow_bypass(struct regulator *regulator, bool enable) | |||
| 3622 | if (ret == 0) | 3684 | if (ret == 0) |
| 3623 | regulator->bypass = enable; | 3685 | regulator->bypass = enable; |
| 3624 | 3686 | ||
| 3625 | mutex_unlock(&rdev->mutex); | 3687 | regulator_unlock(rdev); |
| 3626 | 3688 | ||
| 3627 | return ret; | 3689 | return ret; |
| 3628 | } | 3690 | } |
| @@ -4067,6 +4129,96 @@ static int regulator_register_resolve_supply(struct device *dev, void *data) | |||
| 4067 | return 0; | 4129 | return 0; |
| 4068 | } | 4130 | } |
| 4069 | 4131 | ||
| 4132 | static int regulator_fill_coupling_array(struct regulator_dev *rdev) | ||
| 4133 | { | ||
| 4134 | struct coupling_desc *c_desc = &rdev->coupling_desc; | ||
| 4135 | int n_coupled = c_desc->n_coupled; | ||
| 4136 | struct regulator_dev *c_rdev; | ||
| 4137 | int i; | ||
| 4138 | |||
| 4139 | for (i = 1; i < n_coupled; i++) { | ||
| 4140 | /* already resolved */ | ||
| 4141 | if (c_desc->coupled_rdevs[i]) | ||
| 4142 | continue; | ||
| 4143 | |||
| 4144 | c_rdev = of_parse_coupled_regulator(rdev, i - 1); | ||
| 4145 | |||
| 4146 | if (c_rdev) { | ||
| 4147 | c_desc->coupled_rdevs[i] = c_rdev; | ||
| 4148 | c_desc->n_resolved++; | ||
| 4149 | } | ||
| 4150 | } | ||
| 4151 | |||
| 4152 | if (rdev->coupling_desc.n_resolved < n_coupled) | ||
| 4153 | return -1; | ||
| 4154 | else | ||
| 4155 | return 0; | ||
| 4156 | } | ||
| 4157 | |||
| 4158 | static int regulator_register_fill_coupling_array(struct device *dev, | ||
| 4159 | void *data) | ||
| 4160 | { | ||
| 4161 | struct regulator_dev *rdev = dev_to_rdev(dev); | ||
| 4162 | |||
| 4163 | if (!IS_ENABLED(CONFIG_OF)) | ||
| 4164 | return 0; | ||
| 4165 | |||
| 4166 | if (regulator_fill_coupling_array(rdev)) | ||
| 4167 | rdev_dbg(rdev, "unable to resolve coupling\n"); | ||
| 4168 | |||
| 4169 | return 0; | ||
| 4170 | } | ||
| 4171 | |||
| 4172 | static int regulator_resolve_coupling(struct regulator_dev *rdev) | ||
| 4173 | { | ||
| 4174 | int n_phandles; | ||
| 4175 | |||
| 4176 | if (!IS_ENABLED(CONFIG_OF)) | ||
| 4177 | n_phandles = 0; | ||
| 4178 | else | ||
| 4179 | n_phandles = of_get_n_coupled(rdev); | ||
| 4180 | |||
| 4181 | if (n_phandles + 1 > MAX_COUPLED) { | ||
| 4182 | rdev_err(rdev, "too many regulators coupled\n"); | ||
| 4183 | return -EPERM; | ||
| 4184 | } | ||
| 4185 | |||
| 4186 | /* | ||
| 4187 | * Every regulator should always have coupling descriptor filled with | ||
| 4188 | * at least pointer to itself. | ||
| 4189 | */ | ||
| 4190 | rdev->coupling_desc.coupled_rdevs[0] = rdev; | ||
| 4191 | rdev->coupling_desc.n_coupled = n_phandles + 1; | ||
| 4192 | rdev->coupling_desc.n_resolved++; | ||
| 4193 | |||
| 4194 | /* regulator isn't coupled */ | ||
| 4195 | if (n_phandles == 0) | ||
| 4196 | return 0; | ||
| 4197 | |||
| 4198 | /* regulator, which can't change its voltage, can't be coupled */ | ||
| 4199 | if (!regulator_ops_is_valid(rdev, REGULATOR_CHANGE_VOLTAGE)) { | ||
| 4200 | rdev_err(rdev, "voltage operation not allowed\n"); | ||
| 4201 | return -EPERM; | ||
| 4202 | } | ||
| 4203 | |||
| 4204 | if (rdev->constraints->max_spread <= 0) { | ||
| 4205 | rdev_err(rdev, "wrong max_spread value\n"); | ||
| 4206 | return -EPERM; | ||
| 4207 | } | ||
| 4208 | |||
| 4209 | if (!of_check_coupling_data(rdev)) | ||
| 4210 | return -EPERM; | ||
| 4211 | |||
| 4212 | /* | ||
| 4213 | * After everything has been checked, try to fill rdevs array | ||
| 4214 | * with pointers to regulators parsed from device tree. If some | ||
| 4215 | * regulators are not registered yet, retry in late init call | ||
| 4216 | */ | ||
| 4217 | regulator_fill_coupling_array(rdev); | ||
| 4218 | |||
| 4219 | return 0; | ||
| 4220 | } | ||
| 4221 | |||
| 4070 | /** | 4222 | /** |
| 4071 | * regulator_register - register regulator | 4223 | * regulator_register - register regulator |
| 4072 | * @regulator_desc: regulator to register | 4224 | * @regulator_desc: regulator to register |
| @@ -4200,6 +4352,13 @@ regulator_register(const struct regulator_desc *regulator_desc, | |||
| 4200 | if (ret < 0) | 4352 | if (ret < 0) |
| 4201 | goto wash; | 4353 | goto wash; |
| 4202 | 4354 | ||
| 4355 | mutex_lock(®ulator_list_mutex); | ||
| 4356 | ret = regulator_resolve_coupling(rdev); | ||
| 4357 | mutex_unlock(®ulator_list_mutex); | ||
| 4358 | |||
| 4359 | if (ret != 0) | ||
| 4360 | goto wash; | ||
| 4361 | |||
| 4203 | /* add consumers devices */ | 4362 | /* add consumers devices */ |
| 4204 | if (init_data) { | 4363 | if (init_data) { |
| 4205 | mutex_lock(®ulator_list_mutex); | 4364 | mutex_lock(®ulator_list_mutex); |
| @@ -4288,9 +4447,9 @@ static int _regulator_suspend_late(struct device *dev, void *data) | |||
| 4288 | suspend_state_t *state = data; | 4447 | suspend_state_t *state = data; |
| 4289 | int ret; | 4448 | int ret; |
| 4290 | 4449 | ||
| 4291 | mutex_lock(&rdev->mutex); | 4450 | regulator_lock(rdev); |
| 4292 | ret = suspend_set_state(rdev, *state); | 4451 | ret = suspend_set_state(rdev, *state); |
| 4293 | mutex_unlock(&rdev->mutex); | 4452 | regulator_unlock(rdev); |
| 4294 | 4453 | ||
| 4295 | return ret; | 4454 | return ret; |
| 4296 | } | 4455 | } |
| @@ -4320,14 +4479,14 @@ static int _regulator_resume_early(struct device *dev, void *data) | |||
| 4320 | if (rstate == NULL) | 4479 | if (rstate == NULL) |
| 4321 | return 0; | 4480 | return 0; |
| 4322 | 4481 | ||
| 4323 | mutex_lock(&rdev->mutex); | 4482 | regulator_lock(rdev); |
| 4324 | 4483 | ||
| 4325 | if (rdev->desc->ops->resume_early && | 4484 | if (rdev->desc->ops->resume_early && |
| 4326 | (rstate->enabled == ENABLE_IN_SUSPEND || | 4485 | (rstate->enabled == ENABLE_IN_SUSPEND || |
| 4327 | rstate->enabled == DISABLE_IN_SUSPEND)) | 4486 | rstate->enabled == DISABLE_IN_SUSPEND)) |
| 4328 | ret = rdev->desc->ops->resume_early(rdev); | 4487 | ret = rdev->desc->ops->resume_early(rdev); |
| 4329 | 4488 | ||
| 4330 | mutex_unlock(&rdev->mutex); | 4489 | regulator_unlock(rdev); |
| 4331 | 4490 | ||
| 4332 | return ret; | 4491 | return ret; |
| 4333 | } | 4492 | } |
| @@ -4629,7 +4788,7 @@ static int __init regulator_late_cleanup(struct device *dev, void *data) | |||
| 4629 | if (!regulator_ops_is_valid(rdev, REGULATOR_CHANGE_STATUS)) | 4788 | if (!regulator_ops_is_valid(rdev, REGULATOR_CHANGE_STATUS)) |
| 4630 | return 0; | 4789 | return 0; |
| 4631 | 4790 | ||
| 4632 | mutex_lock(&rdev->mutex); | 4791 | regulator_lock(rdev); |
| 4633 | 4792 | ||
| 4634 | if (rdev->use_count) | 4793 | if (rdev->use_count) |
| 4635 | goto unlock; | 4794 | goto unlock; |
| @@ -4660,7 +4819,7 @@ static int __init regulator_late_cleanup(struct device *dev, void *data) | |||
| 4660 | } | 4819 | } |
| 4661 | 4820 | ||
| 4662 | unlock: | 4821 | unlock: |
| 4663 | mutex_unlock(&rdev->mutex); | 4822 | regulator_unlock(rdev); |
| 4664 | 4823 | ||
| 4665 | return 0; | 4824 | return 0; |
| 4666 | } | 4825 | } |
| @@ -4694,6 +4853,9 @@ static int __init regulator_init_complete(void) | |||
| 4694 | class_for_each_device(®ulator_class, NULL, NULL, | 4853 | class_for_each_device(®ulator_class, NULL, NULL, |
| 4695 | regulator_late_cleanup); | 4854 | regulator_late_cleanup); |
| 4696 | 4855 | ||
| 4856 | class_for_each_device(®ulator_class, NULL, NULL, | ||
| 4857 | regulator_register_fill_coupling_array); | ||
| 4858 | |||
| 4697 | return 0; | 4859 | return 0; |
| 4698 | } | 4860 | } |
| 4699 | late_initcall_sync(regulator_init_complete); | 4861 | late_initcall_sync(regulator_init_complete); |
diff --git a/drivers/regulator/cpcap-regulator.c b/drivers/regulator/cpcap-regulator.c index f541b80f1b54..bd910fe123d9 100644 --- a/drivers/regulator/cpcap-regulator.c +++ b/drivers/regulator/cpcap-regulator.c | |||
| @@ -222,7 +222,7 @@ static unsigned int cpcap_map_mode(unsigned int mode) | |||
| 222 | case CPCAP_BIT_AUDIO_LOW_PWR: | 222 | case CPCAP_BIT_AUDIO_LOW_PWR: |
| 223 | return REGULATOR_MODE_STANDBY; | 223 | return REGULATOR_MODE_STANDBY; |
| 224 | default: | 224 | default: |
| 225 | return -EINVAL; | 225 | return REGULATOR_MODE_INVALID; |
| 226 | } | 226 | } |
| 227 | } | 227 | } |
| 228 | 228 | ||
diff --git a/drivers/regulator/internal.h b/drivers/regulator/internal.h index abfd56e8c78a..943926a156f2 100644 --- a/drivers/regulator/internal.h +++ b/drivers/regulator/internal.h | |||
| @@ -56,14 +56,27 @@ static inline struct regulator_dev *dev_to_rdev(struct device *dev) | |||
| 56 | return container_of(dev, struct regulator_dev, dev); | 56 | return container_of(dev, struct regulator_dev, dev); |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | struct regulator_dev *of_find_regulator_by_node(struct device_node *np); | ||
| 60 | |||
| 61 | #ifdef CONFIG_OF | 59 | #ifdef CONFIG_OF |
| 60 | struct regulator_dev *of_find_regulator_by_node(struct device_node *np); | ||
| 62 | struct regulator_init_data *regulator_of_get_init_data(struct device *dev, | 61 | struct regulator_init_data *regulator_of_get_init_data(struct device *dev, |
| 63 | const struct regulator_desc *desc, | 62 | const struct regulator_desc *desc, |
| 64 | struct regulator_config *config, | 63 | struct regulator_config *config, |
| 65 | struct device_node **node); | 64 | struct device_node **node); |
| 65 | |||
| 66 | struct regulator_dev *of_parse_coupled_regulator(struct regulator_dev *rdev, | ||
| 67 | int index); | ||
| 68 | |||
| 69 | int of_get_n_coupled(struct regulator_dev *rdev); | ||
| 70 | |||
| 71 | bool of_check_coupling_data(struct regulator_dev *rdev); | ||
| 72 | |||
| 66 | #else | 73 | #else |
| 74 | static inline struct regulator_dev * | ||
| 75 | of_find_regulator_by_node(struct device_node *np) | ||
| 76 | { | ||
| 77 | return NULL; | ||
| 78 | } | ||
| 79 | |||
| 67 | static inline struct regulator_init_data * | 80 | static inline struct regulator_init_data * |
| 68 | regulator_of_get_init_data(struct device *dev, | 81 | regulator_of_get_init_data(struct device *dev, |
| 69 | const struct regulator_desc *desc, | 82 | const struct regulator_desc *desc, |
| @@ -72,8 +85,25 @@ regulator_of_get_init_data(struct device *dev, | |||
| 72 | { | 85 | { |
| 73 | return NULL; | 86 | return NULL; |
| 74 | } | 87 | } |
| 75 | #endif | ||
| 76 | 88 | ||
| 89 | static inline struct regulator_dev * | ||
| 90 | of_parse_coupled_regulator(struct regulator_dev *rdev, | ||
| 91 | int index) | ||
| 92 | { | ||
| 93 | return NULL; | ||
| 94 | } | ||
| 95 | |||
| 96 | static inline int of_get_n_coupled(struct regulator_dev *rdev) | ||
| 97 | { | ||
| 98 | return 0; | ||
| 99 | } | ||
| 100 | |||
| 101 | static inline bool of_check_coupling_data(struct regulator_dev *rdev) | ||
| 102 | { | ||
| 103 | return false; | ||
| 104 | } | ||
| 105 | |||
| 106 | #endif | ||
| 77 | enum regulator_get_type { | 107 | enum regulator_get_type { |
| 78 | NORMAL_GET, | 108 | NORMAL_GET, |
| 79 | EXCLUSIVE_GET, | 109 | EXCLUSIVE_GET, |
| @@ -83,5 +113,4 @@ enum regulator_get_type { | |||
| 83 | 113 | ||
| 84 | struct regulator *_regulator_get(struct device *dev, const char *id, | 114 | struct regulator *_regulator_get(struct device *dev, const char *id, |
| 85 | enum regulator_get_type get_type); | 115 | enum regulator_get_type get_type); |
| 86 | |||
| 87 | #endif | 116 | #endif |
diff --git a/drivers/regulator/lm363x-regulator.c b/drivers/regulator/lm363x-regulator.c index ce5f7d9ad475..b615a413ca9f 100644 --- a/drivers/regulator/lm363x-regulator.c +++ b/drivers/regulator/lm363x-regulator.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | #include <linux/mfd/ti-lmu-register.h> | 16 | #include <linux/mfd/ti-lmu-register.h> |
| 17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 18 | #include <linux/of.h> | 18 | #include <linux/of.h> |
| 19 | #include <linux/of_gpio.h> | 19 | #include <linux/gpio/consumer.h> |
| 20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
| 21 | #include <linux/regulator/driver.h> | 21 | #include <linux/regulator/driver.h> |
| 22 | #include <linux/regulator/of_regulator.h> | 22 | #include <linux/regulator/of_regulator.h> |
| @@ -219,7 +219,7 @@ static const struct regulator_desc lm363x_regulator_desc[] = { | |||
| 219 | }, | 219 | }, |
| 220 | }; | 220 | }; |
| 221 | 221 | ||
| 222 | static int lm363x_regulator_of_get_enable_gpio(struct device_node *np, int id) | 222 | static struct gpio_desc *lm363x_regulator_of_get_enable_gpio(struct device *dev, int id) |
| 223 | { | 223 | { |
| 224 | /* | 224 | /* |
| 225 | * Check LCM_EN1/2_GPIO is configured. | 225 | * Check LCM_EN1/2_GPIO is configured. |
| @@ -227,11 +227,11 @@ static int lm363x_regulator_of_get_enable_gpio(struct device_node *np, int id) | |||
| 227 | */ | 227 | */ |
| 228 | switch (id) { | 228 | switch (id) { |
| 229 | case LM3632_LDO_POS: | 229 | case LM3632_LDO_POS: |
| 230 | return of_get_named_gpio(np, "enable-gpios", 0); | 230 | return devm_gpiod_get_index_optional(dev, "enable", 0, GPIOD_OUT_LOW); |
| 231 | case LM3632_LDO_NEG: | 231 | case LM3632_LDO_NEG: |
| 232 | return of_get_named_gpio(np, "enable-gpios", 1); | 232 | return devm_gpiod_get_index_optional(dev, "enable", 1, GPIOD_OUT_LOW); |
| 233 | default: | 233 | default: |
| 234 | return -EINVAL; | 234 | return NULL; |
| 235 | } | 235 | } |
| 236 | } | 236 | } |
| 237 | 237 | ||
| @@ -243,7 +243,8 @@ static int lm363x_regulator_probe(struct platform_device *pdev) | |||
| 243 | struct regulator_dev *rdev; | 243 | struct regulator_dev *rdev; |
| 244 | struct device *dev = &pdev->dev; | 244 | struct device *dev = &pdev->dev; |
| 245 | int id = pdev->id; | 245 | int id = pdev->id; |
| 246 | int ret, ena_gpio; | 246 | struct gpio_desc *gpiod; |
| 247 | int ret; | ||
| 247 | 248 | ||
| 248 | cfg.dev = dev; | 249 | cfg.dev = dev; |
| 249 | cfg.regmap = regmap; | 250 | cfg.regmap = regmap; |
| @@ -252,10 +253,9 @@ static int lm363x_regulator_probe(struct platform_device *pdev) | |||
| 252 | * LM3632 LDOs can be controlled by external pin. | 253 | * LM3632 LDOs can be controlled by external pin. |
| 253 | * Register update is required if the pin is used. | 254 | * Register update is required if the pin is used. |
| 254 | */ | 255 | */ |
| 255 | ena_gpio = lm363x_regulator_of_get_enable_gpio(dev->of_node, id); | 256 | gpiod = lm363x_regulator_of_get_enable_gpio(dev, id); |
| 256 | if (gpio_is_valid(ena_gpio)) { | 257 | if (gpiod) { |
| 257 | cfg.ena_gpio = ena_gpio; | 258 | cfg.ena_gpiod = gpiod; |
| 258 | cfg.ena_gpio_flags = GPIOF_OUT_INIT_LOW; | ||
| 259 | 259 | ||
| 260 | ret = regmap_update_bits(regmap, LM3632_REG_BIAS_CONFIG, | 260 | ret = regmap_update_bits(regmap, LM3632_REG_BIAS_CONFIG, |
| 261 | LM3632_EXT_EN_MASK, | 261 | LM3632_EXT_EN_MASK, |
diff --git a/drivers/regulator/lp87565-regulator.c b/drivers/regulator/lp87565-regulator.c index cfdbe294fb6a..c192357d1dea 100644 --- a/drivers/regulator/lp87565-regulator.c +++ b/drivers/regulator/lp87565-regulator.c | |||
| @@ -95,6 +95,10 @@ static int lp87565_buck_set_ramp_delay(struct regulator_dev *rdev, | |||
| 95 | 95 | ||
| 96 | rdev->constraints->ramp_delay = lp87565_buck_ramp_delay[reg]; | 96 | rdev->constraints->ramp_delay = lp87565_buck_ramp_delay[reg]; |
| 97 | 97 | ||
| 98 | /* Conservatively give a 15% margin */ | ||
| 99 | rdev->constraints->ramp_delay = | ||
| 100 | rdev->constraints->ramp_delay * 85 / 100; | ||
| 101 | |||
| 98 | return 0; | 102 | return 0; |
| 99 | } | 103 | } |
| 100 | 104 | ||
| @@ -154,32 +158,33 @@ static const struct lp87565_regulator regulators[] = { | |||
| 154 | LP87565_REGULATOR("BUCK0", LP87565_BUCK_0, "buck0", lp87565_buck_ops, | 158 | LP87565_REGULATOR("BUCK0", LP87565_BUCK_0, "buck0", lp87565_buck_ops, |
| 155 | 256, LP87565_REG_BUCK0_VOUT, LP87565_BUCK_VSET, | 159 | 256, LP87565_REG_BUCK0_VOUT, LP87565_BUCK_VSET, |
| 156 | LP87565_REG_BUCK0_CTRL_1, | 160 | LP87565_REG_BUCK0_CTRL_1, |
| 157 | LP87565_BUCK_CTRL_1_EN, 3800, | 161 | LP87565_BUCK_CTRL_1_EN, 3230, |
| 158 | buck0_1_2_3_ranges, LP87565_REG_BUCK0_CTRL_2), | 162 | buck0_1_2_3_ranges, LP87565_REG_BUCK0_CTRL_2), |
| 159 | LP87565_REGULATOR("BUCK1", LP87565_BUCK_1, "buck1", lp87565_buck_ops, | 163 | LP87565_REGULATOR("BUCK1", LP87565_BUCK_1, "buck1", lp87565_buck_ops, |
| 160 | 256, LP87565_REG_BUCK1_VOUT, LP87565_BUCK_VSET, | 164 | 256, LP87565_REG_BUCK1_VOUT, LP87565_BUCK_VSET, |
| 161 | LP87565_REG_BUCK1_CTRL_1, | 165 | LP87565_REG_BUCK1_CTRL_1, |
| 162 | LP87565_BUCK_CTRL_1_EN, 3800, | 166 | LP87565_BUCK_CTRL_1_EN, 3230, |
| 163 | buck0_1_2_3_ranges, LP87565_REG_BUCK1_CTRL_2), | 167 | buck0_1_2_3_ranges, LP87565_REG_BUCK1_CTRL_2), |
| 164 | LP87565_REGULATOR("BUCK2", LP87565_BUCK_2, "buck2", lp87565_buck_ops, | 168 | LP87565_REGULATOR("BUCK2", LP87565_BUCK_2, "buck2", lp87565_buck_ops, |
| 165 | 256, LP87565_REG_BUCK2_VOUT, LP87565_BUCK_VSET, | 169 | 256, LP87565_REG_BUCK2_VOUT, LP87565_BUCK_VSET, |
| 166 | LP87565_REG_BUCK2_CTRL_1, | 170 | LP87565_REG_BUCK2_CTRL_1, |
| 167 | LP87565_BUCK_CTRL_1_EN, 3800, | 171 | LP87565_BUCK_CTRL_1_EN, 3230, |
| 168 | buck0_1_2_3_ranges, LP87565_REG_BUCK2_CTRL_2), | 172 | buck0_1_2_3_ranges, LP87565_REG_BUCK2_CTRL_2), |
| 169 | LP87565_REGULATOR("BUCK3", LP87565_BUCK_3, "buck3", lp87565_buck_ops, | 173 | LP87565_REGULATOR("BUCK3", LP87565_BUCK_3, "buck3", lp87565_buck_ops, |
| 170 | 256, LP87565_REG_BUCK3_VOUT, LP87565_BUCK_VSET, | 174 | 256, LP87565_REG_BUCK3_VOUT, LP87565_BUCK_VSET, |
| 171 | LP87565_REG_BUCK3_CTRL_1, | 175 | LP87565_REG_BUCK3_CTRL_1, |
| 172 | LP87565_BUCK_CTRL_1_EN, 3800, | 176 | LP87565_BUCK_CTRL_1_EN, 3230, |
| 173 | buck0_1_2_3_ranges, LP87565_REG_BUCK3_CTRL_2), | 177 | buck0_1_2_3_ranges, LP87565_REG_BUCK3_CTRL_2), |
| 174 | LP87565_REGULATOR("BUCK10", LP87565_BUCK_10, "buck10", lp87565_buck_ops, | 178 | LP87565_REGULATOR("BUCK10", LP87565_BUCK_10, "buck10", lp87565_buck_ops, |
| 175 | 256, LP87565_REG_BUCK0_VOUT, LP87565_BUCK_VSET, | 179 | 256, LP87565_REG_BUCK0_VOUT, LP87565_BUCK_VSET, |
| 176 | LP87565_REG_BUCK0_CTRL_1, | 180 | LP87565_REG_BUCK0_CTRL_1, |
| 177 | LP87565_BUCK_CTRL_1_EN, 3800, | 181 | LP87565_BUCK_CTRL_1_EN | |
| 182 | LP87565_BUCK_CTRL_1_FPWM_MP_0_2, 3230, | ||
| 178 | buck0_1_2_3_ranges, LP87565_REG_BUCK0_CTRL_2), | 183 | buck0_1_2_3_ranges, LP87565_REG_BUCK0_CTRL_2), |
| 179 | LP87565_REGULATOR("BUCK23", LP87565_BUCK_23, "buck23", lp87565_buck_ops, | 184 | LP87565_REGULATOR("BUCK23", LP87565_BUCK_23, "buck23", lp87565_buck_ops, |
| 180 | 256, LP87565_REG_BUCK2_VOUT, LP87565_BUCK_VSET, | 185 | 256, LP87565_REG_BUCK2_VOUT, LP87565_BUCK_VSET, |
| 181 | LP87565_REG_BUCK2_CTRL_1, | 186 | LP87565_REG_BUCK2_CTRL_1, |
| 182 | LP87565_BUCK_CTRL_1_EN, 3800, | 187 | LP87565_BUCK_CTRL_1_EN, 3230, |
| 183 | buck0_1_2_3_ranges, LP87565_REG_BUCK2_CTRL_2), | 188 | buck0_1_2_3_ranges, LP87565_REG_BUCK2_CTRL_2), |
| 184 | }; | 189 | }; |
| 185 | 190 | ||
diff --git a/drivers/regulator/lp8788-ldo.c b/drivers/regulator/lp8788-ldo.c index cbfd35873575..f2347474a106 100644 --- a/drivers/regulator/lp8788-ldo.c +++ b/drivers/regulator/lp8788-ldo.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
| 17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/regulator/driver.h> | 18 | #include <linux/regulator/driver.h> |
| 19 | #include <linux/gpio.h> | 19 | #include <linux/gpio/consumer.h> |
| 20 | #include <linux/mfd/lp8788.h> | 20 | #include <linux/mfd/lp8788.h> |
| 21 | 21 | ||
| 22 | /* register address */ | 22 | /* register address */ |
| @@ -85,8 +85,6 @@ | |||
| 85 | #define LP8788_STARTUP_TIME_S 3 | 85 | #define LP8788_STARTUP_TIME_S 3 |
| 86 | 86 | ||
| 87 | #define ENABLE_TIME_USEC 32 | 87 | #define ENABLE_TIME_USEC 32 |
| 88 | #define ENABLE GPIOF_OUT_INIT_HIGH | ||
| 89 | #define DISABLE GPIOF_OUT_INIT_LOW | ||
| 90 | 88 | ||
| 91 | enum lp8788_ldo_id { | 89 | enum lp8788_ldo_id { |
| 92 | DLDO1, | 90 | DLDO1, |
| @@ -117,7 +115,7 @@ struct lp8788_ldo { | |||
| 117 | struct lp8788 *lp; | 115 | struct lp8788 *lp; |
| 118 | struct regulator_desc *desc; | 116 | struct regulator_desc *desc; |
| 119 | struct regulator_dev *regulator; | 117 | struct regulator_dev *regulator; |
| 120 | struct lp8788_ldo_enable_pin *en_pin; | 118 | struct gpio_desc *ena_gpiod; |
| 121 | }; | 119 | }; |
| 122 | 120 | ||
| 123 | /* DLDO 1, 2, 3, 9 voltage table */ | 121 | /* DLDO 1, 2, 3, 9 voltage table */ |
| @@ -469,7 +467,6 @@ static int lp8788_config_ldo_enable_mode(struct platform_device *pdev, | |||
| 469 | enum lp8788_ldo_id id) | 467 | enum lp8788_ldo_id id) |
| 470 | { | 468 | { |
| 471 | struct lp8788 *lp = ldo->lp; | 469 | struct lp8788 *lp = ldo->lp; |
| 472 | struct lp8788_platform_data *pdata = lp->pdata; | ||
| 473 | enum lp8788_ext_ldo_en_id enable_id; | 470 | enum lp8788_ext_ldo_en_id enable_id; |
| 474 | u8 en_mask[] = { | 471 | u8 en_mask[] = { |
| 475 | [EN_ALDO1] = LP8788_EN_SEL_ALDO1_M, | 472 | [EN_ALDO1] = LP8788_EN_SEL_ALDO1_M, |
| @@ -504,11 +501,18 @@ static int lp8788_config_ldo_enable_mode(struct platform_device *pdev, | |||
| 504 | return 0; | 501 | return 0; |
| 505 | } | 502 | } |
| 506 | 503 | ||
| 507 | /* if no platform data for ldo pin, then set default enable mode */ | 504 | /* FIXME: check default mode for GPIO here: high or low? */ |
| 508 | if (!pdata || !pdata->ldo_pin || !pdata->ldo_pin[enable_id]) | 505 | ldo->ena_gpiod = devm_gpiod_get_index_optional(&pdev->dev, |
| 506 | "enable", | ||
| 507 | enable_id, | ||
| 508 | GPIOD_OUT_HIGH); | ||
| 509 | if (IS_ERR(ldo->ena_gpiod)) | ||
| 510 | return PTR_ERR(ldo->ena_gpiod); | ||
| 511 | |||
| 512 | /* if no GPIO for ldo pin, then set default enable mode */ | ||
| 513 | if (!ldo->ena_gpiod) | ||
| 509 | goto set_default_ldo_enable_mode; | 514 | goto set_default_ldo_enable_mode; |
| 510 | 515 | ||
| 511 | ldo->en_pin = pdata->ldo_pin[enable_id]; | ||
| 512 | return 0; | 516 | return 0; |
| 513 | 517 | ||
| 514 | set_default_ldo_enable_mode: | 518 | set_default_ldo_enable_mode: |
| @@ -533,10 +537,8 @@ static int lp8788_dldo_probe(struct platform_device *pdev) | |||
| 533 | if (ret) | 537 | if (ret) |
| 534 | return ret; | 538 | return ret; |
| 535 | 539 | ||
| 536 | if (ldo->en_pin) { | 540 | if (ldo->ena_gpiod) |
| 537 | cfg.ena_gpio = ldo->en_pin->gpio; | 541 | cfg.ena_gpiod = ldo->ena_gpiod; |
| 538 | cfg.ena_gpio_flags = ldo->en_pin->init_state; | ||
| 539 | } | ||
| 540 | 542 | ||
| 541 | cfg.dev = pdev->dev.parent; | 543 | cfg.dev = pdev->dev.parent; |
| 542 | cfg.init_data = lp->pdata ? lp->pdata->dldo_data[id] : NULL; | 544 | cfg.init_data = lp->pdata ? lp->pdata->dldo_data[id] : NULL; |
| @@ -582,10 +584,8 @@ static int lp8788_aldo_probe(struct platform_device *pdev) | |||
| 582 | if (ret) | 584 | if (ret) |
| 583 | return ret; | 585 | return ret; |
| 584 | 586 | ||
| 585 | if (ldo->en_pin) { | 587 | if (ldo->ena_gpiod) |
| 586 | cfg.ena_gpio = ldo->en_pin->gpio; | 588 | cfg.ena_gpiod = ldo->ena_gpiod; |
| 587 | cfg.ena_gpio_flags = ldo->en_pin->init_state; | ||
| 588 | } | ||
| 589 | 589 | ||
| 590 | cfg.dev = pdev->dev.parent; | 590 | cfg.dev = pdev->dev.parent; |
| 591 | cfg.init_data = lp->pdata ? lp->pdata->aldo_data[id] : NULL; | 591 | cfg.init_data = lp->pdata ? lp->pdata->aldo_data[id] : NULL; |
diff --git a/drivers/regulator/ltc3676.c b/drivers/regulator/ltc3676.c index 662ee05ea44d..9dec1609ff66 100644 --- a/drivers/regulator/ltc3676.c +++ b/drivers/regulator/ltc3676.c | |||
| @@ -52,6 +52,7 @@ | |||
| 52 | #define LTC3676_CLIRQ 0x1F | 52 | #define LTC3676_CLIRQ 0x1F |
| 53 | 53 | ||
| 54 | #define LTC3676_DVBxA_REF_SELECT BIT(5) | 54 | #define LTC3676_DVBxA_REF_SELECT BIT(5) |
| 55 | #define LTC3676_DVBxB_PGOOD_MASK BIT(5) | ||
| 55 | 56 | ||
| 56 | #define LTC3676_IRQSTAT_PGOOD_TIMEOUT BIT(3) | 57 | #define LTC3676_IRQSTAT_PGOOD_TIMEOUT BIT(3) |
| 57 | #define LTC3676_IRQSTAT_UNDERVOLT_WARN BIT(4) | 58 | #define LTC3676_IRQSTAT_UNDERVOLT_WARN BIT(4) |
| @@ -123,6 +124,23 @@ static int ltc3676_set_suspend_mode(struct regulator_dev *rdev, | |||
| 123 | mask, val); | 124 | mask, val); |
| 124 | } | 125 | } |
| 125 | 126 | ||
| 127 | static int ltc3676_set_voltage_sel(struct regulator_dev *rdev, unsigned selector) | ||
| 128 | { | ||
| 129 | struct ltc3676 *ltc3676 = rdev_get_drvdata(rdev); | ||
| 130 | struct device *dev = ltc3676->dev; | ||
| 131 | int ret, dcdc = rdev_get_id(rdev); | ||
| 132 | |||
| 133 | dev_dbg(dev, "%s id=%d selector=%d\n", __func__, dcdc, selector); | ||
| 134 | |||
| 135 | ret = regmap_update_bits(ltc3676->regmap, rdev->desc->vsel_reg + 1, | ||
| 136 | LTC3676_DVBxB_PGOOD_MASK, | ||
| 137 | LTC3676_DVBxB_PGOOD_MASK); | ||
| 138 | if (ret) | ||
| 139 | return ret; | ||
| 140 | |||
| 141 | return regulator_set_voltage_sel_regmap(rdev, selector); | ||
| 142 | } | ||
| 143 | |||
| 126 | static inline unsigned int ltc3676_scale(unsigned int uV, u32 r1, u32 r2) | 144 | static inline unsigned int ltc3676_scale(unsigned int uV, u32 r1, u32 r2) |
| 127 | { | 145 | { |
| 128 | uint64_t tmp; | 146 | uint64_t tmp; |
| @@ -166,7 +184,7 @@ static const struct regulator_ops ltc3676_linear_regulator_ops = { | |||
| 166 | .disable = regulator_disable_regmap, | 184 | .disable = regulator_disable_regmap, |
| 167 | .is_enabled = regulator_is_enabled_regmap, | 185 | .is_enabled = regulator_is_enabled_regmap, |
| 168 | .list_voltage = regulator_list_voltage_linear, | 186 | .list_voltage = regulator_list_voltage_linear, |
| 169 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 187 | .set_voltage_sel = ltc3676_set_voltage_sel, |
| 170 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 188 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
| 171 | .set_suspend_voltage = ltc3676_set_suspend_voltage, | 189 | .set_suspend_voltage = ltc3676_set_suspend_voltage, |
| 172 | .set_suspend_mode = ltc3676_set_suspend_mode, | 190 | .set_suspend_mode = ltc3676_set_suspend_mode, |
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c index 1096546c05e9..f1e77ed5dfec 100644 --- a/drivers/regulator/max8952.c +++ b/drivers/regulator/max8952.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <linux/regulator/driver.h> | 27 | #include <linux/regulator/driver.h> |
| 28 | #include <linux/regulator/max8952.h> | 28 | #include <linux/regulator/max8952.h> |
| 29 | #include <linux/gpio.h> | 29 | #include <linux/gpio.h> |
| 30 | #include <linux/gpio/consumer.h> | ||
| 30 | #include <linux/io.h> | 31 | #include <linux/io.h> |
| 31 | #include <linux/of.h> | 32 | #include <linux/of.h> |
| 32 | #include <linux/of_gpio.h> | 33 | #include <linux/of_gpio.h> |
| @@ -148,7 +149,6 @@ static struct max8952_platform_data *max8952_parse_dt(struct device *dev) | |||
| 148 | 149 | ||
| 149 | pd->gpio_vid0 = of_get_named_gpio(np, "max8952,vid-gpios", 0); | 150 | pd->gpio_vid0 = of_get_named_gpio(np, "max8952,vid-gpios", 0); |
| 150 | pd->gpio_vid1 = of_get_named_gpio(np, "max8952,vid-gpios", 1); | 151 | pd->gpio_vid1 = of_get_named_gpio(np, "max8952,vid-gpios", 1); |
| 151 | pd->gpio_en = of_get_named_gpio(np, "max8952,en-gpio", 0); | ||
| 152 | 152 | ||
| 153 | if (of_property_read_u32(np, "max8952,default-mode", &pd->default_mode)) | 153 | if (of_property_read_u32(np, "max8952,default-mode", &pd->default_mode)) |
| 154 | dev_warn(dev, "Default mode not specified, assuming 0\n"); | 154 | dev_warn(dev, "Default mode not specified, assuming 0\n"); |
| @@ -197,6 +197,8 @@ static int max8952_pmic_probe(struct i2c_client *client, | |||
| 197 | struct regulator_config config = { }; | 197 | struct regulator_config config = { }; |
| 198 | struct max8952_data *max8952; | 198 | struct max8952_data *max8952; |
| 199 | struct regulator_dev *rdev; | 199 | struct regulator_dev *rdev; |
| 200 | struct gpio_desc *gpiod; | ||
| 201 | enum gpiod_flags gflags; | ||
| 200 | 202 | ||
| 201 | int ret = 0, err = 0; | 203 | int ret = 0, err = 0; |
| 202 | 204 | ||
| @@ -224,11 +226,17 @@ static int max8952_pmic_probe(struct i2c_client *client, | |||
| 224 | config.driver_data = max8952; | 226 | config.driver_data = max8952; |
| 225 | config.of_node = client->dev.of_node; | 227 | config.of_node = client->dev.of_node; |
| 226 | 228 | ||
| 227 | config.ena_gpio = pdata->gpio_en; | ||
| 228 | if (client->dev.of_node) | ||
| 229 | config.ena_gpio_initialized = true; | ||
| 230 | if (pdata->reg_data->constraints.boot_on) | 229 | if (pdata->reg_data->constraints.boot_on) |
| 231 | config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH; | 230 | gflags = GPIOD_OUT_HIGH; |
| 231 | else | ||
| 232 | gflags = GPIOD_OUT_LOW; | ||
| 233 | gpiod = devm_gpiod_get_optional(&client->dev, | ||
| 234 | "max8952,en", | ||
| 235 | gflags); | ||
| 236 | if (IS_ERR(gpiod)) | ||
| 237 | return PTR_ERR(gpiod); | ||
| 238 | if (gpiod) | ||
| 239 | config.ena_gpiod = gpiod; | ||
| 232 | 240 | ||
| 233 | rdev = devm_regulator_register(&client->dev, ®ulator, &config); | 241 | rdev = devm_regulator_register(&client->dev, ®ulator, &config); |
| 234 | if (IS_ERR(rdev)) { | 242 | if (IS_ERR(rdev)) { |
diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c index e0c747aa9f85..7cd493ec6315 100644 --- a/drivers/regulator/max8973-regulator.c +++ b/drivers/regulator/max8973-regulator.c | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #include <linux/regulator/max8973-regulator.h> | 34 | #include <linux/regulator/max8973-regulator.h> |
| 35 | #include <linux/regulator/of_regulator.h> | 35 | #include <linux/regulator/of_regulator.h> |
| 36 | #include <linux/gpio.h> | 36 | #include <linux/gpio.h> |
| 37 | #include <linux/gpio/consumer.h> | ||
| 37 | #include <linux/of_gpio.h> | 38 | #include <linux/of_gpio.h> |
| 38 | #include <linux/i2c.h> | 39 | #include <linux/i2c.h> |
| 39 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
| @@ -114,7 +115,6 @@ struct max8973_chip { | |||
| 114 | struct regulator_desc desc; | 115 | struct regulator_desc desc; |
| 115 | struct regmap *regmap; | 116 | struct regmap *regmap; |
| 116 | bool enable_external_control; | 117 | bool enable_external_control; |
| 117 | int enable_gpio; | ||
| 118 | int dvs_gpio; | 118 | int dvs_gpio; |
| 119 | int lru_index[MAX8973_MAX_VOUT_REG]; | 119 | int lru_index[MAX8973_MAX_VOUT_REG]; |
| 120 | int curr_vout_val[MAX8973_MAX_VOUT_REG]; | 120 | int curr_vout_val[MAX8973_MAX_VOUT_REG]; |
| @@ -567,7 +567,6 @@ static struct max8973_regulator_platform_data *max8973_parse_dt( | |||
| 567 | 567 | ||
| 568 | pdata->enable_ext_control = of_property_read_bool(np, | 568 | pdata->enable_ext_control = of_property_read_bool(np, |
| 569 | "maxim,externally-enable"); | 569 | "maxim,externally-enable"); |
| 570 | pdata->enable_gpio = of_get_named_gpio(np, "maxim,enable-gpio", 0); | ||
| 571 | pdata->dvs_gpio = of_get_named_gpio(np, "maxim,dvs-gpio", 0); | 570 | pdata->dvs_gpio = of_get_named_gpio(np, "maxim,dvs-gpio", 0); |
| 572 | 571 | ||
| 573 | ret = of_property_read_u32(np, "maxim,dvs-default-state", &pval); | 572 | ret = of_property_read_u32(np, "maxim,dvs-default-state", &pval); |
| @@ -633,6 +632,8 @@ static int max8973_probe(struct i2c_client *client, | |||
| 633 | struct max8973_chip *max; | 632 | struct max8973_chip *max; |
| 634 | bool pdata_from_dt = false; | 633 | bool pdata_from_dt = false; |
| 635 | unsigned int chip_id; | 634 | unsigned int chip_id; |
| 635 | struct gpio_desc *gpiod; | ||
| 636 | enum gpiod_flags gflags; | ||
| 636 | int ret; | 637 | int ret; |
| 637 | 638 | ||
| 638 | pdata = dev_get_platdata(&client->dev); | 639 | pdata = dev_get_platdata(&client->dev); |
| @@ -647,8 +648,7 @@ static int max8973_probe(struct i2c_client *client, | |||
| 647 | return -EIO; | 648 | return -EIO; |
| 648 | } | 649 | } |
| 649 | 650 | ||
| 650 | if ((pdata->dvs_gpio == -EPROBE_DEFER) || | 651 | if (pdata->dvs_gpio == -EPROBE_DEFER) |
| 651 | (pdata->enable_gpio == -EPROBE_DEFER)) | ||
| 652 | return -EPROBE_DEFER; | 652 | return -EPROBE_DEFER; |
| 653 | 653 | ||
| 654 | max = devm_kzalloc(&client->dev, sizeof(*max), GFP_KERNEL); | 654 | max = devm_kzalloc(&client->dev, sizeof(*max), GFP_KERNEL); |
| @@ -696,15 +696,11 @@ static int max8973_probe(struct i2c_client *client, | |||
| 696 | max->desc.n_voltages = MAX8973_BUCK_N_VOLTAGE; | 696 | max->desc.n_voltages = MAX8973_BUCK_N_VOLTAGE; |
| 697 | 697 | ||
| 698 | max->dvs_gpio = (pdata->dvs_gpio) ? pdata->dvs_gpio : -EINVAL; | 698 | max->dvs_gpio = (pdata->dvs_gpio) ? pdata->dvs_gpio : -EINVAL; |
| 699 | max->enable_gpio = (pdata->enable_gpio) ? pdata->enable_gpio : -EINVAL; | ||
| 700 | max->enable_external_control = pdata->enable_ext_control; | 699 | max->enable_external_control = pdata->enable_ext_control; |
| 701 | max->curr_gpio_val = pdata->dvs_def_state; | 700 | max->curr_gpio_val = pdata->dvs_def_state; |
| 702 | max->curr_vout_reg = MAX8973_VOUT + pdata->dvs_def_state; | 701 | max->curr_vout_reg = MAX8973_VOUT + pdata->dvs_def_state; |
| 703 | max->junction_temp_warning = pdata->junction_temp_warning; | 702 | max->junction_temp_warning = pdata->junction_temp_warning; |
| 704 | 703 | ||
| 705 | if (gpio_is_valid(max->enable_gpio)) | ||
| 706 | max->enable_external_control = true; | ||
| 707 | |||
| 708 | max->lru_index[0] = max->curr_vout_reg; | 704 | max->lru_index[0] = max->curr_vout_reg; |
| 709 | 705 | ||
| 710 | if (gpio_is_valid(max->dvs_gpio)) { | 706 | if (gpio_is_valid(max->dvs_gpio)) { |
| @@ -757,27 +753,35 @@ static int max8973_probe(struct i2c_client *client, | |||
| 757 | break; | 753 | break; |
| 758 | } | 754 | } |
| 759 | 755 | ||
| 760 | if (gpio_is_valid(max->enable_gpio)) { | 756 | if (ridata && (ridata->constraints.always_on || |
| 761 | config.ena_gpio_flags = GPIOF_OUT_INIT_LOW; | 757 | ridata->constraints.boot_on)) |
| 762 | if (ridata && (ridata->constraints.always_on || | 758 | gflags = GPIOD_OUT_HIGH; |
| 763 | ridata->constraints.boot_on)) | 759 | else |
| 764 | config.ena_gpio_flags = GPIOF_OUT_INIT_HIGH; | 760 | gflags = GPIOD_OUT_LOW; |
| 765 | config.ena_gpio = max->enable_gpio; | 761 | gpiod = devm_gpiod_get_optional(&client->dev, |
| 762 | "maxim,enable", | ||
| 763 | gflags); | ||
| 764 | if (IS_ERR(gpiod)) | ||
| 765 | return PTR_ERR(gpiod); | ||
| 766 | if (gpiod) { | ||
| 767 | config.ena_gpiod = gpiod; | ||
| 768 | max->enable_external_control = true; | ||
| 766 | } | 769 | } |
| 770 | |||
| 767 | break; | 771 | break; |
| 768 | 772 | ||
| 769 | case MAX77621: | 773 | case MAX77621: |
| 770 | if (gpio_is_valid(max->enable_gpio)) { | 774 | /* |
| 771 | ret = devm_gpio_request_one(&client->dev, | 775 | * We do not let the core switch this regulator on/off, |
| 772 | max->enable_gpio, GPIOF_OUT_INIT_HIGH, | 776 | * we just leave it on. |
| 773 | "max8973-en-gpio"); | 777 | */ |
| 774 | if (ret) { | 778 | gpiod = devm_gpiod_get_optional(&client->dev, |
| 775 | dev_err(&client->dev, | 779 | "maxim,enable", |
| 776 | "gpio_request for gpio %d failed: %d\n", | 780 | GPIOD_OUT_HIGH); |
| 777 | max->enable_gpio, ret); | 781 | if (IS_ERR(gpiod)) |
| 778 | return ret; | 782 | return PTR_ERR(gpiod); |
| 779 | } | 783 | if (gpiod) |
| 780 | } | 784 | max->enable_external_control = true; |
| 781 | 785 | ||
| 782 | max->desc.enable_reg = MAX8973_VOUT; | 786 | max->desc.enable_reg = MAX8973_VOUT; |
| 783 | max->desc.enable_mask = MAX8973_VOUT_ENABLE; | 787 | max->desc.enable_mask = MAX8973_VOUT_ENABLE; |
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index 3027e7ce100b..6a2b61c012b5 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c | |||
| @@ -309,8 +309,7 @@ static int max8998_set_voltage_buck_sel(struct regulator_dev *rdev, | |||
| 309 | unsigned selector) | 309 | unsigned selector) |
| 310 | { | 310 | { |
| 311 | struct max8998_data *max8998 = rdev_get_drvdata(rdev); | 311 | struct max8998_data *max8998 = rdev_get_drvdata(rdev); |
| 312 | struct max8998_platform_data *pdata = | 312 | struct max8998_platform_data *pdata = max8998->iodev->pdata; |
| 313 | dev_get_platdata(max8998->iodev->dev); | ||
| 314 | struct i2c_client *i2c = max8998->iodev->i2c; | 313 | struct i2c_client *i2c = max8998->iodev->i2c; |
| 315 | int buck = rdev_get_id(rdev); | 314 | int buck = rdev_get_id(rdev); |
| 316 | int reg, shift = 0, mask, ret, j; | 315 | int reg, shift = 0, mask, ret, j; |
diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c index 0e0277bd91a8..8fd1adc9c9a9 100644 --- a/drivers/regulator/mc13783-regulator.c +++ b/drivers/regulator/mc13783-regulator.c | |||
| @@ -1,14 +1,10 @@ | |||
| 1 | /* | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | * Regulator Driver for Freescale MC13783 PMIC | 2 | // |
| 3 | * | 3 | // Regulator Driver for Freescale MC13783 PMIC |
| 4 | * Copyright 2010 Yong Shen <yong.shen@linaro.org> | 4 | // |
| 5 | * Copyright (C) 2008 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de> | 5 | // Copyright 2010 Yong Shen <yong.shen@linaro.org> |
| 6 | * Copyright 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com> | 6 | // Copyright (C) 2008 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de> |
| 7 | * | 7 | // Copyright 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com> |
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | */ | ||
| 12 | 8 | ||
| 13 | #include <linux/mfd/mc13783.h> | 9 | #include <linux/mfd/mc13783.h> |
| 14 | #include <linux/regulator/machine.h> | 10 | #include <linux/regulator/machine.h> |
diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c index 15dd7bc7b529..f3fba1cc1379 100644 --- a/drivers/regulator/mc13892-regulator.c +++ b/drivers/regulator/mc13892-regulator.c | |||
| @@ -1,14 +1,10 @@ | |||
| 1 | /* | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | * Regulator Driver for Freescale MC13892 PMIC | 2 | // |
| 3 | * | 3 | // Regulator Driver for Freescale MC13892 PMIC |
| 4 | * Copyright 2010 Yong Shen <yong.shen@linaro.org> | 4 | // |
| 5 | * | 5 | // Copyright 2010 Yong Shen <yong.shen@linaro.org> |
| 6 | * Based on draft driver from Arnaud Patard <arnaud.patard@rtp-net.org> | 6 | // |
| 7 | * | 7 | // Based on draft driver from Arnaud Patard <arnaud.patard@rtp-net.org> |
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | */ | ||
| 12 | 8 | ||
| 13 | #include <linux/mfd/mc13892.h> | 9 | #include <linux/mfd/mc13892.h> |
| 14 | #include <linux/regulator/machine.h> | 10 | #include <linux/regulator/machine.h> |
diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c index 0281c31ae2ed..41271aeea63e 100644 --- a/drivers/regulator/mc13xxx-regulator-core.c +++ b/drivers/regulator/mc13xxx-regulator-core.c | |||
| @@ -1,19 +1,15 @@ | |||
| 1 | /* | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | * Regulator Driver for Freescale MC13xxx PMIC | 2 | // |
| 3 | * | 3 | // Regulator Driver for Freescale MC13xxx PMIC |
| 4 | * Copyright 2010 Yong Shen <yong.shen@linaro.org> | 4 | // |
| 5 | * | 5 | // Copyright 2010 Yong Shen <yong.shen@linaro.org> |
| 6 | * Based on mc13783 regulator driver : | 6 | // |
| 7 | * Copyright (C) 2008 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de> | 7 | // Based on mc13783 regulator driver : |
| 8 | * Copyright 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com> | 8 | // Copyright (C) 2008 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de> |
| 9 | * | 9 | // Copyright 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com> |
| 10 | * This program is free software; you can redistribute it and/or modify | 10 | // |
| 11 | * it under the terms of the GNU General Public License version 2 as | 11 | // Regs infos taken from mc13xxx drivers from freescale and mc13xxx.pdf file |
| 12 | * published by the Free Software Foundation. | 12 | // from freescale |
| 13 | * | ||
| 14 | * Regs infos taken from mc13xxx drivers from freescale and mc13xxx.pdf file | ||
| 15 | * from freescale | ||
| 16 | */ | ||
| 17 | 13 | ||
| 18 | #include <linux/mfd/mc13xxx.h> | 14 | #include <linux/mfd/mc13xxx.h> |
| 19 | #include <linux/regulator/machine.h> | 15 | #include <linux/regulator/machine.h> |
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index f47264fa1940..638f17d4c848 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c | |||
| @@ -31,7 +31,8 @@ static void of_get_regulation_constraints(struct device_node *np, | |||
| 31 | struct regulation_constraints *constraints = &(*init_data)->constraints; | 31 | struct regulation_constraints *constraints = &(*init_data)->constraints; |
| 32 | struct regulator_state *suspend_state; | 32 | struct regulator_state *suspend_state; |
| 33 | struct device_node *suspend_np; | 33 | struct device_node *suspend_np; |
| 34 | int ret, i; | 34 | unsigned int mode; |
| 35 | int ret, i, len; | ||
| 35 | u32 pval; | 36 | u32 pval; |
| 36 | 37 | ||
| 37 | constraints->name = of_get_property(np, "regulator-name", NULL); | 38 | constraints->name = of_get_property(np, "regulator-name", NULL); |
| @@ -124,20 +125,51 @@ static void of_get_regulation_constraints(struct device_node *np, | |||
| 124 | 125 | ||
| 125 | if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) { | 126 | if (!of_property_read_u32(np, "regulator-initial-mode", &pval)) { |
| 126 | if (desc && desc->of_map_mode) { | 127 | if (desc && desc->of_map_mode) { |
| 127 | ret = desc->of_map_mode(pval); | 128 | mode = desc->of_map_mode(pval); |
| 128 | if (ret == -EINVAL) | 129 | if (mode == REGULATOR_MODE_INVALID) |
| 129 | pr_err("%s: invalid mode %u\n", np->name, pval); | 130 | pr_err("%s: invalid mode %u\n", np->name, pval); |
| 130 | else | 131 | else |
| 131 | constraints->initial_mode = ret; | 132 | constraints->initial_mode = mode; |
| 132 | } else { | 133 | } else { |
| 133 | pr_warn("%s: mapping for mode %d not defined\n", | 134 | pr_warn("%s: mapping for mode %d not defined\n", |
| 134 | np->name, pval); | 135 | np->name, pval); |
| 135 | } | 136 | } |
| 136 | } | 137 | } |
| 137 | 138 | ||
| 139 | len = of_property_count_elems_of_size(np, "regulator-allowed-modes", | ||
| 140 | sizeof(u32)); | ||
| 141 | if (len > 0) { | ||
| 142 | if (desc && desc->of_map_mode) { | ||
| 143 | for (i = 0; i < len; i++) { | ||
| 144 | ret = of_property_read_u32_index(np, | ||
| 145 | "regulator-allowed-modes", i, &pval); | ||
| 146 | if (ret) { | ||
| 147 | pr_err("%s: couldn't read allowed modes index %d, ret=%d\n", | ||
| 148 | np->name, i, ret); | ||
| 149 | break; | ||
| 150 | } | ||
| 151 | mode = desc->of_map_mode(pval); | ||
| 152 | if (mode == REGULATOR_MODE_INVALID) | ||
| 153 | pr_err("%s: invalid regulator-allowed-modes element %u\n", | ||
| 154 | np->name, pval); | ||
| 155 | else | ||
| 156 | constraints->valid_modes_mask |= mode; | ||
| 157 | } | ||
| 158 | if (constraints->valid_modes_mask) | ||
| 159 | constraints->valid_ops_mask | ||
| 160 | |= REGULATOR_CHANGE_MODE; | ||
| 161 | } else { | ||
| 162 | pr_warn("%s: mode mapping not defined\n", np->name); | ||
| 163 | } | ||
| 164 | } | ||
| 165 | |||
| 138 | if (!of_property_read_u32(np, "regulator-system-load", &pval)) | 166 | if (!of_property_read_u32(np, "regulator-system-load", &pval)) |
| 139 | constraints->system_load = pval; | 167 | constraints->system_load = pval; |
| 140 | 168 | ||
| 169 | if (!of_property_read_u32(np, "regulator-coupled-max-spread", | ||
| 170 | &pval)) | ||
| 171 | constraints->max_spread = pval; | ||
| 172 | |||
| 141 | constraints->over_current_protection = of_property_read_bool(np, | 173 | constraints->over_current_protection = of_property_read_bool(np, |
| 142 | "regulator-over-current-protection"); | 174 | "regulator-over-current-protection"); |
| 143 | 175 | ||
| @@ -163,12 +195,12 @@ static void of_get_regulation_constraints(struct device_node *np, | |||
| 163 | if (!of_property_read_u32(suspend_np, "regulator-mode", | 195 | if (!of_property_read_u32(suspend_np, "regulator-mode", |
| 164 | &pval)) { | 196 | &pval)) { |
| 165 | if (desc && desc->of_map_mode) { | 197 | if (desc && desc->of_map_mode) { |
| 166 | ret = desc->of_map_mode(pval); | 198 | mode = desc->of_map_mode(pval); |
| 167 | if (ret == -EINVAL) | 199 | if (mode == REGULATOR_MODE_INVALID) |
| 168 | pr_err("%s: invalid mode %u\n", | 200 | pr_err("%s: invalid mode %u\n", |
| 169 | np->name, pval); | 201 | np->name, pval); |
| 170 | else | 202 | else |
| 171 | suspend_state->mode = ret; | 203 | suspend_state->mode = mode; |
| 172 | } else { | 204 | } else { |
| 173 | pr_warn("%s: mapping for mode %d not defined\n", | 205 | pr_warn("%s: mapping for mode %d not defined\n", |
| 174 | np->name, pval); | 206 | np->name, pval); |
| @@ -407,3 +439,150 @@ struct regulator_dev *of_find_regulator_by_node(struct device_node *np) | |||
| 407 | 439 | ||
| 408 | return dev ? dev_to_rdev(dev) : NULL; | 440 | return dev ? dev_to_rdev(dev) : NULL; |
| 409 | } | 441 | } |
| 442 | |||
| 443 | /* | ||
| 444 | * Returns number of regulators coupled with rdev. | ||
| 445 | */ | ||
| 446 | int of_get_n_coupled(struct regulator_dev *rdev) | ||
| 447 | { | ||
| 448 | struct device_node *node = rdev->dev.of_node; | ||
| 449 | int n_phandles; | ||
| 450 | |||
| 451 | n_phandles = of_count_phandle_with_args(node, | ||
| 452 | "regulator-coupled-with", | ||
| 453 | NULL); | ||
| 454 | |||
| 455 | return (n_phandles > 0) ? n_phandles : 0; | ||
| 456 | } | ||
| 457 | |||
| 458 | /* Looks for "to_find" device_node in src's "regulator-coupled-with" property */ | ||
| 459 | static bool of_coupling_find_node(struct device_node *src, | ||
| 460 | struct device_node *to_find) | ||
| 461 | { | ||
| 462 | int n_phandles, i; | ||
| 463 | bool found = false; | ||
| 464 | |||
| 465 | n_phandles = of_count_phandle_with_args(src, | ||
| 466 | "regulator-coupled-with", | ||
| 467 | NULL); | ||
| 468 | |||
| 469 | for (i = 0; i < n_phandles; i++) { | ||
| 470 | struct device_node *tmp = of_parse_phandle(src, | ||
| 471 | "regulator-coupled-with", i); | ||
| 472 | |||
| 473 | if (!tmp) | ||
| 474 | break; | ||
| 475 | |||
| 476 | /* found */ | ||
| 477 | if (tmp == to_find) | ||
| 478 | found = true; | ||
| 479 | |||
| 480 | of_node_put(tmp); | ||
| 481 | |||
| 482 | if (found) | ||
| 483 | break; | ||
| 484 | } | ||
| 485 | |||
| 486 | return found; | ||
| 487 | } | ||
| 488 | |||
| 489 | /** | ||
| 490 | * of_check_coupling_data - Parse rdev's coupling properties and check data | ||
| 491 | * consistency | ||
| 492 | * @rdev - pointer to regulator_dev whose data is checked | ||
| 493 | * | ||
| 494 | * Function checks if all the following conditions are met: | ||
| 495 | * - rdev's max_spread is greater than 0 | ||
| 496 | * - all coupled regulators have the same max_spread | ||
| 497 | * - all coupled regulators have the same number of regulator_dev phandles | ||
| 498 | * - all regulators are linked to each other | ||
| 499 | * | ||
| 500 | * Returns true if all conditions are met. | ||
| 501 | */ | ||
| 502 | bool of_check_coupling_data(struct regulator_dev *rdev) | ||
| 503 | { | ||
| 504 | int max_spread = rdev->constraints->max_spread; | ||
| 505 | struct device_node *node = rdev->dev.of_node; | ||
| 506 | int n_phandles = of_get_n_coupled(rdev); | ||
| 507 | struct device_node *c_node; | ||
| 508 | int i; | ||
| 509 | bool ret = true; | ||
| 510 | |||
| 511 | if (max_spread <= 0) { | ||
| 512 | dev_err(&rdev->dev, "max_spread value invalid\n"); | ||
| 513 | return false; | ||
| 514 | } | ||
| 515 | |||
| 516 | /* iterate over rdev's phandles */ | ||
| 517 | for (i = 0; i < n_phandles; i++) { | ||
| 518 | int c_max_spread, c_n_phandles; | ||
| 519 | |||
| 520 | c_node = of_parse_phandle(node, | ||
| 521 | "regulator-coupled-with", i); | ||
| 522 | |||
| 523 | if (!c_node) | ||
| 524 | ret = false; | ||
| 525 | |||
| 526 | c_n_phandles = of_count_phandle_with_args(c_node, | ||
| 527 | "regulator-coupled-with", | ||
| 528 | NULL); | ||
| 529 | |||
| 530 | if (c_n_phandles != n_phandles) { | ||
| 531 | dev_err(&rdev->dev, "number of couped reg phandles mismatch\n"); | ||
| 532 | ret = false; | ||
| 533 | goto clean; | ||
| 534 | } | ||
| 535 | |||
| 536 | if (of_property_read_u32(c_node, "regulator-coupled-max-spread", | ||
| 537 | &c_max_spread)) { | ||
| 538 | ret = false; | ||
| 539 | goto clean; | ||
| 540 | } | ||
| 541 | |||
| 542 | if (c_max_spread != max_spread) { | ||
| 543 | dev_err(&rdev->dev, | ||
| 544 | "coupled regulators max_spread mismatch\n"); | ||
| 545 | ret = false; | ||
| 546 | goto clean; | ||
| 547 | } | ||
| 548 | |||
| 549 | if (!of_coupling_find_node(c_node, node)) { | ||
| 550 | dev_err(&rdev->dev, "missing 2-way linking for coupled regulators\n"); | ||
| 551 | ret = false; | ||
| 552 | } | ||
| 553 | |||
| 554 | clean: | ||
| 555 | of_node_put(c_node); | ||
| 556 | if (!ret) | ||
| 557 | break; | ||
| 558 | } | ||
| 559 | |||
| 560 | return ret; | ||
| 561 | } | ||
| 562 | |||
| 563 | /** | ||
| 564 | * of_parse_coupled regulator - Get regulator_dev pointer from rdev's property | ||
| 565 | * @rdev: Pointer to regulator_dev, whose DTS is used as a source to parse | ||
| 566 | * "regulator-coupled-with" property | ||
| 567 | * @index: Index in phandles array | ||
| 568 | * | ||
| 569 | * Returns the regulator_dev pointer parsed from DTS. If it has not been yet | ||
| 570 | * registered, returns NULL | ||
| 571 | */ | ||
| 572 | struct regulator_dev *of_parse_coupled_regulator(struct regulator_dev *rdev, | ||
| 573 | int index) | ||
| 574 | { | ||
| 575 | struct device_node *node = rdev->dev.of_node; | ||
| 576 | struct device_node *c_node; | ||
| 577 | struct regulator_dev *c_rdev; | ||
| 578 | |||
| 579 | c_node = of_parse_phandle(node, "regulator-coupled-with", index); | ||
| 580 | if (!c_node) | ||
| 581 | return NULL; | ||
| 582 | |||
| 583 | c_rdev = of_find_regulator_by_node(c_node); | ||
| 584 | |||
| 585 | of_node_put(c_node); | ||
| 586 | |||
| 587 | return c_rdev; | ||
| 588 | } | ||
diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c index 63922a2167e5..8d9dbcc775ea 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c | |||
| @@ -1,20 +1,7 @@ | |||
| 1 | /* | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | * Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved. | 2 | // |
| 3 | * | 3 | // Copyright (C) 2011-2013 Freescale Semiconductor, Inc. All Rights Reserved. |
| 4 | * This program is free software; you can redistribute it and/or modify | 4 | |
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation; either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write to the Free Software | ||
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 17 | */ | ||
| 18 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
| 19 | #include <linux/module.h> | 6 | #include <linux/module.h> |
| 20 | #include <linux/init.h> | 7 | #include <linux/init.h> |
| @@ -86,6 +73,13 @@ static const int pfuze100_coin[] = { | |||
| 86 | 2500000, 2700000, 2800000, 2900000, 3000000, 3100000, 3200000, 3300000, | 73 | 2500000, 2700000, 2800000, 2900000, 3000000, 3100000, 3200000, 3300000, |
| 87 | }; | 74 | }; |
| 88 | 75 | ||
| 76 | static const int pfuze3000_sw1a[] = { | ||
| 77 | 700000, 725000, 750000, 775000, 800000, 825000, 850000, 875000, | ||
| 78 | 900000, 925000, 950000, 975000, 1000000, 1025000, 1050000, 1075000, | ||
| 79 | 1100000, 1125000, 1150000, 1175000, 1200000, 1225000, 1250000, 1275000, | ||
| 80 | 1300000, 1325000, 1350000, 1375000, 1400000, 1425000, 1800000, 3300000, | ||
| 81 | }; | ||
| 82 | |||
| 89 | static const int pfuze3000_sw2lo[] = { | 83 | static const int pfuze3000_sw2lo[] = { |
| 90 | 1500000, 1550000, 1600000, 1650000, 1700000, 1750000, 1800000, 1850000, | 84 | 1500000, 1550000, 1600000, 1650000, 1700000, 1750000, 1800000, 1850000, |
| 91 | }; | 85 | }; |
| @@ -148,6 +142,9 @@ static const struct regulator_ops pfuze100_fixed_regulator_ops = { | |||
| 148 | }; | 142 | }; |
| 149 | 143 | ||
| 150 | static const struct regulator_ops pfuze100_sw_regulator_ops = { | 144 | static const struct regulator_ops pfuze100_sw_regulator_ops = { |
| 145 | .enable = regulator_enable_regmap, | ||
| 146 | .disable = regulator_disable_regmap, | ||
| 147 | .is_enabled = regulator_is_enabled_regmap, | ||
| 151 | .list_voltage = regulator_list_voltage_linear, | 148 | .list_voltage = regulator_list_voltage_linear, |
| 152 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 149 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
| 153 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 150 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
| @@ -158,6 +155,7 @@ static const struct regulator_ops pfuze100_sw_regulator_ops = { | |||
| 158 | static const struct regulator_ops pfuze100_swb_regulator_ops = { | 155 | static const struct regulator_ops pfuze100_swb_regulator_ops = { |
| 159 | .enable = regulator_enable_regmap, | 156 | .enable = regulator_enable_regmap, |
| 160 | .disable = regulator_disable_regmap, | 157 | .disable = regulator_disable_regmap, |
| 158 | .is_enabled = regulator_is_enabled_regmap, | ||
| 161 | .list_voltage = regulator_list_voltage_table, | 159 | .list_voltage = regulator_list_voltage_table, |
| 162 | .map_voltage = regulator_map_voltage_ascend, | 160 | .map_voltage = regulator_map_voltage_ascend, |
| 163 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 161 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
| @@ -193,6 +191,11 @@ static const struct regulator_ops pfuze100_swb_regulator_ops = { | |||
| 193 | .uV_step = (step), \ | 191 | .uV_step = (step), \ |
| 194 | .vsel_reg = (base) + PFUZE100_VOL_OFFSET, \ | 192 | .vsel_reg = (base) + PFUZE100_VOL_OFFSET, \ |
| 195 | .vsel_mask = 0x3f, \ | 193 | .vsel_mask = 0x3f, \ |
| 194 | .enable_reg = (base) + PFUZE100_MODE_OFFSET, \ | ||
| 195 | .enable_val = 0xc, \ | ||
| 196 | .disable_val = 0x0, \ | ||
| 197 | .enable_mask = 0xf, \ | ||
| 198 | .enable_time = 500, \ | ||
| 196 | }, \ | 199 | }, \ |
| 197 | .stby_reg = (base) + PFUZE100_STANDBY_OFFSET, \ | 200 | .stby_reg = (base) + PFUZE100_STANDBY_OFFSET, \ |
| 198 | .stby_mask = 0x3f, \ | 201 | .stby_mask = 0x3f, \ |
| @@ -343,7 +346,7 @@ static struct pfuze_regulator pfuze200_regulators[] = { | |||
| 343 | }; | 346 | }; |
| 344 | 347 | ||
| 345 | static struct pfuze_regulator pfuze3000_regulators[] = { | 348 | static struct pfuze_regulator pfuze3000_regulators[] = { |
| 346 | PFUZE100_SW_REG(PFUZE3000, SW1A, PFUZE100_SW1ABVOL, 700000, 1475000, 25000), | 349 | PFUZE100_SWB_REG(PFUZE3000, SW1A, PFUZE100_SW1ABVOL, 0x1f, pfuze3000_sw1a), |
| 347 | PFUZE100_SW_REG(PFUZE3000, SW1B, PFUZE100_SW1CVOL, 700000, 1475000, 25000), | 350 | PFUZE100_SW_REG(PFUZE3000, SW1B, PFUZE100_SW1CVOL, 700000, 1475000, 25000), |
| 348 | PFUZE100_SWB_REG(PFUZE3000, SW2, PFUZE100_SW2VOL, 0x7, pfuze3000_sw2lo), | 351 | PFUZE100_SWB_REG(PFUZE3000, SW2, PFUZE100_SW2VOL, 0x7, pfuze3000_sw2lo), |
| 349 | PFUZE3000_SW3_REG(PFUZE3000, SW3, PFUZE100_SW3AVOL, 900000, 1650000, 50000), | 352 | PFUZE3000_SW3_REG(PFUZE3000, SW3, PFUZE100_SW3AVOL, 900000, 1650000, 50000), |
| @@ -648,7 +651,6 @@ static int pfuze100_regulator_probe(struct i2c_client *client, | |||
| 648 | config.init_data = init_data; | 651 | config.init_data = init_data; |
| 649 | config.driver_data = pfuze_chip; | 652 | config.driver_data = pfuze_chip; |
| 650 | config.of_node = match_of_node(i); | 653 | config.of_node = match_of_node(i); |
| 651 | config.ena_gpio = -EINVAL; | ||
| 652 | 654 | ||
| 653 | pfuze_chip->regulators[i] = | 655 | pfuze_chip->regulators[i] = |
| 654 | devm_regulator_register(&client->dev, desc, &config); | 656 | devm_regulator_register(&client->dev, desc, &config); |
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c index 63c7a0c17777..9817f1a75342 100644 --- a/drivers/regulator/qcom_spmi-regulator.c +++ b/drivers/regulator/qcom_spmi-regulator.c | |||
| @@ -25,6 +25,8 @@ | |||
| 25 | #include <linux/regulator/driver.h> | 25 | #include <linux/regulator/driver.h> |
| 26 | #include <linux/regmap.h> | 26 | #include <linux/regmap.h> |
| 27 | #include <linux/list.h> | 27 | #include <linux/list.h> |
| 28 | #include <linux/mfd/syscon.h> | ||
| 29 | #include <linux/io.h> | ||
| 28 | 30 | ||
| 29 | /* Pin control enable input pins. */ | 31 | /* Pin control enable input pins. */ |
| 30 | #define SPMI_REGULATOR_PIN_CTRL_ENABLE_NONE 0x00 | 32 | #define SPMI_REGULATOR_PIN_CTRL_ENABLE_NONE 0x00 |
| @@ -181,6 +183,23 @@ enum spmi_boost_byp_registers { | |||
| 181 | SPMI_BOOST_BYP_REG_CURRENT_LIMIT = 0x4b, | 183 | SPMI_BOOST_BYP_REG_CURRENT_LIMIT = 0x4b, |
| 182 | }; | 184 | }; |
| 183 | 185 | ||
| 186 | enum spmi_saw3_registers { | ||
| 187 | SAW3_SECURE = 0x00, | ||
| 188 | SAW3_ID = 0x04, | ||
| 189 | SAW3_SPM_STS = 0x0C, | ||
| 190 | SAW3_AVS_STS = 0x10, | ||
| 191 | SAW3_PMIC_STS = 0x14, | ||
| 192 | SAW3_RST = 0x18, | ||
| 193 | SAW3_VCTL = 0x1C, | ||
| 194 | SAW3_AVS_CTL = 0x20, | ||
| 195 | SAW3_AVS_LIMIT = 0x24, | ||
| 196 | SAW3_AVS_DLY = 0x28, | ||
| 197 | SAW3_AVS_HYSTERESIS = 0x2C, | ||
| 198 | SAW3_SPM_STS2 = 0x38, | ||
| 199 | SAW3_SPM_PMIC_DATA_3 = 0x4C, | ||
| 200 | SAW3_VERSION = 0xFD0, | ||
| 201 | }; | ||
| 202 | |||
| 184 | /* Used for indexing into ctrl_reg. These are offets from 0x40 */ | 203 | /* Used for indexing into ctrl_reg. These are offets from 0x40 */ |
| 185 | enum spmi_common_control_register_index { | 204 | enum spmi_common_control_register_index { |
| 186 | SPMI_COMMON_IDX_VOLTAGE_RANGE = 0, | 205 | SPMI_COMMON_IDX_VOLTAGE_RANGE = 0, |
| @@ -1035,6 +1054,89 @@ static irqreturn_t spmi_regulator_vs_ocp_isr(int irq, void *data) | |||
| 1035 | return IRQ_HANDLED; | 1054 | return IRQ_HANDLED; |
| 1036 | } | 1055 | } |
| 1037 | 1056 | ||
| 1057 | #define SAW3_VCTL_DATA_MASK 0xFF | ||
| 1058 | #define SAW3_VCTL_CLEAR_MASK 0x700FF | ||
| 1059 | #define SAW3_AVS_CTL_EN_MASK 0x1 | ||
| 1060 | #define SAW3_AVS_CTL_TGGL_MASK 0x8000000 | ||
| 1061 | #define SAW3_AVS_CTL_CLEAR_MASK 0x7efc00 | ||
| 1062 | |||
| 1063 | static struct regmap *saw_regmap = NULL; | ||
| 1064 | |||
| 1065 | static void spmi_saw_set_vdd(void *data) | ||
| 1066 | { | ||
| 1067 | u32 vctl, data3, avs_ctl, pmic_sts; | ||
| 1068 | bool avs_enabled = false; | ||
| 1069 | unsigned long timeout; | ||
| 1070 | u8 voltage_sel = *(u8 *)data; | ||
| 1071 | |||
| 1072 | regmap_read(saw_regmap, SAW3_AVS_CTL, &avs_ctl); | ||
| 1073 | regmap_read(saw_regmap, SAW3_VCTL, &vctl); | ||
| 1074 | regmap_read(saw_regmap, SAW3_SPM_PMIC_DATA_3, &data3); | ||
| 1075 | |||
| 1076 | /* select the band */ | ||
| 1077 | vctl &= ~SAW3_VCTL_CLEAR_MASK; | ||
| 1078 | vctl |= (u32)voltage_sel; | ||
| 1079 | |||
| 1080 | data3 &= ~SAW3_VCTL_CLEAR_MASK; | ||
| 1081 | data3 |= (u32)voltage_sel; | ||
| 1082 | |||
| 1083 | /* If AVS is enabled, switch it off during the voltage change */ | ||
| 1084 | avs_enabled = SAW3_AVS_CTL_EN_MASK & avs_ctl; | ||
| 1085 | if (avs_enabled) { | ||
| 1086 | avs_ctl &= ~SAW3_AVS_CTL_TGGL_MASK; | ||
| 1087 | regmap_write(saw_regmap, SAW3_AVS_CTL, avs_ctl); | ||
| 1088 | } | ||
| 1089 | |||
| 1090 | regmap_write(saw_regmap, SAW3_RST, 1); | ||
| 1091 | regmap_write(saw_regmap, SAW3_VCTL, vctl); | ||
| 1092 | regmap_write(saw_regmap, SAW3_SPM_PMIC_DATA_3, data3); | ||
| 1093 | |||
| 1094 | timeout = jiffies + usecs_to_jiffies(100); | ||
| 1095 | do { | ||
| 1096 | regmap_read(saw_regmap, SAW3_PMIC_STS, &pmic_sts); | ||
| 1097 | pmic_sts &= SAW3_VCTL_DATA_MASK; | ||
| 1098 | if (pmic_sts == (u32)voltage_sel) | ||
| 1099 | break; | ||
| 1100 | |||
| 1101 | cpu_relax(); | ||
| 1102 | |||
| 1103 | } while (time_before(jiffies, timeout)); | ||
| 1104 | |||
| 1105 | /* After successful voltage change, switch the AVS back on */ | ||
| 1106 | if (avs_enabled) { | ||
| 1107 | pmic_sts &= 0x3f; | ||
| 1108 | avs_ctl &= ~SAW3_AVS_CTL_CLEAR_MASK; | ||
| 1109 | avs_ctl |= ((pmic_sts - 4) << 10); | ||
| 1110 | avs_ctl |= (pmic_sts << 17); | ||
| 1111 | avs_ctl |= SAW3_AVS_CTL_TGGL_MASK; | ||
| 1112 | regmap_write(saw_regmap, SAW3_AVS_CTL, avs_ctl); | ||
| 1113 | } | ||
| 1114 | } | ||
| 1115 | |||
| 1116 | static int | ||
| 1117 | spmi_regulator_saw_set_voltage(struct regulator_dev *rdev, unsigned selector) | ||
| 1118 | { | ||
| 1119 | struct spmi_regulator *vreg = rdev_get_drvdata(rdev); | ||
| 1120 | int ret; | ||
| 1121 | u8 range_sel, voltage_sel; | ||
| 1122 | |||
| 1123 | ret = spmi_sw_selector_to_hw(vreg, selector, &range_sel, &voltage_sel); | ||
| 1124 | if (ret) | ||
| 1125 | return ret; | ||
| 1126 | |||
| 1127 | if (0 != range_sel) { | ||
| 1128 | dev_dbg(&rdev->dev, "range_sel = %02X voltage_sel = %02X", \ | ||
| 1129 | range_sel, voltage_sel); | ||
| 1130 | return -EINVAL; | ||
| 1131 | } | ||
| 1132 | |||
| 1133 | /* Always do the SAW register writes on the first CPU */ | ||
| 1134 | return smp_call_function_single(0, spmi_saw_set_vdd, \ | ||
| 1135 | &voltage_sel, true); | ||
| 1136 | } | ||
| 1137 | |||
| 1138 | static struct regulator_ops spmi_saw_ops = {}; | ||
| 1139 | |||
| 1038 | static struct regulator_ops spmi_smps_ops = { | 1140 | static struct regulator_ops spmi_smps_ops = { |
| 1039 | .enable = regulator_enable_regmap, | 1141 | .enable = regulator_enable_regmap, |
| 1040 | .disable = regulator_disable_regmap, | 1142 | .disable = regulator_disable_regmap, |
| @@ -1250,6 +1352,7 @@ static int spmi_regulator_match(struct spmi_regulator *vreg, u16 force_type) | |||
| 1250 | } | 1352 | } |
| 1251 | dig_major_rev = version[SPMI_COMMON_REG_DIG_MAJOR_REV | 1353 | dig_major_rev = version[SPMI_COMMON_REG_DIG_MAJOR_REV |
| 1252 | - SPMI_COMMON_REG_DIG_MAJOR_REV]; | 1354 | - SPMI_COMMON_REG_DIG_MAJOR_REV]; |
| 1355 | |||
| 1253 | if (!force_type) { | 1356 | if (!force_type) { |
| 1254 | type = version[SPMI_COMMON_REG_TYPE - | 1357 | type = version[SPMI_COMMON_REG_TYPE - |
| 1255 | SPMI_COMMON_REG_DIG_MAJOR_REV]; | 1358 | SPMI_COMMON_REG_DIG_MAJOR_REV]; |
| @@ -1648,7 +1751,9 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev) | |||
| 1648 | struct regmap *regmap; | 1751 | struct regmap *regmap; |
| 1649 | const char *name; | 1752 | const char *name; |
| 1650 | struct device *dev = &pdev->dev; | 1753 | struct device *dev = &pdev->dev; |
| 1651 | int ret; | 1754 | struct device_node *node = pdev->dev.of_node; |
| 1755 | struct device_node *syscon; | ||
| 1756 | int ret, lenp; | ||
| 1652 | struct list_head *vreg_list; | 1757 | struct list_head *vreg_list; |
| 1653 | 1758 | ||
| 1654 | vreg_list = devm_kzalloc(dev, sizeof(*vreg_list), GFP_KERNEL); | 1759 | vreg_list = devm_kzalloc(dev, sizeof(*vreg_list), GFP_KERNEL); |
| @@ -1665,7 +1770,22 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev) | |||
| 1665 | if (!match) | 1770 | if (!match) |
| 1666 | return -ENODEV; | 1771 | return -ENODEV; |
| 1667 | 1772 | ||
| 1773 | if (of_find_property(node, "qcom,saw-reg", &lenp)) { | ||
| 1774 | syscon = of_parse_phandle(node, "qcom,saw-reg", 0); | ||
| 1775 | saw_regmap = syscon_node_to_regmap(syscon); | ||
| 1776 | of_node_put(syscon); | ||
| 1777 | if (IS_ERR(regmap)) | ||
| 1778 | dev_err(dev, "ERROR reading SAW regmap\n"); | ||
| 1779 | } | ||
| 1780 | |||
| 1668 | for (reg = match->data; reg->name; reg++) { | 1781 | for (reg = match->data; reg->name; reg++) { |
| 1782 | |||
| 1783 | if (saw_regmap && \ | ||
| 1784 | of_find_property(of_find_node_by_name(node, reg->name), \ | ||
| 1785 | "qcom,saw-slave", &lenp)) { | ||
| 1786 | continue; | ||
| 1787 | } | ||
| 1788 | |||
| 1669 | vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); | 1789 | vreg = devm_kzalloc(dev, sizeof(*vreg), GFP_KERNEL); |
| 1670 | if (!vreg) | 1790 | if (!vreg) |
| 1671 | return -ENOMEM; | 1791 | return -ENOMEM; |
| @@ -1673,7 +1793,6 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev) | |||
| 1673 | vreg->dev = dev; | 1793 | vreg->dev = dev; |
| 1674 | vreg->base = reg->base; | 1794 | vreg->base = reg->base; |
| 1675 | vreg->regmap = regmap; | 1795 | vreg->regmap = regmap; |
| 1676 | |||
| 1677 | if (reg->ocp) { | 1796 | if (reg->ocp) { |
| 1678 | vreg->ocp_irq = platform_get_irq_byname(pdev, reg->ocp); | 1797 | vreg->ocp_irq = platform_get_irq_byname(pdev, reg->ocp); |
| 1679 | if (vreg->ocp_irq < 0) { | 1798 | if (vreg->ocp_irq < 0) { |
| @@ -1681,7 +1800,6 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev) | |||
| 1681 | goto err; | 1800 | goto err; |
| 1682 | } | 1801 | } |
| 1683 | } | 1802 | } |
| 1684 | |||
| 1685 | vreg->desc.id = -1; | 1803 | vreg->desc.id = -1; |
| 1686 | vreg->desc.owner = THIS_MODULE; | 1804 | vreg->desc.owner = THIS_MODULE; |
| 1687 | vreg->desc.type = REGULATOR_VOLTAGE; | 1805 | vreg->desc.type = REGULATOR_VOLTAGE; |
| @@ -1698,6 +1816,15 @@ static int qcom_spmi_regulator_probe(struct platform_device *pdev) | |||
| 1698 | if (ret) | 1816 | if (ret) |
| 1699 | continue; | 1817 | continue; |
| 1700 | 1818 | ||
| 1819 | if (saw_regmap && \ | ||
| 1820 | of_find_property(of_find_node_by_name(node, reg->name), \ | ||
| 1821 | "qcom,saw-leader", &lenp)) { | ||
| 1822 | spmi_saw_ops = *(vreg->desc.ops); | ||
| 1823 | spmi_saw_ops.set_voltage_sel = \ | ||
| 1824 | spmi_regulator_saw_set_voltage; | ||
| 1825 | vreg->desc.ops = &spmi_saw_ops; | ||
| 1826 | } | ||
| 1827 | |||
| 1701 | config.dev = dev; | 1828 | config.dev = dev; |
| 1702 | config.driver_data = vreg; | 1829 | config.driver_data = vreg; |
| 1703 | config.regmap = regmap; | 1830 | config.regmap = regmap; |
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c index 4836947e1521..b8443a360646 100644 --- a/drivers/regulator/s5m8767.c +++ b/drivers/regulator/s5m8767.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | #include <linux/err.h> | 14 | #include <linux/err.h> |
| 15 | #include <linux/of_gpio.h> | 15 | #include <linux/of_gpio.h> |
| 16 | #include <linux/gpio/consumer.h> | ||
| 16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 17 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
| 18 | #include <linux/regulator/driver.h> | 19 | #include <linux/regulator/driver.h> |
| @@ -459,15 +460,14 @@ static void s5m8767_regulator_config_ext_control(struct s5m8767_info *s5m8767, | |||
| 459 | return; | 460 | return; |
| 460 | } | 461 | } |
| 461 | 462 | ||
| 462 | if (!gpio_is_valid(rdata->ext_control_gpio)) { | 463 | if (!rdata->ext_control_gpiod) { |
| 463 | dev_warn(s5m8767->dev, | 464 | dev_warn(s5m8767->dev, |
| 464 | "ext-control for %s: GPIO not valid, ignoring\n", | 465 | "ext-control for %s: GPIO not valid, ignoring\n", |
| 465 | rdata->reg_node->name); | 466 | rdata->reg_node->name); |
| 466 | return; | 467 | return; |
| 467 | } | 468 | } |
| 468 | 469 | ||
| 469 | config->ena_gpio = rdata->ext_control_gpio; | 470 | config->ena_gpiod = rdata->ext_control_gpiod; |
| 470 | config->ena_gpio_flags = GPIOF_OUT_INIT_HIGH; | ||
| 471 | } | 471 | } |
| 472 | 472 | ||
| 473 | /* | 473 | /* |
| @@ -577,8 +577,14 @@ static int s5m8767_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
| 577 | continue; | 577 | continue; |
| 578 | } | 578 | } |
| 579 | 579 | ||
| 580 | rdata->ext_control_gpio = of_get_named_gpio(reg_np, | 580 | rdata->ext_control_gpiod = devm_gpiod_get_from_of_node(&pdev->dev, |
| 581 | "s5m8767,pmic-ext-control-gpios", 0); | 581 | reg_np, |
| 582 | "s5m8767,pmic-ext-control-gpios", | ||
| 583 | 0, | ||
| 584 | GPIOD_OUT_HIGH, | ||
| 585 | "s5m8767"); | ||
| 586 | if (IS_ERR(rdata->ext_control_gpiod)) | ||
| 587 | return PTR_ERR(rdata->ext_control_gpiod); | ||
| 582 | 588 | ||
| 583 | rdata->id = i; | 589 | rdata->id = i; |
| 584 | rdata->initdata = of_get_regulator_init_data( | 590 | rdata->initdata = of_get_regulator_init_data( |
| @@ -954,10 +960,8 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) | |||
| 954 | config.driver_data = s5m8767; | 960 | config.driver_data = s5m8767; |
| 955 | config.regmap = iodev->regmap_pmic; | 961 | config.regmap = iodev->regmap_pmic; |
| 956 | config.of_node = pdata->regulators[i].reg_node; | 962 | config.of_node = pdata->regulators[i].reg_node; |
| 957 | config.ena_gpio = -EINVAL; | 963 | config.ena_gpiod = NULL; |
| 958 | config.ena_gpio_flags = 0; | 964 | if (pdata->regulators[i].ext_control_gpiod) |
| 959 | config.ena_gpio_initialized = true; | ||
| 960 | if (gpio_is_valid(pdata->regulators[i].ext_control_gpio)) | ||
| 961 | s5m8767_regulator_config_ext_control(s5m8767, | 965 | s5m8767_regulator_config_ext_control(s5m8767, |
| 962 | &pdata->regulators[i], &config); | 966 | &pdata->regulators[i], &config); |
| 963 | 967 | ||
| @@ -970,7 +974,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev) | |||
| 970 | return ret; | 974 | return ret; |
| 971 | } | 975 | } |
| 972 | 976 | ||
| 973 | if (gpio_is_valid(pdata->regulators[i].ext_control_gpio)) { | 977 | if (pdata->regulators[i].ext_control_gpiod) { |
| 974 | ret = s5m8767_enable_ext_control(s5m8767, rdev); | 978 | ret = s5m8767_enable_ext_control(s5m8767, rdev); |
| 975 | if (ret < 0) { | 979 | if (ret < 0) { |
| 976 | dev_err(s5m8767->dev, | 980 | dev_err(s5m8767->dev, |
diff --git a/drivers/regulator/sy8106a-regulator.c b/drivers/regulator/sy8106a-regulator.c new file mode 100644 index 000000000000..65fbd1f0b612 --- /dev/null +++ b/drivers/regulator/sy8106a-regulator.c | |||
| @@ -0,0 +1,167 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0+ | ||
| 2 | // | ||
| 3 | // sy8106a-regulator.c - Regulator device driver for SY8106A | ||
| 4 | // | ||
| 5 | // Copyright (C) 2016 Ondřej Jirman <megous@megous.com> | ||
| 6 | // Copyright (c) 2017-2018 Icenowy Zheng <icenowy@aosc.io> | ||
| 7 | |||
| 8 | #include <linux/err.h> | ||
| 9 | #include <linux/i2c.h> | ||
| 10 | #include <linux/module.h> | ||
| 11 | #include <linux/regmap.h> | ||
| 12 | #include <linux/regulator/driver.h> | ||
| 13 | #include <linux/regulator/of_regulator.h> | ||
| 14 | |||
| 15 | #define SY8106A_REG_VOUT1_SEL 0x01 | ||
| 16 | #define SY8106A_REG_VOUT_COM 0x02 | ||
| 17 | #define SY8106A_REG_VOUT1_SEL_MASK 0x7f | ||
| 18 | #define SY8106A_DISABLE_REG BIT(0) | ||
| 19 | /* | ||
| 20 | * The I2C controlled voltage will only work when this bit is set; otherwise | ||
| 21 | * it will behave like a fixed regulator. | ||
| 22 | */ | ||
| 23 | #define SY8106A_GO_BIT BIT(7) | ||
| 24 | |||
| 25 | struct sy8106a { | ||
| 26 | struct regulator_dev *rdev; | ||
| 27 | struct regmap *regmap; | ||
| 28 | u32 fixed_voltage; | ||
| 29 | }; | ||
| 30 | |||
| 31 | static const struct regmap_config sy8106a_regmap_config = { | ||
| 32 | .reg_bits = 8, | ||
| 33 | .val_bits = 8, | ||
| 34 | }; | ||
| 35 | |||
| 36 | static const struct regulator_ops sy8106a_ops = { | ||
| 37 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | ||
| 38 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | ||
| 39 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
| 40 | .list_voltage = regulator_list_voltage_linear, | ||
| 41 | /* Enabling/disabling the regulator is not yet implemented */ | ||
| 42 | }; | ||
| 43 | |||
| 44 | /* Default limits measured in millivolts */ | ||
| 45 | #define SY8106A_MIN_MV 680 | ||
| 46 | #define SY8106A_MAX_MV 1950 | ||
| 47 | #define SY8106A_STEP_MV 10 | ||
| 48 | |||
| 49 | static const struct regulator_desc sy8106a_reg = { | ||
| 50 | .name = "SY8106A", | ||
| 51 | .id = 0, | ||
| 52 | .ops = &sy8106a_ops, | ||
| 53 | .type = REGULATOR_VOLTAGE, | ||
| 54 | .n_voltages = ((SY8106A_MAX_MV - SY8106A_MIN_MV) / SY8106A_STEP_MV) + 1, | ||
| 55 | .min_uV = (SY8106A_MIN_MV * 1000), | ||
| 56 | .uV_step = (SY8106A_STEP_MV * 1000), | ||
| 57 | .vsel_reg = SY8106A_REG_VOUT1_SEL, | ||
| 58 | .vsel_mask = SY8106A_REG_VOUT1_SEL_MASK, | ||
| 59 | /* | ||
| 60 | * This ramp_delay is a conservative default value which works on | ||
| 61 | * H3/H5 boards VDD-CPUX situations. | ||
| 62 | */ | ||
| 63 | .ramp_delay = 200, | ||
| 64 | .owner = THIS_MODULE, | ||
| 65 | }; | ||
| 66 | |||
| 67 | /* | ||
| 68 | * I2C driver interface functions | ||
| 69 | */ | ||
| 70 | static int sy8106a_i2c_probe(struct i2c_client *i2c, | ||
| 71 | const struct i2c_device_id *id) | ||
| 72 | { | ||
| 73 | struct sy8106a *chip; | ||
| 74 | struct device *dev = &i2c->dev; | ||
| 75 | struct regulator_dev *rdev = NULL; | ||
| 76 | struct regulator_config config = { }; | ||
| 77 | unsigned int reg, vsel; | ||
| 78 | int error; | ||
| 79 | |||
| 80 | chip = devm_kzalloc(&i2c->dev, sizeof(struct sy8106a), GFP_KERNEL); | ||
| 81 | if (!chip) | ||
| 82 | return -ENOMEM; | ||
| 83 | |||
| 84 | error = of_property_read_u32(dev->of_node, "silergy,fixed-microvolt", | ||
| 85 | &chip->fixed_voltage); | ||
| 86 | if (error) | ||
| 87 | return error; | ||
| 88 | |||
| 89 | if (chip->fixed_voltage < SY8106A_MIN_MV * 1000 || | ||
| 90 | chip->fixed_voltage > SY8106A_MAX_MV * 1000) | ||
| 91 | return -EINVAL; | ||
| 92 | |||
| 93 | chip->regmap = devm_regmap_init_i2c(i2c, &sy8106a_regmap_config); | ||
| 94 | if (IS_ERR(chip->regmap)) { | ||
| 95 | error = PTR_ERR(chip->regmap); | ||
| 96 | dev_err(dev, "Failed to allocate register map: %d\n", error); | ||
| 97 | return error; | ||
| 98 | } | ||
| 99 | |||
| 100 | config.dev = &i2c->dev; | ||
| 101 | config.regmap = chip->regmap; | ||
| 102 | config.driver_data = chip; | ||
| 103 | |||
| 104 | config.of_node = dev->of_node; | ||
| 105 | config.init_data = of_get_regulator_init_data(dev, dev->of_node, | ||
| 106 | &sy8106a_reg); | ||
| 107 | |||
| 108 | if (!config.init_data) | ||
| 109 | return -ENOMEM; | ||
| 110 | |||
| 111 | /* Ensure GO_BIT is enabled when probing */ | ||
| 112 | error = regmap_read(chip->regmap, SY8106A_REG_VOUT1_SEL, ®); | ||
| 113 | if (error) | ||
| 114 | return error; | ||
| 115 | |||
| 116 | if (!(reg & SY8106A_GO_BIT)) { | ||
| 117 | vsel = (chip->fixed_voltage / 1000 - SY8106A_MIN_MV) / | ||
| 118 | SY8106A_STEP_MV; | ||
| 119 | |||
| 120 | error = regmap_write(chip->regmap, SY8106A_REG_VOUT1_SEL, | ||
| 121 | vsel | SY8106A_GO_BIT); | ||
| 122 | if (error) | ||
| 123 | return error; | ||
| 124 | } | ||
| 125 | |||
| 126 | /* Probe regulator */ | ||
| 127 | rdev = devm_regulator_register(&i2c->dev, &sy8106a_reg, &config); | ||
| 128 | if (IS_ERR(rdev)) { | ||
| 129 | error = PTR_ERR(rdev); | ||
| 130 | dev_err(&i2c->dev, "Failed to register SY8106A regulator: %d\n", error); | ||
| 131 | return error; | ||
| 132 | } | ||
| 133 | |||
| 134 | chip->rdev = rdev; | ||
| 135 | |||
| 136 | i2c_set_clientdata(i2c, chip); | ||
| 137 | |||
| 138 | return 0; | ||
| 139 | } | ||
| 140 | |||
| 141 | static const struct of_device_id sy8106a_i2c_of_match[] = { | ||
| 142 | { .compatible = "silergy,sy8106a" }, | ||
| 143 | { }, | ||
| 144 | }; | ||
| 145 | MODULE_DEVICE_TABLE(of, sy8106a_i2c_of_match); | ||
| 146 | |||
| 147 | static const struct i2c_device_id sy8106a_i2c_id[] = { | ||
| 148 | { "sy8106a", 0 }, | ||
| 149 | { }, | ||
| 150 | }; | ||
| 151 | MODULE_DEVICE_TABLE(i2c, sy8106a_i2c_id); | ||
| 152 | |||
| 153 | static struct i2c_driver sy8106a_regulator_driver = { | ||
| 154 | .driver = { | ||
| 155 | .name = "sy8106a", | ||
| 156 | .of_match_table = of_match_ptr(sy8106a_i2c_of_match), | ||
| 157 | }, | ||
| 158 | .probe = sy8106a_i2c_probe, | ||
| 159 | .id_table = sy8106a_i2c_id, | ||
| 160 | }; | ||
| 161 | |||
| 162 | module_i2c_driver(sy8106a_regulator_driver); | ||
| 163 | |||
| 164 | MODULE_AUTHOR("Ondřej Jirman <megous@megous.com>"); | ||
| 165 | MODULE_AUTHOR("Icenowy Zheng <icenowy@aosc.io>"); | ||
| 166 | MODULE_DESCRIPTION("Regulator device driver for Silergy SY8106A"); | ||
| 167 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c index 395f35dc8cdb..2d398fa3b720 100644 --- a/drivers/regulator/tps65090-regulator.c +++ b/drivers/regulator/tps65090-regulator.c | |||
| @@ -19,8 +19,8 @@ | |||
| 19 | #include <linux/module.h> | 19 | #include <linux/module.h> |
| 20 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
| 21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
| 22 | #include <linux/gpio.h> | 22 | #include <linux/of.h> |
| 23 | #include <linux/of_gpio.h> | 23 | #include <linux/gpio/consumer.h> |
| 24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
| 25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
| 26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
| @@ -300,26 +300,6 @@ static int tps65090_regulator_disable_ext_control( | |||
| 300 | return tps65090_config_ext_control(ri, false); | 300 | return tps65090_config_ext_control(ri, false); |
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | static void tps65090_configure_regulator_config( | ||
| 304 | struct tps65090_regulator_plat_data *tps_pdata, | ||
| 305 | struct regulator_config *config) | ||
| 306 | { | ||
| 307 | if (gpio_is_valid(tps_pdata->gpio)) { | ||
| 308 | int gpio_flag = GPIOF_OUT_INIT_LOW; | ||
| 309 | |||
| 310 | if (tps_pdata->reg_init_data->constraints.always_on || | ||
| 311 | tps_pdata->reg_init_data->constraints.boot_on) | ||
| 312 | gpio_flag = GPIOF_OUT_INIT_HIGH; | ||
| 313 | |||
| 314 | config->ena_gpio = tps_pdata->gpio; | ||
| 315 | config->ena_gpio_initialized = true; | ||
| 316 | config->ena_gpio_flags = gpio_flag; | ||
| 317 | } else { | ||
| 318 | config->ena_gpio = -EINVAL; | ||
| 319 | config->ena_gpio_initialized = false; | ||
| 320 | } | ||
| 321 | } | ||
| 322 | |||
| 323 | #ifdef CONFIG_OF | 303 | #ifdef CONFIG_OF |
| 324 | static struct of_regulator_match tps65090_matches[] = { | 304 | static struct of_regulator_match tps65090_matches[] = { |
| 325 | { .name = "dcdc1", }, | 305 | { .name = "dcdc1", }, |
| @@ -385,9 +365,26 @@ static struct tps65090_platform_data *tps65090_parse_dt_reg_data( | |||
| 385 | rpdata->enable_ext_control = of_property_read_bool( | 365 | rpdata->enable_ext_control = of_property_read_bool( |
| 386 | tps65090_matches[idx].of_node, | 366 | tps65090_matches[idx].of_node, |
| 387 | "ti,enable-ext-control"); | 367 | "ti,enable-ext-control"); |
| 388 | if (rpdata->enable_ext_control) | 368 | if (rpdata->enable_ext_control) { |
| 389 | rpdata->gpio = of_get_named_gpio(np, | 369 | enum gpiod_flags gflags; |
| 390 | "dcdc-ext-control-gpios", 0); | 370 | |
| 371 | if (ri_data->constraints.always_on || | ||
| 372 | ri_data->constraints.boot_on) | ||
| 373 | gflags = GPIOD_OUT_HIGH; | ||
| 374 | else | ||
| 375 | gflags = GPIOD_OUT_LOW; | ||
| 376 | |||
| 377 | rpdata->gpiod = devm_gpiod_get_from_of_node(&pdev->dev, | ||
| 378 | tps65090_matches[idx].of_node, | ||
| 379 | "dcdc-ext-control-gpios", 0, | ||
| 380 | gflags, | ||
| 381 | "tps65090"); | ||
| 382 | if (IS_ERR(rpdata->gpiod)) | ||
| 383 | return ERR_CAST(rpdata->gpiod); | ||
| 384 | if (!rpdata->gpiod) | ||
| 385 | dev_err(&pdev->dev, | ||
| 386 | "could not find DCDC external control GPIO\n"); | ||
| 387 | } | ||
| 391 | 388 | ||
| 392 | if (of_property_read_u32(tps65090_matches[idx].of_node, | 389 | if (of_property_read_u32(tps65090_matches[idx].of_node, |
| 393 | "ti,overcurrent-wait", | 390 | "ti,overcurrent-wait", |
| @@ -455,8 +452,7 @@ static int tps65090_regulator_probe(struct platform_device *pdev) | |||
| 455 | */ | 452 | */ |
| 456 | if (tps_pdata && is_dcdc(num) && tps_pdata->reg_init_data) { | 453 | if (tps_pdata && is_dcdc(num) && tps_pdata->reg_init_data) { |
| 457 | if (tps_pdata->enable_ext_control) { | 454 | if (tps_pdata->enable_ext_control) { |
| 458 | tps65090_configure_regulator_config( | 455 | config.ena_gpiod = tps_pdata->gpiod; |
| 459 | tps_pdata, &config); | ||
| 460 | ri->desc->ops = &tps65090_ext_control_ops; | 456 | ri->desc->ops = &tps65090_ext_control_ops; |
| 461 | } else { | 457 | } else { |
| 462 | ret = tps65090_regulator_disable_ext_control( | 458 | ret = tps65090_regulator_disable_ext_control( |
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c index 9e9d22038017..ba3dae7b2d2d 100644 --- a/drivers/regulator/tps6586x-regulator.c +++ b/drivers/regulator/tps6586x-regulator.c | |||
| @@ -342,6 +342,7 @@ static struct tps6586x_regulator *find_regulator_info(int id, int version) | |||
| 342 | 342 | ||
| 343 | switch (version) { | 343 | switch (version) { |
| 344 | case TPS658623: | 344 | case TPS658623: |
| 345 | case TPS658624: | ||
| 345 | table = tps658623_regulator; | 346 | table = tps658623_regulator; |
| 346 | num = ARRAY_SIZE(tps658623_regulator); | 347 | num = ARRAY_SIZE(tps658623_regulator); |
| 347 | break; | 348 | break; |
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index a4456db5849d..884c7505ed91 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c | |||
| @@ -274,7 +274,7 @@ static inline unsigned int twl4030reg_map_mode(unsigned int mode) | |||
| 274 | case RES_STATE_SLEEP: | 274 | case RES_STATE_SLEEP: |
| 275 | return REGULATOR_MODE_STANDBY; | 275 | return REGULATOR_MODE_STANDBY; |
| 276 | default: | 276 | default: |
| 277 | return -EINVAL; | 277 | return REGULATOR_MODE_INVALID; |
| 278 | } | 278 | } |
| 279 | } | 279 | } |
| 280 | 280 | ||
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c index da9106bd2109..8ad11b074b49 100644 --- a/drivers/regulator/wm8350-regulator.c +++ b/drivers/regulator/wm8350-regulator.c | |||
| @@ -911,6 +911,7 @@ static unsigned int get_mode(int uA, const struct wm8350_dcdc_efficiency *eff) | |||
| 911 | while (eff[i].uA_load_min != -1) { | 911 | while (eff[i].uA_load_min != -1) { |
| 912 | if (uA >= eff[i].uA_load_min && uA <= eff[i].uA_load_max) | 912 | if (uA >= eff[i].uA_load_min && uA <= eff[i].uA_load_max) |
| 913 | return eff[i].mode; | 913 | return eff[i].mode; |
| 914 | i++; | ||
| 914 | } | 915 | } |
| 915 | return REGULATOR_MODE_NORMAL; | 916 | return REGULATOR_MODE_NORMAL; |
| 916 | } | 917 | } |
diff --git a/include/linux/mfd/bd9571mwv.h b/include/linux/mfd/bd9571mwv.h index f0708ba4cbba..eb05569f752b 100644 --- a/include/linux/mfd/bd9571mwv.h +++ b/include/linux/mfd/bd9571mwv.h | |||
| @@ -33,6 +33,11 @@ | |||
| 33 | #define BD9571MWV_I2C_MD2_E1_BIT_2 0x12 | 33 | #define BD9571MWV_I2C_MD2_E1_BIT_2 0x12 |
| 34 | 34 | ||
| 35 | #define BD9571MWV_BKUP_MODE_CNT 0x20 | 35 | #define BD9571MWV_BKUP_MODE_CNT 0x20 |
| 36 | #define BD9571MWV_BKUP_MODE_CNT_KEEPON_MASK GENMASK(3, 0) | ||
| 37 | #define BD9571MWV_BKUP_MODE_CNT_KEEPON_DDR0 BIT(0) | ||
| 38 | #define BD9571MWV_BKUP_MODE_CNT_KEEPON_DDR1 BIT(1) | ||
| 39 | #define BD9571MWV_BKUP_MODE_CNT_KEEPON_DDR0C BIT(2) | ||
| 40 | #define BD9571MWV_BKUP_MODE_CNT_KEEPON_DDR1C BIT(3) | ||
| 36 | #define BD9571MWV_BKUP_MODE_STATUS 0x21 | 41 | #define BD9571MWV_BKUP_MODE_STATUS 0x21 |
| 37 | #define BD9571MWV_BKUP_RECOVERY_CNT 0x22 | 42 | #define BD9571MWV_BKUP_RECOVERY_CNT 0x22 |
| 38 | #define BD9571MWV_BKUP_CTRL_TIM_CNT 0x23 | 43 | #define BD9571MWV_BKUP_CTRL_TIM_CNT 0x23 |
diff --git a/include/linux/mfd/lp8788.h b/include/linux/mfd/lp8788.h index 786bf6679a28..2010e0de3e34 100644 --- a/include/linux/mfd/lp8788.h +++ b/include/linux/mfd/lp8788.h | |||
| @@ -182,20 +182,6 @@ struct lp8788_buck2_dvs { | |||
| 182 | }; | 182 | }; |
| 183 | 183 | ||
| 184 | /* | 184 | /* |
| 185 | * struct lp8788_ldo_enable_pin | ||
| 186 | * | ||
| 187 | * Basically, all LDOs are enabled through the I2C commands. | ||
| 188 | * But ALDO 1 ~ 5, 7, DLDO 7, 9, 11 can be enabled by external gpio pins. | ||
| 189 | * | ||
| 190 | * @gpio : gpio number which is used for enabling ldos | ||
| 191 | * @init_state : initial gpio state (ex. GPIOF_OUT_INIT_LOW) | ||
| 192 | */ | ||
| 193 | struct lp8788_ldo_enable_pin { | ||
| 194 | int gpio; | ||
| 195 | int init_state; | ||
| 196 | }; | ||
| 197 | |||
| 198 | /* | ||
| 199 | * struct lp8788_chg_param | 185 | * struct lp8788_chg_param |
| 200 | * @addr : charging control register address (range : 0x11 ~ 0x1C) | 186 | * @addr : charging control register address (range : 0x11 ~ 0x1C) |
| 201 | * @val : charging parameter value | 187 | * @val : charging parameter value |
| @@ -288,7 +274,6 @@ struct lp8788_vib_platform_data { | |||
| 288 | * @aldo_data : regulator initial data for analog ldo | 274 | * @aldo_data : regulator initial data for analog ldo |
| 289 | * @buck1_dvs : gpio configurations for buck1 dvs | 275 | * @buck1_dvs : gpio configurations for buck1 dvs |
| 290 | * @buck2_dvs : gpio configurations for buck2 dvs | 276 | * @buck2_dvs : gpio configurations for buck2 dvs |
| 291 | * @ldo_pin : gpio configurations for enabling LDOs | ||
| 292 | * @chg_pdata : platform data for charger driver | 277 | * @chg_pdata : platform data for charger driver |
| 293 | * @alarm_sel : rtc alarm selection (1 or 2) | 278 | * @alarm_sel : rtc alarm selection (1 or 2) |
| 294 | * @bl_pdata : configurable data for backlight driver | 279 | * @bl_pdata : configurable data for backlight driver |
| @@ -306,7 +291,6 @@ struct lp8788_platform_data { | |||
| 306 | struct regulator_init_data *aldo_data[LP8788_NUM_ALDOS]; | 291 | struct regulator_init_data *aldo_data[LP8788_NUM_ALDOS]; |
| 307 | struct lp8788_buck1_dvs *buck1_dvs; | 292 | struct lp8788_buck1_dvs *buck1_dvs; |
| 308 | struct lp8788_buck2_dvs *buck2_dvs; | 293 | struct lp8788_buck2_dvs *buck2_dvs; |
| 309 | struct lp8788_ldo_enable_pin *ldo_pin[EN_LDOS_MAX]; | ||
| 310 | 294 | ||
| 311 | /* charger */ | 295 | /* charger */ |
| 312 | struct lp8788_charger_platform_data *chg_pdata; | 296 | struct lp8788_charger_platform_data *chg_pdata; |
diff --git a/include/linux/mfd/samsung/core.h b/include/linux/mfd/samsung/core.h index 5a23dd4df432..28f4ae76271d 100644 --- a/include/linux/mfd/samsung/core.h +++ b/include/linux/mfd/samsung/core.h | |||
| @@ -39,6 +39,8 @@ | |||
| 39 | #define STEP_12_5_MV 12500 | 39 | #define STEP_12_5_MV 12500 |
| 40 | #define STEP_6_25_MV 6250 | 40 | #define STEP_6_25_MV 6250 |
| 41 | 41 | ||
| 42 | struct gpio_desc; | ||
| 43 | |||
| 42 | enum sec_device_type { | 44 | enum sec_device_type { |
| 43 | S5M8751X, | 45 | S5M8751X, |
| 44 | S5M8763X, | 46 | S5M8763X, |
| @@ -151,7 +153,7 @@ struct sec_regulator_data { | |||
| 151 | int id; | 153 | int id; |
| 152 | struct regulator_init_data *initdata; | 154 | struct regulator_init_data *initdata; |
| 153 | struct device_node *reg_node; | 155 | struct device_node *reg_node; |
| 154 | int ext_control_gpio; | 156 | struct gpio_desc *ext_control_gpiod; |
| 155 | }; | 157 | }; |
| 156 | 158 | ||
| 157 | /* | 159 | /* |
diff --git a/include/linux/mfd/tps65090.h b/include/linux/mfd/tps65090.h index 67d144b3b8f9..f05bf4a146e2 100644 --- a/include/linux/mfd/tps65090.h +++ b/include/linux/mfd/tps65090.h | |||
| @@ -83,6 +83,8 @@ enum { | |||
| 83 | #define TPS65090_MAX_REG TPS65090_REG_AD_OUT2 | 83 | #define TPS65090_MAX_REG TPS65090_REG_AD_OUT2 |
| 84 | #define TPS65090_NUM_REGS (TPS65090_MAX_REG + 1) | 84 | #define TPS65090_NUM_REGS (TPS65090_MAX_REG + 1) |
| 85 | 85 | ||
| 86 | struct gpio_desc; | ||
| 87 | |||
| 86 | struct tps65090 { | 88 | struct tps65090 { |
| 87 | struct device *dev; | 89 | struct device *dev; |
| 88 | struct regmap *rmap; | 90 | struct regmap *rmap; |
| @@ -95,8 +97,8 @@ struct tps65090 { | |||
| 95 | * @reg_init_data: The regulator init data. | 97 | * @reg_init_data: The regulator init data. |
| 96 | * @enable_ext_control: Enable extrenal control or not. Only available for | 98 | * @enable_ext_control: Enable extrenal control or not. Only available for |
| 97 | * DCDC1, DCDC2 and DCDC3. | 99 | * DCDC1, DCDC2 and DCDC3. |
| 98 | * @gpio: Gpio number if external control is enabled and controlled through | 100 | * @gpiod: Gpio descriptor if external control is enabled and controlled through |
| 99 | * gpio. | 101 | * gpio |
| 100 | * @overcurrent_wait_valid: True if the overcurrent_wait should be applied. | 102 | * @overcurrent_wait_valid: True if the overcurrent_wait should be applied. |
| 101 | * @overcurrent_wait: Value to set as the overcurrent wait time. This is the | 103 | * @overcurrent_wait: Value to set as the overcurrent wait time. This is the |
| 102 | * actual bitfield value, not a time in ms (valid value are 0 - 3). | 104 | * actual bitfield value, not a time in ms (valid value are 0 - 3). |
| @@ -104,7 +106,7 @@ struct tps65090 { | |||
| 104 | struct tps65090_regulator_plat_data { | 106 | struct tps65090_regulator_plat_data { |
| 105 | struct regulator_init_data *reg_init_data; | 107 | struct regulator_init_data *reg_init_data; |
| 106 | bool enable_ext_control; | 108 | bool enable_ext_control; |
| 107 | int gpio; | 109 | struct gpio_desc *gpiod; |
| 108 | bool overcurrent_wait_valid; | 110 | bool overcurrent_wait_valid; |
| 109 | int overcurrent_wait; | 111 | int overcurrent_wait; |
| 110 | }; | 112 | }; |
diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h index 2fe68e481230..b19c2801a30e 100644 --- a/include/linux/mfd/tps6586x.h +++ b/include/linux/mfd/tps6586x.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #define TPS658621A 0x15 | 18 | #define TPS658621A 0x15 |
| 19 | #define TPS658621CD 0x2c | 19 | #define TPS658621CD 0x2c |
| 20 | #define TPS658623 0x1b | 20 | #define TPS658623 0x1b |
| 21 | #define TPS658624 0x0a | ||
| 21 | #define TPS658640 0x01 | 22 | #define TPS658640 0x01 |
| 22 | #define TPS658640v2 0x02 | 23 | #define TPS658640v2 0x02 |
| 23 | #define TPS658643 0x03 | 24 | #define TPS658643 0x03 |
diff --git a/include/linux/regulator/ab8500.h b/include/linux/regulator/ab8500.h index d8ecefaf63ca..6d46f962685d 100644 --- a/include/linux/regulator/ab8500.h +++ b/include/linux/regulator/ab8500.h | |||
| @@ -49,47 +49,7 @@ enum ab8505_regulator_id { | |||
| 49 | AB8505_NUM_REGULATORS, | 49 | AB8505_NUM_REGULATORS, |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | /* AB9540 regulators */ | 52 | /* AB8500 and AB8505 register initialization */ |
| 53 | enum ab9540_regulator_id { | ||
| 54 | AB9540_LDO_AUX1, | ||
| 55 | AB9540_LDO_AUX2, | ||
| 56 | AB9540_LDO_AUX3, | ||
| 57 | AB9540_LDO_AUX4, | ||
| 58 | AB9540_LDO_INTCORE, | ||
| 59 | AB9540_LDO_TVOUT, | ||
| 60 | AB9540_LDO_USB, | ||
| 61 | AB9540_LDO_AUDIO, | ||
| 62 | AB9540_LDO_ANAMIC1, | ||
| 63 | AB9540_LDO_ANAMIC2, | ||
| 64 | AB9540_LDO_DMIC, | ||
| 65 | AB9540_LDO_ANA, | ||
| 66 | AB9540_SYSCLKREQ_2, | ||
| 67 | AB9540_SYSCLKREQ_4, | ||
| 68 | AB9540_NUM_REGULATORS, | ||
| 69 | }; | ||
| 70 | |||
| 71 | /* AB8540 regulators */ | ||
| 72 | enum ab8540_regulator_id { | ||
| 73 | AB8540_LDO_AUX1, | ||
| 74 | AB8540_LDO_AUX2, | ||
| 75 | AB8540_LDO_AUX3, | ||
| 76 | AB8540_LDO_AUX4, | ||
| 77 | AB8540_LDO_AUX5, | ||
| 78 | AB8540_LDO_AUX6, | ||
| 79 | AB8540_LDO_INTCORE, | ||
| 80 | AB8540_LDO_TVOUT, | ||
| 81 | AB8540_LDO_AUDIO, | ||
| 82 | AB8540_LDO_ANAMIC1, | ||
| 83 | AB8540_LDO_ANAMIC2, | ||
| 84 | AB8540_LDO_DMIC, | ||
| 85 | AB8540_LDO_ANA, | ||
| 86 | AB8540_LDO_SDIO, | ||
| 87 | AB8540_SYSCLKREQ_2, | ||
| 88 | AB8540_SYSCLKREQ_4, | ||
| 89 | AB8540_NUM_REGULATORS, | ||
| 90 | }; | ||
| 91 | |||
| 92 | /* AB8500, AB8505, and AB9540 register initialization */ | ||
| 93 | struct ab8500_regulator_reg_init { | 53 | struct ab8500_regulator_reg_init { |
| 94 | int id; | 54 | int id; |
| 95 | u8 mask; | 55 | u8 mask; |
| @@ -185,121 +145,6 @@ enum ab8505_regulator_reg { | |||
| 185 | AB8505_NUM_REGULATOR_REGISTERS, | 145 | AB8505_NUM_REGULATOR_REGISTERS, |
| 186 | }; | 146 | }; |
| 187 | 147 | ||
| 188 | /* AB9540 registers */ | ||
| 189 | enum ab9540_regulator_reg { | ||
| 190 | AB9540_REGUREQUESTCTRL1, | ||
| 191 | AB9540_REGUREQUESTCTRL2, | ||
| 192 | AB9540_REGUREQUESTCTRL3, | ||
| 193 | AB9540_REGUREQUESTCTRL4, | ||
| 194 | AB9540_REGUSYSCLKREQ1HPVALID1, | ||
| 195 | AB9540_REGUSYSCLKREQ1HPVALID2, | ||
| 196 | AB9540_REGUHWHPREQ1VALID1, | ||
| 197 | AB9540_REGUHWHPREQ1VALID2, | ||
| 198 | AB9540_REGUHWHPREQ2VALID1, | ||
| 199 | AB9540_REGUHWHPREQ2VALID2, | ||
| 200 | AB9540_REGUSWHPREQVALID1, | ||
| 201 | AB9540_REGUSWHPREQVALID2, | ||
| 202 | AB9540_REGUSYSCLKREQVALID1, | ||
| 203 | AB9540_REGUSYSCLKREQVALID2, | ||
| 204 | AB9540_REGUVAUX4REQVALID, | ||
| 205 | AB9540_REGUMISC1, | ||
| 206 | AB9540_VAUDIOSUPPLY, | ||
| 207 | AB9540_REGUCTRL1VAMIC, | ||
| 208 | AB9540_VSMPS1REGU, | ||
| 209 | AB9540_VSMPS2REGU, | ||
| 210 | AB9540_VSMPS3REGU, /* NOTE! PRCMU register */ | ||
| 211 | AB9540_VPLLVANAREGU, | ||
| 212 | AB9540_EXTSUPPLYREGU, | ||
| 213 | AB9540_VAUX12REGU, | ||
| 214 | AB9540_VRF1VAUX3REGU, | ||
| 215 | AB9540_VSMPS1SEL1, | ||
| 216 | AB9540_VSMPS1SEL2, | ||
| 217 | AB9540_VSMPS1SEL3, | ||
| 218 | AB9540_VSMPS2SEL1, | ||
| 219 | AB9540_VSMPS2SEL2, | ||
| 220 | AB9540_VSMPS2SEL3, | ||
| 221 | AB9540_VSMPS3SEL1, /* NOTE! PRCMU register */ | ||
| 222 | AB9540_VSMPS3SEL2, /* NOTE! PRCMU register */ | ||
| 223 | AB9540_VAUX1SEL, | ||
| 224 | AB9540_VAUX2SEL, | ||
| 225 | AB9540_VRF1VAUX3SEL, | ||
| 226 | AB9540_REGUCTRL2SPARE, | ||
| 227 | AB9540_VAUX4REQCTRL, | ||
| 228 | AB9540_VAUX4REGU, | ||
| 229 | AB9540_VAUX4SEL, | ||
| 230 | AB9540_REGUCTRLDISCH, | ||
| 231 | AB9540_REGUCTRLDISCH2, | ||
| 232 | AB9540_REGUCTRLDISCH3, | ||
| 233 | AB9540_NUM_REGULATOR_REGISTERS, | ||
| 234 | }; | ||
| 235 | |||
| 236 | /* AB8540 registers */ | ||
| 237 | enum ab8540_regulator_reg { | ||
| 238 | AB8540_REGUREQUESTCTRL1, | ||
| 239 | AB8540_REGUREQUESTCTRL2, | ||
| 240 | AB8540_REGUREQUESTCTRL3, | ||
| 241 | AB8540_REGUREQUESTCTRL4, | ||
| 242 | AB8540_REGUSYSCLKREQ1HPVALID1, | ||
| 243 | AB8540_REGUSYSCLKREQ1HPVALID2, | ||
| 244 | AB8540_REGUHWHPREQ1VALID1, | ||
| 245 | AB8540_REGUHWHPREQ1VALID2, | ||
| 246 | AB8540_REGUHWHPREQ2VALID1, | ||
| 247 | AB8540_REGUHWHPREQ2VALID2, | ||
| 248 | AB8540_REGUSWHPREQVALID1, | ||
| 249 | AB8540_REGUSWHPREQVALID2, | ||
| 250 | AB8540_REGUSYSCLKREQVALID1, | ||
| 251 | AB8540_REGUSYSCLKREQVALID2, | ||
| 252 | AB8540_REGUVAUX4REQVALID, | ||
| 253 | AB8540_REGUVAUX5REQVALID, | ||
| 254 | AB8540_REGUVAUX6REQVALID, | ||
| 255 | AB8540_REGUVCLKBREQVALID, | ||
| 256 | AB8540_REGUVRF1REQVALID, | ||
| 257 | AB8540_REGUMISC1, | ||
| 258 | AB8540_VAUDIOSUPPLY, | ||
| 259 | AB8540_REGUCTRL1VAMIC, | ||
| 260 | AB8540_VHSIC, | ||
| 261 | AB8540_VSDIO, | ||
| 262 | AB8540_VSMPS1REGU, | ||
| 263 | AB8540_VSMPS2REGU, | ||
| 264 | AB8540_VSMPS3REGU, | ||
| 265 | AB8540_VPLLVANAREGU, | ||
| 266 | AB8540_EXTSUPPLYREGU, | ||
| 267 | AB8540_VAUX12REGU, | ||
| 268 | AB8540_VRF1VAUX3REGU, | ||
| 269 | AB8540_VSMPS1SEL1, | ||
| 270 | AB8540_VSMPS1SEL2, | ||
| 271 | AB8540_VSMPS1SEL3, | ||
| 272 | AB8540_VSMPS2SEL1, | ||
| 273 | AB8540_VSMPS2SEL2, | ||
| 274 | AB8540_VSMPS2SEL3, | ||
| 275 | AB8540_VSMPS3SEL1, | ||
| 276 | AB8540_VSMPS3SEL2, | ||
| 277 | AB8540_VAUX1SEL, | ||
| 278 | AB8540_VAUX2SEL, | ||
| 279 | AB8540_VRF1VAUX3SEL, | ||
| 280 | AB8540_REGUCTRL2SPARE, | ||
| 281 | AB8540_VAUX4REQCTRL, | ||
| 282 | AB8540_VAUX4REGU, | ||
| 283 | AB8540_VAUX4SEL, | ||
| 284 | AB8540_VAUX5REQCTRL, | ||
| 285 | AB8540_VAUX5REGU, | ||
| 286 | AB8540_VAUX5SEL, | ||
| 287 | AB8540_VAUX6REQCTRL, | ||
| 288 | AB8540_VAUX6REGU, | ||
| 289 | AB8540_VAUX6SEL, | ||
| 290 | AB8540_VCLKBREQCTRL, | ||
| 291 | AB8540_VCLKBREGU, | ||
| 292 | AB8540_VCLKBSEL, | ||
| 293 | AB8540_VRF1REQCTRL, | ||
| 294 | AB8540_REGUCTRLDISCH, | ||
| 295 | AB8540_REGUCTRLDISCH2, | ||
| 296 | AB8540_REGUCTRLDISCH3, | ||
| 297 | AB8540_REGUCTRLDISCH4, | ||
| 298 | AB8540_VSIMSYSCLKCTRL, | ||
| 299 | AB8540_VANAVPLLSEL, | ||
| 300 | AB8540_NUM_REGULATOR_REGISTERS, | ||
| 301 | }; | ||
| 302 | |||
| 303 | /* AB8500 external regulators */ | 148 | /* AB8500 external regulators */ |
| 304 | struct ab8500_ext_regulator_cfg { | 149 | struct ab8500_ext_regulator_cfg { |
| 305 | bool hwreq; /* requires hw mode or high power mode */ | 150 | bool hwreq; /* requires hw mode or high power mode */ |
diff --git a/include/linux/regulator/arizona-ldo1.h b/include/linux/regulator/arizona-ldo1.h index c685f1277c63..fe74ab9990e6 100644 --- a/include/linux/regulator/arizona-ldo1.h +++ b/include/linux/regulator/arizona-ldo1.h | |||
| @@ -14,9 +14,6 @@ | |||
| 14 | struct regulator_init_data; | 14 | struct regulator_init_data; |
| 15 | 15 | ||
| 16 | struct arizona_ldo1_pdata { | 16 | struct arizona_ldo1_pdata { |
| 17 | /** GPIO controlling LDOENA, if any */ | ||
| 18 | int ldoena; | ||
| 19 | |||
| 20 | /** Regulator configuration for LDO1 */ | 17 | /** Regulator configuration for LDO1 */ |
| 21 | const struct regulator_init_data *init_data; | 18 | const struct regulator_init_data *init_data; |
| 22 | }; | 19 | }; |
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index df176d7c2b87..25602afd4844 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
| @@ -80,6 +80,7 @@ struct regmap; | |||
| 80 | * These modes can be OR'ed together to make up a mask of valid register modes. | 80 | * These modes can be OR'ed together to make up a mask of valid register modes. |
| 81 | */ | 81 | */ |
| 82 | 82 | ||
| 83 | #define REGULATOR_MODE_INVALID 0x0 | ||
| 83 | #define REGULATOR_MODE_FAST 0x1 | 84 | #define REGULATOR_MODE_FAST 0x1 |
| 84 | #define REGULATOR_MODE_NORMAL 0x2 | 85 | #define REGULATOR_MODE_NORMAL 0x2 |
| 85 | #define REGULATOR_MODE_IDLE 0x4 | 86 | #define REGULATOR_MODE_IDLE 0x4 |
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 4fc96cb8e5d7..fc2dc8df476f 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
| @@ -15,6 +15,8 @@ | |||
| 15 | #ifndef __LINUX_REGULATOR_DRIVER_H_ | 15 | #ifndef __LINUX_REGULATOR_DRIVER_H_ |
| 16 | #define __LINUX_REGULATOR_DRIVER_H_ | 16 | #define __LINUX_REGULATOR_DRIVER_H_ |
| 17 | 17 | ||
| 18 | #define MAX_COUPLED 4 | ||
| 19 | |||
| 18 | #include <linux/device.h> | 20 | #include <linux/device.h> |
| 19 | #include <linux/notifier.h> | 21 | #include <linux/notifier.h> |
| 20 | #include <linux/regulator/consumer.h> | 22 | #include <linux/regulator/consumer.h> |
| @@ -81,9 +83,12 @@ struct regulator_linear_range { | |||
| 81 | * @set_voltage_sel: Set the voltage for the regulator using the specified | 83 | * @set_voltage_sel: Set the voltage for the regulator using the specified |
| 82 | * selector. | 84 | * selector. |
| 83 | * @map_voltage: Convert a voltage into a selector | 85 | * @map_voltage: Convert a voltage into a selector |
| 84 | * @get_voltage: Return the currently configured voltage for the regulator. | 86 | * @get_voltage: Return the currently configured voltage for the regulator; |
| 87 | * return -ENOTRECOVERABLE if regulator can't be read at | ||
| 88 | * bootup and hasn't been set yet. | ||
| 85 | * @get_voltage_sel: Return the currently configured voltage selector for the | 89 | * @get_voltage_sel: Return the currently configured voltage selector for the |
| 86 | * regulator. | 90 | * regulator; return -ENOTRECOVERABLE if regulator can't |
| 91 | * be read at bootup and hasn't been set yet. | ||
| 87 | * @list_voltage: Return one of the supported voltages, in microvolts; zero | 92 | * @list_voltage: Return one of the supported voltages, in microvolts; zero |
| 88 | * if the selector indicates a voltage that is unusable on this system; | 93 | * if the selector indicates a voltage that is unusable on this system; |
| 89 | * or negative errno. Selectors range from zero to one less than | 94 | * or negative errno. Selectors range from zero to one less than |
| @@ -407,6 +412,20 @@ struct regulator_config { | |||
| 407 | }; | 412 | }; |
| 408 | 413 | ||
| 409 | /* | 414 | /* |
| 415 | * struct coupling_desc | ||
| 416 | * | ||
| 417 | * Describes coupling of regulators. Each regulator should have | ||
| 418 | * at least a pointer to itself in coupled_rdevs array. | ||
| 419 | * When a new coupled regulator is resolved, n_resolved is | ||
| 420 | * incremented. | ||
| 421 | */ | ||
| 422 | struct coupling_desc { | ||
| 423 | struct regulator_dev *coupled_rdevs[MAX_COUPLED]; | ||
| 424 | int n_resolved; | ||
| 425 | int n_coupled; | ||
| 426 | }; | ||
| 427 | |||
| 428 | /* | ||
| 410 | * struct regulator_dev | 429 | * struct regulator_dev |
| 411 | * | 430 | * |
| 412 | * Voltage / Current regulator class device. One for each | 431 | * Voltage / Current regulator class device. One for each |
| @@ -429,8 +448,12 @@ struct regulator_dev { | |||
| 429 | /* lists we own */ | 448 | /* lists we own */ |
| 430 | struct list_head consumer_list; /* consumers we supply */ | 449 | struct list_head consumer_list; /* consumers we supply */ |
| 431 | 450 | ||
| 451 | struct coupling_desc coupling_desc; | ||
| 452 | |||
| 432 | struct blocking_notifier_head notifier; | 453 | struct blocking_notifier_head notifier; |
| 433 | struct mutex mutex; /* consumer lock */ | 454 | struct mutex mutex; /* consumer lock */ |
| 455 | struct task_struct *mutex_owner; | ||
| 456 | int ref_cnt; | ||
| 434 | struct module *owner; | 457 | struct module *owner; |
| 435 | struct device dev; | 458 | struct device dev; |
| 436 | struct regulation_constraints *constraints; | 459 | struct regulation_constraints *constraints; |
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index 93a04893c739..3468703d663a 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
| @@ -103,6 +103,7 @@ struct regulator_state { | |||
| 103 | * @ilim_uA: Maximum input current. | 103 | * @ilim_uA: Maximum input current. |
| 104 | * @system_load: Load that isn't captured by any consumer requests. | 104 | * @system_load: Load that isn't captured by any consumer requests. |
| 105 | * | 105 | * |
| 106 | * @max_spread: Max possible spread between coupled regulators | ||
| 106 | * @valid_modes_mask: Mask of modes which may be configured by consumers. | 107 | * @valid_modes_mask: Mask of modes which may be configured by consumers. |
| 107 | * @valid_ops_mask: Operations which may be performed by consumers. | 108 | * @valid_ops_mask: Operations which may be performed by consumers. |
| 108 | * | 109 | * |
| @@ -154,6 +155,9 @@ struct regulation_constraints { | |||
| 154 | 155 | ||
| 155 | int system_load; | 156 | int system_load; |
| 156 | 157 | ||
| 158 | /* used for coupled regulators */ | ||
| 159 | int max_spread; | ||
| 160 | |||
| 157 | /* valid regulator operating modes for this machine */ | 161 | /* valid regulator operating modes for this machine */ |
| 158 | unsigned int valid_modes_mask; | 162 | unsigned int valid_modes_mask; |
| 159 | 163 | ||
diff --git a/include/linux/regulator/max8952.h b/include/linux/regulator/max8952.h index 4dbb63a1d4ab..686c42c041b5 100644 --- a/include/linux/regulator/max8952.h +++ b/include/linux/regulator/max8952.h | |||
| @@ -120,7 +120,6 @@ enum { | |||
| 120 | struct max8952_platform_data { | 120 | struct max8952_platform_data { |
| 121 | int gpio_vid0; | 121 | int gpio_vid0; |
| 122 | int gpio_vid1; | 122 | int gpio_vid1; |
| 123 | int gpio_en; | ||
| 124 | 123 | ||
| 125 | u32 default_mode; | 124 | u32 default_mode; |
| 126 | u32 dvs_mode[MAX8952_NUM_DVS_MODE]; /* MAX8952_DVS_MODEx_XXXXmV */ | 125 | u32 dvs_mode[MAX8952_NUM_DVS_MODE]; /* MAX8952_DVS_MODEx_XXXXmV */ |
