From patchwork Tue Apr 30 18:05:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ga=C3=ABl_PORTAY?= X-Patchwork-Id: 10924063 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 B56B91395 for ; Tue, 30 Apr 2019 18:05:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6D8A28969 for ; Tue, 30 Apr 2019 18:05:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99E5128A12; Tue, 30 Apr 2019 18:05:55 +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,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 23A3428969 for ; Tue, 30 Apr 2019 18:05:55 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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:In-Reply-To:References: List-Owner; bh=BQDNBFBi4AF0dHoFqtQcSIYn0gHfR4JyhSn54OKlNcs=; b=H4Xvtoo8IPW7Gh CTLbL2Lh9teAGh3sv5hFkKH0fpx1MwJ9TNcMqb3WEMcYsMgMJ9T0dUiVphtlAWERj0D61nTpRTgOf 2q7UMsachItEU9zwj7jZSl0Y59NOP1tnYCPiQqQybmxJBx/1bJilK7YrjluSoRbjFppCeczcGCmbb YQ4tytZDZjAgugPBNy22uLPlP0pSXDbwDRmmP4dBBYNPwj+Sb+bGIsze+Es3k5uxp20TMrR1yQTEt Z4lPSoCIZmRkbo/McX1hxF6mFr6HhEyM6QNm1a4hdFnflqNDCyvxzntUx5t2CsRpETn8YSLKa4H8O Nra6vMpLdT2TAtW11JoQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLX8Y-0003om-4g; Tue, 30 Apr 2019 18:05:50 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLX8O-0003g1-Nf; Tue, 30 Apr 2019 18:05:42 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: gportay) with ESMTPSA id 60BAB281CB7 From: =?utf-8?q?Ga=C3=ABl_PORTAY?= To: Rob Herring , Mark Rutland , Heiko Stuebner , Michael Turquette , Stephen Boyd , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Sandy Huang , David Airlie , Daniel Vetter , =?utf-8?q?Ga=C3=ABl_PORTAY?= , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [RFC 0/4] Add support for drm/rockchip to dynamically control the DDR frequency within vblank for gru chromebooks. Date: Tue, 30 Apr 2019 14:05:20 -0400 Message-Id: <20190430180524.22710-1-gael.portay@collabora.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190430_110541_034929_E10A44A0 X-CRM114-Status: GOOD ( 17.12 ) 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: Lin Huang , Derek Basehore , Douglas Anderson , Matthias Kaehlcke , Boris Brezillon , Enric Balletbo i Serra , kernel@collabora.com Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Dear all, The purpose of that RFC is to enable de DMC device for the Rockchip based GRU Chromebooks, and to add a mean of synchronization between the Rockchip DRM driver and that DMC devfreq driver. The DMC device is responsible for updating the DDR frequency according to the load of the DDR memory. Changing that clock rate within the display scanout leads to glitches. Thus, the devfreq framework needs a mean to synchronize the rate change with other devices. In that case, the DRM driver display has to synchronize a change rate within the VBLANK. The first patch adds a locking API to the devfreq framework. The users of a devfreq device can control the frequency change by locking and unlocking the devfreq device whenever they want. When a change rate is requested, and the device is locked, the drivers that hold a lock are called back, and the change will be applied as soon as the device is unlocked. The second patch adds the devfreq support in the Rockchip DRM drivers and uses the devfreq lock API to defer the change of the DDR frequency within the next VBLANK. The DRM driver locks the devfreq device and gets notified when a change is wanted then. Next, it enables the VBLANK interrupt, releases the lock on interrupt and starts a timer that relocks the devfreq device at the end of the vertical blanking interval. Also, the DRM driver disables the devfreq device if more than one CRTC becomes active. The third patch merges the Rockchip DDR clock code to the Rockchip DMC devfreq driver. These drivers both perform SMC calls to the Trusted-Firmware A to run SiP services that are related to the DDR memory. This merge puts the code at the same place. It avoids the contention in the Common Clock Framework that may cause to miss the deadline during which the rate can be changing without making glitches. The fourth patch tells display-subsystem to use the DMC devfreq device. I am waiting for your feedback. Note: This RFC needs patchset[1]. Its purpose is to addresses the review that was made in v1[2]. I dropped some patches in v2 to address things separately (in that RFC). [1]: https://patchwork.kernel.org/cover/10901577/ [2]: https://lkml.org/lkml/fancy/2018/8/2/7 Best regards, Gaƫl PORTAY (3): PM / devfreq: add devfreq_lock/unlock() functions drm: rockchip: Add DDR devfreq support. clk: rockchip: merge clk-ddr in dmc devfreq driver arm64: dts: rockchip: Set the display-subsystem devfreq arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 4 + arch/arm64/boot/dts/rockchip/rk3399.dtsi | 2 +- drivers/clk/rockchip/Makefile | 1 - drivers/clk/rockchip/clk-ddr.c | 147 -------------- drivers/clk/rockchip/clk-rk3399.c | 2 - drivers/clk/rockchip/clk.c | 9 - drivers/clk/rockchip/clk.h | 33 --- drivers/devfreq/devfreq.c | 200 ++++++++++++++++++- drivers/devfreq/rk3399_dmc.c | 42 ++-- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 51 ++++- drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 6 + drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 177 +++++++++++++++- drivers/gpu/drm/rockchip/rockchip_drm_fb.h | 3 +- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 82 ++++++++ include/linux/devfreq.h | 64 ++++++ 15 files changed, 611 insertions(+), 212 deletions(-) delete mode 100644 drivers/clk/rockchip/clk-ddr.c