From mboxrd@z Thu Jan 1 00:00:00 1970 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=-10.0 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 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 B0FD7C28E83 for ; Fri, 4 Sep 2020 09:48:06 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7A24520791 for ; Fri, 4 Sep 2020 09:48:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2OtHlpcz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="GkEwuFZ2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A24520791 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=raspberrypi.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YKbdUuppEcw1AwG0twcWPhQWIasMzFHumtf/Soe1TGQ=; b=2OtHlpczB+eU9lGIAkqbaJBlU 7RXIzfyn9bEI9u7K3ntYGuZX4+2xGjjTs4XUVEbvWvvowUJjMIZhUjgqM2E4nJQGQknEbbaO2BH0Z b2B8/isjhZsINyZnEaNXGFqueec3ro50f1VqGD7iqbId5yXt3Gc06tkZKiWSh9QzFfq+GMNGrusxH xX29ZG2xbNfxxOvrdQif+dQ7U3V+GjT1Obs6AOtP2XaS8vr+Jg90+JpSC42n4zP2wYZNRFombGpWG f/My1lfC2zslyLvfE3zXXlorh1H1ksM3cXn0esZQt/hGNOL+F8vIjbyCqOrjLSnZDxIiNWRIRHogp yJMIPATog==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kE8Ix-0004TE-7C; Fri, 04 Sep 2020 09:46:47 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kE8It-0004Rq-Jf for linux-arm-kernel@lists.infradead.org; Fri, 04 Sep 2020 09:46:44 +0000 Received: by mail-wr1-x441.google.com with SMTP id m6so6121150wrn.0 for ; Fri, 04 Sep 2020 02:46:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iVx7hC5Z+ZE9a7SrgsdYEtoRluDNQl4XcnFv96CEECo=; b=GkEwuFZ2XgoFCAbgB9JFRh7/4rIuBnkk7B3WowF0Ouo7ZwRGjDRK2ZDlmZJ2RLg/On nrfPdZUS/h6zd7gpkrNCNoCHNFDi305JAdVAde3a7doEtdHs0smrUnlcdJG+pKDd/cO7 z7gpywm58gbc6ZQtGbyM4abXSOAwVd/o12b8eqbMIFpwHGPaugZDkoyz3B5fyVcPllbH rhj30xsmlH1C15HVBRhssiDsZvK16TDN6lMszim4cQjNM01buVbRtafq3/3c+yhlPLjS mzWOjOvn/OLzZPG+rs7d835O+afcHy1Qx9kDXY5pA1V4bgiKpFHrAZ3z4gH8TtH47vbm sVRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iVx7hC5Z+ZE9a7SrgsdYEtoRluDNQl4XcnFv96CEECo=; b=RipuHzKp6kJnYxSebr8wl/SbSo2NPpA89B66lWI6OYekG2VqXKb49WuReeGm33ddxf zhQCjH4nkJrm2oMGnPpxHOhPimHuPAviJWFWjLo05uWUq5Zj2MMqW80c2Y5qB9PUGBS/ izmcLiondfKd6VCElfd6YyAkHJ5qXyOqI0KNyKmetR/0VExPpGLFPYBaTqAV/Wvh5xo/ xlcWYK62pSkY/XIerLpnI3nSr1s0TQ5f2AKaH5QSyyat8GN6TssRMcN5hX5sAk+bIIFf pjYwYKDBJN/bXqNc54thVDGFMKU/P4iw+dobrW59ckw8WSdFcUbEmqQTalHskDjesQNg 5Ruw== X-Gm-Message-State: AOAM530ggG1QL53napT8MvNbGkP4neg3iGMMAEwnnOa2bWY8/Yoy9hIl +vxc0Uo0Xj2j6a9UhR4OU3ubmf6Jc9eG1DL03o24RA== X-Google-Smtp-Source: ABdhPJwptTnuYBF7f+Osku8uKwpWjtboRQN9W4oEJ9YqWxV4nkxW6SWMHqNqVamQSLiM39jayeQ7YaNuePi+ebV3FW8= X-Received: by 2002:a5d:4949:: with SMTP id r9mr7050780wrs.27.1599212800728; Fri, 04 Sep 2020 02:46:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dave Stevenson Date: Fri, 4 Sep 2020 10:46:26 +0100 Message-ID: Subject: Re: [PATCH v5 75/80] drm/vc4: hdmi: Add pixel BVB clock control To: Maxime Ripard X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200904_054643_724363_AD481437 X-CRM114-Status: GOOD ( 28.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tim Gover , LKML , DRI Development , Hoegeun Kwon , Eric Anholt , bcm-kernel-feedback-list@broadcom.com, Nicolas Saenz Julienne , Phil Elwell , linux-arm-kernel@lists.infradead.org, linux-rpi-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Maxime On Thu, 3 Sep 2020 at 09:03, Maxime Ripard wrote: > > 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 I didn't flag it earlier, but this is a bit of a weird name for the define. I know it wants to be concise, but it made me do a double take as to what it is for. I'm currently applying all these patches to our Raspberry Pi tree and actually CEC needs a fixed HSM on Pi0-3 to avoid recomputing all the timings. So I have a VC4_HSM_CLOCK define which is the fixed clock rate for Pi 0-3. This one is more a threshold for HSM to control BVB, and my brain starts to hurt over what it should be called. Unless there are other comments around this patchset (and I hope to read through the remaining ones today), then I don't consider it a blocker, but we can probably do better as and when we add the next threshold for 4k60. My current understanding is that the clock has to be an integer divide of 600MHz, and at least the pixel rate / 2, so the only link to HSM is due to HSM being 101% of pixel rate, but I will try to find confirmation of that. > > 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. > + */ Typo here. For 4k60 we need 300MHz (pixel clock / 2) Otherwise Reviewed-by: Dave Stevenson > + 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel