summaryrefslogtreecommitdiffstats
path: root/kernel/capability.c
diff options
context:
space:
mode:
authorBrian Norris <briannorris@chromium.org>2022-04-20 14:22:13 -0700
committerMark Brown <broonie@kernel.org>2022-04-21 14:18:06 +0100
commit062920d2464715ef5cbba52a8573ba12cc882b8f (patch)
tree44e3a0a4871eda07eefde92069d61bda1eadb91b /kernel/capability.c
parenta38dce4cb1f1bcc4f6ef7f11e54b6507a4043ebe (diff)
downloadlinux-062920d2464715ef5cbba52a8573ba12cc882b8f.tar.gz
linux-062920d2464715ef5cbba52a8573ba12cc882b8f.tar.bz2
linux-062920d2464715ef5cbba52a8573ba12cc882b8f.zip
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>
Diffstat (limited to 'kernel/capability.c')
0 files changed, 0 insertions, 0 deletions