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/act8865', 'regulator/topic/arizona-ldo1', 'regulator/topic/arizona-micsupp' and 'regulator/topic/da9211' into regulator-next

+189 -31
+26 -1
Documentation/devicetree/bindings/regulator/act8865-regulator.txt
··· 2 2 ------------------- 3 3 4 4 Required properties: 5 - - compatible: "active-semi,act8846" or "active-semi,act8865" 5 + - compatible: "active-semi,act8846" or "active-semi,act8865" or "active-semi,act8600" 6 6 - reg: I2C slave address 7 7 8 8 Optional properties: 9 9 - system-power-controller: Telling whether or not this pmic is controlling 10 10 the system power. See Documentation/devicetree/bindings/power/power-controller.txt . 11 + 12 + Optional input supply properties: 13 + - for act8600: 14 + - vp1-supply: The input supply for DCDC_REG1 15 + - vp2-supply: The input supply for DCDC_REG2 16 + - vp3-supply: The input supply for DCDC_REG3 17 + - inl-supply: The input supply for LDO_REG5, LDO_REG6, LDO_REG7 and LDO_REG8 18 + SUDCDC_REG4, LDO_REG9 and LDO_REG10 do not have separate supplies. 19 + - for act8846: 20 + - vp1-supply: The input supply for REG1 21 + - vp2-supply: The input supply for REG2 22 + - vp3-supply: The input supply for REG3 23 + - vp4-supply: The input supply for REG4 24 + - inl1-supply: The input supply for REG5, REG6 and REG7 25 + - inl2-supply: The input supply for REG8 and LDO_REG9 26 + - inl3-supply: The input supply for REG10, REG11 and REG12 27 + - for act8865: 28 + - vp1-supply: The input supply for DCDC_REG1 29 + - vp2-supply: The input supply for DCDC_REG2 30 + - vp3-supply: The input supply for DCDC_REG3 31 + - inl45-supply: The input supply for LDO_REG1 and LDO_REG2 32 + - inl67-supply: The input supply for LDO_REG3 and LDO_REG4 11 33 12 34 Any standard regulator properties can be used to configure the single regulator. 13 35 ··· 38 16 REG1, REG2, REG3, REG4, REG5, REG6, REG7, REG8, REG9, REG10, REG11, REG12 39 17 - for act8865: 40 18 DCDC_REG1, DCDC_REG2, DCDC_REG3, LDO_REG1, LDO_REG2, LDO_REG3, LDO_REG4. 19 + - for act8600: 20 + DCDC_REG1, DCDC_REG2, DCDC_REG3, SUDCDC_REG4, LDO_REG5, LDO_REG6, LDO_REG7, 21 + LDO_REG8, LDO_REG9, LDO_REG10, 41 22 42 23 Example: 43 24 --------
+140 -21
drivers/regulator/act8865-regulator.c
··· 29 29 #include <linux/regmap.h> 30 30 31 31 /* 32 + * ACT8600 Global Register Map. 33 + */ 34 + #define ACT8600_SYS_MODE 0x00 35 + #define ACT8600_SYS_CTRL 0x01 36 + #define ACT8600_DCDC1_VSET 0x10 37 + #define ACT8600_DCDC1_CTRL 0x12 38 + #define ACT8600_DCDC2_VSET 0x20 39 + #define ACT8600_DCDC2_CTRL 0x22 40 + #define ACT8600_DCDC3_VSET 0x30 41 + #define ACT8600_DCDC3_CTRL 0x32 42 + #define ACT8600_SUDCDC4_VSET 0x40 43 + #define ACT8600_SUDCDC4_CTRL 0x41 44 + #define ACT8600_LDO5_VSET 0x50 45 + #define ACT8600_LDO5_CTRL 0x51 46 + #define ACT8600_LDO6_VSET 0x60 47 + #define ACT8600_LDO6_CTRL 0x61 48 + #define ACT8600_LDO7_VSET 0x70 49 + #define ACT8600_LDO7_CTRL 0x71 50 + #define ACT8600_LDO8_VSET 0x80 51 + #define ACT8600_LDO8_CTRL 0x81 52 + #define ACT8600_LDO910_CTRL 0x91 53 + #define ACT8600_APCH0 0xA1 54 + #define ACT8600_APCH1 0xA8 55 + #define ACT8600_APCH2 0xA9 56 + #define ACT8600_APCH_STAT 0xAA 57 + #define ACT8600_OTG0 0xB0 58 + #define ACT8600_OTG1 0xB2 59 + 60 + /* 32 61 * ACT8846 Global Register Map. 33 62 */ 34 63 #define ACT8846_SYS0 0x00 ··· 123 94 #define ACT8865_ENA 0x80 /* ON - [7] */ 124 95 #define ACT8865_VSEL_MASK 0x3F /* VSET - [5:0] */ 125 96 97 + 98 + #define ACT8600_LDO10_ENA 0x40 /* ON - [6] */ 99 + #define ACT8600_SUDCDC_VSEL_MASK 0xFF /* SUDCDC VSET - [7:0] */ 100 + 126 101 /* 127 102 * ACT8865 voltage number 128 103 */ 129 104 #define ACT8865_VOLTAGE_NUM 64 105 + #define ACT8600_SUDCDC_VOLTAGE_NUM 255 130 106 131 107 struct act8865 { 132 108 struct regmap *regmap; ··· 150 116 REGULATOR_LINEAR_RANGE(2400000, 48, 63, 100000), 151 117 }; 152 118 119 + static const struct regulator_linear_range act8600_sudcdc_voltage_ranges[] = { 120 + REGULATOR_LINEAR_RANGE(3000000, 0, 63, 0), 121 + REGULATOR_LINEAR_RANGE(3000000, 64, 159, 100000), 122 + REGULATOR_LINEAR_RANGE(12600000, 160, 191, 200000), 123 + REGULATOR_LINEAR_RANGE(19000000, 191, 255, 400000), 124 + }; 125 + 153 126 static struct regulator_ops act8865_ops = { 154 127 .list_voltage = regulator_list_voltage_linear_range, 155 128 .map_voltage = regulator_map_voltage_linear_range, ··· 167 126 .is_enabled = regulator_is_enabled_regmap, 168 127 }; 169 128 170 - #define ACT88xx_REG(_name, _family, _id, _vsel_reg) \ 129 + static struct regulator_ops act8865_ldo_ops = { 130 + .enable = regulator_enable_regmap, 131 + .disable = regulator_disable_regmap, 132 + .is_enabled = regulator_is_enabled_regmap, 133 + }; 134 + 135 + #define ACT88xx_REG(_name, _family, _id, _vsel_reg, _supply) \ 171 136 [_family##_ID_##_id] = { \ 172 137 .name = _name, \ 138 + .supply_name = _supply, \ 173 139 .id = _family##_ID_##_id, \ 174 140 .type = REGULATOR_VOLTAGE, \ 175 141 .ops = &act8865_ops, \ ··· 190 142 .owner = THIS_MODULE, \ 191 143 } 192 144 145 + static const struct regulator_desc act8600_regulators[] = { 146 + ACT88xx_REG("DCDC1", ACT8600, DCDC1, VSET, "vp1"), 147 + ACT88xx_REG("DCDC2", ACT8600, DCDC2, VSET, "vp2"), 148 + ACT88xx_REG("DCDC3", ACT8600, DCDC3, VSET, "vp3"), 149 + { 150 + .name = "SUDCDC_REG4", 151 + .id = ACT8600_ID_SUDCDC4, 152 + .ops = &act8865_ops, 153 + .type = REGULATOR_VOLTAGE, 154 + .n_voltages = ACT8600_SUDCDC_VOLTAGE_NUM, 155 + .linear_ranges = act8600_sudcdc_voltage_ranges, 156 + .n_linear_ranges = ARRAY_SIZE(act8600_sudcdc_voltage_ranges), 157 + .vsel_reg = ACT8600_SUDCDC4_VSET, 158 + .vsel_mask = ACT8600_SUDCDC_VSEL_MASK, 159 + .enable_reg = ACT8600_SUDCDC4_CTRL, 160 + .enable_mask = ACT8865_ENA, 161 + .owner = THIS_MODULE, 162 + }, 163 + ACT88xx_REG("LDO5", ACT8600, LDO5, VSET, "inl"), 164 + ACT88xx_REG("LDO6", ACT8600, LDO6, VSET, "inl"), 165 + ACT88xx_REG("LDO7", ACT8600, LDO7, VSET, "inl"), 166 + ACT88xx_REG("LDO8", ACT8600, LDO8, VSET, "inl"), 167 + { 168 + .name = "LDO_REG9", 169 + .id = ACT8600_ID_LDO9, 170 + .ops = &act8865_ldo_ops, 171 + .type = REGULATOR_VOLTAGE, 172 + .n_voltages = 1, 173 + .fixed_uV = 1800000, 174 + .enable_reg = ACT8600_LDO910_CTRL, 175 + .enable_mask = ACT8865_ENA, 176 + .owner = THIS_MODULE, 177 + }, 178 + { 179 + .name = "LDO_REG10", 180 + .id = ACT8600_ID_LDO10, 181 + .ops = &act8865_ldo_ops, 182 + .type = REGULATOR_VOLTAGE, 183 + .n_voltages = 1, 184 + .fixed_uV = 1200000, 185 + .enable_reg = ACT8600_LDO910_CTRL, 186 + .enable_mask = ACT8600_LDO10_ENA, 187 + .owner = THIS_MODULE, 188 + }, 189 + }; 190 + 193 191 static const struct regulator_desc act8846_regulators[] = { 194 - ACT88xx_REG("REG1", ACT8846, REG1, VSET), 195 - ACT88xx_REG("REG2", ACT8846, REG2, VSET0), 196 - ACT88xx_REG("REG3", ACT8846, REG3, VSET0), 197 - ACT88xx_REG("REG4", ACT8846, REG4, VSET0), 198 - ACT88xx_REG("REG5", ACT8846, REG5, VSET), 199 - ACT88xx_REG("REG6", ACT8846, REG6, VSET), 200 - ACT88xx_REG("REG7", ACT8846, REG7, VSET), 201 - ACT88xx_REG("REG8", ACT8846, REG8, VSET), 202 - ACT88xx_REG("REG9", ACT8846, REG9, VSET), 203 - ACT88xx_REG("REG10", ACT8846, REG10, VSET), 204 - ACT88xx_REG("REG11", ACT8846, REG11, VSET), 205 - ACT88xx_REG("REG12", ACT8846, REG12, VSET), 192 + ACT88xx_REG("REG1", ACT8846, REG1, VSET, "vp1"), 193 + ACT88xx_REG("REG2", ACT8846, REG2, VSET0, "vp2"), 194 + ACT88xx_REG("REG3", ACT8846, REG3, VSET0, "vp3"), 195 + ACT88xx_REG("REG4", ACT8846, REG4, VSET0, "vp4"), 196 + ACT88xx_REG("REG5", ACT8846, REG5, VSET, "inl1"), 197 + ACT88xx_REG("REG6", ACT8846, REG6, VSET, "inl1"), 198 + ACT88xx_REG("REG7", ACT8846, REG7, VSET, "inl1"), 199 + ACT88xx_REG("REG8", ACT8846, REG8, VSET, "inl2"), 200 + ACT88xx_REG("REG9", ACT8846, REG9, VSET, "inl2"), 201 + ACT88xx_REG("REG10", ACT8846, REG10, VSET, "inl3"), 202 + ACT88xx_REG("REG11", ACT8846, REG11, VSET, "inl3"), 203 + ACT88xx_REG("REG12", ACT8846, REG12, VSET, "inl3"), 206 204 }; 207 205 208 206 static const struct regulator_desc act8865_regulators[] = { 209 - ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET1), 210 - ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET1), 211 - ACT88xx_REG("DCDC_REG3", ACT8865, DCDC3, VSET1), 212 - ACT88xx_REG("LDO_REG1", ACT8865, LDO1, VSET), 213 - ACT88xx_REG("LDO_REG2", ACT8865, LDO2, VSET), 214 - ACT88xx_REG("LDO_REG3", ACT8865, LDO3, VSET), 215 - ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET), 207 + ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET1, "vp1"), 208 + ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET1, "vp2"), 209 + ACT88xx_REG("DCDC_REG3", ACT8865, DCDC3, VSET1, "vp3"), 210 + ACT88xx_REG("LDO_REG1", ACT8865, LDO1, VSET, "inl45"), 211 + ACT88xx_REG("LDO_REG2", ACT8865, LDO2, VSET, "inl45"), 212 + ACT88xx_REG("LDO_REG3", ACT8865, LDO3, VSET, "inl67"), 213 + ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET, "inl67"), 216 214 }; 217 215 218 216 #ifdef CONFIG_OF 219 217 static const struct of_device_id act8865_dt_ids[] = { 218 + { .compatible = "active-semi,act8600", .data = (void *)ACT8600 }, 220 219 { .compatible = "active-semi,act8846", .data = (void *)ACT8846 }, 221 220 { .compatible = "active-semi,act8865", .data = (void *)ACT8865 }, 222 221 { } ··· 295 200 [ACT8865_ID_LDO4] = { .name = "LDO_REG4"}, 296 201 }; 297 202 203 + static struct of_regulator_match act8600_matches[] = { 204 + [ACT8600_ID_DCDC1] = { .name = "DCDC_REG1"}, 205 + [ACT8600_ID_DCDC2] = { .name = "DCDC_REG2"}, 206 + [ACT8600_ID_DCDC3] = { .name = "DCDC_REG3"}, 207 + [ACT8600_ID_SUDCDC4] = { .name = "SUDCDC_REG4"}, 208 + [ACT8600_ID_LDO5] = { .name = "LDO_REG5"}, 209 + [ACT8600_ID_LDO6] = { .name = "LDO_REG6"}, 210 + [ACT8600_ID_LDO7] = { .name = "LDO_REG7"}, 211 + [ACT8600_ID_LDO8] = { .name = "LDO_REG8"}, 212 + [ACT8600_ID_LDO9] = { .name = "LDO_REG9"}, 213 + [ACT8600_ID_LDO10] = { .name = "LDO_REG10"}, 214 + }; 215 + 298 216 static int act8865_pdata_from_dt(struct device *dev, 299 217 struct device_node **of_node, 300 218 struct act8865_platform_data *pdata, ··· 325 217 } 326 218 327 219 switch (type) { 220 + case ACT8600: 221 + matches = act8600_matches; 222 + num_matches = ARRAY_SIZE(act8600_matches); 223 + break; 328 224 case ACT8846: 329 225 matches = act8846_matches; 330 226 num_matches = ARRAY_SIZE(act8846_matches); ··· 429 317 } 430 318 431 319 switch (type) { 320 + case ACT8600: 321 + regulators = act8600_regulators; 322 + num_regulators = ARRAY_SIZE(act8600_regulators); 323 + off_reg = -1; 324 + off_mask = -1; 325 + break; 432 326 case ACT8846: 433 327 regulators = act8846_regulators; 434 328 num_regulators = ARRAY_SIZE(act8846_regulators); ··· 484 366 } 485 367 486 368 if (of_device_is_system_power_controller(dev->of_node)) { 487 - if (!pm_power_off) { 369 + if (!pm_power_off && (off_reg > 0)) { 488 370 act8865_i2c_client = client; 489 371 act8865->off_reg = off_reg; 490 372 act8865->off_mask = off_mask; ··· 520 402 } 521 403 522 404 static const struct i2c_device_id act8865_ids[] = { 405 + { .name = "act8600", .driver_data = ACT8600 }, 523 406 { .name = "act8846", .driver_data = ACT8846 }, 524 407 { .name = "act8865", .driver_data = ACT8865 }, 525 408 { },
+3 -2
drivers/regulator/arizona-ldo1.c
··· 282 282 arizona->external_dcvdd = true; 283 283 284 284 ldo1->regulator = devm_regulator_register(&pdev->dev, desc, &config); 285 + 286 + of_node_put(config.of_node); 287 + 285 288 if (IS_ERR(ldo1->regulator)) { 286 289 ret = PTR_ERR(ldo1->regulator); 287 290 dev_err(arizona->dev, "Failed to register LDO1 supply: %d\n", 288 291 ret); 289 292 return ret; 290 293 } 291 - 292 - of_node_put(config.of_node); 293 294 294 295 platform_set_drvdata(pdev, ldo1); 295 296
+3 -2
drivers/regulator/arizona-micsupp.c
··· 284 284 micsupp->regulator = devm_regulator_register(&pdev->dev, 285 285 desc, 286 286 &config); 287 + 288 + of_node_put(config.of_node); 289 + 287 290 if (IS_ERR(micsupp->regulator)) { 288 291 ret = PTR_ERR(micsupp->regulator); 289 292 dev_err(arizona->dev, "Failed to register mic supply: %d\n", 290 293 ret); 291 294 return ret; 292 295 } 293 - 294 - of_node_put(config.of_node); 295 296 296 297 platform_set_drvdata(pdev, micsupp); 297 298
+3 -5
drivers/regulator/da9211-regulator.c
··· 305 305 306 306 if (reg_val & DA9211_E_OV_CURR_A) { 307 307 regulator_notifier_call_chain(chip->rdev[0], 308 - REGULATOR_EVENT_OVER_CURRENT, 309 - rdev_get_drvdata(chip->rdev[0])); 308 + REGULATOR_EVENT_OVER_CURRENT, NULL); 310 309 311 310 err = regmap_write(chip->regmap, DA9211_REG_EVENT_B, 312 311 DA9211_E_OV_CURR_A); ··· 317 318 318 319 if (reg_val & DA9211_E_OV_CURR_B) { 319 320 regulator_notifier_call_chain(chip->rdev[1], 320 - REGULATOR_EVENT_OVER_CURRENT, 321 - rdev_get_drvdata(chip->rdev[1])); 321 + REGULATOR_EVENT_OVER_CURRENT, NULL); 322 322 323 323 err = regmap_write(chip->regmap, DA9211_REG_EVENT_B, 324 324 DA9211_E_OV_CURR_B); ··· 342 344 343 345 ret = regmap_read(chip->regmap, DA9211_REG_CONFIG_E, &data); 344 346 if (ret < 0) { 345 - dev_err(chip->dev, "Failed to read CONTROL_E reg: %d\n", ret); 347 + dev_err(chip->dev, "Failed to read CONFIG_E reg: %d\n", ret); 346 348 return ret; 347 349 } 348 350
+14
include/linux/regulator/act8865.h
··· 19 19 #include <linux/regulator/machine.h> 20 20 21 21 enum { 22 + ACT8600_ID_DCDC1, 23 + ACT8600_ID_DCDC2, 24 + ACT8600_ID_DCDC3, 25 + ACT8600_ID_SUDCDC4, 26 + ACT8600_ID_LDO5, 27 + ACT8600_ID_LDO6, 28 + ACT8600_ID_LDO7, 29 + ACT8600_ID_LDO8, 30 + ACT8600_ID_LDO9, 31 + ACT8600_ID_LDO10, 32 + }; 33 + 34 + enum { 22 35 ACT8865_ID_DCDC1, 23 36 ACT8865_ID_DCDC2, 24 37 ACT8865_ID_DCDC3, ··· 59 46 }; 60 47 61 48 enum { 49 + ACT8600, 62 50 ACT8865, 63 51 ACT8846, 64 52 };