diff options
| -rw-r--r-- | drivers/regulator/Kconfig | 8 | ||||
| -rw-r--r-- | drivers/regulator/Makefile | 1 | ||||
| -rw-r--r-- | drivers/regulator/bcm590xx-regulator.c | 403 | ||||
| -rw-r--r-- | drivers/regulator/da9052-regulator.c | 29 | ||||
| -rw-r--r-- | drivers/regulator/da9055-regulator.c | 69 | ||||
| -rw-r--r-- | drivers/regulator/da9063-regulator.c | 13 | ||||
| -rw-r--r-- | drivers/regulator/da9210-regulator.c | 5 | ||||
| -rw-r--r-- | drivers/regulator/db8500-prcmu.c | 2 | ||||
| -rw-r--r-- | drivers/regulator/dbx500-prcmu.c | 16 |
9 files changed, 520 insertions, 26 deletions
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 6a7932822e37..1169a42519d5 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
| @@ -139,6 +139,14 @@ config REGULATOR_AS3722 | |||
| 139 | AS3722 PMIC. This will enable support for all the software | 139 | AS3722 PMIC. This will enable support for all the software |
| 140 | controllable DCDC/LDO regulators. | 140 | controllable DCDC/LDO regulators. |
| 141 | 141 | ||
| 142 | config REGULATOR_BCM590XX | ||
| 143 | tristate "Broadcom BCM590xx PMU Regulators" | ||
| 144 | depends on MFD_BCM590XX | ||
| 145 | help | ||
| 146 | This driver provides support for the voltage regulators on the | ||
| 147 | BCM590xx PMUs. This will enable support for the software | ||
| 148 | controllable LDO/Switching regulators. | ||
| 149 | |||
| 142 | config REGULATOR_DA903X | 150 | config REGULATOR_DA903X |
| 143 | tristate "Dialog Semiconductor DA9030/DA9034 regulators" | 151 | tristate "Dialog Semiconductor DA9030/DA9034 regulators" |
| 144 | depends on PMIC_DA903X | 152 | depends on PMIC_DA903X |
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 979f9ddcf259..e1ab514f03c5 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile | |||
| @@ -20,6 +20,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o | |||
| 20 | obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o | 20 | obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o |
| 21 | obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o | 21 | obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o |
| 22 | obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o | 22 | obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o |
| 23 | obj-$(CONFIG_REGULATOR_BCM590XX) += bcm590xx-regulator.o | ||
| 23 | obj-$(CONFIG_REGULATOR_DA903X) += da903x.o | 24 | obj-$(CONFIG_REGULATOR_DA903X) += da903x.o |
| 24 | obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o | 25 | obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o |
| 25 | obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o | 26 | obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o |
diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c new file mode 100644 index 000000000000..ab08ca7cfb08 --- /dev/null +++ b/drivers/regulator/bcm590xx-regulator.c | |||
| @@ -0,0 +1,403 @@ | |||
| 1 | /* | ||
| 2 | * Broadcom BCM590xx regulator driver | ||
| 3 | * | ||
| 4 | * Copyright 2014 Linaro Limited | ||
| 5 | * Author: Matt Porter <mporter@linaro.org> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <linux/err.h> | ||
| 14 | #include <linux/init.h> | ||
| 15 | #include <linux/kernel.h> | ||
| 16 | #include <linux/mfd/bcm590xx.h> | ||
| 17 | #include <linux/module.h> | ||
| 18 | #include <linux/of.h> | ||
| 19 | #include <linux/platform_device.h> | ||
| 20 | #include <linux/regulator/driver.h> | ||
| 21 | #include <linux/regulator/machine.h> | ||
| 22 | #include <linux/regulator/of_regulator.h> | ||
| 23 | #include <linux/slab.h> | ||
| 24 | |||
| 25 | /* Register defs */ | ||
| 26 | #define BCM590XX_RFLDOPMCTRL1 0x60 | ||
| 27 | #define BCM590XX_IOSR1PMCTRL1 0x7a | ||
| 28 | #define BCM590XX_IOSR2PMCTRL1 0x7c | ||
| 29 | #define BCM590XX_CSRPMCTRL1 0x7e | ||
| 30 | #define BCM590XX_SDSR1PMCTRL1 0x82 | ||
| 31 | #define BCM590XX_SDSR2PMCTRL1 0x86 | ||
| 32 | #define BCM590XX_MSRPMCTRL1 0x8a | ||
| 33 | #define BCM590XX_VSRPMCTRL1 0x8e | ||
| 34 | #define BCM590XX_REG_ENABLE BIT(7) | ||
| 35 | |||
| 36 | #define BCM590XX_RFLDOCTRL 0x96 | ||
| 37 | #define BCM590XX_CSRVOUT1 0xc0 | ||
| 38 | #define BCM590XX_LDO_VSEL_MASK GENMASK(5, 3) | ||
| 39 | #define BCM590XX_SR_VSEL_MASK GENMASK(5, 0) | ||
| 40 | |||
| 41 | /* LDO regulator IDs */ | ||
| 42 | #define BCM590XX_REG_RFLDO 0 | ||
| 43 | #define BCM590XX_REG_CAMLDO1 1 | ||
| 44 | #define BCM590XX_REG_CAMLDO2 2 | ||
| 45 | #define BCM590XX_REG_SIMLDO1 3 | ||
| 46 | #define BCM590XX_REG_SIMLDO2 4 | ||
| 47 | #define BCM590XX_REG_SDLDO 5 | ||
| 48 | #define BCM590XX_REG_SDXLDO 6 | ||
| 49 | #define BCM590XX_REG_MMCLDO1 7 | ||
| 50 | #define BCM590XX_REG_MMCLDO2 8 | ||
| 51 | #define BCM590XX_REG_AUDLDO 9 | ||
| 52 | #define BCM590XX_REG_MICLDO 10 | ||
| 53 | #define BCM590XX_REG_USBLDO 11 | ||
| 54 | #define BCM590XX_REG_VIBLDO 12 | ||
| 55 | |||
| 56 | /* DCDC regulator IDs */ | ||
| 57 | #define BCM590XX_REG_CSR 13 | ||
| 58 | #define BCM590XX_REG_IOSR1 14 | ||
| 59 | #define BCM590XX_REG_IOSR2 15 | ||
| 60 | #define BCM590XX_REG_MSR 16 | ||
| 61 | #define BCM590XX_REG_SDSR1 17 | ||
| 62 | #define BCM590XX_REG_SDSR2 18 | ||
| 63 | #define BCM590XX_REG_VSR 19 | ||
| 64 | |||
| 65 | #define BCM590XX_NUM_REGS 20 | ||
| 66 | |||
| 67 | #define BCM590XX_REG_IS_LDO(n) (n < BCM590XX_REG_CSR) | ||
| 68 | |||
| 69 | struct bcm590xx_board { | ||
| 70 | struct regulator_init_data *bcm590xx_pmu_init_data[BCM590XX_NUM_REGS]; | ||
| 71 | }; | ||
| 72 | |||
| 73 | /* LDO group A: supported voltages in microvolts */ | ||
| 74 | static const unsigned int ldo_a_table[] = { | ||
| 75 | 1200000, 1800000, 2500000, 2700000, 2800000, | ||
| 76 | 2900000, 3000000, 3300000, | ||
| 77 | }; | ||
| 78 | |||
| 79 | /* LDO group C: supported voltages in microvolts */ | ||
| 80 | static const unsigned int ldo_c_table[] = { | ||
| 81 | 3100000, 1800000, 2500000, 2700000, 2800000, | ||
| 82 | 2900000, 3000000, 3300000, | ||
| 83 | }; | ||
| 84 | |||
| 85 | /* DCDC group CSR: supported voltages in microvolts */ | ||
| 86 | static const struct regulator_linear_range dcdc_csr_ranges[] = { | ||
| 87 | REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000), | ||
| 88 | REGULATOR_LINEAR_RANGE(1360000, 51, 55, 20000), | ||
| 89 | REGULATOR_LINEAR_RANGE(900000, 56, 63, 0), | ||
| 90 | }; | ||
| 91 | |||
| 92 | /* DCDC group IOSR1: supported voltages in microvolts */ | ||
| 93 | static const struct regulator_linear_range dcdc_iosr1_ranges[] = { | ||
| 94 | REGULATOR_LINEAR_RANGE(860000, 2, 51, 10000), | ||
| 95 | REGULATOR_LINEAR_RANGE(1500000, 52, 52, 0), | ||
| 96 | REGULATOR_LINEAR_RANGE(1800000, 53, 53, 0), | ||
| 97 | REGULATOR_LINEAR_RANGE(900000, 54, 63, 0), | ||
| 98 | }; | ||
| 99 | |||
| 100 | /* DCDC group SDSR1: supported voltages in microvolts */ | ||
| 101 | static const struct regulator_linear_range dcdc_sdsr1_ranges[] = { | ||
| 102 | REGULATOR_LINEAR_RANGE(860000, 2, 50, 10000), | ||
| 103 | REGULATOR_LINEAR_RANGE(1340000, 51, 51, 0), | ||
| 104 | REGULATOR_LINEAR_RANGE(900000, 52, 63, 0), | ||
| 105 | }; | ||
| 106 | |||
| 107 | struct bcm590xx_info { | ||
| 108 | const char *name; | ||
| 109 | const char *vin_name; | ||
| 110 | u8 n_voltages; | ||
| 111 | const unsigned int *volt_table; | ||
| 112 | u8 n_linear_ranges; | ||
| 113 | const struct regulator_linear_range *linear_ranges; | ||
| 114 | }; | ||
| 115 | |||
| 116 | #define BCM590XX_REG_TABLE(_name, _table) \ | ||
| 117 | { \ | ||
| 118 | .name = #_name, \ | ||
| 119 | .n_voltages = ARRAY_SIZE(_table), \ | ||
| 120 | .volt_table = _table, \ | ||
| 121 | } | ||
| 122 | |||
| 123 | #define BCM590XX_REG_RANGES(_name, _ranges) \ | ||
| 124 | { \ | ||
| 125 | .name = #_name, \ | ||
| 126 | .n_linear_ranges = ARRAY_SIZE(_ranges), \ | ||
| 127 | .linear_ranges = _ranges, \ | ||
| 128 | } | ||
| 129 | |||
| 130 | static struct bcm590xx_info bcm590xx_regs[] = { | ||
| 131 | BCM590XX_REG_TABLE(rfldo, ldo_a_table), | ||
| 132 | BCM590XX_REG_TABLE(camldo1, ldo_c_table), | ||
| 133 | BCM590XX_REG_TABLE(camldo2, ldo_c_table), | ||
| 134 | BCM590XX_REG_TABLE(simldo1, ldo_a_table), | ||
| 135 | BCM590XX_REG_TABLE(simldo2, ldo_a_table), | ||
| 136 | BCM590XX_REG_TABLE(sdldo, ldo_c_table), | ||
| 137 | BCM590XX_REG_TABLE(sdxldo, ldo_a_table), | ||
| 138 | BCM590XX_REG_TABLE(mmcldo1, ldo_a_table), | ||
| 139 | BCM590XX_REG_TABLE(mmcldo2, ldo_a_table), | ||
| 140 | BCM590XX_REG_TABLE(audldo, ldo_a_table), | ||
| 141 | BCM590XX_REG_TABLE(micldo, ldo_a_table), | ||
| 142 | BCM590XX_REG_TABLE(usbldo, ldo_a_table), | ||
| 143 | BCM590XX_REG_TABLE(vibldo, ldo_c_table), | ||
| 144 | BCM590XX_REG_RANGES(csr, dcdc_csr_ranges), | ||
| 145 | BCM590XX_REG_RANGES(iosr1, dcdc_iosr1_ranges), | ||
| 146 | BCM590XX_REG_RANGES(iosr2, dcdc_iosr1_ranges), | ||
| 147 | BCM590XX_REG_RANGES(msr, dcdc_iosr1_ranges), | ||
| 148 | BCM590XX_REG_RANGES(sdsr1, dcdc_sdsr1_ranges), | ||
| 149 | BCM590XX_REG_RANGES(sdsr2, dcdc_iosr1_ranges), | ||
| 150 | BCM590XX_REG_RANGES(vsr, dcdc_iosr1_ranges), | ||
| 151 | }; | ||
| 152 | |||
| 153 | struct bcm590xx_reg { | ||
| 154 | struct regulator_desc *desc; | ||
| 155 | struct bcm590xx *mfd; | ||
| 156 | struct bcm590xx_info **info; | ||
| 157 | }; | ||
| 158 | |||
| 159 | static int bcm590xx_get_vsel_register(int id) | ||
| 160 | { | ||
| 161 | if (BCM590XX_REG_IS_LDO(id)) | ||
| 162 | return BCM590XX_RFLDOCTRL + id; | ||
| 163 | else | ||
| 164 | return BCM590XX_CSRVOUT1 + (id - BCM590XX_REG_CSR) * 3; | ||
| 165 | } | ||
| 166 | |||
| 167 | static int bcm590xx_get_enable_register(int id) | ||
| 168 | { | ||
| 169 | int reg = 0; | ||
| 170 | |||
| 171 | if (BCM590XX_REG_IS_LDO(id)) | ||
| 172 | reg = BCM590XX_RFLDOPMCTRL1 + id * 2; | ||
| 173 | else | ||
| 174 | switch (id) { | ||
| 175 | case BCM590XX_REG_CSR: | ||
| 176 | reg = BCM590XX_CSRPMCTRL1; | ||
| 177 | break; | ||
| 178 | case BCM590XX_REG_IOSR1: | ||
| 179 | reg = BCM590XX_IOSR1PMCTRL1; | ||
| 180 | break; | ||
| 181 | case BCM590XX_REG_IOSR2: | ||
| 182 | reg = BCM590XX_IOSR2PMCTRL1; | ||
| 183 | break; | ||
| 184 | case BCM590XX_REG_MSR: | ||
| 185 | reg = BCM590XX_MSRPMCTRL1; | ||
| 186 | break; | ||
| 187 | case BCM590XX_REG_SDSR1: | ||
| 188 | reg = BCM590XX_SDSR1PMCTRL1; | ||
| 189 | break; | ||
| 190 | case BCM590XX_REG_SDSR2: | ||
| 191 | reg = BCM590XX_SDSR2PMCTRL1; | ||
| 192 | break; | ||
| 193 | }; | ||
| 194 | |||
| 195 | return reg; | ||
| 196 | } | ||
| 197 | |||
| 198 | static struct regulator_ops bcm590xx_ops_ldo = { | ||
| 199 | .is_enabled = regulator_is_enabled_regmap, | ||
| 200 | .enable = regulator_enable_regmap, | ||
| 201 | .disable = regulator_disable_regmap, | ||
| 202 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
| 203 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | ||
| 204 | .list_voltage = regulator_list_voltage_table, | ||
| 205 | .map_voltage = regulator_map_voltage_iterate, | ||
| 206 | }; | ||
| 207 | |||
| 208 | static struct regulator_ops bcm590xx_ops_dcdc = { | ||
| 209 | .is_enabled = regulator_is_enabled_regmap, | ||
| 210 | .enable = regulator_enable_regmap, | ||
| 211 | .disable = regulator_disable_regmap, | ||
| 212 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
| 213 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | ||
| 214 | .list_voltage = regulator_list_voltage_linear_range, | ||
| 215 | .map_voltage = regulator_map_voltage_linear_range, | ||
| 216 | }; | ||
| 217 | |||
| 218 | #define BCM590XX_MATCH(_name, _id) \ | ||
| 219 | { \ | ||
| 220 | .name = #_name, \ | ||
| 221 | .driver_data = (void *)&bcm590xx_regs[BCM590XX_REG_##_id], \ | ||
| 222 | } | ||
| 223 | |||
| 224 | static struct of_regulator_match bcm590xx_matches[] = { | ||
| 225 | BCM590XX_MATCH(rfldo, RFLDO), | ||
| 226 | BCM590XX_MATCH(camldo1, CAMLDO1), | ||
| 227 | BCM590XX_MATCH(camldo2, CAMLDO2), | ||
| 228 | BCM590XX_MATCH(simldo1, SIMLDO1), | ||
| 229 | BCM590XX_MATCH(simldo2, SIMLDO2), | ||
| 230 | BCM590XX_MATCH(sdldo, SDLDO), | ||
| 231 | BCM590XX_MATCH(sdxldo, SDXLDO), | ||
| 232 | BCM590XX_MATCH(mmcldo1, MMCLDO1), | ||
| 233 | BCM590XX_MATCH(mmcldo2, MMCLDO2), | ||
| 234 | BCM590XX_MATCH(audldo, AUDLDO), | ||
| 235 | BCM590XX_MATCH(micldo, MICLDO), | ||
| 236 | BCM590XX_MATCH(usbldo, USBLDO), | ||
| 237 | BCM590XX_MATCH(vibldo, VIBLDO), | ||
| 238 | BCM590XX_MATCH(csr, CSR), | ||
| 239 | BCM590XX_MATCH(iosr1, IOSR1), | ||
| 240 | BCM590XX_MATCH(iosr2, IOSR2), | ||
| 241 | BCM590XX_MATCH(msr, MSR), | ||
| 242 | BCM590XX_MATCH(sdsr1, SDSR1), | ||
| 243 | BCM590XX_MATCH(sdsr2, SDSR2), | ||
| 244 | BCM590XX_MATCH(vsr, VSR), | ||
| 245 | }; | ||
| 246 | |||
| 247 | static struct bcm590xx_board *bcm590xx_parse_dt_reg_data( | ||
| 248 | struct platform_device *pdev, | ||
| 249 | struct of_regulator_match **bcm590xx_reg_matches) | ||
| 250 | { | ||
| 251 | struct bcm590xx_board *data; | ||
| 252 | struct device_node *np = pdev->dev.parent->of_node; | ||
| 253 | struct device_node *regulators; | ||
| 254 | struct of_regulator_match *matches = bcm590xx_matches; | ||
| 255 | int count = ARRAY_SIZE(bcm590xx_matches); | ||
| 256 | int idx = 0; | ||
| 257 | int ret; | ||
| 258 | |||
| 259 | if (!np) { | ||
| 260 | dev_err(&pdev->dev, "of node not found\n"); | ||
| 261 | return NULL; | ||
| 262 | } | ||
| 263 | |||
| 264 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | ||
| 265 | if (!data) { | ||
| 266 | dev_err(&pdev->dev, "failed to allocate regulator board data\n"); | ||
| 267 | return NULL; | ||
| 268 | } | ||
| 269 | |||
| 270 | np = of_node_get(np); | ||
| 271 | regulators = of_get_child_by_name(np, "regulators"); | ||
| 272 | if (!regulators) { | ||
| 273 | dev_warn(&pdev->dev, "regulator node not found\n"); | ||
| 274 | return NULL; | ||
| 275 | } | ||
| 276 | |||
| 277 | ret = of_regulator_match(&pdev->dev, regulators, matches, count); | ||
| 278 | of_node_put(regulators); | ||
| 279 | if (ret < 0) { | ||
| 280 | dev_err(&pdev->dev, "Error parsing regulator init data: %d\n", | ||
| 281 | ret); | ||
| 282 | return NULL; | ||
| 283 | } | ||
| 284 | |||
| 285 | *bcm590xx_reg_matches = matches; | ||
| 286 | |||
| 287 | for (idx = 0; idx < count; idx++) { | ||
| 288 | if (!matches[idx].init_data || !matches[idx].of_node) | ||
| 289 | continue; | ||
| 290 | |||
| 291 | data->bcm590xx_pmu_init_data[idx] = matches[idx].init_data; | ||
| 292 | } | ||
| 293 | |||
| 294 | return data; | ||
| 295 | } | ||
| 296 | |||
| 297 | static int bcm590xx_probe(struct platform_device *pdev) | ||
| 298 | { | ||
| 299 | struct bcm590xx *bcm590xx = dev_get_drvdata(pdev->dev.parent); | ||
| 300 | struct bcm590xx_board *pmu_data = NULL; | ||
| 301 | struct bcm590xx_reg *pmu; | ||
| 302 | struct regulator_config config = { }; | ||
| 303 | struct bcm590xx_info *info; | ||
| 304 | struct regulator_init_data *reg_data; | ||
| 305 | struct regulator_dev *rdev; | ||
| 306 | struct of_regulator_match *bcm590xx_reg_matches = NULL; | ||
| 307 | int i; | ||
| 308 | |||
| 309 | pmu_data = bcm590xx_parse_dt_reg_data(pdev, | ||
| 310 | &bcm590xx_reg_matches); | ||
| 311 | |||
| 312 | pmu = devm_kzalloc(&pdev->dev, sizeof(*pmu), GFP_KERNEL); | ||
| 313 | if (!pmu) { | ||
| 314 | dev_err(&pdev->dev, "Memory allocation failed for pmu\n"); | ||
| 315 | return -ENOMEM; | ||
| 316 | } | ||
| 317 | |||
| 318 | pmu->mfd = bcm590xx; | ||
| 319 | |||
| 320 | platform_set_drvdata(pdev, pmu); | ||
| 321 | |||
| 322 | pmu->desc = devm_kzalloc(&pdev->dev, BCM590XX_NUM_REGS * | ||
| 323 | sizeof(struct regulator_desc), GFP_KERNEL); | ||
| 324 | if (!pmu->desc) { | ||
| 325 | dev_err(&pdev->dev, "Memory alloc fails for desc\n"); | ||
| 326 | return -ENOMEM; | ||
| 327 | } | ||
| 328 | |||
| 329 | pmu->info = devm_kzalloc(&pdev->dev, BCM590XX_NUM_REGS * | ||
| 330 | sizeof(struct bcm590xx_info *), GFP_KERNEL); | ||
| 331 | if (!pmu->info) { | ||
| 332 | dev_err(&pdev->dev, "Memory alloc fails for info\n"); | ||
| 333 | return -ENOMEM; | ||
| 334 | } | ||
| 335 | |||
| 336 | info = bcm590xx_regs; | ||
| 337 | |||
| 338 | for (i = 0; i < BCM590XX_NUM_REGS; i++, info++) { | ||
| 339 | if (pmu_data) | ||
| 340 | reg_data = pmu_data->bcm590xx_pmu_init_data[i]; | ||
| 341 | else | ||
| 342 | reg_data = NULL; | ||
| 343 | |||
| 344 | /* Register the regulators */ | ||
| 345 | pmu->info[i] = info; | ||
| 346 | |||
| 347 | pmu->desc[i].name = info->name; | ||
| 348 | pmu->desc[i].supply_name = info->vin_name; | ||
| 349 | pmu->desc[i].id = i; | ||
| 350 | pmu->desc[i].volt_table = info->volt_table; | ||
| 351 | pmu->desc[i].n_voltages = info->n_voltages; | ||
| 352 | pmu->desc[i].linear_ranges = info->linear_ranges; | ||
| 353 | pmu->desc[i].n_linear_ranges = info->n_linear_ranges; | ||
| 354 | |||
| 355 | if (BCM590XX_REG_IS_LDO(i)) { | ||
| 356 | pmu->desc[i].ops = &bcm590xx_ops_ldo; | ||
| 357 | pmu->desc[i].vsel_mask = BCM590XX_LDO_VSEL_MASK; | ||
| 358 | } else { | ||
| 359 | pmu->desc[i].ops = &bcm590xx_ops_dcdc; | ||
| 360 | pmu->desc[i].vsel_mask = BCM590XX_SR_VSEL_MASK; | ||
| 361 | } | ||
| 362 | |||
| 363 | pmu->desc[i].vsel_reg = bcm590xx_get_vsel_register(i); | ||
| 364 | pmu->desc[i].enable_is_inverted = true; | ||
| 365 | pmu->desc[i].enable_mask = BCM590XX_REG_ENABLE; | ||
| 366 | pmu->desc[i].enable_reg = bcm590xx_get_enable_register(i); | ||
| 367 | pmu->desc[i].type = REGULATOR_VOLTAGE; | ||
| 368 | pmu->desc[i].owner = THIS_MODULE; | ||
| 369 | |||
| 370 | config.dev = bcm590xx->dev; | ||
| 371 | config.init_data = reg_data; | ||
| 372 | config.driver_data = pmu; | ||
| 373 | config.regmap = bcm590xx->regmap; | ||
| 374 | |||
| 375 | if (bcm590xx_reg_matches) | ||
| 376 | config.of_node = bcm590xx_reg_matches[i].of_node; | ||
| 377 | |||
| 378 | rdev = devm_regulator_register(&pdev->dev, &pmu->desc[i], | ||
| 379 | &config); | ||
| 380 | if (IS_ERR(rdev)) { | ||
| 381 | dev_err(bcm590xx->dev, | ||
| 382 | "failed to register %s regulator\n", | ||
| 383 | pdev->name); | ||
| 384 | return PTR_ERR(rdev); | ||
| 385 | } | ||
| 386 | } | ||
| 387 | |||
| 388 | return 0; | ||
| 389 | } | ||
| 390 | |||
| 391 | static struct platform_driver bcm590xx_regulator_driver = { | ||
| 392 | .driver = { | ||
| 393 | .name = "bcm590xx-vregs", | ||
| 394 | .owner = THIS_MODULE, | ||
| 395 | }, | ||
| 396 | .probe = bcm590xx_probe, | ||
| 397 | }; | ||
| 398 | module_platform_driver(bcm590xx_regulator_driver); | ||
| 399 | |||
| 400 | MODULE_AUTHOR("Matt Porter <mporter@linaro.org>"); | ||
| 401 | MODULE_DESCRIPTION("BCM590xx voltage regulator driver"); | ||
| 402 | MODULE_LICENSE("GPL v2"); | ||
| 403 | MODULE_ALIAS("platform:bcm590xx-vregs"); | ||
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c index 3adeaeffc485..fdb6ea8ae7e6 100644 --- a/drivers/regulator/da9052-regulator.c +++ b/drivers/regulator/da9052-regulator.c | |||
| @@ -240,6 +240,31 @@ static int da9052_regulator_set_voltage_sel(struct regulator_dev *rdev, | |||
| 240 | return ret; | 240 | return ret; |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | static int da9052_regulator_set_voltage_time_sel(struct regulator_dev *rdev, | ||
| 244 | unsigned int old_sel, | ||
| 245 | unsigned int new_sel) | ||
| 246 | { | ||
| 247 | struct da9052_regulator *regulator = rdev_get_drvdata(rdev); | ||
| 248 | struct da9052_regulator_info *info = regulator->info; | ||
| 249 | int id = rdev_get_id(rdev); | ||
| 250 | int ret = 0; | ||
| 251 | |||
| 252 | /* The DVC controlled LDOs and DCDCs ramp with 6.25mV/µs after enabling | ||
| 253 | * the activate bit. | ||
| 254 | */ | ||
| 255 | switch (id) { | ||
| 256 | case DA9052_ID_BUCK1: | ||
| 257 | case DA9052_ID_BUCK2: | ||
| 258 | case DA9052_ID_BUCK3: | ||
| 259 | case DA9052_ID_LDO2: | ||
| 260 | case DA9052_ID_LDO3: | ||
| 261 | ret = (new_sel - old_sel) * info->step_uV / 6250; | ||
| 262 | break; | ||
| 263 | } | ||
| 264 | |||
| 265 | return ret; | ||
| 266 | } | ||
| 267 | |||
| 243 | static struct regulator_ops da9052_dcdc_ops = { | 268 | static struct regulator_ops da9052_dcdc_ops = { |
| 244 | .get_current_limit = da9052_dcdc_get_current_limit, | 269 | .get_current_limit = da9052_dcdc_get_current_limit, |
| 245 | .set_current_limit = da9052_dcdc_set_current_limit, | 270 | .set_current_limit = da9052_dcdc_set_current_limit, |
| @@ -248,6 +273,7 @@ static struct regulator_ops da9052_dcdc_ops = { | |||
| 248 | .map_voltage = da9052_map_voltage, | 273 | .map_voltage = da9052_map_voltage, |
| 249 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 274 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
| 250 | .set_voltage_sel = da9052_regulator_set_voltage_sel, | 275 | .set_voltage_sel = da9052_regulator_set_voltage_sel, |
| 276 | .set_voltage_time_sel = da9052_regulator_set_voltage_time_sel, | ||
| 251 | .is_enabled = regulator_is_enabled_regmap, | 277 | .is_enabled = regulator_is_enabled_regmap, |
| 252 | .enable = regulator_enable_regmap, | 278 | .enable = regulator_enable_regmap, |
| 253 | .disable = regulator_disable_regmap, | 279 | .disable = regulator_disable_regmap, |
| @@ -258,6 +284,7 @@ static struct regulator_ops da9052_ldo_ops = { | |||
| 258 | .map_voltage = da9052_map_voltage, | 284 | .map_voltage = da9052_map_voltage, |
| 259 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 285 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
| 260 | .set_voltage_sel = da9052_regulator_set_voltage_sel, | 286 | .set_voltage_sel = da9052_regulator_set_voltage_sel, |
| 287 | .set_voltage_time_sel = da9052_regulator_set_voltage_time_sel, | ||
| 261 | .is_enabled = regulator_is_enabled_regmap, | 288 | .is_enabled = regulator_is_enabled_regmap, |
| 262 | .enable = regulator_enable_regmap, | 289 | .enable = regulator_enable_regmap, |
| 263 | .disable = regulator_disable_regmap, | 290 | .disable = regulator_disable_regmap, |
| @@ -401,7 +428,7 @@ static int da9052_regulator_probe(struct platform_device *pdev) | |||
| 401 | if (!nproot) | 428 | if (!nproot) |
| 402 | return -ENODEV; | 429 | return -ENODEV; |
| 403 | 430 | ||
| 404 | nproot = of_find_node_by_name(nproot, "regulators"); | 431 | nproot = of_get_child_by_name(nproot, "regulators"); |
| 405 | if (!nproot) | 432 | if (!nproot) |
| 406 | return -ENODEV; | 433 | return -ENODEV; |
| 407 | 434 | ||
diff --git a/drivers/regulator/da9055-regulator.c b/drivers/regulator/da9055-regulator.c index b14ebdad5dd2..9516317e1a9f 100644 --- a/drivers/regulator/da9055-regulator.c +++ b/drivers/regulator/da9055-regulator.c | |||
| @@ -19,6 +19,8 @@ | |||
| 19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
| 20 | #include <linux/regulator/driver.h> | 20 | #include <linux/regulator/driver.h> |
| 21 | #include <linux/regulator/machine.h> | 21 | #include <linux/regulator/machine.h> |
| 22 | #include <linux/of.h> | ||
| 23 | #include <linux/regulator/of_regulator.h> | ||
| 22 | 24 | ||
| 23 | #include <linux/mfd/da9055/core.h> | 25 | #include <linux/mfd/da9055/core.h> |
| 24 | #include <linux/mfd/da9055/reg.h> | 26 | #include <linux/mfd/da9055/reg.h> |
| @@ -446,6 +448,9 @@ static int da9055_gpio_init(struct da9055_regulator *regulator, | |||
| 446 | struct da9055_regulator_info *info = regulator->info; | 448 | struct da9055_regulator_info *info = regulator->info; |
| 447 | int ret = 0; | 449 | int ret = 0; |
| 448 | 450 | ||
| 451 | if (!pdata) | ||
| 452 | return 0; | ||
| 453 | |||
| 449 | if (pdata->gpio_ren && pdata->gpio_ren[id]) { | 454 | if (pdata->gpio_ren && pdata->gpio_ren[id]) { |
| 450 | char name[18]; | 455 | char name[18]; |
| 451 | int gpio_mux = pdata->gpio_ren[id]; | 456 | int gpio_mux = pdata->gpio_ren[id]; |
| @@ -530,6 +535,59 @@ static inline struct da9055_regulator_info *find_regulator_info(int id) | |||
| 530 | return NULL; | 535 | return NULL; |
| 531 | } | 536 | } |
| 532 | 537 | ||
| 538 | #ifdef CONFIG_OF | ||
| 539 | static struct of_regulator_match da9055_reg_matches[] = { | ||
| 540 | { .name = "BUCK1", }, | ||
| 541 | { .name = "BUCK2", }, | ||
| 542 | { .name = "LDO1", }, | ||
| 543 | { .name = "LDO2", }, | ||
| 544 | { .name = "LDO3", }, | ||
| 545 | { .name = "LDO4", }, | ||
| 546 | { .name = "LDO5", }, | ||
| 547 | { .name = "LDO6", }, | ||
| 548 | }; | ||
| 549 | |||
| 550 | static int da9055_regulator_dt_init(struct platform_device *pdev, | ||
| 551 | struct da9055_regulator *regulator, | ||
| 552 | struct regulator_config *config, | ||
| 553 | int regid) | ||
| 554 | { | ||
| 555 | struct device_node *nproot, *np; | ||
| 556 | int ret; | ||
| 557 | |||
| 558 | nproot = of_node_get(pdev->dev.parent->of_node); | ||
| 559 | if (!nproot) | ||
| 560 | return -ENODEV; | ||
| 561 | |||
| 562 | np = of_get_child_by_name(nproot, "regulators"); | ||
| 563 | if (!np) | ||
| 564 | return -ENODEV; | ||
| 565 | |||
| 566 | ret = of_regulator_match(&pdev->dev, np, &da9055_reg_matches[regid], 1); | ||
| 567 | of_node_put(nproot); | ||
| 568 | if (ret < 0) { | ||
| 569 | dev_err(&pdev->dev, "Error matching regulator: %d\n", ret); | ||
| 570 | return ret; | ||
| 571 | } | ||
| 572 | |||
| 573 | config->init_data = da9055_reg_matches[regid].init_data; | ||
| 574 | config->of_node = da9055_reg_matches[regid].of_node; | ||
| 575 | |||
| 576 | if (!config->of_node) | ||
| 577 | return -ENODEV; | ||
| 578 | |||
| 579 | return 0; | ||
| 580 | } | ||
| 581 | #else | ||
| 582 | static inline int da9055_regulator_dt_init(struct platform_device *pdev, | ||
| 583 | struct da9055_regulator *regulator, | ||
| 584 | struct regulator_config *config, | ||
| 585 | int regid) | ||
| 586 | { | ||
| 587 | return -ENODEV; | ||
| 588 | } | ||
| 589 | #endif /* CONFIG_OF */ | ||
| 590 | |||
| 533 | static int da9055_regulator_probe(struct platform_device *pdev) | 591 | static int da9055_regulator_probe(struct platform_device *pdev) |
| 534 | { | 592 | { |
| 535 | struct regulator_config config = { }; | 593 | struct regulator_config config = { }; |
| @@ -538,9 +596,6 @@ static int da9055_regulator_probe(struct platform_device *pdev) | |||
| 538 | struct da9055_pdata *pdata = dev_get_platdata(da9055->dev); | 596 | struct da9055_pdata *pdata = dev_get_platdata(da9055->dev); |
| 539 | int ret, irq; | 597 | int ret, irq; |
| 540 | 598 | ||
| 541 | if (pdata == NULL || pdata->regulators[pdev->id] == NULL) | ||
| 542 | return -ENODEV; | ||
| 543 | |||
| 544 | regulator = devm_kzalloc(&pdev->dev, sizeof(struct da9055_regulator), | 599 | regulator = devm_kzalloc(&pdev->dev, sizeof(struct da9055_regulator), |
| 545 | GFP_KERNEL); | 600 | GFP_KERNEL); |
| 546 | if (!regulator) | 601 | if (!regulator) |
| @@ -557,8 +612,14 @@ static int da9055_regulator_probe(struct platform_device *pdev) | |||
| 557 | config.driver_data = regulator; | 612 | config.driver_data = regulator; |
| 558 | config.regmap = da9055->regmap; | 613 | config.regmap = da9055->regmap; |
| 559 | 614 | ||
| 560 | if (pdata && pdata->regulators) | 615 | if (pdata && pdata->regulators) { |
| 561 | config.init_data = pdata->regulators[pdev->id]; | 616 | config.init_data = pdata->regulators[pdev->id]; |
| 617 | } else { | ||
| 618 | ret = da9055_regulator_dt_init(pdev, regulator, &config, | ||
| 619 | pdev->id); | ||
| 620 | if (ret < 0) | ||
| 621 | return ret; | ||
| 622 | } | ||
| 562 | 623 | ||
| 563 | ret = da9055_gpio_init(regulator, &config, pdata, pdev->id); | 624 | ret = da9055_gpio_init(regulator, &config, pdata, pdev->id); |
| 564 | if (ret < 0) | 625 | if (ret < 0) |
diff --git a/drivers/regulator/da9063-regulator.c b/drivers/regulator/da9063-regulator.c index 91e99a2c8dc1..7c9461d13313 100644 --- a/drivers/regulator/da9063-regulator.c +++ b/drivers/regulator/da9063-regulator.c | |||
| @@ -365,7 +365,7 @@ static int da9063_set_suspend_voltage(struct regulator_dev *rdev, int uV) | |||
| 365 | 365 | ||
| 366 | sel = regulator_map_voltage_linear(rdev, uV, uV); | 366 | sel = regulator_map_voltage_linear(rdev, uV, uV); |
| 367 | if (sel < 0) | 367 | if (sel < 0) |
| 368 | return -EINVAL; | 368 | return sel; |
| 369 | 369 | ||
| 370 | sel <<= ffs(rdev->desc->vsel_mask) - 1; | 370 | sel <<= ffs(rdev->desc->vsel_mask) - 1; |
| 371 | 371 | ||
| @@ -666,7 +666,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt( | |||
| 666 | struct device_node *node; | 666 | struct device_node *node; |
| 667 | int i, n, num; | 667 | int i, n, num; |
| 668 | 668 | ||
| 669 | node = of_find_node_by_name(pdev->dev.parent->of_node, "regulators"); | 669 | node = of_get_child_by_name(pdev->dev.parent->of_node, "regulators"); |
| 670 | if (!node) { | 670 | if (!node) { |
| 671 | dev_err(&pdev->dev, "Regulators device node not found\n"); | 671 | dev_err(&pdev->dev, "Regulators device node not found\n"); |
| 672 | return ERR_PTR(-ENODEV); | 672 | return ERR_PTR(-ENODEV); |
| @@ -674,6 +674,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt( | |||
| 674 | 674 | ||
| 675 | num = of_regulator_match(&pdev->dev, node, da9063_matches, | 675 | num = of_regulator_match(&pdev->dev, node, da9063_matches, |
| 676 | ARRAY_SIZE(da9063_matches)); | 676 | ARRAY_SIZE(da9063_matches)); |
| 677 | of_node_put(node); | ||
| 677 | if (num < 0) { | 678 | if (num < 0) { |
| 678 | dev_err(&pdev->dev, "Failed to match regulators\n"); | 679 | dev_err(&pdev->dev, "Failed to match regulators\n"); |
| 679 | return ERR_PTR(-EINVAL); | 680 | return ERR_PTR(-EINVAL); |
| @@ -710,7 +711,7 @@ static struct da9063_regulators_pdata *da9063_parse_regulators_dt( | |||
| 710 | struct platform_device *pdev, | 711 | struct platform_device *pdev, |
| 711 | struct of_regulator_match **da9063_reg_matches) | 712 | struct of_regulator_match **da9063_reg_matches) |
| 712 | { | 713 | { |
| 713 | da9063_reg_matches = NULL; | 714 | *da9063_reg_matches = NULL; |
| 714 | return ERR_PTR(-ENODEV); | 715 | return ERR_PTR(-ENODEV); |
| 715 | } | 716 | } |
| 716 | #endif | 717 | #endif |
| @@ -756,7 +757,7 @@ static int da9063_regulator_probe(struct platform_device *pdev) | |||
| 756 | if (ret < 0) { | 757 | if (ret < 0) { |
| 757 | dev_err(&pdev->dev, | 758 | dev_err(&pdev->dev, |
| 758 | "Error while reading BUCKs configuration\n"); | 759 | "Error while reading BUCKs configuration\n"); |
| 759 | return -EIO; | 760 | return ret; |
| 760 | } | 761 | } |
| 761 | bcores_merged = val & DA9063_BCORE_MERGE; | 762 | bcores_merged = val & DA9063_BCORE_MERGE; |
| 762 | bmem_bio_merged = val & DA9063_BUCK_MERGE; | 763 | bmem_bio_merged = val & DA9063_BUCK_MERGE; |
| @@ -775,10 +776,8 @@ static int da9063_regulator_probe(struct platform_device *pdev) | |||
| 775 | size = sizeof(struct da9063_regulators) + | 776 | size = sizeof(struct da9063_regulators) + |
| 776 | n_regulators * sizeof(struct da9063_regulator); | 777 | n_regulators * sizeof(struct da9063_regulator); |
| 777 | regulators = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); | 778 | regulators = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); |
| 778 | if (!regulators) { | 779 | if (!regulators) |
| 779 | dev_err(&pdev->dev, "No memory for regulators\n"); | ||
| 780 | return -ENOMEM; | 780 | return -ENOMEM; |
| 781 | } | ||
| 782 | 781 | ||
| 783 | regulators->n_regulators = n_regulators; | 782 | regulators->n_regulators = n_regulators; |
| 784 | platform_set_drvdata(pdev, regulators); | 783 | platform_set_drvdata(pdev, regulators); |
diff --git a/drivers/regulator/da9210-regulator.c b/drivers/regulator/da9210-regulator.c index 6f5ecbe1132e..7a320dd11c46 100644 --- a/drivers/regulator/da9210-regulator.c +++ b/drivers/regulator/da9210-regulator.c | |||
| @@ -134,11 +134,8 @@ static int da9210_i2c_probe(struct i2c_client *i2c, | |||
| 134 | int error; | 134 | int error; |
| 135 | 135 | ||
| 136 | chip = devm_kzalloc(&i2c->dev, sizeof(struct da9210), GFP_KERNEL); | 136 | chip = devm_kzalloc(&i2c->dev, sizeof(struct da9210), GFP_KERNEL); |
| 137 | if (NULL == chip) { | 137 | if (!chip) |
| 138 | dev_err(&i2c->dev, | ||
| 139 | "Cannot kzalloc memory for regulator structure\n"); | ||
| 140 | return -ENOMEM; | 138 | return -ENOMEM; |
| 141 | } | ||
| 142 | 139 | ||
| 143 | chip->regmap = devm_regmap_init_i2c(i2c, &da9210_regmap_config); | 140 | chip->regmap = devm_regmap_init_i2c(i2c, &da9210_regmap_config); |
| 144 | if (IS_ERR(chip->regmap)) { | 141 | if (IS_ERR(chip->regmap)) { |
diff --git a/drivers/regulator/db8500-prcmu.c b/drivers/regulator/db8500-prcmu.c index 846acf240e48..617c1adca816 100644 --- a/drivers/regulator/db8500-prcmu.c +++ b/drivers/regulator/db8500-prcmu.c | |||
| @@ -263,6 +263,8 @@ dbx500_regulator_info[DB8500_NUM_REGULATORS] = { | |||
| 263 | .ops = &db8500_regulator_ops, | 263 | .ops = &db8500_regulator_ops, |
| 264 | .type = REGULATOR_VOLTAGE, | 264 | .type = REGULATOR_VOLTAGE, |
| 265 | .owner = THIS_MODULE, | 265 | .owner = THIS_MODULE, |
| 266 | .fixed_uV = 1800000, | ||
| 267 | .n_voltages = 1, | ||
| 266 | }, | 268 | }, |
| 267 | .exclude_from_power_state = true, | 269 | .exclude_from_power_state = true, |
| 268 | }, | 270 | }, |
diff --git a/drivers/regulator/dbx500-prcmu.c b/drivers/regulator/dbx500-prcmu.c index ce89f7848a57..2d16b9f16de7 100644 --- a/drivers/regulator/dbx500-prcmu.c +++ b/drivers/regulator/dbx500-prcmu.c | |||
| @@ -78,6 +78,7 @@ static struct ux500_regulator_debug { | |||
| 78 | void ux500_regulator_suspend_debug(void) | 78 | void ux500_regulator_suspend_debug(void) |
| 79 | { | 79 | { |
| 80 | int i; | 80 | int i; |
| 81 | |||
| 81 | for (i = 0; i < rdebug.num_regulators; i++) | 82 | for (i = 0; i < rdebug.num_regulators; i++) |
| 82 | rdebug.state_before_suspend[i] = | 83 | rdebug.state_before_suspend[i] = |
| 83 | rdebug.regulator_array[i].is_enabled; | 84 | rdebug.regulator_array[i].is_enabled; |
| @@ -86,6 +87,7 @@ void ux500_regulator_suspend_debug(void) | |||
| 86 | void ux500_regulator_resume_debug(void) | 87 | void ux500_regulator_resume_debug(void) |
| 87 | { | 88 | { |
| 88 | int i; | 89 | int i; |
| 90 | |||
| 89 | for (i = 0; i < rdebug.num_regulators; i++) | 91 | for (i = 0; i < rdebug.num_regulators; i++) |
| 90 | rdebug.state_after_suspend[i] = | 92 | rdebug.state_after_suspend[i] = |
| 91 | rdebug.regulator_array[i].is_enabled; | 93 | rdebug.regulator_array[i].is_enabled; |
| @@ -127,9 +129,9 @@ static int ux500_regulator_status_print(struct seq_file *s, void *p) | |||
| 127 | int i; | 129 | int i; |
| 128 | 130 | ||
| 129 | /* print dump header */ | 131 | /* print dump header */ |
| 130 | err = seq_printf(s, "ux500-regulator status:\n"); | 132 | err = seq_puts(s, "ux500-regulator status:\n"); |
| 131 | if (err < 0) | 133 | if (err < 0) |
| 132 | dev_err(dev, "seq_printf overflow\n"); | 134 | dev_err(dev, "seq_puts overflow\n"); |
| 133 | 135 | ||
| 134 | err = seq_printf(s, "%31s : %8s : %8s\n", "current", | 136 | err = seq_printf(s, "%31s : %8s : %8s\n", "current", |
| 135 | "before", "after"); | 137 | "before", "after"); |
| @@ -202,18 +204,12 @@ ux500_regulator_debug_init(struct platform_device *pdev, | |||
| 202 | rdebug.num_regulators = num_regulators; | 204 | rdebug.num_regulators = num_regulators; |
| 203 | 205 | ||
| 204 | rdebug.state_before_suspend = kzalloc(num_regulators, GFP_KERNEL); | 206 | rdebug.state_before_suspend = kzalloc(num_regulators, GFP_KERNEL); |
| 205 | if (!rdebug.state_before_suspend) { | 207 | if (!rdebug.state_before_suspend) |
| 206 | dev_err(&pdev->dev, | ||
| 207 | "could not allocate memory for saving state\n"); | ||
| 208 | goto exit_destroy_power_state; | 208 | goto exit_destroy_power_state; |
| 209 | } | ||
| 210 | 209 | ||
| 211 | rdebug.state_after_suspend = kzalloc(num_regulators, GFP_KERNEL); | 210 | rdebug.state_after_suspend = kzalloc(num_regulators, GFP_KERNEL); |
| 212 | if (!rdebug.state_after_suspend) { | 211 | if (!rdebug.state_after_suspend) |
| 213 | dev_err(&pdev->dev, | ||
| 214 | "could not allocate memory for saving state\n"); | ||
| 215 | goto exit_free; | 212 | goto exit_free; |
| 216 | } | ||
| 217 | 213 | ||
| 218 | dbx500_regulator_testcase(regulator_info, num_regulators); | 214 | dbx500_regulator_testcase(regulator_info, num_regulators); |
| 219 | return 0; | 215 | return 0; |
