phy: freescale: fsl-samsung-hdmi: Use closest divider
authorAdam Ford <aford173@gmail.com>
Sat, 14 Sep 2024 11:27:48 +0000 (06:27 -0500)
committerVinod Koul <vkoul@kernel.org>
Thu, 17 Oct 2024 13:13:36 +0000 (18:43 +0530)
commit058ea4a06704c6ad3032bdb3ead9ed3dc1f7fe6e
treedd2d0b5a3b39f8bebf888d4902a262104789fa08
parent1951dbb41d1dff7c135eed4fa1a6330df6971549
phy: freescale: fsl-samsung-hdmi: Use closest divider

Currently, if the clock values cannot be set to the exact rate,
the round_rate and set_rate functions use the closest value found in
the look-up-table.  In preparation of removing values from the LUT
that can be calculated evenly with the integer calculator, it's
necessary to ensure to check both the look-up-table and the integer
divider clock values to get the closest values to the requested
value.  It does this by measuring the difference between the
requested clock value and the closest value in both integer divider
calucator and the fractional clock look-up-table.

Which ever has the smallest difference between them is returned as
the closest rate.

Signed-off-by: Adam Ford <aford173@gmail.com>
Reviewed-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Tested-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Link: https://lore.kernel.org/r/20240914112816.520224-5-aford173@gmail.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/freescale/phy-fsl-samsung-hdmi.c