Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp156768ybb; Thu, 19 Mar 2020 18:44:22 -0700 (PDT) X-Google-Smtp-Source: ADFU+vszzj9wlNEUpb6TvhwVLpZLPVuxFTx/o/KQx7LVuoYI7Bv16M9xHc1FCBLd4/5maMhSHX0C X-Received: by 2002:a9d:4ee:: with SMTP id 101mr4719800otm.301.1584668662064; Thu, 19 Mar 2020 18:44:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584668662; cv=none; d=google.com; s=arc-20160816; b=M2j+UitNDJnAbK2x7DxcLYbxWHveSi5/5RIdPzpcQb9ZzGjRUyFEJOe42bUTxaNfzT zCI1leSwCRBD7dHKg3WqrZzoJtJzKkO42CcGhGias0zg++Lz4oqCCvLg4T/Q++OvUVHE RRoa0V6jh6qU7w5oyfZLrr99m/H723Ee8BLug86ocAWPo1MRXH4h7zoQFmJ3E1d4KNNz +enqw6f9JSOVHT0p4/NPKBOpqeLalPb5OTAZj+nW8lDIqW62ugMGoaXM08kW1ulSoEAx ONR7ZOt1RZxctMf1Qi9nZCla7yY1THoNLCHZXuOtES4/jlBKsQSBd0onZXzUwFQ/FsNR oLWw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Lr1Y7KtiXEwRNt5oEJbHw3xmtSZcUrY6dlEwgFNuRHA=; b=AmtI9g8jWDtGHUYL0eeWTeCY2coY/G9bSfOLb5biMMKTFs4IsPCHfbP5lj9kFSUW63 VwoZiAKr9bL6Ulpe8pSb1rBwrxFpycOUErr6+ycbE476epRj34OAk5sLCBn0EaaqRpAY C1IrVMRoWCjZqUTIvyARuPnZCYk1VggcLDtFqNZ9MaTR5xlb8JXSLg+2bJ6rdCYNi2up N0EGKFruDJWzK/YYhL4iiYzUgRXJkg+wnMuLAIMi8RXInkzMoKoSqnqQYnS5UZJUdUGh fjTbFGLTeniI1FJDJMK48Ed57tyRgtiXeLDlP9dXMC1znrY8rLvCVBU6ojYRwNEpFRFg NrXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JoZrZzq9; 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 p189si2037542oic.178.2020.03.19.18.44.09; Thu, 19 Mar 2020 18:44:22 -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; dkim=pass header.i=@linaro.org header.s=google header.b=JoZrZzq9; 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 S1727416AbgCTBmR (ORCPT + 99 others); Thu, 19 Mar 2020 21:42:17 -0400 Received: from mail-qv1-f67.google.com ([209.85.219.67]:46387 "EHLO mail-qv1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727415AbgCTBlR (ORCPT ); Thu, 19 Mar 2020 21:41:17 -0400 Received: by mail-qv1-f67.google.com with SMTP id m2so2166630qvu.13 for ; Thu, 19 Mar 2020 18:41:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lr1Y7KtiXEwRNt5oEJbHw3xmtSZcUrY6dlEwgFNuRHA=; b=JoZrZzq9MtCdZRY8h1hIczI93UjeYWLiyWcjBPqgqslk4B+dNR7hCtZIo7jyN6xzmt PhtpHWIrRArylYLj/pati/6Okn2ECsDFjNcuTjl/1u2m3eZZvbEsj0JyhcW+Nkf1rQm7 7vkn6PlDFIgd/DPxZnqmxR9bm0UaGI9/Y/zVDLEmBBjWQaEm0UPOBRyLUpRpyat/lwQ2 tIKTvYGmmrm/4MH5dCshcNMg2rWoiOfaFroCJC9mULyzd/myHd5i8mf8ZWoFDKvWy3R+ JmxiYw5Up0VLEHVizPB0QOaKD3/xpnZLsGnlp0Z+8ZFsCkuwJrsbuGlF8/YewmN39dBz pLaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Lr1Y7KtiXEwRNt5oEJbHw3xmtSZcUrY6dlEwgFNuRHA=; b=r1MBqZbYxlMpazdjuL3q3JnOBCpGomL4OOJ4C0Ekh2ekrIzF4Et/pufIV8EFLwzjVZ tUorSsRKurr+a0BmHE11z7+JORgDwG8vJmLe8WmWE2WVZOIMRtMhflgY0vFBbSDJU59O Oxui9yz+p/uYmZft6vTg0jIXAfWbxTLif2qClXgAo0BTaSG9VozODIEYfphsNnOEMT58 WE7zG1N85KEqsf3zxiu6m6zrHPg3J+IiJw08FXdCykfbUp3P6AaBRBpldBfOZAWTkPaB VuIWjqnXi7nTv2n+JdoDrUgNF2PN1RxJU5LFbr48gY2rzZAMmcQnXC1GPNRhbN1owYaA BaHg== X-Gm-Message-State: ANhLgQ2Z2Wm/+HUQ0HQqYvBWf8snlrpCfER0gT/p3rQhpmzq54k0Qhr4 NhVjYp09Mrc4PIaRsS0kFRdjhw== X-Received: by 2002:a05:6214:12c1:: with SMTP id s1mr5757053qvv.150.1584668475089; Thu, 19 Mar 2020 18:41:15 -0700 (PDT) Received: from pop-os.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id 2sm2706287qtp.33.2020.03.19.18.41.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2020 18:41:14 -0700 (PDT) From: Thara Gopinath To: rui.zhang@intel.com, ulf.hansson@linaro.org, daniel.lezcano@linaro.org, bjorn.andersson@linaro.org, agross@kernel.org, robh@kernel.org Cc: amit.kucheria@verdurent.com, mark.rutland@arm.com, rjw@rjwysocki.net, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [Patch v5 4/6] soc: qcom: Extend RPMh power controller driver to register warming devices. Date: Thu, 19 Mar 2020 21:41:05 -0400 Message-Id: <20200320014107.26087-5-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200320014107.26087-1-thara.gopinath@linaro.org> References: <20200320014107.26087-1-thara.gopinath@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Reviewed-by: Ulf Hansson 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 registered after thermal framework is initialized. drivers/soc/qcom/rpmhpd.c | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/rpmhpd.c b/drivers/soc/qcom/rpmhpd.c index 7142409a3b77..4e9c0bbb8826 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 = { @@ -452,7 +457,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; + + return 0; } static struct platform_driver rpmhpd_driver = { @@ -469,3 +481,26 @@ 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) + of_pd_warming_register(rpmhpds[i]->dev, i); + + return 0; +} +late_initcall(rpmhpd_init_warming_device); -- 2.20.1