From patchwork Wed Feb 21 15:29:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 129084 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp750518ljc; Wed, 21 Feb 2018 07:30:00 -0800 (PST) X-Google-Smtp-Source: AH8x2258d4MR2Wj+B7QZu2wKio7Kq5f6YFyuwMHTUJj4XqsIKKz6A6nxXdTiQmhFFAdgbcp47vsy X-Received: by 10.99.152.10 with SMTP id q10mr3112884pgd.212.1519227000674; Wed, 21 Feb 2018 07:30:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519227000; cv=none; d=google.com; s=arc-20160816; b=OtJIEJn9jzg/4KTYV8oS29+g5z9OfJns0iQcMlc9jWA5QU8SdjeZE6oSyhUmx4juC2 GhNaHbMPuPoRgfZHw4kyYBGxtTTjXDV3WeJDqLDZgnwaj+W5gZnECeW+qtTFclROVVVZ BRuu1cqeHk/UQyvfoIRlU4w8S14eWkleS+wyLvbgKm7YcRO3bF2vAu1YKYWzTFPkqgka 5v2EsfG3HyCgNUPI6kcl0Umae3nBN3a1au0oNxoSDXUVPhiGVjZfTcCG1If3fLX1MpTM 7DEuZOV6+EzrlrLJglTu+g+TvW0Q/yF937v6AkstsmnfEiTPJlJLfGjgueSOEtCMlW/6 vhHg== 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=x4VKVxl2v6GGT+6xUsI4anQtbw1ctliEdrTg6QRcI3kN5JoM9v+Mf5ExWD49jGwvHz s9ot69bg5GfZmur2zxL1V0Zr2xBgg5EmXMZuddHR8BzFG7+PqvaukHrmXT2BDAkHr0gP QiLyRGOX06vnqjfmjxV1vEpmBQz73yW/PlClkEhZ81u4rB33AA+g2KcHiCS0Q2OaoUgt UT3lQn1ZTFAFEC2cyUbM6SaKJRySC5xUCdPeuupeWpUryuKVc9HUKMVDOAXSpp60FENC riDawT8ivyHcnhGx6W0zmNbnf7calZ+autaVkzdlKnBemdQLCIVg9h6gQtVeBJAuPAZG aZHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J9ET5G7f; 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 69si1518747pfv.15.2018.02.21.07.30.00; Wed, 21 Feb 2018 07:30:00 -0800 (PST) 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=J9ET5G7f; 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 S938321AbeBUP36 (ORCPT + 28 others); Wed, 21 Feb 2018 10:29:58 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:36405 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938264AbeBUP3r (ORCPT ); Wed, 21 Feb 2018 10:29:47 -0500 Received: by mail-wr0-f193.google.com with SMTP id u15so5631384wrg.3 for ; Wed, 21 Feb 2018 07:29:46 -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=2B+u7r7k98kBwXfr9ac52jfD5UJK1QPtdRFSc0U8m8k=; b=J9ET5G7fzbsua3egWlykAIq5TZ1IUpIf6DJ1/UqDAJCmgdj1bDlp1CptTmccB22FF4 KLc73mjx81VfqWeKt6IZ+T91lMx4mb+Aw9KYaIg+LBdfiAI16PHfirnG5tKzzbSOyFDR iofdUu6Ity7rfgMLg8CHsNjvULjeLrpiTANSY= 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=Z/DujicCSPPy4x0YKBe1KmdcV9t8YqAZO5yAi6pIaz0ctzKFNhkdqa8/lgk0iPuMCm iqGk2v/XazF29LMiY9bK49+TZbalsH2KF9I0pUsRlD2hNPqltwYE7f319aTJypaWeXDO wg2lgwOqyFxIrsUwwrD4SNuhUqN+7bjTneHY2C/YTL6l//PXvdRcamfAFFT5EXeR7W6B jj38lRse4D2iJjhtfm2n5VIpYMYT0DkRCkDOb2X9Cuk7gIYnglqU2PSIK4+XRNX0Qvug MxaFeju3O/qjr0fwpiyzXGFqP88m+Xl1L5dYZZDzL0KP7hFvNOdoRSUJO2FV9wUKFdPt f53w== X-Gm-Message-State: APf1xPAfirn+Dbb80p+PydRW9k53EBkVmXgv7axKc271QRM3Y3AH0DSp aiaR216R++GyJveWS5jjOpY1/Q== X-Received: by 10.28.87.20 with SMTP id l20mr2308233wmb.48.1519226985596; Wed, 21 Feb 2018 07:29:45 -0800 (PST) Received: from localhost.localdomain ([2a01:e35:879a:6cd0:c4f2:763f:443f:f48]) by smtp.gmail.com with ESMTPSA id 32sm26552736wrm.14.2018.02.21.07.29.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Feb 2018 07:29:44 -0800 (PST) From: Daniel Lezcano To: edubezval@gmail.com Cc: kevin.wangtao@linaro.org, leo.yan@linaro.org, vincent.guittot@linaro.org, amit.kachhap@gmail.com, linux-kernel@vger.kernel.org, javi.merino@kernel.org, rui.zhang@intel.com, daniel.thompson@linaro.org, linux-pm@vger.kernel.org, Viresh Kumar Subject: [PATCH V2 4/7] thermal/drivers/Kconfig: Convert the CPU cooling device to a choice Date: Wed, 21 Feb 2018 16:29:25 +0100 Message-Id: <1519226968-19821-5-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519226968-19821-1-git-send-email-daniel.lezcano@linaro.org> References: <1519226968-19821-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(-) -- 2.7.4 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__ */