From patchwork Fri Jan 25 07:02:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156542 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp17909jaa; Thu, 24 Jan 2019 23:03:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN55EzwXr47DSoLevvXZoZwoHcFYZc3vhenVk6W7DJ8EWxvEkhIQMmitDDepq4LXT9fXu9uu X-Received: by 2002:a65:4784:: with SMTP id e4mr8765191pgs.12.1548399780395; Thu, 24 Jan 2019 23:03:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548399780; cv=none; d=google.com; s=arc-20160816; b=JYt0YlIS2HWWLRtEqsQ9Sw2XLwnohMARfDQeXd8eSI3e394/p0Xmr5RYKo8q7MTpZ2 OcGmFy/RdRBieIu475CQqF+bBv1TKPwe7UCTw7/wu6/kgh3iwM0M3niowHTstC0iI+8L QMzsMnFtXooBGBuGceUVMkPhSriwU4FXUtzvjiWstSE0TJ8t871ovBuBzhw2wWydPj2L lRIqo4fsd8p3dHwSlPghyjeaMPTjATmY4mlBNpux+rNMH4FMjuUSFM9eYqKXGkAn+SJw /lBIfvidgJ4DHJ55cp4pfY5I8a6Zh+bMGcdkRKV/Fb88o9IE4ZlIc5m+2PoaFVewE4B3 sCHg== 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=M5tXVSorWIxjyx2W+vXR4nkHOdqq0FYsZWQiwd4C6lQ=; b=MZ/WUfwVvuzJXICH3zR6YHfPQZZSvgziwzys0e+Z/QuPnlIxfdaivDRpFz51CJWB49 ai3XCyyhre3e0tnj+dxwZ7vWCfRo2oBUIpo7a3FqhEJ8VWCQiNrfFGt6F4cETtuuWgYZ 81M6TmEuKczx3lCPhnxTJYVPfzsQczXlw3R2WcZ32Ah/nhKGG6OysA/ouQyI71xfMhr1 Q1kHUsKu0HAB6Lj62zDobpi0evndxVmSaYqJwz+mZECEfPYY+QReIR4fQ8wkcgWaewCK E6NpmSLpyk0uyet0KRlexf8xAKPdZhoObivZGqz1fD4+xfLfI7yv5w1B2sDKbVCVMox1 edlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VumhuCF2; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 n12si24397119pgb.563.2019.01.24.23.03.00; Thu, 24 Jan 2019 23:03:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=VumhuCF2; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1727858AbfAYHC7 (ORCPT + 15 others); Fri, 25 Jan 2019 02:02:59 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:42225 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726897AbfAYHC7 (ORCPT ); Fri, 25 Jan 2019 02:02:59 -0500 Received: by mail-ed1-f68.google.com with SMTP id y20so6546031edw.9 for ; Thu, 24 Jan 2019 23:02: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=M5tXVSorWIxjyx2W+vXR4nkHOdqq0FYsZWQiwd4C6lQ=; b=VumhuCF2lE2V20MUI6pPWSxmHxM9lbw8uK2pFz39OqJPiVJr6A9+UcPL0jM5gEJ4dL +/cApfsQOFSMK2gSkFhu8j9LM/XfEnmi2RLwg9WSSqqAUrCIVHC20WOyad9arys8HMrm eqSjGWKel/ezVlaXpKu6lL+SBBbctZCKoCY34= 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=M5tXVSorWIxjyx2W+vXR4nkHOdqq0FYsZWQiwd4C6lQ=; b=ENFMxHOQqmRfgHsbD7WIr6DRn2RYQMzNbY6dk3ouMopEvVPXDMZpYfkPOBljGKAHip wajly8GWE9rI4BrMqEhTUiyn61PfA3FZ3iyNFAfknXl07XF/PkGAzFe11PcES7cHPq9t S4uPqL0QJrJFZrt9VMNEpiWfzoyd88NyZ4Z96JAxSNavKO7PBBsxs5uJstzD63Is+98M ZfJ+8C0M2+vXf6Zal1r+1IAF8ChadYxL2GCXqAHkt1dYRqe+DeJY4vAVqWWAy83VsYcL UztzGH6pj4WQNWPClh0tDnkq9/LNeJHOXP3ZBS/2nYZYNonGYLfsCZC8WvppOP5KzP8y r1HQ== X-Gm-Message-State: AJcUukc+UlnC39kx2Eu8L7Mvo9FwLDcPFHjdFf12ovJHCeYeRiCjLvV9 rbYcYRZQ5JzmM4ZrXFnSQWph7g== X-Received: by 2002:a05:6402:796:: with SMTP id d22mr9827585edy.81.1548399776747; Thu, 24 Jan 2019 23:02:56 -0800 (PST) Received: from localhost ([49.248.181.51]) by smtp.gmail.com with ESMTPSA id s19sm402863eja.52.2019.01.24.23.02.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 23:02: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, "Rafael J. Wysocki" , Zhang Rui , Daniel Lezcano , linux-pm@vger.kernel.org (open list:CPU FREQUENCY SCALING FRAMEWORK) Subject: [PATCHv3 1/9] thermal: cpu_cooling: Require thermal core to be compiled in Date: Fri, 25 Jan 2019 12:32:21 +0530 Message-Id: <0d63ca44cff5f47ef0102b2c86b4fe9eca9b658b.1548398851.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 --- 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 Fri Jan 25 07:02:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156543 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp18013jaa; Thu, 24 Jan 2019 23:03:06 -0800 (PST) X-Google-Smtp-Source: ALg8bN7waXL6XrELQ4ms5ie/+G0z0mP21qcWfqCCb+lDMBhi7asMdvbQK8vVFjqtplk1WdNuuQRI X-Received: by 2002:a17:902:145:: with SMTP id 63mr9740370plb.256.1548399786796; Thu, 24 Jan 2019 23:03:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548399786; cv=none; d=google.com; s=arc-20160816; b=rwMiSq5DOKdfE69rRdMS2Skmg1i0ivuw6Ix+mmBng+MH8hmFOrXL7o/EzCce4QmQ1b Rr8gDhZwDnratYTqEox2RnOvESA4AUMr2C0NdIL3BONmop+kQxnIKc8F9Nb8aIql63LL SUo0dtf4a5/DQifakE9qCdhXDWfwtP3d4K0NqivZCSMpyLxbPt9rQCba0fO1YIZ18+l6 P7TYhal4hy4ebXsR3pNZrHVfYgSQ2nRrkumlNBs26kw5KO8SK9iq1xcrPsBfQ3m9V9P8 v6axXPJu8XpPMKETPqM53x88g0EJjXs66NLFD3Es4qJYRL09OXBbW+1pzW30LZRMTClv OIYw== 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=y3EtZ9Zijh6g5b1BdvkqodqbkDXmOjJfZ/0yd7HhXeE=; b=ImmUBsuS8AHNoLGm/Anr1IwCtiWlZVMlcNg8Mks7wdcPCO8xSW5FLE752FqH+qUnVA iwaJSSsg/XXl6ecbxl04xJQN9hxVIaFD/OoDUEZqQvUVbdl9RDtSj/XaZ8EL+qdF2rOv fdQajuEocfOYeNPH0KHNSFb7ODCoYr8AnDDIMqYgCgAdu/LlyNO4aAvnXZcCob0viKJh xAex3mRnmP4GKoz6pJzpUtQFbz9zeh7OvDoZ5ijqKUI52EBlWEFBRVlilP53LL109ldU J4g4vIeCG28YcmhCyYawGhW9zNxl2sqEdAsZ8eVP9Xi39V7vitl2DZQlxoAwnEwEdDIq /+hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N2cWSkuY; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 a34si6490933pgm.427.2019.01.24.23.03.06; Thu, 24 Jan 2019 23:03:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=N2cWSkuY; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1728030AbfAYHDG (ORCPT + 15 others); Fri, 25 Jan 2019 02:03:06 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:36974 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728012AbfAYHDF (ORCPT ); Fri, 25 Jan 2019 02:03:05 -0500 Received: by mail-ed1-f68.google.com with SMTP id h15so6560414edb.4 for ; Thu, 24 Jan 2019 23:03: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=y3EtZ9Zijh6g5b1BdvkqodqbkDXmOjJfZ/0yd7HhXeE=; b=N2cWSkuYkCEV0DFcML/0FcxMJLPso61+fkMzVT4Mqvd8kb07HlBv8CLzu9f9ruMTv5 rSVlVyo2UkXWTulTswVoSQNxgTbRyTapa+rDEU5RX/XV+04+5n7JQYPprzmadmUKbI2M 9fWlg7Z52z/ym4NaMQxg0kyDQFUH0twFyEWfY= 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=y3EtZ9Zijh6g5b1BdvkqodqbkDXmOjJfZ/0yd7HhXeE=; b=mC19h8sr0tGHRTyEQcA3253yuWl9Z7i+EXPJsVMjWywugjaUkjoI/1I6/03iK2mfLz 3ZOdxyX3COTPYm4hib6iHolPN3Sy/QE79cbS6j0jho+8WPE2JRwMgqSugeGTYy2sOCv9 Gt7G/v1LSTmtqU4kN69OXwD0LIXWZPvKY/oJnCGc5PYtqBAx4KC2WYG9qez2pCKb36YS 0E6ng8/Nknf2fEzndI1btQ8XUBMG0T3W3JJT1FYPWrlN0Yv86+ttt4wA7TA0b5x1f0dU eAxHw8Oc2p1uagXKSDm40Lg7QZ+y11cW2cMk9to+zM+zKynZmuJGRAt8QW/MNpuQ+SXz +69Q== X-Gm-Message-State: AJcUukf3tiMdHfpfbLURn+oYlzHBMmt2YFVASS2mxztLuq+1NgHIkZ+h SDy2qjwe7NqowAuomDga6AwazeTsCbE= X-Received: by 2002:a50:de88:: with SMTP id c8mr9572635edl.129.1548399783664; Thu, 24 Jan 2019 23:03:03 -0800 (PST) Received: from localhost ([49.248.181.51]) by smtp.gmail.com with ESMTPSA id h47sm11808656eda.8.2019.01.24.23.03.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 23:03:03 -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 (open list:CPU FREQUENCY SCALING FRAMEWORK) Subject: [PATCHv3 2/9] cpufreq: Auto-register the driver as a thermal cooling device if asked Date: Fri, 25 Jan 2019 12:32:22 +0530 Message-Id: <73e091e2d56d9fa6eb94feaed9fc2be30bf6da20.1548398851.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 | 21 +++++++++++++++++++++ 2 files changed, 27 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..c7eb59b8ce94 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -151,6 +152,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 +390,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 +425,17 @@ cpufreq_verify_within_cpu_limits(struct cpufreq_policy *policy) policy->cpuinfo.max_freq); } +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; +} + #ifdef CONFIG_CPU_FREQ void cpufreq_suspend(void); void cpufreq_resume(void); From patchwork Fri Jan 25 07:02:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156544 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp18097jaa; Thu, 24 Jan 2019 23:03:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN5jer1eCd91O7VaWZ+16pxsWay/ym44sxs2M24HGo8vJEJ0l/tZOGxuBz8bmUytf2fLmWL4 X-Received: by 2002:a17:902:209:: with SMTP id 9mr9939031plc.288.1548399791944; Thu, 24 Jan 2019 23:03:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548399791; cv=none; d=google.com; s=arc-20160816; b=M9bQPqVzI8Hy1IrW+HKx5Esgng7g5AWRqJHF6Nidkb2R+l7dQxZN4Xy0kJkTBhsOig uDNyR0AfZtsscjvP+86nYC174pH3Le85QCJo0vezRw7hKMMENl8ivHw7ERh91qzacB7N 4qYzsqeyDQ243eoAYVOE2xFjMh5RJDak0ryWvOiUliECv88FdRmK3H10gOcTzBpQSx6y dcysp9+tcLF6n+tpN1hpT4/+QRzHUNtG9hcRT3b84MY1pusEXRZEbJyVinSTvLf+NL3t /YSJfUOMReqwl02SBM4hB2TGvk2sjcVmBRv27c4zPx4vFCzh76G4YS6mZa0nqiYktRVq RJyQ== 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=zLqXF7SYoovkgBMNm7MtzJSzeE0VgZYQlKefNmrl8Go=; b=vpbFgMnRN0JP5LbconJK6a7/f+cj7Pe5JaA7uIkldzVnU07K/kaQ+aUvFyRUJwObZv Elaen5MuLegOXx+Uxh8nqmg4fpyLq6pPMzjciYmIpXVt2+zwMdVJHiKwFsCgPY4hQiOx MaDE8bstTiw8eBb6hcpTA1Qq56C8h4+/ipCK2cI7RRSl5of/LDx6vvsAuYtNidlamZjN E1I7vxr40YC440dcT8SLKkXcHdsXyO21BiSKoteROvjeUTBgl8TTdOSEvRHePvihBzFI P6WFm+2iFlG2eaktLJsuiKo5OZ6Z4thj+ZoSwrKMUGIN2jrmpFMAhgSMO69E+XmtGMe1 revw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EwLhTb+1; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 y7si21681719pga.296.2019.01.24.23.03.11; Thu, 24 Jan 2019 23:03:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=EwLhTb+1; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1728191AbfAYHDL (ORCPT + 15 others); Fri, 25 Jan 2019 02:03:11 -0500 Received: from mail-yw1-f65.google.com ([209.85.161.65]:34507 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728143AbfAYHDK (ORCPT ); Fri, 25 Jan 2019 02:03:10 -0500 Received: by mail-yw1-f65.google.com with SMTP id g75so3536307ywb.1 for ; Thu, 24 Jan 2019 23:03:10 -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=zLqXF7SYoovkgBMNm7MtzJSzeE0VgZYQlKefNmrl8Go=; b=EwLhTb+1nwC8TLvJKx01JbTutq1255mupbqFFVXEEgh1OnGkfiBmHs6hz107JGe/P2 x6PnUPmI7FFNWIC7oQ8STOnRyd82VZiyDGq40BYlDzxM6UvP568DlE0NyuAJEnpRYOxN /MmudNV7UWET34KAU8JQ6M+t28sGKGm0Nrl6k= 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=zLqXF7SYoovkgBMNm7MtzJSzeE0VgZYQlKefNmrl8Go=; b=BxP8YLV8V5buTQ5LDypb+j4vCoLA8srPOUd/pymLZU1K0lSi6AItUpbnoTUdiVLINS IVHgune8cZAM4B0IveV/1YyNs1yJF6qmvu5QNXe/uuwuccvJPbFyKwY/yORaWRiA+UAw f7cYgSobO2ah6yoYTdIztyAqn8V2q91oaTKi4lDmGMBumySwCg6IAojIFhjSKcI7/ZbS 2E4icwptZWxUq1H3Yj8Om04lZsCHuZFFv+bE+Us2X6AGYhnJEnbu2MLcYkl1VwDsqNgL nvZhR7duFP2MnKv0/v4DCpMw5L77KFqBUBMWadFaViPbicfLP2Ew8D8GCKIcoMNVvmHh fLUQ== X-Gm-Message-State: AJcUukdAt6j5raaxo3f05tGgQcpMMIjL22OXfuHywIeeuoPEuDP8wN3P pL1FoOBg0Be8p+zIO+pZ2F/KFg== X-Received: by 2002:a81:4511:: with SMTP id s17mr9655402ywa.430.1548399789522; Thu, 24 Jan 2019 23:03:09 -0800 (PST) Received: from localhost ([49.248.181.51]) by smtp.gmail.com with ESMTPSA id i2sm12390826ywc.59.2019.01.24.23.03.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 23:03:09 -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 (open list:CPU FREQUENCY SCALING FRAMEWORK) Subject: [PATCHv3 3/9] cpufreq: qcom-hw: Register as a cpufreq cooling device Date: Fri, 25 Jan 2019 12:32:23 +0530 Message-Id: <03a5f33f0667b58eca3c65a7ce1c25a4e5cd00df.1548398851.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add the CPUFREQ_AUTO_REGISTER_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 --- drivers/cpufreq/qcom-cpufreq-hw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index d83939a1b3d4..ed32849a3d40 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_AUTO_REGISTER_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .target_index = qcom_cpufreq_hw_target_index, .get = qcom_cpufreq_hw_get, From patchwork Fri Jan 25 07:02:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156545 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp18214jaa; Thu, 24 Jan 2019 23:03:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN4OK1JRVYve4IMHAxjtpvfpHA4oBdB0U5MldJgf8ksc4oaeLRmV/ht1oU/ISGl8z6dmi3uo X-Received: by 2002:a17:902:690c:: with SMTP id j12mr9704457plk.206.1548399797526; Thu, 24 Jan 2019 23:03:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548399797; cv=none; d=google.com; s=arc-20160816; b=u+KEL1MZM+KULrnF+dgExAV3AhtQMlqntEIb4QK69ZkWZqFmSo4CMUqXdTaJMK4AF8 7FHQwjHWDcgPuGNNS8CERW4nXIp//kAeC3UXjkAX0u6Iead+7I07qBDn3jEESEmcSgsa S7OnhKR/Amd51veMwZnwQQ/+J1sje2BmxneulYewsdJBo22rZ58YJhkhSZl5mpPQtXAJ nM3WRGpCVtqWjK1laGA/9KzGtz2IsBadmBUhtN25hYN1llTAyK8bW0LG7WhVCI0w8LqX ClNoX9vjdxzmaBpY8/HXa3+Gdb0YPR2icDo0ypjsYVUdfRVGdA3EQ1HgjnOWCd7jiR6C TR5g== 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=1aBBJ84u3ymAhFuzjAtS5nCyk99H9ZXfxJBF/z7RCfY=; b=uZy1LkljIDN6lDojv26e7q4kDvBk8xRbiGVWhpc8AJtnvpROkoAi97nptcDw2ApmhW vDM91GQJQrT0U6tGdn5g+po8/iWBpzm/O1nV+AKEjoy/a2cSmq+a4C9Hj9uqkc9sgt37 YRLk+cpGvVl7E+u1OQMPhjTdgChs3fYD//gQ+9rqT68+x0douHrUboWjyCaLYkQay+s6 QgT/80iMHZGBwX4/+dzIW3HAffAXselRjpedzSqiC8QYjPzGgASD9o6y32w6vfT5Xhuf KXWUZOVikH8Cf/E/UkaBItmvFqYyP7n6mBKayjjN5my1YLQ8ILSkKCz4Bt8l3Do0qFNZ eB3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NEk3eDfd; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 o10si24044000pls.76.2019.01.24.23.03.17; Thu, 24 Jan 2019 23:03:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=NEk3eDfd; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1728292AbfAYHDQ (ORCPT + 15 others); Fri, 25 Jan 2019 02:03:16 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:33048 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728283AbfAYHDP (ORCPT ); Fri, 25 Jan 2019 02:03:15 -0500 Received: by mail-yw1-f66.google.com with SMTP id p65so3533952ywe.0 for ; Thu, 24 Jan 2019 23:03: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=1aBBJ84u3ymAhFuzjAtS5nCyk99H9ZXfxJBF/z7RCfY=; b=NEk3eDfdH6RfX9hchExtslZ+BOkSbowcM9TqUZKf4LXiHXO2GBftEUFiMmgVxLfEX/ B53QG/F66Ki43J/CZy0q6Xy/7ZT9UuuCZIFF3G0BowFvb43DtZgFu42ENX11ThPZSR/8 YQ4wpc9xVwYCgAfaB02CgPrlW4/5xJsB1cLAc= 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=1aBBJ84u3ymAhFuzjAtS5nCyk99H9ZXfxJBF/z7RCfY=; b=pC4jtwMSD1ak0v7dmg0/oYa8rVf4fVJ8MGJ08kbSUyb1P3nE0Cr2Umvd1uWMEnZoIp qpnukMslfu1q4qbu/4iqKxNO3uWnfdIRfEOPVWa+/lo4agvkcnWLMLz6wjOCE4ty1dU/ G/rnwJPtp08Bq1tPYvK/HjdprMryal2xefj06M2onquFBYpu1iBY+pd4JxOnQ4leXSUq jZY7dnbyNfKVpD3S6BlzokcvKQhp3gM+ywDL3AwSqc09FZulj9xz+NXJlf48p7y27OO4 JTaursS9GRfAD0Yu4HCYOt36PLP+KsPf7HWoyBEG/9fwKt77heAXwLwnAqj38HrlQqNW MUnA== X-Gm-Message-State: AJcUukeOfAUHvdGNtGwW/X2J1pt8syp9Q3ysgxF2SDn/ksO0O5q2g0Kw 7W/yVNyVOFO6BbyVkB3qceBaiw== X-Received: by 2002:a0d:f7c1:: with SMTP id h184mr9695278ywf.473.1548399794630; Thu, 24 Jan 2019 23:03:14 -0800 (PST) Received: from localhost ([49.248.181.51]) by smtp.gmail.com with ESMTPSA id i128sm10340153ywb.82.2019.01.24.23.03.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 23:03:14 -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 (open list:CPU FREQUENCY SCALING FRAMEWORK) Subject: [PATCHv3 4/9] cpufreq: imx6q: Use auto-registration of thermal cooling device Date: Fri, 25 Jan 2019 12:32:24 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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/imx6q-cpufreq.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 9fedf627e000..9935df234fa1 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_AUTO_REGISTER_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 Fri Jan 25 07:02:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156546 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp18304jaa; Thu, 24 Jan 2019 23:03:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN72v+iKU3QrUvG+modUbgAKUDOL6V1Vt8+yJpuTfYCkw7uujNxgvn3FqVtm8PxzN8m5wjs8 X-Received: by 2002:a62:6f49:: with SMTP id k70mr9676613pfc.7.1548399802464; Thu, 24 Jan 2019 23:03:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548399802; cv=none; d=google.com; s=arc-20160816; b=r+qpNvJNLu7DKa5Z207v0fi0WdX7wRbGFI/grStpBeFGYZG1rn8dIDB2x/aR254lwc Tg4lvIpvWATt0ixBBNukSE0U9qaTy6cZ9JqFAEN95Sd9I5I8/vQz4oZJ/LVFuWqF10PL wJ1EJNZfbx67iQN3wM+UKi679/LnRLGFutoaPyWTpAipSd5G5xNKS9DIrc0AF80UTyQX ttRZldlBCcA4PdXQqNlfZsyU2zB1LuEud+vP+zY7Azia6FoGgZduBsqfWuW1AqsQby1T 8JrB/cSwI5ZoeKp2fdsOCj0GplVLAvtxr3Lk7srix6KWKvLpV3jEP6KEE/Lr/geidZHZ Kl/w== 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=vvKU/vni5tiJQMfKN1lI3GLEVjFx0rHFgSlpmwbDnlzmV9ifU+YkgWov7hK+05FUjx hgrLwQXlNalXbRdEjZQGdmaoVz9en5VYoHaEeZ+Z7gCXofHcC+og+5Joc8stkIaszR8z vfS1QzLnj9/Lq7szV9URd+R1bhQ+r+aZXwFmo0czl3KnjZjNGWz0OZcCcRIoL56OisyH PfeDVe5NtyvREdLogorXiJbylYSf1+TYGiMG/krrJAr4UG6W7WeDzsCbmuftJ7hDsGjL ICV6rx9CDUs7XqwtI3f9FhXFc331OVQAycluQdVyS7GMlJMtHa/UicrHNhXTkzGuAXIH VhDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GBHMSNqA; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 v2si25255863pgn.451.2019.01.24.23.03.22; Thu, 24 Jan 2019 23:03:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=GBHMSNqA; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1728362AbfAYHDV (ORCPT + 15 others); Fri, 25 Jan 2019 02:03:21 -0500 Received: from mail-yb1-f196.google.com ([209.85.219.196]:33084 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728288AbfAYHDV (ORCPT ); Fri, 25 Jan 2019 02:03:21 -0500 Received: by mail-yb1-f196.google.com with SMTP id m132so1724033ybf.0 for ; Thu, 24 Jan 2019 23:03: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=7flkZLLLMPKnUBob6lG91eyXS2wXjEuVdEl94VSGgUQ=; b=GBHMSNqA6ShHtjwmgPgitPzf3OS+onfrjvdFO2ocI8NldpG5NHv7o7TsP0RMdkA1mw 0M5HfBlXeVCCP38rpGx92Snjzug5Xc1Org8gvRrfsICCbg8pTG5GaU6A1mT8gmJG1GRF ItEe9bb6dImdTacqjh5d1XyxEy7BWoe+qRgHQ= 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=grOjk+vfVmSpa4ns7QFIJ8boluwxWVXLqMpHNfrX9748HjMXo2ETXd5W3aF+V2+Svz vJxsEH/KNsKHSrN1E9Y0HjPWx5E5WHaOPcKQzz+FKZKJ3ZzyMX5MaCBTvKVs+cKMtwQ8 ibVd9OXrpS7O+nJOf9ZsZ6aKh3D3eVFpvnBPBj8nzlHr0dGq5BcGWUpfQtrQQI9VP+9u /hXQMVvu0NruAiNWPnj1KgGR7HqIEqYdLMUrRoN+iRITX+YljxIoGwaxuLcHWnd4CEIn 8d41CEIsDakO+d7JK8iBGx7QrAwEr7bFSGAzcM/vsRhPTvnTEI+JlNL3FHLvx2grpPFB 6oTw== X-Gm-Message-State: AJcUukc+lx3qqAeJ3G5bIX1kgbExCUHk4pUU61HNl8nwT6QZaivd26t+ tcU1HYMAPSewscOw4wOiQ36yvQ== X-Received: by 2002:a25:37ce:: with SMTP id e197mr9589228yba.63.1548399799997; Thu, 24 Jan 2019 23:03:19 -0800 (PST) Received: from localhost ([49.248.181.51]) by smtp.gmail.com with ESMTPSA id y187sm8940007ywf.50.2019.01.24.23.03.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 23:03:19 -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 (open list:CPU FREQUENCY SCALING FRAMEWORK) Subject: [PATCHv3 5/9] cpufreq: cpufreq-dt: Use auto-registration of thermal cooling device Date: Fri, 25 Jan 2019 12:32:25 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 Fri Jan 25 07:02: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: 156548 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp18458jaa; Thu, 24 Jan 2019 23:03:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN7j/pJG+eGo8B8yRWSotmf9xn2hzRUpTsuVlLnQakDetyVEZd94d/RcjYnDC/XnyJq5kYSi X-Received: by 2002:a65:47ca:: with SMTP id f10mr2402817pgs.166.1548399812539; Thu, 24 Jan 2019 23:03:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548399812; cv=none; d=google.com; s=arc-20160816; b=SzifmKEE+CV4f5HbzSKFuChJGOcS4dD6beVODXZSO5Js8LDMnbe0gw7RP5owXgYDvF +BFUpXZJ4peWCe84O1qi2ZMAqKdLMKum4ecXcjY7jp9YZg0VvrZpiHUjmhdTyht+lQsv Y9ZSmIJgdOf4hVApw7W96cZEcTq/JANaoHSaiperkS2SYGY/M+K8HZsm4+eVHYbK/93p iYEiOtiAqowagtQbOU2RLT3FmMkrKy6SAvMDu1WSmXrtKI/k1job6eBTSXDiZJecIxdd xlhfrasaqyW8EgWuCcr8nIQ6zjd3Kzw3X3xsC/j6Ysvk4fAyxldkxyRwL+Iq1fNVbCD9 8Q5w== 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=uNg8u+PNEUeQRX4cygjXzjwXE1TJnohQR0G2mn6eilSxoftFK7mToYkNcH5mqcGbDJ GSlDHaScWDaljnw91OctDO7dzM1ve861nzFDerxmqnHiFU4o8u4D7NwRqKAe9Vd0GwPb UnOQfK72xOxsJ0DbMSytSu2vYBy81Y0XHZXxIyITDUcRd2evIOhlC3y0aM5eDRiqQkdr yTwkbr2w8bPivlSNPVOEI387bYErNRii4pki7gOYoNBK1PYq3MRAFxBeYGOU8O1V9aqU Z1bwY6IL0y6GASavsf0wvirIfvyoyyWC7tlMUVTVycjQi00kRKgJPhLqH9C0Cckf5ewR OuEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mfl4kUgk; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 z63si18237139pfz.132.2019.01.24.23.03.32; Thu, 24 Jan 2019 23:03:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=Mfl4kUgk; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1728524AbfAYHDb (ORCPT + 15 others); Fri, 25 Jan 2019 02:03:31 -0500 Received: from mail-yb1-f193.google.com ([209.85.219.193]:40625 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728505AbfAYHDb (ORCPT ); Fri, 25 Jan 2019 02:03:31 -0500 Received: by mail-yb1-f193.google.com with SMTP id i6so3446250ybo.7 for ; Thu, 24 Jan 2019 23:03:30 -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=Mfl4kUgk5Aal9odAJZaf5fVDL4LZALQC7ZfU1MBmIZrUrGFbkU/ZoVR/6wogyLJqT3 nBXoxBHOUyRGxHsVUurXbrSQ8ExPyV3uzHl/p9AqV/3GBDONOntxw0HZOtNYbgx/s40b N4Em4TZXghHpuLI7Wvt/9ucEhVUfN7XsiTGl4= 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=sfB6I+zxlIfV+5d00ACXVvUgai7RzWdVUIIChDU6LEE62cOH5WxqYixsbJzmWpWxP3 u7pi6Nq3+OGGulfCNGrBBbcHdAWWHuUFQbA+AggkmwxgtmObWnBzbog/qd3KfyTf0gAV wIMSIE8nEr4dCHVvvtRtwcc/uPjYHUWvJE2lvnV6zDfE1pYLfL35qLVlPVrrUhUN/isT ZUfZav20g+U5tMFwrkfyx3aMDolq81QAEk/Tg0x8NKTevRenQX/fWNcCp9Ck9oMQvhof xvLWu+cGrt2HKQ5Eh6481MaDipxNW1h1GeDBjoZpflOUxhzNR1a8EwhcNc3dk70YuiPt hwmw== X-Gm-Message-State: AJcUukcx2uP2kw7HHjS2T5kXW0x1c5H0rr/2ZDuacrVR9ZwnEUMjAfZE hez5jrWQGJHNFH5d4g5CiixAFA== X-Received: by 2002:a25:d688:: with SMTP id n130mr8188972ybg.29.1548399810240; Thu, 24 Jan 2019 23:03:30 -0800 (PST) Received: from localhost ([49.248.181.51]) by smtp.gmail.com with ESMTPSA id w63sm8943697ywc.46.2019.01.24.23.03.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 23:03:29 -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 (open list:CPU FREQUENCY SCALING FRAMEWORK) Subject: [PATCHv3 7/9] cpufreq: qoriq: Use auto-registration of thermal cooling device Date: Fri, 25 Jan 2019 12:32:27 +0530 Message-Id: <1d18d89fe2fc3655d372a0ab25e1241df4f8dd99.1548398851.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 Fri Jan 25 07:02:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156550 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp19211jaa; Thu, 24 Jan 2019 23:04:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN54OmotI2cRSzrwxvAfmp0N9KkvbLms+zzUar1T7jMDr7aJpNNYVBEAfCaP7XoppJ/JXkLd X-Received: by 2002:aa7:8286:: with SMTP id s6mr9596945pfm.63.1548399862633; Thu, 24 Jan 2019 23:04:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548399862; cv=none; d=google.com; s=arc-20160816; b=UFqi1d1pFkb1wDn42YJ23LlH3yFpGkJ9edaeRJIdacNeY0qUeUnJj+XDpGJwhvZlKw 8bw4lrIzu8XdmsEeNcVTsVJzvg8EE9pM9lVbSGv8P5YmP1So9YTshCep35XKx7x2h2ew 3/W6K7xKeLQRl8n6bymvZfMNBgE2fci/P2G/irEYrmNZd6jp4pRyScqvrUVRFB+nxrQi kwJq7JYf55wIF7lkag+9nUloW3ZHShzV/DLiR5KTkb/QlKv0cQfzHm7ybE3ZWz4o0B85 NV37P5Q03gJvy2Wyrffo+kD7BpTwqZk/HANhtpDLTCIoAoLaZ4ZVmFqvy1u7SfdNJFAX 4TPQ== 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=lmDIKADatw1oUeQ5UHUMSZddpdBoEMSbYiY1RQRpnEA=; b=p9bqXlrjUmFRlabFQBPKef5BYw8afZGTddP9vD4UhAmC1SVlZX5Mr6ZbTVOb0lcBss YbD2yyoloklOIch5b+1BYMLB2IFRcV4UZf4rhMKkogeudyx2v77ywhtcyg9K2aUSI2uK waRHT2t7P74USKDDIiaSryoUVFEIMRWao5KmwzAEcNhNplfy4LoAOLVRg3g6mVNYFIhC R1UMgtUO+8YlrYmZzlOiP4hVVOhUUwySHL/i3YFnp/dAXYu+XfQf0nGVLzLxEAgsBDH6 +Bpzutn4sMUvOdnr+Scg49bH5VEeGfFMbAlzbIVbqnS4k8Pyjn+/dDpxoodc+Raqc9VH uUyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c9XfQHXK; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 o19si20154240pfi.261.2019.01.24.23.04.22; Thu, 24 Jan 2019 23:04:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=c9XfQHXK; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1726381AbfAYHEV (ORCPT + 15 others); Fri, 25 Jan 2019 02:04:21 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:41450 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727864AbfAYHEV (ORCPT ); Fri, 25 Jan 2019 02:04:21 -0500 Received: by mail-ed1-f67.google.com with SMTP id a20so6542868edc.8 for ; Thu, 24 Jan 2019 23:04: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=lmDIKADatw1oUeQ5UHUMSZddpdBoEMSbYiY1RQRpnEA=; b=c9XfQHXKTJjH9D8+A9yWRU0POrNIBML8yy4f3PPCCfnJpwyfoCXm+jquPMXGhj78uP v3QMXI6KhuZb5C1BK6jeNEPlGnHiYGwAZUc/Oet7u0C3OjNstLEQ0B6NnDxAPvN9TzNh bVB81EaHQT+ngBa2Tn9F3YVPUF3LOVVXKHEvY= 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=lmDIKADatw1oUeQ5UHUMSZddpdBoEMSbYiY1RQRpnEA=; b=WCU26oKF8d5CL55773NAVRG7GuQed6i68dNmFoEv1XApodyisfcxLcYkLYjOtEm985 nMkHOSTA8exdBIGUG1/WXxz5MvxkymDEzI5OZkUMcAO0UrQu9Eg9tlpDo8l4N4Iqd5sQ Wm1fbFOK1Zij7Wzx8S4Ji/jwAdwlRLRv48GLrN0bLObao7H0qkKmxGBZ0/d2Xb1yHEt+ kRkqqEPn9PjK1c35pKpEbguzEDDBfGgF+grvjUqgIY9w2gaZn2Bgan2tNiOmOVDxwz0Z CQ+x5VQs+/wSoaoEAtbbUGTUqIKHAbn0SkAO85SFAQlQV3LSX1nse9tVy7bkrn3cjo5o nm/w== X-Gm-Message-State: AJcUukcV9co1gAn0EICnXefH6g60VACwfXxqF06KnjVAjyKOluRwGW0m 7vLhZ46xpwSnPrPBh0I8b0hMDtrln5o= X-Received: by 2002:a50:b667:: with SMTP id c36mr9996768ede.190.1548399859489; Thu, 24 Jan 2019 23:04:19 -0800 (PST) Received: from localhost ([49.248.181.51]) by smtp.gmail.com with ESMTPSA id 49sm11802931edz.59.2019.01.24.23.04.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 23:04:18 -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" , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org (open list:CPU FREQUENCY SCALING FRAMEWORK) Subject: [PATCHv3 9/9] cpufreq: scpi: Use auto-registration of thermal cooling device Date: Fri, 25 Jan 2019 12:32:29 +0530 Message-Id: <94d264be0f980396cf4d2b94ba31e55ef1bc304b.1548398851.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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/scpi-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c index 99449738faa4..82420e8e5f0d 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_AUTO_REGISTER_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, };