Received: by 10.213.65.68 with SMTP id h4csp2123287imn; Thu, 5 Apr 2018 09:20:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx481ySOB7me/KwHVsk26NWeqABPsxTLI3HXU/iGFGr2yW/5SrU3E9ZsF6T5MOZavpG9eYeog X-Received: by 10.98.189.14 with SMTP id a14mr11092657pff.30.1522945219844; Thu, 05 Apr 2018 09:20:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522945219; cv=none; d=google.com; s=arc-20160816; b=lF26ZMPTk/jV4axyMV51SAJ7a3RAID0SHjwqodxmHpOjFRkphOQgDxhcPMbaYb+zbf 9qayr3+jNwTz5Pmo8YEzmJqiU5dDpSPxemB5Nb8O9rprFbKZE90I3Dajl1UfHC7fIXo9 4p+gicYRFqOxh8IQFDOMwxi6H2ALWPxl1+E1jTsTzY8Hk586YnRCs120VSD48OMBkZH3 U0Jg1d/oDLZqUg3BdVi7LAHeVcSB84hP7Ry7QPZ87LzKd8ovKaWYMMvsYPlwxXt98Ujh OPF/LteYDMWYW79iqenxqVDJOo1Lx4PA+N6vrQjNbGY9Fv0R8tLyJZMuRLaSPkDhMy/J yMTQ== 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:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=2B+u7r7k98kBwXfr9ac52jfD5UJK1QPtdRFSc0U8m8k=; b=ufFdV0Au5iada+fO7/ug21jdarKDkxjXPe9G9hd2QS1GrFfi5AWMdhj1iFOmfCR0O+ 2oLadxL050p5rfo3twq3ESz4HM8rhNH+zppsGyjMX1aQR2k46kpm9mfUpGZK0fK+nK+X oFWH8YmhuRsZ93HXIWTuDdEYDEpoMt27nd8dD+MAx8VGmYdXtGMGs7dkWDJCVDuxZ6i8 oZmE1kSvWfR/sDuDBep2aGcHiqcglWdqydoNatYv55RFI2DK3jkcYX1r+Ja9An8IgtKT rghdf9hGV65hTu37UjiqorNDGcb7sfBkX+0OSwpOWztn5MRl+ddFevkmKJ44+WnUE0ho QUOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e1D+GSdV; 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 j15si5708547pga.418.2018.04.05.09.20.05; Thu, 05 Apr 2018 09:20:19 -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=e1D+GSdV; 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 S1752037AbeDEQSY (ORCPT + 99 others); Thu, 5 Apr 2018 12:18:24 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:42610 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751519AbeDEQRD (ORCPT ); Thu, 5 Apr 2018 12:17:03 -0400 Received: by mail-wr0-f196.google.com with SMTP id s18so29335684wrg.9 for ; Thu, 05 Apr 2018 09:17:02 -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; bh=2B+u7r7k98kBwXfr9ac52jfD5UJK1QPtdRFSc0U8m8k=; b=e1D+GSdVaGbCzgkLpU2iEScaA8kopcXUafqIFb27J/6Wa6ky5JvxndzS7NUb8ig83D FOY8sd3FSV5yz0zwNi+Mf9HBGlfGEL2quPVM+ucal+5CpzKjDag+bVj6mPTbfzl81k27 LRwBBCoBdiJQ7QARcbTpvX4BhLtttXjPKzqI4= 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=2B+u7r7k98kBwXfr9ac52jfD5UJK1QPtdRFSc0U8m8k=; b=X1e+68w5IcuFKGxEOAsCK3+HHgmFlQBF2oGDMfsghPmjfGH15dIMWQOBSIpn7IqQsF SfxHWNA+D7QTPr5F2d77gVbr15Q/7YYUzgvQGBC0LgOh8tagtelRIIwEYuv7Rd2TwL1Z gla3GMVNAJNSIPR+5FR3rySUxxmcM8YQ142+FGkd95SyBJF80Vnpt4rzOE3VWJ34NHmp 4XNTKi6R+h+acGPfj3+VlrIuyQ+yFCzdiSZSYEJGzGP+dGcwHbL+f6cHzD2XibUvcJG0 StHAioTLYQ9LsyDCuPcwGEzDWgEwsR3LSKn+gDF36PyJVcW1VtFRQXA9Vwo17lebfYKD qLlg== X-Gm-Message-State: AElRT7E5jWq6orUspnx5dnPMETl/p2YuYPzOh4wxGqw0NTMrt0s8U7Ee nhC/zb5al5o1eNZGcRf8qQGMeA== X-Received: by 10.223.226.14 with SMTP id j14mr15877015wri.17.1522945022035; Thu, 05 Apr 2018 09:17:02 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:d9b6:ce30:b76c:2e56]) by smtp.gmail.com with ESMTPSA id 39sm16103904wry.89.2018.04.05.09.17.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Apr 2018 09:17:01 -0700 (PDT) From: Daniel Lezcano To: viresh.kumar@linaro.org, edubezval@gmail.com Cc: kevin.wangtao@linaro.org, leo.yan@linaro.org, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, javi.merino@kernel.org, rui.zhang@intel.com, daniel.thompson@linaro.org, linux-pm@vger.kernel.org, Amit Daniel Kachhap Subject: [PATCH v3 4/7] thermal/drivers/Kconfig: Convert the CPU cooling device to a choice Date: Thu, 5 Apr 2018 18:16:41 +0200 Message-Id: <1522945005-7165-5-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522945005-7165-1-git-send-email-daniel.lezcano@linaro.org> References: <1522945005-7165-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The next changes will add new way to cool down a CPU. In order to sanitize and make the overall cpu cooling code consistent and robust we must prevent the cpu cooling devices to co-exists with the same purpose at the same time in the kernel. Make the CPU cooling device a choice in the Kconfig, so only one CPU cooling strategy can be chosen. Signed-off-by: Daniel Lezcano --- drivers/thermal/Kconfig | 20 +++++++++++++++++--- drivers/thermal/cpu_cooling.c | 2 ++ include/linux/cpu_cooling.h | 6 +++--- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index b6adc54..5aaae1b 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -142,17 +142,31 @@ config THERMAL_GOV_POWER_ALLOCATOR allocating and limiting power to devices. config CPU_THERMAL - bool "generic cpu cooling support" - depends on CPU_FREQ + bool "Generic cpu cooling support" depends on THERMAL_OF help + Enable the CPU cooling features. If the system has no active + cooling device available, this option allows to use the CPU + as a cooling device. + +choice + prompt "CPU cooling strategies" + depends on CPU_THERMAL + default CPU_FREQ_THERMAL + help + Select the CPU cooling strategy. + +config CPU_FREQ_THERMAL + bool "CPU frequency cooling strategy" + depends on CPU_FREQ + help This implements the generic cpu cooling mechanism through frequency reduction. An ACPI version of this already exists (drivers/acpi/processor_thermal.c). This will be useful for platforms using the generic thermal interface and not the ACPI interface. - If you want this support, you should say Y here. +endchoice config CLOCK_THERMAL bool "Generic clock cooling support" diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 7bdc19f..5c219dc 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -22,6 +22,7 @@ #include +#ifdef CONFIG_CPU_FREQ_THERMAL /* * Cooling state <-> CPUFreq frequency * @@ -926,3 +927,4 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) kfree(cpufreq_cdev); } EXPORT_SYMBOL_GPL(cpufreq_cooling_unregister); +#endif /* CONFIG_CPU_FREQ_THERMAL */ diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h index d4292eb..c0accc7 100644 --- a/include/linux/cpu_cooling.h +++ b/include/linux/cpu_cooling.h @@ -33,7 +33,7 @@ struct cpufreq_policy; typedef int (*get_static_t)(cpumask_t *cpumask, int interval, unsigned long voltage, u32 *power); -#ifdef CONFIG_CPU_THERMAL +#ifdef CONFIG_CPU_FREQ_THERMAL /** * cpufreq_cooling_register - function to create cpufreq cooling device. * @policy: cpufreq policy. @@ -84,7 +84,7 @@ of_cpufreq_power_cooling_register(struct device_node *np, */ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev); -#else /* !CONFIG_CPU_THERMAL */ +#else /* !CONFIG_CPU_FREQ_THERMAL */ static inline struct thermal_cooling_device * cpufreq_cooling_register(struct cpufreq_policy *policy) { @@ -118,6 +118,6 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) { return; } -#endif /* CONFIG_CPU_THERMAL */ +#endif /* CONFIG_CPU_FREQ_THERMAL */ #endif /* __CPU_COOLING_H__ */ -- 2.7.4