Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp273260ybv; Wed, 12 Feb 2020 23:58:47 -0800 (PST) X-Google-Smtp-Source: APXvYqywlvc+jrpB4/fpylLREKqhzbQKzsRCU0NEwrKgGllllAVSWrtO9z2dag7/gj25/2ci/KEQ X-Received: by 2002:aca:5d57:: with SMTP id r84mr2116591oib.42.1581580727449; Wed, 12 Feb 2020 23:58:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581580727; cv=none; d=google.com; s=arc-20160816; b=uNtCZjbQ4dXs+OSexwLkigU5o+FgZa/ypdkaE+mPamsCYfEL3TVkSNvYG34KcCQaT9 Ud+AlWXeavSgJcWQJ20jczd+dgtDkWJt9Dupbf7VjUGPlgVql88tUWGSsXoPtXtxkijC ClyQyh9v5I7vN4lS1OtpIKQSSmaU/v0hDiEql5paGwpsN2HJGPMOmWTg1BApR4ffeifv 4oO61XppmPL6IheBO6vgOSyT9/DJsYiYpMur3ELFjSvPeJZS9VlKEOi1Aw1kueibQURK Wi71r8DEy/cx5gySOuYHmD5XRWbitP7II7afFi+xKaYW4SLP9uNlHNYQq+NaeDzrdO+d pHWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=63SchGggoiyVI5EN3ryL83QTa83h0sF68yqzlCCOYPA=; b=Dea/pULW8l0CBCBOhYCbiKct7hlUjxZpODEx5KFV8oO1osDwJNtmpMMuLKOz6sglLr dsRSE3SezmgQJ01ByxqDe+aPSdVBoMWIRqbORHrLtsy9SlLJYUh3DQ1hqKcCjeewtNK3 KrGt4PmDtup0reHyD676+Dz3oA7FX8WtwkEvkBu2D8DTx520G978XYNGY8oKngYGhziZ 8gP2AU28DIP3V6x0UGN5axg0c/P1Km9Hptvlv0RyihXixfUruj1f93/US6F7oWSzLAhm xaszbIXk/yL11SRKvP7MZt50pKQjlYYnDqTJqw3Ja8QF32RgLf8FS6Zl4+2t8rIVWWqA nFIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="dKMEN31/"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l83si807188oih.58.2020.02.12.23.58.34; Wed, 12 Feb 2020 23:58:47 -0800 (PST) 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; dkim=pass header.i=@chromium.org header.s=google header.b="dKMEN31/"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729843AbgBMH6G (ORCPT + 99 others); Thu, 13 Feb 2020 02:58:06 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:37681 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729383AbgBMH6F (ORCPT ); Thu, 13 Feb 2020 02:58:05 -0500 Received: by mail-qk1-f193.google.com with SMTP id c188so4823068qkg.4 for ; Wed, 12 Feb 2020 23:58:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=63SchGggoiyVI5EN3ryL83QTa83h0sF68yqzlCCOYPA=; b=dKMEN31/0+UPjXjjiovyaJUVBlun8Po5VfH13AHcZMUXJDuSs1EI8nWJXKA7w7uhm7 ZFZz9QipKQ788oZVIHCnev3yFTRL7P+gk1Dj0VbcEMXdofR1rbh4c1ZuIizRumh9PFo7 XasDtmmhv2Ji6x1dAjrj+mXlEzg1Y9xWMKswM= 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=63SchGggoiyVI5EN3ryL83QTa83h0sF68yqzlCCOYPA=; b=EqH6e9P9dLvAkpme12qmcYT/js8RPmQ2WGRRXgwhNztXT6u3LLTZJoi/oCoMB45DJZ nD9+fGI6EAJaYlKV05q4Iw9R1E6cgq/7jrj2mx3mEhBMQBTKyxp2xXHDi33Nhe7oJITA RVygL28iRzAYM7FL5jdezJefD+6XnCyImBWMCDf/Su21jku9e6zq1ygfafKiZKk8V4cr g/KTRI2vG2R/tk9YokJQdpup3WfTMx9Ose3+bkLlh2g0VKpWDVzG3ukgh2oc4+xq1Ssp h10uY/qSQ3iqJ/n8EnVL3v/zy2659K1PxcFbSGScqF8nJ0KVuYmAPTVopGwknA00mU3R OmDw== X-Gm-Message-State: APjAAAXww9M9kAveahu7EHgi01JRYnk+OaJUsFQOW/B4EKRJU/a3/V+z 20a8qrDrLV94UJ6dRHqEK3+TulU1G00REmIML4lyJA== X-Received: by 2002:a37:6595:: with SMTP id z143mr11648233qkb.457.1581580683445; Wed, 12 Feb 2020 23:58:03 -0800 (PST) MIME-Version: 1.0 References: <20200207052627.130118-1-drinkcat@chromium.org> <20200207052627.130118-8-drinkcat@chromium.org> In-Reply-To: From: Nicolas Boichat Date: Thu, 13 Feb 2020 15:57:52 +0800 Message-ID: Subject: Re: [PATCH v4 7/7] RFC: drm/panfrost: devfreq: Add support for 2 regulators To: Rob Herring , Weiyi Lu , Nick Fan Cc: David Airlie , Daniel Vetter , Mark Rutland , Matthias Brugger , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , Liam Girdwood , Mark Brown , dri-devel , Devicetree List , lkml , linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , Hsin-Yi Wang , Ulf Hansson , Viresh Kumar , Stephen Boyd Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +Weiyi Lu +Nick Fan @MTK who may have more ideas. On Thu, Feb 13, 2020 at 2:14 AM Rob Herring wrote: > > On Wed, Feb 12, 2020 at 2:49 AM Nicolas Boichat wrote: > > > > +Viresh Kumar +Stephen Boyd for clock advice. > > > > On Fri, Feb 7, 2020 at 1:27 PM Nicolas Boichat wrote: > > > > > > The Bifrost GPU on MT8183 uses 2 regulators (core and SRAM) for > > > devfreq, and provides OPP table with 2 sets of voltages. > > > > > > TODO: This is incomplete as we'll need add support for setting > > > a pair of voltages as well. > > > > So all we need for this to work (at least apparently, that is, I can > > change frequency) is this: > > https://lore.kernel.org/patchwork/patch/1192945/ > > (ah well, Viresh just replied, so, probably not, I'll check that out > > and use the correct API) > > > > But then there's a slight problem: panfrost_devfreq uses a bunch of > > clk_get_rate calls, and the clock PLLs (at least on MTK platform) are > > never fully precise, so we get back 299999955 for 300 Mhz and > > 799999878 for 800 Mhz. That means that the kernel is unable to keep > > devfreq stats as neither of these values are in the table: > > [ 4802.470952] devfreq devfreq1: Couldn't update frequency transition > > information. > > The kbase driver fixes this by remembering the last set frequency, and > > reporting that to devfreq. Should we do that as well or is there a > > better fix? > > > > Another thing that I'm not implementing is the dance that Mediatek > > does in their kbase driver when changing the clock (described in patch > > 2/7): > > "" > > The binding we use with out-of-tree Mali drivers includes more > > clocks, this is used for devfreq: the out-of-tree driver switches > > clk_mux to clk_sub_parent (26Mhz), adjusts clk_main_parent, then > > switches clk_mux back to clk_main_parent: > > (see https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-4.19/drivers/gpu/arm/midgard/platform/mediatek/mali_kbase_runtime_pm.c#423) > > clocks = > > <&topckgen CLK_TOP_MFGPLL_CK>, > > <&topckgen CLK_TOP_MUX_MFG>, > > <&clk26m>, > > <&mfgcfg CLK_MFG_BG3D>; > > clock-names = > > "clk_main_parent", > > "clk_mux", > > "clk_sub_parent", > > "subsys_mfg_cg"; > > "" > > Is there a clean/simple way to implement this in the clock > > framework/device tree? Or should we implement something in the > > panfrost driver? > > Putting parent clocks into 'clocks' for a device is a pretty common > abuse. The 'assigned-clocks' binding is what's used for parent clock > setup. Not sure that's going to help here though. Is this dance > because the parent clock frequency can't be changed cleanly? Nick/Weiyi, any idea why we do that dance in the first place? (maybe the PLL clock is unstable while it's being changed?) If we really need it, can we move that logic to the clock core? > If up to > me, I'd put that dance in the clock driver. The GPU shouldn't have to > care. > > Rob