From patchwork Wed Nov 20 12:56:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11253769 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CAE1013A4 for ; Wed, 20 Nov 2019 12:56:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A17692251D for ; Wed, 20 Nov 2019 12:56:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ArXeuvGp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729959AbfKTM4s (ORCPT ); Wed, 20 Nov 2019 07:56:48 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:36122 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729952AbfKTM4q (ORCPT ); Wed, 20 Nov 2019 07:56:46 -0500 Received: by mail-qt1-f196.google.com with SMTP id y10so28814210qto.3 for ; Wed, 20 Nov 2019 04:56:44 -0800 (PST) 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; bh=e3cBvCJGRcxYKob0R3G9a3fkI3S2TOmBRjT4BE52Zwg=; b=ArXeuvGpoBlrfpILMx/M83+Zn/RbRWXihN50pPnTAw2ZLLkb/hp/kzXGE4e3pJcJ3R gsYaNqlAFKy0EJHJMMUsBRCdN68xbd0/u9HLA/lwkwTiRIie2u8OQ4ubtENtMbs+NnKA Cmru7KlvSqU/6oQTWAAxXSVXZ6dwfTVAU3AzwldjvPeVnpnzaSmGsFp5a7oWXickOmYY lTxHgbpbFs/+r9OWV46swlR8FLMWOQm2U4HrrqbOFOYw4nt/ffV6HidWqcKbMNWUSzi9 AvukxXBhZ5W7XQoSKlFGkGDOkaR04e6y3vxHPJgKzQqCIvZauZdPMGjAh/jNQPeUlWKf 7XSQ== 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; bh=e3cBvCJGRcxYKob0R3G9a3fkI3S2TOmBRjT4BE52Zwg=; b=I4lUkFcpDLAp8BuNvjIWyxCPkHRJLCjDZ+OgRZFt2EjFmTeS62AahGadpqKp+xnOoO axa7Tjz6L0RB9iH9lfjR+wBdrOqqPH4NyGXilBFl/XJ9V+buJSgd1iyXQOyEHYzfhiJp dkYP2LH/oHDpOceQ5vdbO9ys95FAQkR8DFRtmLEwDHsrSSiq8yIVWUUPenQR0XO9E2Dz jiekb95y8XF1FvWW42I6UiXhgFwIDh0q37DlKFoc694tUiVRg94AwYnv/yKnMVKi16jN 5c4MU/SJNIs4llMHkoBZXpa3dXVPDOhw782oUCvVTem0ZzPaeo8d9/c/TNSbU+N5hcKN Mvtw== X-Gm-Message-State: APjAAAVQIMDztt2v/VHvrtgdunDSjxSMyawMBBIXv8WX+ca1CVuEAPew zeneWk2/X2dfb7uzhYtZUD1fM4qZs94= X-Google-Smtp-Source: APXvYqwv4OeeDPmAsbQS44jpcRMO6IRwZgLvnuiwUbOpTPEixRa4022JfwejzTFLXf6BZpU3r5bqkA== X-Received: by 2002:aed:3c0a:: with SMTP id t10mr2434630qte.173.1574254603451; Wed, 20 Nov 2019 04:56:43 -0800 (PST) Received: from Thara-Work-Ubuntu.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id r2sm14109637qtc.28.2019.11.20.04.56.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Nov 2019 04:56:41 -0800 (PST) From: Thara Gopinath To: edubezval@gmail.com, rui.zhang@intel.com, ulf.hansson@linaro.org, daniel.lezcano@linaro.org, bjorn.andersson@linaro.org, agross@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 v4 1/7] PM/Domains: Add support for retrieving genpd performance states information Date: Wed, 20 Nov 2019 07:56:27 -0500 Message-Id: <1574254593-16078-2-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> References: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add two new APIs in the genpd framework, dev_pm_genpd_get_performance_state to return the current performance state of a power domain and dev_pm_genpd_performance_state_count to return the total number of performance states supported by a power domain. Since the genpd framework does not maintain a count of number of performance states supported by a power domain, introduce a new callback(.get_performance_state_count) that can be used to retrieve this information from power domain drivers. These APIs are added to aid the implementation of a power domain as a warming device. Linux kernel cooling device framework(into which warming device can be plugged in) requires during initialization to be provided with the maximum number of states that can be supported. When a power domain acts as a warming device, the max state is the max number of perfomrance states supported by the power domain. The cooling device framework implements API to retrieve the current state of the cooling device. This in turn translates to the current performance state of the power domain. Signed-off-by: Thara Gopinath Reviewed-by: Ulf Hansson --- drivers/base/power/domain.c | 37 +++++++++++++++++++++++++++++++++++++ include/linux/pm_domain.h | 13 +++++++++++++ 2 files changed, 50 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index cc85e87..507e530 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -408,6 +408,43 @@ int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state) } EXPORT_SYMBOL_GPL(dev_pm_genpd_set_performance_state); +int dev_pm_genpd_get_performance_state(struct device *dev) +{ + struct generic_pm_domain *genpd; + unsigned int state; + + genpd = dev_to_genpd_safe(dev); + if (IS_ERR(genpd)) + return -ENODEV; + + genpd_lock(genpd); + state = genpd->performance_state; + genpd_unlock(genpd); + + return state; +} +EXPORT_SYMBOL_GPL(dev_pm_genpd_get_performance_state); + +int dev_pm_genpd_performance_state_count(struct device *dev) +{ + struct generic_pm_domain *genpd; + int count; + + genpd = dev_to_genpd_safe(dev); + if (IS_ERR(genpd)) + return -ENODEV; + + if (unlikely(!genpd->get_performance_state_count)) + return -EINVAL; + + genpd_lock(genpd); + count = genpd->get_performance_state_count(genpd); + genpd_unlock(genpd); + + return count; +} +EXPORT_SYMBOL_GPL(dev_pm_genpd_performance_state_count); + static int _genpd_power_on(struct generic_pm_domain *genpd, bool timed) { unsigned int state_idx = genpd->state_idx; diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index baf02ff..e88e57f 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -117,6 +117,7 @@ struct generic_pm_domain { struct dev_pm_opp *opp); int (*set_performance_state)(struct generic_pm_domain *genpd, unsigned int state); + int (*get_performance_state_count)(struct generic_pm_domain *genpd); struct gpd_dev_ops dev_ops; s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ bool max_off_time_changed; @@ -204,6 +205,8 @@ int pm_genpd_init(struct generic_pm_domain *genpd, struct dev_power_governor *gov, bool is_off); int pm_genpd_remove(struct generic_pm_domain *genpd); int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state); +int dev_pm_genpd_get_performance_state(struct device *dev); +int dev_pm_genpd_performance_state_count(struct device *dev); extern struct dev_power_governor simple_qos_governor; extern struct dev_power_governor pm_domain_always_on_gov; @@ -251,6 +254,16 @@ static inline int dev_pm_genpd_set_performance_state(struct device *dev, return -ENOTSUPP; } +static inline int dev_pm_genpd_get_performance_state(struct device *dev) +{ + return -ENOTSUPP; +} + +static inline int dev_pm_genpd_performance_state_count(struct device *dev) +{ + return -ENOTSUPP; +} + #define simple_qos_governor (*(struct dev_power_governor *)(NULL)) #define pm_domain_always_on_gov (*(struct dev_power_governor *)(NULL)) #endif From patchwork Wed Nov 20 12:56:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11253771 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F2EF61871 for ; Wed, 20 Nov 2019 12:56:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D340D2251D for ; Wed, 20 Nov 2019 12:56:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="V3yYTK2+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729952AbfKTM4s (ORCPT ); Wed, 20 Nov 2019 07:56:48 -0500 Received: from mail-qv1-f65.google.com ([209.85.219.65]:37270 "EHLO mail-qv1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729957AbfKTM4r (ORCPT ); Wed, 20 Nov 2019 07:56:47 -0500 Received: by mail-qv1-f65.google.com with SMTP id s18so9651966qvr.4 for ; Wed, 20 Nov 2019 04:56:47 -0800 (PST) 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; bh=Bjn8ReEOuhGj9F9W8fuw8HgClV07G2HHM36EtHpy9gw=; b=V3yYTK2+0pBvo3Fs29fkJr+7+mmKEYMjFkE7Ka3SjI9crrpN1l2CayK3y0m4ygetZ3 nlTP0SZkttXLJbDk5AOuS6mH+hTEpZkfTBcG+NUhtj2fwrBaoGZCtzSWrQysLdKVzK6G 82BJ8fTCqtLxFEutXC0gQzqzT+b5UJC7ur3ECvk4P6L6747BLjqdVCcBzBeh0GFR44xO TI/nl70KdWfEcZ2jjkTNH1sWgohGuRtMyxavuy530AY0D8o3H4iRL+3+s1mBeoMlYguD CRTIxUPLmNgN3NAZR8vYGqsc8gqU5PIQyqE51k+aXurXAhWBYR/jx70NiwU8ZN6stAVZ Dg7Q== 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; bh=Bjn8ReEOuhGj9F9W8fuw8HgClV07G2HHM36EtHpy9gw=; b=F5jp2FtvQcFsxlLRmBjskR+uKxI9JFsIr6LPUwB74znA66SkwgasGHxWSUJ3VfZf2i aXwM17zo/TDBilAgaA2hxi8oMn2J3WaM/Hlv81RtTmb6sCn3FpG/V9idPzmCt7xXDohr 6/R61F0tcke0/F7z4ilb8ymgwdfj339fOHFxGdtnI/0Rh9urNOih4BRZ72PP8uk3aRSU 2vn3H5TipF+iUiKcBR/UwseSXo2fmF0R8DXw6Ptms5MsbhixRLqbpqn3Z/bbrCirTq8/ lPRPaff2xdub26hzF4KfJm6r3ghzETVTSU14qHtat9louz4xHthrZqKeNFuv0moD7hXu Xe3w== X-Gm-Message-State: APjAAAXPxfuCYDhNp/xtxo5dec/hTc2gL7qjcHvMaY/HvkQRAN3rIVT4 4r06Dxob3IiXkBDQvGJ6Ckw/DQ== X-Google-Smtp-Source: APXvYqxf+sKw7EwManApOCl7KSNRE1MiRk/sThSYeiR8bBGoNF0Mhv4ABmcOFKGpvjkgYskeZk0h+w== X-Received: by 2002:a0c:e947:: with SMTP id n7mr1303514qvo.103.1574254606578; Wed, 20 Nov 2019 04:56:46 -0800 (PST) Received: from Thara-Work-Ubuntu.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id r2sm14109637qtc.28.2019.11.20.04.56.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Nov 2019 04:56:44 -0800 (PST) From: Thara Gopinath To: edubezval@gmail.com, rui.zhang@intel.com, ulf.hansson@linaro.org, daniel.lezcano@linaro.org, bjorn.andersson@linaro.org, agross@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 v4 2/7] soc: qcom: rpmhpd: Introduce function to retrieve power domain performance state count Date: Wed, 20 Nov 2019 07:56:28 -0500 Message-Id: <1574254593-16078-3-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> References: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Populate .get_performace_state_count in genpd ops to retrieve the count of performance states supported by a rpmh power domain. Signed-off-by: Thara Gopinath Reviewed-by: Ulf Hansson --- drivers/soc/qcom/rpmhpd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/soc/qcom/rpmhpd.c b/drivers/soc/qcom/rpmhpd.c index 5741ec3..9d37534 100644 --- a/drivers/soc/qcom/rpmhpd.c +++ b/drivers/soc/qcom/rpmhpd.c @@ -285,6 +285,13 @@ static unsigned int rpmhpd_get_performance_state(struct generic_pm_domain *genpd return dev_pm_opp_get_level(opp); } +static int rpmhpd_performance_states_count(struct generic_pm_domain *domain) +{ + struct rpmhpd *pd = domain_to_rpmhpd(domain); + + return pd->level_count; +} + static int rpmhpd_update_level_mapping(struct rpmhpd *rpmhpd) { int i; @@ -373,6 +380,8 @@ static int rpmhpd_probe(struct platform_device *pdev) rpmhpds[i]->pd.power_on = rpmhpd_power_on; rpmhpds[i]->pd.set_performance_state = rpmhpd_set_performance_state; rpmhpds[i]->pd.opp_to_performance_state = rpmhpd_get_performance_state; + rpmhpds[i]->pd.get_performance_state_count = + rpmhpd_performance_states_count; pm_genpd_init(&rpmhpds[i]->pd, NULL, true); data->domains[i] = &rpmhpds[i]->pd; From patchwork Wed Nov 20 12:56:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11253791 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C2EE513A4 for ; Wed, 20 Nov 2019 12:57:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9BD7E22521 for ; Wed, 20 Nov 2019 12:57:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="I6Y1ofWc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729972AbfKTM4v (ORCPT ); Wed, 20 Nov 2019 07:56:51 -0500 Received: from mail-qv1-f68.google.com ([209.85.219.68]:33562 "EHLO mail-qv1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729970AbfKTM4u (ORCPT ); Wed, 20 Nov 2019 07:56:50 -0500 Received: by mail-qv1-f68.google.com with SMTP id x14so9644752qvu.0 for ; Wed, 20 Nov 2019 04:56:50 -0800 (PST) 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; bh=wtD/eNE9TAmXsnR2IF1O0WWLLWtlBArf0uI74fbpZrc=; b=I6Y1ofWcZLyq/uKNmdCCl9/kv6h14tQOGMfF99XIcPBr2zXYHDnctewepPWDp45hWX 34HWqvhN/ZLdDC4eL2yFrqN4yMwpNuPs2gY325lwOdWhGvbVEWeInv79vO8V8BfpLlkX 9JEpTyJJiI9ai+op+ZgJtoCD6l2BW8uOj5m+SZi84oFxc+s1N36WSISTqqDbSR4SkY6a tfA/Vovqqcwynhv5sqOdWM5nYh3U1PpHaSsYTvrcJq1FDcTgw41q2YDf8j/3KvRSqifa WQPZ9h2Zo2akBqX6c5sZPSkQ1wzwlOGpsiC5eE8v458CijsaEqC1+rSHLeM+GfHVRbN1 vovg== 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; bh=wtD/eNE9TAmXsnR2IF1O0WWLLWtlBArf0uI74fbpZrc=; b=RKIhJgOVBpa9PCHIXgBZQha/lJu3V8KqTl8vCKEXkZvKilN9YCGQVYzdbzUpn3HfEP mU1mOBUYKLzJ8DMMZazv9PuLX2zYMF8EV1zUSGq36aAIIUDernwvAgIgwfZqaTp2nYu+ 68jPhTIUTgNuLcUuhmslorPJj2+sFRJFBRY9DT+txmEbDb1sJoIcdLnZPd9/fqERhHPF WvYr6o69gUnl6FoA6SH8PMvBnCv3U6NbUtjEZ52BXHwPzr7sRyFrgt+o3xkIMrKlFjkk 48Hrf+qe4AF2LNsfJL15wjWddVFmQ3nJnhJt6hJZEM+ki6IMXgs5IOcbDtzHY1Sv0LjK sLGQ== X-Gm-Message-State: APjAAAV9hLgP28CaUF+V1Q1v9dG740m9JnBrYawwQh4SjC2WhbluW6qZ 8GoI8fpVthaCrz1LJ4ZIUdkMtQ== X-Google-Smtp-Source: APXvYqw24dE4Bpb6W+86oKmxzS/1gF4C2jq50860GAtv08Qo7BSTHHHRkgr+WA3BAD0STf18ppHdfg== X-Received: by 2002:ad4:404e:: with SMTP id r14mr2428885qvp.4.1574254609837; Wed, 20 Nov 2019 04:56:49 -0800 (PST) Received: from Thara-Work-Ubuntu.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id r2sm14109637qtc.28.2019.11.20.04.56.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Nov 2019 04:56:48 -0800 (PST) From: Thara Gopinath To: edubezval@gmail.com, rui.zhang@intel.com, ulf.hansson@linaro.org, daniel.lezcano@linaro.org, bjorn.andersson@linaro.org, agross@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 v4 3/7] thermal: core: Allow cooling devices to register a parent. Date: Wed, 20 Nov 2019 07:56:29 -0500 Message-Id: <1574254593-16078-4-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> References: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org With introduction of power domain warming devices, devices that control the power domain are registered as the parent of the cooling device so that the device-genpd hierarchy in kernel is maintained intact. To enable this, introduce a new API thermal_of_cooling_device_parent_register that takes a parent device pointer as input. Also, modify __thermal_cooling_device_register to register parent of a newly created cooling device, if specified. Signed-off-by: Thara Gopinath --- drivers/thermal/thermal_core.c | 22 +++++++++++++++++++--- include/linux/thermal.h | 15 +++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index d4481cc..912ba75 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -947,6 +947,7 @@ static void bind_cdev(struct thermal_cooling_device *cdev) */ static struct thermal_cooling_device * __thermal_cooling_device_register(struct device_node *np, + struct device *parent, const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { @@ -979,6 +980,8 @@ __thermal_cooling_device_register(struct device_node *np, cdev->ops = ops; cdev->updated = false; cdev->device.class = &thermal_class; + if (parent) + cdev->device.parent = parent; cdev->devdata = devdata; thermal_cooling_device_setup_sysfs(cdev); dev_set_name(&cdev->device, "cooling_device%d", cdev->id); @@ -1024,7 +1027,8 @@ struct thermal_cooling_device * thermal_cooling_device_register(const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { - return __thermal_cooling_device_register(NULL, type, devdata, ops); + return __thermal_cooling_device_register(NULL, NULL, type, + devdata, ops); } EXPORT_SYMBOL_GPL(thermal_cooling_device_register); @@ -1048,10 +1052,22 @@ thermal_of_cooling_device_register(struct device_node *np, const char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { - return __thermal_cooling_device_register(np, type, devdata, ops); + return __thermal_cooling_device_register(np, NULL, type, devdata, ops); } EXPORT_SYMBOL_GPL(thermal_of_cooling_device_register); +struct thermal_cooling_device * +thermal_of_cooling_device_parent_register(struct device_node *np, + struct device *parent, + const char *type, void *devdata, + const struct + thermal_cooling_device_ops *ops) +{ + return __thermal_cooling_device_register(np, parent, type, + devdata, ops); +} +EXPORT_SYMBOL_GPL(thermal_of_cooling_device_parent_register); + static void thermal_cooling_device_release(struct device *dev, void *res) { thermal_cooling_device_unregister( @@ -1088,7 +1104,7 @@ devm_thermal_of_cooling_device_register(struct device *dev, if (!ptr) return ERR_PTR(-ENOMEM); - tcd = __thermal_cooling_device_register(np, type, devdata, ops); + tcd = __thermal_cooling_device_register(np, NULL, type, devdata, ops); if (IS_ERR(tcd)) { devres_free(ptr); return tcd; diff --git a/include/linux/thermal.h b/include/linux/thermal.h index e45659c..ac5f268 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -448,6 +448,11 @@ struct thermal_cooling_device * thermal_of_cooling_device_register(struct device_node *np, const char *, void *, const struct thermal_cooling_device_ops *); struct thermal_cooling_device * +thermal_of_cooling_device_parent_register(struct device_node *np, + struct device *parent, + const char *, void *, const struct + thermal_cooling_device_ops *); +struct thermal_cooling_device * devm_thermal_of_cooling_device_register(struct device *dev, struct device_node *np, char *type, void *devdata, @@ -508,6 +513,16 @@ static inline struct thermal_cooling_device * thermal_of_cooling_device_register(struct device_node *np, char *type, void *devdata, const struct thermal_cooling_device_ops *ops) { return ERR_PTR(-ENODEV); } + +static inline struct thermal_cooling_device * +thermal_of_cooling_device_parent_register(struct device_node *np, + struct device *parent, + const char *, void *, const struct + thermal_cooling_device_ops *) +{ + return ERR_PTR(-ENODEV); +} + static inline struct thermal_cooling_device * devm_thermal_of_cooling_device_register(struct device *dev, struct device_node *np, From patchwork Wed Nov 20 12:56:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11253789 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A5F44188B for ; Wed, 20 Nov 2019 12:57:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E2572252A for ; Wed, 20 Nov 2019 12:57:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WD85C7u9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729985AbfKTM44 (ORCPT ); Wed, 20 Nov 2019 07:56:56 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:43193 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729984AbfKTM4z (ORCPT ); Wed, 20 Nov 2019 07:56:55 -0500 Received: by mail-qt1-f193.google.com with SMTP id j5so27357897qtn.10 for ; Wed, 20 Nov 2019 04:56:54 -0800 (PST) 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; bh=UM2VNIyhsEQWAdxoUvBsAp0FiOlz8ZfKGsaB/5AYX7U=; b=WD85C7u9NWEMbHwM/sjKEJ4ryfnNgTq8BlVICVvxRxopHEEe+V0gp1qsTJaBODoV7L 0qE3b01AwO9mamaPEukWnzpvRAICFGL7Y8V75jkkn9rrt7FV3M5EGCKxmLZkRM//MeLu DL8MqTPlzvfuO5j1DL1pl2mCM/ht/AVuL48lXY70xE6x0XbDx9px3UdYVm+4OPRzs+ma SVnyBCFwbqQu4TrVCYt28lHsyhxIzzrQhY1C5NU4YtVLv5/nnBpk4oDMYrgFeukxKudZ Q7lrhjUG0BvDr12OTGAnxAi5mtLuYnTL8xM4L2OxgzHcTj+BIHpX6RX18JQx3Y+DsrKi N0Ug== 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; bh=UM2VNIyhsEQWAdxoUvBsAp0FiOlz8ZfKGsaB/5AYX7U=; b=cQFc3c5Pxy7O/3rWTfe6IMdThSoioLH3DeJNds6h73CNUB9aU18reJpv7vvik9aNLG YayVllbAamf2PS1zUjn055GgCRyGxLqX9+az2nxirMVIjpfPUGTS4ygP1e/MVRQZa87g 5duYH/Ili5yIRgZ6yMJj3XY+s0VrJE0KNVsvPJxAbgSI5aMvHocNhKABDYcpUQXywyR0 FgLejPCkZrVzxeVKUHWVcnui02n/F/GHiQqxN99H8CNBeGqajddwinKqGUv/aYAXi08k grJHBW9dhzObbrLmIrWBmd1zzcUSUUhkEocY8s3VAp/WdvWQjCZjSPWXVEqC95IyLjUh 5J5g== X-Gm-Message-State: APjAAAVKw4ojkN37ewpW9D0AyFMIydFMzRhYk9d51OfjKsgQgrfeqI9L gKzhXW8j22Z+16ptasfVvly00F5YHHY= X-Google-Smtp-Source: APXvYqwCTITcGMrN0VxfpnmTjfH0pUcc1CbAhIlqWewcG1arkytYtpoX747E2f8lLjCTV79k0rI32A== X-Received: by 2002:ac8:288a:: with SMTP id i10mr2378040qti.139.1574254613445; Wed, 20 Nov 2019 04:56:53 -0800 (PST) Received: from Thara-Work-Ubuntu.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id r2sm14109637qtc.28.2019.11.20.04.56.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Nov 2019 04:56:51 -0800 (PST) From: Thara Gopinath To: edubezval@gmail.com, rui.zhang@intel.com, ulf.hansson@linaro.org, daniel.lezcano@linaro.org, bjorn.andersson@linaro.org, agross@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 v4 4/7] thermal: Add generic power domain warming device driver. Date: Wed, 20 Nov 2019 07:56:30 -0500 Message-Id: <1574254593-16078-5-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> References: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Resources modeled as power domains in linux kenrel can be used to warm the SoC(eg. mx power domain on sdm845). To support this feature, introduce a generic power domain warming device driver that can be plugged into the thermal framework (The thermal framework itself requires further modifiction to support a warming device in place of a cooling device. Those extensions are not introduced in this patch series). Signed-off-by: Thara Gopinath --- v3->v4: - Removed late_init hook pd_warming_device_ops. - Use of_genpd_add_device instead of pm_genpd_add_device to attach device to the generic power domain. - Use thermal_of_cooling_device_parent_register to register the cooling device so that the device with genpd attached can be made parent of the cooling device. - With above changes, remove reference to generic_pm_domain in pd_warming_device. drivers/thermal/Kconfig | 10 +++ drivers/thermal/Makefile | 2 + drivers/thermal/pwr_domain_warming.c | 138 +++++++++++++++++++++++++++++++++++ include/linux/pwr_domain_warming.h | 29 ++++++++ 4 files changed, 179 insertions(+) create mode 100644 drivers/thermal/pwr_domain_warming.c create mode 100644 include/linux/pwr_domain_warming.h diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 001a21a..0c5c93e 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -187,6 +187,16 @@ config DEVFREQ_THERMAL If you want this support, you should say Y here. +config PWR_DOMAIN_WARMING_THERMAL + bool "Power Domain based warming device" + depends on PM_GENERIC_DOMAINS_OF + help + This implements the generic power domain based warming + mechanism through increasing the performance state of + a power domain. + + If you want this support, you should say Y here. + config THERMAL_EMULATION bool "Thermal emulation mode support" help diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index 74a37c7..382c64a 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile @@ -27,6 +27,8 @@ thermal_sys-$(CONFIG_CLOCK_THERMAL) += clock_cooling.o # devfreq cooling thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o +thermal_sys-$(CONFIG_PWR_DOMAIN_WARMING_THERMAL) += pwr_domain_warming.o + # platform thermal drivers obj-y += broadcom/ obj-$(CONFIG_THERMAL_MMIO) += thermal_mmio.o diff --git a/drivers/thermal/pwr_domain_warming.c b/drivers/thermal/pwr_domain_warming.c new file mode 100644 index 0000000..40162b9 --- /dev/null +++ b/drivers/thermal/pwr_domain_warming.c @@ -0,0 +1,138 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019, Linaro Ltd + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct pd_warming_device { + struct thermal_cooling_device *cdev; + struct device dev; + int max_state; + int cur_state; + bool runtime_resumed; +}; + +static int pd_wdev_get_max_state(struct thermal_cooling_device *cdev, + unsigned long *state) +{ + struct pd_warming_device *pd_wdev = cdev->devdata; + + *state = pd_wdev->max_state; + return 0; +} + +static int pd_wdev_get_cur_state(struct thermal_cooling_device *cdev, + unsigned long *state) +{ + struct pd_warming_device *pd_wdev = cdev->devdata; + + *state = dev_pm_genpd_get_performance_state(&pd_wdev->dev); + + return 0; +} + +static int pd_wdev_set_cur_state(struct thermal_cooling_device *cdev, + unsigned long state) +{ + struct pd_warming_device *pd_wdev = cdev->devdata; + struct device *dev = &pd_wdev->dev; + int ret; + + ret = dev_pm_genpd_set_performance_state(dev, state); + + if (ret) + return ret; + + if (state && !pd_wdev->runtime_resumed) { + ret = pm_runtime_get_sync(dev); + pd_wdev->runtime_resumed = true; + } else if (!state && pd_wdev->runtime_resumed) { + ret = pm_runtime_put(dev); + pd_wdev->runtime_resumed = false; + } + + return ret; +} + +static struct thermal_cooling_device_ops pd_warming_device_ops = { + .get_max_state = pd_wdev_get_max_state, + .get_cur_state = pd_wdev_get_cur_state, + .set_cur_state = pd_wdev_set_cur_state, +}; + +struct thermal_cooling_device * +pwr_domain_warming_register(struct device *parent, char *pd_name, int pd_id) +{ + struct pd_warming_device *pd_wdev; + struct of_phandle_args pd_args; + int ret; + + pd_wdev = kzalloc(sizeof(*pd_wdev), GFP_KERNEL); + if (!pd_wdev) + return ERR_PTR(-ENOMEM); + + dev_set_name(&pd_wdev->dev, "%s_warming_dev", pd_name); + pd_wdev->dev.parent = parent; + + ret = device_register(&pd_wdev->dev); + if (ret) + goto error; + + pd_args.np = parent->of_node; + pd_args.args[0] = pd_id; + pd_args.args_count = 1; + + ret = of_genpd_add_device(&pd_args, &pd_wdev->dev); + + if (ret) + goto error; + + ret = dev_pm_genpd_performance_state_count(&pd_wdev->dev); + if (ret < 0) + goto error; + + pd_wdev->max_state = ret - 1; + pm_runtime_enable(&pd_wdev->dev); + pd_wdev->runtime_resumed = false; + + pd_wdev->cdev = thermal_of_cooling_device_parent_register + (NULL, parent, pd_name, pd_wdev, + &pd_warming_device_ops); + if (IS_ERR(pd_wdev->cdev)) { + pr_err("unable to register %s cooling device\n", pd_name); + pm_runtime_disable(&pd_wdev->dev); + ret = PTR_ERR(pd_wdev->cdev); + goto error; + } + + return pd_wdev->cdev; +error: + put_device(&pd_wdev->dev); + kfree(pd_wdev); + return ERR_PTR(ret); +} +EXPORT_SYMBOL_GPL(pwr_domain_warming_register); + +void pwr_domain_warming_unregister(struct thermal_cooling_device *cdev) +{ + struct pd_warming_device *pd_wdev = cdev->devdata; + struct device *dev = &pd_wdev->dev; + + if (pd_wdev->runtime_resumed) { + dev_pm_genpd_set_performance_state(dev, 0); + pm_runtime_put(dev); + pd_wdev->runtime_resumed = false; + } + pm_runtime_disable(dev); + thermal_cooling_device_unregister(cdev); + kfree(pd_wdev); +} +EXPORT_SYMBOL_GPL(pwr_domain_warming_unregister); diff --git a/include/linux/pwr_domain_warming.h b/include/linux/pwr_domain_warming.h new file mode 100644 index 0000000..cb6550d --- /dev/null +++ b/include/linux/pwr_domain_warming.h @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019, Linaro Ltd. + */ +#ifndef __PWR_DOMAIN_WARMING_H__ +#define __PWR_DOMAIN_WARMING_H__ + +#include +#include + +#ifdef CONFIG_PWR_DOMAIN_WARMING_THERMAL +struct thermal_cooling_device * +pwr_domain_warming_register(struct device *parent, char *pd_name, int pd_id); + +void pwr_domain_warming_unregister(struct thermal_cooling_device *cdev); + +#else +static inline struct thermal_cooling_device * +pwr_domain_warming_register(struct device *parent, char *pd_name, int pd_id) +{ + return ERR_PTR(-ENOSYS); +} + +static inline void +pwr_domain_warming_unregister(struct thermal_cooling_device *cdev) +{ +} +#endif /* CONFIG_PWR_DOMAIN_WARMING_THERMAL */ +#endif /* __PWR_DOMAIN_WARMING_H__ */ From patchwork Wed Nov 20 12:56:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11253779 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4DD75186D for ; Wed, 20 Nov 2019 12:57:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E0BC22521 for ; Wed, 20 Nov 2019 12:57:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MJg7O/TJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729999AbfKTM47 (ORCPT ); Wed, 20 Nov 2019 07:56:59 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:41570 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729996AbfKTM46 (ORCPT ); Wed, 20 Nov 2019 07:56:58 -0500 Received: by mail-qt1-f194.google.com with SMTP id o3so28780903qtj.8 for ; Wed, 20 Nov 2019 04:56:57 -0800 (PST) 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; bh=cANs+XnpVTcynqaWpfsqlgLUi206zYOAK/dPpz604Tg=; b=MJg7O/TJk2K7ImDXGKhqrX6U/5p9NJhHcTR2lgYkod0HwVASuMcrBcy1ud268D1N0k b2DS/xpDFR5YAuK9gax0enejq1T5tamnZ8BlkYMGQiTKk1hoZ2cWWFGKLnyO7XRNqAk3 X2eT+CKejP1VK0TLb9TgYC7hkvgabZXMkU58QZv2au1anvF4cKaueiWBiPbypQ1qPC9d n+5Dzl0MxwU4kNB+nZ7TBGH6r2EAin5d3mKUjddUcOYF/pi772AziGhySCkrF2rr36eF YVeJpqt5QSlqI87Ri1KT7vhgJURoS0RxUES9B8fQ4qdrvuJxqP8HZqWaJHhNOuUpMJUd pwbg== 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; bh=cANs+XnpVTcynqaWpfsqlgLUi206zYOAK/dPpz604Tg=; b=kMgHykr/03KFoUr31W90T3VLqS6kX1nFNPFm6v2tFWiRRFp5BtAc9Z/gypNXu7sEth bRSFvkTt59lrw4NJyic7W07vWz0HsuEd6QLn+mb3MA7MTTUS2/EcQ6gXCP9Aeh34jPUT 72BuwjeJ8jln+obTs1pX+ziO9/I4Md74dAMmj1L9w7H8Gi91LjIxqUeU7+sr87P58HNC 8SyTI1jVSKSV8ZD1PYo5tuL3a8TCeVLr96PGQOdvNW7vRGFWuVBYiJYwOebeGKwEKb+d Xn68e1+SVdN22IHm0BJ7kool4ABGLeKu1DnHUQVUjB2mNR2w3R0to/zJdvgb71YTDqA4 rzvg== X-Gm-Message-State: APjAAAVo1jsYN29MJcOZ0+lQ/I9bfMIz4RnUxNICh/Db/mjirY4S6LTP FV7kS9EEG5oHoci0W7ehg0lC+w== X-Google-Smtp-Source: APXvYqySn/aIs6hMGIqMIcxxfm7tqJHVK7kXXyzjWECMU9RJJqSgIfBzONFBB7sckH/Ezcbxla3Keg== X-Received: by 2002:ac8:542:: with SMTP id c2mr2363165qth.56.1574254617325; Wed, 20 Nov 2019 04:56:57 -0800 (PST) Received: from Thara-Work-Ubuntu.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id r2sm14109637qtc.28.2019.11.20.04.56.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Nov 2019 04:56:55 -0800 (PST) From: Thara Gopinath To: edubezval@gmail.com, rui.zhang@intel.com, ulf.hansson@linaro.org, daniel.lezcano@linaro.org, bjorn.andersson@linaro.org, agross@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 v4 5/7] soc: qcom: Extend RPMh power controller driver to register warming devices. Date: Wed, 20 Nov 2019 07:56:31 -0500 Message-Id: <1574254593-16078-6-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> References: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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. Signed-off-by: Thara Gopinath Reviewed-by: Ulf Hansson --- 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; + + 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); From patchwork Wed Nov 20 12:56:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11253777 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3EEE213A4 for ; Wed, 20 Nov 2019 12:57:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E75122520 for ; Wed, 20 Nov 2019 12:57:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hNV6ICs5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730012AbfKTM5C (ORCPT ); Wed, 20 Nov 2019 07:57:02 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:33667 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729971AbfKTM5B (ORCPT ); Wed, 20 Nov 2019 07:57:01 -0500 Received: by mail-qk1-f194.google.com with SMTP id 71so21134346qkl.0 for ; Wed, 20 Nov 2019 04:57:00 -0800 (PST) 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; bh=z4ssK7JBCpbD6bi+mRUWzSmv0ifU6DEy28XSn5k5sZs=; b=hNV6ICs5UGYvgFnOyufx/4UHKvv5yVwhD9gYoCz8z+Y9+JIGFkmp+2BQLpVz6GSbZO wI1uN9CrEXJ9q+bYeF0657TDzwMRsgQ0ig6oE5fyDIelnNuNvI3kBKpppEsSW44ZaTyr AQesMDm9xX/9Hdgz3xn/TvEqHQ25xPu4WqHTBTtDSix50d1nClk5FqjKfYQaorn54zNj vWv47tvOelxdJxhPeB176mvNbCjFGZged8aZK1mghaaV3qZ+IxtzEigBK5yfkDz7fWz9 diaqXjNjfCvsGJ6pIfO8mZPqYDEThb20/l5O3+bMe44zeLXeiqPfT+TmafIezKOVejtl QnTw== 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; bh=z4ssK7JBCpbD6bi+mRUWzSmv0ifU6DEy28XSn5k5sZs=; b=bQ0dnv2BJp00xSEtVL+krI4wBTYVLwCOYE3aIhoC/IYPN3OhTwyteYuXjUTbKUco8D qfWFAl9ds0yI0NwAjcODpTtr9abOUvkv5wpxtsjaZU0dO0GQpi/7V/2yse+3A/0rZvJF lLRtUs9fNkaaeGFog+Z7q+AktX9dMmWnlnq9i1SE9IYigdym4ZX/pcGJ6ExP4NMljBBa uIziP41VrMiEfDeYcrTkUY5Sh0jMTKXO5NkOnzufIBt9f7R4ZvJA16UsxpMMXp+Ua1z1 WqplEvfaxw+3MXtd4UVHDKCcLg2o3f7pmVz0UCTL6IJlX/eAlipCdCo833+W5Kk/UNAp OTZg== X-Gm-Message-State: APjAAAXS2ODeTyi5ouGVtqMWTiCor8yF68Ap4Sg2zuLgLS+HRaCp2+4y 4IofJQ3S9z56gvDCOAT1I/UPSg== X-Google-Smtp-Source: APXvYqx/E5etm3hWvVlli7RF8886y86fqgHfkP0XBa0wut8QU/VTWJx86gXNc8XIyaSYy4rLEq1uXg== X-Received: by 2002:ae9:ef0b:: with SMTP id d11mr2206623qkg.68.1574254620425; Wed, 20 Nov 2019 04:57:00 -0800 (PST) Received: from Thara-Work-Ubuntu.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id r2sm14109637qtc.28.2019.11.20.04.56.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Nov 2019 04:56:58 -0800 (PST) From: Thara Gopinath To: edubezval@gmail.com, rui.zhang@intel.com, ulf.hansson@linaro.org, daniel.lezcano@linaro.org, bjorn.andersson@linaro.org, agross@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 v4 6/7] dt-bindings: soc: qcom: Extend RPMh power controller binding to describe thermal warming device Date: Wed, 20 Nov 2019 07:56:32 -0500 Message-Id: <1574254593-16078-7-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> References: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org RPMh power controller hosts mx domain that can be used as thermal warming device. Add #cooling-cells property to the power domain provider node to indicate this. Signed-off-by: Thara Gopinath Acked-by: Rob Herring Reviewed-by: Ulf Hansson --- v3->v4: - Removed subnode to indicate that mx power domain is a warming device. Instead #cooling-cells is used as a power domain provider property to indicate if the provider hosts a power domain that can be used as a warming device. Documentation/devicetree/bindings/power/qcom,rpmpd.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/power/qcom,rpmpd.txt b/Documentation/devicetree/bindings/power/qcom,rpmpd.txt index bc75bf4..a193d33 100644 --- a/Documentation/devicetree/bindings/power/qcom,rpmpd.txt +++ b/Documentation/devicetree/bindings/power/qcom,rpmpd.txt @@ -19,6 +19,11 @@ Required Properties: Refer to for the level values for various OPPs for different platforms as well as Power domain indexes +Optional Properties + - #cooling-cells: must be 2 + RPMh also hosts power domains that can behave as thermal warming + device. If so, indicate this by specifying #cooling-cells. + Example: rpmh power domain controller and OPP table #include From patchwork Wed Nov 20 12:56:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 11253783 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D9F313A4 for ; Wed, 20 Nov 2019 12:57:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0D4BD22520 for ; Wed, 20 Nov 2019 12:57:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jGdbKr2T" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730019AbfKTM5I (ORCPT ); Wed, 20 Nov 2019 07:57:08 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:33362 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730027AbfKTM5F (ORCPT ); Wed, 20 Nov 2019 07:57:05 -0500 Received: by mail-qt1-f193.google.com with SMTP id y39so28847894qty.0 for ; Wed, 20 Nov 2019 04:57:03 -0800 (PST) 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; bh=gtYgZsKdjWgKCLPuHgoMJ2eNbNG78NE68Q155qN82Ug=; b=jGdbKr2TED35aioqiqlsFcPudOG7cyQVE8+ZKhJapv6KOePem9zkOJoCl1+xmbSFZd 3Q1WLQAYXerCakAyxDej/i6/C0jfkafUUU9MZzFDq8WYmMQxnZZFjjEzGqnSc+kFxk/r Hq04BqVbcW9zp26Jbq1Dr2q9wFOWSlOWbEABb/tNcGOJzbygqL3sWIHAGyYYOwQ+Xi8h I/8SL4SnBPPb1Tq7d0A3X4E8ztaLuSp9DHAkEiMWHpT875qrb8xYGi1dGi19gF5T7RwS kOo4DPafrI4uFo/yxuFDuq1UvxqfascRNd0eGuLjPW+HU632Nql7sXT+nOq0v/wIQmgu UyHA== 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; bh=gtYgZsKdjWgKCLPuHgoMJ2eNbNG78NE68Q155qN82Ug=; b=ddpssaTIMiG60pBGbzqxXjyhArgWkcJ/n/DlE62ostHespi/DwvvhIur3C5ZNixGDv 6AtwDmIRZ87Bo0eUOoKRARxzBJiBbn6c7SVG40h7nQYPadIYfu6GJ+6iwhst2lwB6BZW 0WB6jYO6JnIACbJeXtMKY/MFX+8GeIy5X4iWZE/pKv2Ab62jQJGxDuR0AunRlJv1DWGy 4piwRLQUmvVyCFBcSa2sEwNwPTfLec8C0zsgfJ5DSHkrdx1rXnlMekSt/R6RwgsGoN9Q cZ3lJ9zZU4dob69wkyMMvrBkKSXjKJwF2bEhIpO9f/iLOis18J3hfd4cKEniJiB7VCxG Z4oQ== X-Gm-Message-State: APjAAAU7NzEvtZ+LKBv03l4Tsmvas4hkg/V0IAnSCackHBFW31vi7Uae XWDrHkVcmYMKpIJ0JglDAAHjDQ== X-Google-Smtp-Source: APXvYqyrW8nUtaIuzKEjvmVZtBqF9yXQRwNnUnQSVpoxtCSbI9LpsbmrAPc1ye5t5YVnlTR8qlWrMw== X-Received: by 2002:aed:33c2:: with SMTP id v60mr2423209qtd.168.1574254623419; Wed, 20 Nov 2019 04:57:03 -0800 (PST) Received: from Thara-Work-Ubuntu.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id r2sm14109637qtc.28.2019.11.20.04.57.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Nov 2019 04:57:01 -0800 (PST) From: Thara Gopinath To: edubezval@gmail.com, rui.zhang@intel.com, ulf.hansson@linaro.org, daniel.lezcano@linaro.org, bjorn.andersson@linaro.org, agross@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 v4 7/7] arm64: dts: qcom: Indicate rpmhpd hosts a power domain that can be used as a warming device. Date: Wed, 20 Nov 2019 07:56:33 -0500 Message-Id: <1574254593-16078-8-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> References: <1574254593-16078-1-git-send-email-thara.gopinath@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org RPMh hosts mx power domain that can be used to warm up the SoC. Indicate this by using #cooling-cells property. Signed-off-by: Thara Gopinath Reviewed-by: Ulf Hansson --- v3->v4: - Removed subnode to indicate that mx power domain is a warming device. Instead #cooling-cells is used as a power domain provider property to indicate if the provider hosts a power domain that can be used as a warming device. arch/arm64/boot/dts/qcom/sdm845.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi index 23260a0..71d6f91 100644 --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi @@ -3118,6 +3118,7 @@ rpmhpd: power-controller { compatible = "qcom,sdm845-rpmhpd"; #power-domain-cells = <1>; + #cooling-cells = <2>; operating-points-v2 = <&rpmhpd_opp_table>; rpmhpd_opp_table: opp-table {