Skip to content

Commit 8acfb16

Browse files
mmindbroonie
authored andcommitted
regulator: fan53555: add enable_time support and soft-start times
The datasheets for all the fan53555 variants (and clones using the same interface) define so called soft start times, from enabling the regulator until at least some percentage of the output (i.e. 92% for the rk860x types) are available. The regulator framework supports this with the enable_time property but currently the fan53555 driver does not define enable_times for any variant. I ran into a problem with this while testing the new driver for the Rockchip NPUs (rocket), which does runtime-pm including disabling and enabling a rk8602 as needed. When reenabling the regulator while running a load, fatal hangs could be observed while enabling the associated power-domain, which the regulator supplies. Experimentally setting the regulator to always-on, made the issue disappear, leading to the missing delay to let power stabilize. And as expected, setting the enable-time to a non-zero value according to the datasheet also resolved the regulator-issue. The datasheets in nearly all cases only specify "typical" values, except for the fan53555 type 08. There both a typical and maximum value are listed - 40uS apart. For all typical values I've added 100uS to be on the safe side. Individual details for the relevant regulators below: - fan53526: The datasheet for all variants lists a typical value of 150uS, so make that 250uS with safety margin. - fan53555: types 08 and 18 (unsupported) are given a typical enable time of 135uS but also a maximum of 175uS so use that value. All the other types only have a typical time in the datasheet of 300uS, so give a bit margin by setting it to 400uS. - rk8600 + rk8602: Datasheet reports a typical value of 260us, so use 360uS to be safe. - syr82x + syr83x: All datasheets report typical soft-start values of 300uS for these regulators, so use 400uS. - tcs452x: Datasheet sadly does not report a soft-start time, so I've not set an enable-time Signed-off-by: Heiko Stuebner <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent e04c78d commit 8acfb16

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

drivers/regulator/fan53555.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ struct fan53555_device_info {
147147
unsigned int slew_mask;
148148
const unsigned int *ramp_delay_table;
149149
unsigned int n_ramp_values;
150+
unsigned int enable_time;
150151
unsigned int slew_rate;
151152
};
152153

@@ -282,6 +283,7 @@ static int fan53526_voltages_setup_fairchild(struct fan53555_device_info *di)
282283
di->slew_mask = CTL_SLEW_MASK;
283284
di->ramp_delay_table = slew_rates;
284285
di->n_ramp_values = ARRAY_SIZE(slew_rates);
286+
di->enable_time = 250;
285287
di->vsel_count = FAN53526_NVOLTAGES;
286288

287289
return 0;
@@ -296,10 +298,12 @@ static int fan53555_voltages_setup_fairchild(struct fan53555_device_info *di)
296298
case FAN53555_CHIP_REV_00:
297299
di->vsel_min = 600000;
298300
di->vsel_step = 10000;
301+
di->enable_time = 400;
299302
break;
300303
case FAN53555_CHIP_REV_13:
301304
di->vsel_min = 800000;
302305
di->vsel_step = 10000;
306+
di->enable_time = 400;
303307
break;
304308
default:
305309
dev_err(di->dev,
@@ -311,13 +315,19 @@ static int fan53555_voltages_setup_fairchild(struct fan53555_device_info *di)
311315
case FAN53555_CHIP_ID_01:
312316
case FAN53555_CHIP_ID_03:
313317
case FAN53555_CHIP_ID_05:
318+
di->vsel_min = 600000;
319+
di->vsel_step = 10000;
320+
di->enable_time = 400;
321+
break;
314322
case FAN53555_CHIP_ID_08:
315323
di->vsel_min = 600000;
316324
di->vsel_step = 10000;
325+
di->enable_time = 175;
317326
break;
318327
case FAN53555_CHIP_ID_04:
319328
di->vsel_min = 603000;
320329
di->vsel_step = 12826;
330+
di->enable_time = 400;
321331
break;
322332
default:
323333
dev_err(di->dev,
@@ -350,6 +360,7 @@ static int fan53555_voltages_setup_rockchip(struct fan53555_device_info *di)
350360
di->slew_mask = CTL_SLEW_MASK;
351361
di->ramp_delay_table = slew_rates;
352362
di->n_ramp_values = ARRAY_SIZE(slew_rates);
363+
di->enable_time = 360;
353364
di->vsel_count = FAN53555_NVOLTAGES;
354365

355366
return 0;
@@ -372,6 +383,7 @@ static int rk8602_voltages_setup_rockchip(struct fan53555_device_info *di)
372383
di->slew_mask = CTL_SLEW_MASK;
373384
di->ramp_delay_table = slew_rates;
374385
di->n_ramp_values = ARRAY_SIZE(slew_rates);
386+
di->enable_time = 360;
375387
di->vsel_count = RK8602_NVOLTAGES;
376388

377389
return 0;
@@ -395,6 +407,7 @@ static int fan53555_voltages_setup_silergy(struct fan53555_device_info *di)
395407
di->slew_mask = CTL_SLEW_MASK;
396408
di->ramp_delay_table = slew_rates;
397409
di->n_ramp_values = ARRAY_SIZE(slew_rates);
410+
di->enable_time = 400;
398411
di->vsel_count = FAN53555_NVOLTAGES;
399412

400413
return 0;
@@ -594,6 +607,7 @@ static int fan53555_regulator_register(struct fan53555_device_info *di,
594607
rdesc->ramp_mask = di->slew_mask;
595608
rdesc->ramp_delay_table = di->ramp_delay_table;
596609
rdesc->n_ramp_values = di->n_ramp_values;
610+
rdesc->enable_time = di->enable_time;
597611
rdesc->owner = THIS_MODULE;
598612

599613
rdev = devm_regulator_register(di->dev, &di->desc, config);

0 commit comments

Comments
 (0)