Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5214667ybl; Tue, 4 Feb 2020 09:43:09 -0800 (PST) X-Google-Smtp-Source: APXvYqxRCV+LBUiSYd0z9VacK6axc0NIMOPZc6V24sorusINb98MT/FnLTSLXyKriDp8iBHAKk+n X-Received: by 2002:a05:6830:9a:: with SMTP id a26mr23227952oto.273.1580838188953; Tue, 04 Feb 2020 09:43:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580838188; cv=none; d=google.com; s=arc-20160816; b=VAkrFkGnvdHka+sgQ0535o5XZ9KAF8Blgjo0TS0Oav1/hLs7xkllIsDN6YqqMWZnd8 n2xWH7hHrpq/dGR9jAmFNm5UMnzwNjcmFMuy80AYVmWIBO1ihOdQRos0MvVBCGPiESLJ 44zsB21OyPj7AJTkuGR+VKmlaW3LlDLDQpmNZ6ThwWPxMBPSu5PsnMX10hez2zzk4BBQ sWMeGyN/RXs370ZL82nKno0PMZRRTw4O/8WjETN0YahgDsyGj9Xufk43fT5fke06sWLe h/peRfhLiDOaqzrYzJcs/CmtXbaWRnkt11J39GIN7VBUfEI7GH5O3JPPNKxJfShGZrzL qEng== 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=yoiAXhoixmdJYs8LD0r9kQphcdYUs7qTHA0kGn1fjD8=; b=mG61JGwBpd7NMJW/73HNA1Qb+vlUypnxCPiru4EZR+bmLYQRZfK0SmTh7MRS+Aeu8/ d54E8bybbnbqVssvd7EELkC6wlZHiBO6kQjfvOB6NCvOG/D4b61MraMv8HshB6IPaRjB erVdK8OZxhspeAQ/KPgek7ZMu++0MPhfzb6FVnHyRv2ae3PtXSE5lg8pqGo4ImIlNRM3 O4szh1h12BtFxCXCbTDgk7s4icCX9Jnd8C91sjfGQZLtQw6Q8Is90LIftUTofoBcfo99 UZXHkdiV8QxTjpXvzfq3ihMR6LIuqIjblhzAMy+JK2gtpMavMWtOZt0Yhxi7qSn4eBUD 5Wzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ziMjW1G2; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si9968422oih.41.2020.02.04.09.42.56; Tue, 04 Feb 2020 09:43:08 -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=@linaro.org header.s=google header.b=ziMjW1G2; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727496AbgBDRlB (ORCPT + 99 others); Tue, 4 Feb 2020 12:41:01 -0500 Received: from mail-vk1-f196.google.com ([209.85.221.196]:38497 "EHLO mail-vk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727394AbgBDRlB (ORCPT ); Tue, 4 Feb 2020 12:41:01 -0500 Received: by mail-vk1-f196.google.com with SMTP id w4so3795383vkd.5 for ; Tue, 04 Feb 2020 09:41:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=yoiAXhoixmdJYs8LD0r9kQphcdYUs7qTHA0kGn1fjD8=; b=ziMjW1G2ZC36prlStBh0BoqSZzrOzkvJgh4cxQJxzi2UYxeh0U6jYD3ceYaUFbxW/1 b/0ePQTGd+lyMBeZqKeC+hxGtEkgpE8EH6Y2lxFMYCqrv3Ak4nk42IGHFOldLsCDBsae 40BgwcClVqsWD2sMrahZCAeYJeX4pCF94iZDkyUXuVDghCn/cjfqG/vLYIBWmkBikA9A eRyRF06XfBOXrwxWbGj01NEg1HYXx3jibtOA0Q8TgAXWtmUJtRWBcjd9p7DDi/LBAckX sqg7bIML+x1oxWc2FraBge5N9fzLy5A/TX2gVJmTuwEDW/TJgkzZtOYi0HKw+k5Ll1XH YlWA== 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=yoiAXhoixmdJYs8LD0r9kQphcdYUs7qTHA0kGn1fjD8=; b=GCsn11X+vLNtuNWH4vZXmuUwg6i8WN6v+v9qdsIxOzB2Bwp/Bp3lzk90bTr21V5h9i KNM6W4a9NNt7N0QKDK58ZDZPPGspTL8oc1RfRgFKWHx/L4DjvB5r6l5+EM4nZtA1QyzD ZqejU50KxCeR/GtuwDEdXfgiFpBfgm0oOLEWGbga80aRdsjOkV5lVwEEe1spdjq5OT4X gfxJQsUCkutge9ECztPqMhzDQ14TrvB4Gml98GYpk8eWi4Vj27gnoYgCpno1M14SsYXg 5kosGT4l9aOPx5TOrw+hJjgvtKBCfS+8pHuVzE6GWbikon5mUCSH2V9stKzSSiC96Qo4 KLqQ== X-Gm-Message-State: APjAAAX0wpMG4scHBRCxlNTxzAPkYvkCt0TBstMjBX3P8CNQnNR2sq41 RYwmUQAkDioOA0ggc45eAd5sDhNtM/AsRLYtwnfPsw== X-Received: by 2002:a1f:94c1:: with SMTP id w184mr19267627vkd.43.1580838060111; Tue, 04 Feb 2020 09:41:00 -0800 (PST) MIME-Version: 1.0 References: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> <1574254593-16078-6-git-send-email-thara.gopinath@linaro.org> In-Reply-To: <1574254593-16078-6-git-send-email-thara.gopinath@linaro.org> From: Ulf Hansson Date: Tue, 4 Feb 2020 18:40:24 +0100 Message-ID: Subject: Re: [Patch v4 5/7] soc: qcom: Extend RPMh power controller driver to register warming devices. To: Thara Gopinath Cc: Eduardo Valentin , Zhang Rui , Daniel Lezcano , Bjorn Andersson , Andy Gross , Amit Kucheria , Mark Rutland , "Rafael J. Wysocki" , Linux PM , DTML , linux-arm-msm , Linux Kernel Mailing List 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 On Wed, 20 Nov 2019 at 13:56, Thara Gopinath wrote: > > RPMh power control hosts power domains that can be used as > thermal warming devices. Register these power domains > with the generic power domain warming device thermal framework. > > Signed-off-by: Thara Gopinath > --- > v3->v4: > - Introduce a boolean value is_warming_dev in rpmhpd structure to > indicate if a generic power domain can be used as a warming > device or not.With this change, device tree no longer has to > specify which power domain inside the rpmh power domain provider > is a warming device. > - Move registering of warming devices into a late initcall to > ensure that warming devices are registerd after thermal > framework is initialized. > > drivers/soc/qcom/rpmhpd.c | 38 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 37 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/qcom/rpmhpd.c b/drivers/soc/qcom/rpmhpd.c > index 9d37534..5666d1f 100644 > --- a/drivers/soc/qcom/rpmhpd.c > +++ b/drivers/soc/qcom/rpmhpd.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -48,6 +49,7 @@ struct rpmhpd { > bool enabled; > const char *res_name; > u32 addr; > + bool is_warming_dev; > }; > > struct rpmhpd_desc { > @@ -55,6 +57,8 @@ struct rpmhpd_desc { > size_t num_pds; > }; > > +const struct rpmhpd_desc *global_desc; > + > static DEFINE_MUTEX(rpmhpd_lock); > > /* SDM845 RPMH powerdomains */ > @@ -89,6 +93,7 @@ static struct rpmhpd sdm845_mx = { > .pd = { .name = "mx", }, > .peer = &sdm845_mx_ao, > .res_name = "mx.lvl", > + .is_warming_dev = true, > }; > > static struct rpmhpd sdm845_mx_ao = { > @@ -396,7 +401,14 @@ static int rpmhpd_probe(struct platform_device *pdev) > &rpmhpds[i]->pd); > } > > - return of_genpd_add_provider_onecell(pdev->dev.of_node, data); > + ret = of_genpd_add_provider_onecell(pdev->dev.of_node, data); > + > + if (ret) > + return ret; > + > + global_desc = desc; I assume this works fine, for now. Although, nothing prevents this driver from being probed for two different compatibles for the same platform. Thus the global_desc could be overwritten with the last one being probed, so then how do you know which one to use? > + > + return 0; > } > > static struct platform_driver rpmhpd_driver = { > @@ -413,3 +425,27 @@ static int __init rpmhpd_init(void) > return platform_driver_register(&rpmhpd_driver); > } > core_initcall(rpmhpd_init); > + > +static int __init rpmhpd_init_warming_device(void) > +{ > + size_t num_pds; > + struct rpmhpd **rpmhpds; > + int i; > + > + if (!global_desc) > + return -EINVAL; > + > + rpmhpds = global_desc->rpmhpds; > + num_pds = global_desc->num_pds; > + > + if (!of_find_property(rpmhpds[0]->dev->of_node, "#cooling-cells", NULL)) > + return 0; > + > + for (i = 0; i < num_pds; i++) > + if (rpmhpds[i]->is_warming_dev) > + pwr_domain_warming_register(rpmhpds[i]->dev, > + rpmhpds[i]->res_name, i); > + > + return 0; > +} > +late_initcall(rpmhpd_init_warming_device); For the record, there are limitations with this approach, for example you can't deal with -EPROBE_DEFER. On the other hand, I don't have anything better to suggest, from the top of my head. So, feel free to add: Reviewed-by: Ulf Hansson Kind regards Uffe