From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74436C48BE8 for ; Mon, 24 Jun 2019 10:01:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3FD6120848 for ; Mon, 24 Jun 2019 10:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561370471; bh=1bNHZQ1YAqLPt3Bb3GJ7D+Dtom1Ldb/0VjfMEzqmOyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=lrIhGYUGlSvlyPSipjdBfmB7R8XtmVE9vQhl5VWcDNQnhe17BLyzEeMAtwHr9wekQ megxLdcsbCuV96RASMWE51C4blB1t1QMHK4zd67PhcDN4KkIOxsAzAx/vOFJpxkcfg ZgrdQWojGiqDTZCWpZOqFOVFfGYcgC2oUpBCh9Ig= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728350AbfFXJ6t (ORCPT ); Mon, 24 Jun 2019 05:58:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:57518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727953AbfFXJ6q (ORCPT ); Mon, 24 Jun 2019 05:58:46 -0400 Received: from localhost (f4.8f.5177.ip4.static.sl-reverse.com [119.81.143.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 43692205ED; Mon, 24 Jun 2019 09:58:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561370325; bh=1bNHZQ1YAqLPt3Bb3GJ7D+Dtom1Ldb/0VjfMEzqmOyk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tkT9GZ6cqP/5LP8HzqWbeNc0mcqpc/TSQeh/+LyB4iseLWQkvPvHIEcFmyQz43brr mrQsoQLtrQAru+HpsU/LcB7fjj4axksmGXkc/FN3a3gPnW1Q7LzuY+CtoVB5kC/khM CgKxnrSyda91gMwTbnmix8NUEq1rx+W0JwOOL9Qs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Murphy , Liviu Dudau , Sasha Levin Subject: [PATCH 4.14 30/51] drm/arm/hdlcd: Allow a bit of clock tolerance Date: Mon, 24 Jun 2019 17:56:48 +0800 Message-Id: <20190624092309.833444832@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190624092305.919204959@linuxfoundation.org> References: <20190624092305.919204959@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ 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 Signed-off-by: Liviu Dudau Signed-off-by: Sasha Levin --- drivers/gpu/drm/arm/hdlcd_crtc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arm/hdlcd_crtc.c b/drivers/gpu/drm/arm/hdlcd_crtc.c index 4a108660cc8f..6f03700a94be 100644 --- a/drivers/gpu/drm/arm/hdlcd_crtc.c +++ b/drivers/gpu/drm/arm/hdlcd_crtc.c @@ -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; } -- 2.20.1