]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/arm/hdlcd: Allow a bit of clock tolerance
authorRobin Murphy <robin.murphy@arm.com>
Fri, 17 May 2019 16:37:22 +0000 (17:37 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Jun 2019 03:36:53 +0000 (11:36 +0800)
[ Upstream commit 1c810739097fdeb31b393b67a0a1e3d7ffdd9f63 ]

On the Arm Juno platform, the HDLCD pixel clock is constrained to 250KHz
resolution in order to avoid the tiny System Control Processor spending
aeons trying to calculate exact PLL coefficients. This means that modes
like my oddball 1600x1200 with 130.89MHz clock get rejected since the
rate cannot be matched exactly. In practice, though, this mode works
quite happily with the clock at 131MHz, so let's relax the check to
allow a little bit of slop.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/arm/hdlcd_crtc.c

index 4a108660cc8f2b9c5e0aea0292fe22e8dfa6bd94..6f03700a94be71e27514d112ab884a6af8884c3a 100644 (file)
@@ -193,7 +193,8 @@ static enum drm_mode_status hdlcd_crtc_mode_valid(struct drm_crtc *crtc,
        long rate, clk_rate = mode->clock * 1000;
 
        rate = clk_round_rate(hdlcd->clk, clk_rate);
-       if (rate != clk_rate) {
+       /* 0.1% seems a close enough tolerance for the TDA19988 on Juno */
+       if (abs(rate - clk_rate) * 1000 > clk_rate) {
                /* clock required by mode not supported by hardware */
                return MODE_NOCLOCK;
        }