diff options
43 files changed, 1357 insertions, 215 deletions
diff --git a/Documentation/devicetree/bindings/mfd/axp20x.txt b/Documentation/devicetree/bindings/mfd/axp20x.txt index d20b1034e967..585a95546288 100644 --- a/Documentation/devicetree/bindings/mfd/axp20x.txt +++ b/Documentation/devicetree/bindings/mfd/axp20x.txt | |||
| @@ -22,6 +22,11 @@ Optional properties: | |||
| 22 | AXP152/20X: range: 750-1875, Default: 1.5 MHz | 22 | AXP152/20X: range: 750-1875, Default: 1.5 MHz |
| 23 | AXP22X/80X: range: 1800-4050, Default: 3 MHz | 23 | AXP22X/80X: range: 1800-4050, Default: 3 MHz |
| 24 | 24 | ||
| 25 | - x-powers,drive-vbus-en: axp221 / axp223 only boolean, set this when the | ||
| 26 | N_VBUSEN pin is used as an output pin to control an external | ||
| 27 | regulator to drive the OTG VBus, rather then as an input pin | ||
| 28 | which signals whether the board is driving OTG VBus or not. | ||
| 29 | |||
| 25 | - <input>-supply: a phandle to the regulator supply node. May be omitted if | 30 | - <input>-supply: a phandle to the regulator supply node. May be omitted if |
| 26 | inputs are unregulated, such as using the IPSOUT output | 31 | inputs are unregulated, such as using the IPSOUT output |
| 27 | from the PMIC. | 32 | from the PMIC. |
| @@ -79,6 +84,7 @@ ELDO3 : LDO : eldoin-supply : shared supply | |||
| 79 | LDO_IO0 : LDO : ips-supply : GPIO 0 | 84 | LDO_IO0 : LDO : ips-supply : GPIO 0 |
| 80 | LDO_IO1 : LDO : ips-supply : GPIO 1 | 85 | LDO_IO1 : LDO : ips-supply : GPIO 1 |
| 81 | RTC_LDO : LDO : ips-supply : always on | 86 | RTC_LDO : LDO : ips-supply : always on |
| 87 | DRIVEVBUS : Enable output : drivevbus-supply : external regulator | ||
| 82 | 88 | ||
| 83 | AXP809 regulators, type, and corresponding input supply names: | 89 | AXP809 regulators, type, and corresponding input supply names: |
| 84 | 90 | ||
diff --git a/Documentation/devicetree/bindings/mfd/rn5t618.txt b/Documentation/devicetree/bindings/mfd/rn5t618.txt index 937785a3eddc..9e6770b105c9 100644 --- a/Documentation/devicetree/bindings/mfd/rn5t618.txt +++ b/Documentation/devicetree/bindings/mfd/rn5t618.txt | |||
| @@ -1,18 +1,21 @@ | |||
| 1 | * Ricoh RN5T618 PMIC | 1 | * Ricoh RN5T567/RN5T618 PMIC |
| 2 | 2 | ||
| 3 | Ricoh RN5T618 is a power management IC which integrates 3 step-down | 3 | Ricoh RN5T567/RN5T618 is a power management IC family which integrates |
| 4 | DCDC converters, 7 low-dropout regulators, a Li-ion battery charger, | 4 | 3 to 4 step-down DCDC converters, 7 low-dropout regulators, GPIOs and |
| 5 | fuel gauge, ADC, GPIOs and a watchdog timer. It can be controlled | 5 | a watchdog timer. The RN5T618 provides additionally a Li-ion battery |
| 6 | through a I2C interface. | 6 | charger, fuel gauge and an ADC. It can be controlled through an I2C |
| 7 | interface. | ||
| 7 | 8 | ||
| 8 | Required properties: | 9 | Required properties: |
| 9 | - compatible: should be "ricoh,rn5t618" | 10 | - compatible: must be one of |
| 11 | "ricoh,rn5t567" | ||
| 12 | "ricoh,rn5t618" | ||
| 10 | - reg: the I2C slave address of the device | 13 | - reg: the I2C slave address of the device |
| 11 | 14 | ||
| 12 | Sub-nodes: | 15 | Sub-nodes: |
| 13 | - regulators: the node is required if the regulator functionality is | 16 | - regulators: the node is required if the regulator functionality is |
| 14 | needed. The valid regulator names are: DCDC1, DCDC2, DCDC3, LDO1, | 17 | needed. The valid regulator names are: DCDC1, DCDC2, DCDC3, DCDC4 |
| 15 | LDO2, LDO3, LDO4, LDO5, LDORTC1 and LDORTC2. | 18 | (RN5T567), LDO1, LDO2, LDO3, LDO4, LDO5, LDORTC1 and LDORTC2. |
| 16 | The common bindings for each individual regulator can be found in: | 19 | The common bindings for each individual regulator can be found in: |
| 17 | Documentation/devicetree/bindings/regulator/regulator.txt | 20 | Documentation/devicetree/bindings/regulator/regulator.txt |
| 18 | 21 | ||
diff --git a/Documentation/devicetree/bindings/regulator/da9210.txt b/Documentation/devicetree/bindings/regulator/da9210.txt index 7aa9b1fa6b21..58065ca9e3b4 100644 --- a/Documentation/devicetree/bindings/regulator/da9210.txt +++ b/Documentation/devicetree/bindings/regulator/da9210.txt | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | * Dialog Semiconductor DA9210 Voltage Regulator | 1 | * Dialog Semiconductor DA9210 Multi-phase 12A DCDC BUCK Converter |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | 4 | ||
| @@ -18,8 +18,12 @@ Example: | |||
| 18 | compatible = "dlg,da9210"; | 18 | compatible = "dlg,da9210"; |
| 19 | reg = <0x68>; | 19 | reg = <0x68>; |
| 20 | 20 | ||
| 21 | regulator-min-microvolt = <900000>; | 21 | interrupt-parent = <...>; |
| 22 | regulator-max-microvolt = <1000000>; | 22 | interrupts = <...>; |
| 23 | |||
| 24 | regulator-min-microvolt = <300000>; | ||
| 25 | regulator-max-microvolt = <1570000>; | ||
| 26 | regulator-min-microamp = <1600000>; | ||
| 27 | regulator-max-microamp = <4600000>; | ||
| 23 | regulator-boot-on; | 28 | regulator-boot-on; |
| 24 | regulator-always-on; | ||
| 25 | }; | 29 | }; |
diff --git a/Documentation/devicetree/bindings/regulator/da9211.txt b/Documentation/devicetree/bindings/regulator/da9211.txt index c620493e8dbe..0f2a6f8fcafd 100644 --- a/Documentation/devicetree/bindings/regulator/da9211.txt +++ b/Documentation/devicetree/bindings/regulator/da9211.txt | |||
| @@ -1,7 +1,8 @@ | |||
| 1 | * Dialog Semiconductor DA9211/DA9213/DA9215 Voltage Regulator | 1 | * Dialog Semiconductor DA9211/DA9212/DA9213/DA9214/DA9215 Voltage Regulator |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible: "dlg,da9211" or "dlg,da9213" or "dlg,da9215" | 4 | - compatible: "dlg,da9211" or "dlg,da9212" or "dlg,da9213" |
| 5 | or "dlg,da9214" or "dlg,da9215" | ||
| 5 | - reg: I2C slave address, usually 0x68. | 6 | - reg: I2C slave address, usually 0x68. |
| 6 | - interrupts: the interrupt outputs of the controller | 7 | - interrupts: the interrupt outputs of the controller |
| 7 | - regulators: A node that houses a sub-node for each regulator within the | 8 | - regulators: A node that houses a sub-node for each regulator within the |
| @@ -30,6 +31,25 @@ Example 1) DA9211 | |||
| 30 | regulator-max-microamp = <5000000>; | 31 | regulator-max-microamp = <5000000>; |
| 31 | enable-gpios = <&gpio 27 0>; | 32 | enable-gpios = <&gpio 27 0>; |
| 32 | }; | 33 | }; |
| 34 | }; | ||
| 35 | }; | ||
| 36 | |||
| 37 | Example 2) DA9212 | ||
| 38 | |||
| 39 | pmic: da9212@68 { | ||
| 40 | compatible = "dlg,da9212"; | ||
| 41 | reg = <0x68>; | ||
| 42 | interrupts = <3 27>; | ||
| 43 | |||
| 44 | regulators { | ||
| 45 | BUCKA { | ||
| 46 | regulator-name = "VBUCKA"; | ||
| 47 | regulator-min-microvolt = < 300000>; | ||
| 48 | regulator-max-microvolt = <1570000>; | ||
| 49 | regulator-min-microamp = <2000000>; | ||
| 50 | regulator-max-microamp = <5000000>; | ||
| 51 | enable-gpios = <&gpio 27 0>; | ||
| 52 | }; | ||
| 33 | BUCKB { | 53 | BUCKB { |
| 34 | regulator-name = "VBUCKB"; | 54 | regulator-name = "VBUCKB"; |
| 35 | regulator-min-microvolt = < 300000>; | 55 | regulator-min-microvolt = < 300000>; |
| @@ -41,7 +61,7 @@ Example 1) DA9211 | |||
| 41 | }; | 61 | }; |
| 42 | }; | 62 | }; |
| 43 | 63 | ||
| 44 | Example 2) DA9213 | 64 | Example 3) DA9213 |
| 45 | pmic: da9213@68 { | 65 | pmic: da9213@68 { |
| 46 | compatible = "dlg,da9213"; | 66 | compatible = "dlg,da9213"; |
| 47 | reg = <0x68>; | 67 | reg = <0x68>; |
| @@ -56,6 +76,24 @@ Example 2) DA9213 | |||
| 56 | regulator-max-microamp = <6000000>; | 76 | regulator-max-microamp = <6000000>; |
| 57 | enable-gpios = <&gpio 27 0>; | 77 | enable-gpios = <&gpio 27 0>; |
| 58 | }; | 78 | }; |
| 79 | }; | ||
| 80 | }; | ||
| 81 | |||
| 82 | Example 4) DA9214 | ||
| 83 | pmic: da9214@68 { | ||
| 84 | compatible = "dlg,da9214"; | ||
| 85 | reg = <0x68>; | ||
| 86 | interrupts = <3 27>; | ||
| 87 | |||
| 88 | regulators { | ||
| 89 | BUCKA { | ||
| 90 | regulator-name = "VBUCKA"; | ||
| 91 | regulator-min-microvolt = < 300000>; | ||
| 92 | regulator-max-microvolt = <1570000>; | ||
| 93 | regulator-min-microamp = <3000000>; | ||
| 94 | regulator-max-microamp = <6000000>; | ||
| 95 | enable-gpios = <&gpio 27 0>; | ||
| 96 | }; | ||
| 59 | BUCKB { | 97 | BUCKB { |
| 60 | regulator-name = "VBUCKB"; | 98 | regulator-name = "VBUCKB"; |
| 61 | regulator-min-microvolt = < 300000>; | 99 | regulator-min-microvolt = < 300000>; |
| @@ -67,8 +105,7 @@ Example 2) DA9213 | |||
| 67 | }; | 105 | }; |
| 68 | }; | 106 | }; |
| 69 | 107 | ||
| 70 | 108 | Example 5) DA9215 | |
| 71 | Example 3) DA9215 | ||
| 72 | pmic: da9215@68 { | 109 | pmic: da9215@68 { |
| 73 | compatible = "dlg,da9215"; | 110 | compatible = "dlg,da9215"; |
| 74 | reg = <0x68>; | 111 | reg = <0x68>; |
diff --git a/Documentation/devicetree/bindings/regulator/mt6323-regulator.txt b/Documentation/devicetree/bindings/regulator/mt6323-regulator.txt new file mode 100644 index 000000000000..c35d878b0960 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/mt6323-regulator.txt | |||
| @@ -0,0 +1,237 @@ | |||
| 1 | Mediatek MT6323 Regulator Driver | ||
| 2 | |||
| 3 | All voltage regulators are defined as subnodes of the regulators node. A list | ||
| 4 | of regulators provided by this controller are defined as subnodes of the | ||
| 5 | PMIC's node. Each regulator is named according to its regulator type, | ||
| 6 | buck_<name> and ldo_<name>. The definition for each of these nodes is defined | ||
| 7 | using the standard binding for regulators at | ||
| 8 | Documentation/devicetree/bindings/regulator/regulator.txt. | ||
| 9 | |||
| 10 | The valid names for regulators are:: | ||
| 11 | BUCK: | ||
| 12 | buck_vproc, buck_vsys, buck_vpa | ||
| 13 | LDO: | ||
| 14 | ldo_vtcxo, ldo_vcn28, ldo_vcn33_bt, ldo_vcn33_wifi, ldo_va, ldo_vcama, | ||
| 15 | ldo_vio28, ldo_vusb, ldo_vmc, ldo_vmch, ldo_vemc3v3, ldo_vgp1, ldo_vgp2, | ||
| 16 | ldo_vgp3, ldo_vcn18, ldo_vsim1, ldo_vsim2, ldo_vrtc, ldo_vcamaf, ldo_vibr, | ||
| 17 | ldo_vrf18, ldo_vm, ldo_vio18, ldo_vcamd, ldo_vcamio | ||
| 18 | |||
| 19 | Example: | ||
| 20 | |||
| 21 | pmic: mt6323 { | ||
| 22 | mt6323regulator: regulators { | ||
| 23 | mt6323_vproc_reg: buck_vproc{ | ||
| 24 | regulator-name = "vproc"; | ||
| 25 | regulator-min-microvolt = < 700000>; | ||
| 26 | regulator-max-microvolt = <1350000>; | ||
| 27 | regulator-ramp-delay = <12500>; | ||
| 28 | regulator-always-on; | ||
| 29 | regulator-boot-on; | ||
| 30 | }; | ||
| 31 | |||
| 32 | mt6323_vsys_reg: buck_vsys{ | ||
| 33 | regulator-name = "vsys"; | ||
| 34 | regulator-min-microvolt = <1400000>; | ||
| 35 | regulator-max-microvolt = <2987500>; | ||
| 36 | regulator-ramp-delay = <25000>; | ||
| 37 | regulator-always-on; | ||
| 38 | regulator-boot-on; | ||
| 39 | }; | ||
| 40 | |||
| 41 | mt6323_vpa_reg: buck_vpa{ | ||
| 42 | regulator-name = "vpa"; | ||
| 43 | regulator-min-microvolt = < 500000>; | ||
| 44 | regulator-max-microvolt = <3650000>; | ||
| 45 | }; | ||
| 46 | |||
| 47 | mt6323_vtcxo_reg: ldo_vtcxo{ | ||
| 48 | regulator-name = "vtcxo"; | ||
| 49 | regulator-min-microvolt = <2800000>; | ||
| 50 | regulator-max-microvolt = <2800000>; | ||
| 51 | regulator-enable-ramp-delay = <90>; | ||
| 52 | regulator-always-on; | ||
| 53 | regulator-boot-on; | ||
| 54 | }; | ||
| 55 | |||
| 56 | mt6323_vcn28_reg: ldo_vcn28{ | ||
| 57 | regulator-name = "vcn28"; | ||
| 58 | regulator-min-microvolt = <2800000>; | ||
| 59 | regulator-max-microvolt = <2800000>; | ||
| 60 | regulator-enable-ramp-delay = <185>; | ||
| 61 | }; | ||
| 62 | |||
| 63 | mt6323_vcn33_bt_reg: ldo_vcn33_bt{ | ||
| 64 | regulator-name = "vcn33_bt"; | ||
| 65 | regulator-min-microvolt = <3300000>; | ||
| 66 | regulator-max-microvolt = <3600000>; | ||
| 67 | regulator-enable-ramp-delay = <185>; | ||
| 68 | }; | ||
| 69 | |||
| 70 | mt6323_vcn33_wifi_reg: ldo_vcn33_wifi{ | ||
| 71 | regulator-name = "vcn33_wifi"; | ||
| 72 | regulator-min-microvolt = <3300000>; | ||
| 73 | regulator-max-microvolt = <3600000>; | ||
| 74 | regulator-enable-ramp-delay = <185>; | ||
| 75 | }; | ||
| 76 | |||
| 77 | mt6323_va_reg: ldo_va{ | ||
| 78 | regulator-name = "va"; | ||
| 79 | regulator-min-microvolt = <2800000>; | ||
| 80 | regulator-max-microvolt = <2800000>; | ||
| 81 | regulator-enable-ramp-delay = <216>; | ||
| 82 | regulator-always-on; | ||
| 83 | regulator-boot-on; | ||
| 84 | }; | ||
| 85 | |||
| 86 | mt6323_vcama_reg: ldo_vcama{ | ||
| 87 | regulator-name = "vcama"; | ||
| 88 | regulator-min-microvolt = <1500000>; | ||
| 89 | regulator-max-microvolt = <2800000>; | ||
| 90 | regulator-enable-ramp-delay = <216>; | ||
| 91 | }; | ||
| 92 | |||
| 93 | mt6323_vio28_reg: ldo_vio28{ | ||
| 94 | regulator-name = "vio28"; | ||
| 95 | regulator-min-microvolt = <2800000>; | ||
| 96 | regulator-max-microvolt = <2800000>; | ||
| 97 | regulator-enable-ramp-delay = <216>; | ||
| 98 | regulator-always-on; | ||
| 99 | regulator-boot-on; | ||
| 100 | }; | ||
| 101 | |||
| 102 | mt6323_vusb_reg: ldo_vusb{ | ||
| 103 | regulator-name = "vusb"; | ||
| 104 | regulator-min-microvolt = <3300000>; | ||
| 105 | regulator-max-microvolt = <3300000>; | ||
| 106 | regulator-enable-ramp-delay = <216>; | ||
| 107 | regulator-boot-on; | ||
| 108 | }; | ||
| 109 | |||
| 110 | mt6323_vmc_reg: ldo_vmc{ | ||
| 111 | regulator-name = "vmc"; | ||
| 112 | regulator-min-microvolt = <1800000>; | ||
| 113 | regulator-max-microvolt = <3300000>; | ||
| 114 | regulator-enable-ramp-delay = <36>; | ||
| 115 | regulator-boot-on; | ||
| 116 | }; | ||
| 117 | |||
| 118 | mt6323_vmch_reg: ldo_vmch{ | ||
| 119 | regulator-name = "vmch"; | ||
| 120 | regulator-min-microvolt = <3000000>; | ||
| 121 | regulator-max-microvolt = <3300000>; | ||
| 122 | regulator-enable-ramp-delay = <36>; | ||
| 123 | regulator-boot-on; | ||
| 124 | }; | ||
| 125 | |||
| 126 | mt6323_vemc3v3_reg: ldo_vemc3v3{ | ||
| 127 | regulator-name = "vemc3v3"; | ||
| 128 | regulator-min-microvolt = <3000000>; | ||
| 129 | regulator-max-microvolt = <3300000>; | ||
| 130 | regulator-enable-ramp-delay = <36>; | ||
| 131 | regulator-boot-on; | ||
| 132 | }; | ||
| 133 | |||
| 134 | mt6323_vgp1_reg: ldo_vgp1{ | ||
| 135 | regulator-name = "vgp1"; | ||
| 136 | regulator-min-microvolt = <1200000>; | ||
| 137 | regulator-max-microvolt = <3300000>; | ||
| 138 | regulator-enable-ramp-delay = <216>; | ||
| 139 | }; | ||
| 140 | |||
| 141 | mt6323_vgp2_reg: ldo_vgp2{ | ||
| 142 | regulator-name = "vgp2"; | ||
| 143 | regulator-min-microvolt = <1200000>; | ||
| 144 | regulator-max-microvolt = <3000000>; | ||
| 145 | regulator-enable-ramp-delay = <216>; | ||
| 146 | }; | ||
| 147 | |||
| 148 | mt6323_vgp3_reg: ldo_vgp3{ | ||
| 149 | regulator-name = "vgp3"; | ||
| 150 | regulator-min-microvolt = <1200000>; | ||
| 151 | regulator-max-microvolt = <1800000>; | ||
| 152 | regulator-enable-ramp-delay = <216>; | ||
| 153 | }; | ||
| 154 | |||
| 155 | mt6323_vcn18_reg: ldo_vcn18{ | ||
| 156 | regulator-name = "vcn18"; | ||
| 157 | regulator-min-microvolt = <1800000>; | ||
| 158 | regulator-max-microvolt = <1800000>; | ||
| 159 | regulator-enable-ramp-delay = <216>; | ||
| 160 | }; | ||
| 161 | |||
| 162 | mt6323_vsim1_reg: ldo_vsim1{ | ||
| 163 | regulator-name = "vsim1"; | ||
| 164 | regulator-min-microvolt = <1800000>; | ||
| 165 | regulator-max-microvolt = <3000000>; | ||
| 166 | regulator-enable-ramp-delay = <216>; | ||
| 167 | }; | ||
| 168 | |||
| 169 | mt6323_vsim2_reg: ldo_vsim2{ | ||
| 170 | regulator-name = "vsim2"; | ||
| 171 | regulator-min-microvolt = <1800000>; | ||
| 172 | regulator-max-microvolt = <3000000>; | ||
| 173 | regulator-enable-ramp-delay = <216>; | ||
| 174 | }; | ||
| 175 | |||
| 176 | mt6323_vrtc_reg: ldo_vrtc{ | ||
| 177 | regulator-name = "vrtc"; | ||
| 178 | regulator-min-microvolt = <2800000>; | ||
| 179 | regulator-max-microvolt = <2800000>; | ||
| 180 | regulator-always-on; | ||
| 181 | regulator-boot-on; | ||
| 182 | }; | ||
| 183 | |||
| 184 | mt6323_vcamaf_reg: ldo_vcamaf{ | ||
| 185 | regulator-name = "vcamaf"; | ||
| 186 | regulator-min-microvolt = <1200000>; | ||
| 187 | regulator-max-microvolt = <3300000>; | ||
| 188 | regulator-enable-ramp-delay = <216>; | ||
| 189 | }; | ||
| 190 | |||
| 191 | mt6323_vibr_reg: ldo_vibr{ | ||
| 192 | regulator-name = "vibr"; | ||
| 193 | regulator-min-microvolt = <1200000>; | ||
| 194 | regulator-max-microvolt = <3300000>; | ||
| 195 | regulator-enable-ramp-delay = <36>; | ||
| 196 | }; | ||
| 197 | |||
| 198 | mt6323_vrf18_reg: ldo_vrf18{ | ||
| 199 | regulator-name = "vrf18"; | ||
| 200 | regulator-min-microvolt = <1825000>; | ||
| 201 | regulator-max-microvolt = <1825000>; | ||
| 202 | regulator-enable-ramp-delay = <187>; | ||
| 203 | }; | ||
| 204 | |||
| 205 | mt6323_vm_reg: ldo_vm{ | ||
| 206 | regulator-name = "vm"; | ||
| 207 | regulator-min-microvolt = <1200000>; | ||
| 208 | regulator-max-microvolt = <1800000>; | ||
| 209 | regulator-enable-ramp-delay = <216>; | ||
| 210 | regulator-always-on; | ||
| 211 | regulator-boot-on; | ||
| 212 | }; | ||
| 213 | |||
| 214 | mt6323_vio18_reg: ldo_vio18{ | ||
| 215 | regulator-name = "vio18"; | ||
| 216 | regulator-min-microvolt = <1800000>; | ||
| 217 | regulator-max-microvolt = <1800000>; | ||
| 218 | regulator-enable-ramp-delay = <216>; | ||
| 219 | regulator-always-on; | ||
| 220 | regulator-boot-on; | ||
| 221 | }; | ||
| 222 | |||
| 223 | mt6323_vcamd_reg: ldo_vcamd{ | ||
| 224 | regulator-name = "vcamd"; | ||
| 225 | regulator-min-microvolt = <1200000>; | ||
| 226 | regulator-max-microvolt = <1800000>; | ||
| 227 | regulator-enable-ramp-delay = <216>; | ||
| 228 | }; | ||
| 229 | |||
| 230 | mt6323_vcamio_reg: ldo_vcamio{ | ||
| 231 | regulator-name = "vcamio"; | ||
| 232 | regulator-min-microvolt = <1800000>; | ||
| 233 | regulator-max-microvolt = <1800000>; | ||
| 234 | regulator-enable-ramp-delay = <216>; | ||
| 235 | }; | ||
| 236 | }; | ||
| 237 | }; | ||
diff --git a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt index ed936f0f34f2..dd6f59cf1455 100644 --- a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt | |||
| @@ -38,13 +38,18 @@ NB: To be clear, if voltage-table is provided, then the device will be used | |||
| 38 | in Voltage Table Mode. If no voltage-table is provided, then the device will | 38 | in Voltage Table Mode. If no voltage-table is provided, then the device will |
| 39 | be used in Continuous Voltage Mode. | 39 | be used in Continuous Voltage Mode. |
| 40 | 40 | ||
| 41 | Optional properties: | ||
| 42 | -------------------- | ||
| 43 | - enable-gpios: GPIO to use to enable/disable the regulator | ||
| 44 | |||
| 41 | Any property defined as part of the core regulator binding can also be used. | 45 | Any property defined as part of the core regulator binding can also be used. |
| 42 | (See: ../regulator/regulator.txt) | 46 | (See: ../regulator/regulator.txt) |
| 43 | 47 | ||
| 44 | Continuous Voltage Example: | 48 | Continuous Voltage With Enable GPIO Example: |
| 45 | pwm_regulator { | 49 | pwm_regulator { |
| 46 | compatible = "pwm-regulator; | 50 | compatible = "pwm-regulator; |
| 47 | pwms = <&pwm1 0 8448 0>; | 51 | pwms = <&pwm1 0 8448 0>; |
| 52 | enable-gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>; | ||
| 48 | regulator-min-microvolt = <1016000>; | 53 | regulator-min-microvolt = <1016000>; |
| 49 | regulator-max-microvolt = <1114000>; | 54 | regulator-max-microvolt = <1114000>; |
| 50 | regulator-name = "vdd_logic"; | 55 | regulator-name = "vdd_logic"; |
diff --git a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt index 46c6f3ed1a1c..0fa3b0fac129 100644 --- a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt | |||
| @@ -113,9 +113,9 @@ pm8916: | |||
| 113 | l14, l15, l16, l17, l18 | 113 | l14, l15, l16, l17, l18 |
| 114 | 114 | ||
| 115 | pm8941: | 115 | pm8941: |
| 116 | s1, s2, s3, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, | 116 | s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, |
| 117 | l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, lvs3, | 117 | l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, lvs3, |
| 118 | mvs1, mvs2 | 118 | 5vs1, 5vs2 |
| 119 | 119 | ||
| 120 | pm8994: | 120 | pm8994: |
| 121 | s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, l1, l2, l3, l4, l5, | 121 | s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, l1, l2, l3, l4, l5, |
diff --git a/arch/arm/boot/dts/meson8-minix-neo-x8.dts b/arch/arm/boot/dts/meson8-minix-neo-x8.dts index 4f536bb1f002..8bceb8d343f6 100644 --- a/arch/arm/boot/dts/meson8-minix-neo-x8.dts +++ b/arch/arm/boot/dts/meson8-minix-neo-x8.dts | |||
| @@ -80,6 +80,7 @@ | |||
| 80 | pmic@32 { | 80 | pmic@32 { |
| 81 | compatible = "ricoh,rn5t618"; | 81 | compatible = "ricoh,rn5t618"; |
| 82 | reg = <0x32>; | 82 | reg = <0x32>; |
| 83 | system-power-controller; | ||
| 83 | 84 | ||
| 84 | regulators { | 85 | regulators { |
| 85 | }; | 86 | }; |
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1bcf601de5bc..ff031a7735a5 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
| @@ -852,13 +852,14 @@ config MFD_RK808 | |||
| 852 | including interrupts, RTC, LDO & DCDC regulators, and onkey. | 852 | including interrupts, RTC, LDO & DCDC regulators, and onkey. |
| 853 | 853 | ||
| 854 | config MFD_RN5T618 | 854 | config MFD_RN5T618 |
| 855 | tristate "Ricoh RN5T5618 PMIC" | 855 | tristate "Ricoh RN5T567/618 PMIC" |
| 856 | depends on I2C | 856 | depends on I2C |
| 857 | depends on OF | ||
| 857 | select MFD_CORE | 858 | select MFD_CORE |
| 858 | select REGMAP_I2C | 859 | select REGMAP_I2C |
| 859 | help | 860 | help |
| 860 | Say yes here to add support for the Ricoh RN5T618 PMIC. This | 861 | Say yes here to add support for the Ricoh RN5T567 or R5T618 PMIC. |
| 861 | driver provides common support for accessing the device, | 862 | This driver provides common support for accessing the device, |
| 862 | additional drivers must be enabled in order to use the | 863 | additional drivers must be enabled in order to use the |
| 863 | functionality of the device. | 864 | functionality of the device. |
| 864 | 865 | ||
diff --git a/drivers/mfd/rn5t618.c b/drivers/mfd/rn5t618.c index 0ad51d792feb..ee94080e1cbb 100644 --- a/drivers/mfd/rn5t618.c +++ b/drivers/mfd/rn5t618.c | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | * MFD core driver for Ricoh RN5T618 PMIC | 2 | * MFD core driver for Ricoh RN5T618 PMIC |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com> | 4 | * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com> |
| 5 | * Copyright (C) 2016 Toradex AG | ||
| 5 | * | 6 | * |
| 6 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
| @@ -11,10 +12,13 @@ | |||
| 11 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 12 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 12 | */ | 13 | */ |
| 13 | 14 | ||
| 15 | #include <linux/delay.h> | ||
| 14 | #include <linux/i2c.h> | 16 | #include <linux/i2c.h> |
| 15 | #include <linux/mfd/core.h> | 17 | #include <linux/mfd/core.h> |
| 16 | #include <linux/mfd/rn5t618.h> | 18 | #include <linux/mfd/rn5t618.h> |
| 17 | #include <linux/module.h> | 19 | #include <linux/module.h> |
| 20 | #include <linux/of_device.h> | ||
| 21 | #include <linux/reboot.h> | ||
| 18 | #include <linux/regmap.h> | 22 | #include <linux/regmap.h> |
| 19 | 23 | ||
| 20 | static const struct mfd_cell rn5t618_cells[] = { | 24 | static const struct mfd_cell rn5t618_cells[] = { |
| @@ -48,28 +52,64 @@ static const struct regmap_config rn5t618_regmap_config = { | |||
| 48 | }; | 52 | }; |
| 49 | 53 | ||
| 50 | static struct rn5t618 *rn5t618_pm_power_off; | 54 | static struct rn5t618 *rn5t618_pm_power_off; |
| 55 | static struct notifier_block rn5t618_restart_handler; | ||
| 51 | 56 | ||
| 52 | static void rn5t618_power_off(void) | 57 | static void rn5t618_trigger_poweroff_sequence(bool repower) |
| 53 | { | 58 | { |
| 54 | /* disable automatic repower-on */ | 59 | /* disable automatic repower-on */ |
| 55 | regmap_update_bits(rn5t618_pm_power_off->regmap, RN5T618_REPCNT, | 60 | regmap_update_bits(rn5t618_pm_power_off->regmap, RN5T618_REPCNT, |
| 56 | RN5T618_REPCNT_REPWRON, 0); | 61 | RN5T618_REPCNT_REPWRON, |
| 62 | repower ? RN5T618_REPCNT_REPWRON : 0); | ||
| 57 | /* start power-off sequence */ | 63 | /* start power-off sequence */ |
| 58 | regmap_update_bits(rn5t618_pm_power_off->regmap, RN5T618_SLPCNT, | 64 | regmap_update_bits(rn5t618_pm_power_off->regmap, RN5T618_SLPCNT, |
| 59 | RN5T618_SLPCNT_SWPWROFF, RN5T618_SLPCNT_SWPWROFF); | 65 | RN5T618_SLPCNT_SWPWROFF, RN5T618_SLPCNT_SWPWROFF); |
| 60 | } | 66 | } |
| 61 | 67 | ||
| 68 | static void rn5t618_power_off(void) | ||
| 69 | { | ||
| 70 | rn5t618_trigger_poweroff_sequence(false); | ||
| 71 | } | ||
| 72 | |||
| 73 | static int rn5t618_restart(struct notifier_block *this, | ||
| 74 | unsigned long mode, void *cmd) | ||
| 75 | { | ||
| 76 | rn5t618_trigger_poweroff_sequence(true); | ||
| 77 | |||
| 78 | /* | ||
| 79 | * Re-power factor detection on PMIC side is not instant. 1ms | ||
| 80 | * proved to be enough time until reset takes effect. | ||
| 81 | */ | ||
| 82 | mdelay(1); | ||
| 83 | |||
| 84 | return NOTIFY_DONE; | ||
| 85 | } | ||
| 86 | |||
| 87 | static const struct of_device_id rn5t618_of_match[] = { | ||
| 88 | { .compatible = "ricoh,rn5t567", .data = (void *)RN5T567 }, | ||
| 89 | { .compatible = "ricoh,rn5t618", .data = (void *)RN5T618 }, | ||
| 90 | { } | ||
| 91 | }; | ||
| 92 | MODULE_DEVICE_TABLE(of, rn5t618_of_match); | ||
| 93 | |||
| 62 | static int rn5t618_i2c_probe(struct i2c_client *i2c, | 94 | static int rn5t618_i2c_probe(struct i2c_client *i2c, |
| 63 | const struct i2c_device_id *id) | 95 | const struct i2c_device_id *id) |
| 64 | { | 96 | { |
| 97 | const struct of_device_id *of_id; | ||
| 65 | struct rn5t618 *priv; | 98 | struct rn5t618 *priv; |
| 66 | int ret; | 99 | int ret; |
| 67 | 100 | ||
| 101 | of_id = of_match_device(rn5t618_of_match, &i2c->dev); | ||
| 102 | if (!of_id) { | ||
| 103 | dev_err(&i2c->dev, "Failed to find matching DT ID\n"); | ||
| 104 | return -EINVAL; | ||
| 105 | } | ||
| 106 | |||
| 68 | priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); | 107 | priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); |
| 69 | if (!priv) | 108 | if (!priv) |
| 70 | return -ENOMEM; | 109 | return -ENOMEM; |
| 71 | 110 | ||
| 72 | i2c_set_clientdata(i2c, priv); | 111 | i2c_set_clientdata(i2c, priv); |
| 112 | priv->variant = (long)of_id->data; | ||
| 73 | 113 | ||
| 74 | priv->regmap = devm_regmap_init_i2c(i2c, &rn5t618_regmap_config); | 114 | priv->regmap = devm_regmap_init_i2c(i2c, &rn5t618_regmap_config); |
| 75 | if (IS_ERR(priv->regmap)) { | 115 | if (IS_ERR(priv->regmap)) { |
| @@ -85,9 +125,21 @@ static int rn5t618_i2c_probe(struct i2c_client *i2c, | |||
| 85 | return ret; | 125 | return ret; |
| 86 | } | 126 | } |
| 87 | 127 | ||
| 88 | if (!pm_power_off) { | 128 | rn5t618_pm_power_off = priv; |
| 89 | rn5t618_pm_power_off = priv; | 129 | if (of_device_is_system_power_controller(i2c->dev.of_node)) { |
| 90 | pm_power_off = rn5t618_power_off; | 130 | if (!pm_power_off) |
| 131 | pm_power_off = rn5t618_power_off; | ||
| 132 | else | ||
| 133 | dev_warn(&i2c->dev, "Poweroff callback already assigned\n"); | ||
| 134 | } | ||
| 135 | |||
| 136 | rn5t618_restart_handler.notifier_call = rn5t618_restart; | ||
| 137 | rn5t618_restart_handler.priority = 192; | ||
| 138 | |||
| 139 | ret = register_restart_handler(&rn5t618_restart_handler); | ||
| 140 | if (ret) { | ||
| 141 | dev_err(&i2c->dev, "cannot register restart handler, %d\n", ret); | ||
| 142 | return ret; | ||
| 91 | } | 143 | } |
| 92 | 144 | ||
| 93 | return 0; | 145 | return 0; |
| @@ -105,12 +157,6 @@ static int rn5t618_i2c_remove(struct i2c_client *i2c) | |||
| 105 | return 0; | 157 | return 0; |
| 106 | } | 158 | } |
| 107 | 159 | ||
| 108 | static const struct of_device_id rn5t618_of_match[] = { | ||
| 109 | { .compatible = "ricoh,rn5t618" }, | ||
| 110 | { } | ||
| 111 | }; | ||
| 112 | MODULE_DEVICE_TABLE(of, rn5t618_of_match); | ||
| 113 | |||
| 114 | static const struct i2c_device_id rn5t618_i2c_id[] = { | 160 | static const struct i2c_device_id rn5t618_i2c_id[] = { |
| 115 | { } | 161 | { } |
| 116 | }; | 162 | }; |
| @@ -129,5 +175,5 @@ static struct i2c_driver rn5t618_i2c_driver = { | |||
| 129 | module_i2c_driver(rn5t618_i2c_driver); | 175 | module_i2c_driver(rn5t618_i2c_driver); |
| 130 | 176 | ||
| 131 | MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>"); | 177 | MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>"); |
| 132 | MODULE_DESCRIPTION("Ricoh RN5T618 MFD driver"); | 178 | MODULE_DESCRIPTION("Ricoh RN5T567/618 MFD driver"); |
| 133 | MODULE_LICENSE("GPL v2"); | 179 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 144cbf5b3e5a..6c88e31c01f7 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
| @@ -498,6 +498,15 @@ config REGULATOR_MT6311 | |||
| 498 | This driver supports the control of different power rails of device | 498 | This driver supports the control of different power rails of device |
| 499 | through regulator interface. | 499 | through regulator interface. |
| 500 | 500 | ||
| 501 | config REGULATOR_MT6323 | ||
| 502 | tristate "MediaTek MT6323 PMIC" | ||
| 503 | depends on MFD_MT6397 | ||
| 504 | help | ||
| 505 | Say y here to select this option to enable the power regulator of | ||
| 506 | MediaTek MT6323 PMIC. | ||
| 507 | This driver supports the control of different power rails of device | ||
| 508 | through regulator interface. | ||
| 509 | |||
| 501 | config REGULATOR_MT6397 | 510 | config REGULATOR_MT6397 |
| 502 | tristate "MediaTek MT6397 PMIC" | 511 | tristate "MediaTek MT6397 PMIC" |
| 503 | depends on MFD_MT6397 | 512 | depends on MFD_MT6397 |
| @@ -543,12 +552,12 @@ config REGULATOR_PCF50633 | |||
| 543 | on PCF50633 | 552 | on PCF50633 |
| 544 | 553 | ||
| 545 | config REGULATOR_PFUZE100 | 554 | config REGULATOR_PFUZE100 |
| 546 | tristate "Freescale PFUZE100/PFUZE200 regulator driver" | 555 | tristate "Freescale PFUZE100/200/3000 regulator driver" |
| 547 | depends on I2C | 556 | depends on I2C |
| 548 | select REGMAP_I2C | 557 | select REGMAP_I2C |
| 549 | help | 558 | help |
| 550 | Say y here to support the regulators found on the Freescale | 559 | Say y here to support the regulators found on the Freescale |
| 551 | PFUZE100/PFUZE200 PMIC. | 560 | PFUZE100/200/3000 PMIC. |
| 552 | 561 | ||
| 553 | config REGULATOR_PV88060 | 562 | config REGULATOR_PV88060 |
| 554 | tristate "Powerventure Semiconductor PV88060 regulator" | 563 | tristate "Powerventure Semiconductor PV88060 regulator" |
| @@ -636,10 +645,11 @@ config REGULATOR_RK808 | |||
| 636 | outputs which can be controlled by i2c communication. | 645 | outputs which can be controlled by i2c communication. |
| 637 | 646 | ||
| 638 | config REGULATOR_RN5T618 | 647 | config REGULATOR_RN5T618 |
| 639 | tristate "Ricoh RN5T618 voltage regulators" | 648 | tristate "Ricoh RN5T567/618 voltage regulators" |
| 640 | depends on MFD_RN5T618 | 649 | depends on MFD_RN5T618 |
| 641 | help | 650 | help |
| 642 | Say y here to support the regulators found on Ricoh RN5T618 PMIC. | 651 | Say y here to support the regulators found on Ricoh RN5T567 or |
| 652 | RN5T618 PMIC. | ||
| 643 | 653 | ||
| 644 | config REGULATOR_RT5033 | 654 | config REGULATOR_RT5033 |
| 645 | tristate "Richtek RT5033 Regulators" | 655 | tristate "Richtek RT5033 Regulators" |
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 85a1d44a3939..f3da9eea9ab6 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile | |||
| @@ -65,6 +65,7 @@ obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o | |||
| 65 | obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o | 65 | obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o |
| 66 | obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o | 66 | obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o |
| 67 | obj-$(CONFIG_REGULATOR_MT6311) += mt6311-regulator.o | 67 | obj-$(CONFIG_REGULATOR_MT6311) += mt6311-regulator.o |
| 68 | obj-$(CONFIG_REGULATOR_MT6323) += mt6323-regulator.o | ||
| 68 | obj-$(CONFIG_REGULATOR_MT6397) += mt6397-regulator.o | 69 | obj-$(CONFIG_REGULATOR_MT6397) += mt6397-regulator.o |
| 69 | obj-$(CONFIG_REGULATOR_QCOM_RPM) += qcom_rpm-regulator.o | 70 | obj-$(CONFIG_REGULATOR_QCOM_RPM) += qcom_rpm-regulator.o |
| 70 | obj-$(CONFIG_REGULATOR_QCOM_SMD_RPM) += qcom_smd-regulator.o | 71 | obj-$(CONFIG_REGULATOR_QCOM_SMD_RPM) += qcom_smd-regulator.o |
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c index a1cd0d4f8257..7652477e6a9d 100644 --- a/drivers/regulator/act8865-regulator.c +++ b/drivers/regulator/act8865-regulator.c | |||
| @@ -395,12 +395,6 @@ static int act8865_pdata_from_dt(struct device *dev, | |||
| 395 | struct act8865_regulator_data *regulator; | 395 | struct act8865_regulator_data *regulator; |
| 396 | struct of_regulator_match *matches; | 396 | struct of_regulator_match *matches; |
| 397 | 397 | ||
| 398 | np = of_get_child_by_name(dev->of_node, "regulators"); | ||
| 399 | if (!np) { | ||
| 400 | dev_err(dev, "missing 'regulators' subnode in DT\n"); | ||
| 401 | return -EINVAL; | ||
| 402 | } | ||
| 403 | |||
| 404 | switch (type) { | 398 | switch (type) { |
| 405 | case ACT8600: | 399 | case ACT8600: |
| 406 | matches = act8600_matches; | 400 | matches = act8600_matches; |
| @@ -419,6 +413,12 @@ static int act8865_pdata_from_dt(struct device *dev, | |||
| 419 | return -EINVAL; | 413 | return -EINVAL; |
| 420 | } | 414 | } |
| 421 | 415 | ||
| 416 | np = of_get_child_by_name(dev->of_node, "regulators"); | ||
| 417 | if (!np) { | ||
| 418 | dev_err(dev, "missing 'regulators' subnode in DT\n"); | ||
| 419 | return -EINVAL; | ||
| 420 | } | ||
| 421 | |||
| 422 | matched = of_regulator_match(dev, np, matches, num_matches); | 422 | matched = of_regulator_match(dev, np, matches, num_matches); |
| 423 | of_node_put(np); | 423 | of_node_put(np); |
| 424 | if (matched <= 0) | 424 | if (matched <= 0) |
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c index 514a5e8fdbab..6d9ac76a772f 100644 --- a/drivers/regulator/axp20x-regulator.c +++ b/drivers/regulator/axp20x-regulator.c | |||
| @@ -36,6 +36,8 @@ | |||
| 36 | 36 | ||
| 37 | #define AXP20X_FREQ_DCDC_MASK 0x0f | 37 | #define AXP20X_FREQ_DCDC_MASK 0x0f |
| 38 | 38 | ||
| 39 | #define AXP22X_MISC_N_VBUSEN_FUNC BIT(4) | ||
| 40 | |||
| 39 | #define AXP_DESC_IO(_family, _id, _match, _supply, _min, _max, _step, _vreg, \ | 41 | #define AXP_DESC_IO(_family, _id, _match, _supply, _min, _max, _step, _vreg, \ |
| 40 | _vmask, _ereg, _emask, _enable_val, _disable_val) \ | 42 | _vmask, _ereg, _emask, _enable_val, _disable_val) \ |
| 41 | [_family##_##_id] = { \ | 43 | [_family##_##_id] = { \ |
| @@ -230,6 +232,73 @@ static const struct regulator_desc axp22x_regulators[] = { | |||
| 230 | AXP_DESC_FIXED(AXP22X, RTC_LDO, "rtc_ldo", "ips", 3000), | 232 | AXP_DESC_FIXED(AXP22X, RTC_LDO, "rtc_ldo", "ips", 3000), |
| 231 | }; | 233 | }; |
| 232 | 234 | ||
| 235 | static const struct regulator_desc axp22x_drivevbus_regulator = { | ||
| 236 | .name = "drivevbus", | ||
| 237 | .supply_name = "drivevbus", | ||
| 238 | .of_match = of_match_ptr("drivevbus"), | ||
| 239 | .regulators_node = of_match_ptr("regulators"), | ||
| 240 | .type = REGULATOR_VOLTAGE, | ||
| 241 | .owner = THIS_MODULE, | ||
| 242 | .enable_reg = AXP20X_VBUS_IPSOUT_MGMT, | ||
| 243 | .enable_mask = BIT(2), | ||
| 244 | .ops = &axp20x_ops_sw, | ||
| 245 | }; | ||
| 246 | |||
| 247 | static const struct regulator_linear_range axp809_dcdc4_ranges[] = { | ||
| 248 | REGULATOR_LINEAR_RANGE(600000, 0x0, 0x2f, 20000), | ||
| 249 | REGULATOR_LINEAR_RANGE(1800000, 0x30, 0x38, 100000), | ||
| 250 | }; | ||
| 251 | |||
| 252 | static const struct regulator_linear_range axp809_dldo1_ranges[] = { | ||
| 253 | REGULATOR_LINEAR_RANGE(700000, 0x0, 0x1a, 100000), | ||
| 254 | REGULATOR_LINEAR_RANGE(3400000, 0x1b, 0x1f, 200000), | ||
| 255 | }; | ||
| 256 | |||
| 257 | static const struct regulator_desc axp809_regulators[] = { | ||
| 258 | AXP_DESC(AXP809, DCDC1, "dcdc1", "vin1", 1600, 3400, 100, | ||
| 259 | AXP22X_DCDC1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(1)), | ||
| 260 | AXP_DESC(AXP809, DCDC2, "dcdc2", "vin2", 600, 1540, 20, | ||
| 261 | AXP22X_DCDC2_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(2)), | ||
| 262 | AXP_DESC(AXP809, DCDC3, "dcdc3", "vin3", 600, 1860, 20, | ||
| 263 | AXP22X_DCDC3_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, BIT(3)), | ||
| 264 | AXP_DESC_RANGES(AXP809, DCDC4, "dcdc4", "vin4", axp809_dcdc4_ranges, | ||
| 265 | 57, AXP22X_DCDC4_V_OUT, 0x3f, AXP22X_PWR_OUT_CTRL1, | ||
| 266 | BIT(4)), | ||
| 267 | AXP_DESC(AXP809, DCDC5, "dcdc5", "vin5", 1000, 2550, 50, | ||
| 268 | AXP22X_DCDC5_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(5)), | ||
| 269 | /* secondary switchable output of DCDC1 */ | ||
| 270 | AXP_DESC_SW(AXP809, DC1SW, "dc1sw", NULL, AXP22X_PWR_OUT_CTRL2, | ||
| 271 | BIT(7)), | ||
| 272 | /* LDO regulator internally chained to DCDC5 */ | ||
| 273 | AXP_DESC(AXP809, DC5LDO, "dc5ldo", NULL, 700, 1400, 100, | ||
| 274 | AXP22X_DC5LDO_V_OUT, 0x7, AXP22X_PWR_OUT_CTRL1, BIT(0)), | ||
| 275 | AXP_DESC(AXP809, ALDO1, "aldo1", "aldoin", 700, 3300, 100, | ||
| 276 | AXP22X_ALDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(6)), | ||
| 277 | AXP_DESC(AXP809, ALDO2, "aldo2", "aldoin", 700, 3300, 100, | ||
| 278 | AXP22X_ALDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL1, BIT(7)), | ||
| 279 | AXP_DESC(AXP809, ALDO3, "aldo3", "aldoin", 700, 3300, 100, | ||
| 280 | AXP22X_ALDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(5)), | ||
| 281 | AXP_DESC_RANGES(AXP809, DLDO1, "dldo1", "dldoin", axp809_dldo1_ranges, | ||
| 282 | 32, AXP22X_DLDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, | ||
| 283 | BIT(3)), | ||
| 284 | AXP_DESC(AXP809, DLDO2, "dldo2", "dldoin", 700, 3300, 100, | ||
| 285 | AXP22X_DLDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(4)), | ||
| 286 | AXP_DESC(AXP809, ELDO1, "eldo1", "eldoin", 700, 3300, 100, | ||
| 287 | AXP22X_ELDO1_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(0)), | ||
| 288 | AXP_DESC(AXP809, ELDO2, "eldo2", "eldoin", 700, 3300, 100, | ||
| 289 | AXP22X_ELDO2_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(1)), | ||
| 290 | AXP_DESC(AXP809, ELDO3, "eldo3", "eldoin", 700, 3300, 100, | ||
| 291 | AXP22X_ELDO3_V_OUT, 0x1f, AXP22X_PWR_OUT_CTRL2, BIT(2)), | ||
| 292 | AXP_DESC_IO(AXP809, LDO_IO0, "ldo_io0", "ips", 700, 3300, 100, | ||
| 293 | AXP22X_LDO_IO0_V_OUT, 0x1f, AXP20X_GPIO0_CTRL, 0x07, | ||
| 294 | AXP22X_IO_ENABLED, AXP22X_IO_DISABLED), | ||
| 295 | AXP_DESC_IO(AXP809, LDO_IO1, "ldo_io1", "ips", 700, 3300, 100, | ||
| 296 | AXP22X_LDO_IO1_V_OUT, 0x1f, AXP20X_GPIO1_CTRL, 0x07, | ||
| 297 | AXP22X_IO_ENABLED, AXP22X_IO_DISABLED), | ||
| 298 | AXP_DESC_FIXED(AXP809, RTC_LDO, "rtc_ldo", "ips", 1800), | ||
| 299 | AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)), | ||
| 300 | }; | ||
| 301 | |||
| 233 | static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) | 302 | static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) |
| 234 | { | 303 | { |
| 235 | struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); | 304 | struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); |
| @@ -245,6 +314,7 @@ static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) | |||
| 245 | break; | 314 | break; |
| 246 | case AXP221_ID: | 315 | case AXP221_ID: |
| 247 | case AXP223_ID: | 316 | case AXP223_ID: |
| 317 | case AXP809_ID: | ||
| 248 | min = 1800; | 318 | min = 1800; |
| 249 | max = 4050; | 319 | max = 4050; |
| 250 | def = 3000; | 320 | def = 3000; |
| @@ -324,6 +394,7 @@ static int axp20x_set_dcdc_workmode(struct regulator_dev *rdev, int id, u32 work | |||
| 324 | 394 | ||
| 325 | case AXP221_ID: | 395 | case AXP221_ID: |
| 326 | case AXP223_ID: | 396 | case AXP223_ID: |
| 397 | case AXP809_ID: | ||
| 327 | if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5) | 398 | if (id < AXP22X_DCDC1 || id > AXP22X_DCDC5) |
| 328 | return -EINVAL; | 399 | return -EINVAL; |
| 329 | 400 | ||
| @@ -352,8 +423,9 @@ static int axp20x_regulator_probe(struct platform_device *pdev) | |||
| 352 | }; | 423 | }; |
| 353 | int ret, i, nregulators; | 424 | int ret, i, nregulators; |
| 354 | u32 workmode; | 425 | u32 workmode; |
| 355 | const char *axp22x_dc1_name = axp22x_regulators[AXP22X_DCDC1].name; | 426 | const char *dcdc1_name = axp22x_regulators[AXP22X_DCDC1].name; |
| 356 | const char *axp22x_dc5_name = axp22x_regulators[AXP22X_DCDC5].name; | 427 | const char *dcdc5_name = axp22x_regulators[AXP22X_DCDC5].name; |
| 428 | bool drivevbus = false; | ||
| 357 | 429 | ||
| 358 | switch (axp20x->variant) { | 430 | switch (axp20x->variant) { |
| 359 | case AXP202_ID: | 431 | case AXP202_ID: |
| @@ -365,6 +437,12 @@ static int axp20x_regulator_probe(struct platform_device *pdev) | |||
| 365 | case AXP223_ID: | 437 | case AXP223_ID: |
| 366 | regulators = axp22x_regulators; | 438 | regulators = axp22x_regulators; |
| 367 | nregulators = AXP22X_REG_ID_MAX; | 439 | nregulators = AXP22X_REG_ID_MAX; |
| 440 | drivevbus = of_property_read_bool(pdev->dev.parent->of_node, | ||
| 441 | "x-powers,drive-vbus-en"); | ||
| 442 | break; | ||
| 443 | case AXP809_ID: | ||
| 444 | regulators = axp809_regulators; | ||
| 445 | nregulators = AXP809_REG_ID_MAX; | ||
| 368 | break; | 446 | break; |
| 369 | default: | 447 | default: |
| 370 | dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n", | 448 | dev_err(&pdev->dev, "Unsupported AXP variant: %ld\n", |
| @@ -388,22 +466,22 @@ static int axp20x_regulator_probe(struct platform_device *pdev) | |||
| 388 | * part of this loop to see where we save the DT defined | 466 | * part of this loop to see where we save the DT defined |
| 389 | * name. | 467 | * name. |
| 390 | */ | 468 | */ |
| 391 | if (regulators == axp22x_regulators) { | 469 | if ((regulators == axp22x_regulators && i == AXP22X_DC1SW) || |
| 392 | if (i == AXP22X_DC1SW) { | 470 | (regulators == axp809_regulators && i == AXP809_DC1SW)) { |
| 393 | new_desc = devm_kzalloc(&pdev->dev, | 471 | new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc), |
| 394 | sizeof(*desc), | 472 | GFP_KERNEL); |
| 395 | GFP_KERNEL); | 473 | *new_desc = regulators[i]; |
| 396 | *new_desc = regulators[i]; | 474 | new_desc->supply_name = dcdc1_name; |
| 397 | new_desc->supply_name = axp22x_dc1_name; | 475 | desc = new_desc; |
| 398 | desc = new_desc; | 476 | } |
| 399 | } else if (i == AXP22X_DC5LDO) { | 477 | |
| 400 | new_desc = devm_kzalloc(&pdev->dev, | 478 | if ((regulators == axp22x_regulators && i == AXP22X_DC5LDO) || |
| 401 | sizeof(*desc), | 479 | (regulators == axp809_regulators && i == AXP809_DC5LDO)) { |
| 402 | GFP_KERNEL); | 480 | new_desc = devm_kzalloc(&pdev->dev, sizeof(*desc), |
| 403 | *new_desc = regulators[i]; | 481 | GFP_KERNEL); |
| 404 | new_desc->supply_name = axp22x_dc5_name; | 482 | *new_desc = regulators[i]; |
| 405 | desc = new_desc; | 483 | new_desc->supply_name = dcdc5_name; |
| 406 | } | 484 | desc = new_desc; |
| 407 | } | 485 | } |
| 408 | 486 | ||
| 409 | rdev = devm_regulator_register(&pdev->dev, desc, &config); | 487 | rdev = devm_regulator_register(&pdev->dev, desc, &config); |
| @@ -426,16 +504,29 @@ static int axp20x_regulator_probe(struct platform_device *pdev) | |||
| 426 | /* | 504 | /* |
| 427 | * Save AXP22X DCDC1 / DCDC5 regulator names for later. | 505 | * Save AXP22X DCDC1 / DCDC5 regulator names for later. |
| 428 | */ | 506 | */ |
| 429 | if (regulators == axp22x_regulators) { | 507 | if ((regulators == axp22x_regulators && i == AXP22X_DCDC1) || |
| 430 | /* Can we use rdev->constraints->name instead? */ | 508 | (regulators == axp809_regulators && i == AXP809_DCDC1)) |
| 431 | if (i == AXP22X_DCDC1) | 509 | of_property_read_string(rdev->dev.of_node, |
| 432 | of_property_read_string(rdev->dev.of_node, | 510 | "regulator-name", |
| 433 | "regulator-name", | 511 | &dcdc1_name); |
| 434 | &axp22x_dc1_name); | 512 | |
| 435 | else if (i == AXP22X_DCDC5) | 513 | if ((regulators == axp22x_regulators && i == AXP22X_DCDC5) || |
| 436 | of_property_read_string(rdev->dev.of_node, | 514 | (regulators == axp809_regulators && i == AXP809_DCDC5)) |
| 437 | "regulator-name", | 515 | of_property_read_string(rdev->dev.of_node, |
| 438 | &axp22x_dc5_name); | 516 | "regulator-name", |
| 517 | &dcdc5_name); | ||
| 518 | } | ||
| 519 | |||
| 520 | if (drivevbus) { | ||
| 521 | /* Change N_VBUSEN sense pin to DRIVEVBUS output pin */ | ||
| 522 | regmap_update_bits(axp20x->regmap, AXP20X_OVER_TMP, | ||
| 523 | AXP22X_MISC_N_VBUSEN_FUNC, 0); | ||
| 524 | rdev = devm_regulator_register(&pdev->dev, | ||
| 525 | &axp22x_drivevbus_regulator, | ||
| 526 | &config); | ||
| 527 | if (IS_ERR(rdev)) { | ||
| 528 | dev_err(&pdev->dev, "Failed to register drivevbus\n"); | ||
| 529 | return PTR_ERR(rdev); | ||
| 439 | } | 530 | } |
| 440 | } | 531 | } |
| 441 | 532 | ||
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index ec8184d53f13..db320e8fa865 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
| @@ -2509,33 +2509,6 @@ int regulator_is_enabled(struct regulator *regulator) | |||
| 2509 | EXPORT_SYMBOL_GPL(regulator_is_enabled); | 2509 | EXPORT_SYMBOL_GPL(regulator_is_enabled); |
| 2510 | 2510 | ||
| 2511 | /** | 2511 | /** |
| 2512 | * regulator_can_change_voltage - check if regulator can change voltage | ||
| 2513 | * @regulator: regulator source | ||
| 2514 | * | ||
| 2515 | * Returns positive if the regulator driver backing the source/client | ||
| 2516 | * can change its voltage, false otherwise. Useful for detecting fixed | ||
| 2517 | * or dummy regulators and disabling voltage change logic in the client | ||
| 2518 | * driver. | ||
| 2519 | */ | ||
| 2520 | int regulator_can_change_voltage(struct regulator *regulator) | ||
| 2521 | { | ||
| 2522 | struct regulator_dev *rdev = regulator->rdev; | ||
| 2523 | |||
| 2524 | if (regulator_ops_is_valid(rdev, REGULATOR_CHANGE_VOLTAGE)) { | ||
| 2525 | if (rdev->desc->n_voltages - rdev->desc->linear_min_sel > 1) | ||
| 2526 | return 1; | ||
| 2527 | |||
| 2528 | if (rdev->desc->continuous_voltage_range && | ||
| 2529 | rdev->constraints->min_uV && rdev->constraints->max_uV && | ||
| 2530 | rdev->constraints->min_uV != rdev->constraints->max_uV) | ||
| 2531 | return 1; | ||
| 2532 | } | ||
| 2533 | |||
| 2534 | return 0; | ||
| 2535 | } | ||
| 2536 | EXPORT_SYMBOL_GPL(regulator_can_change_voltage); | ||
| 2537 | |||
| 2538 | /** | ||
| 2539 | * regulator_count_voltages - count regulator_list_voltage() selectors | 2512 | * regulator_count_voltages - count regulator_list_voltage() selectors |
| 2540 | * @regulator: regulator source | 2513 | * @regulator: regulator source |
| 2541 | * | 2514 | * |
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c index 1050cb77561a..9ececfef42d6 100644 --- a/drivers/regulator/da9052-regulator.c +++ b/drivers/regulator/da9052-regulator.c | |||
| @@ -333,7 +333,7 @@ static const struct regulator_ops da9052_ldo_ops = { | |||
| 333 | static struct da9052_regulator_info da9052_regulator_info[] = { | 333 | static struct da9052_regulator_info da9052_regulator_info[] = { |
| 334 | DA9052_DCDC(BUCK1, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBCOREGO), | 334 | DA9052_DCDC(BUCK1, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBCOREGO), |
| 335 | DA9052_DCDC(BUCK2, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBPROGO), | 335 | DA9052_DCDC(BUCK2, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBPROGO), |
| 336 | DA9052_DCDC(BUCK3, 25, 925, 2500, 6, 6, DA9052_SUPPLY_VBMEMGO), | 336 | DA9052_DCDC(BUCK3, 25, 950, 2525, 6, 6, DA9052_SUPPLY_VBMEMGO), |
| 337 | DA9052_DCDC(BUCK4, 50, 1800, 3600, 5, 6, 0), | 337 | DA9052_DCDC(BUCK4, 50, 1800, 3600, 5, 6, 0), |
| 338 | DA9052_LDO(LDO1, 50, 600, 1800, 5, 6, 0), | 338 | DA9052_LDO(LDO1, 50, 600, 1800, 5, 6, 0), |
| 339 | DA9052_LDO(LDO2, 25, 600, 1800, 6, 6, DA9052_SUPPLY_VLDO2GO), | 339 | DA9052_LDO(LDO2, 25, 600, 1800, 6, 6, DA9052_SUPPLY_VLDO2GO), |
| @@ -350,8 +350,8 @@ static struct da9052_regulator_info da9052_regulator_info[] = { | |||
| 350 | static struct da9052_regulator_info da9053_regulator_info[] = { | 350 | static struct da9052_regulator_info da9053_regulator_info[] = { |
| 351 | DA9052_DCDC(BUCK1, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBCOREGO), | 351 | DA9052_DCDC(BUCK1, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBCOREGO), |
| 352 | DA9052_DCDC(BUCK2, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBPROGO), | 352 | DA9052_DCDC(BUCK2, 25, 500, 2075, 6, 6, DA9052_SUPPLY_VBPROGO), |
| 353 | DA9052_DCDC(BUCK3, 25, 925, 2500, 6, 6, DA9052_SUPPLY_VBMEMGO), | 353 | DA9052_DCDC(BUCK3, 25, 950, 2525, 6, 6, DA9052_SUPPLY_VBMEMGO), |
| 354 | DA9052_DCDC(BUCK4, 25, 925, 2500, 6, 6, 0), | 354 | DA9052_DCDC(BUCK4, 25, 950, 2525, 6, 6, 0), |
| 355 | DA9052_LDO(LDO1, 50, 600, 1800, 5, 6, 0), | 355 | DA9052_LDO(LDO1, 50, 600, 1800, 5, 6, 0), |
| 356 | DA9052_LDO(LDO2, 25, 600, 1800, 6, 6, DA9052_SUPPLY_VLDO2GO), | 356 | DA9052_LDO(LDO2, 25, 600, 1800, 6, 6, DA9052_SUPPLY_VLDO2GO), |
| 357 | DA9052_LDO(LDO3, 25, 1725, 3300, 6, 6, DA9052_SUPPLY_VLDO3GO), | 357 | DA9052_LDO(LDO3, 25, 1725, 3300, 6, 6, DA9052_SUPPLY_VLDO3GO), |
diff --git a/drivers/regulator/da9210-regulator.c b/drivers/regulator/da9210-regulator.c index 01c0e3709b66..d0496d6b0934 100644 --- a/drivers/regulator/da9210-regulator.c +++ b/drivers/regulator/da9210-regulator.c | |||
| @@ -21,12 +21,11 @@ | |||
| 21 | #include <linux/err.h> | 21 | #include <linux/err.h> |
| 22 | #include <linux/i2c.h> | 22 | #include <linux/i2c.h> |
| 23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
| 24 | #include <linux/init.h> | ||
| 25 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
| 26 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
| 27 | #include <linux/slab.h> | ||
| 28 | #include <linux/regulator/driver.h> | 26 | #include <linux/regulator/driver.h> |
| 29 | #include <linux/regulator/machine.h> | 27 | #include <linux/regulator/machine.h> |
| 28 | #include <linux/of_device.h> | ||
| 30 | #include <linux/regulator/of_regulator.h> | 29 | #include <linux/regulator/of_regulator.h> |
| 31 | #include <linux/regmap.h> | 30 | #include <linux/regmap.h> |
| 32 | 31 | ||
| @@ -179,6 +178,13 @@ error_i2c: | |||
| 179 | /* | 178 | /* |
| 180 | * I2C driver interface functions | 179 | * I2C driver interface functions |
| 181 | */ | 180 | */ |
| 181 | |||
| 182 | static const struct of_device_id da9210_dt_ids[] = { | ||
| 183 | { .compatible = "dlg,da9210", }, | ||
| 184 | { } | ||
| 185 | }; | ||
| 186 | MODULE_DEVICE_TABLE(of, da9210_dt_ids); | ||
| 187 | |||
| 182 | static int da9210_i2c_probe(struct i2c_client *i2c, | 188 | static int da9210_i2c_probe(struct i2c_client *i2c, |
| 183 | const struct i2c_device_id *id) | 189 | const struct i2c_device_id *id) |
| 184 | { | 190 | { |
| @@ -188,6 +194,16 @@ static int da9210_i2c_probe(struct i2c_client *i2c, | |||
| 188 | struct regulator_dev *rdev = NULL; | 194 | struct regulator_dev *rdev = NULL; |
| 189 | struct regulator_config config = { }; | 195 | struct regulator_config config = { }; |
| 190 | int error; | 196 | int error; |
| 197 | const struct of_device_id *match; | ||
| 198 | |||
| 199 | if (i2c->dev.of_node && !pdata) { | ||
| 200 | match = of_match_device(of_match_ptr(da9210_dt_ids), | ||
| 201 | &i2c->dev); | ||
| 202 | if (!match) { | ||
| 203 | dev_err(&i2c->dev, "Error: No device match found\n"); | ||
| 204 | return -ENODEV; | ||
| 205 | } | ||
| 206 | } | ||
| 191 | 207 | ||
| 192 | chip = devm_kzalloc(&i2c->dev, sizeof(struct da9210), GFP_KERNEL); | 208 | chip = devm_kzalloc(&i2c->dev, sizeof(struct da9210), GFP_KERNEL); |
| 193 | if (!chip) | 209 | if (!chip) |
| @@ -264,6 +280,7 @@ MODULE_DEVICE_TABLE(i2c, da9210_i2c_id); | |||
| 264 | static struct i2c_driver da9210_regulator_driver = { | 280 | static struct i2c_driver da9210_regulator_driver = { |
| 265 | .driver = { | 281 | .driver = { |
| 266 | .name = "da9210", | 282 | .name = "da9210", |
| 283 | .of_match_table = of_match_ptr(da9210_dt_ids), | ||
| 267 | }, | 284 | }, |
| 268 | .probe = da9210_i2c_probe, | 285 | .probe = da9210_i2c_probe, |
| 269 | .id_table = da9210_i2c_id, | 286 | .id_table = da9210_i2c_id, |
diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c index 236abf473db5..aa47280efd32 100644 --- a/drivers/regulator/da9211-regulator.c +++ b/drivers/regulator/da9211-regulator.c | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * da9211-regulator.c - Regulator device driver for DA9211/DA9213/DA9215 | 2 | * da9211-regulator.c - Regulator device driver for DA9211/DA9212 |
| 3 | * /DA9213/DA9214/DA9215 | ||
| 3 | * Copyright (C) 2015 Dialog Semiconductor Ltd. | 4 | * Copyright (C) 2015 Dialog Semiconductor Ltd. |
| 4 | * | 5 | * |
| 5 | * This library is free software; you can redistribute it and/or | 6 | * This library is free software; you can redistribute it and/or |
| @@ -493,7 +494,9 @@ static int da9211_i2c_probe(struct i2c_client *i2c, | |||
| 493 | 494 | ||
| 494 | static const struct i2c_device_id da9211_i2c_id[] = { | 495 | static const struct i2c_device_id da9211_i2c_id[] = { |
| 495 | {"da9211", DA9211}, | 496 | {"da9211", DA9211}, |
| 497 | {"da9212", DA9212}, | ||
| 496 | {"da9213", DA9213}, | 498 | {"da9213", DA9213}, |
| 499 | {"da9214", DA9214}, | ||
| 497 | {"da9215", DA9215}, | 500 | {"da9215", DA9215}, |
| 498 | {}, | 501 | {}, |
| 499 | }; | 502 | }; |
| @@ -502,8 +505,10 @@ MODULE_DEVICE_TABLE(i2c, da9211_i2c_id); | |||
| 502 | #ifdef CONFIG_OF | 505 | #ifdef CONFIG_OF |
| 503 | static const struct of_device_id da9211_dt_ids[] = { | 506 | static const struct of_device_id da9211_dt_ids[] = { |
| 504 | { .compatible = "dlg,da9211", .data = &da9211_i2c_id[0] }, | 507 | { .compatible = "dlg,da9211", .data = &da9211_i2c_id[0] }, |
| 505 | { .compatible = "dlg,da9213", .data = &da9211_i2c_id[1] }, | 508 | { .compatible = "dlg,da9212", .data = &da9211_i2c_id[1] }, |
| 506 | { .compatible = "dlg,da9215", .data = &da9211_i2c_id[2] }, | 509 | { .compatible = "dlg,da9213", .data = &da9211_i2c_id[2] }, |
| 510 | { .compatible = "dlg,da9214", .data = &da9211_i2c_id[3] }, | ||
| 511 | { .compatible = "dlg,da9215", .data = &da9211_i2c_id[4] }, | ||
| 507 | {}, | 512 | {}, |
| 508 | }; | 513 | }; |
| 509 | MODULE_DEVICE_TABLE(of, da9211_dt_ids); | 514 | MODULE_DEVICE_TABLE(of, da9211_dt_ids); |
| @@ -521,5 +526,5 @@ static struct i2c_driver da9211_regulator_driver = { | |||
| 521 | module_i2c_driver(da9211_regulator_driver); | 526 | module_i2c_driver(da9211_regulator_driver); |
| 522 | 527 | ||
| 523 | MODULE_AUTHOR("James Ban <James.Ban.opensource@diasemi.com>"); | 528 | MODULE_AUTHOR("James Ban <James.Ban.opensource@diasemi.com>"); |
| 524 | MODULE_DESCRIPTION("Regulator device driver for Dialog DA9211/DA9213/DA9215"); | 529 | MODULE_DESCRIPTION("DA9211/DA9212/DA9213/DA9214/DA9215 regulator driver"); |
| 525 | MODULE_LICENSE("GPL"); | 530 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/regulator/da9211-regulator.h b/drivers/regulator/da9211-regulator.h index d6ad96fc64d3..b841bbf330cc 100644 --- a/drivers/regulator/da9211-regulator.h +++ b/drivers/regulator/da9211-regulator.h | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * da9211-regulator.h - Regulator definitions for DA9211/DA9213/DA9215 | 2 | * da9211-regulator.h - Regulator definitions for DA9211/DA9212 |
| 3 | * /DA9213/DA9214/DA9215 | ||
| 3 | * Copyright (C) 2015 Dialog Semiconductor Ltd. | 4 | * Copyright (C) 2015 Dialog Semiconductor Ltd. |
| 4 | * | 5 | * |
| 5 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index ff62d69ba0be..988a7472c2ab 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c | |||
| @@ -79,18 +79,8 @@ of_get_fixed_voltage_config(struct device *dev, | |||
| 79 | config->enabled_at_boot = true; | 79 | config->enabled_at_boot = true; |
| 80 | 80 | ||
| 81 | config->gpio = of_get_named_gpio(np, "gpio", 0); | 81 | config->gpio = of_get_named_gpio(np, "gpio", 0); |
| 82 | /* | 82 | if ((config->gpio < 0) && (config->gpio != -ENOENT)) |
| 83 | * of_get_named_gpio() currently returns ENODEV rather than | 83 | return ERR_PTR(config->gpio); |
| 84 | * EPROBE_DEFER. This code attempts to be compatible with both | ||
| 85 | * for now; the ENODEV check can be removed once the API is fixed. | ||
| 86 | * of_get_named_gpio() doesn't differentiate between a missing | ||
| 87 | * property (which would be fine here, since the GPIO is optional) | ||
| 88 | * and some other error. Patches have been posted for both issues. | ||
| 89 | * Once they are check in, we should replace this with: | ||
| 90 | * if (config->gpio < 0 && config->gpio != -ENOENT) | ||
| 91 | */ | ||
| 92 | if ((config->gpio == -ENODEV) || (config->gpio == -EPROBE_DEFER)) | ||
| 93 | return ERR_PTR(-EPROBE_DEFER); | ||
| 94 | 84 | ||
| 95 | of_property_read_u32(np, "startup-delay-us", &config->startup_delay); | 85 | of_property_read_u32(np, "startup-delay-us", &config->startup_delay); |
| 96 | 86 | ||
diff --git a/drivers/regulator/lp873x-regulator.c b/drivers/regulator/lp873x-regulator.c index b4ffd113ba21..e504b9148226 100644 --- a/drivers/regulator/lp873x-regulator.c +++ b/drivers/regulator/lp873x-regulator.c | |||
| @@ -20,7 +20,7 @@ | |||
| 20 | #include <linux/mfd/lp873x.h> | 20 | #include <linux/mfd/lp873x.h> |
| 21 | 21 | ||
| 22 | #define LP873X_REGULATOR(_name, _id, _of, _ops, _n, _vr, _vm, _er, _em, \ | 22 | #define LP873X_REGULATOR(_name, _id, _of, _ops, _n, _vr, _vm, _er, _em, \ |
| 23 | _delay, _lr, _nlr, _cr) \ | 23 | _delay, _lr, _cr) \ |
| 24 | [_id] = { \ | 24 | [_id] = { \ |
| 25 | .desc = { \ | 25 | .desc = { \ |
| 26 | .name = _name, \ | 26 | .name = _name, \ |
| @@ -37,7 +37,7 @@ | |||
| 37 | .enable_mask = _em, \ | 37 | .enable_mask = _em, \ |
| 38 | .ramp_delay = _delay, \ | 38 | .ramp_delay = _delay, \ |
| 39 | .linear_ranges = _lr, \ | 39 | .linear_ranges = _lr, \ |
| 40 | .n_linear_ranges = _nlr, \ | 40 | .n_linear_ranges = ARRAY_SIZE(_lr), \ |
| 41 | }, \ | 41 | }, \ |
| 42 | .ctrl2_reg = _cr, \ | 42 | .ctrl2_reg = _cr, \ |
| 43 | } | 43 | } |
| @@ -175,22 +175,20 @@ static const struct lp873x_regulator regulators[] = { | |||
| 175 | 256, LP873X_REG_BUCK0_VOUT, | 175 | 256, LP873X_REG_BUCK0_VOUT, |
| 176 | LP873X_BUCK0_VOUT_BUCK0_VSET, LP873X_REG_BUCK0_CTRL_1, | 176 | LP873X_BUCK0_VOUT_BUCK0_VSET, LP873X_REG_BUCK0_CTRL_1, |
| 177 | LP873X_BUCK0_CTRL_1_BUCK0_EN, 10000, | 177 | LP873X_BUCK0_CTRL_1_BUCK0_EN, 10000, |
| 178 | buck0_buck1_ranges, 4, LP873X_REG_BUCK0_CTRL_2), | 178 | buck0_buck1_ranges, LP873X_REG_BUCK0_CTRL_2), |
| 179 | LP873X_REGULATOR("BUCK1", LP873X_BUCK_1, "buck1", lp873x_buck01_ops, | 179 | LP873X_REGULATOR("BUCK1", LP873X_BUCK_1, "buck1", lp873x_buck01_ops, |
| 180 | 256, LP873X_REG_BUCK1_VOUT, | 180 | 256, LP873X_REG_BUCK1_VOUT, |
| 181 | LP873X_BUCK1_VOUT_BUCK1_VSET, LP873X_REG_BUCK1_CTRL_1, | 181 | LP873X_BUCK1_VOUT_BUCK1_VSET, LP873X_REG_BUCK1_CTRL_1, |
| 182 | LP873X_BUCK1_CTRL_1_BUCK1_EN, 10000, | 182 | LP873X_BUCK1_CTRL_1_BUCK1_EN, 10000, |
| 183 | buck0_buck1_ranges, 4, LP873X_REG_BUCK1_CTRL_2), | 183 | buck0_buck1_ranges, LP873X_REG_BUCK1_CTRL_2), |
| 184 | LP873X_REGULATOR("LDO0", LP873X_LDO_0, "ldo0", lp873x_ldo01_ops, 26, | 184 | LP873X_REGULATOR("LDO0", LP873X_LDO_0, "ldo0", lp873x_ldo01_ops, 26, |
| 185 | LP873X_REG_LDO0_VOUT, LP873X_LDO0_VOUT_LDO0_VSET, | 185 | LP873X_REG_LDO0_VOUT, LP873X_LDO0_VOUT_LDO0_VSET, |
| 186 | LP873X_REG_LDO0_CTRL, | 186 | LP873X_REG_LDO0_CTRL, |
| 187 | LP873X_LDO0_CTRL_LDO0_EN, 0, ldo0_ldo1_ranges, 1, | 187 | LP873X_LDO0_CTRL_LDO0_EN, 0, ldo0_ldo1_ranges, 0xFF), |
| 188 | 0xFF), | ||
| 189 | LP873X_REGULATOR("LDO1", LP873X_LDO_1, "ldo1", lp873x_ldo01_ops, 26, | 188 | LP873X_REGULATOR("LDO1", LP873X_LDO_1, "ldo1", lp873x_ldo01_ops, 26, |
| 190 | LP873X_REG_LDO1_VOUT, LP873X_LDO1_VOUT_LDO1_VSET, | 189 | LP873X_REG_LDO1_VOUT, LP873X_LDO1_VOUT_LDO1_VSET, |
| 191 | LP873X_REG_LDO1_CTRL, | 190 | LP873X_REG_LDO1_CTRL, |
| 192 | LP873X_LDO1_CTRL_LDO1_EN, 0, ldo0_ldo1_ranges, 1, | 191 | LP873X_LDO1_CTRL_LDO1_EN, 0, ldo0_ldo1_ranges, 0xFF), |
| 193 | 0xFF), | ||
| 194 | }; | 192 | }; |
| 195 | 193 | ||
| 196 | static int lp873x_regulator_probe(struct platform_device *pdev) | 194 | static int lp873x_regulator_probe(struct platform_device *pdev) |
diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c index 08d2f13eca00..3958f50c5975 100644 --- a/drivers/regulator/max8973-regulator.c +++ b/drivers/regulator/max8973-regulator.c | |||
| @@ -271,22 +271,18 @@ static int max8973_set_ramp_delay(struct regulator_dev *rdev, | |||
| 271 | struct max8973_chip *max = rdev_get_drvdata(rdev); | 271 | struct max8973_chip *max = rdev_get_drvdata(rdev); |
| 272 | unsigned int control; | 272 | unsigned int control; |
| 273 | int ret; | 273 | int ret; |
| 274 | int ret_val; | ||
| 275 | 274 | ||
| 276 | /* Set ramp delay */ | 275 | /* Set ramp delay */ |
| 277 | if (ramp_delay < 25000) { | 276 | if (ramp_delay <= 12000) |
| 278 | control = MAX8973_RAMP_12mV_PER_US; | 277 | control = MAX8973_RAMP_12mV_PER_US; |
| 279 | ret_val = 12000; | 278 | else if (ramp_delay <= 25000) |
| 280 | } else if (ramp_delay < 50000) { | ||
| 281 | control = MAX8973_RAMP_25mV_PER_US; | 279 | control = MAX8973_RAMP_25mV_PER_US; |
| 282 | ret_val = 25000; | 280 | else if (ramp_delay <= 50000) |
| 283 | } else if (ramp_delay < 200000) { | ||
| 284 | control = MAX8973_RAMP_50mV_PER_US; | 281 | control = MAX8973_RAMP_50mV_PER_US; |
| 285 | ret_val = 50000; | 282 | else if (ramp_delay <= 200000) |
| 286 | } else { | ||
| 287 | control = MAX8973_RAMP_200mV_PER_US; | 283 | control = MAX8973_RAMP_200mV_PER_US; |
| 288 | ret_val = 200000; | 284 | else |
| 289 | } | 285 | return -EINVAL; |
| 290 | 286 | ||
| 291 | ret = regmap_update_bits(max->regmap, MAX8973_CONTROL1, | 287 | ret = regmap_update_bits(max->regmap, MAX8973_CONTROL1, |
| 292 | MAX8973_RAMP_MASK, control); | 288 | MAX8973_RAMP_MASK, control); |
diff --git a/drivers/regulator/mt6323-regulator.c b/drivers/regulator/mt6323-regulator.c new file mode 100644 index 000000000000..b7b9670f0979 --- /dev/null +++ b/drivers/regulator/mt6323-regulator.c | |||
| @@ -0,0 +1,425 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2016 MediaTek Inc. | ||
| 3 | * Author: Chen Zhong <chen.zhong@mediatek.com> | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License version 2 as | ||
| 7 | * published by the Free Software Foundation. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <linux/module.h> | ||
| 11 | #include <linux/of.h> | ||
| 12 | #include <linux/platform_device.h> | ||
| 13 | #include <linux/regmap.h> | ||
| 14 | #include <linux/mfd/mt6397/core.h> | ||
| 15 | #include <linux/mfd/mt6323/registers.h> | ||
| 16 | #include <linux/regulator/driver.h> | ||
| 17 | #include <linux/regulator/machine.h> | ||
| 18 | #include <linux/regulator/mt6323-regulator.h> | ||
| 19 | #include <linux/regulator/of_regulator.h> | ||
| 20 | |||
| 21 | #define MT6323_LDO_MODE_NORMAL 0 | ||
| 22 | #define MT6323_LDO_MODE_LP 1 | ||
| 23 | |||
| 24 | /* | ||
| 25 | * MT6323 regulators' information | ||
| 26 | * | ||
| 27 | * @desc: standard fields of regulator description. | ||
| 28 | * @qi: Mask for query enable signal status of regulators | ||
| 29 | * @vselon_reg: Register sections for hardware control mode of bucks | ||
| 30 | * @vselctrl_reg: Register for controlling the buck control mode. | ||
| 31 | * @vselctrl_mask: Mask for query buck's voltage control mode. | ||
| 32 | */ | ||
| 33 | struct mt6323_regulator_info { | ||
| 34 | struct regulator_desc desc; | ||
| 35 | u32 qi; | ||
| 36 | u32 vselon_reg; | ||
| 37 | u32 vselctrl_reg; | ||
| 38 | u32 vselctrl_mask; | ||
| 39 | u32 modeset_reg; | ||
| 40 | u32 modeset_mask; | ||
| 41 | }; | ||
| 42 | |||
| 43 | #define MT6323_BUCK(match, vreg, min, max, step, volt_ranges, enreg, \ | ||
| 44 | vosel, vosel_mask, voselon, vosel_ctrl) \ | ||
| 45 | [MT6323_ID_##vreg] = { \ | ||
| 46 | .desc = { \ | ||
| 47 | .name = #vreg, \ | ||
| 48 | .of_match = of_match_ptr(match), \ | ||
| 49 | .ops = &mt6323_volt_range_ops, \ | ||
| 50 | .type = REGULATOR_VOLTAGE, \ | ||
| 51 | .id = MT6323_ID_##vreg, \ | ||
| 52 | .owner = THIS_MODULE, \ | ||
| 53 | .n_voltages = (max - min)/step + 1, \ | ||
| 54 | .linear_ranges = volt_ranges, \ | ||
| 55 | .n_linear_ranges = ARRAY_SIZE(volt_ranges), \ | ||
| 56 | .vsel_reg = vosel, \ | ||
| 57 | .vsel_mask = vosel_mask, \ | ||
| 58 | .enable_reg = enreg, \ | ||
| 59 | .enable_mask = BIT(0), \ | ||
| 60 | }, \ | ||
| 61 | .qi = BIT(13), \ | ||
| 62 | .vselon_reg = voselon, \ | ||
| 63 | .vselctrl_reg = vosel_ctrl, \ | ||
| 64 | .vselctrl_mask = BIT(1), \ | ||
| 65 | } | ||
| 66 | |||
| 67 | #define MT6323_LDO(match, vreg, ldo_volt_table, enreg, enbit, vosel, \ | ||
| 68 | vosel_mask, _modeset_reg, _modeset_mask) \ | ||
| 69 | [MT6323_ID_##vreg] = { \ | ||
| 70 | .desc = { \ | ||
| 71 | .name = #vreg, \ | ||
| 72 | .of_match = of_match_ptr(match), \ | ||
| 73 | .ops = &mt6323_volt_table_ops, \ | ||
| 74 | .type = REGULATOR_VOLTAGE, \ | ||
| 75 | .id = MT6323_ID_##vreg, \ | ||
| 76 | .owner = THIS_MODULE, \ | ||
| 77 | .n_voltages = ARRAY_SIZE(ldo_volt_table), \ | ||
| 78 | .volt_table = ldo_volt_table, \ | ||
| 79 | .vsel_reg = vosel, \ | ||
| 80 | .vsel_mask = vosel_mask, \ | ||
| 81 | .enable_reg = enreg, \ | ||
| 82 | .enable_mask = BIT(enbit), \ | ||
| 83 | }, \ | ||
| 84 | .qi = BIT(15), \ | ||
| 85 | .modeset_reg = _modeset_reg, \ | ||
| 86 | .modeset_mask = _modeset_mask, \ | ||
| 87 | } | ||
| 88 | |||
| 89 | #define MT6323_REG_FIXED(match, vreg, enreg, enbit, volt, \ | ||
| 90 | _modeset_reg, _modeset_mask) \ | ||
| 91 | [MT6323_ID_##vreg] = { \ | ||
| 92 | .desc = { \ | ||
| 93 | .name = #vreg, \ | ||
| 94 | .of_match = of_match_ptr(match), \ | ||
| 95 | .ops = &mt6323_volt_fixed_ops, \ | ||
| 96 | .type = REGULATOR_VOLTAGE, \ | ||
| 97 | .id = MT6323_ID_##vreg, \ | ||
| 98 | .owner = THIS_MODULE, \ | ||
| 99 | .n_voltages = 1, \ | ||
| 100 | .enable_reg = enreg, \ | ||
| 101 | .enable_mask = BIT(enbit), \ | ||
| 102 | .min_uV = volt, \ | ||
| 103 | }, \ | ||
| 104 | .qi = BIT(15), \ | ||
| 105 | .modeset_reg = _modeset_reg, \ | ||
| 106 | .modeset_mask = _modeset_mask, \ | ||
| 107 | } | ||
| 108 | |||
| 109 | static const struct regulator_linear_range buck_volt_range1[] = { | ||
| 110 | REGULATOR_LINEAR_RANGE(700000, 0, 0x7f, 6250), | ||
| 111 | }; | ||
| 112 | |||
| 113 | static const struct regulator_linear_range buck_volt_range2[] = { | ||
| 114 | REGULATOR_LINEAR_RANGE(1400000, 0, 0x7f, 12500), | ||
| 115 | }; | ||
| 116 | |||
| 117 | static const struct regulator_linear_range buck_volt_range3[] = { | ||
| 118 | REGULATOR_LINEAR_RANGE(500000, 0, 0x3f, 50000), | ||
| 119 | }; | ||
| 120 | |||
| 121 | static const u32 ldo_volt_table1[] = { | ||
| 122 | 3300000, 3400000, 3500000, 3600000, | ||
| 123 | }; | ||
| 124 | |||
| 125 | static const u32 ldo_volt_table2[] = { | ||
| 126 | 1500000, 1800000, 2500000, 2800000, | ||
| 127 | }; | ||
| 128 | |||
| 129 | static const u32 ldo_volt_table3[] = { | ||
| 130 | 1800000, 3300000, | ||
| 131 | }; | ||
| 132 | |||
| 133 | static const u32 ldo_volt_table4[] = { | ||
| 134 | 3000000, 3300000, | ||
| 135 | }; | ||
| 136 | |||
| 137 | static const u32 ldo_volt_table5[] = { | ||
| 138 | 1200000, 1300000, 1500000, 1800000, 2000000, 2800000, 3000000, 3300000, | ||
| 139 | }; | ||
| 140 | |||
| 141 | static const u32 ldo_volt_table6[] = { | ||
| 142 | 1200000, 1300000, 1500000, 1800000, 2500000, 2800000, 3000000, 2000000, | ||
| 143 | }; | ||
| 144 | |||
| 145 | static const u32 ldo_volt_table7[] = { | ||
| 146 | 1200000, 1300000, 1500000, 1800000, | ||
| 147 | }; | ||
| 148 | |||
| 149 | static const u32 ldo_volt_table8[] = { | ||
| 150 | 1800000, 3000000, | ||
| 151 | }; | ||
| 152 | |||
| 153 | static const u32 ldo_volt_table9[] = { | ||
| 154 | 1200000, 1350000, 1500000, 1800000, | ||
| 155 | }; | ||
| 156 | |||
| 157 | static const u32 ldo_volt_table10[] = { | ||
| 158 | 1200000, 1300000, 1500000, 1800000, | ||
| 159 | }; | ||
| 160 | |||
| 161 | static int mt6323_get_status(struct regulator_dev *rdev) | ||
| 162 | { | ||
| 163 | int ret; | ||
| 164 | u32 regval; | ||
| 165 | struct mt6323_regulator_info *info = rdev_get_drvdata(rdev); | ||
| 166 | |||
| 167 | ret = regmap_read(rdev->regmap, info->desc.enable_reg, ®val); | ||
| 168 | if (ret != 0) { | ||
| 169 | dev_err(&rdev->dev, "Failed to get enable reg: %d\n", ret); | ||
| 170 | return ret; | ||
| 171 | } | ||
| 172 | |||
| 173 | return (regval & info->qi) ? REGULATOR_STATUS_ON : REGULATOR_STATUS_OFF; | ||
| 174 | } | ||
| 175 | |||
| 176 | static int mt6323_ldo_set_mode(struct regulator_dev *rdev, unsigned int mode) | ||
| 177 | { | ||
| 178 | int ret, val = 0; | ||
| 179 | struct mt6323_regulator_info *info = rdev_get_drvdata(rdev); | ||
| 180 | |||
| 181 | if (!info->modeset_mask) { | ||
| 182 | dev_err(&rdev->dev, "regulator %s doesn't support set_mode\n", | ||
| 183 | info->desc.name); | ||
| 184 | return -EINVAL; | ||
| 185 | } | ||
| 186 | |||
| 187 | switch (mode) { | ||
| 188 | case REGULATOR_MODE_STANDBY: | ||
| 189 | val = MT6323_LDO_MODE_LP; | ||
| 190 | break; | ||
| 191 | case REGULATOR_MODE_NORMAL: | ||
| 192 | val = MT6323_LDO_MODE_NORMAL; | ||
| 193 | break; | ||
| 194 | default: | ||
| 195 | return -EINVAL; | ||
| 196 | } | ||
| 197 | |||
| 198 | val <<= ffs(info->modeset_mask) - 1; | ||
| 199 | |||
| 200 | ret = regmap_update_bits(rdev->regmap, info->modeset_reg, | ||
| 201 | info->modeset_mask, val); | ||
| 202 | |||
| 203 | return ret; | ||
| 204 | } | ||
| 205 | |||
| 206 | static unsigned int mt6323_ldo_get_mode(struct regulator_dev *rdev) | ||
| 207 | { | ||
| 208 | unsigned int val; | ||
| 209 | unsigned int mode; | ||
| 210 | int ret; | ||
| 211 | struct mt6323_regulator_info *info = rdev_get_drvdata(rdev); | ||
| 212 | |||
| 213 | if (!info->modeset_mask) { | ||
| 214 | dev_err(&rdev->dev, "regulator %s doesn't support get_mode\n", | ||
| 215 | info->desc.name); | ||
| 216 | return -EINVAL; | ||
| 217 | } | ||
| 218 | |||
| 219 | ret = regmap_read(rdev->regmap, info->modeset_reg, &val); | ||
| 220 | if (ret < 0) | ||
| 221 | return ret; | ||
| 222 | |||
| 223 | val &= info->modeset_mask; | ||
| 224 | val >>= ffs(info->modeset_mask) - 1; | ||
| 225 | |||
| 226 | if (val & 0x1) | ||
| 227 | mode = REGULATOR_MODE_STANDBY; | ||
| 228 | else | ||
| 229 | mode = REGULATOR_MODE_NORMAL; | ||
| 230 | |||
| 231 | return mode; | ||
| 232 | } | ||
| 233 | |||
| 234 | static const struct regulator_ops mt6323_volt_range_ops = { | ||
| 235 | .list_voltage = regulator_list_voltage_linear_range, | ||
| 236 | .map_voltage = regulator_map_voltage_linear_range, | ||
| 237 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | ||
| 238 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
| 239 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | ||
| 240 | .enable = regulator_enable_regmap, | ||
| 241 | .disable = regulator_disable_regmap, | ||
| 242 | .is_enabled = regulator_is_enabled_regmap, | ||
| 243 | .get_status = mt6323_get_status, | ||
| 244 | }; | ||
| 245 | |||
| 246 | static const struct regulator_ops mt6323_volt_table_ops = { | ||
| 247 | .list_voltage = regulator_list_voltage_table, | ||
| 248 | .map_voltage = regulator_map_voltage_iterate, | ||
| 249 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | ||
| 250 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
| 251 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | ||
| 252 | .enable = regulator_enable_regmap, | ||
| 253 | .disable = regulator_disable_regmap, | ||
| 254 | .is_enabled = regulator_is_enabled_regmap, | ||
| 255 | .get_status = mt6323_get_status, | ||
| 256 | .set_mode = mt6323_ldo_set_mode, | ||
| 257 | .get_mode = mt6323_ldo_get_mode, | ||
| 258 | }; | ||
| 259 | |||
| 260 | static const struct regulator_ops mt6323_volt_fixed_ops = { | ||
| 261 | .list_voltage = regulator_list_voltage_linear, | ||
| 262 | .enable = regulator_enable_regmap, | ||
| 263 | .disable = regulator_disable_regmap, | ||
| 264 | .is_enabled = regulator_is_enabled_regmap, | ||
| 265 | .get_status = mt6323_get_status, | ||
| 266 | .set_mode = mt6323_ldo_set_mode, | ||
| 267 | .get_mode = mt6323_ldo_get_mode, | ||
| 268 | }; | ||
| 269 | |||
| 270 | /* The array is indexed by id(MT6323_ID_XXX) */ | ||
| 271 | static struct mt6323_regulator_info mt6323_regulators[] = { | ||
| 272 | MT6323_BUCK("buck_vproc", VPROC, 700000, 1493750, 6250, | ||
| 273 | buck_volt_range1, MT6323_VPROC_CON7, MT6323_VPROC_CON9, 0x7f, | ||
| 274 | MT6323_VPROC_CON10, MT6323_VPROC_CON5), | ||
| 275 | MT6323_BUCK("buck_vsys", VSYS, 1400000, 2987500, 12500, | ||
| 276 | buck_volt_range2, MT6323_VSYS_CON7, MT6323_VSYS_CON9, 0x7f, | ||
| 277 | MT6323_VSYS_CON10, MT6323_VSYS_CON5), | ||
| 278 | MT6323_BUCK("buck_vpa", VPA, 500000, 3650000, 50000, | ||
| 279 | buck_volt_range3, MT6323_VPA_CON7, MT6323_VPA_CON9, | ||
| 280 | 0x3f, MT6323_VPA_CON10, MT6323_VPA_CON5), | ||
| 281 | MT6323_REG_FIXED("ldo_vtcxo", VTCXO, MT6323_ANALDO_CON1, 10, 2800000, | ||
| 282 | MT6323_ANALDO_CON1, 0x2), | ||
| 283 | MT6323_REG_FIXED("ldo_vcn28", VCN28, MT6323_ANALDO_CON19, 12, 2800000, | ||
| 284 | MT6323_ANALDO_CON20, 0x2), | ||
| 285 | MT6323_LDO("ldo_vcn33_bt", VCN33_BT, ldo_volt_table1, | ||
| 286 | MT6323_ANALDO_CON16, 7, MT6323_ANALDO_CON16, 0xC, | ||
| 287 | MT6323_ANALDO_CON21, 0x2), | ||
| 288 | MT6323_LDO("ldo_vcn33_wifi", VCN33_WIFI, ldo_volt_table1, | ||
| 289 | MT6323_ANALDO_CON17, 12, MT6323_ANALDO_CON16, 0xC, | ||
| 290 | MT6323_ANALDO_CON21, 0x2), | ||
| 291 | MT6323_REG_FIXED("ldo_va", VA, MT6323_ANALDO_CON2, 14, 2800000, | ||
| 292 | MT6323_ANALDO_CON2, 0x2), | ||
| 293 | MT6323_LDO("ldo_vcama", VCAMA, ldo_volt_table2, | ||
| 294 | MT6323_ANALDO_CON4, 15, MT6323_ANALDO_CON10, 0x60, -1, 0), | ||
| 295 | MT6323_REG_FIXED("ldo_vio28", VIO28, MT6323_DIGLDO_CON0, 14, 2800000, | ||
| 296 | MT6323_DIGLDO_CON0, 0x2), | ||
| 297 | MT6323_REG_FIXED("ldo_vusb", VUSB, MT6323_DIGLDO_CON2, 14, 3300000, | ||
| 298 | MT6323_DIGLDO_CON2, 0x2), | ||
| 299 | MT6323_LDO("ldo_vmc", VMC, ldo_volt_table3, | ||
| 300 | MT6323_DIGLDO_CON3, 12, MT6323_DIGLDO_CON24, 0x10, | ||
| 301 | MT6323_DIGLDO_CON3, 0x2), | ||
| 302 | MT6323_LDO("ldo_vmch", VMCH, ldo_volt_table4, | ||
| 303 | MT6323_DIGLDO_CON5, 14, MT6323_DIGLDO_CON26, 0x80, | ||
| 304 | MT6323_DIGLDO_CON5, 0x2), | ||
| 305 | MT6323_LDO("ldo_vemc3v3", VEMC3V3, ldo_volt_table4, | ||
| 306 | MT6323_DIGLDO_CON6, 14, MT6323_DIGLDO_CON27, 0x80, | ||
| 307 | MT6323_DIGLDO_CON6, 0x2), | ||
| 308 | MT6323_LDO("ldo_vgp1", VGP1, ldo_volt_table5, | ||
| 309 | MT6323_DIGLDO_CON7, 15, MT6323_DIGLDO_CON28, 0xE0, | ||
| 310 | MT6323_DIGLDO_CON7, 0x2), | ||
| 311 | MT6323_LDO("ldo_vgp2", VGP2, ldo_volt_table6, | ||
| 312 | MT6323_DIGLDO_CON8, 15, MT6323_DIGLDO_CON29, 0xE0, | ||
| 313 | MT6323_DIGLDO_CON8, 0x2), | ||
| 314 | MT6323_LDO("ldo_vgp3", VGP3, ldo_volt_table7, | ||
| 315 | MT6323_DIGLDO_CON9, 15, MT6323_DIGLDO_CON30, 0x60, | ||
| 316 | MT6323_DIGLDO_CON9, 0x2), | ||
| 317 | MT6323_REG_FIXED("ldo_vcn18", VCN18, MT6323_DIGLDO_CON11, 14, 1800000, | ||
| 318 | MT6323_DIGLDO_CON11, 0x2), | ||
| 319 | MT6323_LDO("ldo_vsim1", VSIM1, ldo_volt_table8, | ||
| 320 | MT6323_DIGLDO_CON13, 15, MT6323_DIGLDO_CON34, 0x20, | ||
| 321 | MT6323_DIGLDO_CON13, 0x2), | ||
| 322 | MT6323_LDO("ldo_vsim2", VSIM2, ldo_volt_table8, | ||
| 323 | MT6323_DIGLDO_CON14, 15, MT6323_DIGLDO_CON35, 0x20, | ||
| 324 | MT6323_DIGLDO_CON14, 0x2), | ||
| 325 | MT6323_REG_FIXED("ldo_vrtc", VRTC, MT6323_DIGLDO_CON15, 8, 2800000, | ||
| 326 | -1, 0), | ||
| 327 | MT6323_LDO("ldo_vcamaf", VCAMAF, ldo_volt_table5, | ||
| 328 | MT6323_DIGLDO_CON31, 15, MT6323_DIGLDO_CON32, 0xE0, | ||
| 329 | MT6323_DIGLDO_CON31, 0x2), | ||
| 330 | MT6323_LDO("ldo_vibr", VIBR, ldo_volt_table5, | ||
| 331 | MT6323_DIGLDO_CON39, 15, MT6323_DIGLDO_CON40, 0xE0, | ||
| 332 | MT6323_DIGLDO_CON39, 0x2), | ||
| 333 | MT6323_REG_FIXED("ldo_vrf18", VRF18, MT6323_DIGLDO_CON45, 15, 1825000, | ||
| 334 | MT6323_DIGLDO_CON45, 0x2), | ||
| 335 | MT6323_LDO("ldo_vm", VM, ldo_volt_table9, | ||
| 336 | MT6323_DIGLDO_CON47, 14, MT6323_DIGLDO_CON48, 0x30, | ||
| 337 | MT6323_DIGLDO_CON47, 0x2), | ||
| 338 | MT6323_REG_FIXED("ldo_vio18", VIO18, MT6323_DIGLDO_CON49, 14, 1800000, | ||
| 339 | MT6323_DIGLDO_CON49, 0x2), | ||
| 340 | MT6323_LDO("ldo_vcamd", VCAMD, ldo_volt_table10, | ||
| 341 | MT6323_DIGLDO_CON51, 14, MT6323_DIGLDO_CON52, 0x60, | ||
| 342 | MT6323_DIGLDO_CON51, 0x2), | ||
| 343 | MT6323_REG_FIXED("ldo_vcamio", VCAMIO, MT6323_DIGLDO_CON53, 14, 1800000, | ||
| 344 | MT6323_DIGLDO_CON53, 0x2), | ||
| 345 | }; | ||
| 346 | |||
| 347 | static int mt6323_set_buck_vosel_reg(struct platform_device *pdev) | ||
| 348 | { | ||
| 349 | struct mt6397_chip *mt6323 = dev_get_drvdata(pdev->dev.parent); | ||
| 350 | int i; | ||
| 351 | u32 regval; | ||
| 352 | |||
| 353 | for (i = 0; i < MT6323_MAX_REGULATOR; i++) { | ||
| 354 | if (mt6323_regulators[i].vselctrl_reg) { | ||
| 355 | if (regmap_read(mt6323->regmap, | ||
| 356 | mt6323_regulators[i].vselctrl_reg, | ||
| 357 | ®val) < 0) { | ||
| 358 | dev_err(&pdev->dev, | ||
| 359 | "Failed to read buck ctrl\n"); | ||
| 360 | return -EIO; | ||
| 361 | } | ||
| 362 | |||
| 363 | if (regval & mt6323_regulators[i].vselctrl_mask) { | ||
| 364 | mt6323_regulators[i].desc.vsel_reg = | ||
| 365 | mt6323_regulators[i].vselon_reg; | ||
| 366 | } | ||
| 367 | } | ||
| 368 | } | ||
| 369 | |||
| 370 | return 0; | ||
| 371 | } | ||
| 372 | |||
| 373 | static int mt6323_regulator_probe(struct platform_device *pdev) | ||
| 374 | { | ||
| 375 | struct mt6397_chip *mt6323 = dev_get_drvdata(pdev->dev.parent); | ||
| 376 | struct regulator_config config = {}; | ||
| 377 | struct regulator_dev *rdev; | ||
| 378 | int i; | ||
| 379 | u32 reg_value; | ||
| 380 | |||
| 381 | /* Query buck controller to select activated voltage register part */ | ||
| 382 | if (mt6323_set_buck_vosel_reg(pdev)) | ||
| 383 | return -EIO; | ||
| 384 | |||
| 385 | /* Read PMIC chip revision to update constraints and voltage table */ | ||
| 386 | if (regmap_read(mt6323->regmap, MT6323_CID, ®_value) < 0) { | ||
| 387 | dev_err(&pdev->dev, "Failed to read Chip ID\n"); | ||
| 388 | return -EIO; | ||
| 389 | } | ||
| 390 | dev_info(&pdev->dev, "Chip ID = 0x%x\n", reg_value); | ||
| 391 | |||
| 392 | for (i = 0; i < MT6323_MAX_REGULATOR; i++) { | ||
| 393 | config.dev = &pdev->dev; | ||
| 394 | config.driver_data = &mt6323_regulators[i]; | ||
| 395 | config.regmap = mt6323->regmap; | ||
| 396 | rdev = devm_regulator_register(&pdev->dev, | ||
| 397 | &mt6323_regulators[i].desc, &config); | ||
| 398 | if (IS_ERR(rdev)) { | ||
| 399 | dev_err(&pdev->dev, "failed to register %s\n", | ||
| 400 | mt6323_regulators[i].desc.name); | ||
| 401 | return PTR_ERR(rdev); | ||
| 402 | } | ||
| 403 | } | ||
| 404 | return 0; | ||
| 405 | } | ||
| 406 | |||
| 407 | static const struct platform_device_id mt6323_platform_ids[] = { | ||
| 408 | {"mt6323-regulator", 0}, | ||
| 409 | { /* sentinel */ }, | ||
| 410 | }; | ||
| 411 | MODULE_DEVICE_TABLE(platform, mt6323_platform_ids); | ||
| 412 | |||
| 413 | static struct platform_driver mt6323_regulator_driver = { | ||
| 414 | .driver = { | ||
| 415 | .name = "mt6323-regulator", | ||
| 416 | }, | ||
| 417 | .probe = mt6323_regulator_probe, | ||
| 418 | .id_table = mt6323_platform_ids, | ||
| 419 | }; | ||
| 420 | |||
| 421 | module_platform_driver(mt6323_regulator_driver); | ||
| 422 | |||
| 423 | MODULE_AUTHOR("Chen Zhong <chen.zhong@mediatek.com>"); | ||
| 424 | MODULE_DESCRIPTION("Regulator Driver for MediaTek MT6323 PMIC"); | ||
| 425 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/regulator/mt6397-regulator.c b/drivers/regulator/mt6397-regulator.c index 17a5b6c2d6a9..c6c6aa85e4e8 100644 --- a/drivers/regulator/mt6397-regulator.c +++ b/drivers/regulator/mt6397-regulator.c | |||
| @@ -23,6 +23,9 @@ | |||
| 23 | #include <linux/regulator/mt6397-regulator.h> | 23 | #include <linux/regulator/mt6397-regulator.h> |
| 24 | #include <linux/regulator/of_regulator.h> | 24 | #include <linux/regulator/of_regulator.h> |
| 25 | 25 | ||
| 26 | #define MT6397_BUCK_MODE_AUTO 0 | ||
| 27 | #define MT6397_BUCK_MODE_FORCE_PWM 1 | ||
| 28 | |||
| 26 | /* | 29 | /* |
| 27 | * MT6397 regulators' information | 30 | * MT6397 regulators' information |
| 28 | * | 31 | * |
| @@ -38,10 +41,14 @@ struct mt6397_regulator_info { | |||
| 38 | u32 vselon_reg; | 41 | u32 vselon_reg; |
| 39 | u32 vselctrl_reg; | 42 | u32 vselctrl_reg; |
| 40 | u32 vselctrl_mask; | 43 | u32 vselctrl_mask; |
| 44 | u32 modeset_reg; | ||
| 45 | u32 modeset_mask; | ||
| 46 | u32 modeset_shift; | ||
| 41 | }; | 47 | }; |
| 42 | 48 | ||
| 43 | #define MT6397_BUCK(match, vreg, min, max, step, volt_ranges, enreg, \ | 49 | #define MT6397_BUCK(match, vreg, min, max, step, volt_ranges, enreg, \ |
| 44 | vosel, vosel_mask, voselon, vosel_ctrl) \ | 50 | vosel, vosel_mask, voselon, vosel_ctrl, _modeset_reg, \ |
| 51 | _modeset_shift) \ | ||
| 45 | [MT6397_ID_##vreg] = { \ | 52 | [MT6397_ID_##vreg] = { \ |
| 46 | .desc = { \ | 53 | .desc = { \ |
| 47 | .name = #vreg, \ | 54 | .name = #vreg, \ |
| @@ -62,6 +69,9 @@ struct mt6397_regulator_info { | |||
| 62 | .vselon_reg = voselon, \ | 69 | .vselon_reg = voselon, \ |
| 63 | .vselctrl_reg = vosel_ctrl, \ | 70 | .vselctrl_reg = vosel_ctrl, \ |
| 64 | .vselctrl_mask = BIT(1), \ | 71 | .vselctrl_mask = BIT(1), \ |
| 72 | .modeset_reg = _modeset_reg, \ | ||
| 73 | .modeset_mask = BIT(_modeset_shift), \ | ||
| 74 | .modeset_shift = _modeset_shift \ | ||
| 65 | } | 75 | } |
| 66 | 76 | ||
| 67 | #define MT6397_LDO(match, vreg, ldo_volt_table, enreg, enbit, vosel, \ | 77 | #define MT6397_LDO(match, vreg, ldo_volt_table, enreg, enbit, vosel, \ |
| @@ -145,6 +155,63 @@ static const u32 ldo_volt_table7[] = { | |||
| 145 | 1300000, 1500000, 1800000, 2000000, 2500000, 2800000, 3000000, 3300000, | 155 | 1300000, 1500000, 1800000, 2000000, 2500000, 2800000, 3000000, 3300000, |
| 146 | }; | 156 | }; |
| 147 | 157 | ||
| 158 | static int mt6397_regulator_set_mode(struct regulator_dev *rdev, | ||
| 159 | unsigned int mode) | ||
| 160 | { | ||
| 161 | struct mt6397_regulator_info *info = rdev_get_drvdata(rdev); | ||
| 162 | int ret, val; | ||
| 163 | |||
| 164 | switch (mode) { | ||
| 165 | case REGULATOR_MODE_FAST: | ||
| 166 | val = MT6397_BUCK_MODE_FORCE_PWM; | ||
| 167 | break; | ||
| 168 | case REGULATOR_MODE_NORMAL: | ||
| 169 | val = MT6397_BUCK_MODE_AUTO; | ||
| 170 | break; | ||
| 171 | default: | ||
| 172 | ret = -EINVAL; | ||
| 173 | goto err_mode; | ||
| 174 | } | ||
| 175 | |||
| 176 | dev_dbg(&rdev->dev, "mt6397 buck set_mode %#x, %#x, %#x, %#x\n", | ||
| 177 | info->modeset_reg, info->modeset_mask, | ||
| 178 | info->modeset_shift, val); | ||
| 179 | |||
| 180 | val <<= info->modeset_shift; | ||
| 181 | ret = regmap_update_bits(rdev->regmap, info->modeset_reg, | ||
| 182 | info->modeset_mask, val); | ||
| 183 | err_mode: | ||
| 184 | if (ret != 0) { | ||
| 185 | dev_err(&rdev->dev, | ||
| 186 | "Failed to set mt6397 buck mode: %d\n", ret); | ||
| 187 | return ret; | ||
| 188 | } | ||
| 189 | |||
| 190 | return 0; | ||
| 191 | } | ||
| 192 | |||
| 193 | static unsigned int mt6397_regulator_get_mode(struct regulator_dev *rdev) | ||
| 194 | { | ||
| 195 | struct mt6397_regulator_info *info = rdev_get_drvdata(rdev); | ||
| 196 | int ret, regval; | ||
| 197 | |||
| 198 | ret = regmap_read(rdev->regmap, info->modeset_reg, ®val); | ||
| 199 | if (ret != 0) { | ||
| 200 | dev_err(&rdev->dev, | ||
| 201 | "Failed to get mt6397 buck mode: %d\n", ret); | ||
| 202 | return ret; | ||
| 203 | } | ||
| 204 | |||
| 205 | switch ((regval & info->modeset_mask) >> info->modeset_shift) { | ||
| 206 | case MT6397_BUCK_MODE_AUTO: | ||
| 207 | return REGULATOR_MODE_NORMAL; | ||
| 208 | case MT6397_BUCK_MODE_FORCE_PWM: | ||
| 209 | return REGULATOR_MODE_FAST; | ||
| 210 | default: | ||
| 211 | return -EINVAL; | ||
| 212 | } | ||
| 213 | } | ||
| 214 | |||
| 148 | static int mt6397_get_status(struct regulator_dev *rdev) | 215 | static int mt6397_get_status(struct regulator_dev *rdev) |
| 149 | { | 216 | { |
| 150 | int ret; | 217 | int ret; |
| @@ -160,7 +227,7 @@ static int mt6397_get_status(struct regulator_dev *rdev) | |||
| 160 | return (regval & info->qi) ? REGULATOR_STATUS_ON : REGULATOR_STATUS_OFF; | 227 | return (regval & info->qi) ? REGULATOR_STATUS_ON : REGULATOR_STATUS_OFF; |
| 161 | } | 228 | } |
| 162 | 229 | ||
| 163 | static struct regulator_ops mt6397_volt_range_ops = { | 230 | static const struct regulator_ops mt6397_volt_range_ops = { |
| 164 | .list_voltage = regulator_list_voltage_linear_range, | 231 | .list_voltage = regulator_list_voltage_linear_range, |
| 165 | .map_voltage = regulator_map_voltage_linear_range, | 232 | .map_voltage = regulator_map_voltage_linear_range, |
| 166 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 233 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
| @@ -170,9 +237,11 @@ static struct regulator_ops mt6397_volt_range_ops = { | |||
| 170 | .disable = regulator_disable_regmap, | 237 | .disable = regulator_disable_regmap, |
| 171 | .is_enabled = regulator_is_enabled_regmap, | 238 | .is_enabled = regulator_is_enabled_regmap, |
| 172 | .get_status = mt6397_get_status, | 239 | .get_status = mt6397_get_status, |
| 240 | .set_mode = mt6397_regulator_set_mode, | ||
| 241 | .get_mode = mt6397_regulator_get_mode, | ||
| 173 | }; | 242 | }; |
| 174 | 243 | ||
| 175 | static struct regulator_ops mt6397_volt_table_ops = { | 244 | static const struct regulator_ops mt6397_volt_table_ops = { |
| 176 | .list_voltage = regulator_list_voltage_table, | 245 | .list_voltage = regulator_list_voltage_table, |
| 177 | .map_voltage = regulator_map_voltage_iterate, | 246 | .map_voltage = regulator_map_voltage_iterate, |
| 178 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 247 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
| @@ -184,7 +253,7 @@ static struct regulator_ops mt6397_volt_table_ops = { | |||
| 184 | .get_status = mt6397_get_status, | 253 | .get_status = mt6397_get_status, |
| 185 | }; | 254 | }; |
| 186 | 255 | ||
| 187 | static struct regulator_ops mt6397_volt_fixed_ops = { | 256 | static const struct regulator_ops mt6397_volt_fixed_ops = { |
| 188 | .list_voltage = regulator_list_voltage_linear, | 257 | .list_voltage = regulator_list_voltage_linear, |
| 189 | .enable = regulator_enable_regmap, | 258 | .enable = regulator_enable_regmap, |
| 190 | .disable = regulator_disable_regmap, | 259 | .disable = regulator_disable_regmap, |
| @@ -196,28 +265,30 @@ static struct regulator_ops mt6397_volt_fixed_ops = { | |||
| 196 | static struct mt6397_regulator_info mt6397_regulators[] = { | 265 | static struct mt6397_regulator_info mt6397_regulators[] = { |
| 197 | MT6397_BUCK("buck_vpca15", VPCA15, 700000, 1493750, 6250, | 266 | MT6397_BUCK("buck_vpca15", VPCA15, 700000, 1493750, 6250, |
| 198 | buck_volt_range1, MT6397_VCA15_CON7, MT6397_VCA15_CON9, 0x7f, | 267 | buck_volt_range1, MT6397_VCA15_CON7, MT6397_VCA15_CON9, 0x7f, |
| 199 | MT6397_VCA15_CON10, MT6397_VCA15_CON5), | 268 | MT6397_VCA15_CON10, MT6397_VCA15_CON5, MT6397_VCA15_CON2, 11), |
| 200 | MT6397_BUCK("buck_vpca7", VPCA7, 700000, 1493750, 6250, | 269 | MT6397_BUCK("buck_vpca7", VPCA7, 700000, 1493750, 6250, |
| 201 | buck_volt_range1, MT6397_VPCA7_CON7, MT6397_VPCA7_CON9, 0x7f, | 270 | buck_volt_range1, MT6397_VPCA7_CON7, MT6397_VPCA7_CON9, 0x7f, |
| 202 | MT6397_VPCA7_CON10, MT6397_VPCA7_CON5), | 271 | MT6397_VPCA7_CON10, MT6397_VPCA7_CON5, MT6397_VPCA7_CON2, 8), |
| 203 | MT6397_BUCK("buck_vsramca15", VSRAMCA15, 700000, 1493750, 6250, | 272 | MT6397_BUCK("buck_vsramca15", VSRAMCA15, 700000, 1493750, 6250, |
| 204 | buck_volt_range1, MT6397_VSRMCA15_CON7, MT6397_VSRMCA15_CON9, | 273 | buck_volt_range1, MT6397_VSRMCA15_CON7, MT6397_VSRMCA15_CON9, |
| 205 | 0x7f, MT6397_VSRMCA15_CON10, MT6397_VSRMCA15_CON5), | 274 | 0x7f, MT6397_VSRMCA15_CON10, MT6397_VSRMCA15_CON5, |
| 275 | MT6397_VSRMCA15_CON2, 8), | ||
| 206 | MT6397_BUCK("buck_vsramca7", VSRAMCA7, 700000, 1493750, 6250, | 276 | MT6397_BUCK("buck_vsramca7", VSRAMCA7, 700000, 1493750, 6250, |
| 207 | buck_volt_range1, MT6397_VSRMCA7_CON7, MT6397_VSRMCA7_CON9, | 277 | buck_volt_range1, MT6397_VSRMCA7_CON7, MT6397_VSRMCA7_CON9, |
| 208 | 0x7f, MT6397_VSRMCA7_CON10, MT6397_VSRMCA7_CON5), | 278 | 0x7f, MT6397_VSRMCA7_CON10, MT6397_VSRMCA7_CON5, |
| 279 | MT6397_VSRMCA7_CON2, 8), | ||
| 209 | MT6397_BUCK("buck_vcore", VCORE, 700000, 1493750, 6250, | 280 | MT6397_BUCK("buck_vcore", VCORE, 700000, 1493750, 6250, |
| 210 | buck_volt_range1, MT6397_VCORE_CON7, MT6397_VCORE_CON9, 0x7f, | 281 | buck_volt_range1, MT6397_VCORE_CON7, MT6397_VCORE_CON9, 0x7f, |
| 211 | MT6397_VCORE_CON10, MT6397_VCORE_CON5), | 282 | MT6397_VCORE_CON10, MT6397_VCORE_CON5, MT6397_VCORE_CON2, 8), |
| 212 | MT6397_BUCK("buck_vgpu", VGPU, 700000, 1493750, 6250, buck_volt_range1, | 283 | MT6397_BUCK("buck_vgpu", VGPU, 700000, 1493750, 6250, buck_volt_range1, |
| 213 | MT6397_VGPU_CON7, MT6397_VGPU_CON9, 0x7f, | 284 | MT6397_VGPU_CON7, MT6397_VGPU_CON9, 0x7f, |
| 214 | MT6397_VGPU_CON10, MT6397_VGPU_CON5), | 285 | MT6397_VGPU_CON10, MT6397_VGPU_CON5, MT6397_VGPU_CON2, 8), |
| 215 | MT6397_BUCK("buck_vdrm", VDRM, 800000, 1593750, 6250, buck_volt_range2, | 286 | MT6397_BUCK("buck_vdrm", VDRM, 800000, 1593750, 6250, buck_volt_range2, |
| 216 | MT6397_VDRM_CON7, MT6397_VDRM_CON9, 0x7f, | 287 | MT6397_VDRM_CON7, MT6397_VDRM_CON9, 0x7f, |
| 217 | MT6397_VDRM_CON10, MT6397_VDRM_CON5), | 288 | MT6397_VDRM_CON10, MT6397_VDRM_CON5, MT6397_VDRM_CON2, 8), |
| 218 | MT6397_BUCK("buck_vio18", VIO18, 1500000, 2120000, 20000, | 289 | MT6397_BUCK("buck_vio18", VIO18, 1500000, 2120000, 20000, |
| 219 | buck_volt_range3, MT6397_VIO18_CON7, MT6397_VIO18_CON9, 0x1f, | 290 | buck_volt_range3, MT6397_VIO18_CON7, MT6397_VIO18_CON9, 0x1f, |
| 220 | MT6397_VIO18_CON10, MT6397_VIO18_CON5), | 291 | MT6397_VIO18_CON10, MT6397_VIO18_CON5, MT6397_VIO18_CON2, 8), |
| 221 | MT6397_REG_FIXED("ldo_vtcxo", VTCXO, MT6397_ANALDO_CON0, 10, 2800000), | 292 | MT6397_REG_FIXED("ldo_vtcxo", VTCXO, MT6397_ANALDO_CON0, 10, 2800000), |
| 222 | MT6397_REG_FIXED("ldo_va28", VA28, MT6397_ANALDO_CON1, 14, 2800000), | 293 | MT6397_REG_FIXED("ldo_va28", VA28, MT6397_ANALDO_CON1, 14, 2800000), |
| 223 | MT6397_LDO("ldo_vcama", VCAMA, ldo_volt_table1, | 294 | MT6397_LDO("ldo_vcama", VCAMA, ldo_volt_table1, |
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index cd828dbf9d52..4f613ec99500 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c | |||
| @@ -163,6 +163,9 @@ static void of_get_regulation_constraints(struct device_node *np, | |||
| 163 | "regulator-suspend-microvolt", &pval)) | 163 | "regulator-suspend-microvolt", &pval)) |
| 164 | suspend_state->uV = pval; | 164 | suspend_state->uV = pval; |
| 165 | 165 | ||
| 166 | if (i == PM_SUSPEND_MEM) | ||
| 167 | constraints->initial_state = PM_SUSPEND_MEM; | ||
| 168 | |||
| 166 | of_node_put(suspend_np); | 169 | of_node_put(suspend_np); |
| 167 | suspend_state = NULL; | 170 | suspend_state = NULL; |
| 168 | suspend_np = NULL; | 171 | suspend_np = NULL; |
diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c index 2a44e5dd9c2a..cb18b5c4f2db 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c | |||
| @@ -70,6 +70,7 @@ struct pfuze_chip { | |||
| 70 | struct device *dev; | 70 | struct device *dev; |
| 71 | struct pfuze_regulator regulator_descs[PFUZE100_MAX_REGULATOR]; | 71 | struct pfuze_regulator regulator_descs[PFUZE100_MAX_REGULATOR]; |
| 72 | struct regulator_dev *regulators[PFUZE100_MAX_REGULATOR]; | 72 | struct regulator_dev *regulators[PFUZE100_MAX_REGULATOR]; |
| 73 | struct pfuze_regulator *pfuze_regulators; | ||
| 73 | }; | 74 | }; |
| 74 | 75 | ||
| 75 | static const int pfuze100_swbst[] = { | 76 | static const int pfuze100_swbst[] = { |
| @@ -334,8 +335,6 @@ static struct pfuze_regulator pfuze3000_regulators[] = { | |||
| 334 | PFUZE100_VGEN_REG(PFUZE3000, VLDO4, PFUZE100_VGEN6VOL, 1800000, 3300000, 100000), | 335 | PFUZE100_VGEN_REG(PFUZE3000, VLDO4, PFUZE100_VGEN6VOL, 1800000, 3300000, 100000), |
| 335 | }; | 336 | }; |
| 336 | 337 | ||
| 337 | static struct pfuze_regulator *pfuze_regulators; | ||
| 338 | |||
| 339 | #ifdef CONFIG_OF | 338 | #ifdef CONFIG_OF |
| 340 | /* PFUZE100 */ | 339 | /* PFUZE100 */ |
| 341 | static struct of_regulator_match pfuze100_matches[] = { | 340 | static struct of_regulator_match pfuze100_matches[] = { |
| @@ -563,21 +562,21 @@ static int pfuze100_regulator_probe(struct i2c_client *client, | |||
| 563 | /* use the right regulators after identify the right device */ | 562 | /* use the right regulators after identify the right device */ |
| 564 | switch (pfuze_chip->chip_id) { | 563 | switch (pfuze_chip->chip_id) { |
| 565 | case PFUZE3000: | 564 | case PFUZE3000: |
| 566 | pfuze_regulators = pfuze3000_regulators; | 565 | pfuze_chip->pfuze_regulators = pfuze3000_regulators; |
| 567 | regulator_num = ARRAY_SIZE(pfuze3000_regulators); | 566 | regulator_num = ARRAY_SIZE(pfuze3000_regulators); |
| 568 | sw_check_start = PFUZE3000_SW2; | 567 | sw_check_start = PFUZE3000_SW2; |
| 569 | sw_check_end = PFUZE3000_SW2; | 568 | sw_check_end = PFUZE3000_SW2; |
| 570 | sw_hi = 1 << 3; | 569 | sw_hi = 1 << 3; |
| 571 | break; | 570 | break; |
| 572 | case PFUZE200: | 571 | case PFUZE200: |
| 573 | pfuze_regulators = pfuze200_regulators; | 572 | pfuze_chip->pfuze_regulators = pfuze200_regulators; |
| 574 | regulator_num = ARRAY_SIZE(pfuze200_regulators); | 573 | regulator_num = ARRAY_SIZE(pfuze200_regulators); |
| 575 | sw_check_start = PFUZE200_SW2; | 574 | sw_check_start = PFUZE200_SW2; |
| 576 | sw_check_end = PFUZE200_SW3B; | 575 | sw_check_end = PFUZE200_SW3B; |
| 577 | break; | 576 | break; |
| 578 | case PFUZE100: | 577 | case PFUZE100: |
| 579 | default: | 578 | default: |
| 580 | pfuze_regulators = pfuze100_regulators; | 579 | pfuze_chip->pfuze_regulators = pfuze100_regulators; |
| 581 | regulator_num = ARRAY_SIZE(pfuze100_regulators); | 580 | regulator_num = ARRAY_SIZE(pfuze100_regulators); |
| 582 | sw_check_start = PFUZE100_SW2; | 581 | sw_check_start = PFUZE100_SW2; |
| 583 | sw_check_end = PFUZE100_SW4; | 582 | sw_check_end = PFUZE100_SW4; |
| @@ -587,7 +586,7 @@ static int pfuze100_regulator_probe(struct i2c_client *client, | |||
| 587 | (pfuze_chip->chip_id == PFUZE100) ? "100" : | 586 | (pfuze_chip->chip_id == PFUZE100) ? "100" : |
| 588 | ((pfuze_chip->chip_id == PFUZE200) ? "200" : "3000")); | 587 | ((pfuze_chip->chip_id == PFUZE200) ? "200" : "3000")); |
| 589 | 588 | ||
| 590 | memcpy(pfuze_chip->regulator_descs, pfuze_regulators, | 589 | memcpy(pfuze_chip->regulator_descs, pfuze_chip->pfuze_regulators, |
| 591 | sizeof(pfuze_chip->regulator_descs)); | 590 | sizeof(pfuze_chip->regulator_descs)); |
| 592 | 591 | ||
| 593 | ret = pfuze_parse_regulators_dt(pfuze_chip); | 592 | ret = pfuze_parse_regulators_dt(pfuze_chip); |
| @@ -631,7 +630,7 @@ static int pfuze100_regulator_probe(struct i2c_client *client, | |||
| 631 | devm_regulator_register(&client->dev, desc, &config); | 630 | devm_regulator_register(&client->dev, desc, &config); |
| 632 | if (IS_ERR(pfuze_chip->regulators[i])) { | 631 | if (IS_ERR(pfuze_chip->regulators[i])) { |
| 633 | dev_err(&client->dev, "register regulator%s failed\n", | 632 | dev_err(&client->dev, "register regulator%s failed\n", |
| 634 | pfuze_regulators[i].desc.name); | 633 | pfuze_chip->pfuze_regulators[i].desc.name); |
| 635 | return PTR_ERR(pfuze_chip->regulators[i]); | 634 | return PTR_ERR(pfuze_chip->regulators[i]); |
| 636 | } | 635 | } |
| 637 | } | 636 | } |
| @@ -650,5 +649,5 @@ static struct i2c_driver pfuze_driver = { | |||
| 650 | module_i2c_driver(pfuze_driver); | 649 | module_i2c_driver(pfuze_driver); |
| 651 | 650 | ||
| 652 | MODULE_AUTHOR("Robin Gong <b38343@freescale.com>"); | 651 | MODULE_AUTHOR("Robin Gong <b38343@freescale.com>"); |
| 653 | MODULE_DESCRIPTION("Regulator Driver for Freescale PFUZE100/PFUZE200 PMIC"); | 652 | MODULE_DESCRIPTION("Regulator Driver for Freescale PFUZE100/200/3000 PMIC"); |
| 654 | MODULE_LICENSE("GPL v2"); | 653 | MODULE_LICENSE("GPL v2"); |
diff --git a/drivers/regulator/pv88060-regulator.c b/drivers/regulator/pv88060-regulator.c index c448b727f5f8..6c4afc73ecac 100644 --- a/drivers/regulator/pv88060-regulator.c +++ b/drivers/regulator/pv88060-regulator.c | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
| 17 | #include <linux/gpio.h> | ||
| 18 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
| 19 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 20 | #include <linux/init.h> | 19 | #include <linux/init.h> |
| @@ -25,8 +24,6 @@ | |||
| 25 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
| 26 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
| 27 | #include <linux/regulator/of_regulator.h> | 26 | #include <linux/regulator/of_regulator.h> |
| 28 | #include <linux/proc_fs.h> | ||
| 29 | #include <linux/uaccess.h> | ||
| 30 | #include "pv88060-regulator.h" | 27 | #include "pv88060-regulator.h" |
| 31 | 28 | ||
| 32 | #define PV88060_MAX_REGULATORS 14 | 29 | #define PV88060_MAX_REGULATORS 14 |
diff --git a/drivers/regulator/pv88080-regulator.c b/drivers/regulator/pv88080-regulator.c index d7107566c429..81950bdb1cc4 100644 --- a/drivers/regulator/pv88080-regulator.c +++ b/drivers/regulator/pv88080-regulator.c | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
| 17 | #include <linux/gpio.h> | ||
| 18 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
| 19 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 20 | #include <linux/init.h> | 19 | #include <linux/init.h> |
| @@ -25,8 +24,6 @@ | |||
| 25 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
| 26 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
| 27 | #include <linux/regulator/of_regulator.h> | 26 | #include <linux/regulator/of_regulator.h> |
| 28 | #include <linux/proc_fs.h> | ||
| 29 | #include <linux/uaccess.h> | ||
| 30 | #include "pv88080-regulator.h" | 27 | #include "pv88080-regulator.h" |
| 31 | 28 | ||
| 32 | #define PV88080_MAX_REGULATORS 3 | 29 | #define PV88080_MAX_REGULATORS 3 |
diff --git a/drivers/regulator/pv88090-regulator.c b/drivers/regulator/pv88090-regulator.c index 0057c6740d6f..421641175352 100644 --- a/drivers/regulator/pv88090-regulator.c +++ b/drivers/regulator/pv88090-regulator.c | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
| 17 | #include <linux/gpio.h> | ||
| 18 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
| 19 | #include <linux/module.h> | 18 | #include <linux/module.h> |
| 20 | #include <linux/init.h> | 19 | #include <linux/init.h> |
| @@ -25,8 +24,6 @@ | |||
| 25 | #include <linux/irq.h> | 24 | #include <linux/irq.h> |
| 26 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
| 27 | #include <linux/regulator/of_regulator.h> | 26 | #include <linux/regulator/of_regulator.h> |
| 28 | #include <linux/proc_fs.h> | ||
| 29 | #include <linux/uaccess.h> | ||
| 30 | #include "pv88090-regulator.h" | 27 | #include "pv88090-regulator.h" |
| 31 | 28 | ||
| 32 | #define PV88090_MAX_REGULATORS 5 | 29 | #define PV88090_MAX_REGULATORS 5 |
diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c index fafa3488e960..666bc3bb52ef 100644 --- a/drivers/regulator/pwm-regulator.c +++ b/drivers/regulator/pwm-regulator.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/of.h> | 20 | #include <linux/of.h> |
| 21 | #include <linux/of_device.h> | 21 | #include <linux/of_device.h> |
| 22 | #include <linux/pwm.h> | 22 | #include <linux/pwm.h> |
| 23 | #include <linux/gpio/consumer.h> | ||
| 23 | 24 | ||
| 24 | struct pwm_regulator_data { | 25 | struct pwm_regulator_data { |
| 25 | /* Shared */ | 26 | /* Shared */ |
| @@ -38,6 +39,9 @@ struct pwm_regulator_data { | |||
| 38 | 39 | ||
| 39 | /* Continuous voltage */ | 40 | /* Continuous voltage */ |
| 40 | int volt_uV; | 41 | int volt_uV; |
| 42 | |||
| 43 | /* Enable GPIO */ | ||
| 44 | struct gpio_desc *enb_gpio; | ||
| 41 | }; | 45 | }; |
| 42 | 46 | ||
| 43 | struct pwm_voltages { | 47 | struct pwm_voltages { |
| @@ -94,6 +98,9 @@ static int pwm_regulator_enable(struct regulator_dev *dev) | |||
| 94 | { | 98 | { |
| 95 | struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev); | 99 | struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev); |
| 96 | 100 | ||
| 101 | if (drvdata->enb_gpio) | ||
| 102 | gpiod_set_value_cansleep(drvdata->enb_gpio, 1); | ||
| 103 | |||
| 97 | return pwm_enable(drvdata->pwm); | 104 | return pwm_enable(drvdata->pwm); |
| 98 | } | 105 | } |
| 99 | 106 | ||
| @@ -103,6 +110,9 @@ static int pwm_regulator_disable(struct regulator_dev *dev) | |||
| 103 | 110 | ||
| 104 | pwm_disable(drvdata->pwm); | 111 | pwm_disable(drvdata->pwm); |
| 105 | 112 | ||
| 113 | if (drvdata->enb_gpio) | ||
| 114 | gpiod_set_value_cansleep(drvdata->enb_gpio, 0); | ||
| 115 | |||
| 106 | return 0; | 116 | return 0; |
| 107 | } | 117 | } |
| 108 | 118 | ||
| @@ -110,6 +120,9 @@ static int pwm_regulator_is_enabled(struct regulator_dev *dev) | |||
| 110 | { | 120 | { |
| 111 | struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev); | 121 | struct pwm_regulator_data *drvdata = rdev_get_drvdata(dev); |
| 112 | 122 | ||
| 123 | if (drvdata->enb_gpio && !gpiod_get_value_cansleep(drvdata->enb_gpio)) | ||
| 124 | return false; | ||
| 125 | |||
| 113 | return pwm_is_enabled(drvdata->pwm); | 126 | return pwm_is_enabled(drvdata->pwm); |
| 114 | } | 127 | } |
| 115 | 128 | ||
| @@ -132,6 +145,7 @@ static int pwm_regulator_set_voltage(struct regulator_dev *rdev, | |||
| 132 | unsigned int duty_pulse; | 145 | unsigned int duty_pulse; |
| 133 | u64 req_period; | 146 | u64 req_period; |
| 134 | u32 rem; | 147 | u32 rem; |
| 148 | int old_uV = pwm_regulator_get_voltage(rdev); | ||
| 135 | int ret; | 149 | int ret; |
| 136 | 150 | ||
| 137 | pwm_get_args(drvdata->pwm, &pargs); | 151 | pwm_get_args(drvdata->pwm, &pargs); |
| @@ -159,15 +173,14 @@ static int pwm_regulator_set_voltage(struct regulator_dev *rdev, | |||
| 159 | return ret; | 173 | return ret; |
| 160 | } | 174 | } |
| 161 | 175 | ||
| 162 | ret = pwm_enable(drvdata->pwm); | ||
| 163 | if (ret) { | ||
| 164 | dev_err(&rdev->dev, "Failed to enable PWM: %d\n", ret); | ||
| 165 | return ret; | ||
| 166 | } | ||
| 167 | drvdata->volt_uV = min_uV; | 176 | drvdata->volt_uV = min_uV; |
| 168 | 177 | ||
| 169 | /* Delay required by PWM regulator to settle to the new voltage */ | 178 | if ((ramp_delay == 0) || !pwm_regulator_is_enabled(rdev)) |
| 170 | usleep_range(ramp_delay, ramp_delay + 1000); | 179 | return 0; |
| 180 | |||
| 181 | /* Ramp delay is in uV/uS. Adjust to uS and delay */ | ||
| 182 | ramp_delay = DIV_ROUND_UP(abs(min_uV - old_uV), ramp_delay); | ||
| 183 | usleep_range(ramp_delay, ramp_delay + DIV_ROUND_UP(ramp_delay, 10)); | ||
| 171 | 184 | ||
| 172 | return 0; | 185 | return 0; |
| 173 | } | 186 | } |
| @@ -253,6 +266,7 @@ static int pwm_regulator_probe(struct platform_device *pdev) | |||
| 253 | struct regulator_dev *regulator; | 266 | struct regulator_dev *regulator; |
| 254 | struct regulator_config config = { }; | 267 | struct regulator_config config = { }; |
| 255 | struct device_node *np = pdev->dev.of_node; | 268 | struct device_node *np = pdev->dev.of_node; |
| 269 | enum gpiod_flags gpio_flags; | ||
| 256 | int ret; | 270 | int ret; |
| 257 | 271 | ||
| 258 | if (!np) { | 272 | if (!np) { |
| @@ -290,6 +304,18 @@ static int pwm_regulator_probe(struct platform_device *pdev) | |||
| 290 | return ret; | 304 | return ret; |
| 291 | } | 305 | } |
| 292 | 306 | ||
| 307 | if (init_data->constraints.boot_on || init_data->constraints.always_on) | ||
| 308 | gpio_flags = GPIOD_OUT_HIGH; | ||
| 309 | else | ||
| 310 | gpio_flags = GPIOD_OUT_LOW; | ||
| 311 | drvdata->enb_gpio = devm_gpiod_get_optional(&pdev->dev, "enable", | ||
| 312 | gpio_flags); | ||
| 313 | if (IS_ERR(drvdata->enb_gpio)) { | ||
| 314 | ret = PTR_ERR(drvdata->enb_gpio); | ||
| 315 | dev_err(&pdev->dev, "Failed to get enable GPIO: %d\n", ret); | ||
| 316 | return ret; | ||
| 317 | } | ||
| 318 | |||
| 293 | /* | 319 | /* |
| 294 | * FIXME: pwm_apply_args() should be removed when switching to the | 320 | * FIXME: pwm_apply_args() should be removed when switching to the |
| 295 | * atomic PWM API. | 321 | * atomic PWM API. |
diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c index 6c7fe4778793..5022fa8d10c6 100644 --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c | |||
| @@ -211,7 +211,7 @@ static const struct regulator_desc pma8084_switch = { | |||
| 211 | static const struct regulator_desc pm8x41_hfsmps = { | 211 | static const struct regulator_desc pm8x41_hfsmps = { |
| 212 | .linear_ranges = (struct regulator_linear_range[]) { | 212 | .linear_ranges = (struct regulator_linear_range[]) { |
| 213 | REGULATOR_LINEAR_RANGE( 375000, 0, 95, 12500), | 213 | REGULATOR_LINEAR_RANGE( 375000, 0, 95, 12500), |
| 214 | REGULATOR_LINEAR_RANGE(1550000, 96, 158, 25000), | 214 | REGULATOR_LINEAR_RANGE(1575000, 96, 158, 25000), |
| 215 | }, | 215 | }, |
| 216 | .n_linear_ranges = 2, | 216 | .n_linear_ranges = 2, |
| 217 | .n_voltages = 159, | 217 | .n_voltages = 159, |
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c index 84cce21e98cd..16c5f84e06a7 100644 --- a/drivers/regulator/qcom_spmi-regulator.c +++ b/drivers/regulator/qcom_spmi-regulator.c | |||
| @@ -1085,6 +1085,8 @@ static struct regulator_ops spmi_vs_ops = { | |||
| 1085 | .set_pull_down = spmi_regulator_common_set_pull_down, | 1085 | .set_pull_down = spmi_regulator_common_set_pull_down, |
| 1086 | .set_soft_start = spmi_regulator_common_set_soft_start, | 1086 | .set_soft_start = spmi_regulator_common_set_soft_start, |
| 1087 | .set_over_current_protection = spmi_regulator_vs_ocp, | 1087 | .set_over_current_protection = spmi_regulator_vs_ocp, |
| 1088 | .set_mode = spmi_regulator_common_set_mode, | ||
| 1089 | .get_mode = spmi_regulator_common_get_mode, | ||
| 1088 | }; | 1090 | }; |
| 1089 | 1091 | ||
| 1090 | static struct regulator_ops spmi_boost_ops = { | 1092 | static struct regulator_ops spmi_boost_ops = { |
| @@ -1496,6 +1498,7 @@ static const struct spmi_regulator_data pm8941_regulators[] = { | |||
| 1496 | { "s1", 0x1400, "vdd_s1", }, | 1498 | { "s1", 0x1400, "vdd_s1", }, |
| 1497 | { "s2", 0x1700, "vdd_s2", }, | 1499 | { "s2", 0x1700, "vdd_s2", }, |
| 1498 | { "s3", 0x1a00, "vdd_s3", }, | 1500 | { "s3", 0x1a00, "vdd_s3", }, |
| 1501 | { "s4", 0xa000, }, | ||
| 1499 | { "l1", 0x4000, "vdd_l1_l3", }, | 1502 | { "l1", 0x4000, "vdd_l1_l3", }, |
| 1500 | { "l2", 0x4100, "vdd_l2_lvs_1_2_3", }, | 1503 | { "l2", 0x4100, "vdd_l2_lvs_1_2_3", }, |
| 1501 | { "l3", 0x4200, "vdd_l1_l3", }, | 1504 | { "l3", 0x4200, "vdd_l1_l3", }, |
| @@ -1523,8 +1526,8 @@ static const struct spmi_regulator_data pm8941_regulators[] = { | |||
| 1523 | { "lvs1", 0x8000, "vdd_l2_lvs_1_2_3", }, | 1526 | { "lvs1", 0x8000, "vdd_l2_lvs_1_2_3", }, |
| 1524 | { "lvs2", 0x8100, "vdd_l2_lvs_1_2_3", }, | 1527 | { "lvs2", 0x8100, "vdd_l2_lvs_1_2_3", }, |
| 1525 | { "lvs3", 0x8200, "vdd_l2_lvs_1_2_3", }, | 1528 | { "lvs3", 0x8200, "vdd_l2_lvs_1_2_3", }, |
| 1526 | { "mvs1", 0x8300, "vin_5vs", }, | 1529 | { "5vs1", 0x8300, "vin_5vs", "ocp-5vs1", }, |
| 1527 | { "mvs2", 0x8400, "vin_5vs", }, | 1530 | { "5vs2", 0x8400, "vin_5vs", "ocp-5vs2", }, |
| 1528 | { } | 1531 | { } |
| 1529 | }; | 1532 | }; |
| 1530 | 1533 | ||
diff --git a/drivers/regulator/rn5t618-regulator.c b/drivers/regulator/rn5t618-regulator.c index b85ceb8ff911..9c930eb68cda 100644 --- a/drivers/regulator/rn5t618-regulator.c +++ b/drivers/regulator/rn5t618-regulator.c | |||
| @@ -46,6 +46,23 @@ static struct regulator_ops rn5t618_reg_ops = { | |||
| 46 | .vsel_mask = (vmask), \ | 46 | .vsel_mask = (vmask), \ |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | static struct regulator_desc rn5t567_regulators[] = { | ||
| 50 | /* DCDC */ | ||
| 51 | REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500), | ||
| 52 | REG(DCDC2, DC2CTL, BIT(0), DC2DAC, 0xff, 600000, 3500000, 12500), | ||
| 53 | REG(DCDC3, DC3CTL, BIT(0), DC3DAC, 0xff, 600000, 3500000, 12500), | ||
| 54 | REG(DCDC4, DC4CTL, BIT(0), DC4DAC, 0xff, 600000, 3500000, 12500), | ||
| 55 | /* LDO */ | ||
| 56 | REG(LDO1, LDOEN1, BIT(0), LDO1DAC, 0x7f, 900000, 3500000, 25000), | ||
| 57 | REG(LDO2, LDOEN1, BIT(1), LDO2DAC, 0x7f, 900000, 3500000, 25000), | ||
| 58 | REG(LDO3, LDOEN1, BIT(2), LDO3DAC, 0x7f, 600000, 3500000, 25000), | ||
| 59 | REG(LDO4, LDOEN1, BIT(3), LDO4DAC, 0x7f, 900000, 3500000, 25000), | ||
| 60 | REG(LDO5, LDOEN1, BIT(4), LDO5DAC, 0x7f, 900000, 3500000, 25000), | ||
| 61 | /* LDO RTC */ | ||
| 62 | REG(LDORTC1, LDOEN2, BIT(4), LDORTCDAC, 0x7f, 1200000, 3500000, 25000), | ||
| 63 | REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 900000, 3500000, 25000), | ||
| 64 | }; | ||
| 65 | |||
| 49 | static struct regulator_desc rn5t618_regulators[] = { | 66 | static struct regulator_desc rn5t618_regulators[] = { |
| 50 | /* DCDC */ | 67 | /* DCDC */ |
| 51 | REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500), | 68 | REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500), |
| @@ -67,18 +84,33 @@ static int rn5t618_regulator_probe(struct platform_device *pdev) | |||
| 67 | struct rn5t618 *rn5t618 = dev_get_drvdata(pdev->dev.parent); | 84 | struct rn5t618 *rn5t618 = dev_get_drvdata(pdev->dev.parent); |
| 68 | struct regulator_config config = { }; | 85 | struct regulator_config config = { }; |
| 69 | struct regulator_dev *rdev; | 86 | struct regulator_dev *rdev; |
| 87 | struct regulator_desc *regulators; | ||
| 70 | int i; | 88 | int i; |
| 71 | 89 | ||
| 90 | switch (rn5t618->variant) { | ||
| 91 | case RN5T567: | ||
| 92 | regulators = rn5t567_regulators; | ||
| 93 | break; | ||
| 94 | case RN5T618: | ||
| 95 | regulators = rn5t618_regulators; | ||
| 96 | break; | ||
| 97 | default: | ||
| 98 | return -EINVAL; | ||
| 99 | } | ||
| 100 | |||
| 101 | config.dev = pdev->dev.parent; | ||
| 102 | config.regmap = rn5t618->regmap; | ||
| 103 | |||
| 72 | for (i = 0; i < RN5T618_REG_NUM; i++) { | 104 | for (i = 0; i < RN5T618_REG_NUM; i++) { |
| 73 | config.dev = pdev->dev.parent; | 105 | if (!regulators[i].name) |
| 74 | config.regmap = rn5t618->regmap; | 106 | continue; |
| 75 | 107 | ||
| 76 | rdev = devm_regulator_register(&pdev->dev, | 108 | rdev = devm_regulator_register(&pdev->dev, |
| 77 | &rn5t618_regulators[i], | 109 | ®ulators[i], |
| 78 | &config); | 110 | &config); |
| 79 | if (IS_ERR(rdev)) { | 111 | if (IS_ERR(rdev)) { |
| 80 | dev_err(&pdev->dev, "failed to register %s regulator\n", | 112 | dev_err(&pdev->dev, "failed to register %s regulator\n", |
| 81 | rn5t618_regulators[i].name); | 113 | regulators[i].name); |
| 82 | return PTR_ERR(rdev); | 114 | return PTR_ERR(rdev); |
| 83 | } | 115 | } |
| 84 | } | 116 | } |
diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c index 02fb6b4ea820..d838e77dd947 100644 --- a/drivers/regulator/s2mps11.c +++ b/drivers/regulator/s2mps11.c | |||
| @@ -750,7 +750,7 @@ static const struct regulator_linear_range s2mps15_ldo_voltage_ranges3[] = { | |||
| 750 | 750 | ||
| 751 | /* voltage range for s2mps15 LDO 7, 8, 9 and 10 */ | 751 | /* voltage range for s2mps15 LDO 7, 8, 9 and 10 */ |
| 752 | static const struct regulator_linear_range s2mps15_ldo_voltage_ranges4[] = { | 752 | static const struct regulator_linear_range s2mps15_ldo_voltage_ranges4[] = { |
| 753 | REGULATOR_LINEAR_RANGE(700000, 0xc, 0x18, 25000), | 753 | REGULATOR_LINEAR_RANGE(700000, 0x10, 0x20, 25000), |
| 754 | }; | 754 | }; |
| 755 | 755 | ||
| 756 | /* voltage range for s2mps15 LDO 1 */ | 756 | /* voltage range for s2mps15 LDO 1 */ |
| @@ -760,12 +760,12 @@ static const struct regulator_linear_range s2mps15_ldo_voltage_ranges5[] = { | |||
| 760 | 760 | ||
| 761 | /* voltage range for s2mps15 BUCK 1, 2, 3, 4, 5, 6 and 7 */ | 761 | /* voltage range for s2mps15 BUCK 1, 2, 3, 4, 5, 6 and 7 */ |
| 762 | static const struct regulator_linear_range s2mps15_buck_voltage_ranges1[] = { | 762 | static const struct regulator_linear_range s2mps15_buck_voltage_ranges1[] = { |
| 763 | REGULATOR_LINEAR_RANGE(500000, 0x20, 0xb0, 6250), | 763 | REGULATOR_LINEAR_RANGE(500000, 0x20, 0xc0, 6250), |
| 764 | }; | 764 | }; |
| 765 | 765 | ||
| 766 | /* voltage range for s2mps15 BUCK 8, 9 and 10 */ | 766 | /* voltage range for s2mps15 BUCK 8, 9 and 10 */ |
| 767 | static const struct regulator_linear_range s2mps15_buck_voltage_ranges2[] = { | 767 | static const struct regulator_linear_range s2mps15_buck_voltage_ranges2[] = { |
| 768 | REGULATOR_LINEAR_RANGE(1000000, 0x20, 0xc0, 12500), | 768 | REGULATOR_LINEAR_RANGE(1000000, 0x20, 0x78, 12500), |
| 769 | }; | 769 | }; |
| 770 | 770 | ||
| 771 | static const struct regulator_desc s2mps15_regulators[] = { | 771 | static const struct regulator_desc s2mps15_regulators[] = { |
diff --git a/drivers/regulator/tps65217-regulator.c b/drivers/regulator/tps65217-regulator.c index adbe4fc5cf07..2d12b9af3540 100644 --- a/drivers/regulator/tps65217-regulator.c +++ b/drivers/regulator/tps65217-regulator.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | #include <linux/mfd/tps65217.h> | 28 | #include <linux/mfd/tps65217.h> |
| 29 | 29 | ||
| 30 | #define TPS65217_REGULATOR(_name, _id, _of_match, _ops, _n, _vr, _vm, _em, \ | 30 | #define TPS65217_REGULATOR(_name, _id, _of_match, _ops, _n, _vr, _vm, _em, \ |
| 31 | _t, _lr, _nlr) \ | 31 | _t, _lr, _nlr, _sr, _sm) \ |
| 32 | { \ | 32 | { \ |
| 33 | .name = _name, \ | 33 | .name = _name, \ |
| 34 | .id = _id, \ | 34 | .id = _id, \ |
| @@ -45,6 +45,8 @@ | |||
| 45 | .volt_table = _t, \ | 45 | .volt_table = _t, \ |
| 46 | .linear_ranges = _lr, \ | 46 | .linear_ranges = _lr, \ |
| 47 | .n_linear_ranges = _nlr, \ | 47 | .n_linear_ranges = _nlr, \ |
| 48 | .bypass_reg = _sr, \ | ||
| 49 | .bypass_mask = _sm, \ | ||
| 48 | } \ | 50 | } \ |
| 49 | 51 | ||
| 50 | static const unsigned int LDO1_VSEL_table[] = { | 52 | static const unsigned int LDO1_VSEL_table[] = { |
| @@ -118,6 +120,35 @@ static int tps65217_pmic_set_voltage_sel(struct regulator_dev *dev, | |||
| 118 | return ret; | 120 | return ret; |
| 119 | } | 121 | } |
| 120 | 122 | ||
| 123 | static int tps65217_pmic_set_suspend_enable(struct regulator_dev *dev) | ||
| 124 | { | ||
| 125 | struct tps65217 *tps = rdev_get_drvdata(dev); | ||
| 126 | unsigned int rid = rdev_get_id(dev); | ||
| 127 | |||
| 128 | if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4) | ||
| 129 | return -EINVAL; | ||
| 130 | |||
| 131 | return tps65217_clear_bits(tps, dev->desc->bypass_reg, | ||
| 132 | dev->desc->bypass_mask, | ||
| 133 | TPS65217_PROTECT_L1); | ||
| 134 | } | ||
| 135 | |||
| 136 | static int tps65217_pmic_set_suspend_disable(struct regulator_dev *dev) | ||
| 137 | { | ||
| 138 | struct tps65217 *tps = rdev_get_drvdata(dev); | ||
| 139 | unsigned int rid = rdev_get_id(dev); | ||
| 140 | |||
| 141 | if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4) | ||
| 142 | return -EINVAL; | ||
| 143 | |||
| 144 | if (!tps->strobes[rid]) | ||
| 145 | return -EINVAL; | ||
| 146 | |||
| 147 | return tps65217_set_bits(tps, dev->desc->bypass_reg, | ||
| 148 | dev->desc->bypass_mask, | ||
| 149 | tps->strobes[rid], TPS65217_PROTECT_L1); | ||
| 150 | } | ||
| 151 | |||
| 121 | /* Operations permitted on DCDCx, LDO2, LDO3 and LDO4 */ | 152 | /* Operations permitted on DCDCx, LDO2, LDO3 and LDO4 */ |
| 122 | static struct regulator_ops tps65217_pmic_ops = { | 153 | static struct regulator_ops tps65217_pmic_ops = { |
| 123 | .is_enabled = regulator_is_enabled_regmap, | 154 | .is_enabled = regulator_is_enabled_regmap, |
| @@ -127,6 +158,8 @@ static struct regulator_ops tps65217_pmic_ops = { | |||
| 127 | .set_voltage_sel = tps65217_pmic_set_voltage_sel, | 158 | .set_voltage_sel = tps65217_pmic_set_voltage_sel, |
| 128 | .list_voltage = regulator_list_voltage_linear_range, | 159 | .list_voltage = regulator_list_voltage_linear_range, |
| 129 | .map_voltage = regulator_map_voltage_linear_range, | 160 | .map_voltage = regulator_map_voltage_linear_range, |
| 161 | .set_suspend_enable = tps65217_pmic_set_suspend_enable, | ||
| 162 | .set_suspend_disable = tps65217_pmic_set_suspend_disable, | ||
| 130 | }; | 163 | }; |
| 131 | 164 | ||
| 132 | /* Operations permitted on LDO1 */ | 165 | /* Operations permitted on LDO1 */ |
| @@ -138,41 +171,50 @@ static struct regulator_ops tps65217_pmic_ldo1_ops = { | |||
| 138 | .set_voltage_sel = tps65217_pmic_set_voltage_sel, | 171 | .set_voltage_sel = tps65217_pmic_set_voltage_sel, |
| 139 | .list_voltage = regulator_list_voltage_table, | 172 | .list_voltage = regulator_list_voltage_table, |
| 140 | .map_voltage = regulator_map_voltage_ascend, | 173 | .map_voltage = regulator_map_voltage_ascend, |
| 174 | .set_suspend_enable = tps65217_pmic_set_suspend_enable, | ||
| 175 | .set_suspend_disable = tps65217_pmic_set_suspend_disable, | ||
| 141 | }; | 176 | }; |
| 142 | 177 | ||
| 143 | static const struct regulator_desc regulators[] = { | 178 | static const struct regulator_desc regulators[] = { |
| 144 | TPS65217_REGULATOR("DCDC1", TPS65217_DCDC_1, "dcdc1", | 179 | TPS65217_REGULATOR("DCDC1", TPS65217_DCDC_1, "dcdc1", |
| 145 | tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC1, | 180 | tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC1, |
| 146 | TPS65217_DEFDCDCX_DCDC_MASK, TPS65217_ENABLE_DC1_EN, | 181 | TPS65217_DEFDCDCX_DCDC_MASK, TPS65217_ENABLE_DC1_EN, |
| 147 | NULL, tps65217_uv1_ranges, 2), | 182 | NULL, tps65217_uv1_ranges, 2, TPS65217_REG_SEQ1, |
| 183 | TPS65217_SEQ1_DC1_SEQ_MASK), | ||
| 148 | TPS65217_REGULATOR("DCDC2", TPS65217_DCDC_2, "dcdc2", | 184 | TPS65217_REGULATOR("DCDC2", TPS65217_DCDC_2, "dcdc2", |
| 149 | tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC2, | 185 | tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC2, |
| 150 | TPS65217_DEFDCDCX_DCDC_MASK, TPS65217_ENABLE_DC2_EN, | 186 | TPS65217_DEFDCDCX_DCDC_MASK, TPS65217_ENABLE_DC2_EN, |
| 151 | NULL, tps65217_uv1_ranges, | 187 | NULL, tps65217_uv1_ranges, |
| 152 | ARRAY_SIZE(tps65217_uv1_ranges)), | 188 | ARRAY_SIZE(tps65217_uv1_ranges), TPS65217_REG_SEQ1, |
| 189 | TPS65217_SEQ1_DC2_SEQ_MASK), | ||
| 153 | TPS65217_REGULATOR("DCDC3", TPS65217_DCDC_3, "dcdc3", | 190 | TPS65217_REGULATOR("DCDC3", TPS65217_DCDC_3, "dcdc3", |
| 154 | tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC3, | 191 | tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC3, |
| 155 | TPS65217_DEFDCDCX_DCDC_MASK, TPS65217_ENABLE_DC3_EN, | 192 | TPS65217_DEFDCDCX_DCDC_MASK, TPS65217_ENABLE_DC3_EN, |
| 156 | NULL, tps65217_uv1_ranges, 1), | 193 | NULL, tps65217_uv1_ranges, 1, TPS65217_REG_SEQ2, |
| 194 | TPS65217_SEQ2_DC3_SEQ_MASK), | ||
| 157 | TPS65217_REGULATOR("LDO1", TPS65217_LDO_1, "ldo1", | 195 | TPS65217_REGULATOR("LDO1", TPS65217_LDO_1, "ldo1", |
| 158 | tps65217_pmic_ldo1_ops, 16, TPS65217_REG_DEFLDO1, | 196 | tps65217_pmic_ldo1_ops, 16, TPS65217_REG_DEFLDO1, |
| 159 | TPS65217_DEFLDO1_LDO1_MASK, TPS65217_ENABLE_LDO1_EN, | 197 | TPS65217_DEFLDO1_LDO1_MASK, TPS65217_ENABLE_LDO1_EN, |
| 160 | LDO1_VSEL_table, NULL, 0), | 198 | LDO1_VSEL_table, NULL, 0, TPS65217_REG_SEQ2, |
| 199 | TPS65217_SEQ2_LDO1_SEQ_MASK), | ||
| 161 | TPS65217_REGULATOR("LDO2", TPS65217_LDO_2, "ldo2", tps65217_pmic_ops, | 200 | TPS65217_REGULATOR("LDO2", TPS65217_LDO_2, "ldo2", tps65217_pmic_ops, |
| 162 | 64, TPS65217_REG_DEFLDO2, | 201 | 64, TPS65217_REG_DEFLDO2, |
| 163 | TPS65217_DEFLDO2_LDO2_MASK, TPS65217_ENABLE_LDO2_EN, | 202 | TPS65217_DEFLDO2_LDO2_MASK, TPS65217_ENABLE_LDO2_EN, |
| 164 | NULL, tps65217_uv1_ranges, | 203 | NULL, tps65217_uv1_ranges, |
| 165 | ARRAY_SIZE(tps65217_uv1_ranges)), | 204 | ARRAY_SIZE(tps65217_uv1_ranges), TPS65217_REG_SEQ3, |
| 205 | TPS65217_SEQ3_LDO2_SEQ_MASK), | ||
| 166 | TPS65217_REGULATOR("LDO3", TPS65217_LDO_3, "ldo3", tps65217_pmic_ops, | 206 | TPS65217_REGULATOR("LDO3", TPS65217_LDO_3, "ldo3", tps65217_pmic_ops, |
| 167 | 32, TPS65217_REG_DEFLS1, TPS65217_DEFLDO3_LDO3_MASK, | 207 | 32, TPS65217_REG_DEFLS1, TPS65217_DEFLDO3_LDO3_MASK, |
| 168 | TPS65217_ENABLE_LS1_EN | TPS65217_DEFLDO3_LDO3_EN, | 208 | TPS65217_ENABLE_LS1_EN | TPS65217_DEFLDO3_LDO3_EN, |
| 169 | NULL, tps65217_uv2_ranges, | 209 | NULL, tps65217_uv2_ranges, |
| 170 | ARRAY_SIZE(tps65217_uv2_ranges)), | 210 | ARRAY_SIZE(tps65217_uv2_ranges), TPS65217_REG_SEQ3, |
| 211 | TPS65217_SEQ3_LDO3_SEQ_MASK), | ||
| 171 | TPS65217_REGULATOR("LDO4", TPS65217_LDO_4, "ldo4", tps65217_pmic_ops, | 212 | TPS65217_REGULATOR("LDO4", TPS65217_LDO_4, "ldo4", tps65217_pmic_ops, |
| 172 | 32, TPS65217_REG_DEFLS2, TPS65217_DEFLDO4_LDO4_MASK, | 213 | 32, TPS65217_REG_DEFLS2, TPS65217_DEFLDO4_LDO4_MASK, |
| 173 | TPS65217_ENABLE_LS2_EN | TPS65217_DEFLDO4_LDO4_EN, | 214 | TPS65217_ENABLE_LS2_EN | TPS65217_DEFLDO4_LDO4_EN, |
| 174 | NULL, tps65217_uv2_ranges, | 215 | NULL, tps65217_uv2_ranges, |
| 175 | ARRAY_SIZE(tps65217_uv2_ranges)), | 216 | ARRAY_SIZE(tps65217_uv2_ranges), TPS65217_REG_SEQ4, |
| 217 | TPS65217_SEQ4_LDO4_SEQ_MASK), | ||
| 176 | }; | 218 | }; |
| 177 | 219 | ||
| 178 | static int tps65217_regulator_probe(struct platform_device *pdev) | 220 | static int tps65217_regulator_probe(struct platform_device *pdev) |
| @@ -181,13 +223,18 @@ static int tps65217_regulator_probe(struct platform_device *pdev) | |||
| 181 | struct tps65217_board *pdata = dev_get_platdata(tps->dev); | 223 | struct tps65217_board *pdata = dev_get_platdata(tps->dev); |
| 182 | struct regulator_dev *rdev; | 224 | struct regulator_dev *rdev; |
| 183 | struct regulator_config config = { }; | 225 | struct regulator_config config = { }; |
| 184 | int i; | 226 | int i, ret; |
| 227 | unsigned int val; | ||
| 185 | 228 | ||
| 186 | if (tps65217_chip_id(tps) != TPS65217) { | 229 | if (tps65217_chip_id(tps) != TPS65217) { |
| 187 | dev_err(&pdev->dev, "Invalid tps chip version\n"); | 230 | dev_err(&pdev->dev, "Invalid tps chip version\n"); |
| 188 | return -ENODEV; | 231 | return -ENODEV; |
| 189 | } | 232 | } |
| 190 | 233 | ||
| 234 | /* Allocate memory for strobes */ | ||
| 235 | tps->strobes = devm_kzalloc(&pdev->dev, sizeof(u8) * | ||
| 236 | TPS65217_NUM_REGULATOR, GFP_KERNEL); | ||
| 237 | |||
| 191 | platform_set_drvdata(pdev, tps); | 238 | platform_set_drvdata(pdev, tps); |
| 192 | 239 | ||
| 193 | for (i = 0; i < TPS65217_NUM_REGULATOR; i++) { | 240 | for (i = 0; i < TPS65217_NUM_REGULATOR; i++) { |
| @@ -205,6 +252,10 @@ static int tps65217_regulator_probe(struct platform_device *pdev) | |||
| 205 | pdev->name); | 252 | pdev->name); |
| 206 | return PTR_ERR(rdev); | 253 | return PTR_ERR(rdev); |
| 207 | } | 254 | } |
| 255 | |||
| 256 | /* Store default strobe info */ | ||
| 257 | ret = tps65217_reg_read(tps, regulators[i].bypass_reg, &val); | ||
| 258 | tps->strobes[i] = val & regulators[i].bypass_mask; | ||
| 208 | } | 259 | } |
| 209 | 260 | ||
| 210 | return 0; | 261 | return 0; |
diff --git a/drivers/regulator/tps65218-regulator.c b/drivers/regulator/tps65218-regulator.c index a5e5634eeb9e..d1e631d64a20 100644 --- a/drivers/regulator/tps65218-regulator.c +++ b/drivers/regulator/tps65218-regulator.c | |||
| @@ -31,7 +31,7 @@ enum tps65218_regulators { DCDC1, DCDC2, DCDC3, DCDC4, | |||
| 31 | DCDC5, DCDC6, LDO1, LS3 }; | 31 | DCDC5, DCDC6, LDO1, LS3 }; |
| 32 | 32 | ||
| 33 | #define TPS65218_REGULATOR(_name, _id, _type, _ops, _n, _vr, _vm, _er, _em, \ | 33 | #define TPS65218_REGULATOR(_name, _id, _type, _ops, _n, _vr, _vm, _er, _em, \ |
| 34 | _cr, _cm, _lr, _nlr, _delay, _fuv) \ | 34 | _cr, _cm, _lr, _nlr, _delay, _fuv, _sr, _sm) \ |
| 35 | { \ | 35 | { \ |
| 36 | .name = _name, \ | 36 | .name = _name, \ |
| 37 | .id = _id, \ | 37 | .id = _id, \ |
| @@ -49,7 +49,9 @@ enum tps65218_regulators { DCDC1, DCDC2, DCDC3, DCDC4, | |||
| 49 | .linear_ranges = _lr, \ | 49 | .linear_ranges = _lr, \ |
| 50 | .n_linear_ranges = _nlr, \ | 50 | .n_linear_ranges = _nlr, \ |
| 51 | .ramp_delay = _delay, \ | 51 | .ramp_delay = _delay, \ |
| 52 | .fixed_uV = _fuv \ | 52 | .fixed_uV = _fuv, \ |
| 53 | .bypass_reg = _sr, \ | ||
| 54 | .bypass_mask = _sm, \ | ||
| 53 | } \ | 55 | } \ |
| 54 | 56 | ||
| 55 | #define TPS65218_INFO(_id, _nm, _min, _max) \ | 57 | #define TPS65218_INFO(_id, _nm, _min, _max) \ |
| @@ -157,6 +159,40 @@ static int tps65218_pmic_disable(struct regulator_dev *dev) | |||
| 157 | dev->desc->enable_mask, TPS65218_PROTECT_L1); | 159 | dev->desc->enable_mask, TPS65218_PROTECT_L1); |
| 158 | } | 160 | } |
| 159 | 161 | ||
| 162 | static int tps65218_pmic_set_suspend_enable(struct regulator_dev *dev) | ||
| 163 | { | ||
| 164 | struct tps65218 *tps = rdev_get_drvdata(dev); | ||
| 165 | unsigned int rid = rdev_get_id(dev); | ||
| 166 | |||
| 167 | if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1) | ||
| 168 | return -EINVAL; | ||
| 169 | |||
| 170 | return tps65218_clear_bits(tps, dev->desc->bypass_reg, | ||
| 171 | dev->desc->bypass_mask, | ||
| 172 | TPS65218_PROTECT_L1); | ||
| 173 | } | ||
| 174 | |||
| 175 | static int tps65218_pmic_set_suspend_disable(struct regulator_dev *dev) | ||
| 176 | { | ||
| 177 | struct tps65218 *tps = rdev_get_drvdata(dev); | ||
| 178 | unsigned int rid = rdev_get_id(dev); | ||
| 179 | |||
| 180 | if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1) | ||
| 181 | return -EINVAL; | ||
| 182 | |||
| 183 | if (!tps->info[rid]->strobe) { | ||
| 184 | if (rid == TPS65218_DCDC_3) | ||
| 185 | tps->info[rid]->strobe = 3; | ||
| 186 | else | ||
| 187 | return -EINVAL; | ||
| 188 | } | ||
| 189 | |||
| 190 | return tps65218_set_bits(tps, dev->desc->bypass_reg, | ||
| 191 | dev->desc->bypass_mask, | ||
| 192 | tps->info[rid]->strobe, | ||
| 193 | TPS65218_PROTECT_L1); | ||
| 194 | } | ||
| 195 | |||
| 160 | /* Operations permitted on DCDC1, DCDC2 */ | 196 | /* Operations permitted on DCDC1, DCDC2 */ |
| 161 | static struct regulator_ops tps65218_dcdc12_ops = { | 197 | static struct regulator_ops tps65218_dcdc12_ops = { |
| 162 | .is_enabled = regulator_is_enabled_regmap, | 198 | .is_enabled = regulator_is_enabled_regmap, |
| @@ -167,6 +203,8 @@ static struct regulator_ops tps65218_dcdc12_ops = { | |||
| 167 | .list_voltage = regulator_list_voltage_linear_range, | 203 | .list_voltage = regulator_list_voltage_linear_range, |
| 168 | .map_voltage = regulator_map_voltage_linear_range, | 204 | .map_voltage = regulator_map_voltage_linear_range, |
| 169 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | 205 | .set_voltage_time_sel = regulator_set_voltage_time_sel, |
| 206 | .set_suspend_enable = tps65218_pmic_set_suspend_enable, | ||
| 207 | .set_suspend_disable = tps65218_pmic_set_suspend_disable, | ||
| 170 | }; | 208 | }; |
| 171 | 209 | ||
| 172 | /* Operations permitted on DCDC3, DCDC4 and LDO1 */ | 210 | /* Operations permitted on DCDC3, DCDC4 and LDO1 */ |
| @@ -178,6 +216,8 @@ static struct regulator_ops tps65218_ldo1_dcdc34_ops = { | |||
| 178 | .set_voltage_sel = tps65218_pmic_set_voltage_sel, | 216 | .set_voltage_sel = tps65218_pmic_set_voltage_sel, |
| 179 | .list_voltage = regulator_list_voltage_linear_range, | 217 | .list_voltage = regulator_list_voltage_linear_range, |
| 180 | .map_voltage = regulator_map_voltage_linear_range, | 218 | .map_voltage = regulator_map_voltage_linear_range, |
| 219 | .set_suspend_enable = tps65218_pmic_set_suspend_enable, | ||
| 220 | .set_suspend_disable = tps65218_pmic_set_suspend_disable, | ||
| 181 | }; | 221 | }; |
| 182 | 222 | ||
| 183 | static const int ls3_currents[] = { 100, 200, 500, 1000 }; | 223 | static const int ls3_currents[] = { 100, 200, 500, 1000 }; |
| @@ -247,6 +287,8 @@ static struct regulator_ops tps65218_dcdc56_pmic_ops = { | |||
| 247 | .is_enabled = regulator_is_enabled_regmap, | 287 | .is_enabled = regulator_is_enabled_regmap, |
| 248 | .enable = tps65218_pmic_enable, | 288 | .enable = tps65218_pmic_enable, |
| 249 | .disable = tps65218_pmic_disable, | 289 | .disable = tps65218_pmic_disable, |
| 290 | .set_suspend_enable = tps65218_pmic_set_suspend_enable, | ||
| 291 | .set_suspend_disable = tps65218_pmic_set_suspend_disable, | ||
| 250 | }; | 292 | }; |
| 251 | 293 | ||
| 252 | static const struct regulator_desc regulators[] = { | 294 | static const struct regulator_desc regulators[] = { |
| @@ -254,42 +296,47 @@ static const struct regulator_desc regulators[] = { | |||
| 254 | tps65218_dcdc12_ops, 64, TPS65218_REG_CONTROL_DCDC1, | 296 | tps65218_dcdc12_ops, 64, TPS65218_REG_CONTROL_DCDC1, |
| 255 | TPS65218_CONTROL_DCDC1_MASK, TPS65218_REG_ENABLE1, | 297 | TPS65218_CONTROL_DCDC1_MASK, TPS65218_REG_ENABLE1, |
| 256 | TPS65218_ENABLE1_DC1_EN, 0, 0, dcdc1_dcdc2_ranges, | 298 | TPS65218_ENABLE1_DC1_EN, 0, 0, dcdc1_dcdc2_ranges, |
| 257 | 2, 4000, 0), | 299 | 2, 4000, 0, TPS65218_REG_SEQ3, |
| 300 | TPS65218_SEQ3_DC1_SEQ_MASK), | ||
| 258 | TPS65218_REGULATOR("DCDC2", TPS65218_DCDC_2, REGULATOR_VOLTAGE, | 301 | TPS65218_REGULATOR("DCDC2", TPS65218_DCDC_2, REGULATOR_VOLTAGE, |
| 259 | tps65218_dcdc12_ops, 64, TPS65218_REG_CONTROL_DCDC2, | 302 | tps65218_dcdc12_ops, 64, TPS65218_REG_CONTROL_DCDC2, |
| 260 | TPS65218_CONTROL_DCDC2_MASK, TPS65218_REG_ENABLE1, | 303 | TPS65218_CONTROL_DCDC2_MASK, TPS65218_REG_ENABLE1, |
| 261 | TPS65218_ENABLE1_DC2_EN, 0, 0, dcdc1_dcdc2_ranges, | 304 | TPS65218_ENABLE1_DC2_EN, 0, 0, dcdc1_dcdc2_ranges, |
| 262 | 2, 4000, 0), | 305 | 2, 4000, 0, TPS65218_REG_SEQ3, |
| 306 | TPS65218_SEQ3_DC2_SEQ_MASK), | ||
| 263 | TPS65218_REGULATOR("DCDC3", TPS65218_DCDC_3, REGULATOR_VOLTAGE, | 307 | TPS65218_REGULATOR("DCDC3", TPS65218_DCDC_3, REGULATOR_VOLTAGE, |
| 264 | tps65218_ldo1_dcdc34_ops, 64, | 308 | tps65218_ldo1_dcdc34_ops, 64, |
| 265 | TPS65218_REG_CONTROL_DCDC3, | 309 | TPS65218_REG_CONTROL_DCDC3, |
| 266 | TPS65218_CONTROL_DCDC3_MASK, TPS65218_REG_ENABLE1, | 310 | TPS65218_CONTROL_DCDC3_MASK, TPS65218_REG_ENABLE1, |
| 267 | TPS65218_ENABLE1_DC3_EN, 0, 0, ldo1_dcdc3_ranges, 2, | 311 | TPS65218_ENABLE1_DC3_EN, 0, 0, ldo1_dcdc3_ranges, 2, |
| 268 | 0, 0), | 312 | 0, 0, TPS65218_REG_SEQ4, TPS65218_SEQ4_DC3_SEQ_MASK), |
| 269 | TPS65218_REGULATOR("DCDC4", TPS65218_DCDC_4, REGULATOR_VOLTAGE, | 313 | TPS65218_REGULATOR("DCDC4", TPS65218_DCDC_4, REGULATOR_VOLTAGE, |
| 270 | tps65218_ldo1_dcdc34_ops, 53, | 314 | tps65218_ldo1_dcdc34_ops, 53, |
| 271 | TPS65218_REG_CONTROL_DCDC4, | 315 | TPS65218_REG_CONTROL_DCDC4, |
| 272 | TPS65218_CONTROL_DCDC4_MASK, TPS65218_REG_ENABLE1, | 316 | TPS65218_CONTROL_DCDC4_MASK, TPS65218_REG_ENABLE1, |
| 273 | TPS65218_ENABLE1_DC4_EN, 0, 0, dcdc4_ranges, 2, | 317 | TPS65218_ENABLE1_DC4_EN, 0, 0, dcdc4_ranges, 2, |
| 274 | 0, 0), | 318 | 0, 0, TPS65218_REG_SEQ4, TPS65218_SEQ4_DC4_SEQ_MASK), |
| 275 | TPS65218_REGULATOR("DCDC5", TPS65218_DCDC_5, REGULATOR_VOLTAGE, | 319 | TPS65218_REGULATOR("DCDC5", TPS65218_DCDC_5, REGULATOR_VOLTAGE, |
| 276 | tps65218_dcdc56_pmic_ops, 1, -1, -1, | 320 | tps65218_dcdc56_pmic_ops, 1, -1, -1, |
| 277 | TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC5_EN, 0, 0, | 321 | TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC5_EN, 0, 0, |
| 278 | NULL, 0, 0, 1000000), | 322 | NULL, 0, 0, 1000000, TPS65218_REG_SEQ5, |
| 323 | TPS65218_SEQ5_DC5_SEQ_MASK), | ||
| 279 | TPS65218_REGULATOR("DCDC6", TPS65218_DCDC_6, REGULATOR_VOLTAGE, | 324 | TPS65218_REGULATOR("DCDC6", TPS65218_DCDC_6, REGULATOR_VOLTAGE, |
| 280 | tps65218_dcdc56_pmic_ops, 1, -1, -1, | 325 | tps65218_dcdc56_pmic_ops, 1, -1, -1, |
| 281 | TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC6_EN, 0, 0, | 326 | TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC6_EN, 0, 0, |
| 282 | NULL, 0, 0, 1800000), | 327 | NULL, 0, 0, 1800000, TPS65218_REG_SEQ5, |
| 328 | TPS65218_SEQ5_DC6_SEQ_MASK), | ||
| 283 | TPS65218_REGULATOR("LDO1", TPS65218_LDO_1, REGULATOR_VOLTAGE, | 329 | TPS65218_REGULATOR("LDO1", TPS65218_LDO_1, REGULATOR_VOLTAGE, |
| 284 | tps65218_ldo1_dcdc34_ops, 64, | 330 | tps65218_ldo1_dcdc34_ops, 64, |
| 285 | TPS65218_REG_CONTROL_LDO1, | 331 | TPS65218_REG_CONTROL_LDO1, |
| 286 | TPS65218_CONTROL_LDO1_MASK, TPS65218_REG_ENABLE2, | 332 | TPS65218_CONTROL_LDO1_MASK, TPS65218_REG_ENABLE2, |
| 287 | TPS65218_ENABLE2_LDO1_EN, 0, 0, ldo1_dcdc3_ranges, | 333 | TPS65218_ENABLE2_LDO1_EN, 0, 0, ldo1_dcdc3_ranges, |
| 288 | 2, 0, 0), | 334 | 2, 0, 0, TPS65218_REG_SEQ6, |
| 335 | TPS65218_SEQ6_LDO1_SEQ_MASK), | ||
| 289 | TPS65218_REGULATOR("LS3", TPS65218_LS_3, REGULATOR_CURRENT, | 336 | TPS65218_REGULATOR("LS3", TPS65218_LS_3, REGULATOR_CURRENT, |
| 290 | tps65218_ls3_ops, 0, 0, 0, TPS65218_REG_ENABLE2, | 337 | tps65218_ls3_ops, 0, 0, 0, TPS65218_REG_ENABLE2, |
| 291 | TPS65218_ENABLE2_LS3_EN, TPS65218_REG_CONFIG2, | 338 | TPS65218_ENABLE2_LS3_EN, TPS65218_REG_CONFIG2, |
| 292 | TPS65218_CONFIG2_LS3ILIM_MASK, NULL, 0, 0, 0), | 339 | TPS65218_CONFIG2_LS3ILIM_MASK, NULL, 0, 0, 0, 0, 0), |
| 293 | }; | 340 | }; |
| 294 | 341 | ||
| 295 | static int tps65218_regulator_probe(struct platform_device *pdev) | 342 | static int tps65218_regulator_probe(struct platform_device *pdev) |
| @@ -300,7 +347,8 @@ static int tps65218_regulator_probe(struct platform_device *pdev) | |||
| 300 | struct regulator_dev *rdev; | 347 | struct regulator_dev *rdev; |
| 301 | const struct of_device_id *match; | 348 | const struct of_device_id *match; |
| 302 | struct regulator_config config = { }; | 349 | struct regulator_config config = { }; |
| 303 | int id; | 350 | int id, ret; |
| 351 | unsigned int val; | ||
| 304 | 352 | ||
| 305 | match = of_match_device(tps65218_of_match, &pdev->dev); | 353 | match = of_match_device(tps65218_of_match, &pdev->dev); |
| 306 | if (!match) | 354 | if (!match) |
| @@ -327,6 +375,12 @@ static int tps65218_regulator_probe(struct platform_device *pdev) | |||
| 327 | return PTR_ERR(rdev); | 375 | return PTR_ERR(rdev); |
| 328 | } | 376 | } |
| 329 | 377 | ||
| 378 | ret = tps65218_reg_read(tps, regulators[id].bypass_reg, &val); | ||
| 379 | if (ret) | ||
| 380 | return ret; | ||
| 381 | |||
| 382 | tps->info[id]->strobe = val & regulators[id].bypass_mask; | ||
| 383 | |||
| 330 | return 0; | 384 | return 0; |
| 331 | } | 385 | } |
| 332 | 386 | ||
diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index faeb5ee92c9e..210681d6b743 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c | |||
| @@ -905,7 +905,7 @@ static struct regulator_ops twlsmps_ops = { | |||
| 905 | twl4030reg_map_mode) | 905 | twl4030reg_map_mode) |
| 906 | #define TWL6030_FIXED_LDO(label, offset, mVolts, turnon_delay) \ | 906 | #define TWL6030_FIXED_LDO(label, offset, mVolts, turnon_delay) \ |
| 907 | TWL_FIXED_LDO(label, offset, mVolts, 0x0, turnon_delay, \ | 907 | TWL_FIXED_LDO(label, offset, mVolts, 0x0, turnon_delay, \ |
| 908 | 0x0, TWL6030, twl6030fixed_ops, 0x0) | 908 | 0x0, TWL6030, twl6030fixed_ops, NULL) |
| 909 | 909 | ||
| 910 | #define TWL4030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf) \ | 910 | #define TWL4030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf) \ |
| 911 | static const struct twlreg_info TWL4030_INFO_##label = { \ | 911 | static const struct twlreg_info TWL4030_INFO_##label = { \ |
diff --git a/include/linux/mfd/rn5t618.h b/include/linux/mfd/rn5t618.h index c72d5344f3b3..cadc6543909d 100644 --- a/include/linux/mfd/rn5t618.h +++ b/include/linux/mfd/rn5t618.h | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #define RN5T618_OTPVER 0x01 | 20 | #define RN5T618_OTPVER 0x01 |
| 21 | #define RN5T618_IODAC 0x02 | 21 | #define RN5T618_IODAC 0x02 |
| 22 | #define RN5T618_VINDAC 0x03 | 22 | #define RN5T618_VINDAC 0x03 |
| 23 | #define RN5T618_OUT32KEN 0x05 | ||
| 23 | #define RN5T618_CPUCNT 0x06 | 24 | #define RN5T618_CPUCNT 0x06 |
| 24 | #define RN5T618_PSWR 0x07 | 25 | #define RN5T618_PSWR 0x07 |
| 25 | #define RN5T618_PONHIS 0x09 | 26 | #define RN5T618_PONHIS 0x09 |
| @@ -38,6 +39,7 @@ | |||
| 38 | #define RN5T618_DC1_SLOT 0x16 | 39 | #define RN5T618_DC1_SLOT 0x16 |
| 39 | #define RN5T618_DC2_SLOT 0x17 | 40 | #define RN5T618_DC2_SLOT 0x17 |
| 40 | #define RN5T618_DC3_SLOT 0x18 | 41 | #define RN5T618_DC3_SLOT 0x18 |
| 42 | #define RN5T618_DC4_SLOT 0x19 | ||
| 41 | #define RN5T618_LDO1_SLOT 0x1b | 43 | #define RN5T618_LDO1_SLOT 0x1b |
| 42 | #define RN5T618_LDO2_SLOT 0x1c | 44 | #define RN5T618_LDO2_SLOT 0x1c |
| 43 | #define RN5T618_LDO3_SLOT 0x1d | 45 | #define RN5T618_LDO3_SLOT 0x1d |
| @@ -54,12 +56,16 @@ | |||
| 54 | #define RN5T618_DC2CTL2 0x2f | 56 | #define RN5T618_DC2CTL2 0x2f |
| 55 | #define RN5T618_DC3CTL 0x30 | 57 | #define RN5T618_DC3CTL 0x30 |
| 56 | #define RN5T618_DC3CTL2 0x31 | 58 | #define RN5T618_DC3CTL2 0x31 |
| 59 | #define RN5T618_DC4CTL 0x32 | ||
| 60 | #define RN5T618_DC4CTL2 0x33 | ||
| 57 | #define RN5T618_DC1DAC 0x36 | 61 | #define RN5T618_DC1DAC 0x36 |
| 58 | #define RN5T618_DC2DAC 0x37 | 62 | #define RN5T618_DC2DAC 0x37 |
| 59 | #define RN5T618_DC3DAC 0x38 | 63 | #define RN5T618_DC3DAC 0x38 |
| 64 | #define RN5T618_DC4DAC 0x39 | ||
| 60 | #define RN5T618_DC1DAC_SLP 0x3b | 65 | #define RN5T618_DC1DAC_SLP 0x3b |
| 61 | #define RN5T618_DC2DAC_SLP 0x3c | 66 | #define RN5T618_DC2DAC_SLP 0x3c |
| 62 | #define RN5T618_DC3DAC_SLP 0x3d | 67 | #define RN5T618_DC3DAC_SLP 0x3d |
| 68 | #define RN5T618_DC4DAC_SLP 0x3e | ||
| 63 | #define RN5T618_DCIREN 0x40 | 69 | #define RN5T618_DCIREN 0x40 |
| 64 | #define RN5T618_DCIRQ 0x41 | 70 | #define RN5T618_DCIRQ 0x41 |
| 65 | #define RN5T618_DCIRMON 0x42 | 71 | #define RN5T618_DCIRMON 0x42 |
| @@ -211,6 +217,7 @@ enum { | |||
| 211 | RN5T618_DCDC1, | 217 | RN5T618_DCDC1, |
| 212 | RN5T618_DCDC2, | 218 | RN5T618_DCDC2, |
| 213 | RN5T618_DCDC3, | 219 | RN5T618_DCDC3, |
| 220 | RN5T618_DCDC4, | ||
| 214 | RN5T618_LDO1, | 221 | RN5T618_LDO1, |
| 215 | RN5T618_LDO2, | 222 | RN5T618_LDO2, |
| 216 | RN5T618_LDO3, | 223 | RN5T618_LDO3, |
| @@ -221,8 +228,14 @@ enum { | |||
| 221 | RN5T618_REG_NUM, | 228 | RN5T618_REG_NUM, |
| 222 | }; | 229 | }; |
| 223 | 230 | ||
| 231 | enum { | ||
| 232 | RN5T567 = 0, | ||
| 233 | RN5T618, | ||
| 234 | }; | ||
| 235 | |||
| 224 | struct rn5t618 { | 236 | struct rn5t618 { |
| 225 | struct regmap *regmap; | 237 | struct regmap *regmap; |
| 238 | long variant; | ||
| 226 | }; | 239 | }; |
| 227 | 240 | ||
| 228 | #endif /* __LINUX_MFD_RN5T618_H */ | 241 | #endif /* __LINUX_MFD_RN5T618_H */ |
diff --git a/include/linux/mfd/tps65217.h b/include/linux/mfd/tps65217.h index ac7fba44d7e4..1c88231496d3 100644 --- a/include/linux/mfd/tps65217.h +++ b/include/linux/mfd/tps65217.h | |||
| @@ -257,6 +257,7 @@ struct tps65217 { | |||
| 257 | unsigned long id; | 257 | unsigned long id; |
| 258 | struct regulator_desc desc[TPS65217_NUM_REGULATOR]; | 258 | struct regulator_desc desc[TPS65217_NUM_REGULATOR]; |
| 259 | struct regmap *regmap; | 259 | struct regmap *regmap; |
| 260 | u8 *strobes; | ||
| 260 | }; | 261 | }; |
| 261 | 262 | ||
| 262 | static inline struct tps65217 *dev_to_tps65217(struct device *dev) | 263 | static inline struct tps65217 *dev_to_tps65217(struct device *dev) |
diff --git a/include/linux/mfd/tps65218.h b/include/linux/mfd/tps65218.h index d58f3b5f585a..7fdf5326f34e 100644 --- a/include/linux/mfd/tps65218.h +++ b/include/linux/mfd/tps65218.h | |||
| @@ -246,6 +246,7 @@ enum tps65218_irqs { | |||
| 246 | * @name: Voltage regulator name | 246 | * @name: Voltage regulator name |
| 247 | * @min_uV: minimum micro volts | 247 | * @min_uV: minimum micro volts |
| 248 | * @max_uV: minimum micro volts | 248 | * @max_uV: minimum micro volts |
| 249 | * @strobe: sequencing strobe value for the regulator | ||
| 249 | * | 250 | * |
| 250 | * This data is used to check the regualtor voltage limits while setting. | 251 | * This data is used to check the regualtor voltage limits while setting. |
| 251 | */ | 252 | */ |
| @@ -254,6 +255,7 @@ struct tps_info { | |||
| 254 | const char *name; | 255 | const char *name; |
| 255 | int min_uV; | 256 | int min_uV; |
| 256 | int max_uV; | 257 | int max_uV; |
| 258 | int strobe; | ||
| 257 | }; | 259 | }; |
| 258 | 260 | ||
| 259 | /** | 261 | /** |
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index 48603506f8de..cae500b2c1d7 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
| @@ -224,7 +224,6 @@ int regulator_bulk_force_disable(int num_consumers, | |||
| 224 | void regulator_bulk_free(int num_consumers, | 224 | void regulator_bulk_free(int num_consumers, |
| 225 | struct regulator_bulk_data *consumers); | 225 | struct regulator_bulk_data *consumers); |
| 226 | 226 | ||
| 227 | int regulator_can_change_voltage(struct regulator *regulator); | ||
| 228 | int regulator_count_voltages(struct regulator *regulator); | 227 | int regulator_count_voltages(struct regulator *regulator); |
| 229 | int regulator_list_voltage(struct regulator *regulator, unsigned selector); | 228 | int regulator_list_voltage(struct regulator *regulator, unsigned selector); |
| 230 | int regulator_is_supported_voltage(struct regulator *regulator, | 229 | int regulator_is_supported_voltage(struct regulator *regulator, |
| @@ -436,11 +435,6 @@ static inline void regulator_bulk_free(int num_consumers, | |||
| 436 | { | 435 | { |
| 437 | } | 436 | } |
| 438 | 437 | ||
| 439 | static inline int regulator_can_change_voltage(struct regulator *regulator) | ||
| 440 | { | ||
| 441 | return 0; | ||
| 442 | } | ||
| 443 | |||
| 444 | static inline int regulator_set_voltage(struct regulator *regulator, | 438 | static inline int regulator_set_voltage(struct regulator *regulator, |
| 445 | int min_uV, int max_uV) | 439 | int min_uV, int max_uV) |
| 446 | { | 440 | { |
diff --git a/include/linux/regulator/da9211.h b/include/linux/regulator/da9211.h index a43a5ca1167b..80cb40b7c88d 100644 --- a/include/linux/regulator/da9211.h +++ b/include/linux/regulator/da9211.h | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * da9211.h - Regulator device driver for DA9211/DA9213/DA9215 | 2 | * da9211.h - Regulator device driver for DA9211/DA9212 |
| 3 | * /DA9213/DA9214/DA9215 | ||
| 3 | * Copyright (C) 2015 Dialog Semiconductor Ltd. | 4 | * Copyright (C) 2015 Dialog Semiconductor Ltd. |
| 4 | * | 5 | * |
| 5 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
| @@ -22,7 +23,9 @@ | |||
| 22 | 23 | ||
| 23 | enum da9211_chip_id { | 24 | enum da9211_chip_id { |
| 24 | DA9211, | 25 | DA9211, |
| 26 | DA9212, | ||
| 25 | DA9213, | 27 | DA9213, |
| 28 | DA9214, | ||
| 26 | DA9215, | 29 | DA9215, |
| 27 | }; | 30 | }; |
| 28 | 31 | ||
diff --git a/include/linux/regulator/mt6323-regulator.h b/include/linux/regulator/mt6323-regulator.h new file mode 100644 index 000000000000..67011cd1ce55 --- /dev/null +++ b/include/linux/regulator/mt6323-regulator.h | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2016 MediaTek Inc. | ||
| 3 | * Author: Chen Zhong <chen.zhong@mediatek.com> | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License version 2 as | ||
| 7 | * published by the Free Software Foundation. | ||
| 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 | |||
| 15 | #ifndef __LINUX_REGULATOR_MT6323_H | ||
| 16 | #define __LINUX_REGULATOR_MT6323_H | ||
| 17 | |||
| 18 | enum { | ||
| 19 | MT6323_ID_VPROC = 0, | ||
| 20 | MT6323_ID_VSYS, | ||
| 21 | MT6323_ID_VPA, | ||
| 22 | MT6323_ID_VTCXO, | ||
| 23 | MT6323_ID_VCN28, | ||
| 24 | MT6323_ID_VCN33_BT, | ||
| 25 | MT6323_ID_VCN33_WIFI, | ||
| 26 | MT6323_ID_VA, | ||
| 27 | MT6323_ID_VCAMA, | ||
| 28 | MT6323_ID_VIO28 = 9, | ||
| 29 | MT6323_ID_VUSB, | ||
| 30 | MT6323_ID_VMC, | ||
| 31 | MT6323_ID_VMCH, | ||
| 32 | MT6323_ID_VEMC3V3, | ||
| 33 | MT6323_ID_VGP1, | ||
| 34 | MT6323_ID_VGP2, | ||
| 35 | MT6323_ID_VGP3, | ||
| 36 | MT6323_ID_VCN18, | ||
| 37 | MT6323_ID_VSIM1, | ||
| 38 | MT6323_ID_VSIM2, | ||
| 39 | MT6323_ID_VRTC, | ||
| 40 | MT6323_ID_VCAMAF, | ||
| 41 | MT6323_ID_VIBR, | ||
| 42 | MT6323_ID_VRF18, | ||
| 43 | MT6323_ID_VM, | ||
| 44 | MT6323_ID_VIO18, | ||
| 45 | MT6323_ID_VCAMD, | ||
| 46 | MT6323_ID_VCAMIO, | ||
| 47 | MT6323_ID_RG_MAX, | ||
| 48 | }; | ||
| 49 | |||
| 50 | #define MT6323_MAX_REGULATOR MT6323_ID_RG_MAX | ||
| 51 | |||
| 52 | #endif /* __LINUX_REGULATOR_MT6323_H */ | ||
