From patchwork Mon Jan 14 16:34:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 155557 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3863594jaa; Mon, 14 Jan 2019 08:42:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN41EKfpUYW2CdbwGIL1s1SHxTBoTaGiwMcz2n/lzaYSocKOPtbCC4lQiTyOumjLc9Z4j4S+ X-Received: by 2002:a63:e21:: with SMTP id d33mr23515164pgl.272.1547484127309; Mon, 14 Jan 2019 08:42:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547484127; cv=none; d=google.com; s=arc-20160816; b=ju9batOs7R7tDTd9V9eo5B6G77drOE7kb9A4CIzEMRxtKiyF6NPaRUAQbO6NCi6sYE 0k+qwQTe13EgcLeRxtIqjWTp4eCj/lw0OZHxxstrPiaS02gWYfQ73YRc7Pz8qAXqqMDl SR8EXgH1cLJQaT5C19moyHvFqf2aYPEXCHDZ2nb2grmQQaoTJ9/RvQHjGA2gw0c198/J clrX05mL2ku1Yz7QxNcuqbwtD/lmN9fryZw6svDf8h/XgOzD9yGCH4YbYduFUDVVRAEN qNb5YNUQw4kgD3FMddKEx9PQxdjuHsAPlA80ovw9TRE4/+m5700ZxZUql275XKx+JpSU 4cKw== 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=tKLZv/PApJD8Rpyyr/+hm8XMw9L4JgFfOnfKHHwbuMDjMfej3iq4q3/poV91hsIMhc BSeACzGXSXevPZ7qElx+iC4Yy4hdzLHsF1/C6j8o0AHa64LHB0ZjO5RDCbQgB9zX18BO Ie7HnZGbEstjcgMoaLT6wQKf7SRdVmmQLuwMORF5RZjxCSBN6md52kxmCSvMMv76WPn6 oxpGMoFnC6AHs06Nl/wZ7Lzm55SUqjKevgYceh+WcfzODKbpvo4/okGI3esmniis33hW HP+qWgLC2eUIquS/3JF3BR2Mxl9CbCUqW69eoIgst6T++yTr3qJU/tIIBi3vh0qpb0Li xhyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Vn/oqcY/"; 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 l7si725033pfb.31.2019.01.14.08.42.07; Mon, 14 Jan 2019 08:42:07 -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="Vn/oqcY/"; 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 S1726751AbfANQmG (ORCPT + 15 others); Mon, 14 Jan 2019 11:42:06 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:40654 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726749AbfANQmG (ORCPT ); Mon, 14 Jan 2019 11:42:06 -0500 Received: by mail-wm1-f66.google.com with SMTP id f188so208475wmf.5 for ; Mon, 14 Jan 2019 08:42:05 -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=Vn/oqcY/P63zY8ZUM+xRQ9jA/yok6Av41I0Nbd/XBcMYaybRLswoqC+bZ7zFthiL99 AD8roHRXIq4z/jltTQDQy+bZ3SYq2XsqBoRpBPDqUlr3MrNNQ8pHTqOE2xiKwhPFJy1I +jhPvzj5X/ykiwTALhSNyEO8GSfyjhARHv/Z8= 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=Y+6hUOKumKtUSLg4tN1xscaTqJAD2o5xaWEp795QfoazIZmg8An0OA1BUGzWmYADJA /xpquG2dgnm4kLeqadlxziwyolnK800XCAkFiblAQS+IQn0K42239+sY3nIiQ/mfE6Df sJI+C1raqgZqR0djgQUHHxwlKg9DyGibJEMCY4/KF1EL98RqIgkSamrNnrqEAOQSpqF4 HggsjrPdqYMRhYgs9M3Sx7I/NA+hUBnHv6pxJ5IhSRiPBZfa6OQIipU7mP/NLtkUNC4D 7JB7WU4qBdMyXHlawBvd6GuiEo0jWxrCZv+8xqtBZAHeanSmFvydiMVXcmsKUsmfrSKf YsTw== X-Gm-Message-State: AJcUukewuAIbvsk/FhIWrwl3/o4XVrPIIVvSZKknbA5xx6n+/HtgzhdE IVStUQXuYy3xxDkNCCMyz6UfGA== X-Received: by 2002:a1c:2007:: with SMTP id g7mr12266919wmg.79.1547484124495; Mon, 14 Jan 2019 08:42:04 -0800 (PST) Received: from localhost ([49.248.190.171]) by smtp.gmail.com with ESMTPSA id k3sm110603159wrm.7.2019.01.14.08.42.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jan 2019 08:42: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" , Matthias Brugger , Sean Wang , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v1 07/10] cpufreq: mediatek: Use auto-registration of thermal cooling device Date: Mon, 14 Jan 2019 22:04:59 +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 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, };