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, };