linux-IllusionX/drivers/media/i2c
Bryan O'Donoghue 708d83aa85 media: ov5675: Fix power on/off delay timings
commit 719ec29fceda2f19c833d2784b1574638320400f upstream.

The ov5675 specification says that the gap between XSHUTDN deassert and the
first I2C transaction should be a minimum of 8192 XVCLK cycles.

Right now we use a usleep_rage() that gives a sleep time of between about
430 and 860 microseconds.

On the Lenovo X13s we have observed that in about 1/20 cases the current
timing is too tight and we start transacting before the ov5675's reset
cycle completes, leading to I2C bus transaction failures.

The reset racing is sometimes triggered at initial chip probe but, more
usually on a subsequent power-off/power-on cycle e.g.

[   71.451662] ov5675 24-0010: failed to write reg 0x0103. error = -5
[   71.451686] ov5675 24-0010: failed to set plls

The current quiescence period we have is too tight. Instead of expressing
the post reset delay in terms of the current XVCLK this patch converts the
power-on and power-off delays to the maximum theoretical delay @ 6 MHz with
an additional buffer.

1.365 milliseconds on the power-on path is 1.5 milliseconds with grace.
85.3 microseconds on the power-off path is 90 microseconds with grace.

Fixes: 49d9ad719e ("media: ov5675: add device-tree support and support runtime PM")
Cc: stable@vger.kernel.org
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Tested-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
Tested-by: Quentin Schulz <quentin.schulz@cherry.de> # RK3399 Puma with
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-10 12:04:00 +02:00
..
adv748x
ccs
cx25840
et8ek8
s5c73m3
ad5820.c
adp1653.c
adv7170.c
adv7175.c
adv7180.c
adv7183.c
adv7183_regs.h
adv7343.c
adv7343_regs.h
adv7393.c
adv7393_regs.h
adv7511-v4l2.c
adv7604.c
adv7842.c
ak881x.c
ak7375.c
alvium-csi2.c
alvium-csi2.h
aptina-pll.c
aptina-pll.h
ar0521.c
bt819.c
bt856.c
bt866.c
ccs-pll.c
ccs-pll.h
cs53l32a.c
cs3308.c
cs5345.c
ds90ub913.c
ds90ub953.c
ds90ub960.c
dw9714.c
dw9719.c
dw9768.c
dw9807-vcm.c
gc05a2.c
gc08a3.c
gc0308.c
gc2145.c
hi556.c
hi846.c
hi847.c
imx208.c
imx214.c
imx219.c
imx258.c
imx274.c
imx283.c
imx290.c
imx296.c
imx319.c
imx334.c
imx335.c
imx355.c
imx412.c
imx415.c
ir-kbd-i2c.c
isl7998x.c
Kconfig
ks0127.c
ks0127.h
lm3560.c
lm3646.c
m52790.c
Makefile
max2175.c
max2175.h
max9271.c
max9271.h
max9286.c
max96714.c
max96717.c
ml86v7667.c
msp3400-driver.c
msp3400-driver.h
msp3400-kthreads.c
mt9m001.c
mt9m111.c
mt9m114.c
mt9p031.c
mt9t112.c
mt9v011.c
mt9v032.c
mt9v111.c
og01a1b.c
ov01a10.c
ov02a10.c
ov08d10.c
ov08x40.c
ov13b10.c
ov64a40.c
ov772x.c
ov2640.c
ov2659.c
ov2680.c
ov2685.c
ov2740.c
ov4689.c
ov5640.c
ov5645.c
ov5647.c
ov5648.c
ov5670.c
ov5675.c media: ov5675: Fix power on/off delay timings 2024-10-10 12:04:00 +02:00
ov5693.c
ov5695.c
ov6650.c
ov7251.c
ov7640.c
ov7670.c
ov7740.c
ov8856.c
ov8858.c
ov8865.c
ov9282.c
ov9640.c
ov9640.h
ov9650.c
ov9734.c
ov13858.c
rdacm20.c
rdacm21.c
rj54n1cb0c.c
s5k5baf.c
s5k6a3.c
saa711x_regs.h
saa717x.c
saa6588.c
saa6752hs.c
saa7110.c
saa7115.c
saa7127.c
saa7185.c
sony-btf-mpx.c
st-mipid02.c
tc358743.c
tc358743_regs.h
tc358746.c
tda1997x.c
tda1997x_regs.h
tda7432.c
tda9840.c
tea6415c.c
tea6415c.h
tea6420.c
tea6420.h
thp7312.c
ths7303.c
ths8200.c
ths8200_regs.h
tlv320aic23b.c
tvaudio.c
tvp514x.c
tvp514x_regs.h
tvp5150.c
tvp5150_reg.h
tvp7002.c
tvp7002_reg.h
tw2804.c
tw9900.c
tw9903.c
tw9906.c
tw9910.c
uda1342.c
upd64031a.c
upd64083.c
vgxy61.c
video-i2c.c
vp27smpx.c
vpx3220.c
wm8739.c
wm8775.c