From patchwork Tue Sep 8 15:25:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 309978 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=-12.8 required=3.0 tests=BAYES_00,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 C6248C433E2 for ; Tue, 8 Sep 2020 18:37:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 91B3F2080C for ; Tue, 8 Sep 2020 18:37:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599590259; bh=XWk1HoF0lhbxsTbo9IgLLT/T2qnTbrihCczZJYn8KKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sn8oo3gzHv1oAbI/EFD9f5LzntrBvSZEi/j7AJcdSIlJGxZIKj71NID0pA8iVntqz 3iWANmpxqaNuawq8wbz1SkFzaylPH/9UnUbNKdXXfkhVwmyCkgMj81cAyE3jFw3IIZ qve1kFWKgTAMNb5nR49ufh+wCJ7yyrv7hTE6QqAU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731416AbgIHSgq (ORCPT ); Tue, 8 Sep 2020 14:36:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:53538 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731346AbgIHQJE (ORCPT ); Tue, 8 Sep 2020 12:09:04 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 EE9BE2415F; Tue, 8 Sep 2020 15:49:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599580155; bh=XWk1HoF0lhbxsTbo9IgLLT/T2qnTbrihCczZJYn8KKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WXauMrpdl8TH6MQDdTZ+2qRh1JT2L0Iv1VQoNd0Y7h68Pm5sIV/UfuAVjRUVLwyAp R+CemYSxFZbmJtEz2rTvP012pJbMHsPloeQOofV/QOlHjqA/JEvzte5VS9iBfAXff4 zwg8hYzyi3X3eyAMH3edS0fBsYKzrH2WZTP71LgI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?utf-8?q?Christian_K=C3=B6nig?= , Kai-Heng Feng , Alex Deucher , Sasha Levin Subject: [PATCH 4.19 44/88] drm/radeon: Prefer lower feedback dividers Date: Tue, 8 Sep 2020 17:25:45 +0200 Message-Id: <20200908152223.324574445@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908152221.082184905@linuxfoundation.org> References: <20200908152221.082184905@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kai-Heng Feng [ Upstream commit fc8c70526bd30733ea8667adb8b8ffebea30a8ed ] Commit 2e26ccb119bd ("drm/radeon: prefer lower reference dividers") fixed screen flicker for HP Compaq nx9420 but breaks other laptops like Asus X50SL. Turns out we also need to favor lower feedback dividers. Users confirmed this change fixes the regression and doesn't regress the original fix. Fixes: 2e26ccb119bd ("drm/radeon: prefer lower reference dividers") BugLink: https://bugs.launchpad.net/bugs/1791312 BugLink: https://bugs.launchpad.net/bugs/1861554 Reviewed-by: Christian König Signed-off-by: Kai-Heng Feng Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/radeon/radeon_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 3f0f3a578ddf0..c28d76d898fdb 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c @@ -926,7 +926,7 @@ static void avivo_get_fb_ref_div(unsigned nom, unsigned den, unsigned post_div, /* get matching reference and feedback divider */ *ref_div = min(max(den/post_div, 1u), ref_div_max); - *fb_div = DIV_ROUND_CLOSEST(nom * *ref_div * post_div, den); + *fb_div = max(nom * *ref_div * post_div / den, 1u); /* limit fb divider to its maximum */ if (*fb_div > fb_div_max) {