linux-stable/drivers
Douglas Anderson 691c1fcda5
regulator: core: Shorten off-on-delay-us for always-on/boot-on by time since booted
This is very close to a straight revert of commit 218320fec2
("regulator: core: Fix off-on-delay-us for always-on/boot-on
regulators"). We've identified that patch as causing a boot speed
regression on sc7180-trogdor boards. While boot speed certainly isn't
more important than making sure that power sequencing is correct,
looking closely at the original change it doesn't seem to have been
fully justified. It mentions "cycling issues" without describing
exactly what the issues were. That means it's possible that the
cycling issues were really a problem that should be fixed in a
different way.

Let's take a careful look at how we should handle regulators that have
an off-on-delay and that are boot-on or always-on. Linux currently
doesn't have any way to identify whether a GPIO regulator was already
on when the kernel booted. That means that when the kernel boots we
probe a regulator, see that it wants boot-on / always-on we, and then
turn the regulator on. We could be in one of two cases when we do
this:

a) The regulator might have been left on by the bootloader and we're
   ensuring that it stays on.
b) The regulator might have been left off by the bootloader and we're
   just now turning it on.

For case a) we definitely don't need any sort of delay. For case b) we
_might_ need some delay in case the bootloader turned the regulator
off _right_ before booting the kernel. To get the proper delay for
case b) then we can just assume a `last_off` of 0, which is what it
gets initialized to by default.

As per above, we can't tell whether we're in case a) or case b) so
we'll assume the longer delay (case b). This basically puts the code
to how it was before commit 218320fec2 ("regulator: core: Fix
off-on-delay-us for always-on/boot-on regulators"). However, we add
one important change: we make sure that the delay is actually honored
if `last_off` is 0. Though the original "cycling issues" cited were
vague, I'm hopeful that this important extra change will be enough to
fix the issues that the initial commit mentioned.

With this fix, I've confined that on a sc7180-trogdor board the delay
at boot goes down from 500 ms to ~250 ms. That's not as good as the 0
ms that we had prior to commit 218320fec2 ("regulator: core: Fix
off-on-delay-us for always-on/boot-on regulators"), but it's probably
safer because we don't know if the bootloader turned the regulator off
right before booting.

One note is that it's possible that we could be in a state that's not
a) or b) if there are other issues in the kernel. The only one I can
think of is related to pinctrl. If the pinctrl driver being used on a
board isn't careful about avoiding glitches when setting up a pin then
it's possible that setting up a pin could cause the regulator to "turn
off" briefly immediately before the regulator probes. If this is
indeed causing problems then the pinctrl driver should be fixed,
perhaps in a similar way to what was done in commit d21f4b7ffc
("pinctrl: qcom: Avoid glitching lines when we first mux to output")

Fixes: 218320fec2 ("regulator: core: Fix off-on-delay-us for always-on/boot-on regulators")
Cc: Christian Kohlschütter <christian@kohlschutter.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20230313111806.1.I2eaad872be0932a805c239a7c7a102233fb0b03b@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-14 13:30:50 +00:00
..
accel
accessibility
acpi
amba
android
ata
atm
auxdisplay
base
bcma
block
bluetooth
bus
cdrom
char tpm: disable hwrng for fTPM on some AMD designs 2023-03-12 23:28:10 +02:00
clk
clocksource
comedi
connector
counter
cpufreq
cpuidle
crypto This push fixes a regression in the caam driver. 2023-03-05 11:32:30 -08:00
cxl
dax
dca
devfreq
dio
dma
dma-buf
edac
eisa
extcon
firewire
firmware
fpga
fsi
gnss
gpio
gpu Merge tag 'amd-drm-fixes-6.3-2023-03-09' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes 2023-03-10 14:17:35 +10:00
greybus
hid for-linus-2023030901 2023-03-09 10:17:23 -08:00
hsi
hte
hv
hwmon
hwspinlock
hwtracing
i2c i2c: dev: Fix bus callback return values 2023-03-09 22:07:52 +01:00
i3c
idle
iio
infiniband
input
interconnect
iommu
ipack
irqchip
isdn
leds
macintosh
mailbox
mcb
md
media media: i2c: ov2685: convert to i2c's .probe_new() 2023-03-09 21:59:04 +01:00
memory
memstick
message
mfd
misc misc: ad525x_dpot-i2c: Convert to i2c's .probe_new() 2023-03-09 21:58:45 +01:00
mmc
most
mtd * regression fix for the notifier handling of the I2C core 2023-03-11 09:24:05 -08:00
mux
net Networking fixes for 6.3-rc2, including fixes from netfilter, bpf 2023-03-09 10:56:58 -08:00
nfc
ntb
nubus
nvdimm
nvme
nvmem
of
opp
parisc
parport
pci
pcmcia
peci
perf
phy
pinctrl
platform platform: mellanox: mlx-platform: Initialize shift variable to 0 2023-03-07 12:08:30 +01:00
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator regulator: core: Shorten off-on-delay-us for always-on/boot-on by time since booted 2023-03-14 13:30:50 +00:00
remoteproc
reset
rpmsg
rtc
s390
sbus
scsi SCSI fixes on 20230310 2023-03-10 20:45:53 -08:00
sh
siox
slimbus
soc
soundwire
spi
spmi
ssb
staging staging: r8188eu: delete driver 2023-03-09 10:06:28 +01:00
target scsi: target: iscsi: Fix an error message in iscsi_check_key() 2023-03-06 16:50:42 -05:00
tc
tee
thermal
thunderbolt
tty serial: sc16is7xx: Convert to i2c's .probe_new() 2023-03-09 21:58:53 +01:00
ufs scsi: ufs: mcq: qcom: Clean the return path of ufs_qcom_mcq_config_resource() 2023-03-06 18:33:12 -05:00
uio
usb
vdpa
vfio
vhost
video
virt
virtio
vlynq
w1 w1: ds2482: Convert to i2c's .probe_new() 2023-03-09 21:58:57 +01:00
watchdog
xen
zorro
Kconfig
Makefile