Brian Norris 062920d246
regulator: core: Sleep (not delay) in set_voltage()
These delays can be relatively large (e.g., hundreds of microseconds to
several milliseconds on RK3399 Gru systems). Per
Documentation/timers/timers-howto.rst, that should usually use a
sleeping delay. Let's use the existing regulator delay helper to handle
both large and small delays appropriately. This avoids burning a bunch
of CPU time and hurting scheduling latencies when hitting regulators a
lot (e.g., during cpufreq).

The sleep vs. delay issue choice has been made differently over time --
early versions of RK3399 Gru PWM-regulator support used usleep_range()
in pwm-regulator.c. More of this got moved into the regulator core,
in commits like:

73e705bf81ce regulator: core: Add set_voltage_time op

At the same time, the sleep turned into a delay.

It's OK to sleep in _regulator_do_set_voltage(), as we aren't in an
atomic context. (All our callers grab various mutexes already.)

I avoid using fsleep() because it uses a usleep_range() of [N to N*2],
and usleep_range() very commonly biases to the high end of the range. We
don't want to double the expected delay, especially for long delays.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/20220420141511.v2.2.If0fc61a894f537b052ca41572aff098cf8e7e673@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-21 14:18:06 +01:00
..
2022-03-31 13:08:13 -07:00
2022-03-25 13:35:34 -07:00
2022-04-02 11:03:03 -07:00
2022-03-24 19:37:53 -07:00
2022-03-23 18:03:08 -07:00
2022-03-30 16:17:54 -07:00
2022-03-31 13:57:15 -07:00
2022-03-24 18:12:09 -07:00
2022-03-30 10:54:49 -07:00
2022-04-01 10:26:09 -07:00
2022-03-28 14:32:39 -07:00
2022-03-24 12:30:37 -07:00
2022-03-24 19:37:53 -07:00
2022-03-29 08:50:14 -07:00
2022-03-23 18:03:08 -07:00
2022-03-24 16:19:43 -07:00
2022-03-23 18:23:13 -07:00
2022-03-25 13:56:18 -07:00
2022-03-31 13:57:15 -07:00
2022-03-21 18:33:57 -07:00
2022-03-30 10:04:11 -07:00
2022-04-01 16:26:57 -07:00
2022-04-02 10:54:52 -07:00
2022-04-02 10:44:18 -07:00
2022-03-21 14:46:01 -07:00
2022-03-28 12:41:28 -07:00
2022-03-30 10:50:48 -07:00
2022-04-01 09:37:18 -07:00
2022-03-27 22:18:39 +02:00
2022-03-28 14:32:39 -07:00
2022-03-24 13:13:26 -07:00
2022-03-25 13:35:34 -07:00
2022-03-24 19:37:53 -07:00
2022-03-23 18:23:13 -07:00
2022-03-18 19:00:26 +01:00
2022-03-28 14:32:39 -07:00
2022-03-31 13:57:15 -07:00
2022-03-31 13:57:15 -07:00
2022-03-28 12:41:28 -07:00
2022-03-31 13:57:15 -07:00
2022-03-31 14:14:03 -07:00