From patchwork Tue Feb 21 02:41:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yao mark X-Patchwork-Id: 9583811 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 40723600C1 for ; Tue, 21 Feb 2017 02:43:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F4EB28918 for ; Tue, 21 Feb 2017 02:43:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 138D32891C; Tue, 21 Feb 2017 02:43:30 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BBD6828918 for ; Tue, 21 Feb 2017 02:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=vTt36Uh9TyMD22HEyfryB8yEmLJ5lRuM4VZVSngGbZg=; b=FzJsIUoA8sze5wSw3iXacll+0J v8uVBCTNHe3AZB6teJtpzeee+0tbKEBLkG7v6kKhdQL2+l1gjFg4RrHfGgk0r11KqdolULlINA/7q IsQsapQ7BZU4pH1UUMMKJoST7I9wJynANJg3WFNIJ5evTDrwBWIyULKiPA7EJO+yx0kjsKlNxxMkH a+7mZHTF48Ail4ODEyq/M+VdSfrrjV23eIKiDl2DeI1oPKwMpt7Rm3Wz5YAcKYedXLfyv4zV00YlM LxF1YnFUoAnpcOOl9R3zAQ31WbsA3O4mdJ323gBtePGmL+g6UzwPLKTe2IggDFuyNYHRi7xurhoSc 69yeD5FA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cg0QK-0002W8-1x; Tue, 21 Feb 2017 02:43:28 +0000 Received: from regular1.263xmail.com ([211.150.99.139]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cg0PD-0001xl-M1; Tue, 21 Feb 2017 02:42:22 +0000 Received: from mark.yao?rock-chips.com (unknown [192.168.167.97]) by regular1.263xmail.com (Postfix) with ESMTP id 25CBA5539; Tue, 21 Feb 2017 10:41:48 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 29E753E7; Tue, 21 Feb 2017 10:41:46 +0800 (CST) X-RL-SENDER: mark.yao@rock-chips.com X-FST-TO: airlied@linux.ie X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: mark.yao@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: yzq@rock-chips.com X-DNS-TYPE: 0 Received: from unknown (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith SMTP id 27577OROB3V; Tue, 21 Feb 2017 10:41:47 +0800 (CST) From: Mark Yao To: David Airlie , Heiko Stuebner , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] drm/rockchip: vop: verify pixelclock for hdmi and displayport Date: Tue, 21 Feb 2017 10:41:25 +0800 Message-Id: <1487644885-22492-2-git-send-email-mark.yao@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1487644885-22492-1-git-send-email-mark.yao@rock-chips.com> References: <1487644885-22492-1-git-send-email-mark.yao@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170220_184220_058288_BE34FEF5 X-CRM114-Status: UNSURE ( 9.53 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Yao MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hdmi or DisplayPort request a accurate clock, reject the display mode if clock is not good. Signed-off-by: Mark Yao --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 7ec5d7f..a7c118e 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -868,14 +868,24 @@ static bool vop_crtc_mode_fixup(struct drm_crtc *crtc, { struct vop *vop = to_vop(crtc); const struct vop_data *vop_data = vop->data; + struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc->state); + int clock; if (mode->hdisplay > vop_data->max_output.width) return false; if (mode->vdisplay > vop_data->max_output.height) return false; - adjusted_mode->clock = - clk_round_rate(vop->dclk, mode->clock * 1000) / 1000; + clock = clk_round_rate(vop->dclk, mode->clock * 1000) / 1000; + /* + * Hdmi or DisplayPort request a Accurate clock. + */ + if (s->output_type == DRM_MODE_CONNECTOR_HDMIA || + s->output_type == DRM_MODE_CONNECTOR_DisplayPort) + if (clock != mode->clock) + return false; + + adjusted_mode->clock = clock; return true; }