From patchwork Mon Jan 21 15:40: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: 156216 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6517074jaa; Mon, 21 Jan 2019 07:45:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN6pmR/hxb1VZK4gOXtGa0fw+enEss+lKVVF1BZIA/pd97FKvoEpffAxIgBfI+wprBEtn+r3 X-Received: by 2002:a17:902:2969:: with SMTP id g96mr30473683plb.295.1548085517491; Mon, 21 Jan 2019 07:45:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548085517; cv=none; d=google.com; s=arc-20160816; b=TZTJqdkh8i6M7f5AZIpxVKvXJn6JC7u+KIldQTbkDTkwI4Qz/7Sa0V0BmdRxnxttE5 NeF522VPtxHzfv0hNpCJxVwHxZcbfYF6pucCUuI9pEgi4RFeEsatawQKaLg/6f1Hanin OmpXP/CviY7YYIekPe0kCXWd8/+Pr8tGYBrH1KenxS0Egqm7mBXyOD//cgmuHiJYGuEc YeKDlU7sKT6oUORsfavbXsat9MUrTp5HNM1vOBulqVfZqN8JMpGOaTbMTmg9cB193N4V qGXeQ/T4KQIT/A3ySuuRnz/SdCQiON9VCJ5zTQ/Gs5IzVTIvinlXegeSncNSRcp+0juh c2mg== 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=I0ThSuPLgjykz/VCFy6G574PYDL2bP9+ifuEkhcy3CHo8jLypZE9IPo+E+xr8TDIjW Pf8HnX/6yV0KaePiaUkGmfocZ6P55IfJ0SBhm97mUZJUzLMjRVqgDsp1YqAslRZKf9Xg nFNabbEw4Sfj9WtdNeI/878dbD7ujVBj6KYvqTWHObB07r2gFQYsDfHa7I7ung6twO0z dNeHIqMna5UhA3gjfNutwP71h6GAXX1Rn4IUBryfHVpwqeYbYPeoxi+JBCHnurPsYsfA +krioa1dtAxwB0VWqVdgOru61ll3CGwYeFm3mDYmoC+ZZr7ohIB3o/dTRQ36+0SdKN0U qyaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WZrUCGY1; 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 c21si12324578plo.165.2019.01.21.07.45.17; Mon, 21 Jan 2019 07:45: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=WZrUCGY1; 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 S1730373AbfAUPpQ (ORCPT + 15 others); Mon, 21 Jan 2019 10:45:16 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36603 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729813AbfAUPpQ (ORCPT ); Mon, 21 Jan 2019 10:45:16 -0500 Received: by mail-wr1-f65.google.com with SMTP id u4so23931601wrp.3 for ; Mon, 21 Jan 2019 07:45: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=QV55M5UT9ckgy/+9mgu7lB9S5ppe7rLYbFWvyS23/Cg=; b=WZrUCGY19DdCA1w3IHmK8oICHtgLdphKhOGUd5vevBnrBwrSzPdnkuBmbMvPX8lyUJ gl2gYp4z2QWp6fpzF4xTqXXp1aWdW4A1icNf4057BL7T6Y0JC6fajhO44w6GvSJzq9kh mo+iF/5MENrCUeILCAUvYs9e1ty9iNJS79FpA= 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=ALnhM7m45StI4ZFIoM1S+G80MnlFazw7K1H0R6eDalWb1MbiIDS9Cw9DcbqTDYYDU4 G69LCno5W8/vhUJ+k9mXe6V768gV1z4buLp5aXgNceuLtqcV75h+ANCxBHUwNwZhnQ6R PaJzW3Q8MpcOxhqb5DsOyyg+HgiYmNvADYpIlPiWkU90b/ZumO8YbC2g0FNhlD7l1640 LL6qrcUpZREodpmMJzm0yPg5OmM6CuwIiitZkQixn1B3zZOfNPNuaWY0dK6Mg71o9Egv aNq9QS8O9OHDyovGBnVVC3NPBpLLwbpVRC1eIdsqSOYHRYqcdBLprgykLMwmxaWQ+xgH APsw== X-Gm-Message-State: AJcUukepNSfZldI51kVcg32wigDvuEGJHAFZphEdRICWvAD2Uj49delk MEkucmUXPFjO1wJ6NonNmcYEvA== X-Received: by 2002:adf:f785:: with SMTP id q5mr28138392wrp.9.1548085514799; Mon, 21 Jan 2019 07:45:14 -0800 (PST) Received: from localhost ([49.248.61.1]) by smtp.gmail.com with ESMTPSA id r12sm105023879wrq.3.2019.01.21.07.45.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 07:45: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" , Matthias Brugger , Sean Wang , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2 6/9] cpufreq: mediatek: Use auto-registration of thermal cooling device Date: Mon, 21 Jan 2019 21:10:31 +0530 Message-Id: <4253d7a24e9c85ca24cceef599ab8da8682e0bee.1548084260.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/mediatek-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c index eb8920d39818..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, };