Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge remote-tracking branches 'regulator/topic/pv88090', 'regulator/topic/qcom-smd', 'regulator/topic/tps6105x', 'regulator/topic/tps65086' and 'regulator/topic/tps65218' into regulator-next

+1296 -135
+65
Documentation/devicetree/bindings/regulator/pv88090.txt
··· 1 + * Powerventure Semiconductor PV88090 Voltage Regulator 2 + 3 + Required properties: 4 + - compatible: "pvs,pv88090". 5 + - reg: I2C slave address, usually 0x48. 6 + - interrupts: the interrupt outputs of the controller 7 + - regulators: A node that houses a sub-node for each regulator within the 8 + device. Each sub-node is identified using the node's name, with valid 9 + values listed below. The content of each sub-node is defined by the 10 + standard binding for regulators; see regulator.txt. 11 + BUCK1, BUCK2, BUCK3, LDO1, and LDO2. 12 + 13 + Optional properties: 14 + - Any optional property defined in regulator.txt 15 + 16 + Example 17 + 18 + pmic: pv88090@48 { 19 + compatible = "pvs,pv88090"; 20 + reg = <0x48>; 21 + interrupt-parent = <&gpio>; 22 + interrupts = <24 24>; 23 + 24 + regulators { 25 + BUCK1 { 26 + regulator-name = "buck1"; 27 + regulator-min-microvolt = < 600000>; 28 + regulator-max-microvolt = <1393750>; 29 + regulator-min-microamp = < 220000>; 30 + regulator-max-microamp = <7040000>; 31 + regulator-boot-on; 32 + }; 33 + 34 + BUCK2 { 35 + regulator-name = "buck2"; 36 + regulator-min-microvolt = < 600000>; 37 + regulator-max-microvolt = <1393750>; 38 + regulator-min-microamp = <1496000>; 39 + regulator-max-microamp = <4189000>; 40 + }; 41 + 42 + BUCK3 { 43 + regulator-name = "buck3"; 44 + regulator-min-microvolt = <600000>; 45 + regulator-max-microvolt = <1393750>; 46 + regulator-min-microamp = <1496000>; 47 + regulator-max-microamp = <4189000>; 48 + regulator-boot-on; 49 + }; 50 + 51 + LDO1 { 52 + regulator-name = "ldo1"; 53 + regulator-min-microvolt = <1200000>; 54 + regulator-max-microvolt = <4350000>; 55 + regulator-boot-on; 56 + }; 57 + 58 + LDO2 { 59 + regulator-name = "ldo2"; 60 + regulator-min-microvolt = < 650000>; 61 + regulator-max-microvolt = <2225000>; 62 + regulator-boot-on; 63 + }; 64 + }; 65 + };
+63 -21
Documentation/devicetree/bindings/soc/qcom,smd-rpm.txt Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt
··· 1 - Qualcomm Resource Power Manager (RPM) over SMD 1 + QCOM SMD RPM REGULATOR 2 2 3 - This driver is used to interface with the Resource Power Manager (RPM) found in 4 - various Qualcomm platforms. The RPM allows each component in the system to vote 5 - for state of the system resources, such as clocks, regulators and bus 6 - frequencies. 3 + The Qualcomm RPM over SMD regulator is modelled as a subdevice of the RPM. 4 + Because SMD is used as the communication transport mechanism, the RPM resides as 5 + a subnode of the SMD. As such, the SMD-RPM regulator requires that the SMD and 6 + RPM nodes be present. 7 7 8 - - compatible: 9 - Usage: required 10 - Value type: <string> 11 - Definition: must be one of: 12 - "qcom,rpm-msm8974" 8 + Please refer to Documentation/devicetree/bindings/soc/qcom/qcom,smd.txt for 9 + information pertaining to the SMD node. 13 10 14 - - qcom,smd-channels: 15 - Usage: required 16 - Value type: <stringlist> 17 - Definition: Shared Memory channel used for communication with the RPM 11 + Please refer to Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt for 12 + information regarding the RPM node. 18 13 19 - = SUBDEVICES 20 - 21 - The RPM exposes resources to its subnodes. The below bindings specify the set 22 - of valid subnodes that can operate on these resources. 23 - 24 - == Regulators 14 + == Regulator 25 15 26 16 Regulator nodes are identified by their compatible: 27 17 ··· 20 30 Value type: <string> 21 31 Definition: must be one of: 22 32 "qcom,rpm-pm8841-regulators" 33 + "qcom,rpm-pm8916-regulators" 23 34 "qcom,rpm-pm8941-regulators" 35 + "qcom,rpm-pma8084-regulators" 24 36 25 37 - vdd_s1-supply: 26 38 - vdd_s2-supply: ··· 33 41 - vdd_s7-supply: 34 42 - vdd_s8-supply: 35 43 Usage: optional (pm8841 only) 44 + Value type: <phandle> 45 + Definition: reference to regulator supplying the input pin, as 46 + described in the data sheet 47 + 48 + - vdd_s1-supply: 49 + - vdd_s2-supply: 50 + - vdd_s3-supply: 51 + - vdd_s4-supply: 52 + - vdd_l1_l2_l3-supply: 53 + - vdd_l4_l5_l6-supply: 54 + - vdd_l7-supply: 55 + - vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18-supply: 56 + Usage: optional (pm8916 only) 36 57 Value type: <phandle> 37 58 Definition: reference to regulator supplying the input pin, as 38 59 described in the data sheet ··· 68 63 Definition: reference to regulator supplying the input pin, as 69 64 described in the data sheet 70 65 66 + - vdd_s1-supply: 67 + - vdd_s2-supply: 68 + - vdd_s3-supply: 69 + - vdd_s4-supply: 70 + - vdd_s5-supply: 71 + - vdd_s6-supply: 72 + - vdd_s7-supply: 73 + - vdd_s8-supply: 74 + - vdd_s9-supply: 75 + - vdd_s10-supply: 76 + - vdd_s11-supply: 77 + - vdd_s12-supply: 78 + - vdd_l1_l11-supply: 79 + - vdd_l2_l3_l4_l27-supply: 80 + - vdd_l5_l7-supply: 81 + - vdd_l6_l12_l14_l15_l26-supply: 82 + - vdd_l8-supply: 83 + - vdd_l9_l10_l13_l20_l23_l24-supply: 84 + - vdd_l16_l25-supply: 85 + - vdd_l17-supply: 86 + - vdd_l18-supply: 87 + - vdd_l19-supply: 88 + - vdd_l21-supply: 89 + - vdd_l22-supply: 90 + Usage: optional (pma8084 only) 91 + Value type: <phandle> 92 + Definition: reference to regulator supplying the input pin, as 93 + described in the data sheet 94 + 71 95 The regulator node houses sub-nodes for each regulator within the device. Each 72 96 sub-node is identified using the node's name, with valid values listed for each 73 97 of the pmics below. ··· 104 70 pm8841: 105 71 s1, s2, s3, s4, s5, s6, s7, s8 106 72 73 + pm8916: 74 + s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, 75 + l14, l15, l16, l17, l18 76 + 107 77 pm8941: 108 78 s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, 109 79 l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, 110 80 lvs3, 5vs1, 5vs2 81 + 82 + pma8084: 83 + s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, l1, l2, l3, l4, l5, 84 + l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19, l20, 85 + l21, l22, l23, l24, l25, l26, l27, lvs1, lvs2, lvs3, lvs4, 5vs1 111 86 112 87 The content of each sub-node is defined by the standard binding for regulators - 113 88 see regulator.txt. ··· 157 114 }; 158 115 }; 159 116 }; 160 -
+58
Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt
··· 1 + Qualcomm Resource Power Manager (RPM) over SMD 2 + 3 + This driver is used to interface with the Resource Power Manager (RPM) found in 4 + various Qualcomm platforms. The RPM allows each component in the system to vote 5 + for state of the system resources, such as clocks, regulators and bus 6 + frequencies. 7 + 8 + The SMD information for the RPM edge should be filled out. See qcom,smd.txt for 9 + the required edge properties. All SMD related properties will reside within the 10 + RPM node itself. 11 + 12 + = SUBDEVICES 13 + 14 + The RPM exposes resources to its subnodes. The rpm_requests node must be 15 + present and this subnode may contain children that designate regulator 16 + resources. 17 + 18 + - compatible: 19 + Usage: required 20 + Value type: <string> 21 + Definition: must be one of: 22 + "qcom,rpm-apq8084" 23 + "qcom,rpm-msm8916" 24 + "qcom,rpm-msm8974" 25 + 26 + - qcom,smd-channels: 27 + Usage: required 28 + Value type: <string> 29 + Definition: must be "rpm_requests" 30 + 31 + Refer to Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt 32 + for information on the regulator subnodes that can exist under the rpm_requests. 33 + 34 + Example: 35 + 36 + soc { 37 + apcs: syscon@f9011000 { 38 + compatible = "syscon"; 39 + reg = <0xf9011000 0x1000>; 40 + }; 41 + }; 42 + 43 + smd { 44 + compatible = "qcom,smd"; 45 + 46 + rpm { 47 + interrupts = <0 168 1>; 48 + qcom,ipc = <&apcs 8 0>; 49 + qcom,smd-edge = <15>; 50 + 51 + rpm_requests { 52 + compatible = "qcom,rpm-msm8974"; 53 + qcom,smd-channels = "rpm_requests"; 54 + 55 + ... 56 + }; 57 + }; 58 + };
+15
drivers/regulator/Kconfig
··· 522 522 Say y here to support the voltage regulators and convertors 523 523 PV88060 524 524 525 + config REGULATOR_PV88090 526 + tristate "Powerventure Semiconductor PV88090 regulator" 527 + depends on I2C 528 + select REGMAP_I2C 529 + help 530 + Say y here to support the voltage regulators and convertors 531 + on PV88090 532 + 525 533 config REGULATOR_PWM 526 534 tristate "PWM voltage regulator" 527 535 depends on PWM ··· 705 697 This driver supports TPS6507X voltage regulator chips. TPS6507X provides 706 698 three step-down converters and two general-purpose LDO voltage regulators. 707 699 It supports TI's software based Class-2 SmartReflex implementation. 700 + 701 + config REGULATOR_TPS65086 702 + tristate "TI TPS65086 Power regulators" 703 + depends on MFD_TPS65086 704 + help 705 + This driver provides support for the voltage regulators on 706 + TI TPS65086 PMICs. 708 707 709 708 config REGULATOR_TPS65090 710 709 tristate "TI TPS65090 Power regulator"
+2
drivers/regulator/Makefile
··· 68 68 obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o 69 69 obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o 70 70 obj-$(CONFIG_REGULATOR_PV88060) += pv88060-regulator.o 71 + obj-$(CONFIG_REGULATOR_PV88090) += pv88090-regulator.o 71 72 obj-$(CONFIG_REGULATOR_PWM) += pwm-regulator.o 72 73 obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o 73 74 obj-$(CONFIG_REGULATOR_PBIAS) += pbias-regulator.o ··· 88 87 obj-$(CONFIG_REGULATOR_TPS62360) += tps62360-regulator.o 89 88 obj-$(CONFIG_REGULATOR_TPS65023) += tps65023-regulator.o 90 89 obj-$(CONFIG_REGULATOR_TPS6507X) += tps6507x-regulator.o 90 + obj-$(CONFIG_REGULATOR_TPS65086) += tps65086-regulator.o 91 91 obj-$(CONFIG_REGULATOR_TPS65090) += tps65090-regulator.o 92 92 obj-$(CONFIG_REGULATOR_TPS65217) += tps65217-regulator.o 93 93 obj-$(CONFIG_REGULATOR_TPS65218) += tps65218-regulator.o
+458
drivers/regulator/pv88090-regulator.c
··· 1 + /* 2 + * pv88090-regulator.c - Regulator device driver for PV88090 3 + * Copyright (C) 2015 Powerventure Semiconductor Ltd. 4 + * 5 + * This program is free software; you can redistribute it and/or 6 + * modify it under the terms of the GNU General Public License 7 + * as published by the Free Software Foundation; either version 2 8 + * of the License, or (at your option) any later version. 9 + * 10 + * This program is distributed in the hope that it will be useful, 11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + */ 15 + 16 + #include <linux/err.h> 17 + #include <linux/gpio.h> 18 + #include <linux/i2c.h> 19 + #include <linux/module.h> 20 + #include <linux/init.h> 21 + #include <linux/slab.h> 22 + #include <linux/regulator/driver.h> 23 + #include <linux/regulator/machine.h> 24 + #include <linux/regmap.h> 25 + #include <linux/irq.h> 26 + #include <linux/interrupt.h> 27 + #include <linux/regulator/of_regulator.h> 28 + #include <linux/proc_fs.h> 29 + #include <linux/uaccess.h> 30 + #include "pv88090-regulator.h" 31 + 32 + #define PV88090_MAX_REGULATORS 5 33 + 34 + /* PV88090 REGULATOR IDs */ 35 + enum { 36 + /* BUCKs */ 37 + PV88090_ID_BUCK1, 38 + PV88090_ID_BUCK2, 39 + PV88090_ID_BUCK3, 40 + 41 + /* LDOs */ 42 + PV88090_ID_LDO1, 43 + PV88090_ID_LDO2, 44 + }; 45 + 46 + struct pv88090_regulator { 47 + struct regulator_desc desc; 48 + /* Current limiting */ 49 + unsigned n_current_limits; 50 + const int *current_limits; 51 + unsigned int limit_mask; 52 + unsigned int conf; 53 + unsigned int conf2; 54 + }; 55 + 56 + struct pv88090 { 57 + struct device *dev; 58 + struct regmap *regmap; 59 + struct regulator_dev *rdev[PV88090_MAX_REGULATORS]; 60 + }; 61 + 62 + struct pv88090_buck_voltage { 63 + int min_uV; 64 + int max_uV; 65 + int uV_step; 66 + }; 67 + 68 + static const struct regmap_config pv88090_regmap_config = { 69 + .reg_bits = 8, 70 + .val_bits = 8, 71 + }; 72 + 73 + /* Current limits array (in uA) for BUCK1, BUCK2, BUCK3. 74 + * Entry indexes corresponds to register values. 75 + */ 76 + 77 + static const int pv88090_buck1_limits[] = { 78 + 220000, 440000, 660000, 880000, 1100000, 1320000, 1540000, 1760000, 79 + 1980000, 2200000, 2420000, 2640000, 2860000, 3080000, 3300000, 3520000, 80 + 3740000, 3960000, 4180000, 4400000, 4620000, 4840000, 5060000, 5280000, 81 + 5500000, 5720000, 5940000, 6160000, 6380000, 6600000, 6820000, 7040000 82 + }; 83 + 84 + static const int pv88090_buck23_limits[] = { 85 + 1496000, 2393000, 3291000, 4189000 86 + }; 87 + 88 + static const struct pv88090_buck_voltage pv88090_buck_vol[3] = { 89 + { 90 + .min_uV = 600000, 91 + .max_uV = 1393750, 92 + .uV_step = 6250, 93 + }, 94 + 95 + { 96 + .min_uV = 1400000, 97 + .max_uV = 2193750, 98 + .uV_step = 6250, 99 + }, 100 + { 101 + .min_uV = 1250000, 102 + .max_uV = 2837500, 103 + .uV_step = 12500, 104 + }, 105 + }; 106 + 107 + static unsigned int pv88090_buck_get_mode(struct regulator_dev *rdev) 108 + { 109 + struct pv88090_regulator *info = rdev_get_drvdata(rdev); 110 + unsigned int data; 111 + int ret, mode = 0; 112 + 113 + ret = regmap_read(rdev->regmap, info->conf, &data); 114 + if (ret < 0) 115 + return ret; 116 + 117 + switch (data & PV88090_BUCK1_MODE_MASK) { 118 + case PV88090_BUCK_MODE_SYNC: 119 + mode = REGULATOR_MODE_FAST; 120 + break; 121 + case PV88090_BUCK_MODE_AUTO: 122 + mode = REGULATOR_MODE_NORMAL; 123 + break; 124 + case PV88090_BUCK_MODE_SLEEP: 125 + mode = REGULATOR_MODE_STANDBY; 126 + break; 127 + } 128 + 129 + return mode; 130 + } 131 + 132 + static int pv88090_buck_set_mode(struct regulator_dev *rdev, 133 + unsigned int mode) 134 + { 135 + struct pv88090_regulator *info = rdev_get_drvdata(rdev); 136 + int val = 0; 137 + 138 + switch (mode) { 139 + case REGULATOR_MODE_FAST: 140 + val = PV88090_BUCK_MODE_SYNC; 141 + break; 142 + case REGULATOR_MODE_NORMAL: 143 + val = PV88090_BUCK_MODE_AUTO; 144 + break; 145 + case REGULATOR_MODE_STANDBY: 146 + val = PV88090_BUCK_MODE_SLEEP; 147 + break; 148 + default: 149 + return -EINVAL; 150 + } 151 + 152 + return regmap_update_bits(rdev->regmap, info->conf, 153 + PV88090_BUCK1_MODE_MASK, val); 154 + } 155 + 156 + static int pv88090_set_current_limit(struct regulator_dev *rdev, int min, 157 + int max) 158 + { 159 + struct pv88090_regulator *info = rdev_get_drvdata(rdev); 160 + int i; 161 + 162 + /* search for closest to maximum */ 163 + for (i = info->n_current_limits; i >= 0; i--) { 164 + if (min <= info->current_limits[i] 165 + && max >= info->current_limits[i]) { 166 + return regmap_update_bits(rdev->regmap, 167 + info->conf, 168 + info->limit_mask, 169 + i << PV88090_BUCK1_ILIM_SHIFT); 170 + } 171 + } 172 + 173 + return -EINVAL; 174 + } 175 + 176 + static int pv88090_get_current_limit(struct regulator_dev *rdev) 177 + { 178 + struct pv88090_regulator *info = rdev_get_drvdata(rdev); 179 + unsigned int data; 180 + int ret; 181 + 182 + ret = regmap_read(rdev->regmap, info->conf, &data); 183 + if (ret < 0) 184 + return ret; 185 + 186 + data = (data & info->limit_mask) >> PV88090_BUCK1_ILIM_SHIFT; 187 + return info->current_limits[data]; 188 + } 189 + 190 + static struct regulator_ops pv88090_buck_ops = { 191 + .get_mode = pv88090_buck_get_mode, 192 + .set_mode = pv88090_buck_set_mode, 193 + .enable = regulator_enable_regmap, 194 + .disable = regulator_disable_regmap, 195 + .is_enabled = regulator_is_enabled_regmap, 196 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 197 + .get_voltage_sel = regulator_get_voltage_sel_regmap, 198 + .list_voltage = regulator_list_voltage_linear, 199 + .set_current_limit = pv88090_set_current_limit, 200 + .get_current_limit = pv88090_get_current_limit, 201 + }; 202 + 203 + static struct regulator_ops pv88090_ldo_ops = { 204 + .enable = regulator_enable_regmap, 205 + .disable = regulator_disable_regmap, 206 + .is_enabled = regulator_is_enabled_regmap, 207 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 208 + .get_voltage_sel = regulator_get_voltage_sel_regmap, 209 + .list_voltage = regulator_list_voltage_linear, 210 + }; 211 + 212 + #define PV88090_BUCK(chip, regl_name, min, step, max, limits_array) \ 213 + {\ 214 + .desc = {\ 215 + .id = chip##_ID_##regl_name,\ 216 + .name = __stringify(chip##_##regl_name),\ 217 + .of_match = of_match_ptr(#regl_name),\ 218 + .regulators_node = of_match_ptr("regulators"),\ 219 + .type = REGULATOR_VOLTAGE,\ 220 + .owner = THIS_MODULE,\ 221 + .ops = &pv88090_buck_ops,\ 222 + .min_uV = min, \ 223 + .uV_step = step, \ 224 + .n_voltages = ((max) - (min))/(step) + 1, \ 225 + .enable_reg = PV88090_REG_##regl_name##_CONF0, \ 226 + .enable_mask = PV88090_##regl_name##_EN, \ 227 + .vsel_reg = PV88090_REG_##regl_name##_CONF0, \ 228 + .vsel_mask = PV88090_V##regl_name##_MASK, \ 229 + },\ 230 + .current_limits = limits_array, \ 231 + .n_current_limits = ARRAY_SIZE(limits_array), \ 232 + .limit_mask = PV88090_##regl_name##_ILIM_MASK, \ 233 + .conf = PV88090_REG_##regl_name##_CONF1, \ 234 + .conf2 = PV88090_REG_##regl_name##_CONF2, \ 235 + } 236 + 237 + #define PV88090_LDO(chip, regl_name, min, step, max) \ 238 + {\ 239 + .desc = {\ 240 + .id = chip##_ID_##regl_name,\ 241 + .name = __stringify(chip##_##regl_name),\ 242 + .of_match = of_match_ptr(#regl_name),\ 243 + .regulators_node = of_match_ptr("regulators"),\ 244 + .type = REGULATOR_VOLTAGE,\ 245 + .owner = THIS_MODULE,\ 246 + .ops = &pv88090_ldo_ops,\ 247 + .min_uV = min, \ 248 + .uV_step = step, \ 249 + .n_voltages = ((max) - (min))/(step) + 1, \ 250 + .enable_reg = PV88090_REG_##regl_name##_CONT, \ 251 + .enable_mask = PV88090_##regl_name##_EN, \ 252 + .vsel_reg = PV88090_REG_##regl_name##_CONT, \ 253 + .vsel_mask = PV88090_V##regl_name##_MASK, \ 254 + },\ 255 + } 256 + 257 + static struct pv88090_regulator pv88090_regulator_info[] = { 258 + PV88090_BUCK(PV88090, BUCK1, 600000, 6250, 1393750, 259 + pv88090_buck1_limits), 260 + PV88090_BUCK(PV88090, BUCK2, 600000, 6250, 1393750, 261 + pv88090_buck23_limits), 262 + PV88090_BUCK(PV88090, BUCK3, 600000, 6250, 1393750, 263 + pv88090_buck23_limits), 264 + PV88090_LDO(PV88090, LDO1, 1200000, 50000, 4350000), 265 + PV88090_LDO(PV88090, LDO2, 650000, 25000, 2225000), 266 + }; 267 + 268 + static irqreturn_t pv88090_irq_handler(int irq, void *data) 269 + { 270 + struct pv88090 *chip = data; 271 + int i, reg_val, err, ret = IRQ_NONE; 272 + 273 + err = regmap_read(chip->regmap, PV88090_REG_EVENT_A, &reg_val); 274 + if (err < 0) 275 + goto error_i2c; 276 + 277 + if (reg_val & PV88090_E_VDD_FLT) { 278 + for (i = 0; i < PV88090_MAX_REGULATORS; i++) { 279 + if (chip->rdev[i] != NULL) { 280 + regulator_notifier_call_chain(chip->rdev[i], 281 + REGULATOR_EVENT_UNDER_VOLTAGE, 282 + NULL); 283 + } 284 + } 285 + 286 + err = regmap_update_bits(chip->regmap, PV88090_REG_EVENT_A, 287 + PV88090_E_VDD_FLT, PV88090_E_VDD_FLT); 288 + if (err < 0) 289 + goto error_i2c; 290 + 291 + ret = IRQ_HANDLED; 292 + } 293 + 294 + if (reg_val & PV88090_E_OVER_TEMP) { 295 + for (i = 0; i < PV88090_MAX_REGULATORS; i++) { 296 + if (chip->rdev[i] != NULL) { 297 + regulator_notifier_call_chain(chip->rdev[i], 298 + REGULATOR_EVENT_OVER_TEMP, 299 + NULL); 300 + } 301 + } 302 + 303 + err = regmap_update_bits(chip->regmap, PV88090_REG_EVENT_A, 304 + PV88090_E_OVER_TEMP, PV88090_E_OVER_TEMP); 305 + if (err < 0) 306 + goto error_i2c; 307 + 308 + ret = IRQ_HANDLED; 309 + } 310 + 311 + return ret; 312 + 313 + error_i2c: 314 + dev_err(chip->dev, "I2C error : %d\n", err); 315 + return IRQ_NONE; 316 + } 317 + 318 + /* 319 + * I2C driver interface functions 320 + */ 321 + static int pv88090_i2c_probe(struct i2c_client *i2c, 322 + const struct i2c_device_id *id) 323 + { 324 + struct regulator_init_data *init_data = dev_get_platdata(&i2c->dev); 325 + struct pv88090 *chip; 326 + struct regulator_config config = { }; 327 + int error, i, ret = 0; 328 + unsigned int conf2, range, index; 329 + 330 + chip = devm_kzalloc(&i2c->dev, sizeof(struct pv88090), GFP_KERNEL); 331 + if (!chip) 332 + return -ENOMEM; 333 + 334 + chip->dev = &i2c->dev; 335 + chip->regmap = devm_regmap_init_i2c(i2c, &pv88090_regmap_config); 336 + if (IS_ERR(chip->regmap)) { 337 + error = PTR_ERR(chip->regmap); 338 + dev_err(chip->dev, "Failed to allocate register map: %d\n", 339 + error); 340 + return error; 341 + } 342 + 343 + i2c_set_clientdata(i2c, chip); 344 + 345 + if (i2c->irq != 0) { 346 + ret = regmap_write(chip->regmap, PV88090_REG_MASK_A, 0xFF); 347 + if (ret < 0) { 348 + dev_err(chip->dev, 349 + "Failed to mask A reg: %d\n", ret); 350 + return ret; 351 + } 352 + 353 + ret = regmap_write(chip->regmap, PV88090_REG_MASK_B, 0xFF); 354 + if (ret < 0) { 355 + dev_err(chip->dev, 356 + "Failed to mask B reg: %d\n", ret); 357 + return ret; 358 + } 359 + 360 + ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL, 361 + pv88090_irq_handler, 362 + IRQF_TRIGGER_LOW|IRQF_ONESHOT, 363 + "pv88090", chip); 364 + if (ret != 0) { 365 + dev_err(chip->dev, "Failed to request IRQ: %d\n", 366 + i2c->irq); 367 + return ret; 368 + } 369 + 370 + ret = regmap_update_bits(chip->regmap, PV88090_REG_MASK_A, 371 + PV88090_M_VDD_FLT | PV88090_M_OVER_TEMP, 0); 372 + if (ret < 0) { 373 + dev_err(chip->dev, 374 + "Failed to update mask reg: %d\n", ret); 375 + return ret; 376 + } 377 + 378 + } else { 379 + dev_warn(chip->dev, "No IRQ configured\n"); 380 + } 381 + 382 + config.dev = chip->dev; 383 + config.regmap = chip->regmap; 384 + 385 + for (i = 0; i < PV88090_MAX_REGULATORS; i++) { 386 + if (init_data) 387 + config.init_data = &init_data[i]; 388 + 389 + if (i == PV88090_ID_BUCK2 || i == PV88090_ID_BUCK3) { 390 + ret = regmap_read(chip->regmap, 391 + pv88090_regulator_info[i].conf2, &conf2); 392 + if (ret < 0) 393 + return ret; 394 + 395 + conf2 = (conf2 >> PV88090_BUCK_VDAC_RANGE_SHIFT) & 396 + PV88090_BUCK_VDAC_RANGE_MASK; 397 + 398 + ret = regmap_read(chip->regmap, 399 + PV88090_REG_BUCK_FOLD_RANGE, &range); 400 + if (ret < 0) 401 + return ret; 402 + 403 + range = (range >> 404 + (PV88080_BUCK_VRANGE_GAIN_SHIFT + i - 1)) & 405 + PV88080_BUCK_VRANGE_GAIN_MASK; 406 + index = ((range << 1) | conf2); 407 + 408 + pv88090_regulator_info[i].desc.min_uV 409 + = pv88090_buck_vol[index].min_uV; 410 + pv88090_regulator_info[i].desc.uV_step 411 + = pv88090_buck_vol[index].uV_step; 412 + pv88090_regulator_info[i].desc.n_voltages 413 + = ((pv88090_buck_vol[index].max_uV) 414 + - (pv88090_buck_vol[index].min_uV)) 415 + /(pv88090_buck_vol[index].uV_step) + 1; 416 + } 417 + 418 + config.driver_data = (void *)&pv88090_regulator_info[i]; 419 + chip->rdev[i] = devm_regulator_register(chip->dev, 420 + &pv88090_regulator_info[i].desc, &config); 421 + if (IS_ERR(chip->rdev[i])) { 422 + dev_err(chip->dev, 423 + "Failed to register PV88090 regulator\n"); 424 + return PTR_ERR(chip->rdev[i]); 425 + } 426 + } 427 + 428 + return 0; 429 + } 430 + 431 + static const struct i2c_device_id pv88090_i2c_id[] = { 432 + {"pv88090", 0}, 433 + {}, 434 + }; 435 + MODULE_DEVICE_TABLE(i2c, pv88090_i2c_id); 436 + 437 + #ifdef CONFIG_OF 438 + static const struct of_device_id pv88090_dt_ids[] = { 439 + { .compatible = "pvs,pv88090", .data = &pv88090_i2c_id[0] }, 440 + {}, 441 + }; 442 + MODULE_DEVICE_TABLE(of, pv88090_dt_ids); 443 + #endif 444 + 445 + static struct i2c_driver pv88090_regulator_driver = { 446 + .driver = { 447 + .name = "pv88090", 448 + .of_match_table = of_match_ptr(pv88090_dt_ids), 449 + }, 450 + .probe = pv88090_i2c_probe, 451 + .id_table = pv88090_i2c_id, 452 + }; 453 + 454 + module_i2c_driver(pv88090_regulator_driver); 455 + 456 + MODULE_AUTHOR("James Ban <James.Ban.opensource@diasemi.com>"); 457 + MODULE_DESCRIPTION("Regulator device driver for Powerventure PV88090"); 458 + MODULE_LICENSE("GPL");
+98
drivers/regulator/pv88090-regulator.h
··· 1 + /* 2 + * pv88090-regulator.h - Regulator definitions for PV88090 3 + * Copyright (C) 2015 Powerventure Semiconductor Ltd. 4 + * 5 + * This program is free software; you can redistribute it and/or 6 + * modify it under the terms of the GNU General Public License 7 + * as published by the Free Software Foundation; either version 2 8 + * of the License, or (at your option) any later version. 9 + * 10 + * This program is distributed in the hope that it will be useful, 11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + */ 15 + 16 + #ifndef __PV88090_REGISTERS_H__ 17 + #define __PV88090_REGISTERS_H__ 18 + 19 + /* System Control and Event Registers */ 20 + #define PV88090_REG_EVENT_A 0x03 21 + #define PV88090_REG_MASK_A 0x06 22 + #define PV88090_REG_MASK_B 0x07 23 + 24 + /* Regulator Registers */ 25 + #define PV88090_REG_BUCK1_CONF0 0x18 26 + #define PV88090_REG_BUCK1_CONF1 0x19 27 + #define PV88090_REG_BUCK1_CONF2 0x1a 28 + #define PV88090_REG_BUCK2_CONF0 0x1b 29 + #define PV88090_REG_BUCK2_CONF1 0x1c 30 + #define PV88090_REG_BUCK2_CONF2 0x58 31 + #define PV88090_REG_BUCK3_CONF0 0x1d 32 + #define PV88090_REG_BUCK3_CONF1 0x1e 33 + #define PV88090_REG_BUCK3_CONF2 0x5c 34 + 35 + #define PV88090_REG_LDO1_CONT 0x1f 36 + #define PV88090_REG_LDO2_CONT 0x20 37 + #define PV88090_REG_LDO3_CONT 0x21 38 + #define PV88090_REG_BUCK_FOLD_RANGE 0x61 39 + 40 + /* PV88090_REG_EVENT_A (addr=0x03) */ 41 + #define PV88090_E_VDD_FLT 0x01 42 + #define PV88090_E_OVER_TEMP 0x02 43 + 44 + /* PV88090_REG_MASK_A (addr=0x06) */ 45 + #define PV88090_M_VDD_FLT 0x01 46 + #define PV88090_M_OVER_TEMP 0x02 47 + 48 + /* PV88090_REG_BUCK1_CONF0 (addr=0x18) */ 49 + #define PV88090_BUCK1_EN 0x80 50 + #define PV88090_VBUCK1_MASK 0x7F 51 + /* PV88090_REG_BUCK2_CONF0 (addr=0x1b) */ 52 + #define PV88090_BUCK2_EN 0x80 53 + #define PV88090_VBUCK2_MASK 0x7F 54 + /* PV88090_REG_BUCK3_CONF0 (addr=0x1d) */ 55 + #define PV88090_BUCK3_EN 0x80 56 + #define PV88090_VBUCK3_MASK 0x7F 57 + /* PV88090_REG_LDO1_CONT (addr=0x1f) */ 58 + #define PV88090_LDO1_EN 0x40 59 + #define PV88090_VLDO1_MASK 0x3F 60 + /* PV88090_REG_LDO2_CONT (addr=0x20) */ 61 + #define PV88090_LDO2_EN 0x40 62 + #define PV88090_VLDO2_MASK 0x3F 63 + 64 + /* PV88090_REG_BUCK1_CONF1 (addr=0x19) */ 65 + #define PV88090_BUCK1_ILIM_SHIFT 2 66 + #define PV88090_BUCK1_ILIM_MASK 0x7C 67 + #define PV88090_BUCK1_MODE_MASK 0x03 68 + 69 + /* PV88090_REG_BUCK2_CONF1 (addr=0x1c) */ 70 + #define PV88090_BUCK2_ILIM_SHIFT 2 71 + #define PV88090_BUCK2_ILIM_MASK 0x0C 72 + #define PV88090_BUCK2_MODE_MASK 0x03 73 + 74 + /* PV88090_REG_BUCK3_CONF1 (addr=0x1e) */ 75 + #define PV88090_BUCK3_ILIM_SHIFT 2 76 + #define PV88090_BUCK3_ILIM_MASK 0x0C 77 + #define PV88090_BUCK3_MODE_MASK 0x03 78 + 79 + #define PV88090_BUCK_MODE_SLEEP 0x00 80 + #define PV88090_BUCK_MODE_AUTO 0x01 81 + #define PV88090_BUCK_MODE_SYNC 0x02 82 + 83 + /* PV88090_REG_BUCK2_CONF2 (addr=0x58) */ 84 + /* PV88090_REG_BUCK3_CONF2 (addr=0x5c) */ 85 + #define PV88090_BUCK_VDAC_RANGE_SHIFT 7 86 + #define PV88090_BUCK_VDAC_RANGE_MASK 0x01 87 + 88 + #define PV88090_BUCK_VDAC_RANGE_1 0x00 89 + #define PV88090_BUCK_VDAC_RANGE_2 0x01 90 + 91 + /* PV88090_REG_BUCK_FOLD_RANGE (addr=0x61) */ 92 + #define PV88080_BUCK_VRANGE_GAIN_SHIFT 3 93 + #define PV88080_BUCK_VRANGE_GAIN_MASK 0x01 94 + 95 + #define PV88080_BUCK_VRANGE_GAIN_1 0x00 96 + #define PV88080_BUCK_VRANGE_GAIN_2 0x01 97 + 98 + #endif /* __PV88090_REGISTERS_H__ */
+159
drivers/regulator/qcom_smd-regulator.c
··· 153 153 .is_enabled = rpm_reg_is_enabled, 154 154 }; 155 155 156 + static const struct regulator_desc pma8084_hfsmps = { 157 + .linear_ranges = (struct regulator_linear_range[]) { 158 + REGULATOR_LINEAR_RANGE(375000, 0, 95, 12500), 159 + REGULATOR_LINEAR_RANGE(1550000, 96, 158, 25000), 160 + }, 161 + .n_linear_ranges = 2, 162 + .n_voltages = 159, 163 + .ops = &rpm_smps_ldo_ops, 164 + }; 165 + 166 + static const struct regulator_desc pma8084_ftsmps = { 167 + .linear_ranges = (struct regulator_linear_range[]) { 168 + REGULATOR_LINEAR_RANGE(350000, 0, 184, 5000), 169 + REGULATOR_LINEAR_RANGE(700000, 185, 339, 10000), 170 + }, 171 + .n_linear_ranges = 2, 172 + .n_voltages = 340, 173 + .ops = &rpm_smps_ldo_ops, 174 + }; 175 + 176 + static const struct regulator_desc pma8084_pldo = { 177 + .linear_ranges = (struct regulator_linear_range[]) { 178 + REGULATOR_LINEAR_RANGE(750000, 0, 30, 25000), 179 + REGULATOR_LINEAR_RANGE(1500000, 31, 99, 50000), 180 + }, 181 + .n_linear_ranges = 2, 182 + .n_voltages = 100, 183 + .ops = &rpm_smps_ldo_ops, 184 + }; 185 + 186 + static const struct regulator_desc pma8084_nldo = { 187 + .linear_ranges = (struct regulator_linear_range[]) { 188 + REGULATOR_LINEAR_RANGE(750000, 0, 63, 12500), 189 + }, 190 + .n_linear_ranges = 1, 191 + .n_voltages = 64, 192 + .ops = &rpm_smps_ldo_ops, 193 + }; 194 + 195 + static const struct regulator_desc pma8084_switch = { 196 + .ops = &rpm_switch_ops, 197 + }; 198 + 156 199 static const struct regulator_desc pm8x41_hfsmps = { 157 200 .linear_ranges = (struct regulator_linear_range[]) { 158 201 REGULATOR_LINEAR_RANGE( 375000, 0, 95, 12500), ··· 254 211 .ops = &rpm_switch_ops, 255 212 }; 256 213 214 + static const struct regulator_desc pm8916_pldo = { 215 + .linear_ranges = (struct regulator_linear_range[]) { 216 + REGULATOR_LINEAR_RANGE(750000, 0, 208, 12500), 217 + }, 218 + .n_linear_ranges = 1, 219 + .n_voltages = 209, 220 + .ops = &rpm_smps_ldo_ops, 221 + }; 222 + 223 + static const struct regulator_desc pm8916_nldo = { 224 + .linear_ranges = (struct regulator_linear_range[]) { 225 + REGULATOR_LINEAR_RANGE(375000, 0, 93, 12500), 226 + }, 227 + .n_linear_ranges = 1, 228 + .n_voltages = 94, 229 + .ops = &rpm_smps_ldo_ops, 230 + }; 231 + 232 + static const struct regulator_desc pm8916_buck_lvo_smps = { 233 + .linear_ranges = (struct regulator_linear_range[]) { 234 + REGULATOR_LINEAR_RANGE(375000, 0, 95, 12500), 235 + REGULATOR_LINEAR_RANGE(750000, 96, 127, 25000), 236 + }, 237 + .n_linear_ranges = 2, 238 + .n_voltages = 128, 239 + .ops = &rpm_smps_ldo_ops, 240 + }; 241 + 242 + static const struct regulator_desc pm8916_buck_hvo_smps = { 243 + .linear_ranges = (struct regulator_linear_range[]) { 244 + REGULATOR_LINEAR_RANGE(1550000, 0, 31, 25000), 245 + }, 246 + .n_linear_ranges = 1, 247 + .n_voltages = 32, 248 + .ops = &rpm_smps_ldo_ops, 249 + }; 250 + 257 251 struct rpm_regulator_data { 258 252 const char *name; 259 253 u32 type; ··· 308 228 { "s6", QCOM_SMD_RPM_SMPB, 6, &pm8841_ftsmps, "vdd_s6" }, 309 229 { "s7", QCOM_SMD_RPM_SMPB, 7, &pm8841_ftsmps, "vdd_s7" }, 310 230 { "s8", QCOM_SMD_RPM_SMPB, 8, &pm8841_ftsmps, "vdd_s8" }, 231 + {} 232 + }; 233 + 234 + static const struct rpm_regulator_data rpm_pm8916_regulators[] = { 235 + { "s1", QCOM_SMD_RPM_SMPA, 1, &pm8916_buck_lvo_smps, "vdd_s1" }, 236 + { "s2", QCOM_SMD_RPM_SMPA, 2, &pm8916_buck_lvo_smps, "vdd_s2" }, 237 + { "s3", QCOM_SMD_RPM_SMPA, 3, &pm8916_buck_lvo_smps, "vdd_s3" }, 238 + { "s4", QCOM_SMD_RPM_SMPA, 4, &pm8916_buck_hvo_smps, "vdd_s4" }, 239 + { "l1", QCOM_SMD_RPM_LDOA, 1, &pm8916_nldo, "vdd_l1_l2_l3" }, 240 + { "l2", QCOM_SMD_RPM_LDOA, 2, &pm8916_nldo, "vdd_l1_l2_l3" }, 241 + { "l3", QCOM_SMD_RPM_LDOA, 3, &pm8916_nldo, "vdd_l1_l2_l3" }, 242 + { "l4", QCOM_SMD_RPM_LDOA, 4, &pm8916_pldo, "vdd_l4_l5_l6" }, 243 + { "l5", QCOM_SMD_RPM_LDOA, 5, &pm8916_pldo, "vdd_l4_l5_l6" }, 244 + { "l6", QCOM_SMD_RPM_LDOA, 6, &pm8916_pldo, "vdd_l4_l5_l6" }, 245 + { "l7", QCOM_SMD_RPM_LDOA, 7, &pm8916_pldo, "vdd_l7" }, 246 + { "l8", QCOM_SMD_RPM_LDOA, 8, &pm8916_pldo, "vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18" }, 247 + { "l9", QCOM_SMD_RPM_LDOA, 9, &pm8916_pldo, "vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18" }, 248 + { "l10", QCOM_SMD_RPM_LDOA, 10, &pm8916_pldo, "vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18"}, 249 + { "l11", QCOM_SMD_RPM_LDOA, 11, &pm8916_pldo, "vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18"}, 250 + { "l12", QCOM_SMD_RPM_LDOA, 12, &pm8916_pldo, "vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18"}, 251 + { "l13", QCOM_SMD_RPM_LDOA, 13, &pm8916_pldo, "vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18"}, 252 + { "l14", QCOM_SMD_RPM_LDOA, 14, &pm8916_pldo, "vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18"}, 253 + { "l15", QCOM_SMD_RPM_LDOA, 15, &pm8916_pldo, "vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18"}, 254 + { "l16", QCOM_SMD_RPM_LDOA, 16, &pm8916_pldo, "vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18"}, 255 + { "l17", QCOM_SMD_RPM_LDOA, 17, &pm8916_pldo, "vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18"}, 256 + { "l18", QCOM_SMD_RPM_LDOA, 18, &pm8916_pldo, "vdd_l8_l9_l10_l11_l12_l13_l14_l15_l16_l17_l18"}, 311 257 {} 312 258 }; 313 259 ··· 378 272 {} 379 273 }; 380 274 275 + static const struct rpm_regulator_data rpm_pma8084_regulators[] = { 276 + { "s1", QCOM_SMD_RPM_SMPA, 1, &pma8084_ftsmps, "vdd_s1" }, 277 + { "s2", QCOM_SMD_RPM_SMPA, 2, &pma8084_ftsmps, "vdd_s2" }, 278 + { "s3", QCOM_SMD_RPM_SMPA, 3, &pma8084_hfsmps, "vdd_s3" }, 279 + { "s4", QCOM_SMD_RPM_SMPA, 4, &pma8084_hfsmps, "vdd_s4" }, 280 + { "s5", QCOM_SMD_RPM_SMPA, 5, &pma8084_hfsmps, "vdd_s5" }, 281 + { "s6", QCOM_SMD_RPM_SMPA, 6, &pma8084_ftsmps, "vdd_s6" }, 282 + { "s7", QCOM_SMD_RPM_SMPA, 7, &pma8084_ftsmps, "vdd_s7" }, 283 + { "s8", QCOM_SMD_RPM_SMPA, 8, &pma8084_ftsmps, "vdd_s8" }, 284 + { "s9", QCOM_SMD_RPM_SMPA, 9, &pma8084_ftsmps, "vdd_s9" }, 285 + { "s10", QCOM_SMD_RPM_SMPA, 10, &pma8084_ftsmps, "vdd_s10" }, 286 + { "s11", QCOM_SMD_RPM_SMPA, 11, &pma8084_ftsmps, "vdd_s11" }, 287 + { "s12", QCOM_SMD_RPM_SMPA, 12, &pma8084_ftsmps, "vdd_s12" }, 288 + 289 + { "l1", QCOM_SMD_RPM_LDOA, 1, &pma8084_nldo, "vdd_l1_l11" }, 290 + { "l2", QCOM_SMD_RPM_LDOA, 2, &pma8084_nldo, "vdd_l2_l3_l4_l27" }, 291 + { "l3", QCOM_SMD_RPM_LDOA, 3, &pma8084_nldo, "vdd_l2_l3_l4_l27" }, 292 + { "l4", QCOM_SMD_RPM_LDOA, 4, &pma8084_nldo, "vdd_l2_l3_l4_l27" }, 293 + { "l5", QCOM_SMD_RPM_LDOA, 5, &pma8084_pldo, "vdd_l5_l7" }, 294 + { "l6", QCOM_SMD_RPM_LDOA, 6, &pma8084_pldo, "vdd_l6_l12_l14_l15_l26" }, 295 + { "l7", QCOM_SMD_RPM_LDOA, 7, &pma8084_pldo, "vdd_l5_l7" }, 296 + { "l8", QCOM_SMD_RPM_LDOA, 8, &pma8084_pldo, "vdd_l8" }, 297 + { "l9", QCOM_SMD_RPM_LDOA, 9, &pma8084_pldo, "vdd_l9_l10_l13_l20_l23_l24" }, 298 + { "l10", QCOM_SMD_RPM_LDOA, 10, &pma8084_pldo, "vdd_l9_l10_l13_l20_l23_l24" }, 299 + { "l11", QCOM_SMD_RPM_LDOA, 11, &pma8084_nldo, "vdd_l1_l11" }, 300 + { "l12", QCOM_SMD_RPM_LDOA, 12, &pma8084_pldo, "vdd_l6_l12_l14_l15_l26" }, 301 + { "l13", QCOM_SMD_RPM_LDOA, 13, &pma8084_pldo, "vdd_l9_l10_l13_l20_l23_l24" }, 302 + { "l14", QCOM_SMD_RPM_LDOA, 14, &pma8084_pldo, "vdd_l6_l12_l14_l15_l26" }, 303 + { "l15", QCOM_SMD_RPM_LDOA, 15, &pma8084_pldo, "vdd_l6_l12_l14_l15_l26" }, 304 + { "l16", QCOM_SMD_RPM_LDOA, 16, &pma8084_pldo, "vdd_l16_l25" }, 305 + { "l17", QCOM_SMD_RPM_LDOA, 17, &pma8084_pldo, "vdd_l17" }, 306 + { "l18", QCOM_SMD_RPM_LDOA, 18, &pma8084_pldo, "vdd_l18" }, 307 + { "l19", QCOM_SMD_RPM_LDOA, 19, &pma8084_pldo, "vdd_l19" }, 308 + { "l20", QCOM_SMD_RPM_LDOA, 20, &pma8084_pldo, "vdd_l9_l10_l13_l20_l23_l24" }, 309 + { "l21", QCOM_SMD_RPM_LDOA, 21, &pma8084_pldo, "vdd_l21" }, 310 + { "l22", QCOM_SMD_RPM_LDOA, 22, &pma8084_pldo, "vdd_l22" }, 311 + { "l23", QCOM_SMD_RPM_LDOA, 23, &pma8084_pldo, "vdd_l9_l10_l13_l20_l23_l24" }, 312 + { "l24", QCOM_SMD_RPM_LDOA, 24, &pma8084_pldo, "vdd_l9_l10_l13_l20_l23_l24" }, 313 + { "l25", QCOM_SMD_RPM_LDOA, 25, &pma8084_pldo, "vdd_l16_l25" }, 314 + { "l26", QCOM_SMD_RPM_LDOA, 26, &pma8084_pldo, "vdd_l6_l12_l14_l15_l26" }, 315 + { "l27", QCOM_SMD_RPM_LDOA, 27, &pma8084_nldo, "vdd_l2_l3_l4_l27" }, 316 + 317 + { "lvs1", QCOM_SMD_RPM_VSA, 1, &pma8084_switch }, 318 + { "lvs2", QCOM_SMD_RPM_VSA, 2, &pma8084_switch }, 319 + { "lvs3", QCOM_SMD_RPM_VSA, 3, &pma8084_switch }, 320 + { "lvs4", QCOM_SMD_RPM_VSA, 4, &pma8084_switch }, 321 + { "5vs1", QCOM_SMD_RPM_VSA, 5, &pma8084_switch }, 322 + 323 + {} 324 + }; 325 + 381 326 static const struct of_device_id rpm_of_match[] = { 382 327 { .compatible = "qcom,rpm-pm8841-regulators", .data = &rpm_pm8841_regulators }, 328 + { .compatible = "qcom,rpm-pm8916-regulators", .data = &rpm_pm8916_regulators }, 383 329 { .compatible = "qcom,rpm-pm8941-regulators", .data = &rpm_pm8941_regulators }, 330 + { .compatible = "qcom,rpm-pma8084-regulators", .data = &rpm_pma8084_regulators }, 384 331 {} 385 332 }; 386 333 MODULE_DEVICE_TABLE(of, rpm_of_match);
+12 -83
drivers/regulator/tps6105x-regulator.c
··· 27 27 5000000, /* There is an additional 5V */ 28 28 }; 29 29 30 - static int tps6105x_regulator_enable(struct regulator_dev *rdev) 31 - { 32 - struct tps6105x *tps6105x = rdev_get_drvdata(rdev); 33 - int ret; 34 - 35 - /* Activate voltage mode */ 36 - ret = regmap_update_bits(tps6105x->regmap, TPS6105X_REG_0, 37 - TPS6105X_REG0_MODE_MASK, 38 - TPS6105X_REG0_MODE_VOLTAGE << TPS6105X_REG0_MODE_SHIFT); 39 - if (ret) 40 - return ret; 41 - 42 - return 0; 43 - } 44 - 45 - static int tps6105x_regulator_disable(struct regulator_dev *rdev) 46 - { 47 - struct tps6105x *tps6105x = rdev_get_drvdata(rdev); 48 - int ret; 49 - 50 - /* Set into shutdown mode */ 51 - ret = regmap_update_bits(tps6105x->regmap, TPS6105X_REG_0, 52 - TPS6105X_REG0_MODE_MASK, 53 - TPS6105X_REG0_MODE_SHUTDOWN << TPS6105X_REG0_MODE_SHIFT); 54 - if (ret) 55 - return ret; 56 - 57 - return 0; 58 - } 59 - 60 - static int tps6105x_regulator_is_enabled(struct regulator_dev *rdev) 61 - { 62 - struct tps6105x *tps6105x = rdev_get_drvdata(rdev); 63 - unsigned int regval; 64 - int ret; 65 - 66 - ret = regmap_read(tps6105x->regmap, TPS6105X_REG_0, &regval); 67 - if (ret) 68 - return ret; 69 - regval &= TPS6105X_REG0_MODE_MASK; 70 - regval >>= TPS6105X_REG0_MODE_SHIFT; 71 - 72 - if (regval == TPS6105X_REG0_MODE_VOLTAGE) 73 - return 1; 74 - 75 - return 0; 76 - } 77 - 78 - static int tps6105x_regulator_get_voltage_sel(struct regulator_dev *rdev) 79 - { 80 - struct tps6105x *tps6105x = rdev_get_drvdata(rdev); 81 - unsigned int regval; 82 - int ret; 83 - 84 - ret = regmap_read(tps6105x->regmap, TPS6105X_REG_0, &regval); 85 - if (ret) 86 - return ret; 87 - 88 - regval &= TPS6105X_REG0_VOLTAGE_MASK; 89 - regval >>= TPS6105X_REG0_VOLTAGE_SHIFT; 90 - return (int) regval; 91 - } 92 - 93 - static int tps6105x_regulator_set_voltage_sel(struct regulator_dev *rdev, 94 - unsigned selector) 95 - { 96 - struct tps6105x *tps6105x = rdev_get_drvdata(rdev); 97 - int ret; 98 - 99 - ret = regmap_update_bits(tps6105x->regmap, TPS6105X_REG_0, 100 - TPS6105X_REG0_VOLTAGE_MASK, 101 - selector << TPS6105X_REG0_VOLTAGE_SHIFT); 102 - if (ret) 103 - return ret; 104 - 105 - return 0; 106 - } 107 - 108 30 static struct regulator_ops tps6105x_regulator_ops = { 109 - .enable = tps6105x_regulator_enable, 110 - .disable = tps6105x_regulator_disable, 111 - .is_enabled = tps6105x_regulator_is_enabled, 112 - .get_voltage_sel = tps6105x_regulator_get_voltage_sel, 113 - .set_voltage_sel = tps6105x_regulator_set_voltage_sel, 31 + .enable = regulator_enable_regmap, 32 + .disable = regulator_disable_regmap, 33 + .is_enabled = regulator_is_enabled_regmap, 34 + .get_voltage_sel = regulator_get_voltage_sel_regmap, 35 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 114 36 .list_voltage = regulator_list_voltage_table, 115 37 }; 116 38 ··· 44 122 .owner = THIS_MODULE, 45 123 .n_voltages = ARRAY_SIZE(tps6105x_voltages), 46 124 .volt_table = tps6105x_voltages, 125 + .vsel_reg = TPS6105X_REG_0, 126 + .vsel_mask = TPS6105X_REG0_VOLTAGE_MASK, 127 + .enable_reg = TPS6105X_REG_0, 128 + .enable_mask = TPS6105X_REG0_MODE_MASK, 129 + .enable_val = TPS6105X_REG0_MODE_VOLTAGE << 130 + TPS6105X_REG0_MODE_SHIFT, 47 131 }; 48 132 49 133 /* ··· 72 144 config.dev = &tps6105x->client->dev; 73 145 config.init_data = pdata->regulator_data; 74 146 config.driver_data = tps6105x; 147 + config.regmap = tps6105x->regmap; 75 148 76 149 /* Register regulator with framework */ 77 150 tps6105x->regulator = devm_regulator_register(&pdev->dev,
+251
drivers/regulator/tps65086-regulator.c
··· 1 + /* 2 + * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/ 3 + * 4 + * Author: Andrew F. Davis <afd@ti.com> 5 + * 6 + * This program is free software; you can redistribute it and/or 7 + * modify it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + * 10 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 11 + * kind, whether expressed or implied; without even the implied warranty 12 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License version 2 for more details. 14 + * 15 + * Based on the TPS65912 driver 16 + */ 17 + 18 + #include <linux/module.h> 19 + #include <linux/of.h> 20 + #include <linux/platform_device.h> 21 + #include <linux/regulator/driver.h> 22 + 23 + #include <linux/mfd/tps65086.h> 24 + 25 + enum tps65086_regulators { BUCK1, BUCK2, BUCK3, BUCK4, BUCK5, BUCK6, LDOA1, 26 + LDOA2, LDOA3, SWA1, SWB1, SWB2, VTT }; 27 + 28 + #define TPS65086_REGULATOR(_name, _of, _id, _nv, _vr, _vm, _er, _em, _lr, _dr, _dm) \ 29 + [_id] = { \ 30 + .desc = { \ 31 + .name = _name, \ 32 + .of_match = of_match_ptr(_of), \ 33 + .regulators_node = "regulators", \ 34 + .of_parse_cb = tps65086_of_parse_cb, \ 35 + .id = _id, \ 36 + .ops = &reg_ops, \ 37 + .n_voltages = _nv, \ 38 + .type = REGULATOR_VOLTAGE, \ 39 + .owner = THIS_MODULE, \ 40 + .vsel_reg = _vr, \ 41 + .vsel_mask = _vm, \ 42 + .enable_reg = _er, \ 43 + .enable_mask = _em, \ 44 + .volt_table = NULL, \ 45 + .linear_ranges = _lr, \ 46 + .n_linear_ranges = ARRAY_SIZE(_lr), \ 47 + }, \ 48 + .decay_reg = _dr, \ 49 + .decay_mask = _dm, \ 50 + } 51 + 52 + #define TPS65086_SWITCH(_name, _of, _id, _er, _em) \ 53 + [_id] = { \ 54 + .desc = { \ 55 + .name = _name, \ 56 + .of_match = of_match_ptr(_of), \ 57 + .regulators_node = "regulators", \ 58 + .of_parse_cb = tps65086_of_parse_cb, \ 59 + .id = _id, \ 60 + .ops = &switch_ops, \ 61 + .type = REGULATOR_VOLTAGE, \ 62 + .owner = THIS_MODULE, \ 63 + .enable_reg = _er, \ 64 + .enable_mask = _em, \ 65 + }, \ 66 + } 67 + 68 + struct tps65086_regulator { 69 + struct regulator_desc desc; 70 + unsigned int decay_reg; 71 + unsigned int decay_mask; 72 + }; 73 + 74 + static const struct regulator_linear_range tps65086_buck126_10mv_ranges[] = { 75 + REGULATOR_LINEAR_RANGE(0, 0x0, 0x0, 0), 76 + REGULATOR_LINEAR_RANGE(410000, 0x1, 0x7F, 10000), 77 + }; 78 + 79 + static const struct regulator_linear_range tps65086_buck126_25mv_ranges[] = { 80 + REGULATOR_LINEAR_RANGE(0, 0x0, 0x0, 0), 81 + REGULATOR_LINEAR_RANGE(1000000, 0x1, 0x18, 0), 82 + REGULATOR_LINEAR_RANGE(1025000, 0x19, 0x7F, 25000), 83 + }; 84 + 85 + static const struct regulator_linear_range tps65086_buck345_ranges[] = { 86 + REGULATOR_LINEAR_RANGE(0, 0x0, 0x0, 0), 87 + REGULATOR_LINEAR_RANGE(425000, 0x1, 0x7F, 25000), 88 + }; 89 + 90 + static const struct regulator_linear_range tps65086_ldoa1_ranges[] = { 91 + REGULATOR_LINEAR_RANGE(1350000, 0x0, 0x0, 0), 92 + REGULATOR_LINEAR_RANGE(1500000, 0x1, 0x7, 100000), 93 + REGULATOR_LINEAR_RANGE(2300000, 0x8, 0xA, 100000), 94 + REGULATOR_LINEAR_RANGE(2700000, 0xB, 0xD, 150000), 95 + REGULATOR_LINEAR_RANGE(3300000, 0xE, 0xE, 0), 96 + }; 97 + 98 + static const struct regulator_linear_range tps65086_ldoa23_ranges[] = { 99 + REGULATOR_LINEAR_RANGE(700000, 0x0, 0xD, 50000), 100 + REGULATOR_LINEAR_RANGE(1400000, 0xE, 0xF, 100000), 101 + }; 102 + 103 + /* Operations permitted on regulators */ 104 + static struct regulator_ops reg_ops = { 105 + .enable = regulator_enable_regmap, 106 + .disable = regulator_disable_regmap, 107 + .is_enabled = regulator_is_enabled_regmap, 108 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 109 + .map_voltage = regulator_map_voltage_linear_range, 110 + .get_voltage_sel = regulator_get_voltage_sel_regmap, 111 + .list_voltage = regulator_list_voltage_linear_range, 112 + }; 113 + 114 + /* Operations permitted on load switches */ 115 + static struct regulator_ops switch_ops = { 116 + .enable = regulator_enable_regmap, 117 + .disable = regulator_disable_regmap, 118 + .is_enabled = regulator_is_enabled_regmap, 119 + }; 120 + 121 + static int tps65086_of_parse_cb(struct device_node *dev, 122 + const struct regulator_desc *desc, 123 + struct regulator_config *config); 124 + 125 + static struct tps65086_regulator regulators[] = { 126 + TPS65086_REGULATOR("BUCK1", "buck1", BUCK1, 0x80, TPS65086_BUCK1CTRL, 127 + BUCK_VID_MASK, TPS65086_BUCK123CTRL, BIT(0), 128 + tps65086_buck126_10mv_ranges, TPS65086_BUCK1CTRL, 129 + BIT(0)), 130 + TPS65086_REGULATOR("BUCK2", "buck2", BUCK2, 0x80, TPS65086_BUCK2CTRL, 131 + BUCK_VID_MASK, TPS65086_BUCK123CTRL, BIT(1), 132 + tps65086_buck126_10mv_ranges, TPS65086_BUCK2CTRL, 133 + BIT(0)), 134 + TPS65086_REGULATOR("BUCK3", "buck3", BUCK3, 0x80, TPS65086_BUCK3VID, 135 + BUCK_VID_MASK, TPS65086_BUCK123CTRL, BIT(2), 136 + tps65086_buck345_ranges, TPS65086_BUCK3DECAY, 137 + BIT(0)), 138 + TPS65086_REGULATOR("BUCK4", "buck4", BUCK4, 0x80, TPS65086_BUCK4VID, 139 + BUCK_VID_MASK, TPS65086_BUCK4CTRL, BIT(0), 140 + tps65086_buck345_ranges, TPS65086_BUCK4VID, 141 + BIT(0)), 142 + TPS65086_REGULATOR("BUCK5", "buck5", BUCK5, 0x80, TPS65086_BUCK5VID, 143 + BUCK_VID_MASK, TPS65086_BUCK5CTRL, BIT(0), 144 + tps65086_buck345_ranges, TPS65086_BUCK5CTRL, 145 + BIT(0)), 146 + TPS65086_REGULATOR("BUCK6", "buck6", BUCK6, 0x80, TPS65086_BUCK6VID, 147 + BUCK_VID_MASK, TPS65086_BUCK6CTRL, BIT(0), 148 + tps65086_buck126_10mv_ranges, TPS65086_BUCK6CTRL, 149 + BIT(0)), 150 + TPS65086_REGULATOR("LDOA1", "ldoa1", LDOA1, 0xF, TPS65086_LDOA1CTRL, 151 + VDOA1_VID_MASK, TPS65086_LDOA1CTRL, BIT(0), 152 + tps65086_ldoa1_ranges, 0, 0), 153 + TPS65086_REGULATOR("LDOA2", "ldoa2", LDOA2, 0x10, TPS65086_LDOA2VID, 154 + VDOA23_VID_MASK, TPS65086_LDOA2CTRL, BIT(0), 155 + tps65086_ldoa23_ranges, 0, 0), 156 + TPS65086_REGULATOR("LDOA3", "ldoa3", LDOA3, 0x10, TPS65086_LDOA3VID, 157 + VDOA23_VID_MASK, TPS65086_LDOA3CTRL, BIT(0), 158 + tps65086_ldoa23_ranges, 0, 0), 159 + TPS65086_SWITCH("SWA1", "swa1", SWA1, TPS65086_SWVTT_EN, BIT(5)), 160 + TPS65086_SWITCH("SWB1", "swa2", SWB1, TPS65086_SWVTT_EN, BIT(6)), 161 + TPS65086_SWITCH("SWB2", "swa3", SWB2, TPS65086_SWVTT_EN, BIT(7)), 162 + TPS65086_SWITCH("VTT", "vtt", VTT, TPS65086_SWVTT_EN, BIT(4)), 163 + }; 164 + 165 + static inline bool has_25mv_mode(int id) 166 + { 167 + switch (id) { 168 + case BUCK1: 169 + case BUCK2: 170 + case BUCK6: 171 + return true; 172 + default: 173 + return false; 174 + } 175 + } 176 + 177 + static int tps65086_of_parse_cb(struct device_node *dev, 178 + const struct regulator_desc *desc, 179 + struct regulator_config *config) 180 + { 181 + int ret; 182 + 183 + /* Check for 25mV step mode */ 184 + if (has_25mv_mode(desc->id) && 185 + of_property_read_bool(config->of_node, "ti,regulator-step-size-25mv")) { 186 + regulators[desc->id].desc.linear_ranges = 187 + tps65086_buck126_25mv_ranges; 188 + regulators[desc->id].desc.n_linear_ranges = 189 + ARRAY_SIZE(tps65086_buck126_25mv_ranges); 190 + } 191 + 192 + /* Check for decay mode */ 193 + if (desc->id <= BUCK6 && of_property_read_bool(config->of_node, "ti,regulator-decay")) { 194 + ret = regmap_write_bits(config->regmap, 195 + regulators[desc->id].decay_reg, 196 + regulators[desc->id].decay_mask, 197 + regulators[desc->id].decay_mask); 198 + if (ret) { 199 + dev_err(config->dev, "Error setting decay\n"); 200 + return ret; 201 + } 202 + } 203 + 204 + return 0; 205 + } 206 + 207 + static int tps65086_regulator_probe(struct platform_device *pdev) 208 + { 209 + struct tps65086 *tps = dev_get_drvdata(pdev->dev.parent); 210 + struct regulator_config config = { }; 211 + struct regulator_dev *rdev; 212 + int i; 213 + 214 + platform_set_drvdata(pdev, tps); 215 + 216 + config.dev = &pdev->dev; 217 + config.dev->of_node = tps->dev->of_node; 218 + config.driver_data = tps; 219 + config.regmap = tps->regmap; 220 + 221 + for (i = 0; i < ARRAY_SIZE(regulators); i++) { 222 + rdev = devm_regulator_register(&pdev->dev, &regulators[i].desc, 223 + &config); 224 + if (IS_ERR(rdev)) { 225 + dev_err(tps->dev, "failed to register %s regulator\n", 226 + pdev->name); 227 + return PTR_ERR(rdev); 228 + } 229 + } 230 + 231 + return 0; 232 + } 233 + 234 + static const struct platform_device_id tps65086_regulator_id_table[] = { 235 + { "tps65086-regulator", }, 236 + { /* sentinel */ } 237 + }; 238 + MODULE_DEVICE_TABLE(platform, tps65086_regulator_id_table); 239 + 240 + static struct platform_driver tps65086_regulator_driver = { 241 + .driver = { 242 + .name = "tps65086-regulator", 243 + }, 244 + .probe = tps65086_regulator_probe, 245 + .id_table = tps65086_regulator_id_table, 246 + }; 247 + module_platform_driver(tps65086_regulator_driver); 248 + 249 + MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>"); 250 + MODULE_DESCRIPTION("TPS65086 Regulator driver"); 251 + MODULE_LICENSE("GPL v2");
+107 -30
drivers/regulator/tps65218-regulator.c
··· 27 27 #include <linux/regulator/machine.h> 28 28 #include <linux/mfd/tps65218.h> 29 29 30 - enum tps65218_regulators { DCDC1, DCDC2, DCDC3, DCDC4, DCDC5, DCDC6, LDO1 }; 30 + enum tps65218_regulators { DCDC1, DCDC2, DCDC3, DCDC4, 31 + DCDC5, DCDC6, LDO1, LS3 }; 31 32 32 - #define TPS65218_REGULATOR(_name, _id, _ops, _n, _vr, _vm, _er, _em, \ 33 - _lr, _nlr, _delay, _fuv) \ 33 + #define TPS65218_REGULATOR(_name, _id, _type, _ops, _n, _vr, _vm, _er, _em, \ 34 + _cr, _cm, _lr, _nlr, _delay, _fuv) \ 34 35 { \ 35 36 .name = _name, \ 36 37 .id = _id, \ 37 38 .ops = &_ops, \ 38 39 .n_voltages = _n, \ 39 - .type = REGULATOR_VOLTAGE, \ 40 + .type = _type, \ 40 41 .owner = THIS_MODULE, \ 41 42 .vsel_reg = _vr, \ 42 43 .vsel_mask = _vm, \ 44 + .csel_reg = _cr, \ 45 + .csel_mask = _cm, \ 43 46 .enable_reg = _er, \ 44 47 .enable_mask = _em, \ 45 48 .volt_table = NULL, \ ··· 83 80 TPS65218_INFO(DCDC5, "DCDC5", 1000000, 1000000), 84 81 TPS65218_INFO(DCDC6, "DCDC6", 1800000, 1800000), 85 82 TPS65218_INFO(LDO1, "LDO1", 900000, 3400000), 83 + TPS65218_INFO(LS3, "LS3", -1, -1), 86 84 }; 87 85 88 86 #define TPS65218_OF_MATCH(comp, label) \ ··· 100 96 TPS65218_OF_MATCH("ti,tps65218-dcdc5", tps65218_pmic_regs[DCDC5]), 101 97 TPS65218_OF_MATCH("ti,tps65218-dcdc6", tps65218_pmic_regs[DCDC6]), 102 98 TPS65218_OF_MATCH("ti,tps65218-ldo1", tps65218_pmic_regs[LDO1]), 99 + TPS65218_OF_MATCH("ti,tps65218-ls3", tps65218_pmic_regs[LS3]), 103 100 { } 104 101 }; 105 102 MODULE_DEVICE_TABLE(of, tps65218_of_match); ··· 180 175 .map_voltage = regulator_map_voltage_linear_range, 181 176 }; 182 177 178 + static const int ls3_currents[] = { 100, 200, 500, 1000 }; 179 + 180 + static int tps65218_pmic_set_input_current_lim(struct regulator_dev *dev, 181 + int lim_uA) 182 + { 183 + unsigned int index = 0; 184 + unsigned int num_currents = ARRAY_SIZE(ls3_currents); 185 + struct tps65218 *tps = rdev_get_drvdata(dev); 186 + 187 + while (index < num_currents && ls3_currents[index] != lim_uA) 188 + index++; 189 + 190 + if (index == num_currents) 191 + return -EINVAL; 192 + 193 + return tps65218_set_bits(tps, dev->desc->csel_reg, dev->desc->csel_mask, 194 + index << 2, TPS65218_PROTECT_L1); 195 + } 196 + 197 + static int tps65218_pmic_set_current_limit(struct regulator_dev *dev, 198 + int min_uA, int max_uA) 199 + { 200 + int index = 0; 201 + unsigned int num_currents = ARRAY_SIZE(ls3_currents); 202 + struct tps65218 *tps = rdev_get_drvdata(dev); 203 + 204 + while (index < num_currents && ls3_currents[index] < max_uA) 205 + index++; 206 + 207 + index--; 208 + 209 + if (index < 0 || ls3_currents[index] < min_uA) 210 + return -EINVAL; 211 + 212 + return tps65218_set_bits(tps, dev->desc->csel_reg, dev->desc->csel_mask, 213 + index << 2, TPS65218_PROTECT_L1); 214 + } 215 + 216 + static int tps65218_pmic_get_current_limit(struct regulator_dev *dev) 217 + { 218 + int retval; 219 + unsigned int index; 220 + struct tps65218 *tps = rdev_get_drvdata(dev); 221 + 222 + retval = tps65218_reg_read(tps, dev->desc->csel_reg, &index); 223 + if (retval < 0) 224 + return retval; 225 + 226 + index = (index & dev->desc->csel_mask) >> 2; 227 + 228 + return ls3_currents[index]; 229 + } 230 + 231 + static struct regulator_ops tps65218_ls3_ops = { 232 + .is_enabled = regulator_is_enabled_regmap, 233 + .enable = tps65218_pmic_enable, 234 + .disable = tps65218_pmic_disable, 235 + .set_input_current_limit = tps65218_pmic_set_input_current_lim, 236 + .set_current_limit = tps65218_pmic_set_current_limit, 237 + .get_current_limit = tps65218_pmic_get_current_limit, 238 + }; 239 + 183 240 /* Operations permitted on DCDC5, DCDC6 */ 184 241 static struct regulator_ops tps65218_dcdc56_pmic_ops = { 185 242 .is_enabled = regulator_is_enabled_regmap, ··· 250 183 }; 251 184 252 185 static const struct regulator_desc regulators[] = { 253 - TPS65218_REGULATOR("DCDC1", TPS65218_DCDC_1, tps65218_dcdc12_ops, 64, 254 - TPS65218_REG_CONTROL_DCDC1, 255 - TPS65218_CONTROL_DCDC1_MASK, 256 - TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC1_EN, 257 - dcdc1_dcdc2_ranges, 2, 4000, 0), 258 - TPS65218_REGULATOR("DCDC2", TPS65218_DCDC_2, tps65218_dcdc12_ops, 64, 259 - TPS65218_REG_CONTROL_DCDC2, 260 - TPS65218_CONTROL_DCDC2_MASK, 261 - TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC2_EN, 262 - dcdc1_dcdc2_ranges, 2, 4000, 0), 263 - TPS65218_REGULATOR("DCDC3", TPS65218_DCDC_3, tps65218_ldo1_dcdc34_ops, 264 - 64, TPS65218_REG_CONTROL_DCDC3, 186 + TPS65218_REGULATOR("DCDC1", TPS65218_DCDC_1, REGULATOR_VOLTAGE, 187 + tps65218_dcdc12_ops, 64, TPS65218_REG_CONTROL_DCDC1, 188 + TPS65218_CONTROL_DCDC1_MASK, TPS65218_REG_ENABLE1, 189 + TPS65218_ENABLE1_DC1_EN, 0, 0, dcdc1_dcdc2_ranges, 190 + 2, 4000, 0), 191 + TPS65218_REGULATOR("DCDC2", TPS65218_DCDC_2, REGULATOR_VOLTAGE, 192 + tps65218_dcdc12_ops, 64, TPS65218_REG_CONTROL_DCDC2, 193 + TPS65218_CONTROL_DCDC2_MASK, TPS65218_REG_ENABLE1, 194 + TPS65218_ENABLE1_DC2_EN, 0, 0, dcdc1_dcdc2_ranges, 195 + 2, 4000, 0), 196 + TPS65218_REGULATOR("DCDC3", TPS65218_DCDC_3, REGULATOR_VOLTAGE, 197 + tps65218_ldo1_dcdc34_ops, 64, 198 + TPS65218_REG_CONTROL_DCDC3, 265 199 TPS65218_CONTROL_DCDC3_MASK, TPS65218_REG_ENABLE1, 266 - TPS65218_ENABLE1_DC3_EN, ldo1_dcdc3_ranges, 2, 0, 0), 267 - TPS65218_REGULATOR("DCDC4", TPS65218_DCDC_4, tps65218_ldo1_dcdc34_ops, 268 - 53, TPS65218_REG_CONTROL_DCDC4, 269 - TPS65218_CONTROL_DCDC4_MASK, 270 - TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC4_EN, 271 - dcdc4_ranges, 2, 0, 0), 272 - TPS65218_REGULATOR("DCDC5", TPS65218_DCDC_5, tps65218_dcdc56_pmic_ops, 273 - 1, -1, -1, TPS65218_REG_ENABLE1, 274 - TPS65218_ENABLE1_DC5_EN, NULL, 0, 0, 1000000), 275 - TPS65218_REGULATOR("DCDC6", TPS65218_DCDC_6, tps65218_dcdc56_pmic_ops, 276 - 1, -1, -1, TPS65218_REG_ENABLE1, 277 - TPS65218_ENABLE1_DC6_EN, NULL, 0, 0, 1800000), 278 - TPS65218_REGULATOR("LDO1", TPS65218_LDO_1, tps65218_ldo1_dcdc34_ops, 64, 200 + TPS65218_ENABLE1_DC3_EN, 0, 0, ldo1_dcdc3_ranges, 2, 201 + 0, 0), 202 + TPS65218_REGULATOR("DCDC4", TPS65218_DCDC_4, REGULATOR_VOLTAGE, 203 + tps65218_ldo1_dcdc34_ops, 53, 204 + TPS65218_REG_CONTROL_DCDC4, 205 + TPS65218_CONTROL_DCDC4_MASK, TPS65218_REG_ENABLE1, 206 + TPS65218_ENABLE1_DC4_EN, 0, 0, dcdc4_ranges, 2, 207 + 0, 0), 208 + TPS65218_REGULATOR("DCDC5", TPS65218_DCDC_5, REGULATOR_VOLTAGE, 209 + tps65218_dcdc56_pmic_ops, 1, -1, -1, 210 + TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC5_EN, 0, 0, 211 + NULL, 0, 0, 1000000), 212 + TPS65218_REGULATOR("DCDC6", TPS65218_DCDC_6, REGULATOR_VOLTAGE, 213 + tps65218_dcdc56_pmic_ops, 1, -1, -1, 214 + TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC6_EN, 0, 0, 215 + NULL, 0, 0, 1800000), 216 + TPS65218_REGULATOR("LDO1", TPS65218_LDO_1, REGULATOR_VOLTAGE, 217 + tps65218_ldo1_dcdc34_ops, 64, 279 218 TPS65218_REG_CONTROL_LDO1, 280 219 TPS65218_CONTROL_LDO1_MASK, TPS65218_REG_ENABLE2, 281 - TPS65218_ENABLE2_LDO1_EN, ldo1_dcdc3_ranges, 220 + TPS65218_ENABLE2_LDO1_EN, 0, 0, ldo1_dcdc3_ranges, 282 221 2, 0, 0), 222 + TPS65218_REGULATOR("LS3", TPS65218_LS_3, REGULATOR_CURRENT, 223 + tps65218_ls3_ops, 0, 0, 0, TPS65218_REG_ENABLE2, 224 + TPS65218_ENABLE2_LS3_EN, TPS65218_REG_CONFIG2, 225 + TPS65218_CONFIG2_LS3ILIM_MASK, NULL, 0, 0, 0), 283 226 }; 284 227 285 228 static int tps65218_regulator_probe(struct platform_device *pdev)
+6 -1
include/linux/mfd/tps65218.h
··· 200 200 TPS65218_DCDC_4, 201 201 TPS65218_DCDC_5, 202 202 TPS65218_DCDC_6, 203 + /* LS's */ 204 + TPS65218_LS_3, 203 205 /* LDOs */ 204 206 TPS65218_LDO_1, 205 207 }; ··· 212 210 #define TPS65218_NUM_DCDC 6 213 211 /* Number of LDO voltage regulators available */ 214 212 #define TPS65218_NUM_LDO 1 213 + /* Number of total LS current regulators available */ 214 + #define TPS65218_NUM_LS 1 215 215 /* Number of total regulators available */ 216 - #define TPS65218_NUM_REGULATOR (TPS65218_NUM_DCDC + TPS65218_NUM_LDO) 216 + #define TPS65218_NUM_REGULATOR (TPS65218_NUM_DCDC + TPS65218_NUM_LDO \ 217 + + TPS65218_NUM_LS) 217 218 218 219 /* Define the TPS65218 IRQ numbers */ 219 220 enum tps65218_irqs {
+2
include/linux/regulator/driver.h
··· 302 302 303 303 unsigned int vsel_reg; 304 304 unsigned int vsel_mask; 305 + unsigned int csel_reg; 306 + unsigned int csel_mask; 305 307 unsigned int apply_reg; 306 308 unsigned int apply_bit; 307 309 unsigned int enable_reg;