Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5226303yba; Tue, 30 Apr 2019 11:06:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXgF+iJgjJEBZBJmr257QeXQDm/x3wTLnJihFz8tsnGAYKjBGaPbhN/GBUyOj3q1Cfxzpi X-Received: by 2002:a17:902:2b88:: with SMTP id l8mr70829451plb.262.1556647619353; Tue, 30 Apr 2019 11:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556647619; cv=none; d=google.com; s=arc-20160816; b=CcvGIMtOhqV47FRwS2SpRtRrBc2D3VxkGUj7hwqpBoyTZqDd2GH5gwt2365ddDmF7J eVXJsGrbgUIz0ZH9nzPmQsv+AXY+7siHzBtp5mu4S6+Bnct1HjJUEVW/RTxXWM8qZlCF LBnga5wLwRU8eLFLjw9PCVaizrVt/noQ+J146K/17SCiGHjfwNjKUJf0igTB6OXEsbCc CKkpxPoLmqkMrvXEZs5qn3ESWU91z+EYF4Ut8JI80dM0+0a80OjjozFnP1sAIJ0tur53 atVI4tMUxJM3y4a70ec8m/ZhuA/aUehCAKumXT9Nw6SJipqNXjJ4dFJ2TQz5/Gfg+Hp8 zmVQ== 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 :message-id:date:subject:cc:to:from; bh=jG1x0S5McnKE5j/O+D5mqxjwbIouI2OefnOSedVWS/Y=; b=WJrgsZcb+oTK72Rf4VrhQtTJQCFuD4S+Zu0zl60oQh2s0JHLU1e9TGCZINjdE9ZXx2 yCBED9dmEB5tjODhnsVcOxs8Plbd2AfGYre8lN+GQeXPjBd6FWEvfKCAhCb3+eVXqJMX EfvZ3inKCIAT6EIi8GHk691bTzTTxQIw98WzmRIrWjW3ff5+f94ZxnUBOnuLugi9MCIK jcwjbJRiz+HImZoLKU1mtpVxaxbyHmVrY6IYjXS1vtPttLs+b4Gh5mPGyxCiZnvJjw2U 8zaIixwerXEBKxpNW8go6L53cQv/+S94cXb51Hvp8pa2Ap9mPt4UNHZireOlx/CpvDtC qI4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m63si8103342pld.163.2019.04.30.11.06.43; Tue, 30 Apr 2019 11:06:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726799AbfD3SFk (ORCPT + 99 others); Tue, 30 Apr 2019 14:05:40 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:60814 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725950AbfD3SFk (ORCPT ); Tue, 30 Apr 2019 14:05:40 -0400 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=20PORTAY?= 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=20PORTAY?= , 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 Cc: Douglas Anderson , Matthias Kaehlcke , Derek Basehore , Lin Huang , Enric Balletbo i Serra , Boris Brezillon , kernel@collabora.com 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.21.0