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/qcom-spmi', 'regulator/topic/rn5t618', 'regulator/topic/tps65218' and 'regulator/topic/twl' into regulator-next

+263 -55
+11 -8
Documentation/devicetree/bindings/mfd/rn5t618.txt
··· 1 - * Ricoh RN5T618 PMIC 1 + * Ricoh RN5T567/RN5T618 PMIC 2 2 3 - Ricoh RN5T618 is a power management IC which integrates 3 step-down 4 - DCDC converters, 7 low-dropout regulators, a Li-ion battery charger, 5 - fuel gauge, ADC, GPIOs and a watchdog timer. It can be controlled 6 - through a I2C interface. 3 + Ricoh RN5T567/RN5T618 is a power management IC family which integrates 4 + 3 to 4 step-down DCDC converters, 7 low-dropout regulators, GPIOs and 5 + a watchdog timer. The RN5T618 provides additionally a Li-ion battery 6 + charger, fuel gauge and an ADC. It can be controlled through an I2C 7 + interface. 7 8 8 9 Required properties: 9 - - compatible: should be "ricoh,rn5t618" 10 + - compatible: must be one of 11 + "ricoh,rn5t567" 12 + "ricoh,rn5t618" 10 13 - reg: the I2C slave address of the device 11 14 12 15 Sub-nodes: 13 16 - regulators: the node is required if the regulator functionality is 14 - needed. The valid regulator names are: DCDC1, DCDC2, DCDC3, LDO1, 15 - LDO2, LDO3, LDO4, LDO5, LDORTC1 and LDORTC2. 17 + needed. The valid regulator names are: DCDC1, DCDC2, DCDC3, DCDC4 18 + (RN5T567), LDO1, LDO2, LDO3, LDO4, LDO5, LDORTC1 and LDORTC2. 16 19 The common bindings for each individual regulator can be found in: 17 20 Documentation/devicetree/bindings/regulator/regulator.txt 18 21
+3 -3
Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
··· 113 113 l14, l15, l16, l17, l18 114 114 115 115 pm8941: 116 - s1, s2, s3, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, 117 - l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, lvs3, 118 - mvs1, mvs2 116 + s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, 117 + l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, lvs3, 118 + 5vs1, 5vs2 119 119 120 120 pm8994: 121 121 s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, l1, l2, l3, l4, l5,
+1
arch/arm/boot/dts/meson8-minix-neo-x8.dts
··· 80 80 pmic@32 { 81 81 compatible = "ricoh,rn5t618"; 82 82 reg = <0x32>; 83 + system-power-controller; 83 84 84 85 regulators { 85 86 };
+4 -3
drivers/mfd/Kconfig
··· 852 852 including interrupts, RTC, LDO & DCDC regulators, and onkey. 853 853 854 854 config MFD_RN5T618 855 - tristate "Ricoh RN5T5618 PMIC" 855 + tristate "Ricoh RN5T567/618 PMIC" 856 856 depends on I2C 857 + depends on OF 857 858 select MFD_CORE 858 859 select REGMAP_I2C 859 860 help 860 - Say yes here to add support for the Ricoh RN5T618 PMIC. This 861 - driver provides common support for accessing the device, 861 + Say yes here to add support for the Ricoh RN5T567 or R5T618 PMIC. 862 + This driver provides common support for accessing the device, 862 863 additional drivers must be enabled in order to use the 863 864 functionality of the device. 864 865
+58 -12
drivers/mfd/rn5t618.c
··· 2 2 * MFD core driver for Ricoh RN5T618 PMIC 3 3 * 4 4 * Copyright (C) 2014 Beniamino Galvani <b.galvani@gmail.com> 5 + * Copyright (C) 2016 Toradex AG 5 6 * 6 7 * This program is free software; you can redistribute it and/or 7 8 * modify it under the terms of the GNU General Public License ··· 12 11 * along with this program. If not, see <http://www.gnu.org/licenses/>. 13 12 */ 14 13 14 + #include <linux/delay.h> 15 15 #include <linux/i2c.h> 16 16 #include <linux/mfd/core.h> 17 17 #include <linux/mfd/rn5t618.h> 18 18 #include <linux/module.h> 19 + #include <linux/of_device.h> 20 + #include <linux/reboot.h> 19 21 #include <linux/regmap.h> 20 22 21 23 static const struct mfd_cell rn5t618_cells[] = { ··· 52 48 }; 53 49 54 50 static struct rn5t618 *rn5t618_pm_power_off; 51 + static struct notifier_block rn5t618_restart_handler; 55 52 56 - static void rn5t618_power_off(void) 53 + static void rn5t618_trigger_poweroff_sequence(bool repower) 57 54 { 58 55 /* disable automatic repower-on */ 59 56 regmap_update_bits(rn5t618_pm_power_off->regmap, RN5T618_REPCNT, 60 - RN5T618_REPCNT_REPWRON, 0); 57 + RN5T618_REPCNT_REPWRON, 58 + repower ? RN5T618_REPCNT_REPWRON : 0); 61 59 /* start power-off sequence */ 62 60 regmap_update_bits(rn5t618_pm_power_off->regmap, RN5T618_SLPCNT, 63 61 RN5T618_SLPCNT_SWPWROFF, RN5T618_SLPCNT_SWPWROFF); 64 62 } 65 63 64 + static void rn5t618_power_off(void) 65 + { 66 + rn5t618_trigger_poweroff_sequence(false); 67 + } 68 + 69 + static int rn5t618_restart(struct notifier_block *this, 70 + unsigned long mode, void *cmd) 71 + { 72 + rn5t618_trigger_poweroff_sequence(true); 73 + 74 + /* 75 + * Re-power factor detection on PMIC side is not instant. 1ms 76 + * proved to be enough time until reset takes effect. 77 + */ 78 + mdelay(1); 79 + 80 + return NOTIFY_DONE; 81 + } 82 + 83 + static const struct of_device_id rn5t618_of_match[] = { 84 + { .compatible = "ricoh,rn5t567", .data = (void *)RN5T567 }, 85 + { .compatible = "ricoh,rn5t618", .data = (void *)RN5T618 }, 86 + { } 87 + }; 88 + MODULE_DEVICE_TABLE(of, rn5t618_of_match); 89 + 66 90 static int rn5t618_i2c_probe(struct i2c_client *i2c, 67 91 const struct i2c_device_id *id) 68 92 { 93 + const struct of_device_id *of_id; 69 94 struct rn5t618 *priv; 70 95 int ret; 96 + 97 + of_id = of_match_device(rn5t618_of_match, &i2c->dev); 98 + if (!of_id) { 99 + dev_err(&i2c->dev, "Failed to find matching DT ID\n"); 100 + return -EINVAL; 101 + } 71 102 72 103 priv = devm_kzalloc(&i2c->dev, sizeof(*priv), GFP_KERNEL); 73 104 if (!priv) 74 105 return -ENOMEM; 75 106 76 107 i2c_set_clientdata(i2c, priv); 108 + priv->variant = (long)of_id->data; 77 109 78 110 priv->regmap = devm_regmap_init_i2c(i2c, &rn5t618_regmap_config); 79 111 if (IS_ERR(priv->regmap)) { ··· 125 85 return ret; 126 86 } 127 87 128 - if (!pm_power_off) { 129 - rn5t618_pm_power_off = priv; 130 - pm_power_off = rn5t618_power_off; 88 + rn5t618_pm_power_off = priv; 89 + if (of_device_is_system_power_controller(i2c->dev.of_node)) { 90 + if (!pm_power_off) 91 + pm_power_off = rn5t618_power_off; 92 + else 93 + dev_warn(&i2c->dev, "Poweroff callback already assigned\n"); 94 + } 95 + 96 + rn5t618_restart_handler.notifier_call = rn5t618_restart; 97 + rn5t618_restart_handler.priority = 192; 98 + 99 + ret = register_restart_handler(&rn5t618_restart_handler); 100 + if (ret) { 101 + dev_err(&i2c->dev, "cannot register restart handler, %d\n", ret); 102 + return ret; 131 103 } 132 104 133 105 return 0; ··· 156 104 157 105 return 0; 158 106 } 159 - 160 - static const struct of_device_id rn5t618_of_match[] = { 161 - { .compatible = "ricoh,rn5t618" }, 162 - { } 163 - }; 164 - MODULE_DEVICE_TABLE(of, rn5t618_of_match); 165 107 166 108 static const struct i2c_device_id rn5t618_i2c_id[] = { 167 109 { } ··· 175 129 module_i2c_driver(rn5t618_i2c_driver); 176 130 177 131 MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>"); 178 - MODULE_DESCRIPTION("Ricoh RN5T618 MFD driver"); 132 + MODULE_DESCRIPTION("Ricoh RN5T567/618 MFD driver"); 179 133 MODULE_LICENSE("GPL v2");
+3 -2
drivers/regulator/Kconfig
··· 645 645 outputs which can be controlled by i2c communication. 646 646 647 647 config REGULATOR_RN5T618 648 - tristate "Ricoh RN5T618 voltage regulators" 648 + tristate "Ricoh RN5T567/618 voltage regulators" 649 649 depends on MFD_RN5T618 650 650 help 651 - Say y here to support the regulators found on Ricoh RN5T618 PMIC. 651 + Say y here to support the regulators found on Ricoh RN5T567 or 652 + RN5T618 PMIC. 652 653 653 654 config REGULATOR_RT5033 654 655 tristate "Richtek RT5033 Regulators"
+5 -2
drivers/regulator/qcom_spmi-regulator.c
··· 1085 1085 .set_pull_down = spmi_regulator_common_set_pull_down, 1086 1086 .set_soft_start = spmi_regulator_common_set_soft_start, 1087 1087 .set_over_current_protection = spmi_regulator_vs_ocp, 1088 + .set_mode = spmi_regulator_common_set_mode, 1089 + .get_mode = spmi_regulator_common_get_mode, 1088 1090 }; 1089 1091 1090 1092 static struct regulator_ops spmi_boost_ops = { ··· 1498 1496 { "s1", 0x1400, "vdd_s1", }, 1499 1497 { "s2", 0x1700, "vdd_s2", }, 1500 1498 { "s3", 0x1a00, "vdd_s3", }, 1499 + { "s4", 0xa000, }, 1501 1500 { "l1", 0x4000, "vdd_l1_l3", }, 1502 1501 { "l2", 0x4100, "vdd_l2_lvs_1_2_3", }, 1503 1502 { "l3", 0x4200, "vdd_l1_l3", }, ··· 1526 1523 { "lvs1", 0x8000, "vdd_l2_lvs_1_2_3", }, 1527 1524 { "lvs2", 0x8100, "vdd_l2_lvs_1_2_3", }, 1528 1525 { "lvs3", 0x8200, "vdd_l2_lvs_1_2_3", }, 1529 - { "mvs1", 0x8300, "vin_5vs", }, 1530 - { "mvs2", 0x8400, "vin_5vs", }, 1526 + { "5vs1", 0x8300, "vin_5vs", "ocp-5vs1", }, 1527 + { "5vs2", 0x8400, "vin_5vs", "ocp-5vs2", }, 1531 1528 { } 1532 1529 }; 1533 1530
+36 -4
drivers/regulator/rn5t618-regulator.c
··· 46 46 .vsel_mask = (vmask), \ 47 47 } 48 48 49 + static struct regulator_desc rn5t567_regulators[] = { 50 + /* DCDC */ 51 + REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500), 52 + REG(DCDC2, DC2CTL, BIT(0), DC2DAC, 0xff, 600000, 3500000, 12500), 53 + REG(DCDC3, DC3CTL, BIT(0), DC3DAC, 0xff, 600000, 3500000, 12500), 54 + REG(DCDC4, DC4CTL, BIT(0), DC4DAC, 0xff, 600000, 3500000, 12500), 55 + /* LDO */ 56 + REG(LDO1, LDOEN1, BIT(0), LDO1DAC, 0x7f, 900000, 3500000, 25000), 57 + REG(LDO2, LDOEN1, BIT(1), LDO2DAC, 0x7f, 900000, 3500000, 25000), 58 + REG(LDO3, LDOEN1, BIT(2), LDO3DAC, 0x7f, 600000, 3500000, 25000), 59 + REG(LDO4, LDOEN1, BIT(3), LDO4DAC, 0x7f, 900000, 3500000, 25000), 60 + REG(LDO5, LDOEN1, BIT(4), LDO5DAC, 0x7f, 900000, 3500000, 25000), 61 + /* LDO RTC */ 62 + REG(LDORTC1, LDOEN2, BIT(4), LDORTCDAC, 0x7f, 1200000, 3500000, 25000), 63 + REG(LDORTC2, LDOEN2, BIT(5), LDORTC2DAC, 0x7f, 900000, 3500000, 25000), 64 + }; 65 + 49 66 static struct regulator_desc rn5t618_regulators[] = { 50 67 /* DCDC */ 51 68 REG(DCDC1, DC1CTL, BIT(0), DC1DAC, 0xff, 600000, 3500000, 12500), ··· 84 67 struct rn5t618 *rn5t618 = dev_get_drvdata(pdev->dev.parent); 85 68 struct regulator_config config = { }; 86 69 struct regulator_dev *rdev; 70 + struct regulator_desc *regulators; 87 71 int i; 88 72 73 + switch (rn5t618->variant) { 74 + case RN5T567: 75 + regulators = rn5t567_regulators; 76 + break; 77 + case RN5T618: 78 + regulators = rn5t618_regulators; 79 + break; 80 + default: 81 + return -EINVAL; 82 + } 83 + 84 + config.dev = pdev->dev.parent; 85 + config.regmap = rn5t618->regmap; 86 + 89 87 for (i = 0; i < RN5T618_REG_NUM; i++) { 90 - config.dev = pdev->dev.parent; 91 - config.regmap = rn5t618->regmap; 88 + if (!regulators[i].name) 89 + continue; 92 90 93 91 rdev = devm_regulator_register(&pdev->dev, 94 - &rn5t618_regulators[i], 92 + &regulators[i], 95 93 &config); 96 94 if (IS_ERR(rdev)) { 97 95 dev_err(&pdev->dev, "failed to register %s regulator\n", 98 - rn5t618_regulators[i].name); 96 + regulators[i].name); 99 97 return PTR_ERR(rdev); 100 98 } 101 99 }
+60 -9
drivers/regulator/tps65217-regulator.c
··· 28 28 #include <linux/mfd/tps65217.h> 29 29 30 30 #define TPS65217_REGULATOR(_name, _id, _of_match, _ops, _n, _vr, _vm, _em, \ 31 - _t, _lr, _nlr) \ 31 + _t, _lr, _nlr, _sr, _sm) \ 32 32 { \ 33 33 .name = _name, \ 34 34 .id = _id, \ ··· 45 45 .volt_table = _t, \ 46 46 .linear_ranges = _lr, \ 47 47 .n_linear_ranges = _nlr, \ 48 + .bypass_reg = _sr, \ 49 + .bypass_mask = _sm, \ 48 50 } \ 49 51 50 52 static const unsigned int LDO1_VSEL_table[] = { ··· 120 118 return ret; 121 119 } 122 120 121 + static int tps65217_pmic_set_suspend_enable(struct regulator_dev *dev) 122 + { 123 + struct tps65217 *tps = rdev_get_drvdata(dev); 124 + unsigned int rid = rdev_get_id(dev); 125 + 126 + if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4) 127 + return -EINVAL; 128 + 129 + return tps65217_clear_bits(tps, dev->desc->bypass_reg, 130 + dev->desc->bypass_mask, 131 + TPS65217_PROTECT_L1); 132 + } 133 + 134 + static int tps65217_pmic_set_suspend_disable(struct regulator_dev *dev) 135 + { 136 + struct tps65217 *tps = rdev_get_drvdata(dev); 137 + unsigned int rid = rdev_get_id(dev); 138 + 139 + if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4) 140 + return -EINVAL; 141 + 142 + if (!tps->strobes[rid]) 143 + return -EINVAL; 144 + 145 + return tps65217_set_bits(tps, dev->desc->bypass_reg, 146 + dev->desc->bypass_mask, 147 + tps->strobes[rid], TPS65217_PROTECT_L1); 148 + } 149 + 123 150 /* Operations permitted on DCDCx, LDO2, LDO3 and LDO4 */ 124 151 static struct regulator_ops tps65217_pmic_ops = { 125 152 .is_enabled = regulator_is_enabled_regmap, ··· 158 127 .set_voltage_sel = tps65217_pmic_set_voltage_sel, 159 128 .list_voltage = regulator_list_voltage_linear_range, 160 129 .map_voltage = regulator_map_voltage_linear_range, 130 + .set_suspend_enable = tps65217_pmic_set_suspend_enable, 131 + .set_suspend_disable = tps65217_pmic_set_suspend_disable, 161 132 }; 162 133 163 134 /* Operations permitted on LDO1 */ ··· 171 138 .set_voltage_sel = tps65217_pmic_set_voltage_sel, 172 139 .list_voltage = regulator_list_voltage_table, 173 140 .map_voltage = regulator_map_voltage_ascend, 141 + .set_suspend_enable = tps65217_pmic_set_suspend_enable, 142 + .set_suspend_disable = tps65217_pmic_set_suspend_disable, 174 143 }; 175 144 176 145 static const struct regulator_desc regulators[] = { 177 146 TPS65217_REGULATOR("DCDC1", TPS65217_DCDC_1, "dcdc1", 178 147 tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC1, 179 148 TPS65217_DEFDCDCX_DCDC_MASK, TPS65217_ENABLE_DC1_EN, 180 - NULL, tps65217_uv1_ranges, 2), 149 + NULL, tps65217_uv1_ranges, 2, TPS65217_REG_SEQ1, 150 + TPS65217_SEQ1_DC1_SEQ_MASK), 181 151 TPS65217_REGULATOR("DCDC2", TPS65217_DCDC_2, "dcdc2", 182 152 tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC2, 183 153 TPS65217_DEFDCDCX_DCDC_MASK, TPS65217_ENABLE_DC2_EN, 184 154 NULL, tps65217_uv1_ranges, 185 - ARRAY_SIZE(tps65217_uv1_ranges)), 155 + ARRAY_SIZE(tps65217_uv1_ranges), TPS65217_REG_SEQ1, 156 + TPS65217_SEQ1_DC2_SEQ_MASK), 186 157 TPS65217_REGULATOR("DCDC3", TPS65217_DCDC_3, "dcdc3", 187 158 tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC3, 188 159 TPS65217_DEFDCDCX_DCDC_MASK, TPS65217_ENABLE_DC3_EN, 189 - NULL, tps65217_uv1_ranges, 1), 160 + NULL, tps65217_uv1_ranges, 1, TPS65217_REG_SEQ2, 161 + TPS65217_SEQ2_DC3_SEQ_MASK), 190 162 TPS65217_REGULATOR("LDO1", TPS65217_LDO_1, "ldo1", 191 163 tps65217_pmic_ldo1_ops, 16, TPS65217_REG_DEFLDO1, 192 164 TPS65217_DEFLDO1_LDO1_MASK, TPS65217_ENABLE_LDO1_EN, 193 - LDO1_VSEL_table, NULL, 0), 165 + LDO1_VSEL_table, NULL, 0, TPS65217_REG_SEQ2, 166 + TPS65217_SEQ2_LDO1_SEQ_MASK), 194 167 TPS65217_REGULATOR("LDO2", TPS65217_LDO_2, "ldo2", tps65217_pmic_ops, 195 168 64, TPS65217_REG_DEFLDO2, 196 169 TPS65217_DEFLDO2_LDO2_MASK, TPS65217_ENABLE_LDO2_EN, 197 170 NULL, tps65217_uv1_ranges, 198 - ARRAY_SIZE(tps65217_uv1_ranges)), 171 + ARRAY_SIZE(tps65217_uv1_ranges), TPS65217_REG_SEQ3, 172 + TPS65217_SEQ3_LDO2_SEQ_MASK), 199 173 TPS65217_REGULATOR("LDO3", TPS65217_LDO_3, "ldo3", tps65217_pmic_ops, 200 174 32, TPS65217_REG_DEFLS1, TPS65217_DEFLDO3_LDO3_MASK, 201 175 TPS65217_ENABLE_LS1_EN | TPS65217_DEFLDO3_LDO3_EN, 202 176 NULL, tps65217_uv2_ranges, 203 - ARRAY_SIZE(tps65217_uv2_ranges)), 177 + ARRAY_SIZE(tps65217_uv2_ranges), TPS65217_REG_SEQ3, 178 + TPS65217_SEQ3_LDO3_SEQ_MASK), 204 179 TPS65217_REGULATOR("LDO4", TPS65217_LDO_4, "ldo4", tps65217_pmic_ops, 205 180 32, TPS65217_REG_DEFLS2, TPS65217_DEFLDO4_LDO4_MASK, 206 181 TPS65217_ENABLE_LS2_EN | TPS65217_DEFLDO4_LDO4_EN, 207 182 NULL, tps65217_uv2_ranges, 208 - ARRAY_SIZE(tps65217_uv2_ranges)), 183 + ARRAY_SIZE(tps65217_uv2_ranges), TPS65217_REG_SEQ4, 184 + TPS65217_SEQ4_LDO4_SEQ_MASK), 209 185 }; 210 186 211 187 static int tps65217_regulator_probe(struct platform_device *pdev) ··· 223 181 struct tps65217_board *pdata = dev_get_platdata(tps->dev); 224 182 struct regulator_dev *rdev; 225 183 struct regulator_config config = { }; 226 - int i; 184 + int i, ret; 185 + unsigned int val; 227 186 228 187 if (tps65217_chip_id(tps) != TPS65217) { 229 188 dev_err(&pdev->dev, "Invalid tps chip version\n"); 230 189 return -ENODEV; 231 190 } 191 + 192 + /* Allocate memory for strobes */ 193 + tps->strobes = devm_kzalloc(&pdev->dev, sizeof(u8) * 194 + TPS65217_NUM_REGULATOR, GFP_KERNEL); 232 195 233 196 platform_set_drvdata(pdev, tps); 234 197 ··· 252 205 pdev->name); 253 206 return PTR_ERR(rdev); 254 207 } 208 + 209 + /* Store default strobe info */ 210 + ret = tps65217_reg_read(tps, regulators[i].bypass_reg, &val); 211 + tps->strobes[i] = val & regulators[i].bypass_mask; 255 212 } 256 213 257 214 return 0;
+65 -11
drivers/regulator/tps65218-regulator.c
··· 31 31 DCDC5, DCDC6, LDO1, LS3 }; 32 32 33 33 #define TPS65218_REGULATOR(_name, _id, _type, _ops, _n, _vr, _vm, _er, _em, \ 34 - _cr, _cm, _lr, _nlr, _delay, _fuv) \ 34 + _cr, _cm, _lr, _nlr, _delay, _fuv, _sr, _sm) \ 35 35 { \ 36 36 .name = _name, \ 37 37 .id = _id, \ ··· 49 49 .linear_ranges = _lr, \ 50 50 .n_linear_ranges = _nlr, \ 51 51 .ramp_delay = _delay, \ 52 - .fixed_uV = _fuv \ 52 + .fixed_uV = _fuv, \ 53 + .bypass_reg = _sr, \ 54 + .bypass_mask = _sm, \ 53 55 } \ 54 56 55 57 #define TPS65218_INFO(_id, _nm, _min, _max) \ ··· 159 157 dev->desc->enable_mask, TPS65218_PROTECT_L1); 160 158 } 161 159 160 + static int tps65218_pmic_set_suspend_enable(struct regulator_dev *dev) 161 + { 162 + struct tps65218 *tps = rdev_get_drvdata(dev); 163 + unsigned int rid = rdev_get_id(dev); 164 + 165 + if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1) 166 + return -EINVAL; 167 + 168 + return tps65218_clear_bits(tps, dev->desc->bypass_reg, 169 + dev->desc->bypass_mask, 170 + TPS65218_PROTECT_L1); 171 + } 172 + 173 + static int tps65218_pmic_set_suspend_disable(struct regulator_dev *dev) 174 + { 175 + struct tps65218 *tps = rdev_get_drvdata(dev); 176 + unsigned int rid = rdev_get_id(dev); 177 + 178 + if (rid < TPS65218_DCDC_1 || rid > TPS65218_LDO_1) 179 + return -EINVAL; 180 + 181 + if (!tps->info[rid]->strobe) { 182 + if (rid == TPS65218_DCDC_3) 183 + tps->info[rid]->strobe = 3; 184 + else 185 + return -EINVAL; 186 + } 187 + 188 + return tps65218_set_bits(tps, dev->desc->bypass_reg, 189 + dev->desc->bypass_mask, 190 + tps->info[rid]->strobe, 191 + TPS65218_PROTECT_L1); 192 + } 193 + 162 194 /* Operations permitted on DCDC1, DCDC2 */ 163 195 static struct regulator_ops tps65218_dcdc12_ops = { 164 196 .is_enabled = regulator_is_enabled_regmap, ··· 203 167 .list_voltage = regulator_list_voltage_linear_range, 204 168 .map_voltage = regulator_map_voltage_linear_range, 205 169 .set_voltage_time_sel = regulator_set_voltage_time_sel, 170 + .set_suspend_enable = tps65218_pmic_set_suspend_enable, 171 + .set_suspend_disable = tps65218_pmic_set_suspend_disable, 206 172 }; 207 173 208 174 /* Operations permitted on DCDC3, DCDC4 and LDO1 */ ··· 216 178 .set_voltage_sel = tps65218_pmic_set_voltage_sel, 217 179 .list_voltage = regulator_list_voltage_linear_range, 218 180 .map_voltage = regulator_map_voltage_linear_range, 181 + .set_suspend_enable = tps65218_pmic_set_suspend_enable, 182 + .set_suspend_disable = tps65218_pmic_set_suspend_disable, 219 183 }; 220 184 221 185 static const int ls3_currents[] = { 100, 200, 500, 1000 }; ··· 287 247 .is_enabled = regulator_is_enabled_regmap, 288 248 .enable = tps65218_pmic_enable, 289 249 .disable = tps65218_pmic_disable, 250 + .set_suspend_enable = tps65218_pmic_set_suspend_enable, 251 + .set_suspend_disable = tps65218_pmic_set_suspend_disable, 290 252 }; 291 253 292 254 static const struct regulator_desc regulators[] = { ··· 296 254 tps65218_dcdc12_ops, 64, TPS65218_REG_CONTROL_DCDC1, 297 255 TPS65218_CONTROL_DCDC1_MASK, TPS65218_REG_ENABLE1, 298 256 TPS65218_ENABLE1_DC1_EN, 0, 0, dcdc1_dcdc2_ranges, 299 - 2, 4000, 0), 257 + 2, 4000, 0, TPS65218_REG_SEQ3, 258 + TPS65218_SEQ3_DC1_SEQ_MASK), 300 259 TPS65218_REGULATOR("DCDC2", TPS65218_DCDC_2, REGULATOR_VOLTAGE, 301 260 tps65218_dcdc12_ops, 64, TPS65218_REG_CONTROL_DCDC2, 302 261 TPS65218_CONTROL_DCDC2_MASK, TPS65218_REG_ENABLE1, 303 262 TPS65218_ENABLE1_DC2_EN, 0, 0, dcdc1_dcdc2_ranges, 304 - 2, 4000, 0), 263 + 2, 4000, 0, TPS65218_REG_SEQ3, 264 + TPS65218_SEQ3_DC2_SEQ_MASK), 305 265 TPS65218_REGULATOR("DCDC3", TPS65218_DCDC_3, REGULATOR_VOLTAGE, 306 266 tps65218_ldo1_dcdc34_ops, 64, 307 267 TPS65218_REG_CONTROL_DCDC3, 308 268 TPS65218_CONTROL_DCDC3_MASK, TPS65218_REG_ENABLE1, 309 269 TPS65218_ENABLE1_DC3_EN, 0, 0, ldo1_dcdc3_ranges, 2, 310 - 0, 0), 270 + 0, 0, TPS65218_REG_SEQ4, TPS65218_SEQ4_DC3_SEQ_MASK), 311 271 TPS65218_REGULATOR("DCDC4", TPS65218_DCDC_4, REGULATOR_VOLTAGE, 312 272 tps65218_ldo1_dcdc34_ops, 53, 313 273 TPS65218_REG_CONTROL_DCDC4, 314 274 TPS65218_CONTROL_DCDC4_MASK, TPS65218_REG_ENABLE1, 315 275 TPS65218_ENABLE1_DC4_EN, 0, 0, dcdc4_ranges, 2, 316 - 0, 0), 276 + 0, 0, TPS65218_REG_SEQ4, TPS65218_SEQ4_DC4_SEQ_MASK), 317 277 TPS65218_REGULATOR("DCDC5", TPS65218_DCDC_5, REGULATOR_VOLTAGE, 318 278 tps65218_dcdc56_pmic_ops, 1, -1, -1, 319 279 TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC5_EN, 0, 0, 320 - NULL, 0, 0, 1000000), 280 + NULL, 0, 0, 1000000, TPS65218_REG_SEQ5, 281 + TPS65218_SEQ5_DC5_SEQ_MASK), 321 282 TPS65218_REGULATOR("DCDC6", TPS65218_DCDC_6, REGULATOR_VOLTAGE, 322 283 tps65218_dcdc56_pmic_ops, 1, -1, -1, 323 284 TPS65218_REG_ENABLE1, TPS65218_ENABLE1_DC6_EN, 0, 0, 324 - NULL, 0, 0, 1800000), 285 + NULL, 0, 0, 1800000, TPS65218_REG_SEQ5, 286 + TPS65218_SEQ5_DC6_SEQ_MASK), 325 287 TPS65218_REGULATOR("LDO1", TPS65218_LDO_1, REGULATOR_VOLTAGE, 326 288 tps65218_ldo1_dcdc34_ops, 64, 327 289 TPS65218_REG_CONTROL_LDO1, 328 290 TPS65218_CONTROL_LDO1_MASK, TPS65218_REG_ENABLE2, 329 291 TPS65218_ENABLE2_LDO1_EN, 0, 0, ldo1_dcdc3_ranges, 330 - 2, 0, 0), 292 + 2, 0, 0, TPS65218_REG_SEQ6, 293 + TPS65218_SEQ6_LDO1_SEQ_MASK), 331 294 TPS65218_REGULATOR("LS3", TPS65218_LS_3, REGULATOR_CURRENT, 332 295 tps65218_ls3_ops, 0, 0, 0, TPS65218_REG_ENABLE2, 333 296 TPS65218_ENABLE2_LS3_EN, TPS65218_REG_CONFIG2, 334 - TPS65218_CONFIG2_LS3ILIM_MASK, NULL, 0, 0, 0), 297 + TPS65218_CONFIG2_LS3ILIM_MASK, NULL, 0, 0, 0, 0, 0), 335 298 }; 336 299 337 300 static int tps65218_regulator_probe(struct platform_device *pdev) ··· 347 300 struct regulator_dev *rdev; 348 301 const struct of_device_id *match; 349 302 struct regulator_config config = { }; 350 - int id; 303 + int id, ret; 304 + unsigned int val; 351 305 352 306 match = of_match_device(tps65218_of_match, &pdev->dev); 353 307 if (!match) ··· 374 326 pdev->name); 375 327 return PTR_ERR(rdev); 376 328 } 329 + 330 + ret = tps65218_reg_read(tps, regulators[id].bypass_reg, &val); 331 + if (ret) 332 + return ret; 333 + 334 + tps->info[id]->strobe = val & regulators[id].bypass_mask; 377 335 378 336 return 0; 379 337 }
+1 -1
drivers/regulator/twl-regulator.c
··· 905 905 twl4030reg_map_mode) 906 906 #define TWL6030_FIXED_LDO(label, offset, mVolts, turnon_delay) \ 907 907 TWL_FIXED_LDO(label, offset, mVolts, 0x0, turnon_delay, \ 908 - 0x0, TWL6030, twl6030fixed_ops, 0x0) 908 + 0x0, TWL6030, twl6030fixed_ops, NULL) 909 909 910 910 #define TWL4030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf) \ 911 911 static const struct twlreg_info TWL4030_INFO_##label = { \
+13
include/linux/mfd/rn5t618.h
··· 20 20 #define RN5T618_OTPVER 0x01 21 21 #define RN5T618_IODAC 0x02 22 22 #define RN5T618_VINDAC 0x03 23 + #define RN5T618_OUT32KEN 0x05 23 24 #define RN5T618_CPUCNT 0x06 24 25 #define RN5T618_PSWR 0x07 25 26 #define RN5T618_PONHIS 0x09 ··· 39 38 #define RN5T618_DC1_SLOT 0x16 40 39 #define RN5T618_DC2_SLOT 0x17 41 40 #define RN5T618_DC3_SLOT 0x18 41 + #define RN5T618_DC4_SLOT 0x19 42 42 #define RN5T618_LDO1_SLOT 0x1b 43 43 #define RN5T618_LDO2_SLOT 0x1c 44 44 #define RN5T618_LDO3_SLOT 0x1d ··· 56 54 #define RN5T618_DC2CTL2 0x2f 57 55 #define RN5T618_DC3CTL 0x30 58 56 #define RN5T618_DC3CTL2 0x31 57 + #define RN5T618_DC4CTL 0x32 58 + #define RN5T618_DC4CTL2 0x33 59 59 #define RN5T618_DC1DAC 0x36 60 60 #define RN5T618_DC2DAC 0x37 61 61 #define RN5T618_DC3DAC 0x38 62 + #define RN5T618_DC4DAC 0x39 62 63 #define RN5T618_DC1DAC_SLP 0x3b 63 64 #define RN5T618_DC2DAC_SLP 0x3c 64 65 #define RN5T618_DC3DAC_SLP 0x3d 66 + #define RN5T618_DC4DAC_SLP 0x3e 65 67 #define RN5T618_DCIREN 0x40 66 68 #define RN5T618_DCIRQ 0x41 67 69 #define RN5T618_DCIRMON 0x42 ··· 217 211 RN5T618_DCDC1, 218 212 RN5T618_DCDC2, 219 213 RN5T618_DCDC3, 214 + RN5T618_DCDC4, 220 215 RN5T618_LDO1, 221 216 RN5T618_LDO2, 222 217 RN5T618_LDO3, ··· 228 221 RN5T618_REG_NUM, 229 222 }; 230 223 224 + enum { 225 + RN5T567 = 0, 226 + RN5T618, 227 + }; 228 + 231 229 struct rn5t618 { 232 230 struct regmap *regmap; 231 + long variant; 233 232 }; 234 233 235 234 #endif /* __LINUX_MFD_RN5T618_H */
+1
include/linux/mfd/tps65217.h
··· 257 257 unsigned long id; 258 258 struct regulator_desc desc[TPS65217_NUM_REGULATOR]; 259 259 struct regmap *regmap; 260 + u8 *strobes; 260 261 }; 261 262 262 263 static inline struct tps65217 *dev_to_tps65217(struct device *dev)
+2
include/linux/mfd/tps65218.h
··· 246 246 * @name: Voltage regulator name 247 247 * @min_uV: minimum micro volts 248 248 * @max_uV: minimum micro volts 249 + * @strobe: sequencing strobe value for the regulator 249 250 * 250 251 * This data is used to check the regualtor voltage limits while setting. 251 252 */ ··· 255 254 const char *name; 256 255 int min_uV; 257 256 int max_uV; 257 + int strobe; 258 258 }; 259 259 260 260 /**