Skip to content

Commit 8d67f64

Browse files
committed
Merge remote-tracking branches 'regulator/topic/settle', 'regulator/topic/tps65910' and 'regulator/topic/tps65917' into regulator-next
4 parents 9b08f76 + 3ffad46 + a9bc67d + be03530 commit 8d67f64

File tree

10 files changed

+79
-13
lines changed

10 files changed

+79
-13
lines changed

Documentation/devicetree/bindings/mfd/tps65910.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ Optional properties:
6161
There should be 9 entries here, one for each gpio.
6262
- ti,system-power-controller: Telling whether or not this pmic is controlling
6363
the system power.
64+
- ti,sleep-enable: Enable SLEEP state.
65+
- ti,sleep-keep-therm: Keep thermal monitoring on in sleep state.
66+
- ti,sleep-keep-ck32k: Keep the 32KHz clock output on in sleep state.
67+
- ti,sleep-keep-hsclk: Keep high speed internal clock on in sleep state.
6468

6569
Regulator Optional properties:
6670
- ti,regulator-ext-sleep-control: enable external sleep

Documentation/devicetree/bindings/regulator/regulator.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ Optional properties:
2424
- regulator-settling-time-us: Settling time, in microseconds, for voltage
2525
change if regulator have the constant time for any level voltage change.
2626
This is useful when regulator have exponential voltage change.
27+
- regulator-settling-time-up-us: Settling time, in microseconds, for voltage
28+
increase if the regulator needs a constant time to settle after voltage
29+
increases of any level. This is useful for regulators with exponential
30+
voltage changes.
31+
- regulator-settling-time-down-us: Settling time, in microseconds, for voltage
32+
decrease if the regulator needs a constant time to settle after voltage
33+
decreases of any level. This is useful for regulators with exponential
34+
voltage changes.
2735
- regulator-soft-start: Enable soft start so that voltage ramps slowly
2836
- regulator-state-mem sub-root node for Suspend-to-RAM mode
2937
: suspend to memory, the device goes to sleep, but all data stored in memory,

drivers/mfd/tps65910.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910,
328328
goto err_sleep_init;
329329
}
330330

331-
/* Return if there is no sleep keepon data. */
332-
if (!pmic_pdata->slp_keepon)
333-
return 0;
334-
335-
if (pmic_pdata->slp_keepon->therm_keepon) {
331+
if (pmic_pdata->slp_keepon.therm_keepon) {
336332
ret = tps65910_reg_set_bits(tps65910,
337333
TPS65910_SLEEP_KEEP_RES_ON,
338334
SLEEP_KEEP_RES_ON_THERM_KEEPON_MASK);
@@ -342,7 +338,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910,
342338
}
343339
}
344340

345-
if (pmic_pdata->slp_keepon->clkout32k_keepon) {
341+
if (pmic_pdata->slp_keepon.clkout32k_keepon) {
346342
ret = tps65910_reg_set_bits(tps65910,
347343
TPS65910_SLEEP_KEEP_RES_ON,
348344
SLEEP_KEEP_RES_ON_CLKOUT32K_KEEPON_MASK);
@@ -352,7 +348,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910,
352348
}
353349
}
354350

355-
if (pmic_pdata->slp_keepon->i2chs_keepon) {
351+
if (pmic_pdata->slp_keepon.i2chs_keepon) {
356352
ret = tps65910_reg_set_bits(tps65910,
357353
TPS65910_SLEEP_KEEP_RES_ON,
358354
SLEEP_KEEP_RES_ON_I2CHS_KEEPON_MASK);
@@ -415,6 +411,18 @@ static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client,
415411
prop = of_property_read_bool(np, "ti,en-ck32k-xtal");
416412
board_info->en_ck32k_xtal = prop;
417413

414+
prop = of_property_read_bool(np, "ti,sleep-enable");
415+
board_info->en_dev_slp = prop;
416+
417+
prop = of_property_read_bool(np, "ti,sleep-keep-therm");
418+
board_info->slp_keepon.therm_keepon = prop;
419+
420+
prop = of_property_read_bool(np, "ti,sleep-keep-ck32k");
421+
board_info->slp_keepon.clkout32k_keepon = prop;
422+
423+
prop = of_property_read_bool(np, "ti,sleep-keep-hsclk");
424+
board_info->slp_keepon.i2chs_keepon = prop;
425+
418426
board_info->irq = client->irq;
419427
board_info->irq_base = -1;
420428
board_info->pm_off = of_property_read_bool(np,

drivers/regulator/core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2767,6 +2767,12 @@ static int _regulator_set_voltage_time(struct regulator_dev *rdev,
27672767
ramp_delay = rdev->desc->ramp_delay;
27682768
else if (rdev->constraints->settling_time)
27692769
return rdev->constraints->settling_time;
2770+
else if (rdev->constraints->settling_time_up &&
2771+
(new_uV > old_uV))
2772+
return rdev->constraints->settling_time_up;
2773+
else if (rdev->constraints->settling_time_down &&
2774+
(new_uV < old_uV))
2775+
return rdev->constraints->settling_time_down;
27702776

27712777
if (ramp_delay == 0) {
27722778
rdev_dbg(rdev, "ramp_delay not set\n");

drivers/regulator/of_regulator.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,25 @@ static void of_get_regulation_constraints(struct device_node *np,
9090
if (!ret)
9191
constraints->settling_time = pval;
9292

93+
ret = of_property_read_u32(np, "regulator-settling-time-up-us", &pval);
94+
if (!ret)
95+
constraints->settling_time_up = pval;
96+
if (constraints->settling_time_up && constraints->settling_time) {
97+
pr_warn("%s: ambiguous configuration for settling time, ignoring 'regulator-settling-time-up-us'\n",
98+
np->name);
99+
constraints->settling_time_up = 0;
100+
}
101+
102+
ret = of_property_read_u32(np, "regulator-settling-time-down-us",
103+
&pval);
104+
if (!ret)
105+
constraints->settling_time_down = pval;
106+
if (constraints->settling_time_down && constraints->settling_time) {
107+
pr_warn("%s: ambiguous configuration for settling time, ignoring 'regulator-settling-time-down-us'\n",
108+
np->name);
109+
constraints->settling_time_down = 0;
110+
}
111+
93112
ret = of_property_read_u32(np, "regulator-enable-ramp-delay", &pval);
94113
if (!ret)
95114
constraints->enable_time = pval;

drivers/regulator/palmas-regulator.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,13 @@ static struct palmas_regs_info tps65917_regs_info[] = {
263263
.ctrl_addr = TPS65917_SMPS5_CTRL,
264264
.sleep_id = TPS65917_EXTERNAL_REQSTR_ID_SMPS5,
265265
},
266+
{
267+
.name = "SMPS12",
268+
.sname = "smps1-in",
269+
.vsel_addr = TPS65917_SMPS1_VOLTAGE,
270+
.ctrl_addr = TPS65917_SMPS1_CTRL,
271+
.sleep_id = TPS65917_EXTERNAL_REQSTR_ID_SMPS12,
272+
},
266273
{
267274
.name = "LDO1",
268275
.sname = "ldo1-in",
@@ -367,6 +374,7 @@ static struct palmas_sleep_requestor_info tps65917_sleep_req_info[] = {
367374
EXTERNAL_REQUESTOR_TPS65917(SMPS3, 1, 2),
368375
EXTERNAL_REQUESTOR_TPS65917(SMPS4, 1, 3),
369376
EXTERNAL_REQUESTOR_TPS65917(SMPS5, 1, 4),
377+
EXTERNAL_REQUESTOR_TPS65917(SMPS12, 1, 5),
370378
EXTERNAL_REQUESTOR_TPS65917(LDO1, 2, 0),
371379
EXTERNAL_REQUESTOR_TPS65917(LDO2, 2, 1),
372380
EXTERNAL_REQUESTOR_TPS65917(LDO3, 2, 2),
@@ -1305,7 +1313,8 @@ static int tps65917_smps_registration(struct palmas_pmic *pmic,
13051313
*/
13061314
desc = &pmic->desc[id];
13071315
desc->n_linear_ranges = 3;
1308-
if ((id == TPS65917_REG_SMPS2) && pmic->smps12)
1316+
if ((id == TPS65917_REG_SMPS2 || id == TPS65917_REG_SMPS1) &&
1317+
pmic->smps12)
13091318
continue;
13101319

13111320
/* Initialise sleep/init values from platform data */
@@ -1427,6 +1436,7 @@ static struct of_regulator_match tps65917_matches[] = {
14271436
{ .name = "smps3", },
14281437
{ .name = "smps4", },
14291438
{ .name = "smps5", },
1439+
{ .name = "smps12",},
14301440
{ .name = "ldo1", },
14311441
{ .name = "ldo2", },
14321442
{ .name = "ldo3", },
@@ -1455,7 +1465,7 @@ static struct palmas_pmic_driver_data palmas_ddata = {
14551465

14561466
static struct palmas_pmic_driver_data tps65917_ddata = {
14571467
.smps_start = TPS65917_REG_SMPS1,
1458-
.smps_end = TPS65917_REG_SMPS5,
1468+
.smps_end = TPS65917_REG_SMPS12,
14591469
.ldo_begin = TPS65917_REG_LDO1,
14601470
.ldo_end = TPS65917_REG_LDO5,
14611471
.max_reg = TPS65917_NUM_REGS,
@@ -1643,8 +1653,10 @@ static int palmas_regulators_probe(struct platform_device *pdev)
16431653
if (ret)
16441654
return ret;
16451655

1646-
if (reg & PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN)
1656+
if (reg & PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN) {
16471657
pmic->smps123 = 1;
1658+
pmic->smps12 = 1;
1659+
}
16481660

16491661
if (reg & PALMAS_SMPS_CTRL_SMPS45_SMPS457_EN)
16501662
pmic->smps457 = 1;

drivers/regulator/tps65910-regulator.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,7 @@ static int tps65910_probe(struct platform_device *pdev)
11071107

11081108
switch (tps65910_chip_id(tps65910)) {
11091109
case TPS65910:
1110+
BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65910_regs));
11101111
pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
11111112
pmic->num_regulators = ARRAY_SIZE(tps65910_regs);
11121113
pmic->ext_sleep_control = tps65910_ext_sleep_control;
@@ -1119,6 +1120,7 @@ static int tps65910_probe(struct platform_device *pdev)
11191120
DCDCCTRL_DCDCCKSYNC_MASK);
11201121
break;
11211122
case TPS65911:
1123+
BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65911_regs));
11221124
pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
11231125
pmic->num_regulators = ARRAY_SIZE(tps65911_regs);
11241126
pmic->ext_sleep_control = tps65911_ext_sleep_control;
@@ -1144,8 +1146,7 @@ static int tps65910_probe(struct platform_device *pdev)
11441146
if (!pmic->rdev)
11451147
return -ENOMEM;
11461148

1147-
for (i = 0; i < pmic->num_regulators && i < TPS65910_NUM_REGS;
1148-
i++, info++) {
1149+
for (i = 0; i < pmic->num_regulators; i++, info++) {
11491150
/* Register the regulators */
11501151
pmic->info[i] = info;
11511152

include/linux/mfd/palmas.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ enum tps65917_regulators {
250250
TPS65917_REG_SMPS3,
251251
TPS65917_REG_SMPS4,
252252
TPS65917_REG_SMPS5,
253+
TPS65917_REG_SMPS12,
253254
/* LDO regulators */
254255
TPS65917_REG_LDO1,
255256
TPS65917_REG_LDO2,
@@ -317,6 +318,7 @@ enum tps65917_external_requestor_id {
317318
TPS65917_EXTERNAL_REQSTR_ID_SMPS3,
318319
TPS65917_EXTERNAL_REQSTR_ID_SMPS4,
319320
TPS65917_EXTERNAL_REQSTR_ID_SMPS5,
321+
TPS65917_EXTERNAL_REQSTR_ID_SMPS12,
320322
TPS65917_EXTERNAL_REQSTR_ID_LDO1,
321323
TPS65917_EXTERNAL_REQSTR_ID_LDO2,
322324
TPS65917_EXTERNAL_REQSTR_ID_LDO3,

include/linux/mfd/tps65910.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ struct tps65910_board {
879879
bool en_ck32k_xtal;
880880
bool en_dev_slp;
881881
bool pm_off;
882-
struct tps65910_sleep_keepon_data *slp_keepon;
882+
struct tps65910_sleep_keepon_data slp_keepon;
883883
bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO];
884884
unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS];
885885
struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS];

include/linux/regulator/machine.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ struct regulator_state {
110110
* @ramp_delay: Time to settle down after voltage change (unit: uV/us)
111111
* @settling_time: Time to settle down after voltage change when voltage
112112
* change is non-linear (unit: microseconds).
113+
* @settling_time_up: Time to settle down after voltage increase when voltage
114+
* change is non-linear (unit: microseconds).
115+
* @settling_time_down : Time to settle down after voltage decrease when
116+
* voltage change is non-linear (unit: microseconds).
113117
* @active_discharge: Enable/disable active discharge. The enum
114118
* regulator_active_discharge values are used for
115119
* initialisation.
@@ -152,6 +156,8 @@ struct regulation_constraints {
152156

153157
unsigned int ramp_delay;
154158
unsigned int settling_time;
159+
unsigned int settling_time_up;
160+
unsigned int settling_time_down;
155161
unsigned int enable_time;
156162

157163
unsigned int active_discharge;

0 commit comments

Comments
 (0)