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

Merge tag 'regulator-v3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fixes from Mark Brown:
"A bunch of fixes, a few driver specific ones and a framework fix for
voltage enumeration on fixed voltage regulators which had previously
worked but had been misplaced during some refactoring causing problems
for users that needed to know the voltage"

* tag 'regulator-v3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
regulator: arizona-micsupp: Correct wm5110 voltage selection
regulator: pfuze100: allow misprogrammed ID
regulator: fixed: fix regulator_list_voltage() for regression
regulator: gpio-regulator: Don't oops on missing regulator-type property

+70 -6
+52 -2
drivers/regulator/arizona-micsupp.c
··· 174 174 .owner = THIS_MODULE, 175 175 }; 176 176 177 + static const struct regulator_linear_range arizona_micsupp_ext_ranges[] = { 178 + REGULATOR_LINEAR_RANGE(900000, 0, 0x14, 25000), 179 + REGULATOR_LINEAR_RANGE(1500000, 0x15, 0x27, 100000), 180 + }; 181 + 182 + static const struct regulator_desc arizona_micsupp_ext = { 183 + .name = "MICVDD", 184 + .supply_name = "CPVDD", 185 + .type = REGULATOR_VOLTAGE, 186 + .n_voltages = 40, 187 + .ops = &arizona_micsupp_ops, 188 + 189 + .vsel_reg = ARIZONA_LDO2_CONTROL_1, 190 + .vsel_mask = ARIZONA_LDO2_VSEL_MASK, 191 + .enable_reg = ARIZONA_MIC_CHARGE_PUMP_1, 192 + .enable_mask = ARIZONA_CPMIC_ENA, 193 + .bypass_reg = ARIZONA_MIC_CHARGE_PUMP_1, 194 + .bypass_mask = ARIZONA_CPMIC_BYPASS, 195 + 196 + .linear_ranges = arizona_micsupp_ext_ranges, 197 + .n_linear_ranges = ARRAY_SIZE(arizona_micsupp_ext_ranges), 198 + 199 + .enable_time = 3000, 200 + 201 + .owner = THIS_MODULE, 202 + }; 203 + 177 204 static const struct regulator_init_data arizona_micsupp_default = { 178 205 .constraints = { 179 206 .valid_ops_mask = REGULATOR_CHANGE_STATUS | ··· 213 186 .num_consumer_supplies = 1, 214 187 }; 215 188 189 + static const struct regulator_init_data arizona_micsupp_ext_default = { 190 + .constraints = { 191 + .valid_ops_mask = REGULATOR_CHANGE_STATUS | 192 + REGULATOR_CHANGE_VOLTAGE | 193 + REGULATOR_CHANGE_BYPASS, 194 + .min_uV = 900000, 195 + .max_uV = 3300000, 196 + }, 197 + 198 + .num_consumer_supplies = 1, 199 + }; 200 + 216 201 static int arizona_micsupp_probe(struct platform_device *pdev) 217 202 { 218 203 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); 204 + const struct regulator_desc *desc; 219 205 struct regulator_config config = { }; 220 206 struct arizona_micsupp *micsupp; 221 207 int ret; ··· 247 207 * default init_data for it. This will be overridden with 248 208 * platform data if provided. 249 209 */ 250 - micsupp->init_data = arizona_micsupp_default; 210 + switch (arizona->type) { 211 + case WM5110: 212 + desc = &arizona_micsupp_ext; 213 + micsupp->init_data = arizona_micsupp_ext_default; 214 + break; 215 + default: 216 + desc = &arizona_micsupp; 217 + micsupp->init_data = arizona_micsupp_default; 218 + break; 219 + } 220 + 251 221 micsupp->init_data.consumer_supplies = &micsupp->supply; 252 222 micsupp->supply.supply = "MICVDD"; 253 223 micsupp->supply.dev_name = dev_name(arizona->dev); ··· 276 226 ARIZONA_CPMIC_BYPASS, 0); 277 227 278 228 micsupp->regulator = devm_regulator_register(&pdev->dev, 279 - &arizona_micsupp, 229 + desc, 280 230 &config); 281 231 if (IS_ERR(micsupp->regulator)) { 282 232 ret = PTR_ERR(micsupp->regulator);
+3
drivers/regulator/core.c
··· 2184 2184 struct regulator_ops *ops = rdev->desc->ops; 2185 2185 int ret; 2186 2186 2187 + if (rdev->desc->fixed_uV && rdev->desc->n_voltages == 1 && !selector) 2188 + return rdev->desc->fixed_uV; 2189 + 2187 2190 if (!ops->list_voltage || selector >= rdev->desc->n_voltages) 2188 2191 return -EINVAL; 2189 2192
+6 -1
drivers/regulator/gpio-regulator.c
··· 139 139 struct property *prop; 140 140 const char *regtype; 141 141 int proplen, gpio, i; 142 + int ret; 142 143 143 144 config = devm_kzalloc(dev, 144 145 sizeof(struct gpio_regulator_config), ··· 203 202 } 204 203 config->nr_states = i; 205 204 206 - of_property_read_string(np, "regulator-type", &regtype); 205 + ret = of_property_read_string(np, "regulator-type", &regtype); 206 + if (ret < 0) { 207 + dev_err(dev, "Missing 'regulator-type' property\n"); 208 + return ERR_PTR(-EINVAL); 209 + } 207 210 208 211 if (!strncmp("voltage", regtype, 7)) 209 212 config->type = REGULATOR_VOLTAGE;
+9 -3
drivers/regulator/pfuze100-regulator.c
··· 308 308 if (ret) 309 309 return ret; 310 310 311 - if (value & 0x0f) { 312 - dev_warn(pfuze_chip->dev, "Illegal ID: %x\n", value); 313 - return -ENODEV; 311 + switch (value & 0x0f) { 312 + /* Freescale misprogrammed 1-3% of parts prior to week 8 of 2013 as ID=8 */ 313 + case 0x8: 314 + dev_info(pfuze_chip->dev, "Assuming misprogrammed ID=0x8"); 315 + case 0x0: 316 + break; 317 + default: 318 + dev_warn(pfuze_chip->dev, "Illegal ID: %x\n", value); 319 + return -ENODEV; 314 320 } 315 321 316 322 ret = regmap_read(pfuze_chip->regmap, PFUZE100_REVID, &value);