From patchwork Wed Apr 24 13:22:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Redfearn X-Patchwork-Id: 10914729 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA58913B5 for ; Wed, 24 Apr 2019 13:34:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B55528796 for ; Wed, 24 Apr 2019 13:34:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7BCF4287BF; Wed, 24 Apr 2019 13:34:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2686028796 for ; Wed, 24 Apr 2019 13:34:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A2D1894C9; Wed, 24 Apr 2019 13:34:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 731 seconds by postgrey-1.36 at gabe; Wed, 24 Apr 2019 13:34:45 UTC Received: from rfout1.hes.trendmicro.com (rfout1.hes.trendmicro.com [54.193.4.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id 38FB4894C9 for ; Wed, 24 Apr 2019 13:34:45 +0000 (UTC) Received: from 0.0.0.0_hes.trendmicro.com (unknown [10.64.14.197]) by rfout1.hes.trendmicro.com (Postfix) with ESMTPS id 8FC82110AFA6 for ; Wed, 24 Apr 2019 13:22:33 +0000 (UTC) Received: from 0.0.0.0_hes.trendmicro.com (unknown [10.64.10.197]) by rout2.hes.trendmicro.com (Postfix) with SMTP id 1611BEFC05B; Wed, 24 Apr 2019 13:22:33 +0000 (UTC) Received: from IND01-BO1-obe.outbound.protection.outlook.com (unknown [104.47.101.59]) by relay1.hes.trendmicro.com (TrendMicro Hosted Email Security) with ESMTPS id 4F359142C182; Wed, 24 Apr 2019 13:22:30 +0000 (UTC) Received: from MAXPR01MB3773.INDPRD01.PROD.OUTLOOK.COM (52.134.158.84) by MAXSPR01MB0004.INDPRD01.PROD.OUTLOOK.COM (52.134.155.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1835.12; Wed, 24 Apr 2019 13:22:27 +0000 Received: from MAXPR01MB3773.INDPRD01.PROD.OUTLOOK.COM ([fe80::8c8f:543a:ccd6:fe7a]) by MAXPR01MB3773.INDPRD01.PROD.OUTLOOK.COM ([fe80::8c8f:543a:ccd6:fe7a%2]) with mapi id 15.20.1835.010; Wed, 24 Apr 2019 13:22:27 +0000 From: Matt Redfearn To: Archit Taneja , Andrzej Hajda , Laurent Pinchart Subject: [PATCH] drm/bridge: adv7511: Fix low refresh rate selection Thread-Topic: [PATCH] drm/bridge: adv7511: Fix low refresh rate selection Thread-Index: AQHU+qDCf6J6wtpe9EGvx8PuTtFI+Q== Date: Wed, 24 Apr 2019 13:22:27 +0000 Message-ID: <20190424132210.26338-1-matt.redfearn@thinci.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: DB7PR03CA0049.eurprd03.prod.outlook.com (2603:10a6:5:2a::26) To MAXPR01MB3773.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:64::20) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [87.242.198.86] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d1ff5687-effa-4683-e146-08d6c8b7e554 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600141)(711020)(4605104)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:MAXSPR01MB0004; x-ms-traffictypediagnostic: MAXSPR01MB0004: x-microsoft-antispam-prvs: x-forefront-prvs: 00179089FD x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(136003)(366004)(39840400004)(346002)(396003)(376002)(189003)(199004)(68736007)(97736004)(305945005)(478600001)(1076003)(26005)(486006)(7736002)(3846002)(6116002)(66446008)(64756008)(73956011)(66476007)(71190400001)(66946007)(66556008)(6486002)(476003)(71200400001)(8936002)(14454004)(256004)(53936002)(2616005)(66066001)(6436002)(6512007)(2906002)(25786009)(50226002)(36756003)(5660300002)(52116002)(81156014)(316002)(4326008)(186003)(102836004)(99286004)(81166006)(8676002)(386003)(7416002)(6506007)(110136005)(54906003)(16453002); DIR:OUT; SFP:1102; SCL:1; SRVR:MAXSPR01MB0004; H:MAXPR01MB3773.INDPRD01.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: thinci.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 3dnwvtCbWibzfyKBY9keTPKOMLttz1rL4GlWf2Xcva15eR9Ms+792EhHWP1lSw+uf8pO30N1U33fUAKWL9xQF9Szt8tmIytAfIlg2nyfjjX94WvDOn8ZlL1WGoVUGavLMlqc4KtnzFo37c0OVtkLJlvy3jz9dZDNGaYnw4pTLaVoJme7jCk+C6pnL6gFOcWKzsqWz1obPdSw7vr4m30sWODt3xscZkmO4lVHUyZQZteWrmn8D1wJczS3vjsPAGuNHk9f1VsGzDKVzwMn/9390ndWCjh6rr+zODlYdwGsIpJkm63eiT7Dbsq/v7bsdNvI3u3sYOQBmJKvfZ5ENO3h3d/j0sZ7OlzBAdrvCEftZTc5XUCb9bYytGqvmnAptqJl2vVSh3+L+M1GPVYlh0s8lHSm/KKriApDfllRUmZ8qvE= MIME-Version: 1.0 X-OriginatorOrg: thinci.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1ff5687-effa-4683-e146-08d6c8b7e554 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Apr 2019 13:22:27.3931 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9d1c3c89-8615-4064-88a7-bb1a8537c779 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: MAXSPR01MB0004 X-TMASE-Version: StarCloud-1.3-8.2.1013-24570.007 X-TMASE-Result: 10--3.090100-4.000000 X-TMASE-MatchedRID: r2UsUYnETSJM4VjZ76ar2MnUT+eskUQPojQrbrPpzzq7qpOHKudqc8it /eCfvDyiigmxhv5wbosPXNIyBkp9I2yeGFxbrq7l/bxP0FQ1eSFQCOsAlaxN7wZbeEWcL03V7DH CQTNvCpajmrD+IUq29gG2ORx9EyapkfRhdidsajMYVPSqPTOLvZmyjlLF2zdknFK7VE/xL0n6C0 ePs7A07bxtFR53UcYCgeMEYTPpuAzdhnvxN4JXQRhcCEaDYLrAq11bpYbTmquECKpZQF7etg5I8 j7jFkWLduRdzJY/tO8FpBT5xpiQ0DaRObpDlI/TwLkctwy8ORb6oIFDlFyvNyejhF9Zk39fSgLy dMok6QM= X-TM-Deliver-Signature: A79490A106642E3427360BC6FEA601E0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thinciit.onmicrosoft.com; s=selector1-thinci-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5RkJiMyxsqMKC7iTJD9sE1Fz1vh0E5zUdKNnBSSvvUw=; b=pdhaiip9VzdhQWTF/ROSxX8hJJFOOQP5hBd5z//pdyFDsli3kfZlj8yrxDyOfJKRUrVMqsONEnrSt7cOg+neTIw10PpCiOIkwTM0MTeTv7Vb3blAEwlzhXa9HFbkfBWAjM7seh8Eyu/No4DJkk4dnZtlzfRBVAuCKZdvh0N1azk= X-Mailman-Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matthew.redfearn@thinci.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Kieran Bingham , "linux-kernel@vger.kernel.org" , Matthew Redfearn , Jia-Ju Bai , Sean Paul , "dri-devel@lists.freedesktop.org" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The driver currently sets register 0xfb (Low Refresh Rate) based on the value of mode->vrefresh. Firstly, this field is specified to be in Hz, but the magic numbers used by the code are Hz * 1000. This essentially leads to the low refresh rate always being set to 0x01, since the vrefresh value will always be less than 24000. Fix the magic numbers to be in Hz. Secondly, according to the comment in drm_modes.h, the field is not supposed to be used in a functional way anyway. Instead, use the helper function drm_mode_vrefresh(). Fixes: 9c8af882bf12 ("drm: Add adv7511 encoder driver") Signed-off-by: Matt Redfearn Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 85c2d407a52..e7ddd3e3db9 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -747,11 +747,11 @@ static void adv7511_mode_set(struct adv7511 *adv7511, vsync_polarity = 1; } - if (mode->vrefresh <= 24000) + if (drm_mode_vrefresh(mode) <= 24) low_refresh_rate = ADV7511_LOW_REFRESH_RATE_24HZ; - else if (mode->vrefresh <= 25000) + else if (drm_mode_vrefresh(mode) <= 25) low_refresh_rate = ADV7511_LOW_REFRESH_RATE_25HZ; - else if (mode->vrefresh <= 30000) + else if (drm_mode_vrefresh(mode) <= 30) low_refresh_rate = ADV7511_LOW_REFRESH_RATE_30HZ; else low_refresh_rate = ADV7511_LOW_REFRESH_RATE_NONE;