From patchwork Mon Jan 28 06:41:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156695 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3088548jaa; Sun, 27 Jan 2019 22:43:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN5mlZbMxY3rls/f1WKqXmvu1RNHsmhA9yCQQ47hX2PhQVN2MhoeyiyZDrpmEdyjhU1OECfD X-Received: by 2002:a62:fb07:: with SMTP id x7mr20667931pfm.71.1548657807711; Sun, 27 Jan 2019 22:43:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548657807; cv=none; d=google.com; s=arc-20160816; b=v9jTak60OKcNUWlOA1cvbJS+T2L2ZFMHvSwo99WdRnmAh0++ji9LuzxHS+GfBPabzU zja2mqcmEq3ewOKR9NwcRuGNIa3Jtpd7EZTE4AxYHBdhcopFjtn8iuzZ0uz0ps7VQ1mz UHqrjFrX21Dc6+aH7+lPquvOJzSit2e0+5waJ+Ex09dJJ0g2ST5QFe/I9TQewF/SUYf8 FjiNE83/I3Lo1+fIIX7MRJDXtNTWkZgqgS6dje2MMUic6TGHTytH3eP0dRFPH7RUz/uv Ghko6cxbR4GAmIKDgRm99y6kvXw73XN76hk9jBdD3M/aBQbzi0xFFg+avOiWqP19mUtD Wzmg== 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=iDk9/ud5w5GKYf7hFPmtmTZOCXsxg6AcTJ5tJBL26ytmvCmBLgOsxxbUTIO/RssnBk /VlKVIcRRyrNntDoLcXkYGgPLWDGUmOVLyrd0RTLNV2WUG2fyMZoUhHlcanxfip3syc8 vvL+VH8v4oI5R/yV0OnMmlMgxYlIqGZxOzhLoLJRoNq+p4g2MSrbFESo/liFZSQFIjnp KfiUmueMvsmtkWAlzEH8nmzgOpFFIE+1Mjga8RweEfh1I/vhTPs8oTnGm9dXdduiWMpa WFfdSAhsxF4msItZLMC3vUbUBHypSyMhxT6k58NBNjksODwTtYnfeBvTdrdsfrjkuM2u 5u2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HDGCcrIK; 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 y7si29168287pga.296.2019.01.27.22.43.27; Sun, 27 Jan 2019 22:43:27 -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=HDGCcrIK; 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 S1726744AbfA1Gn1 (ORCPT + 15 others); Mon, 28 Jan 2019 01:43:27 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:38337 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726150AbfA1Gn0 (ORCPT ); Mon, 28 Jan 2019 01:43:26 -0500 Received: by mail-wr1-f68.google.com with SMTP id v13so16666620wrw.5 for ; Sun, 27 Jan 2019 22:43: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=M5tXVSorWIxjyx2W+vXR4nkHOdqq0FYsZWQiwd4C6lQ=; b=HDGCcrIKjsFqllqVCMfmgAui7VM90zxEd39qH7JNChB1fhl3BPl93D1PkaYbyzWyFL ziHRHeePH2hdf+dPwUufA6WrDg8M0fRWHpuWDNTbwlAy499uKAH1oaEuyyK7az0kv39K 3C19AaZfCp9ia3YKICXmEYKxMj9+djzrp8aDI= 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=qvzp+dPPf3B7+PyT4ZAMo4bOFkgB/ME3MMVh3hvPu2kHYEscib02SU/HxvLVi6fjhE A+2p0C04TpS4raqy7xeXizb0H7Xkcvp+a2N2JxKAAFe9TGMRgaAObP3Wsqfr23OpDfle KhY8adv6RxrGuihih55px5ECUbbZEbYe1c2Ytb7KHgevkmJUJy7Ss5WFwB2FFR/mYAfN BKs/bKKVDA9J/mGh5Kj12nOTmtFGGCe9Z/sTCPLMk+Tfcc/S+pYJAfWDrOFkCT5UA4Fh qr4Yu7ZaUjvwyOOzCrRCmWxYW929wG+TGw0rPMVxBctULdpUUbA+/hn3SXUmF6600TF0 6GwQ== X-Gm-Message-State: AJcUukdYKzqU+Xi/LJuFX+1Wwfr8IZ3rRISZ8yzLEP1JgoMeT1L8G+qY Xmod9Jvt289EGfQFHWYsKpGaWQ== X-Received: by 2002:adf:fa05:: with SMTP id m5mr19997425wrr.155.1548657804332; Sun, 27 Jan 2019 22:43:24 -0800 (PST) Received: from localhost ([49.248.191.44]) by smtp.gmail.com with ESMTPSA id 125sm133521514wmm.26.2019.01.27.22.43.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 Jan 2019 22:43:23 -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 , Sudeep Holla , Taniya Das , Ilia Lin , Anson Huang , linux-pm@vger.kernel.org Subject: [PATCH v4 1/9] thermal: cpu_cooling: Require thermal core to be compiled in Date: Mon, 28 Jan 2019 12:11:26 +0530 Message-Id: <0d63ca44cff5f47ef0102b2c86b4fe9eca9b658b.1548654899.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 Mon Jan 28 06:41: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: 156696 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3089229jaa; Sun, 27 Jan 2019 22:44:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN7abuinpBErrUTRvqJGH02FABdSXClloiQ4n1Guos1OXWEb5UqJ4BQJAkBcQNa1qNC0JG7a X-Received: by 2002:a63:4e41:: with SMTP id o1mr19224250pgl.282.1548657875586; Sun, 27 Jan 2019 22:44:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548657875; cv=none; d=google.com; s=arc-20160816; b=vuOqmIKwcW+AdtZg3Sml7tyfDSDl8hSyXJ4hEb3M2e3ClleTwf+WC7ZW9s9kNWB0zX LXj1HbCRj75wEpHCVJ0y++IVIKlf9o6tsi5/urLoU3IjCeCNcWuiSNGPDx86IAbfwlHy yvQmWH6DnNX2uLb08CLO45M8GdtzY/+VOV1zRtBUIcyJqHGy4HujiPsGdAEJrSo+yFf5 XFLHeba/nJQoD5ZCKd5KGYedRGVGaNDdVrCC+1HMGxigXji9xYeOAPiX1rvg7kXAZqe4 TN9S6PQhJrvnQni7zt5tiA9v0eCmxN4gjtsp2+jBJnS/XM/OTnAmV7eZ/tj/RXphpDPQ e+cw== 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=AMCeOi6x/Wbey9b/NaGjqvsuxi1tHtv0yD2YjLVBzzg=; b=ffamXjSsYCX0OdjKpkhWibbHsdXKyGSLwr9/Qs0Oh4tXePP1iGDXAZ0OhRVtJt0gcB l8Tu4RJYifoYwnNAog1GbanHL0TKS483FczXJBh8MuAesLkztxCUW95wm1TvPegU9HWh Kp0Vu0Qeg4/xKDmC++F9RHECzE/6shtyx2aiUhWywSzZQ7qdYzCUiDLaMir0i+guOr7/ gQPfpoB+B5fPcBIowekn9WcYj0TsvKghh62PJ/XYEGYsMHoJtZzWaHP/U93qtOvNmcvW HW7wwrC8b4oYBY7cuibpWc42v14uPDM8Gdwga4AOpxSVTaPjouXztlOtshjATj3ux9oT +2AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WaHCrlaG; 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 i69si33107796pgd.71.2019.01.27.22.44.35; Sun, 27 Jan 2019 22:44:35 -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=WaHCrlaG; 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 S1726638AbfA1Goe (ORCPT + 15 others); Mon, 28 Jan 2019 01:44:34 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:36043 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726626AbfA1Goe (ORCPT ); Mon, 28 Jan 2019 01:44:34 -0500 Received: by mail-wm1-f65.google.com with SMTP id p6so12550373wmc.1 for ; Sun, 27 Jan 2019 22:44:33 -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=AMCeOi6x/Wbey9b/NaGjqvsuxi1tHtv0yD2YjLVBzzg=; b=WaHCrlaGNbIsQJL0PrjX/7IJwbxZdCo2c8Mn+7HRrFaoXNP38bwLNLaVldVR4W82KY jreY6JsHG3DN5l1yGSxfK+sur+J+dPFd6Amt15bQLyktwFianXBJq6qqMQRL/Trx7eei CgYnHmXSfl1pJut+G8OW/CqBrNXUv+88MVvu0= 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=AMCeOi6x/Wbey9b/NaGjqvsuxi1tHtv0yD2YjLVBzzg=; b=C+fKBHjxgbzHuZSfT8QHPdLEkZxJ5VxcNQy6wNfME6Ss8wMylPkiOoqRbpJ7vgLYms gT1v+BYvzQmI+PtfGYyRWb1SWFCOYNRx3CJtMnuzE8R2b3eGzI/8N00Stv886w7LzCZm 5DM6mcF1xND2bFIi7Z/1wYN1ab87KVIKNVDAy26YyS9cbX6aNbPoQ5ih6eLrUw6jyH+y PkGEo68JOWKem7fhJEGty5eEUhW+kp5q8i8s7RqBZhhXnclw0VlY9hyLXMkd6hF2h/dR Vkln6oySSqInhCpqLkvs/hRVlKfJQ2V2TKDYzNFgIsp4miwY0jAxVWZqfcaA+ANsofnK 96gA== X-Gm-Message-State: AJcUukfJdyoDVCDqVObUcyZX8IbZOawJfPg6tK/Ut16pG4X3IYU5nQZT A1KTUg2e+XU5qAA29pfiAJGkaA== X-Received: by 2002:a1c:8095:: with SMTP id b143mr15097321wmd.63.1548657872657; Sun, 27 Jan 2019 22:44:32 -0800 (PST) Received: from localhost ([49.248.191.44]) by smtp.gmail.com with ESMTPSA id h13sm95586448wrp.61.2019.01.27.22.44.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 Jan 2019 22:44:32 -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" , "Peter Zijlstra (Intel)" , Tao Wang , Sudeep Holla , linux-pm@vger.kernel.org Subject: [PATCH v4 2/9] cpufreq: Auto-register the driver as a thermal cooling device if asked Date: Mon, 28 Jan 2019 12:11:27 +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 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 | 9 +++++++++ include/linux/cpufreq.h | 9 +++++++++ 2 files changed, 18 insertions(+) -- 2.17.1 Reviewed-by: Daniel Lezcano diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index e35a886e00bc..29ed78b0b77b 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -1318,6 +1319,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) + policy->cdev = of_cpufreq_cooling_register(policy); + pr_debug("initialization complete\n"); return 0; @@ -1405,6 +1409,11 @@ static int cpufreq_offline(unsigned int cpu) goto unlock; } + if (cpufreq_driver->flags & CPUFREQ_AUTO_REGISTER_COOLING_DEV) { + cpufreq_cooling_unregister(policy->cdev); + policy->cdev = NULL; + } + if (cpufreq_driver->stop_cpu) cpufreq_driver->stop_cpu(policy); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index bd7fbd6a4478..55ca61a64fc2 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_AUTO_REGISTER_COOLING_DEV BIT(7) + int cpufreq_register_driver(struct cpufreq_driver *driver_data); int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); From patchwork Mon Jan 28 06:41:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156697 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3089402jaa; Sun, 27 Jan 2019 22:44:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN4vqk0DLlxsvkhwVSbDaSRQ4fQseoUMmT+GmGGZH35Zs0E4XiFhU89nYabFcUBiriOwRxhc X-Received: by 2002:a63:9843:: with SMTP id l3mr18670995pgo.413.1548657889615; Sun, 27 Jan 2019 22:44:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548657889; cv=none; d=google.com; s=arc-20160816; b=o7pkRJz0nxdra/fLX1xTRzhB76CNeL+O1KXbpH/S55zCJVcCNkcIEf+0tF72mUHGjT OIZJZUjdiGApmC7sOvT32X9fEflDPg2+AmfikgxVuZW6s2Fi1Kn3/J5I+OyahayPq9B0 TTlIs35BcKp69QVRSRbbkrFhXCgb1eY26KrYRU5qs0k3QUpMk1R07aliBdraYyiu4H1G x1XM7ypG32wYJSlrijMLc3v23sehqlcW4nWzZ8wqnrvtqIjiI3/Iskwtzgzf8Aw02I9W WzZHWjDDF21umXHZuEjnZTyJEqmWd/i7p6y1DiFqxDHG8Ipf9L8lCdSQwBexgbzBUCRJ reJA== 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=Zi/ESujjt397hYVALV4w+ji5LYCDYR6I/sx6PxEYJ6c1roduZJ2iQCH136/NofZTrT 8QP5jEM2vndI9JGVugCAo3Xnu+PCpz4schXyqd3yGYLtyILFz2v5Oe0PRx6wH6OsJUXj 6fdtIpAybLYrmwKxhy3ddpFcE6vChfeD5LSwfdN/Okd7Ann9EH2JViBPPYyZ8ytw3Mcg qoAx3y7+XcJ1R2jxWbrXTOIHgy0NTOWyRRvWEIOXkmrena+pIqeqIlCKR859QbuatyT/ 4/YZ3DkmYurFV/oEkXMiXrZOnxflx8ahubKAx9ZI+tB2CCJsbB04li9KNA1VjQpPEYre +UKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WavQSbx2; 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 b12si30015196plx.159.2019.01.27.22.44.49; Sun, 27 Jan 2019 22:44:49 -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=WavQSbx2; 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 S1726630AbfA1Gos (ORCPT + 15 others); Mon, 28 Jan 2019 01:44:48 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:54631 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726683AbfA1Gos (ORCPT ); Mon, 28 Jan 2019 01:44:48 -0500 Received: by mail-wm1-f65.google.com with SMTP id a62so12675566wmh.4 for ; Sun, 27 Jan 2019 22:44: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=zLqXF7SYoovkgBMNm7MtzJSzeE0VgZYQlKefNmrl8Go=; b=WavQSbx2bNC7C5yXALjdMV9Q0Wx7HAjLbSy6inoEb7pl1O3r0nECunTHyUcMG7vuj3 VJd2jcU2RXYVDDZau8U17OeW7DYNzGcnOeP3UHJOaM/HETxWZOlBi8yJWjWduHhZD/FG 7djYzrGCgCp+9bAJdn/bi36YEKIXc+lSUrowQ= 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=rha5GpdgMI0DRK7hFy/LmKs9pMmzrVCkl4uo+xUNf1W1UyeRc3NyJvsyEtiNGCx4yM GkSGDIjGQszzMN7dvxrmEgh1QjZNAF/ZJKr/UOOF8hL4YwtvpJWJSaQEaXL+lSohszFI IdWsxVRj0D1CbeSgrI3GVwBBP8aTjQac+UEpAskDAz4EjFXQ5gHEdWscN1XryfWfxiPa 9BMkejf9pcxooUwsrYpqyGF753xgz+Fjcc93gENTtUdPmAHZ+9McvKxLVkFDuIrTiQHm lDAIE8liD09YSsVbGBh7R0POuU9Y00RshkWh/xwhXDd9dfM7uZU9zr90F7B5qDWAkeMK nLkQ== X-Gm-Message-State: AJcUukdULVp07MGDsbOckD6CU3akKxiRvMlHeBXNDutzZkdiSa2Y9UI7 3tppkFakif8J6Qm5i0O1NBIwNA== X-Received: by 2002:a1c:7fca:: with SMTP id a193mr15814801wmd.36.1548657886741; Sun, 27 Jan 2019 22:44:46 -0800 (PST) Received: from localhost ([49.248.191.44]) by smtp.gmail.com with ESMTPSA id 127sm131120424wmm.45.2019.01.27.22.44.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 Jan 2019 22:44:46 -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" , Taniya Das , linux-pm@vger.kernel.org Subject: [PATCH v4 3/9] cpufreq: qcom-hw: Register as a cpufreq cooling device Date: Mon, 28 Jan 2019 12:11:28 +0530 Message-Id: <65d7297bbf98fd525d3785f2e8eb5a412ffd3a6b.1548654899.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 Mon Jan 28 06:41: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: 156698 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3089685jaa; Sun, 27 Jan 2019 22:45:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN7esCF4dc3fi6PGONdapWQxqBF0O0Yvn0NAy72p1JEf2IuTcqDfJveYkh7lynlkv2MIPyv6 X-Received: by 2002:a63:cd4c:: with SMTP id a12mr19098541pgj.252.1548657915324; Sun, 27 Jan 2019 22:45:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548657915; cv=none; d=google.com; s=arc-20160816; b=KHVd7o19ZIq9gT/p3I0J8jowdRqtQeeiyplIlkOdMvansLm2KCDk8qBQYTPrFcnOrE r8cRcleY+owdwm8s4t4LzTbhwvoUkkscK6rSmXDwX5vkEETwceV88R23oFnCOmvMUibb KJnPgPIzJhqtDj7Qcl+XTC7T3MBgWppiK4Rsy6e2D0NJUPzWlNMXShD5WYSTrSykNY12 pXGTUwkyi0IUGIic1/cHFZ/ZWEca1DMd0VXEa2dyfMR3K2erIuQAQl3LrQnS4e/YsCfq u0gjuFsmSKQxr8jDprBSOljiXiUkMX84lmBWw2vvLjFOqsRltp1aVj/zQRbK+nDqxNw2 Fzaw== 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=Dwx4HSrtb0kJq/iujYTDJnvEotNcZwGKIH0S0ZoTKe70UI9YFApH1npagtAuzd0cDu zq2dOW+OdQqELa4FREd/LuR2k7wxom5QHTwD706rn+QEMQnkDVwVrq+fXD1D6qECzRQm /BhDf+6RqE3TAAtObJOIVZ7+BvtqWIcFnvndlTpTBTMmCf6W/t1SOOAWwG0B6mI1B/Nt IwGjDeqkez//kqSbVbpmCT7LuvJv/B5My0781fbOCM2Xl61uo5sKfLLiU3dCzsB9Agxh HQQVOv7OMBi4lxseg0yzk3Ojcs+xgEBr246PzRIzinoBPAcYdK+6coxFc9UG66QmxPho tSHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O7dXm3ea; 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 p23si31138323pgk.312.2019.01.27.22.45.15; Sun, 27 Jan 2019 22:45:15 -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=O7dXm3ea; 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 S1726766AbfA1GpO (ORCPT + 15 others); Mon, 28 Jan 2019 01:45:14 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:55540 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726612AbfA1GpO (ORCPT ); Mon, 28 Jan 2019 01:45:14 -0500 Received: by mail-wm1-f65.google.com with SMTP id y139so12579006wmc.5 for ; Sun, 27 Jan 2019 22:45:13 -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=O7dXm3eaXx+urbyXs+leF9FdeXesCvpiSRQYtQssVK5y81eDev8ECLB6fEhz3TVkpO 1dLIFdEmDcMPqHZ7NWGdvSV/c4dqHkysgoHIbfpafxi9Wse6czBAMQ1AA6v5s/uCpG5F L5izdCEmQBNXGUIDzg5EmQR74IvSLLdxnWUBY= 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=Y+jZbt0XJ4PUH3O1si9h47E7wXlvROp/fBPtNHCK6cpgGCD/bq5trlkU9CsbWVyaNR mlTYTFJRiQCnm3a/j/AJzJ9G3s7j0GuVatN/iE1Zs6JFfuh4kgb72/n+BSnemU+EftmB N8mDs7af/BcrPam91TO3NiNe2DdJoJMESs6w/WGN0mqhkqhc0CC2IAqoRvmxzEJDsx6h kJ9gTi4rPttILwvDzUwOIknWIM68hsyb0lxwQ6MwbG9c4qpU56sO/ng1EImqNelPoX4E i48FhUgksAeH5AsYI9Ib8xFKXDCtKumysTUJjsipivM6X/553QTvS3MeVCnummUUScsK RBlA== X-Gm-Message-State: AJcUukeUNPC+SdfPDh2sUggcTODOXl8D7P47B7WBy86S7FCwBHlQEwMz HjwPWJv8u7fc8QScmaVpKqZrnQ== X-Received: by 2002:a1c:2e43:: with SMTP id u64mr16048252wmu.52.1548657912682; Sun, 27 Jan 2019 22:45:12 -0800 (PST) Received: from localhost ([49.248.191.44]) by smtp.gmail.com with ESMTPSA id c15sm52708620wml.27.2019.01.27.22.45.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 Jan 2019 22:45:12 -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" , Anson Huang , Shawn Guo , Bastian Stender , linux-pm@vger.kernel.org Subject: [PATCH v4 4/9] cpufreq: imx6q: Use auto-registration of thermal cooling device Date: Mon, 28 Jan 2019 12:11:29 +0530 Message-Id: <6e8ab1213d82b6de5294c0f579a24150aafaf558.1548654899.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/imx6q-cpufreq.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) -- 2.17.1 Reviewed-by: Daniel Lezcano 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 Mon Jan 28 06:41:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156699 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3089791jaa; Sun, 27 Jan 2019 22:45:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN62ul5ntSbriKI4+8X7Ie7gh4mGiWwaokeXat6dfz9yXWbhYzSj35QapZgAisClobEXlonu X-Received: by 2002:a62:c42:: with SMTP id u63mr20435353pfi.73.1548657925179; Sun, 27 Jan 2019 22:45:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548657925; cv=none; d=google.com; s=arc-20160816; b=y5xIym7wZHzSvJxmDuWtE19J5EKFyPPmsUyC16axKklcLKwl1S9L0gmfcaC4UBQKNx nCuL927HnTcHymaLlV8z0yo921rKU/SsEIcwEPOHjx37wbjFZDeVaHRiJTJDR2XEDtzT PhGt3/N/1Ccusp72SqM5wxWNoGrWmKd41TKhv+rvhgWSnmw3evciWARWb0L+exfH+JNp w+iqWBjzpZB1BHxoqdjfH7p4ggk8pbSYI6lh6LPuQZzKa1IzbBSG2wJQoczdVVyV1J2t U6PSY5wKSiIkLqTCNKdEMtHgCD8yS1uoYVwd9Dr/HJJW/dQg4Y6vEK3LIIGkFTYfKtyi Gk7A== 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=r/wRO1r808Pqs9EM2KfpMu4dvOgHIwgqkg0pHnsUhBtb/I3WFTlhrIJtqG/t9JmJgA MvPSw9FcX6uDNf9CU2JC4pixi990dDDOG5RP9oD2Tmi8fHM91HbvRZC2mwKmJpfRQMJ6 xBgI2PoHWiGWvMZZHwQM4angycRlFA6cCpIicU715qMfTurBLJZwaY5AaZy6XXMPtI6J VB3JuN/bhAHq+QVtZzFhJwC2GI3PoNB6Fe3dKYJqTziDFrr0eQ56lPNqW5cP+s1JCrZn p6Ze7usFAYmK/CuZMoT0mLzKkKfD95u9aH+WRqjAFOIcEwUBdAZIO0+fRJhYwA8ig9Ak G0Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ce0p9qg1; 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 o3si21131240pll.201.2019.01.27.22.45.24; Sun, 27 Jan 2019 22:45:25 -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=ce0p9qg1; 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 S1726632AbfA1GpY (ORCPT + 15 others); Mon, 28 Jan 2019 01:45:24 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34799 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726852AbfA1GpY (ORCPT ); Mon, 28 Jan 2019 01:45:24 -0500 Received: by mail-wr1-f67.google.com with SMTP id f7so16760760wrp.1 for ; Sun, 27 Jan 2019 22:45:23 -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=ce0p9qg1PNF/g2Mzt+MI/kYGEL51eAZQwxB7uptGywv/lzmD2j+/Xk6ndBMpNS4KLb BgeMs0xQ+O4I+rcGxJFGp/XhLxsOMO8EMccGK+zR497LstD56+kGZnGFeW48qV5hawtT AldDvDhXXBySYabj4WViQD7SKKWHLBn7vR/GA= 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=K9lXI4S/LMbF7p0HT/fzvu5u9jkpHzh0HHHRtRBQrW/l+Psq7Pe5xyOnYO1b3aKUfd 50fyzhSYKc2/c4lZZOh5LmoauEoFN7/VCkBDZd8RfBQFvt6w4DeFoAHG5nOGBmES3ZOg Vae5JTfvd4TCZpZHKcyQL1MeY4Jnby2J8+Vxnk0gco/tAk6ABlReMpDYpWdJphi2fNIM N0JK2LSLCgoS0/72ORlYwzJRQXfdUxLjP+JmhiE+ZiKtaT9eVOK7L/Ph8PPNrwU5vUTa Cedm77ZpfzHdimqDZd6vIWcTYiNIO96Ax09EU6fAhSPxeYWQ0LOD7JquSqufEw1L5uIV rhGw== X-Gm-Message-State: AJcUukfaBGZlyI3nGDE7vAO5RCWSCHnAWbtmRTz+yOXELFyHjXLuP+vQ nInqVmgCbVA9Ppb2cOaUty89pQ== X-Received: by 2002:a05:6000:1287:: with SMTP id f7mr21262511wrx.302.1548657922646; Sun, 27 Jan 2019 22:45:22 -0800 (PST) Received: from localhost ([49.248.191.44]) by smtp.gmail.com with ESMTPSA id q12sm44198894wmf.2.2019.01.27.22.45.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 Jan 2019 22:45:22 -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 Subject: [PATCH v4 5/9] cpufreq: cpufreq-dt: Use auto-registration of thermal cooling device Date: Mon, 28 Jan 2019 12:11:30 +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 Reviewed-by: Daniel Lezcano 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 Mon Jan 28 06:41:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156700 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3089953jaa; Sun, 27 Jan 2019 22:45:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN5ewtXZT6szwCsc+L2lnMz+MkiaJO9fiFAowdX2C3+ldBMqaWgUqs1iIHNpJv26Lg4do8Qm X-Received: by 2002:a62:1c0a:: with SMTP id c10mr20710716pfc.213.1548657939467; Sun, 27 Jan 2019 22:45:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548657939; cv=none; d=google.com; s=arc-20160816; b=tj5vt6HZ+C5HB6wnUbUMBBQ4Q3lddyT9Wmhj1xlygMiS/U1n0KPGYoHgfc/Ck6Tx0X hSchTIXnCEllnVMCu4LF5dfUFgpUv21StLogfdkvhPvO8wtQC3GsNsp10ByExoBEdEs1 ZBP4NvJ8oUDPoUcTcBuEktRWlroRdavPygY892NKTCk8+fhYBgpPBsHM5to/09Bs/gIn zMeWxJeLOFw4e/iSbt1t6f3IMvt4tmgdSagRMzlRHa2bmqu+HFRJrAmAZPBSzeqpmOoc DkMWpoCU6NQcG/2ivlHIYHRm+SNllnJrRSevuRl9VwqgezSaNW7/5pW4G/I3pS5uDFRS O8DQ== 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=QV55M5UT9ckgy/+9mgu7lB9S5ppe7rLYbFWvyS23/Cg=; b=x1deXFl2MKvk4cC+D7nvlWCxXZuAVSGz82oeM6JgNi0ab4uRs31ZTQ4erU+RBPfg9t CDPeyrLldgkSniBWebFyEfj5k6TEf8Pk7pvKbuB50v2E/AB4nOpmRbm4S6ihwptNi5wa aB1tBdUYvW9RYrZ3F8o5qnRTG2OgsdE6nhuvaN9OKyWe/hRCWj5TzeRfGBGxdB7TUTZB 76MxUvzIS4E/2+7tKkHTLENziUQYcb/t9kdNZjGgpRGsJZPqhSSqqp7i3Bda9cSOonGP 9XeG0L7uJpvHQMfv7xLhDwjZHdnHc1mcA2EA6EgYytaI2CHzJ9rJxlEXiyNYZ3ZfTf/j AMmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W4RfYAIz; 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 h5si14263225plk.373.2019.01.27.22.45.39; Sun, 27 Jan 2019 22:45:39 -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=W4RfYAIz; 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 S1726872AbfA1Gpi (ORCPT + 15 others); Mon, 28 Jan 2019 01:45:38 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:45896 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726783AbfA1Gpi (ORCPT ); Mon, 28 Jan 2019 01:45:38 -0500 Received: by mail-wr1-f67.google.com with SMTP id t6so16644796wrr.12 for ; Sun, 27 Jan 2019 22:45:37 -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=QV55M5UT9ckgy/+9mgu7lB9S5ppe7rLYbFWvyS23/Cg=; b=W4RfYAIzJgkQJh5MIR4Gnjr5DkFNFNW1Bt6NGGz/WvBZMMfK0AudwJi6FlerejmBKc J9fVVMr3cbR7h6Iko7GMxSgIEJaah943A3l9Qy1SyFuzWRCiTSHf2Gz43+BRUokIyw/m S8THImJ1AIjte0KIUe9HHfxEvOnWpacdFWgYw= 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=QV55M5UT9ckgy/+9mgu7lB9S5ppe7rLYbFWvyS23/Cg=; b=kgCKNyre02O22hh4fxA9k/EaQNL0yBHhAULfQwKyWm9YwWJD2pkoQl0iNuOG6LhwmT Z/XTQB1Lc38GiN6bn7GvuZNXDgdklZkx/xK9CQGzwloOXpHhtCaZWyDANALEwCNGIDlN jlYZEbtKF25du1qUQUExqommuEW72FH0cFcXkyQBQhpGKQarZ8t/8bm2jOpZBMIoznfL WxZZb5z2VemYQTbgJpHR4Gmanrz+dXIKPmVHULyvWgKEy20hVg8GoO3E5luX+o5i+emD sXH8gDuxq0OCGOHATLqdjqTQ+mgECHxaKuJqWtTLVisVS5rY3jTEe4L4Q/CPxcaxfM2u 4PcQ== X-Gm-Message-State: AJcUukdg0vyJorbAy/V0MUHmXEcqHdvR7Wzao+/HR4LpeHqwBadKSVb4 pDU0KD53HyWkGIOYAK7rqK4V5Q== X-Received: by 2002:adf:f691:: with SMTP id v17mr19591125wrp.114.1548657937143; Sun, 27 Jan 2019 22:45:37 -0800 (PST) Received: from localhost ([49.248.191.44]) by smtp.gmail.com with ESMTPSA id c10sm47955333wrr.69.2019.01.27.22.45.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 Jan 2019 22:45:36 -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" , Matthias Brugger , Sean Wang , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v4 6/9] cpufreq: mediatek: Use auto-registration of thermal cooling device Date: Mon, 28 Jan 2019 12:11:31 +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/mediatek-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 Reviewed-by: Daniel Lezcano diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c index eb8920d39818..9a937f4c63e7 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_AUTO_REGISTER_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 Mon Jan 28 06:41:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156701 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3090102jaa; Sun, 27 Jan 2019 22:45:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN5/3FmATe6+Ha7OYGG/lCbE8nj7BWn/nYMIyi+KENimpVbgPNvjC2sEz0va8te20GHDBOht X-Received: by 2002:a63:5a57:: with SMTP id k23mr18661372pgm.5.1548657952120; Sun, 27 Jan 2019 22:45:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548657952; cv=none; d=google.com; s=arc-20160816; b=E5XD9B6lT2YI0crglCgH19cMpUtoFKm/TB1SNnWbpst09pQ/of9sWab3zXQ+rMMILr ZpGBRsWWZmdBIrYRd7tZEQFk/3fEKAocLZvIX24qNeu1RxatPf5FAqp0zbcOiZVoKQ2+ uYJ/panuLfYxHP5d5/pIF2aNrD9zr0CVXyUE/IBLI8O72NNKx7Ef8eaSViaFIxRHTBkF zRXiX8PES8ggvUhipdQSMIhYX1RsLFLMjcu5d728YUshm55Vvu4jO9aCPNB/jtrQs05r 9FddSSgVcc/m9yr3DkbOabwbsIRKy8YOK8Ha/xuQEsrOdheMI54nLgxj2OjiurBbvFiJ ARTA== 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=cOhKInsZFb0aN7yqYOYW6sIf30ZjHKcWIgfKo8TTVDgn+woajVmd811Fa2V3EL5buy B0QBi1NJsVYectyVlOjpA4/FDtUGDBqG0RCf6eqPbO8ogJpyVNeGRf584PJ1a5Gq698r C48aFrxmjHl8dxDecPyABJ2QTjUYKe6kacVbStCpwN2UtsO7Ftyfjw289p4OfyHBmTrI Pne6wkfoRVGsTIWT9khXg1OqYSTYb/hDXAbNcy6Yz2D/WsuO49O7SSuL7WI14RKww7Ju ni40VFBgCj5Qp2aIdL8aeLo95weiDCoaHj+oG0rf9p4nmR8Dj9MUe6uBiOntG1us82lZ Q0Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="DW4K/5zl"; 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 c17si6241104pgl.385.2019.01.27.22.45.51; Sun, 27 Jan 2019 22:45:52 -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="DW4K/5zl"; 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 S1726626AbfA1Gpv (ORCPT + 15 others); Mon, 28 Jan 2019 01:45:51 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52800 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726150AbfA1Gpu (ORCPT ); Mon, 28 Jan 2019 01:45:50 -0500 Received: by mail-wm1-f68.google.com with SMTP id m1so12687846wml.2 for ; Sun, 27 Jan 2019 22:45:49 -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=DW4K/5zlEo6p1xfdiXC+ynAc8dp2Dfyn0kNB0kyOtEt+Uk9Fl/LFxWlhD5JVjyaY/x V78KHr0qkFAKLjVIzFRlNNeDM7u5RrqTzPeOxlIH0wioS0vBNt1nBMoJZy2ERknd5h+w O38eisMJ4t7VOtaxL09vlB/KIgOCGPLDer9aQ= 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=Nh+LYlX+qeZg1Y/8Kx01f+hsTzbRowFqqcCyZoRM7gqApfvX7Cm13z4uBw5mAu1ar+ tHi4v3DfQ1i+GzwDyz80vTvbfP2r8In8Wl6Scp4pXtJsDkNdOSf9OHx8zQPW6WxqxeWg unbS0+hM0PzBSQZTFH47fMnS+4yWwHjDU2gTNAqrB9TaZPfHZ2jEdGxzXUnS0oyeo8fJ oCiHNIOL0sth2utDF4DYYVdz9KdGPyz2NkaWodRgZkhYCLsACTzU8KH9Z15b8Hreo5/b EB+seCbXKT4rwlvYcjohK5pxHCUG0s9b7DwydZHMITcgsQ8tV9l/LAk/+XhyOm5FJa/m VIHA== X-Gm-Message-State: AJcUukcX9mOrF02EhzVi55SiunOxtvUzEHfHRMbxrkzB3Q2owqxdPbxj HgiVMzlJy7GU4po9cb+Y2gj7eA== X-Received: by 2002:a7b:cf30:: with SMTP id m16mr262294wmg.22.1548657948489; Sun, 27 Jan 2019 22:45:48 -0800 (PST) Received: from localhost ([49.248.191.44]) by smtp.gmail.com with ESMTPSA id w10sm7927176wmb.1.2019.01.27.22.45.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 Jan 2019 22:45:47 -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" , Markus Elfring , linux-pm@vger.kernel.org Subject: [PATCH v4 7/9] cpufreq: qoriq: Use auto-registration of thermal cooling device Date: Mon, 28 Jan 2019 12:11:32 +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/qoriq-cpufreq.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) -- 2.17.1 Reviewed-by: Daniel Lezcano 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, };