Commit e17a6ba0 authored by Matthias Fend's avatar Matthias Fend Committed by Greg Kroah-Hartman
Browse files

media: tc358746: improve calculation of the D-PHY timing registers



[ Upstream commit 78d7265e ]

When calculating D-PHY registers, using data rates that are not multiples
of 16 can lead to precision loss in division operations. This can result in
register values that produce timing violations against the MIPI standard.

An example:
cfg->hs_clk_rate = 294MHz
hf_clk = 18

If the desired value in cfg->init is 100us, which is the minimum allowed
value, then the LINEINITCNT register is calculated as 1799. But since the
actual clock is 18.375MHz instead of 18MHz, this setting results in a time
that is shorter than 100us and thus violates the standard. The correct
value for LINEINITCNT would be 1837.

Improve the precision of calculations by using Hz instead of MHz as unit.

Signed-off-by: default avatarMatthias Fend <matthias.fend@emfend.at>
Reviewed-by: default avatarMarco Felsch <m.felsch@pengutronix.de>
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ca9f3ab6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment