From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4453EC11F67 for ; Thu, 1 Jul 2021 20:57:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 23ECB613FE for ; Thu, 1 Jul 2021 20:57:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234232AbhGAVAQ (ORCPT ); Thu, 1 Jul 2021 17:00:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234194AbhGAVAP (ORCPT ); Thu, 1 Jul 2021 17:00:15 -0400 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D2C9C0613DC for ; Thu, 1 Jul 2021 13:57:44 -0700 (PDT) Received: by mail-oi1-x234.google.com with SMTP id t80so8859456oie.8 for ; Thu, 01 Jul 2021 13:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xaKcdpFN2Fw7OEDvlSL72eEsFlsZE9M1SAXoH6GaDOE=; b=KCDSp+iPQWpVLOMxPSrwSVq5HA31cKZynMTvSpoT2vIIQQsexxo9hV+o4ycEBhgbAs 3JrKLrRm9cVxY+GnHGBSNsqmorNYUPURDFZimp3R5tUtvAkPvYtov4H+rHkSUK9pO+RY y6NFIMq9ZW2VKqdR69b/QbbdAoc+vSboS2MqDnwrS9zBgEMjcUfaS0AJ2oxRVXReBetX 6Vkh53ZfPrfazlNlz4a7lL4DdyM5N+41e4niGDKSOnTzwQT5LwMfxjqvyWVccpSu2dyB Ax3RY4kPCFoKMwwWHsA3pv1vvIqDlbX5QGzqIGPHdmxPu+J4xRF+aA3d2P6Ef+jcsRLB LV4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xaKcdpFN2Fw7OEDvlSL72eEsFlsZE9M1SAXoH6GaDOE=; b=A+UCeqml42FYYlEfQzX5JbW/toz/JZ7HVhSLc4LS2ov+ADJVUsxTLaPVsD87hgQKbH GE8h95yBW4yL1aEvU+fjG7gYRvxseBJKSftofVZxotsbwvyO2LdsDE0koSe6YiSKwMjl JMkd9J8jMmY1s9d4V0n2lMhykT2Td1AV/ip5i43wye75Vos3zLPWg+r9VOlrRMV/f15q A/r0qxYz3gP46YQePhMSMUKnKXcBYIU0fqy30EoX5ovnfTy1As8rw1Wu9tSsrJ4dheMe jsXGsbTHl4neQetURtj/cEPlhcEyZGwMpxbQC5IyMWi1t+iKKy4jMrEwAX5o18KafF0r mjSw== X-Gm-Message-State: AOAM531Bfxw8S0/Bsts8H+IsX+GDQFsZUVSO73NKw4aYlN5W3e580x9+ kZxZMepY3MHyxwBX0Nz9z3v32Q== X-Google-Smtp-Source: ABdhPJx0Wjb0iHhvWkfKXwSwN9GFKAP7ElCkMltSdlOwYuFU97C2uRI4KejvvrJMn//dgOoHW0Q+EA== X-Received: by 2002:a05:6808:316:: with SMTP id i22mr9216689oie.41.1625173063200; Thu, 01 Jul 2021 13:57:43 -0700 (PDT) Received: from yoga (rrcs-97-77-166-58.sw.biz.rr.com. [97.77.166.58]) by smtp.gmail.com with ESMTPSA id w2sm253104oia.34.2021.07.01.13.57.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Jul 2021 13:57:42 -0700 (PDT) Date: Thu, 1 Jul 2021 15:57:40 -0500 From: Bjorn Andersson To: Dmitry Baryshkov Cc: Stephen Boyd , Rajendra Nayak , Andy Gross , Rob Herring , Jonathan Marek , Taniya Das , Michael Turquette , "open list:DRM DRIVER FOR MSM ADRENO GPU" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "open list:COMMON CLK FRAMEWORK" , Bryan O'Donoghue , Mark Brown , Ulf Hansson , open list Subject: Re: [PATCH 3/6] clk: qcom: gdsc: enable optional power domain support Message-ID: References: <20210630133149.3204290-1-dmitry.baryshkov@linaro.org> <20210630133149.3204290-4-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 01 Jul 15:12 CDT 2021, Dmitry Baryshkov wrote: > On Thu, 1 Jul 2021 at 07:23, Bjorn Andersson wrote: > > > > On Wed 30 Jun 15:29 CDT 2021, Dmitry Baryshkov wrote: > > > > > On Wed, 30 Jun 2021 at 20:11, Bjorn Andersson > > > wrote: > > > > > > > > On Wed 30 Jun 10:47 CDT 2021, Dmitry Baryshkov wrote: > > > > > > > > > Hi, > > > > > > > > > > On Wed, 30 Jun 2021 at 18:00, Bjorn Andersson > > > > > wrote: > > > > > > > > > > > > On Wed 30 Jun 08:31 CDT 2021, Dmitry Baryshkov wrote: > > > > > > > > > > > > > On sm8250 dispcc and videocc registers are powered up by the MMCX power > > > > > > > domain. Currently we used a regulator to enable this domain on demand, > > > > > > > however this has some consequences, as genpd code is not reentrant. > > > > > > > > > > > > > > Teach Qualcomm clock controller code about setting up power domains and > > > > > > > using them for gdsc control. > > > > > > > > > > > > > > Signed-off-by: Dmitry Baryshkov > > > > > > > > > > > > There's a proposal to add a generic binding for statically assigning a > > > > > > performance states here: > > > > > > > > > > > > https://lore.kernel.org/linux-arm-msm/1622095949-2014-1-git-send-email-rnayak@codeaurora.org/ > > > > > > I checked this thread. It looks like Rajendra will also switch to the > > > "required-opps" property. So if that series goes in first, we can drop > > > the call to set_performance_state. If this one goes in first, we can > > > drop the set_performance_state call after getting Rajendra's work in. > > > > > > > > > > > > > > > > > > > > > But that said, do you really need this? > > > > > > > > > > > > The requirement for driving MMCX to LOW_SVS on SM8250 (and NOM on > > > > > > SM8150/SC8180x) seems to only come from the fact that you push MDP_CLK > > > > > > to 460MHz in &mdss. > > > > > > > > > > > > But then in &mdss_mdp you do the same using an opp-table based on the > > > > > > actual MDP_CLK, which per its power-domains will scale MMCX accordingly. > > > > > > > > > > MDSS and DSI would bump up MMCX performance state requirements on > > > > > their own, depending on the frequency being selected. > > > > > > > > > > > > > Right, but as I copied things from the sm8250.dtsi to come up with > > > > sm8150/sc8180x.dtsi I concluded that as soon as the assigned-clockrate > > > > in &mdss kicks in I need the performance state to be at NOM. > > > > > > > > So keeping the assigned-clockrate in &mdss means that MMCX will never go > > > > below NOM. > > > > > > No, because once MDP is fully running, it will lower the clock frequency: > > > > > > # grep mdp_clk /sys/kernel/debug/clk/clk_summary > > > disp_cc_mdss_mdp_clk_src 1 1 0 > > > 150000000 0 0 50000 ? > > > disp_cc_mdss_mdp_clk 2 2 0 > > > 150000000 0 0 50000 Y > > > > > > > But won't that just lower the performance state requested by the > > &mdss_mdp, while the &mdss still votes for NOM - with the outcome being > > that we maintain NOM even if the clock goes down? > > &mdss doesn't vote on performance state. At least it does not on > msm/msm-next which I have at hand right now. > &mdss toggles mdss_gdsc, but does not assign any performance state. > Right, but per the upstream implementation, enabling MDSS_GDSC could in itself fail, because unless something else has driven up the performance state the enable that trickles up won't actually turn on the supply. > On the other hand &mdss_mdp and &dsi0 clearly vote on mmcx's performance state. > Right, but it does so as part of its clock scaling, so this makes perfect sense to me. > > > > > > > > > > > > So wouldn't it be sufficient to ensure that MDSS_GDSC is parented by > > > > > > MMCX and then use opp-tables associated with the devices that scales the > > > > > > clock and thereby actually carries the "required-opps". > > > > > > > > > > Actually no. I set the performance state in the qcom_cc_map, so that > > > > > further register access is possible. Initially I was doing this in the > > > > > qcom_cc_really_probe() and it was already too late. > > > > > Just to remind: this patchset is not about MDSS_GDSC being parented by > > > > > MMCX, it is about dispcc/videocc registers being gated with MMCX. > > > > > > > > > > > > > So you're saying that just enabling MMCX isn't enough to touch the > > > > dispcc/videocc registers? If that's the case it seems like MMCX's > > > > definition of "on" needs to be adjusted - because just specifying MMCX > > > > as the power-domain for dispcc/videocc and enabling pm_runtime should > > > > ensure that MMCX is enabled when the clock registers are accessed (I > > > > don't see anything like that for the GDSC part though). > > > > > > No, it is not enough. If I comment out the set_performance_state call, > > > the board reboots. > > > > > > However I can set the opps as low as RET and register access will work. > > > I'll run more experiments and if everything works as expected, I can > > > use retention or min_svs level in the next iteration. > > > Just note that downstream specifies low_svs as minimum voltage level > > > for MMCX regulator. > > > > > > > It doesn't make sense to me that a lone power_on on the power-domain > > wouldn't give us enough juice to poke the registers. > > > > But digging into the rpmhpd implementation answers the question, simply > > invoking rpmhpd_power_on() is a nop, unless > > rpmhpd_set_performance_state() has previously been called, because > > pd->corner is 0. So this explains why enable isn't sufficient. > > > > Compare this with the rpmpd implementation that will send an > > enable request to the RPM in this case. > > Do you think that we should change that to: > > rpmhpd_aggregate_corner(pd, max(pd->corner, 1)) ? > > Or > > rpmhpd_aggregate_corner(pd, max(pd->corner, pd->levels[1])) ? > In rpmhpd_power_on() and rpmhpd_set_performance_state() we pass the index of the entry in pd->levels[] that we want, but in rpmhpd_power_off() we pass the value of pd->levels[0]. So I would suggest dropping the if (pd->corner) and doing: rpmhpd_aggregate_corner(pd, max(pd->corner, 1)); And it seems both rb3 and rb5 still boots with this change (but I need to do some more testing to know for sure). > > > > > > I thought our problem you had was that you need to set a > > > > performance_state in order to clock up some of the clocks - e.g. > > > > MDP_CLK. > > > > > > No, even register access needs proper perf state. > > > > > > > Per above finding you're right, enabling a rpmhpd power-domain doesn't > > do anything. And I don't find this intuitive or even in line with the > > expectations of the api... > > > > > > > > A quick test booting rb3 and rb5 seems to indicate that it's possible to > > initialize pd->corner to 1 (to ensure that enable at least gives us the > > lowest level). > > > > set_performance_state(0) will however then result in voting for "off", > > rather than the lowest enabled level. > > Well, set_performance_state(0) means that "the device wouldn't > participate anymore to find the target performance state of the > genpd". I agree. > Strictly speaking it does not specify whether it is ok to turn > it off or not. (like the regulator with the voltage set to 0V). > But I'd also like to hear a comment from Stephen here. > Looking at other power-domains (e.g. gdsc and rpmpd) enabling the power-domain means it is no longer off and if you need some specific performance state you have to vote for that. So I'm also interested in hearing if there's any reasoning behind how this was written. Regards, Bjorn