Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp354610pxk; Thu, 3 Sep 2020 01:09:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0K1EmMIulzDzwoGlAikCbfpyRlPtDILJ39f1PHRvMTgngMf6C+BHB2V812Ne8/YwAoN6W X-Received: by 2002:a17:907:72cc:: with SMTP id du12mr901949ejc.150.1599120543791; Thu, 03 Sep 2020 01:09:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599120543; cv=none; d=google.com; s=arc-20160816; b=FXfKad4FRkVppE0q4+fttTTYJEYPFjJhDl8xFf3GSyIy/eFljrhPVgArlcLIivIyxS pOPNMfeLpeMJ/lgUGyu49GptmrTob3hPz8iR8iYCdxKNRB0dzKzcWZfo6HBCNwJ7UXaj 3UPVlv4BqmLTaRMkvgXQ0a9l6wjrz7gowNX95p65vvuKyf0Ulilt3fOm7z/dbkb3r3Pf UAsC/PrEuGfgyW6cd7v6B+MC5lXiYeNwSLOZG+jewj6tSK9CrpjjN5guLUeroZJMkU3d LUGXc8iwnMdNG+yfjKrKEKVWBRNu5BU500kzKCbc/vue1ROSikPVmaa+hGH5X6zDj2KU BXhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=W3jTdUJQ/fQ9U6n9j8TV+b0Zs3VBSL0+lMyVJA7yrdw=; b=jSq5C2ASFR8G7Pz0UJI3x5o2DM80yNiiG4k9rntn42/lPOpxSq2joSkyzp58bNg+A3 7g+/PhHumFlWdrXvstiJ4zN+sxK63IlvZVJYe5TLLSO9cNZFW4XZyWW/6dmXeuUHUM7S ChFNba5yvZN1qrv/NL0HJgisg7jMdAtN6XU5/KdBODRJkAL6dlhbu92qyizeUUdQLI7s M5DkJ0CWiZYq6CT/1sdJHMz2woM4w4ujLvQfnvrt7iszhe/YWJHLqqJTrFf69OYS/1CG ZTGpyo7H67kzF9VL5+dcusUZVv0RCv2n4dyes70JpaCOwJEaafI/tcXZAiMoM8SGYmOX XPWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=Qyopi9dT; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Q+CCcgPf; 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 z14si1436191ejj.185.2020.09.03.01.08.40; Thu, 03 Sep 2020 01:09:03 -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=fm3 header.b=Qyopi9dT; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Q+CCcgPf; 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 S1728754AbgICIGy (ORCPT + 99 others); Thu, 3 Sep 2020 04:06:54 -0400 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]:59971 "EHLO wnew4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728517AbgICIDl (ORCPT ); Thu, 3 Sep 2020 04:03:41 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id C0E90968; Thu, 3 Sep 2020 04:03:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 03 Sep 2020 04:03:40 -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=fm3; bh=W3jTdUJQ/fQ9U 6n9j8TV+b0Zs3VBSL0+lMyVJA7yrdw=; b=Qyopi9dTJPKjOBJeNKRFzQk5mlATa I019YnX3FrmSS9RF1PfJdnASIPaYd2yJ497GFTd4lzhOrguD1v4+0bs+ze+9wuNi ug1S1pKWV1Zi894bjlo3CcKQ+CE+aDcaxnKcB5hx8cwbNqkvwW938hIcb6hvFVzm j6HwxRNXzLv9vCT4qOiO5vw+2CrMxbuhgs3S5Sc/Im4U0VWvRB49B0hDZzN+b0XP oZJU4KO+//mDMIyQ6mV5ppAR2Xe+EKRqWoR/NwgwMfkdQ798uvejwcvU1EnWSTLn cdE20aBlikrtsHHL7031vOvSt0eer8SazoQZZrNZlTL+P6mAYzV+EKGJQ== 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= fm3; bh=W3jTdUJQ/fQ9U6n9j8TV+b0Zs3VBSL0+lMyVJA7yrdw=; b=Q+CCcgPf i8Q7/S3T0E3pgcnuhrPjseRnNaZbAk+CvEzHjXlESwY6LYrDfKWyuaRtDpeFHAjh xShShFWXJSqF4otmabdredpK++v8QeCEfHq0eItDsgOLqlHS5FT6pefS9DDdwec/ 8uvI71GIoxY5ddY/XTfoWfysygkxwkl2z3JnyjatWDWhFrQ1WgPA5hWdG3IsFrQA 3T1F3NGH52AquAs9qNMiww8A+AbWtU3ihhK5e88hoFsXarIQZJZdBBbNPZ+fwVnj CZ05SZ68Ut2Syo+bqA2sAde7QxJhr8euXlBQoonm0Xn8IwXZx+yX4k4taCVeUQD8 3V5SZi9vN2No8w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrudegtddguddviecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpeejteeuleduieekgfehtefhfefgkedtgfehfeelteehffduvdelgeffkedv hfdvffenucffohhmrghinhepkhgvrhhnvghlrdhorhhgnecukfhppeeltddrkeelrdeike drjeeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep mhgrgihimhgvsegtvghrnhhordhtvggthh 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 id 104153060061; Thu, 3 Sep 2020 04:03:38 -0400 (EDT) From: Maxime Ripard To: Nicolas Saenz Julienne , Eric Anholt Cc: dri-devel@lists.freedesktop.org, linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave Stevenson , Tim Gover , Phil Elwell , Maxime Ripard , Hoegeun Kwon Subject: [PATCH v5 75/80] drm/vc4: hdmi: Add pixel BVB clock control Date: Thu, 3 Sep 2020 10:01:47 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hoegeun Kwon The BCM2711 has another clock that needs to be ramped up depending on the pixel rate: the pixel BVB clock. Add the code to adjust that clock when changing the mode. Signed-off-by: Hoegeun Kwon [Maxime: Changed the commit log, used clk_set_min_rate] Signed-off-by: Maxime Ripard Link: https://lore.kernel.org/r/20200901040759.29992-3-hoegeun.kwon@samsung.com --- drivers/gpu/drm/vc4/vc4_hdmi.c | 23 +++++++++++++++++++++++ drivers/gpu/drm/vc4/vc4_hdmi.h | 1 + 2 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index ab7abb409de2..39508107dafd 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -54,6 +54,7 @@ #include "vc4_regs.h" #define CEC_CLOCK_FREQ 40000 +#define VC4_HSM_MID_CLOCK 149985000 static int vc4_hdmi_debugfs_regs(struct seq_file *m, void *unused) { @@ -344,6 +345,7 @@ static void vc4_hdmi_encoder_post_crtc_powerdown(struct drm_encoder *encoder) HDMI_WRITE(HDMI_VID_CTL, HDMI_READ(HDMI_VID_CTL) & ~VC4_HD_VID_CTL_ENABLE); + clk_disable_unprepare(vc4_hdmi->pixel_bvb_clock); clk_disable_unprepare(vc4_hdmi->hsm_clock); clk_disable_unprepare(vc4_hdmi->pixel_clock); @@ -516,6 +518,27 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder) return; } + /* + * FIXME: When the pixel freq is 594MHz (4k60), this needs to be setup + * at 150MHz. + */ + ret = clk_set_min_rate(vc4_hdmi->pixel_bvb_clock, + (hsm_rate > VC4_HSM_MID_CLOCK ? 150000000 : 75000000)); + if (ret) { + DRM_ERROR("Failed to set pixel bvb clock rate: %d\n", ret); + clk_disable_unprepare(vc4_hdmi->hsm_clock); + clk_disable_unprepare(vc4_hdmi->pixel_clock); + return; + } + + ret = clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); + if (ret) { + DRM_ERROR("Failed to turn on pixel bvb clock: %d\n", ret); + clk_disable_unprepare(vc4_hdmi->hsm_clock); + clk_disable_unprepare(vc4_hdmi->pixel_clock); + return; + } + if (vc4_hdmi->variant->reset) vc4_hdmi->variant->reset(vc4_hdmi); diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h index 34138e0dd4a6..59639b405b7f 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h @@ -119,6 +119,7 @@ struct vc4_hdmi { struct clk *pixel_clock; struct clk *hsm_clock; struct clk *audio_clock; + struct clk *pixel_bvb_clock; struct debugfs_regset32 hdmi_regset; struct debugfs_regset32 hd_regset; -- git-series 0.9.1