Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3769628imu; Mon, 14 Jan 2019 08:43:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN5s5rxot+JH2r3mJlkeQtkUJC5Sa92/jffVnsoyxPC+2oQ/EgJemOMS6lW1Yr6hcRgOXHh0 X-Received: by 2002:a17:902:33c1:: with SMTP id b59mr25923184plc.220.1547484219399; Mon, 14 Jan 2019 08:43:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547484219; cv=none; d=google.com; s=arc-20160816; b=ePZZ84gxDb8OyJaPGhnjr5JBQFyGk+5q4p3K5MZZt7VpK6meuGCwOhP6f7pPzwHo1L 35KlxPpvDQZi0JcnxqrFYDB/XWLY3i5BMwNJMwnFDWWrycXxW3rXLPI2Jqw/Vt4tEEke tZDVVPjYdPnjLEuGHGByYJNa8xHh6Qt2u3uyM6LHz9/sRTWKZXbb3WiY5l7N+/Dkm9/I KOAk36BtVBSmBppAK8mWlb6MMMLMQ8lxVYUfZHeV9eGqIVh80XgmTAIH9WMwWjgn2bti yAJcsTk7y+CX/Yzr7rff19y/bfMkslB31JiKvVDH8B9aG0FGw+vHtNFzEHc9dlsnrbaD vZeA== 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=FFF5logtdjJPswjzscKFzybhjOsUYJGbHqGoBZempnbqtVFr7x1zrqV/H2ZXIyXeKl eun/Zqq3sYdvo4KkrY36q9D8117QaVLmPvGRToAcIG1msiVUFOPQJN34EmIVy6mgdDCX Tj+g1yecJ6dih3JUBO6DyIuKn59nfpg1dFw+mZI/TPN7LRLyYBOU3N3FMKzpCIbeST/X L2bUVBEX64ZnEm+QMoWRSsooz/BQ0NSYkBUmJ1WVr1m6FQPK9TAhAcApC9SurFY7rChI v3kmds4eY9A8CReSCz2bfHC8uX2KCTPtcB09dFgKqdV3GXEAGYPYcMIYmcOQGAVbGfcZ 8/CQ== 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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 d7si706163pfo.108.2019.01.14.08.43.23; Mon, 14 Jan 2019 08:43:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1726835AbfANQmH (ORCPT + 99 others); Mon, 14 Jan 2019 11:42:07 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:38278 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726757AbfANQmH (ORCPT ); Mon, 14 Jan 2019 11:42:07 -0500 Received: by mail-wm1-f65.google.com with SMTP id m22so223917wml.3 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=a1/k6EvspoWCF3SGmVOE2w3aRkuJfFeZpJV3VLz1P43Hozw5GRqM9BEk6DO6MpqU/d ZeBT/PoH0UvJNSAdSu8Tw1JqovYyff7ltcyKDyGdUQgf6rLz1HUUaqENiqk1DpGpyLjt SIIVaeAa0gIq4v3wv21tqMzy0jv7GwrlN2bqCnwMlX2NDup6FAIZMDvGbQUEqtor+STG IJA/Z1F74gnr077sv8eVoiWx0zpHHOAcnglZmBV4oTuyqCya3oEfvlDJ2ddRT/4oAbaB GGFbYEho0mCBN39QzXoiIhci/asGZKnDmYXmzpz90XeYT+3uPgcV9/bH+otphcAkAZbE oCjQ== X-Gm-Message-State: AJcUukexaepN2P+EiQmj8WvGPzuP/5D27gMCgiRC2Z1bGftQDdwUl48I xXPAbisQft3RZQM6gf8PDzvZwbKNe/jyhQ== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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, }; -- 2.17.1