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: 10924059 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 3C82D1395 for ; Tue, 30 Apr 2019 18:05:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DCEB288A9 for ; Tue, 30 Apr 2019 18:05:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20290289F5; Tue, 30 Apr 2019 18:05:50 +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=ham 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 AA19B288A9 for ; Tue, 30 Apr 2019 18:05:49 +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=pOYew/lPaFujfdvEd7nTGOTaFzd0xtUEKNnBg3CmOtQ=; b=rF/UxN/30793AZ Jl1BW4ArEMCyN7cjL8OFpLdAGZeKOgmuYIs7S3pUnfVO5Nh8qchdhsjE09hn5zIbzEu/6Fsgz3wgT TUtgFmy7Xn/GDx5Q9cl0wYipDLvGFFw8359O966EyDdmpS+cYeKILkhFhK+rsA9IzAFKvnUAtsgqm 7XBk7/SdVA5QAmvvZ2R1ZJ5Xb32lHqubuHsbXyinOvUntMlHJmJblKN8jnQdyhQzuCTwJQsJBrgIQ Q3mW3ap8Fg0Sgb09dheLnrBa+H+fPdo7sHh9xUgCAXhMMO7IzH3tw6syxgQIIru9QyGAAaRoxAJmd 6dF7mJi2XKqF+zPyTy9A==; 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 1hLX8T-0003hN-06; Tue, 30 Apr 2019 18:05:45 +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-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: 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-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=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