Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp373303pxj; Fri, 7 May 2021 10:26:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkr19vOeval8m101eXu/T75UjysNVEPR0mthn7Z4ICKdRN/m88oue96CxJ+1gxgV+xTsaf X-Received: by 2002:a63:5143:: with SMTP id r3mr10886851pgl.346.1620408384942; Fri, 07 May 2021 10:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620408384; cv=none; d=google.com; s=arc-20160816; b=sE3vT8mXgOcRCDXnGLOYVQ4Ypad6vUhznywewndvBTlqvr9+LOJiNqpdL0xnhldZ1r XAMiw0nJpndajjx4OTslTvDGlcdAKhcRbxszaQUuorU3aHqh5tJRJgMPJagGJG4IoHk1 jlgHQHAw9W0sFJT/LLx1M0xcJYa6QIMD3TRzl70cTj28/yzSBNBOHVerAUFLbQPZAWLf +UyhKEQ71Rkjmip+xdPQ34EJ8+vWzy/4dKyBEquOWBS9vHT+3RspoNTThpIYyYfrnX9P oNYEJnRKU7MFrB0K+VpBKNUYdk7auEGTDa5Vh/ZaXLIDxyQsluYTzl4WFJ0ZQwryvGzX 4YCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=96379yQnsIehT01GQXKJhvZ6Q4y1tsFGCN7qprHXy5o=; b=dAAvrDnx9a+6WVFxqwwPapHP1C4RpSmrKUllBb5Xl3K/FeFjRCqvjp1CNd1nN0smWW Euxu8o1HHhHYVeJngD2HRhnaOr2u9jlRlKNAF9EY5oWtenR1BVmZ5K8cn/JK3rqfTJph Qo06/J/D2U2lrWsgZgO2rXWsGmJuMwX+VEGboma7Fj/f4ECC4Hry/Xtg28h/ue6/nwMi 4VLIhIlfW9MugsfVN25DirM1zZlt6gxwV2cs2w5935DLhngxqkZURdqGYZDAAUR1Q/FK 9CB3fpOGgKLVsPwRynxYpPMVEulyKNSSUmunIt3+bOd9wNd+J7CkeBUmBnWZ8hl7jq2Z LH5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=aKRNwiYw; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=HnLmjPIQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si7627981pgt.26.2021.05.07.10.26.10; Fri, 07 May 2021 10:26:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=aKRNwiYw; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=HnLmjPIQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237839AbhEGPHY (ORCPT + 99 others); Fri, 7 May 2021 11:07:24 -0400 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]:57033 "EHLO wnew4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237821AbhEGPHE (ORCPT ); Fri, 7 May 2021 11:07:04 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.west.internal (Postfix) with ESMTP id 5C8EE45D; Fri, 7 May 2021 11:06:03 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Fri, 07 May 2021 11:06:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=96379yQnsIehT 01GQXKJhvZ6Q4y1tsFGCN7qprHXy5o=; b=aKRNwiYwytTmg6us6c2YqmK3DbMMQ imt97QJ73i/Y5fhJqkaasTjdM6+kJPucgk3ZkXKpnUv0I8YnEgT1u8hD+B1dF4Eq zp+mAACX8y+ZQQ7qzdf7ELaglz1KqmF9q7YWCGO03pzo/PGNK9rBOmWpggSt0wtb GcqEOddyLVNxJNsGquZMR3yZyDdTawy+CUh1I9LO/J6Erblic009KPKakuh1oVNq Fr4UQ1x502uEuijl1M9njQK9MXbdUSRB3aHfhpRGRP1rCD2ZgNitVkmVlJ0U6wAl xKUlK6KDAKT7TnEOu0N08q8xlSXcA9qXeDCnBHkneGwzojZwTw4Z5BWaQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=96379yQnsIehT01GQXKJhvZ6Q4y1tsFGCN7qprHXy5o=; b=HnLmjPIQ xQPS8chMTxbW3gKCQNKi51h7rUeEA/m/sali+GLSIqqEKbLD8K99nVpx+lAuTdnQ zM68unSZWGPYaqHfZICaM838iwtFCNST4eWIRMrfH2voBb4UQqukaHkYGLONiwRz +ep2K1jV59oaoXTRuspvKIhVCWa36AxQPwNhPAbSn4vWmvuQTgqraZ7kprR2fW9h RzZM1eniyYXhUgCH759yjCWz5hAwYi+xxg4nksrhAbzeEv3IWGNh8+C2zo5OWK9B sY0x16M1Ei+cNH3cFepOyW7XsHZf11/TjH6HWKHztGcLwzwUNzkZTiPQTNOvLPXr nGveZsPvHjOHxQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdegvddgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 May 2021 11:06:01 -0400 (EDT) From: Maxime Ripard To: Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie Cc: Eric Anholt , Nicolas Saenz Julienne , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Dave Stevenson , Phil Elwell , Tim Gover , Dom Cobley , linux-kernel@vger.kernel.org Subject: [PATCH v4 08/12] drm/vc4: hdmi: Properly compute the BVB clock rate Date: Fri, 7 May 2021 17:05:11 +0200 Message-Id: <20210507150515.257424-9-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210507150515.257424-1-maxime@cerno.tech> References: <20210507150515.257424-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The BVB clock rate computation doesn't take into account a mode clock of 594MHz that we're going to need to support 4k60. Acked-by: Thomas Zimmermann Reviewed-by: Dave Stevenson Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 9c919472ae84..c50dc5a59b2f 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -91,7 +91,6 @@ # define VC4_HD_M_ENABLE BIT(0) #define CEC_CLOCK_FREQ 40000 -#define VC4_HSM_MID_CLOCK 149985000 #define HDMI_14_MAX_TMDS_CLK (340 * 1000 * 1000) @@ -739,7 +738,7 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder, conn_state_to_vc4_hdmi_conn_state(conn_state); struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder); - unsigned long pixel_rate, hsm_rate; + unsigned long bvb_rate, pixel_rate, hsm_rate; int ret; ret = pm_runtime_get_sync(&vc4_hdmi->pdev->dev); @@ -793,12 +792,14 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder, vc4_hdmi_cec_update_clk_div(vc4_hdmi); - /* - * FIXME: When the pixel freq is 594MHz (4k60), this needs to be setup - * at 300MHz. - */ - ret = clk_set_min_rate(vc4_hdmi->pixel_bvb_clock, - (hsm_rate > VC4_HSM_MID_CLOCK ? 150000000 : 75000000)); + if (pixel_rate > 297000000) + bvb_rate = 300000000; + else if (pixel_rate > 148500000) + bvb_rate = 150000000; + else + bvb_rate = 75000000; + + ret = clk_set_min_rate(vc4_hdmi->pixel_bvb_clock, bvb_rate); if (ret) { DRM_ERROR("Failed to set pixel bvb clock rate: %d\n", ret); clk_disable_unprepare(vc4_hdmi->hsm_clock); -- 2.31.1