From 3ffad468cf1d9825b425733941bdad0d8d20e795 Mon Sep 17 00:00:00 2001 From: Matthias Kaehlcke Date: Tue, 16 May 2017 11:43:43 -0700 Subject: regulator: Allow for asymmetric settling times Some regulators have different settling times for voltage increases and decreases. To avoid a time penalty on the faster transition allow for different settings for up- and downward transitions. Signed-off-by: Matthias Kaehlcke Acked-by: Laxman Dewangan Signed-off-by: Mark Brown --- drivers/regulator/core.c | 6 ++++++ drivers/regulator/of_regulator.c | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) (limited to 'drivers/regulator') diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index c0d9ae8d0860..919b7f178209 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2767,6 +2767,12 @@ static int _regulator_set_voltage_time(struct regulator_dev *rdev, ramp_delay = rdev->desc->ramp_delay; else if (rdev->constraints->settling_time) return rdev->constraints->settling_time; + else if (rdev->constraints->settling_time_up && + (new_uV > old_uV)) + return rdev->constraints->settling_time_up; + else if (rdev->constraints->settling_time_down && + (new_uV < old_uV)) + return rdev->constraints->settling_time_down; if (ramp_delay == 0) { rdev_dbg(rdev, "ramp_delay not set\n"); diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 09d677d5d3f0..96bf75458da5 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -90,6 +90,25 @@ static void of_get_regulation_constraints(struct device_node *np, if (!ret) constraints->settling_time = pval; + ret = of_property_read_u32(np, "regulator-settling-time-up-us", &pval); + if (!ret) + constraints->settling_time_up = pval; + if (constraints->settling_time_up && constraints->settling_time) { + pr_warn("%s: ambiguous configuration for settling time, ignoring 'regulator-settling-time-up-us'\n", + np->name); + constraints->settling_time_up = 0; + } + + ret = of_property_read_u32(np, "regulator-settling-time-down-us", + &pval); + if (!ret) + constraints->settling_time_down = pval; + if (constraints->settling_time_down && constraints->settling_time) { + pr_warn("%s: ambiguous configuration for settling time, ignoring 'regulator-settling-time-down-us'\n", + np->name); + constraints->settling_time_down = 0; + } + ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval); if (!ret) constraints->enable_time = pval; -- cgit v1.2.3 From be035303182a1260803a1871065d7b1e67c9ebe9 Mon Sep 17 00:00:00 2001 From: Keerthy Date: Tue, 23 May 2017 17:46:56 +0530 Subject: regulator: tps65917: Add support for SMPS12 App support for SMPS12 dual phase regulator. Signed-off-by: Keerthy Acked-by: Lee Jones Signed-off-by: Mark Brown --- drivers/regulator/palmas-regulator.c | 18 +++++++++++++++--- include/linux/mfd/palmas.h | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'drivers/regulator') diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index 31ae5ee3a80d..8018a44ed4f7 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c @@ -263,6 +263,13 @@ static struct palmas_regs_info tps65917_regs_info[] = { .ctrl_addr = TPS65917_SMPS5_CTRL, .sleep_id = TPS65917_EXTERNAL_REQSTR_ID_SMPS5, }, + { + .name = "SMPS12", + .sname = "smps1-in", + .vsel_addr = TPS65917_SMPS1_VOLTAGE, + .ctrl_addr = TPS65917_SMPS1_CTRL, + .sleep_id = TPS65917_EXTERNAL_REQSTR_ID_SMPS12, + }, { .name = "LDO1", .sname = "ldo1-in", @@ -367,6 +374,7 @@ static struct palmas_sleep_requestor_info tps65917_sleep_req_info[] = { EXTERNAL_REQUESTOR_TPS65917(SMPS3, 1, 2), EXTERNAL_REQUESTOR_TPS65917(SMPS4, 1, 3), EXTERNAL_REQUESTOR_TPS65917(SMPS5, 1, 4), + EXTERNAL_REQUESTOR_TPS65917(SMPS12, 1, 5), EXTERNAL_REQUESTOR_TPS65917(LDO1, 2, 0), EXTERNAL_REQUESTOR_TPS65917(LDO2, 2, 1), EXTERNAL_REQUESTOR_TPS65917(LDO3, 2, 2), @@ -1305,7 +1313,8 @@ static int tps65917_smps_registration(struct palmas_pmic *pmic, */ desc = &pmic->desc[id]; desc->n_linear_ranges = 3; - if ((id == TPS65917_REG_SMPS2) && pmic->smps12) + if ((id == TPS65917_REG_SMPS2 || id == TPS65917_REG_SMPS1) && + pmic->smps12) continue; /* Initialise sleep/init values from platform data */ @@ -1427,6 +1436,7 @@ static struct of_regulator_match tps65917_matches[] = { { .name = "smps3", }, { .name = "smps4", }, { .name = "smps5", }, + { .name = "smps12",}, { .name = "ldo1", }, { .name = "ldo2", }, { .name = "ldo3", }, @@ -1455,7 +1465,7 @@ static struct palmas_pmic_driver_data palmas_ddata = { static struct palmas_pmic_driver_data tps65917_ddata = { .smps_start = TPS65917_REG_SMPS1, - .smps_end = TPS65917_REG_SMPS5, + .smps_end = TPS65917_REG_SMPS12, .ldo_begin = TPS65917_REG_LDO1, .ldo_end = TPS65917_REG_LDO5, .max_reg = TPS65917_NUM_REGS, @@ -1643,8 +1653,10 @@ static int palmas_regulators_probe(struct platform_device *pdev) if (ret) return ret; - if (reg & PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN) + if (reg & PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN) { pmic->smps123 = 1; + pmic->smps12 = 1; + } if (reg & PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN) pmic->smps457 = 1; diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index 5c9a1d44c125..6dec43826303 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h @@ -250,6 +250,7 @@ enum tps65917_regulators { TPS65917_REG_SMPS3, TPS65917_REG_SMPS4, TPS65917_REG_SMPS5, + TPS65917_REG_SMPS12, /* LDO regulators */ TPS65917_REG_LDO1, TPS65917_REG_LDO2, @@ -317,6 +318,7 @@ enum tps65917_external_requestor_id { TPS65917_EXTERNAL_REQSTR_ID_SMPS3, TPS65917_EXTERNAL_REQSTR_ID_SMPS4, TPS65917_EXTERNAL_REQSTR_ID_SMPS5, + TPS65917_EXTERNAL_REQSTR_ID_SMPS12, TPS65917_EXTERNAL_REQSTR_ID_LDO1, TPS65917_EXTERNAL_REQSTR_ID_LDO2, TPS65917_EXTERNAL_REQSTR_ID_LDO3, -- cgit v1.2.3 From fe953904f3463609a9a671f68148d8532f2a5d9f Mon Sep 17 00:00:00 2001 From: Michał Mirosław Date: Tue, 13 Jun 2017 16:41:56 +0200 Subject: regulator: tps65910: check TPS65910_NUM_REGS at build time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Check TPS65910_NUM_REGS at build time instead of silently registering not all regulators at runtime. Signed-off-by: Michał Mirosław Signed-off-by: Mark Brown --- drivers/regulator/tps65910-regulator.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/regulator') diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index 696116ebdf50..81672a58fcc2 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c @@ -1107,6 +1107,7 @@ static int tps65910_probe(struct platform_device *pdev) switch (tps65910_chip_id(tps65910)) { case TPS65910: + BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65910_regs)); pmic->get_ctrl_reg = &tps65910_get_ctrl_register; pmic->num_regulators = ARRAY_SIZE(tps65910_regs); pmic->ext_sleep_control = tps65910_ext_sleep_control; @@ -1119,6 +1120,7 @@ static int tps65910_probe(struct platform_device *pdev) DCDCCTRL_DCDCCKSYNC_MASK); break; case TPS65911: + BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65911_regs)); pmic->get_ctrl_reg = &tps65911_get_ctrl_register; pmic->num_regulators = ARRAY_SIZE(tps65911_regs); pmic->ext_sleep_control = tps65911_ext_sleep_control; @@ -1144,8 +1146,7 @@ static int tps65910_probe(struct platform_device *pdev) if (!pmic->rdev) return -ENOMEM; - for (i = 0; i < pmic->num_regulators && i < TPS65910_NUM_REGS; - i++, info++) { + for (i = 0; i < pmic->num_regulators; i++, info++) { /* Register the regulators */ pmic->info[i] = info; -- cgit v1.2.3