From patchwork Tue Jan 29 04:55:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156913 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4224894jaa; Mon, 28 Jan 2019 20:56:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN7Q81QP21TT86H54zfIbKSbt9NjEYO46juKzi8Exp/5w+58tRAoccRhzPyyTC2HvpYBC3Kw X-Received: by 2002:a63:5e43:: with SMTP id s64mr22464283pgb.101.1548737784737; Mon, 28 Jan 2019 20:56:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548737784; cv=none; d=google.com; s=arc-20160816; b=csNzSETb7+sCBF1qxHREnKexw18uDxCGgI1hlYCtGaboHr70yUB0Kv2tjHAfv9yzsc 9GXApXpvivn1vBoooZUH5Nd4lnTdEfaxogdFfaOtT/i3Fav9/wMVMiKDZCEK3rorJApP Y1yShBwbELVPjNW3iWWaUBuGX2a6I7X0fZzd6R5ch3H5M7A7AgmTqTUd2/Lhg/MC8zaf JtfhBoTa8OHGanf6iBVhyiaINI2aqK7vDwj5r6q8Bmv0tNXZgqzPEbZgFvj1OfMnWJ4p q0f8o7wDIUgH5jZwxHsr7haXDnuV8C6kgwlC7Qy3NQVwssdvB5ZaNBQuNlsu+Tc5oF8S vmhw== 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=f9RRfEkXE77pz83n7acsj2941ekty87S490EyLGXvZg=; b=Mj6q46/OibsJaBbFeyMAZHkCekpQSLuQVaflQ7Habr25yjqr+YnmrI0S0G0WCbW9gH o4QKUwSMwaFz0vzg7yjM/FdCHZ4lu030N7SQdWFFcm7klsNHahlNCkvAomY7BCnsEjE0 W0ILuJkhTc+7/QYxEi1ujyudg0T+py0GUBRADNz/dfMzp9C1tG4dSzW4FnzreKVJlDBK VosbmB5AEd0tz+gcocRYZnKLHDDJV3Sg2luocJhdkH489970xiNDa98prcK5JriNGxAe S+GRalbu58Vd1xD3yVQPkDZV68PDyYRJms8Pw4KW+366RB4ULEkEUVRqi8dXBY6epxQd KUPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UXp+fS9T; 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 q66si34477729pfb.231.2019.01.28.20.56.24; Mon, 28 Jan 2019 20:56:24 -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=UXp+fS9T; 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 S1727029AbfA2E4W (ORCPT + 31 others); Mon, 28 Jan 2019 23:56:22 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:55620 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727227AbfA2E4W (ORCPT ); Mon, 28 Jan 2019 23:56:22 -0500 Received: by mail-wm1-f66.google.com with SMTP id y139so16184061wmc.5 for ; Mon, 28 Jan 2019 20:56:20 -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=f9RRfEkXE77pz83n7acsj2941ekty87S490EyLGXvZg=; b=UXp+fS9TOO4n9krRgp8esKxH+Ul+PXMyCPbeH/VFxsOGrgY9RvxlmU9he+OUUZZjNC KtcRD8Ee18SdQq9s5SRS4emcgc+fRcHCi7kCcAVdIRSFPygfzLxmRU4+bYZFUOMq2Dxx AAtPcwwIg8g+Fk/yAQMQJnLDDSf/rceRRQ7PE= 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=f9RRfEkXE77pz83n7acsj2941ekty87S490EyLGXvZg=; b=pnlfy2Wn2VGAVBn/eDm4MFRUNvNS4JsQeuTa6FwYs9CiukZrejkY+C0iyLsToUPJMR UW9tva551Rq+/vEuuZDiJ0/yOfSx7mhmOLATISHJRSdQihmR5dWPCLkc+sF1f9do8HUW 1mylnnqVVlTyPQefTx/dJ5QzUYltGU6x5bWSLfq3n1sntmanaPIKUWWfnLFcwuSaOWh1 8nf44Z1GlrvrGWk51WIhaqzo56jxz0vCg55M4gZ9wSgFFpCHcJBsRdYGe4lwK0W5Y3Wp kWvRpJYh+/00mVaKzvTptPgwBK98d3mo8tRk1vd0pgo17vrB0uufaF5Y/PfpOCmSVdSH UtiA== X-Gm-Message-State: AJcUukdpetruarqPxYWkL2pRPhffBisQQN+y/x9QHR2EW2OZWrG7rBpx 3OBax8FGFx2CMiAo2L9PUWwmD4DCEbE= X-Received: by 2002:a1c:8d12:: with SMTP id p18mr20946052wmd.31.1548737779758; Mon, 28 Jan 2019 20:56:19 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id h184sm2351806wmf.0.2019.01.28.20.56.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:56:18 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Zhang Rui , Eduardo Valentin , Daniel Lezcano , Sudeep Holla , Taniya Das , Anson Huang , linux-pm@vger.kernel.org Subject: [PATCH v5 1/9] thermal: cpu_cooling: Require thermal core to be compiled in Date: Tue, 29 Jan 2019 10:25:07 +0530 Message-Id: <0d63ca44cff5f47ef0102b2c86b4fe9eca9b658b.1548737236.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. As a result of this change, get rid of the ugly (!CPU_THERMAL || THERMAL) dependency in all cpufreq drivers using CPU_THERMAL. Suggested-by: Rafael J. Wysocki Signed-off-by: Amit Kucheria Acked-by: Viresh Kumar --- drivers/cpufreq/Kconfig | 3 --- drivers/cpufreq/Kconfig.arm | 5 ----- drivers/thermal/Kconfig | 1 + 3 files changed, 1 insertion(+), 8 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index 608af20a3494..b22e6bba71f1 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig @@ -207,8 +207,6 @@ comment "CPU frequency scaling drivers" config CPUFREQ_DT tristate "Generic DT based cpufreq driver" depends on HAVE_CLK && OF - # if CPU_THERMAL is on and THERMAL=m, CPUFREQ_DT cannot be =y: - depends on !CPU_THERMAL || THERMAL select CPUFREQ_DT_PLATDEV select PM_OPP help @@ -327,7 +325,6 @@ endif config QORIQ_CPUFREQ tristate "CPU frequency scaling driver for Freescale QorIQ SoCs" depends on OF && COMMON_CLK && (PPC_E500MC || ARM || ARM64) - depends on !CPU_THERMAL || THERMAL select CLK_QORIQ help This adds the CPUFreq driver support for Freescale QorIQ SoCs diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm index 688f10227793..ca8567c3152c 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm @@ -29,8 +29,6 @@ config ARM_ARMADA_37XX_CPUFREQ config ARM_BIG_LITTLE_CPUFREQ tristate "Generic ARM big LITTLE CPUfreq driver" depends on ARM_CPU_TOPOLOGY && HAVE_CLK - # if CPU_THERMAL is on and THERMAL=m, ARM_BIT_LITTLE_CPUFREQ cannot be =y - depends on !CPU_THERMAL || THERMAL select PM_OPP help This enables the Generic CPUfreq driver for ARM big.LITTLE platforms. @@ -38,7 +36,6 @@ config ARM_BIG_LITTLE_CPUFREQ config ARM_SCPI_CPUFREQ tristate "SCPI based CPUfreq driver" depends on ARM_SCPI_PROTOCOL && COMMON_CLK_SCPI - depends on !CPU_THERMAL || THERMAL help This adds the CPUfreq driver support for ARM platforms using SCPI protocol for CPU power management. @@ -93,7 +90,6 @@ config ARM_KIRKWOOD_CPUFREQ config ARM_MEDIATEK_CPUFREQ tristate "CPU Frequency scaling support for MediaTek SoCs" depends on ARCH_MEDIATEK && REGULATOR - depends on !CPU_THERMAL || THERMAL select PM_OPP help This adds the CPUFreq driver support for MediaTek SoCs. @@ -233,7 +229,6 @@ config ARM_SA1110_CPUFREQ config ARM_SCMI_CPUFREQ tristate "SCMI based CPUfreq driver" depends on ARM_SCMI_PROTOCOL || COMPILE_TEST - depends on !CPU_THERMAL || THERMAL select PM_OPP help This adds the CPUfreq driver support for ARM platforms using SCMI 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 Tue Jan 29 04:55:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156918 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4226148jaa; Mon, 28 Jan 2019 20:58:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN5yn+n1TOqaBDp7byyRzZh7KuIArDVrMqNpmNHk9RzvfK9/YEfa8KFCEAsxVoMkJOyeibAy X-Received: by 2002:a63:4c5:: with SMTP id 188mr22576415pge.391.1548737899561; Mon, 28 Jan 2019 20:58:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548737899; cv=none; d=google.com; s=arc-20160816; b=YGs9MGqG9ZlQSEU5oGdxHM5IjI0RVzXD4vrw7skfCpxNtizqvFJfw9Itq6ubnkg5zs /ga5SdXbxjqw/g7w6A2zXTVQu9LKjswcys4Gimzm5chJca8cGEVL9AFwG5/PXW9UNPtV 11SZR/N+GjGvVxGO+SS69O3wsY6otgKwRoSv0z+1zA9aQTctGPbCuXojCgV9lLB1GvgX YdHLONYzXuNAR5CKv2e2eCMdF3b0cfLMzklTAiEJngHOta94CCCx0LIysf1G65oqo+3W Lee8fnlYb45xPKRK+ACJNZPDU51w3e4AnC3olrIG2r4CUbEOgZyqsFKGeuasdJm3IPs/ 872A== 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=+jPKZ9vp1qOYYm4MVv+7Bda22318qKzwckjJAKIOCi0=; b=WK2OjIRdc+TybdqmGG0stJDXu/40srffwTLESzJQWUO3al2nQZugsSJkESeXWFXNgc thrBy7QgSaeV2+br44b/oM/qZHRYS6BnxnHScfRXSOqmTkr/Qqa+sIJlId9hLdB0Skmf pAOjU3xJazmB+f+rm9XI9eo+l/dGm051nKHyhRZMBcxoT4oX39ZqZPMgIk8X5jjyjwfg B72FgeGcFNNHrFTEF38hsJLkfyq+SWysHTb6LY6Ks9EjBn0SIO2BCqVQg9LzqcasncEm clUrLpKalNyEoTUnMpyS9mBGLeUF9nGEmuPyZj2Dp5yNPgw9A8Y1OFPgsfrQKYWGx+4J u2Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=anE2vDQF; 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 h16si3552949pgj.203.2019.01.28.20.58.19; Mon, 28 Jan 2019 20:58:19 -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=anE2vDQF; 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 S1727588AbfA2E6R (ORCPT + 31 others); Mon, 28 Jan 2019 23:58:17 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36972 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727373AbfA2E6Q (ORCPT ); Mon, 28 Jan 2019 23:58:16 -0500 Received: by mail-wr1-f67.google.com with SMTP id s12so20503802wrt.4 for ; Mon, 28 Jan 2019 20:58:16 -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=+jPKZ9vp1qOYYm4MVv+7Bda22318qKzwckjJAKIOCi0=; b=anE2vDQFGsF1XAH9CF3uxaknWOljYGMhl2CzciW+AY/hDoFhzqbpIBHB4a7QW3S8bl LzXlRKbR2mul+a6Puig7aadA8sQiu9FpEqXSzZhq+1XVpFjjltMi6bf+tkeo1p+ipT3C cQp2f1YPstwlKD2T7RT2Mdhqp+4aAANaszQ+g= 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=+jPKZ9vp1qOYYm4MVv+7Bda22318qKzwckjJAKIOCi0=; b=m01X8Pi8y/vJAMX8Z/GfVSE8IhmyxE06TR+FhwYJRlF9r86w4+fMrtYBBxXDzBb7i7 Hs3D2buDgYCjuEs3oCLDQJAksPw0qRpC4rH6gMt2ESlc56k8TTJ+e3PnbvQcZ29u3N8v 0uTIyAbgaHO82/KnPr/yj/XVhXSyDA3hGdf/dbp8lExjuA2lnp+cU9rpI52/o5uRG4PB SsF3kmRyQ1/oM0fyLlcEyXkUe7/Wlybb8Q+NA964SBf7isYLB9FQU6JFiys1LLwDJh3g JyP6JvKhWn9Nij0A2TWpZjP9izxjmkPiUFRAF/+W5U412P2CD4U4DT3DW4khyIBHD3fK MYDQ== X-Gm-Message-State: AJcUukcF/AjVjXLU8eZMFuObxr86zc+we4QySmXnDToltJnO3/HP6XL4 N0mWxBnXE8g3UMJn2uxL8FlHqUitLDo= X-Received: by 2002:adf:f449:: with SMTP id f9mr24838998wrp.40.1548737895053; Mon, 28 Jan 2019 20:58:15 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id a8sm2977581wme.23.2019.01.28.20.58.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:58:14 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Matthias Brugger , Daniel Lezcano , Sean Wang , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v5 6/9] cpufreq: mediatek: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:12 +0530 Message-Id: <36eb429112e84263bdbd26d8ea3027f71eeb862e.1548737236.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the CPUFREQ_IS_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: Viresh Kumar Reviewed-by: Daniel Lezcano --- drivers/cpufreq/mediatek-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c index eb8920d39818..4229fcc31310 100644 --- a/drivers/cpufreq/mediatek-cpufreq.c +++ b/drivers/cpufreq/mediatek-cpufreq.c @@ -14,7 +14,6 @@ #include #include -#include #include #include #include @@ -48,7 +47,6 @@ struct mtk_cpu_dvfs_info { struct regulator *sram_reg; struct clk *cpu_clk; struct clk *inter_clk; - struct thermal_cooling_device *cdev; struct list_head list_head; int intermediate_voltage; bool need_voltage_tracking; @@ -307,13 +305,6 @@ static int mtk_cpufreq_set_target(struct cpufreq_policy *policy, #define DYNAMIC_POWER "dynamic-power-coefficient" -static void mtk_cpufreq_ready(struct cpufreq_policy *policy) -{ - struct mtk_cpu_dvfs_info *info = policy->driver_data; - - info->cdev = of_cpufreq_cooling_register(policy); -} - static int mtk_cpu_dvfs_info_init(struct mtk_cpu_dvfs_info *info, int cpu) { struct device *cpu_dev; @@ -472,7 +463,6 @@ static int mtk_cpufreq_exit(struct cpufreq_policy *policy) { struct mtk_cpu_dvfs_info *info = policy->driver_data; - cpufreq_cooling_unregister(info->cdev); dev_pm_opp_free_cpufreq_table(info->cpu_dev, &policy->freq_table); return 0; @@ -480,13 +470,13 @@ static int mtk_cpufreq_exit(struct cpufreq_policy *policy) static struct cpufreq_driver mtk_cpufreq_driver = { .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK | - CPUFREQ_HAVE_GOVERNOR_PER_POLICY, + CPUFREQ_HAVE_GOVERNOR_PER_POLICY | + CPUFREQ_IS_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .target_index = mtk_cpufreq_set_target, .get = cpufreq_generic_get, .init = mtk_cpufreq_init, .exit = mtk_cpufreq_exit, - .ready = mtk_cpufreq_ready, .name = "mtk-cpufreq", .attr = cpufreq_generic_attr, };