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: 10785411 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 773D713B5 for ; Tue, 29 Jan 2019 04:57:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 636FD2B216 for ; Tue, 29 Jan 2019 04:57:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54D3B2B38C; Tue, 29 Jan 2019 04:57:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF02A2B216 for ; Tue, 29 Jan 2019 04:57:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727312AbfA2E4W (ORCPT ); Mon, 28 Jan 2019 23:56:22 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:54439 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727029AbfA2E4W (ORCPT ); Mon, 28 Jan 2019 23:56:22 -0500 Received: by mail-wm1-f66.google.com with SMTP id a62so16324705wmh.4 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=baD2mFVbLkA7tsr7nYdD6APOHHAPKhBLAHQE0B9Ulawdo3CmnveLJgesv4qO6atz2p u4RNCnMX4t6M3Ssnd6vyAPJcYPB0F6J1L2PO8kXRITyk1vZK0xrp/2287L6UMzOVfETo 8wXo4WhOK8c0uop5us8bXKte07/doEf+kVEbyYBHsZyROZoZsaKCnbIsrrRHMhwl1tbN wUCGN6uYK4cOlvBMX1LtqXvaHkFNVaJg1Us7c7FboZ2Scrxl0pIMk6VedZtADAgDqP5F //uy1VRlRyMc7FwHwc1PqsUSqU1IM/ZN+lf/nWT9xBaX5WKY4YittXXIPx+lazOQfRFz 8EAg== X-Gm-Message-State: AJcUukczwCDQAY8GIM8qleAJa8ETmsdE9qXnbDGruHKGsBls8toZr7Q2 jmnfJyTSIjWIobjodm1IWZ8TYg== X-Google-Smtp-Source: ALg8bN7IEPZantKVO8jCdaXIo5aqtdwMoXDpT21hNxD97hEq3HnweXrFKxwzfGU03+6MlLveFCGsQw== 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10785413 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 746FD14E1 for ; Tue, 29 Jan 2019 04:57:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6493A2B216 for ; Tue, 29 Jan 2019 04:57:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 586CD2B38C; Tue, 29 Jan 2019 04:57:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E915E2B216 for ; Tue, 29 Jan 2019 04:57:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727402AbfA2E5F (ORCPT ); Mon, 28 Jan 2019 23:57:05 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36904 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727227AbfA2E5F (ORCPT ); Mon, 28 Jan 2019 23:57:05 -0500 Received: by mail-wr1-f65.google.com with SMTP id s12so20502255wrt.4 for ; Mon, 28 Jan 2019 20:57:04 -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=sZDXlqnH1fj24jYunxEgKg9iTnvnCWnhkKzCRQGaUNw=; b=dugmhw/6jrlx3hZh1S8+lDNGcaaJeEyKdpTAzYFvj8MdrXX4cbJ3LjAFvmxbXv8uZ8 g9U5qD6kTDf3N4N6p8Hcs7tc3njH1J/2iEOUb0orpv05Rh3NApFy5MlBQ4Ob/0CSEke6 l+D7RrxUcRxzO3v8QXFelqrncmWReP2gkECOI= 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=sZDXlqnH1fj24jYunxEgKg9iTnvnCWnhkKzCRQGaUNw=; b=aPMc+/xugF+Semx4bt6lbuYjF00C9X+yDAfmTOHGCn34T1OO3jpcewmtVLaPIzo20o IdmaRShrhbwTsOuhM2g92PdqUf+YU5F6hvN9h2oFqcOE+BHL35Aku7vGx0yCqdsAqaUM 2O5qXsgKVYD9q1eWH4D2iHHF/d7FSx4vWzUnhDE6pnKZ0O/voaRFdA3dcNzVrmMTVGOa yO4XFRLpcLkjjQI9e1BcPQJKm7lHmGuOdWjx6wc4MOirARslNAo9ikvf6MdBGsYmvT8H RMYw3IsR7nmcM7/q210+CDIsaLXfmT3qtOL8FQc1efee2TFJfy38SME3YYf2XPKbHhVk 76vA== X-Gm-Message-State: AJcUukcgthXW9tUsxVqnSzgWLvN7a43Wr4S6oR4wCZxM4BWjAWXx/6Hs gI+aFREx9Z60exBhAgiTb5k4TA== X-Google-Smtp-Source: ALg8bN6rADYXi8OMLUCoGILKf6XcipnreE8/8jl+8XUgRm1fLCTN9DegTfzFWe4xzgRJoN4xSZ852w== X-Received: by 2002:adf:db01:: with SMTP id s1mr23650280wri.214.1548737823567; Mon, 28 Jan 2019 20:57:03 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id 127sm2512264wmm.45.2019.01.28.20.57.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:57:03 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Sudeep Holla , linux-pm@vger.kernel.org Subject: [PATCH v5 2/9] cpufreq: Auto-register the driver as a thermal cooling device if asked Date: Tue, 29 Jan 2019 10:25:08 +0530 Message-Id: <6077cb33d7e078bb0e85776bad99fdb476f16d0c.1548737236.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 X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 13 +++++++++++++ include/linux/cpufreq.h | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index e35a886e00bc..0f9b50d3ee91 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -1318,6 +1319,11 @@ static int cpufreq_online(unsigned int cpu) if (cpufreq_driver->ready) cpufreq_driver->ready(policy); +#if IS_ENABLED(CONFIG_CPU_THERMAL) + if (cpufreq_driver->flags & CPUFREQ_IS_COOLING_DEV) + policy->cdev = of_cpufreq_cooling_register(policy); +#endif + pr_debug("initialization complete\n"); return 0; @@ -1405,6 +1411,13 @@ static int cpufreq_offline(unsigned int cpu) goto unlock; } +#if IS_ENABLED(CONFIG_CPU_THERMAL) + if (cpufreq_driver->flags & CPUFREQ_IS_COOLING_DEV) { + cpufreq_cooling_unregister(policy->cdev); + policy->cdev = NULL; + } +#endif + if (cpufreq_driver->stop_cpu) cpufreq_driver->stop_cpu(policy); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index bd7fbd6a4478..6078eb07a7e4 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -151,6 +151,9 @@ struct cpufreq_policy { /* For cpufreq driver's internal use */ void *driver_data; + + /* Pointer to the cooling device if used for thermal mitigation */ + struct thermal_cooling_device *cdev; }; /* Only for ACPI */ @@ -386,6 +389,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_IS_COOLING_DEV BIT(7) + int cpufreq_register_driver(struct cpufreq_driver *driver_data); int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); From patchwork Tue Jan 29 04:55:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10785415 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3186714E1 for ; Tue, 29 Jan 2019 04:57:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 229412B37B for ; Tue, 29 Jan 2019 04:57:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 168542B39A; Tue, 29 Jan 2019 04:57:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBFB52B37B for ; Tue, 29 Jan 2019 04:57:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727209AbfA2E51 (ORCPT ); Mon, 28 Jan 2019 23:57:27 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45402 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727162AbfA2E51 (ORCPT ); Mon, 28 Jan 2019 23:57:27 -0500 Received: by mail-wr1-f65.google.com with SMTP id t6so20471433wrr.12 for ; Mon, 28 Jan 2019 20:57:25 -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=f/AzGAh3ZudvUYw4T0qqJvy1cHtwmw9luwK7hINpsNI=; b=YguGZwjmRGHbzKSRsmz+oxth3OP8Qd3nJF/HVLk4nVKRcrKFEYdezDxHQMpUfXuRa9 j9iZqlDxOSeG6nID3/KRGoDONxmOAulOC7XdDc0nlmWQUB8g30riWyYGhMjgHjDRYcQH NoMGNYgpLT8U7A2rgTIqs8aQQH/OIKQJrl2WU= 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=f/AzGAh3ZudvUYw4T0qqJvy1cHtwmw9luwK7hINpsNI=; b=BFkx5h/3pxXv3IRdP9+nDybAQlUwbBumZ2P+kHMgzQEqmKzC88pKiMXWYpi9DwEuXd FlsF0ucctjr/S29BAjwNMQvKmkafrBjBw1H/36mU7rR22MKXhqhX18a+vRduHeUG9iD9 8Gd3v0PEE3suhThziO5akCUngRoowhcUJeoKVvUr3X5thvuUMvqaEFcfxmsETDWMQYNp XVSlbgqbIv6URl3iizSAJOirFvEZsF3QLHZ6s02fYqC4Zu/pIXCx2hbFDG0r5pcYALuL nHG4ygAkZDv/XtkT1J71zHJXzQ2I6+iRo7tlPl1VrN02geyp53ULDht4DaXrcMBIcndx 7DRg== X-Gm-Message-State: AJcUukdYvzoLYvUoUQaoef99/TsRDQjukJbPtpQD1pU2Fxi7b2ctrQwO E4nwjkgDMNA8NF1af0B/ettqQw== X-Google-Smtp-Source: ALg8bN5wlaXkuFK4qoVruAWbC29h4rKYONSibqQ7MKpTzcS6icf3XQkoUs/NLxtQGs3eeBkTlpTtOw== X-Received: by 2002:adf:9d08:: with SMTP id k8mr25652098wre.203.1548737845146; Mon, 28 Jan 2019 20:57:25 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id i13sm96485915wrw.32.2019.01.28.20.57.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:57:24 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Stephen Boyd , Daniel Lezcano , Taniya Das , linux-pm@vger.kernel.org Subject: [PATCH v5 3/9] cpufreq: qcom-hw: Register as a cpufreq cooling device Date: Tue, 29 Jan 2019 10:25:09 +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 X-Virus-Scanned: ClamAV using ClamSMTP Add the CPUFREQ_IS_COOLING_DEV flag to allow the cpufreq core to auto-register the driver as a cooling device. Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke Tested-by: Matthias Kaehlcke Reviewed-by: Stephen Boyd Acked-by: Viresh Kumar Reviewed-by: Daniel Lezcano --- drivers/cpufreq/qcom-cpufreq-hw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index d83939a1b3d4..c88b51304d89 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -231,7 +231,8 @@ static struct freq_attr *qcom_cpufreq_hw_attr[] = { static struct cpufreq_driver cpufreq_qcom_hw_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 = qcom_cpufreq_hw_target_index, .get = qcom_cpufreq_hw_get, From patchwork Tue Jan 29 04:55:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10785417 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE6BF1874 for ; Tue, 29 Jan 2019 04:57:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFAAF2B37B for ; Tue, 29 Jan 2019 04:57:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B37562B39A; Tue, 29 Jan 2019 04:57:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59A872B37B for ; Tue, 29 Jan 2019 04:57:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727082AbfA2E5x (ORCPT ); Mon, 28 Jan 2019 23:57:53 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36888 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727033AbfA2E5x (ORCPT ); Mon, 28 Jan 2019 23:57:53 -0500 Received: by mail-wm1-f66.google.com with SMTP id g67so16220478wmd.2 for ; Mon, 28 Jan 2019 20:57:52 -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=ApaWmXxCOUpMHFzKH4UJpFJJLIlZacYoSUov6fCItbE=; b=Pi8oySiwrxSw+U2E/uf7rNEBCB48Zun38AmHkp+cirwAt/dohdRzgc2BhyS+p8yyOb PoaOQrBBqTAzY7ZKxwJbxOKYk603CH4+hi3q3pWpX0qhltsPaQab3qt6VNF3jT2Y9g7J X9WDPQigzIF6bmN+2tdKdqf01L5K+Rou/RbqY= 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=ApaWmXxCOUpMHFzKH4UJpFJJLIlZacYoSUov6fCItbE=; b=FRe9CQrtcL1/kg7y6Dg8eVp/mIA9QsK2blowRwdTxD038ruVFxnFiUP9SZZU7sFGjk mvL1CbBDVzzJJEcTVKQQfBasOJbn0oVqmPzi9FOWgbQ9N733cWtZDp2p4hOZoXcsEfgG cv1kQMtw3XmB1bGGGvankGOh2CLL+dYJdx8P7R/aq0VNIO+sF/uQUFt/8owvtQBZSr2B p+bHwi/FwU5KMTXIw6iT+6qPedRa93dQTR7PqwgDCB/RddCnNsvVJmAwgnjDg1EABaSE TNRgaVM6JtLUQ+OzLoUHB4V0o1lqTTtpZwIdJi78QoAVIjRYcg8NzFYB3TiPM1iOdJIy 3PRw== X-Gm-Message-State: AJcUukdQ9Pe02pFPfT9/q+kAnjVpqf7EAaWLW7DBBVtMP+YIj22H7C0P efI3Ww/uuyERwY3kQ+3Wy3dx3g== X-Google-Smtp-Source: ALg8bN5UEBiiXSXtpHp8EndQm+0o8Ed6sp27vUhbZ75S3341/Gr23r5AiU/HoCcNVVnjmH4Z3xXhXA== X-Received: by 2002:a1c:6657:: with SMTP id a84mr18288519wmc.23.1548737871433; Mon, 28 Jan 2019 20:57:51 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id p10sm3929437wmd.14.2019.01.28.20.57.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:57:50 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Anson Huang , Bastian Stender , Fabio Estevam , linux-pm@vger.kernel.org Subject: [PATCH v5 4/9] cpufreq: imx6q: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:10 +0530 Message-Id: <37b9d8c8b580152246d988629ab52f58314f698c.1548737236.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 X-Virus-Scanned: ClamAV using ClamSMTP 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/imx6q-cpufreq.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 9fedf627e000..ca955713e070 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -52,7 +51,6 @@ static struct clk_bulk_data clks[] = { }; static struct device *cpu_dev; -static struct thermal_cooling_device *cdev; static bool free_opp; static struct cpufreq_frequency_table *freq_table; static unsigned int max_freq; @@ -193,16 +191,6 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) return 0; } -static void imx6q_cpufreq_ready(struct cpufreq_policy *policy) -{ - cdev = of_cpufreq_cooling_register(policy); - - if (!cdev) - dev_err(cpu_dev, - "running cpufreq without cooling device: %ld\n", - PTR_ERR(cdev)); -} - static int imx6q_cpufreq_init(struct cpufreq_policy *policy) { int ret; @@ -214,22 +202,14 @@ static int imx6q_cpufreq_init(struct cpufreq_policy *policy) return ret; } -static int imx6q_cpufreq_exit(struct cpufreq_policy *policy) -{ - cpufreq_cooling_unregister(cdev); - - return 0; -} - static struct cpufreq_driver imx6q_cpufreq_driver = { - .flags = CPUFREQ_NEED_INITIAL_FREQ_CHECK, + .flags = CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_IS_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .target_index = imx6q_set_target, .get = cpufreq_generic_get, .init = imx6q_cpufreq_init, - .exit = imx6q_cpufreq_exit, .name = "imx6q-cpufreq", - .ready = imx6q_cpufreq_ready, .attr = cpufreq_generic_attr, .suspend = cpufreq_generic_suspend, }; From patchwork Tue Jan 29 04:55:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10785419 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E56501874 for ; Tue, 29 Jan 2019 04:58:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4EE52B216 for ; Tue, 29 Jan 2019 04:58:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C86662B38C; Tue, 29 Jan 2019 04:58:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CED32B216 for ; Tue, 29 Jan 2019 04:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727402AbfA2E6E (ORCPT ); Mon, 28 Jan 2019 23:58:04 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34296 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727048AbfA2E6E (ORCPT ); Mon, 28 Jan 2019 23:58:04 -0500 Received: by mail-wr1-f65.google.com with SMTP id f7so20598394wrp.1 for ; Mon, 28 Jan 2019 20:58: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 :in-reply-to:references; bh=q8zOwinb++dSY+a36ZLUxsOKoJRTDJm8Q+law10TDMs=; b=Z4HVrEsAJLZwLCWLjwhKeac6DiTO3NK15Ix6mCv8oaCWUMqLMOPX2ZXQSk/3MDXU/u d8EWT5UF9OUqAhBjgE6W91S+07pVgTlOWUd+OWeTF70aEEw1vdPTSVlLj/xdV1KOGPCm T+irIqzFGTBp4Rrz4A/n7Ko2BZDE0cvfWCLQo= 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=q8zOwinb++dSY+a36ZLUxsOKoJRTDJm8Q+law10TDMs=; b=Awox0JMTGzdjsUb4fMirNXPTTdIKRLv22/yZqtRAQ6zhqIa+vv52f1AcOWxjz7wRsO HMsQcQmpxhGVAOlXf1yP9aCseroLHBonfaS1JBYaK3f7WyMKDlTf1MvLX3R/8qbdWQWi Lc/8BPXSg/uBy2QRqXeKB0h2Y4vv3jF0SXO6EP1Gqc4KeK6W+lRbdcsSwcZ02uerzAr3 KEB/7ll1GjjwN1y+FvmB2FuVbbinGQ4H/nLPnppqFAX+a2PrILjYZNhxH2okkcoYNVuO dYkraOWFF8ChTYaifoSFluhkdKCs0wFVKGhFkEftdHY2Bkuwd2i5oLQAYkMmn9whXjgp 4iig== X-Gm-Message-State: AJcUukffBs2DZqAJ1Pl5iEc0LyzGXxt+twBGxcGca6m+QehXhiQoEPcl uT52sR0fNLQ0ns1NJ8CX3IlomQ== X-Google-Smtp-Source: ALg8bN5+sCJyDD3U5tSJwjFysiND9QVXhp504ClglfbKlhPREFJkXVAAOR5EubBKMwk3msYX8rMBzg== X-Received: by 2002:a5d:50c5:: with SMTP id f5mr23276547wrt.37.1548737882650; Mon, 28 Jan 2019 20:58:02 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id n6sm1320957wmk.9.2019.01.28.20.58.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:58:02 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v5 5/9] cpufreq: cpufreq-dt: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:11 +0530 Message-Id: <4e19a2d9c5d929cdd87a984953c880c1e5a2e057.1548737236.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 X-Virus-Scanned: ClamAV using ClamSMTP 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/cpufreq-dt.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index e58bfcb1169e..7ba392911cd0 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_IS_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 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: 10785421 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB56C13B5 for ; Tue, 29 Jan 2019 04:58:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC2542B216 for ; Tue, 29 Jan 2019 04:58:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D60B2B38C; Tue, 29 Jan 2019 04:58:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F3482B216 for ; Tue, 29 Jan 2019 04:58:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727586AbfA2E6R (ORCPT ); Mon, 28 Jan 2019 23:58:17 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45459 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbfA2E6R (ORCPT ); Mon, 28 Jan 2019 23:58:17 -0500 Received: by mail-wr1-f65.google.com with SMTP id t6so20472584wrr.12 for ; Mon, 28 Jan 2019 20:58:15 -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=ICvqorJwKRGqFRafKPowik0f5ioH2aDGP51fkgc7EQs1RUBUNHFnPHxhErQLVtFqRj vObJCauH4q6NwEVQNI0wrJALqbM/k28Ga+Th9BjUhEsg4Nhtxvfb92etcAM9Q9LtYGm3 oRsWl2HmqSqnifbu6/o/9eYCdP4kzDea5PKqpUQFYPmYF6uv66VD/jzAZcPFa8sKUgri bu4VazV3Z+jSLJwcX+qVKkBOPJS7xpy9LhUjIbEgEF1xzFqogSU0lKVhYpMs7HNqc0PF fI8rSV0EJz2o7JW/EPB5xQmONTtGBjjenOo3kpZ0fMBTQ0PnxK8vLLwHfjyu+YLaMRVY Ly6w== X-Gm-Message-State: AJcUukcMbuVdScoYr6UJFthwuMiPrGOu9+XjBDwcz377ABfCMBFoSp+Y 5VY9lcr+dpZLNYRYystvD3QS0A== X-Google-Smtp-Source: ALg8bN5iW0BV+F0TjrVK5FWW51JWwOc6PxD2qUoFZ3RJ9thGLu66KEy7/JexxnljuVPUMsceXISG3A== 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Matthias Brugger --- drivers/cpufreq/mediatek-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) 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, }; From patchwork Tue Jan 29 04:55:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10785425 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE4CA13B5 for ; Tue, 29 Jan 2019 04:58:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EF7E2B216 for ; Tue, 29 Jan 2019 04:58:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 935BF2B38C; Tue, 29 Jan 2019 04:58:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D5222B216 for ; Tue, 29 Jan 2019 04:58:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727253AbfA2E60 (ORCPT ); Mon, 28 Jan 2019 23:58:26 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33914 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727276AbfA2E60 (ORCPT ); Mon, 28 Jan 2019 23:58:26 -0500 Received: by mail-wm1-f65.google.com with SMTP id y185so12022827wmd.1 for ; Mon, 28 Jan 2019 20:58:25 -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=l5jEfutaw0gwpPVDHGUPHj5GB9c2BDmfuxGAmeH9M7o=; b=dQXJLEAixZwDW8vnfsMujaz38Qi7FLMZzL8bgTPloe3dBBSIUcTbx42U1Iv/a9UhAO pfoo7bikilHw9yjxNLQpLVnSusJkqlaGiuapK19uUyJ5oEUuSgj3MkihYfY4xspaNMsR xdgJRQvr+8agBrmQWAaPOtY5uaua6LxsenkTc= 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=l5jEfutaw0gwpPVDHGUPHj5GB9c2BDmfuxGAmeH9M7o=; b=AzIuRupd+xnL6snsJYglYkrGSahRRM7F+iqk5CvfIvlj6sRFzIIvvySl3TD4FdHBa+ hMTm2vqdPgPYn7MgS9Kutx5/+ee2AnbLRCf/gVNjeLJ2S8yg+HTqO2O5gldQZc7Mi3m9 Hq9lTQUsiLQDEbTxOVtzUOhLV+dxqg3unJ7Fk4oQZlVRW9734kdSLTi7nzPQfiq1tqRe PHsanck0HaUIK9jVWaRPuXjLe4Xahmguv2niv/uR1J+SG3p+9xAKUlTr9z3feB36L+Iu kvwmbMD0yKIKTrKretbrmYul7SHKhMfJi8wyV8SHEwAZbZIzeCsxlHlTh/YT0spoWdr4 LZpQ== X-Gm-Message-State: AJcUukfMEbcTxKl1KGZEAskpxYt/tsd5NWNLRbFp8i95tviR3Ga6P9CS +N2Y31fcYcY+FwLfDHzasb7how== X-Google-Smtp-Source: AHgI3IaAYjS8LolkXBov5RTxAIwY1VhQUzpwri1+MXSjw7e581QTNVwM95h/Vlkfo3OnUFJUaGg45w== X-Received: by 2002:a1c:f518:: with SMTP id t24mr4101747wmh.26.1548737904717; Mon, 28 Jan 2019 20:58:24 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id n127sm1727856wmd.20.2019.01.28.20.58.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:58:23 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Daniel Lezcano , Markus Elfring , linux-pm@vger.kernel.org Subject: [PATCH v5 7/9] cpufreq: qoriq: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:13 +0530 Message-Id: <3c0f9702f2d68f684b16c4ab5dbb3222d64127e7.1548737236.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 X-Virus-Scanned: ClamAV using ClamSMTP 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/qoriq-cpufreq.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c index 3d773f64b4df..4295e5476264 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_IS_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 Tue Jan 29 04:55:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10785429 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28E971390 for ; Tue, 29 Jan 2019 04:58:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11F0727E71 for ; Tue, 29 Jan 2019 04:58:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F02B527F17; Tue, 29 Jan 2019 04:58:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 628A42022B for ; Tue, 29 Jan 2019 04:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727283AbfA2E6s (ORCPT ); Mon, 28 Jan 2019 23:58:48 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33944 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727209AbfA2E6s (ORCPT ); Mon, 28 Jan 2019 23:58:48 -0500 Received: by mail-wm1-f65.google.com with SMTP id y185so12023290wmd.1 for ; Mon, 28 Jan 2019 20:58: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 :in-reply-to:references; bh=q0Sq1ojzps17WKcX9i43B6VWlGzaqFa3Y99XQ3cE3s0=; b=SKkw+bx9M7a1C7KFz6NtETyB1HBgVDEedtQCAyZlJS20Esw+cYWkadE9BRpxg7FN9v fSTti4bcAemIotQ72wCEHy/4Ibs01qFlFne/uFQ0/dWsQ3O4hVXI40wKT9tQNZu7s0Q9 KZKZeWQZxlWlQ/LA/VRqGQ5c2PSEfdY4+SLDQ= 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=q0Sq1ojzps17WKcX9i43B6VWlGzaqFa3Y99XQ3cE3s0=; b=HX3leC7GfNkFR/AkFN2+t1EyfA4VMEJ3pryfCDPyfpdEDSlLPvFg354VRQgmTVmFKc R5AP0EL3WBinqURMoopJHV1qbwc8hKdzBtKAqenhcxjytublbEgHiotx4tz8EoteZMmY Rjc60yNYVmKtMJt7UJm9HaeG1D4CKPFL/6n229PKPxX1qS4LgtcBnYOvVFmBjwJ+W0mU wfqfkttfy2AOJvHBajK4XHWT0wAQDsy+j08BLvrSqKWTin8QFCqIVgRi5+F/mzX9aCy1 mNNwU2vFCfYYsj2ipR75Ik4ce/SYbHsq0BHaeBuP1CoDf1FAfpy2Lk3wfgNX1BjuBIlw I2cA== X-Gm-Message-State: AJcUukdvXrpLQJzkIA4lt3h/x8pFtGKWquV3XeUgXTmtmw5vm+r3cqSm meSNotoTK6mJB1pCp36JiX+7SxtQSTE= X-Google-Smtp-Source: ALg8bN7lQ4NZxXpPYYyKI5DUU25o6+aZkafyPjktEveuyTl9Mfybi/gfZyuPTCpUrUcuUKYg9snh3w== X-Received: by 2002:a1c:2314:: with SMTP id j20mr19221835wmj.142.1548737926560; Mon, 28 Jan 2019 20:58:46 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id 125sm1908131wmm.26.2019.01.28.20.58.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:58:46 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , "Rafael J. Wysocki" , Viresh Kumar , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v5 8/9] cpufreq: scmi: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:14 +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 X-Virus-Scanned: ClamAV using ClamSMTP 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: Sudeep Holla Acked-by: Viresh Kumar Reviewed-by: Daniel Lezcano --- drivers/cpufreq/scmi-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 242c3370544e..66b633b48eb1 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_IS_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) From patchwork Tue Jan 29 04:55:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10785433 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 32ED61390 for ; Tue, 29 Jan 2019 04:59:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 232D52B2FE for ; Tue, 29 Jan 2019 04:59:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15F0B2B301; Tue, 29 Jan 2019 04:59:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A36292B2FE for ; Tue, 29 Jan 2019 04:59:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727090AbfA2E7K (ORCPT ); Mon, 28 Jan 2019 23:59:10 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:54616 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727070AbfA2E7K (ORCPT ); Mon, 28 Jan 2019 23:59:10 -0500 Received: by mail-wm1-f68.google.com with SMTP id a62so16328738wmh.4 for ; Mon, 28 Jan 2019 20:59:08 -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=vcvqDibFD4J+UsvLzl4IPLt3+45i56JFsvwQyIv7Ies=; b=OIQOgBgIYGQMD5MsHLsxxua0J6GIoPteH87r+Nqm3iXi33wmq5/SA3xu6C8XWZeUE8 5BEPB+ixLyvmyN1VSzTniLJcAQ+MjLrbckzu2gqa6qKrt5+DdT5GzOYGwqFuuE/b8D9+ 9tSK6SeE3Z0bHjhe2bBP4bRqYLweIzNozPMnM= 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=vcvqDibFD4J+UsvLzl4IPLt3+45i56JFsvwQyIv7Ies=; b=F94Yf68Y9506mga6qhgUCe2UD+cbNyucrxIWhfX2oTZXHmtV6sQL1nf+sGIy2Qb4no FqK6hCbJ4AHI6eFHFPR9ibgJjU7eHUsw0TlituIhQ/YKkLAV2Um45CkyZ4c7DYlvcads Y4Han3VSe6G69I/h0RD4l6/a1TJAwYSzYagL4GG6wmMU+E+MmCMSxcrGoaCq+WbPoqrp zElMjUq5DFKxlis0Vfodw2Y8WMFGvqwHBlp1eoH4YLULg+VUF1DjuI/LX13ua8XrHmkO mz0N4gfpnqHJe5kZKlBeyJ13Vq+Ykrm1n6onfaG53mPhdmls6pU4QBJHfupteJ53XofA VSSg== X-Gm-Message-State: AJcUukci/amGx9rI+BVER7Gq678QioOGqO/TLmGL+UtOtWx+Ym+xq+Ls gshHQo+gHyGVgICTd7eQSXEEHQ== X-Google-Smtp-Source: ALg8bN6bI6kCxC4BqxUEiUgTYI6W6CiLIOnshiFU+e/0Ybp+o8c7bUzIrCsxiftfkgC9xU9EH8URjQ== X-Received: by 2002:a1c:7dd6:: with SMTP id y205mr7116773wmc.121.1548737948077; Mon, 28 Jan 2019 20:59:08 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id n127sm1733195wmd.20.2019.01.28.20.59.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:59:07 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , "Rafael J. Wysocki" , Viresh Kumar , Daniel Lezcano , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v5 9/9] cpufreq: scpi: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:15 +0530 Message-Id: <082a9bae988061ea5465f7cdb4b0c61b4230cd59.1548737236.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 X-Virus-Scanned: ClamAV using ClamSMTP 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: Sudeep Holla Acked-by: Viresh Kumar Reviewed-by: Daniel Lezcano --- drivers/cpufreq/scpi-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c index 99449738faa4..1db2f6927e13 100644 --- a/drivers/cpufreq/scpi-cpufreq.c +++ b/drivers/cpufreq/scpi-cpufreq.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -34,7 +33,6 @@ struct scpi_data { struct clk *clk; struct device *cpu_dev; - struct thermal_cooling_device *cdev; }; static struct scpi_ops *scpi_ops; @@ -186,7 +184,6 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy) { struct scpi_data *priv = policy->driver_data; - cpufreq_cooling_unregister(priv->cdev); clk_put(priv->clk); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); kfree(priv); @@ -195,23 +192,16 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy) return 0; } -static void scpi_cpufreq_ready(struct cpufreq_policy *policy) -{ - struct scpi_data *priv = policy->driver_data; - - priv->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver scpi_cpufreq_driver = { .name = "scpi-cpufreq", .flags = CPUFREQ_STICKY | CPUFREQ_HAVE_GOVERNOR_PER_POLICY | - CPUFREQ_NEED_INITIAL_FREQ_CHECK, + CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_IS_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .attr = cpufreq_generic_attr, .get = scpi_cpufreq_get_rate, .init = scpi_cpufreq_init, .exit = scpi_cpufreq_exit, - .ready = scpi_cpufreq_ready, .target_index = scpi_cpufreq_set_target, };