Skip to content

Commit

Permalink
vc4_hdmi_phy: Fix offset calculation
Browse files Browse the repository at this point in the history
The original firmware code worked with float and did
   offset = ((vco_freq / fref * 2) * (1 << 22));
   offset >>= 2;

In this code it's all integer so doing the integer divide before the shift loses lots of precision

This fixes the issue of 1080p59.94 mode having 59.64 fps

Signed-off-by: popcornmix <popcornmix@gmail.com>
  • Loading branch information
popcornmix authored and pelwell committed Apr 2, 2020
1 parent 8a8e4f3 commit e880285
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/vc4/vc4_hdmi_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ static u32 phy_get_rm_offset(unsigned long long vco_freq)

/* RM offset is stored as 9.22 format */
offset = vco_freq * 2;
do_div(offset, fref);
offset = offset << 22;
do_div(offset, fref);
offset >>= 2;

return offset;
Expand Down

0 comments on commit e880285

Please sign in to comment.