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=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 48770C3524B for ; Tue, 4 Feb 2020 17:41:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0F4C620674 for ; Tue, 4 Feb 2020 17:41:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ziMjW1G2" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727494AbgBDRlB (ORCPT ); Tue, 4 Feb 2020 12:41:01 -0500 Received: from mail-vk1-f193.google.com ([209.85.221.193]:35063 "EHLO mail-vk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727451AbgBDRlB (ORCPT ); Tue, 4 Feb 2020 12:41:01 -0500 Received: by mail-vk1-f193.google.com with SMTP id o187so5426033vka.2 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=S39SyJHkGPH/JOGIMRl+b4uMhZ+WkFitPyYraV+Uq6rlo9q21Tx+Dnb0yI8uhWLLTB EViJSuddvxB0iDPKZ763xIoK25BAGYlMI2zA0iFZXLBR+OoSDmj4z7E8+g72mxi7yeHM rSSbjdKFwYrgLulbpYXB1eB6d80HPjJlOf0CyHWSYCqZ12O5thBd+q9AXngwU7GAx1DC Qw8ChySY93r2rjEj8IIKHkaQ+f1eqhJ8+Vyu6MbVCKaK4B1ezn6xyW/7pNCw32MXkDw8 TsxvouM/c5577RCRg/f3+MnKxUldbTtQzp/3ps8e+WYAwcso+e6blXi4X6+fyqSe/C3+ ccnw== X-Gm-Message-State: APjAAAUJY67zINaHzyunFPqHFZhxhsHFXfckvgtb3EGC9P51boxaGMFQ q0u0n2rekBtr6mz6sAXD52OqoL6pNvVgAC0DV6Fl2Q== X-Google-Smtp-Source: APXvYqxED+wsvoC+QCgQxKOUzWUnXH8k+A/0E762um0DhW/ZNecciMz+Dh5mSPvBTLSIOsbmDHFEDhbxvV++vZ1id2Y= 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: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@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