From patchwork Mon Jul 30 08:11:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo i Serra X-Patchwork-Id: 10550315 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 2E0A696FA for ; Tue, 31 Jul 2018 07:26:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BDF2205A9 for ; Tue, 31 Jul 2018 07:26:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F31ED2A0C7; Tue, 31 Jul 2018 07:26:20 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9B1AF205A9 for ; Tue, 31 Jul 2018 07:26:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C8F196E091; Tue, 31 Jul 2018 07:25:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 706CF89BA1 for ; Mon, 30 Jul 2018 08:11:40 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 2F7EF263C00 From: Enric Balletbo i Serra To: MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Rob Herring , Will Deacon , Heiko Stuebner , Michael Turquette , Stephen Boyd , Sandy Huang , David Airlie Subject: [PATCH 0/8] Add support for drm/rockchip to dynamically control the DDR frequency. Date: Mon, 30 Jul 2018 10:11:16 +0200 Message-Id: <20180730081124.30698-1-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.18.0 X-Mailman-Approved-At: Tue, 31 Jul 2018 07:23:22 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Catalin Marinas , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Klaus Goger , Chris Zhong , Randy Li , kernel@collabora.com, linux-clk@vger.kernel.org, Brian Norris , linux-rockchip@lists.infradead.org, Nickey Yang , Jacob Chen , Shunqian Zheng , devicetree@vger.kernel.org, Jeffy Chen , linux-pm@vger.kernel.org, Derek Basehore , Mark Yao , linux-arm-kernel@lists.infradead.org, Lin Huang , Douglas Anderson , robin.murphy@arm.com MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Dear all, The rk3399 platform has a DFI controller that can monitor DDR load and a DMC driver that talks with the TF-A (Trusted Firmware-A) to dynamically set the DDR frequency with following flow. kernel Trusted Firmware-A (bl31) monitor ddr load | | get_target_rate | | pass rate to TF-A clk_set_rate(ddr) --------------------->run ddr dvs flow | | <------------------------------end ddr dvs flow | | return These patches add support for devfreq to dynamically control the DDR frequency into the drm rockchip driver. By default it uses the 'simple_ondemand' governor which can adjust the frequency based on the DDR load. Waiting for your feedback. Best regards, Enric Changes in v1: - [RFC 1/10] Add Acked-by: Chanwoo Choi - [RFC 1/10] s/Generic/General/ (Robin Murphy) - [RFC 2/10] Add reviewed and acked tags from Chanwoo Choi and Rob Herring - [RFC 3/10] Add an explanation for platform SIP calls. - [RFC 3/10] Change if statement for a switch. - [RFC 3/10] Rename ddr_flag to odt_enable to be more clear. - [RFC 4/10] Removed from the series. I did not found a use case where not holding the mutex causes the issue. - [RFC 7/10] Removed from the series. I did not found a use case where this matters. - [RFC 8/10] Move rk3399-dram.h to dt-includes. - [RFC 8/10] Put sdram default values under the dmc node. - [RFC 8/10] Removed rk3399-dram-default-timing.dts Derek Basehore (2): devfreq: rk3399_dmc / clk: rockchip: Sync with vblank in the kernel for DDRfreq. devfreq: rk3399_dmc / clk: rockchip: Disable DDR clk timeout on suspend. Enric Balletbo i Serra (3): devfreq: rockchip-dfi: Move GRF definitions to a common place. dt-bindings: devfreq: rk3399_dmc: Add rockchip,pmu phandle. devfreq: rk3399_dmc: Pass ODT and auto power down parameters to TF-A. Lin Huang (2): arm64: dts: rk3399: Add dfi and dmc nodes. arm64: dts: rockchip: Enable dmc and dfi nodes on gru. Sean Paul (1): drm: rockchip: Add DDR devfreq support. .../bindings/devfreq/rk3399_dmc.txt | 2 + arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 21 ++ .../boot/dts/rockchip/rk3399-op1-opp.dtsi | 29 +++ arch/arm64/boot/dts/rockchip/rk3399.dtsi | 51 ++++- drivers/clk/rockchip/clk-ddr.c | 157 +++++++++++-- drivers/clk/rockchip/clk.c | 2 +- drivers/clk/rockchip/clk.h | 3 +- drivers/devfreq/event/rockchip-dfi.c | 23 +- drivers/devfreq/rk3399_dmc.c | 209 +++++++++++++++--- drivers/devfreq/rk3399_dmc_priv.h | 16 ++ drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 46 ++++ drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 9 + drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 35 +++ drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 34 +++ include/dt-bindings/power/rk3399-dram.h | 73 ++++++ include/soc/rockchip/rk3399_dmc.h | 42 ++++ include/soc/rockchip/rk3399_grf.h | 21 ++ include/soc/rockchip/rockchip_sip.h | 1 + 18 files changed, 704 insertions(+), 70 deletions(-) create mode 100644 drivers/devfreq/rk3399_dmc_priv.h create mode 100644 include/dt-bindings/power/rk3399-dram.h create mode 100644 include/soc/rockchip/rk3399_dmc.h create mode 100644 include/soc/rockchip/rk3399_grf.h