From patchwork Mon Jan 21 15:40:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156211 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6514767jaa; Mon, 21 Jan 2019 07:42:40 -0800 (PST) X-Google-Smtp-Source: ALg8bN6SIZGQPW6yvaMbuppXM1UcZmOCF/3l3NS1++vc+sDqZeB6onr7ooMlmzACKb4pw5o3ckRv X-Received: by 2002:a17:902:2969:: with SMTP id g96mr30467480plb.295.1548085360420; Mon, 21 Jan 2019 07:42:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548085360; cv=none; d=google.com; s=arc-20160816; b=qjLuUCeRh09UbpYGKX/BvDoXkwMIGPA65Z+FJ9M5s+E/VHglz5CzdorJho4ozxTSGw ufq+r3ZdYtKCT7VocEWYnZy8TnGeO680Yri+KxsqRnj2Q01+z0C+9jb8wCk4Bz85DEqH RV7DbvbkRfjdLAxu3ScHReGyE7ekoc7oWatciGIKvZYF55wfWeITURFBFMh+XCwllALq KDQuE5KUxB14MVr171Yd0Pd8xw/+7Z6PtlhxK27EbXUs9ioBuRZwP4ehG6yogWoE6p7k LXlBWP9ohRvq5QJZET9KP7wA6TDsNab8zrOMe1/UB2FgKTv6TZ2ARUOC1oGbtFB+sIRP hPsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=mOHRY9GecvR+zxuWJYSMLBDQ2KcwLpDTRI+yrgkHn2w=; b=VEoHNy5wYuFKOQ73gDrBOb4ljFDkWuSdvWVr8vjXdgoUQFf9Drrapkem7nlHAwr+q2 ZfxZUeZpLJiJVp17z+MY5IVT5oXk/AFwaPt+JEZkGj8K0bFe0gFuCucQxurx0WYN7fpR bp+9SXNs6f1L8peHQ6+WdsGlBFklMHC/APrFN8RV2ZRN+pJdEtPXwP54o/qP7Jls6X0J F7LSTNKgNHaYdmMGb8svelqWNyIn16mvtM8CzoXjnFJnwU+UwF+Nq1rjoA+nSuzgY24R O9F7SiebTi5sxhLn9vj7TTNuoblyzaiTX3DWAh4EFPvC3kxx1m1JMANqxfgJUl8I9TBd kSow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="fR/Gwm5u"; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 c21si12316502plo.165.2019.01.21.07.42.40; Mon, 21 Jan 2019 07:42:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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="fR/Gwm5u"; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1729864AbfAUPmj (ORCPT + 11 others); Mon, 21 Jan 2019 10:42:39 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:56285 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728807AbfAUPmj (ORCPT ); Mon, 21 Jan 2019 10:42:39 -0500 Received: by mail-wm1-f68.google.com with SMTP id y139so11165454wmc.5 for ; Mon, 21 Jan 2019 07:42:38 -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 :in-reply-to:references; bh=mOHRY9GecvR+zxuWJYSMLBDQ2KcwLpDTRI+yrgkHn2w=; b=fR/Gwm5uDyVf8kvr7f/Rw+Or8RDtRiDTXnbpdc5hGFstxhrTrpkL+utGhNw6JbRWJ5 92PsbST9aFJTObXUv5gw86T8+fuD1QF9SgnC1v7qnKqLqyQbUn9K2It1FwHfRSATE4GD /EbNTH+2oc1l8/DiC2tkH6PAlsWStqza59+A4= 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:in-reply-to:references; bh=mOHRY9GecvR+zxuWJYSMLBDQ2KcwLpDTRI+yrgkHn2w=; b=cePhq7QHj9HrdWmCwDv6m281XohVXEhMb4n8UbbzRz+BWNi4KgAPJSeuQ3Do66FqlB mmZieDXyzBda6EVCN2Z97Jhq9sN2oDnsw81SQRG1qbI+WZtFA/eJy/bP1L2wqneSzQ6o 06Jt+jHW7oTgwVLZpjUQLrNjW27tJKuV2VcfVqegdFlizppIUiLYhCpZuefhRU9zbbEB gV7Fx1gC68rICWAiwMjNZZIWUkLakZC/xjZwT+VuT8c4mppwVVX3JW9OghqCR4agSMbL t2UQZ/VP98YI4/ecc0pjIRRnRXfCnn4BLX8AkVfpmRPj40zAp1fthnixtn4WKG9zFFMW GdHQ== X-Gm-Message-State: AJcUukeT7gk7QLVGZaKubX0GfO7KqCegwG28LvUayn/+COPbSxHTcSnx ZW+/rBS4Ldo79j8BJsulqo+EsA== X-Received: by 2002:a1c:c008:: with SMTP id q8mr22990286wmf.99.1548085357709; Mon, 21 Jan 2019 07:42:37 -0800 (PST) Received: from localhost ([49.248.61.1]) by smtp.gmail.com with ESMTPSA id n127sm57377257wmd.20.2019.01.21.07.42.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 07:42:37 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, viresh.kumar@linaro.org, edubezval@gmail.com, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, Zhang Rui , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v2 1/9] thermal: cpu_cooling: Require thermal core to be compiled in Date: Mon, 21 Jan 2019 21:10:26 +0530 Message-Id: <3f3e38e55c2de4b730fd7c6aa30c125f3a6a8704.1548084260.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The CPU cooling driver (cpu_cooling.c) allows the platform's cpufreq driver to register as a cooling device and cool down the platform by throttling the CPU frequency. In order to be able to auto-register a cpufreq driver as a cooling device from the cpufreq core, we need access to code inside cpu_cooling.c which, in turn, accesses code inside thermal core. CPU_FREQ is a bool while THERMAL is tristate. In some configurations (e.g. allmodconfig), CONFIG_THERMAL ends up as a module while CONFIG_CPU_FREQ is compiled in. This leads to following error: drivers/cpufreq/cpufreq.o: In function `cpufreq_offline': cpufreq.c:(.text+0x407c): undefined reference to `cpufreq_cooling_unregister' drivers/cpufreq/cpufreq.o: In function `cpufreq_online': cpufreq.c:(.text+0x70c0): undefined reference to `of_cpufreq_cooling_register' Given that platforms using CPU_THERMAL usually want it compiled-in so it is available early in boot, make CPU_THERMAL depend on THERMAL being compiled-in instead of allowing it to be a module. Suggested-by: Rafael J. Wysocki Signed-off-by: Amit Kucheria --- drivers/thermal/Kconfig | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 30323426902e..58bb7d72dc2b 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -152,6 +152,7 @@ config CPU_THERMAL bool "generic cpu cooling support" depends on CPU_FREQ depends on THERMAL_OF + depends on THERMAL=y help This implements the generic cpu cooling mechanism through frequency reduction. An ACPI version of this already exists From patchwork Mon Jan 21 15:40:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156212 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6515642jaa; Mon, 21 Jan 2019 07:43:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN5EQ3nHcxiKqhltwHksYlfflg3M1nxLIWaXKsqajrho1LN5qMjNk31SWXGQsooqWXk0oWXg X-Received: by 2002:a62:cd1:: with SMTP id 78mr30132061pfm.219.1548085418901; Mon, 21 Jan 2019 07:43:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548085418; cv=none; d=google.com; s=arc-20160816; b=LM8/JnAcEtxJlEwU2y+MMwYPrRjPiAuLZ6GLaeYqr7u5mV8SImDBbtKDB8F1Hrbb2U Egr/lhBcVguekB6slfNKO2LufKABD/IsKOqVhuA0tc44IPXU4EUsZYh7iae4uroqPh1E VMnI5lxlLNgPeFaY0lQNNmp6kgxq9oSkPrkD7PWdC+1VOY0jCpMZT4jX4nYcvZxTHHaR bx6b2T2qYg/A7cRiAaGivmnhEDphzcjEircX0WsZped86RnTz2C5vqfqk620cwGR5qeB V2pNqv6pMhq+NY7OfCBCeQDsZrbHE2SvgMrUewb/AA9QwnXKz+g80pIb4CSzUQscBH1j HE2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=6nK5Z7skk0g3LC/CfG1f/AiMAh85ZzuJOt+3kzqjet0=; b=YUvG1fzw9rYTdkHoIvveAmMBCDrUcCqb5XVoAhm2i9Cemp3oUAADkrg9Dg7XdRccSz NlTispRq+phFLu/CO3CW2AcZlLXkQdkg7vGH2T6HzN2cWZMcsHNHmJW66lYCP4bF3ueu lHCjUltqHaOTMsaly7CQU9NggxRzMjKW4DK9njoUQxcEyjS+KoWHq7q0TWusTkKSU3zz KfIWGg62sIaGTb5HilsEn6Ma6511BduJwQVK36BIN7kk3aHZJXgNEfuqEAC+qhAzxPv+ HbCO+TnWnEjgzERXAkLA/lFJM5iKZ0pmV+dPB2VVcH5sxdSz3jDfeIZql7TloyWbxXOM skVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BCtyzqGC; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 q24si11853704pgi.334.2019.01.21.07.43.38; Mon, 21 Jan 2019 07:43:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=BCtyzqGC; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1729220AbfAUPni (ORCPT + 11 others); Mon, 21 Jan 2019 10:43:38 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:37559 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728822AbfAUPnh (ORCPT ); Mon, 21 Jan 2019 10:43:37 -0500 Received: by mail-wm1-f68.google.com with SMTP id g67so11214633wmd.2 for ; Mon, 21 Jan 2019 07:43:36 -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 :in-reply-to:references; bh=6nK5Z7skk0g3LC/CfG1f/AiMAh85ZzuJOt+3kzqjet0=; b=BCtyzqGCEaRnpexFp/8u0S0xLLNlc/eLc1RE+1luRPpgO2HLYQY+VS2oWTHdcc0HQ3 4jh6sm6O35/GKcPGP0A+eYmGY1PVK7xR2w9iULuvIWlZgTcZNuJgD4TQoD9hELoHNXTV Ffh+LqclWWKwo+HtTeTnZv0GYrSmMHfCI4wGo= 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:in-reply-to:references; bh=6nK5Z7skk0g3LC/CfG1f/AiMAh85ZzuJOt+3kzqjet0=; b=YPiZwEWWzjVxsLgm1Zj1jxnPk1eDYfiKhIx+l+30E+cSnZr6BAtTMFccIGAgcQiyga JR9pB6sA/VHsPEI7y3Yi3e2FInp1X7raKsUuKGhloSNZpIQQpyDuR7RZd6RSBotZFwj/ S1/V+9izseiqRpmVfSOQD1lm6xNek3k59Qmhxn7ruPzPAbyAV3+P33hZsAxtUJ1XTKoy hPZ0QOrKUpQg8SS+r9f//3tr8WTXynp0/juaWhEwdkm6H9uy821chUqtUxqh7dqr7oGg 0bS3RHkPtz20dbigjOQbrSZo+4XQP4K3MJPb9gU6EUr0JW1lpkZqGXWnxEoNtMReGZCT XDSw== X-Gm-Message-State: AJcUukfjiJtf6HbCkzUwit9NUtJVd8E/yo7AqVb7Fi+oZZ1EU7fr4Vq4 rUw0D3ytUcopvMYH6yJPOPlAaw== X-Received: by 2002:a1c:7511:: with SMTP id o17mr24971901wmc.42.1548085415973; Mon, 21 Jan 2019 07:43:35 -0800 (PST) Received: from localhost ([49.248.61.1]) by smtp.gmail.com with ESMTPSA id n15sm76230608wrt.21.2019.01.21.07.43.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 07:43:35 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, viresh.kumar@linaro.org, edubezval@gmail.com, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, "Rafael J. Wysocki" , Ingo Molnar , Sudeep Holla , Tao Wang , linux-pm@vger.kernel.org Subject: [PATCH v2 2/9] cpufreq: Auto-register the driver as a thermal cooling device if asked Date: Mon, 21 Jan 2019 21:10:27 +0530 Message-Id: <0036de796308b8919eac74a9a910f0d7b9c0cbf8.1548084260.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org All cpufreq drivers do similar things to register as a cooling device. Provide a cpufreq driver flag so drivers can just ask the cpufreq core to register the cooling device on their behalf. This allows us to get rid of duplicated code in the drivers. In order to allow this, we add a struct thermal_cooling_device pointer to struct cpufreq_policy so that drivers don't need to store it in a private data structure. Suggested-by: Stephen Boyd Suggested-by: Viresh Kumar Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke Tested-by: Matthias Kaehlcke --- drivers/cpufreq/cpufreq.c | 6 ++++++ include/linux/cpufreq.h | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+) -- 2.17.1 diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index e35a886e00bc..cf1be057caf4 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1318,6 +1318,9 @@ static int cpufreq_online(unsigned int cpu) if (cpufreq_driver->ready) cpufreq_driver->ready(policy); + if (cpufreq_driver->flags & CPUFREQ_AUTO_REGISTER_COOLING_DEV) + register_cooling_device(policy); + pr_debug("initialization complete\n"); return 0; @@ -1405,6 +1408,9 @@ static int cpufreq_offline(unsigned int cpu) goto unlock; } + if (cpufreq_driver->flags & CPUFREQ_AUTO_REGISTER_COOLING_DEV) + unregister_cooling_device(policy); + if (cpufreq_driver->stop_cpu) cpufreq_driver->stop_cpu(policy); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index bd7fbd6a4478..02fc9f210aee 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -151,6 +152,11 @@ struct cpufreq_policy { /* For cpufreq driver's internal use */ void *driver_data; + +#ifdef CONFIG_CPU_THERMAL + /* Pointer to the cooling device if used for thermal mitigation */ + struct thermal_cooling_device *cdev; +#endif }; /* Only for ACPI */ @@ -386,6 +392,12 @@ struct cpufreq_driver { */ #define CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING BIT(6) +/* + * Set by drivers that want the core to automatically register the cpufreq + * driver as a thermal cooling device. + */ +#define CPUFREQ_AUTO_REGISTER_COOLING_DEV BIT(7) + int cpufreq_register_driver(struct cpufreq_driver *driver_data); int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); @@ -415,6 +427,19 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy) policy->cpuinfo.max_freq); } +#ifdef CONFIG_CPU_THERMAL +static inline void register_cooling_device(struct cpufreq_policy *policy) { + policy->cdev = of_cpufreq_cooling_register(policy); +} + +static inline void unregister_cooling_device(struct cpufreq_policy *policy) { + cpufreq_cooling_unregister(policy->cdev); + policy->cdev = NULL; +} +#else +static inline void register_cooling_device(struct cpufreq_policy *policy) {} +static inline void unregister_cooling_device(struct cpufreq_policy *policy) {} +#endif #ifdef CONFIG_CPU_FREQ void cpufreq_suspend(void); void cpufreq_resume(void); From patchwork Mon Jan 21 15:40:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156215 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6516868jaa; Mon, 21 Jan 2019 07:45:01 -0800 (PST) X-Google-Smtp-Source: ALg8bN6viBFVA2xXHqbbo3/+6CpirtfKfQ+a5P8Zg6yqT7e9thc9Q0mRNCif5kJxCVm6a/+CU7Lq X-Received: by 2002:a63:2f86:: with SMTP id v128mr27771629pgv.407.1548085501454; Mon, 21 Jan 2019 07:45:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548085501; cv=none; d=google.com; s=arc-20160816; b=g/o+2mHbLH3S+fwaTeetQILP7RVIx5yuE7sVAc+hP4BkWIY7Lq4HqrBHEDUXkgUHbN X7qFEdAAc0iJpvVIdUWaLHZHw5R7Cq/3+P/UFJzmlF29xdzpvVmeSZ+9dnLHWK75U8eu ZPg2DahZpesuONghHkn0TcJnOO4dlVgKT27aP0LKR3UQ6TzMq8U8COvOLAaGbeVJhZVQ aSYy3gXunUoKfBx90J4BlSrHoMzOJb3CfMXqcW+FAnsTukvORAshDu8ZOpU68AT3No/h 1TDrI6T3KSmv0LAvBSFMlhsE+IdwqJzIAlDWc0BWioNKuJ7CPKTyK5w+N6YQHsSLYIjR QkMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=7flkZLLLMPKnUBob6lG91eyXS2wXjEuVdEl94VSGgUQ=; b=CVpXec1B/mpPilBp6VNLRpE4YHh63wJx5vBYnNPN8aiFCLOZzPEhF7s+TFgYtj6gC+ muKmFJ59q8c8ITDlDd82pp7tIq1r8sEfrhOwTgpzJ34Qs5eFgc+KKUVKaDQP/f0/xCGp zxGZWKuZlRwmISwfCuaaE7yyt3Ph69LpEGLtM0FKS0pqrDIiWMuoL7SCPcDB+zuHZL8o LX5Yjsb8+i5rU/a/sMDYkqOhZVpoC3N07qa8TSlDiswYeLcmGWwTGn4T4w97eOrg+zd6 /WKiPKGo7IJpXIjn/QDfuxA/2bnLPwgt88JJ9Ga7YvNhmX2V/TKIJt3zaNL5+LsrbQnA pLqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ddUlkaot; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 c8si12869020pgl.507.2019.01.21.07.45.01; Mon, 21 Jan 2019 07:45:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=ddUlkaot; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1729495AbfAUPpA (ORCPT + 11 others); Mon, 21 Jan 2019 10:45:00 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:45528 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729693AbfAUPpA (ORCPT ); Mon, 21 Jan 2019 10:45:00 -0500 Received: by mail-wr1-f67.google.com with SMTP id t6so23860594wrr.12 for ; Mon, 21 Jan 2019 07:44:59 -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 :in-reply-to:references; bh=7flkZLLLMPKnUBob6lG91eyXS2wXjEuVdEl94VSGgUQ=; b=ddUlkaotAvscldn0MmLEbEqHzkIGbCFbOPH+e2rnlqcruhdW78Lor2TPKnbHQkyTMZ GvAoYrLpzH9BGIynmLGPgbNMQ3oIaybxfU/wKVh1MVqSxQikPDj56p7/33QBn04ERiuZ RKVCit96wOBni6MRofqJHa13XkmdI0W5wYLog= 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:in-reply-to:references; bh=7flkZLLLMPKnUBob6lG91eyXS2wXjEuVdEl94VSGgUQ=; b=tCxQ58lzzl76u+CAlIcsY+UVD0G/nkOOx9HA/R6VNDQZxqcwnfvKoSXszuMZXUcLsX EB1RYhCkRVlQT+Vnwq9+713OBeDokRodX+GR/pb27GsYD3zItM0XsYaPp0MG4HMa8Se+ Zt5BtfsYfY3ZnkKBONEWEEFNyEnFtY8h0JFbT0VS7wDjT1/ZJ6BfN8kLhp1u86L9keFg fIxOuWVlIPyjgRIaqEx8lN+3b0i4ZeQGesA8LXme5pjez6A66ZJ7XwHMAKOEGflDUTAn F2eRrUB3VNKHkqBQUZWVgPpf6Ko9+ZJ2y+Eu9/hIBtUj87UmSpgNNbEsoQ5yt+BAAf8C z8pQ== X-Gm-Message-State: AJcUukclHP92jAjHITRhoU2IsBkzeAuTsv6fy5egWnvA0n9ZayMHDg3Z wZYP8+XVzLd2TxaXYQu9EFTe4Q== X-Received: by 2002:a05:6000:100f:: with SMTP id a15mr29546048wrx.298.1548085498604; Mon, 21 Jan 2019 07:44:58 -0800 (PST) Received: from localhost ([49.248.61.1]) by smtp.gmail.com with ESMTPSA id t199sm35306565wmt.1.2019.01.21.07.44.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 07:44:58 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, viresh.kumar@linaro.org, edubezval@gmail.com, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, "Rafael J. Wysocki" , linux-pm@vger.kernel.org Subject: [PATCH v2 5/9] cpufreq: cpufreq-dt: Use auto-registration of thermal cooling device Date: Mon, 21 Jan 2019 21:10:30 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use the CPUFREQ_AUTO_REGISTER_COOLING_DEV flag to allow cpufreq core to automatically register as a thermal cooling device. This allows removal of boiler plate code from the driver. Signed-off-by: Amit Kucheria --- drivers/cpufreq/cpufreq-dt.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index e58bfcb1169e..2a4c4ea7980b 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -13,7 +13,6 @@ #include #include -#include #include #include #include @@ -30,7 +29,6 @@ struct private_data { struct opp_table *opp_table; struct device *cpu_dev; - struct thermal_cooling_device *cdev; const char *reg_name; bool have_static_opps; }; @@ -301,7 +299,6 @@ static int cpufreq_exit(struct cpufreq_policy *policy) { struct private_data *priv = policy->driver_data; - cpufreq_cooling_unregister(priv->cdev); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); if (priv->have_static_opps) dev_pm_opp_of_cpumask_remove_table(policy->related_cpus); @@ -314,21 +311,14 @@ static int cpufreq_exit(struct cpufreq_policy *policy) return 0; } -static void cpufreq_ready(struct cpufreq_policy *policy) -{ - struct private_data *priv = policy->driver_data; - - priv->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver dt_cpufreq_driver = { - .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK, + .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_AUTO_REGISTER_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .target_index = set_target, .get = cpufreq_generic_get, .init = cpufreq_init, .exit = cpufreq_exit, - .ready = cpufreq_ready, .name = "cpufreq-dt", .attr = cpufreq_dt_attr, .suspend = cpufreq_generic_suspend, From patchwork Mon Jan 21 15:40:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156217 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6517324jaa; Mon, 21 Jan 2019 07:45:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN6iqpAiBEEXNJdwOdl3zcZHZukPUE0hxuLCEbYMrItFhQUqkywETQTSuyzeQ6O+AGZiLFkT X-Received: by 2002:a17:902:b83:: with SMTP id 3mr29299233plr.42.1548085534993; Mon, 21 Jan 2019 07:45:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548085534; cv=none; d=google.com; s=arc-20160816; b=uqoDgsLX7OZnKcGTyPvS0wZwPoNzhffP/FIYRpUuKe4Km1RkcecTSDUrvgP66ey1/O cvt03AZsHDVPETNBtcqkUf+Y+tySaRBvh0p05oewWDnSYOdOKLP5smH7+EQlKa3qR4HK 4Tcl8visDWQg7paduqxP/gpG4sDJDePKLjtQwLMPQF6A1dZHiSFpHwzFuY2EhgRFAU2I uNn0PEZkAe5CvoP4IwP9XslD1ZCfBiyWQSjruuKlrsI7Wo1SCGNTztf3VgSzQHCvFJcG +OzM9up5aYz2S7IpcMFIx31crHR666CnL3f4GmyEhcQN+oqaF0rf8mpQT/+YxbsmtbIp QAig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=T0qbmuuRPxDVtPya/S7z9HnIzaHUQLSLFndkXz9dAlg=; b=gMtkaVNXd+748oBvB5FOVBCtAfqi572QzaVzjIPHe136jr0BTviFhslyeop1yXCnO0 ezYyYaF2ccmOsuuA58+hKF9zrj1ZdCs4ZbL8aqfz47GA3Ff6x2l0tZoY61iVcYXaYjUw NtXEBftmjdJhM1no2RVF0UpuGQBT/kqTPgZRFk4XkConf9tbxRbYKS3y6orjVqUTWRt8 5lbXPDKRLvGqmt8eKXZodaLPTXCTllx7uYGHG4Zrk4jshBxZkSFvdzXSatsGDZsZem0A O+pJTPMFDWUqecDx/sksk5cPusSJH+xJxt72SYEP4XMRu4Nm9u5LO5+DNPSW8Qx0IdAx jjzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="aa1WM//w"; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 bb4si12772657plb.322.2019.01.21.07.45.34; Mon, 21 Jan 2019 07:45:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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="aa1WM//w"; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1730459AbfAUPpe (ORCPT + 11 others); Mon, 21 Jan 2019 10:45:34 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:39722 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730295AbfAUPpd (ORCPT ); Mon, 21 Jan 2019 10:45:33 -0500 Received: by mail-wm1-f66.google.com with SMTP id y8so11214654wmi.4 for ; Mon, 21 Jan 2019 07:45:32 -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 :in-reply-to:references; bh=T0qbmuuRPxDVtPya/S7z9HnIzaHUQLSLFndkXz9dAlg=; b=aa1WM//wBsKs9dqORTa7wBVQcRD4lPDGGwYTXHzgbzFvML2quBZsRMMuo53RsRAM7e DiiUzMoO3bspcol3RGnucuMb6t6TwiXWcuWil28ria+MDGNnKBx/gSJ646n2h6FTcFdD 2je3WG+tkpjMfbQt6bnWmcQgL7zT+j/XbcSsQ= 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:in-reply-to:references; bh=T0qbmuuRPxDVtPya/S7z9HnIzaHUQLSLFndkXz9dAlg=; b=oFydsguFc5wXwxLeX8AXZatoLf+eBEmRJe/+JSno1Ugtl775wV91uxzrJ4aOQTeBD6 xJ3zA2Lj5J+nzukkTKgr2nsp7WHjZPptBs0vcuASFlbhcrO/9KG7vUJ/9iqjFNuytoU9 9pbCUHAOmzVseU84kKGhSxt27J/tuNmsqgiNj3ejPUGWzjaBznB5boD1v96xGxK14e/m iWHqJCT3vuxxgi469i8xtR4ivk2f2+841NPUS8ysHNQ+ZCHO7u0KtKcrCu5h0hMSk1Zk oF/052ncl5mZZ74bXsAm2grqnoRPRPgw+EYmlMDT18NYPXS1cvA9q4Qs9EelHjKzCOiY gVEQ== X-Gm-Message-State: AJcUukcbzA+elKvh3rZPkM2P+4JI5PthiPY6hIJGr4kgIMLd0GSHPunj EfvVyqfU3yc5T0Gw1Q6WpHjfKA== X-Received: by 2002:a1c:87cc:: with SMTP id j195mr24943011wmd.2.1548085531754; Mon, 21 Jan 2019 07:45:31 -0800 (PST) Received: from localhost ([49.248.61.1]) by smtp.gmail.com with ESMTPSA id l14sm191132944wrp.55.2019.01.21.07.45.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 07:45:31 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, viresh.kumar@linaro.org, edubezval@gmail.com, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, "Rafael J. Wysocki" , Markus Elfring , linux-pm@vger.kernel.org Subject: [PATCH v2 7/9] cpufreq: qoriq: Use auto-registration of thermal cooling device Date: Mon, 21 Jan 2019 21:10:32 +0530 Message-Id: <1c0f7a96c926e313569e0baf10d6d730f7ee1b23.1548084260.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use the CPUFREQ_AUTO_REGISTER_COOLING_DEV flag to allow cpufreq core to automatically register as a thermal cooling device. This allows removal of boiler plate code from the driver. Signed-off-by: Amit Kucheria --- drivers/cpufreq/qoriq-cpufreq.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c index 3d773f64b4df..b206e6cb55f0 100644 --- a/drivers/cpufreq/qoriq-cpufreq.c +++ b/drivers/cpufreq/qoriq-cpufreq.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -31,7 +30,6 @@ struct cpu_data { struct clk **pclk; struct cpufreq_frequency_table *table; - struct thermal_cooling_device *cdev; }; /* @@ -239,7 +237,6 @@ static int qoriq_cpufreq_cpu_exit(struct cpufreq_policy *policy) { struct cpu_data *data = policy->driver_data; - cpufreq_cooling_unregister(data->cdev); kfree(data->pclk); kfree(data->table); kfree(data); @@ -258,23 +255,15 @@ static int qoriq_cpufreq_target(struct cpufreq_policy *policy, return clk_set_parent(policy->clk, parent); } - -static void qoriq_cpufreq_ready(struct cpufreq_policy *policy) -{ - struct cpu_data *cpud = policy->driver_data; - - cpud->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver qoriq_cpufreq_driver = { .name = "qoriq_cpufreq", - .flags = CPUFREQ_CONST_LOOPS, + .flags = CPUFREQ_CONST_LOOPS | + CPUFREQ_AUTO_REGISTER_COOLING_DEV, .init = qoriq_cpufreq_cpu_init, .exit = qoriq_cpufreq_cpu_exit, .verify = cpufreq_generic_frequency_table_verify, .target_index = qoriq_cpufreq_target, .get = cpufreq_generic_get, - .ready = qoriq_cpufreq_ready, .attr = cpufreq_generic_attr, }; From patchwork Mon Jan 21 15:40:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156218 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6517740jaa; Mon, 21 Jan 2019 07:45:59 -0800 (PST) X-Google-Smtp-Source: ALg8bN6tpNKGnK4JpOV+YS6Tg8sOndsy0u8OdXMkREiVcVeEadu/HCu2n56RBMkvT1HWb8s7qPY6 X-Received: by 2002:a63:b105:: with SMTP id r5mr28776351pgf.442.1548085559519; Mon, 21 Jan 2019 07:45:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548085559; cv=none; d=google.com; s=arc-20160816; b=GNtfPL1LKuoqf8bDtimL2AUjBgDeoLRtZ9YIx6Fgc46XZ0pFLkYj3YqnuGIbrPx6fv jTytPuSc44cNYVjKrSTlhaGhNQzPwKUPSHZL/ieH905lZ3vzYTTJXfb38BAd6MkYuZ0X UvAYpqrzG/yztJCsAsKtu6KUqlI5OhERXvFq6fzMWfjPHh6x2Pfrb3urutt4Lvxo3rwu 0B1w2d1x+7uwB4cIs2pWCfyup8/anZnDY2mJFL7bTkLSbcjHiAds5bTxlW5at+aGjPuT ouOLMWblxms1G7Elfl9C027XJ/95fUf1JlEiwda9UmUot594WgC6KEoVB7DnK4M9Lr8s hJeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=xA//1FlkdsXmsx5auTFeNL+jjZLqfN7vDldrYpONvm4=; b=i/eqLqqpza8x/1NzIkACkzie9pDVxVUssTBGEsAVqo0vtg3O4ZTRKyOio7sNkHtAMX tlKv/6MEBpL/mv37oUUPjuljpGBq+ssUrZpdARISgy6TAU7h8uFFqeYjQTNH0wvQcPcW sbv/PYgvAQCjTBgP1BHB3Hh437bm4zJlxIE1HoTJ8JHyXg3XTHpdk882WbExSZ2Pk4iB icQWOYkRX48Hqeq45N1ZR4O81OQl8pOTaNVL8zeTbNVjAfnBych4GbtbjXnuReyFih4n 6yLVU4CVHg8dLTOQUbzXHR2aBDBTuyHVlFX0Yoc65xOpzSAZZz6ckJLlN7bxYxfiD5RC CNLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UYm41OgY; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 v2si13649288pgn.451.2019.01.21.07.45.59; Mon, 21 Jan 2019 07:45:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=UYm41OgY; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1729880AbfAUPp6 (ORCPT + 11 others); Mon, 21 Jan 2019 10:45:58 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:38962 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728965AbfAUPp6 (ORCPT ); Mon, 21 Jan 2019 10:45:58 -0500 Received: by mail-wr1-f68.google.com with SMTP id t27so23920651wra.6 for ; Mon, 21 Jan 2019 07:45: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 :in-reply-to:references; bh=xA//1FlkdsXmsx5auTFeNL+jjZLqfN7vDldrYpONvm4=; b=UYm41OgYi5vribcT/yRgVmTyOKfonDp1gCSdYoN5JVhxHQmtv7NPmG0xORTgY7t3pS T/H16ms5FnaubeVeQ/LqMlVCQyiGAXxiRrCooF7w9UuIa95pNlZAADkVBU6OMzCwfbPW Q82riebXP2V8q6m/jnTlG9XdykRzGvtKsBwIg= 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:in-reply-to:references; bh=xA//1FlkdsXmsx5auTFeNL+jjZLqfN7vDldrYpONvm4=; b=DvjdtgsuQQ+P7McwUoZGdY+OhVtVksRnU4h0mChASpfXL0cYj3u2MVaqrA072J9mRW q6pmaw7ilFF09j8t/bNxIFXdHQC8hfTNTrchAagGMs3UmDS7PJRppl07jRpWk5A3UW1k bB0F/dfcKZ5+FimUusebNA0VeORI+3rhqJN1JuMiLxsnAIX7bQWpg4mhu57SuIM3J3CQ b9QxniCutdtPR2SAVTpfosLBbmU5PG3QXZ2jB5n+FGyKnMFM/+/1Pl1fAKpZ0dN1+2fx 5KD569oe1IyQVcIbxIJB2FQm66M6ZPMMSQEX/0YjHjBhOEW7gxBLJ3xbBWmUfiwN7XOp JJLg== X-Gm-Message-State: AJcUukeWLK0Hx9Ct7p9x4BN+X16Pv5ORy6ae1ZRyk3lhDF0qX8NDl3DF n0lua3mtw4mU6iA7++rwx0TPkA== X-Received: by 2002:adf:d243:: with SMTP id o3mr29691751wri.66.1548085556785; Mon, 21 Jan 2019 07:45:56 -0800 (PST) Received: from localhost ([49.248.61.1]) by smtp.gmail.com with ESMTPSA id g188sm64972795wmf.32.2019.01.21.07.45.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 07:45:56 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, viresh.kumar@linaro.org, edubezval@gmail.com, swboyd@chromium.org, dianders@chromium.org, mka@chromium.org, Sudeep Holla , "Rafael J. Wysocki" , Wei Yongjun , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v2 8/9] cpufreq: scmi: Use auto-registration of thermal cooling device Date: Mon, 21 Jan 2019 21:10:33 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use the CPUFREQ_AUTO_REGISTER_COOLING_DEV flag to allow cpufreq core to automatically register as a thermal cooling device. This allows removal of boiler plate code from the driver. Signed-off-by: Amit Kucheria Acked-by: Sudeep Holla --- drivers/cpufreq/scmi-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 242c3370544e..b19e9d129f8f 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -22,7 +21,6 @@ struct scmi_data { int domain_id; struct device *cpu_dev; - struct thermal_cooling_device *cdev; }; static const struct scmi_handle *handle; @@ -185,7 +183,6 @@ static int scmi_cpufreq_exit(struct cpufreq_policy *policy) { struct scmi_data *priv = policy->driver_data; - cpufreq_cooling_unregister(priv->cdev); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); kfree(priv); dev_pm_opp_remove_all_dynamic(priv->cpu_dev); @@ -193,17 +190,11 @@ static int scmi_cpufreq_exit(struct cpufreq_policy *policy) return 0; } -static void scmi_cpufreq_ready(struct cpufreq_policy *policy) -{ - struct scmi_data *priv = policy->driver_data; - - priv->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver scmi_cpufreq_driver = { .name = "scmi", .flags = CPUFREQ_STICKY | CPUFREQ_HAVE_GOVERNOR_PER_POLICY | - CPUFREQ_NEED_INITIAL_FREQ_CHECK, + CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_AUTO_REGISTER_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .attr = cpufreq_generic_attr, .target_index = scmi_cpufreq_set_target, @@ -211,7 +202,6 @@ static struct cpufreq_driver scmi_cpufreq_driver = { .get = scmi_cpufreq_get_rate, .init = scmi_cpufreq_init, .exit = scmi_cpufreq_exit, - .ready = scmi_cpufreq_ready, }; static int scmi_cpufreq_probe(struct scmi_device *sdev)