Skip to content

Commit 471486b

Browse files
jrtc27bsdjhb
authored andcommitted
tda19988: Fix divisor calculation
The existing calculation was linear with a fixup to make it non-linear (and, correctly, cap it at 3). However, the actual value is logarithmic and this ended up generating bad values in the following ranges: * [20000, 37125] - gave a divisor of 3 not 2 * [40000, 49500] - gave a divisor of 2 not 1 * [74251, 79999] - gave a divisor of 0 not 1
1 parent 891d1fb commit 471486b

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

sys/dev/drm/bridges/tda19988/tda19988.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -778,12 +778,7 @@ tda19988_bridge_mode_set(struct drm_bridge *bridge,
778778
vs2_line_end = vs2_line_start + (mode->vsync_end - mode->vsync_start)/2;
779779
}
780780

781-
div = 148500 / mode->crtc_clock;
782-
if (div != 0) {
783-
div--;
784-
if (div > 3)
785-
div = 3;
786-
}
781+
div = imin(imax(fls(160000 / (mode->crtc_clock + 1)) - 1, 0), 3);
787782

788783
/* set HDMI HDCP mode off */
789784
tda19988_reg_set(sc, TDA_TBG_CNTRL_1, TBG_CNTRL_1_DWIN_DIS);

0 commit comments

Comments
 (0)