From patchwork Tue Jan 29 04:55:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10785421 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB56C13B5 for ; Tue, 29 Jan 2019 04:58:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC2542B216 for ; Tue, 29 Jan 2019 04:58:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D60B2B38C; Tue, 29 Jan 2019 04:58:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F3482B216 for ; Tue, 29 Jan 2019 04:58:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727586AbfA2E6R (ORCPT ); Mon, 28 Jan 2019 23:58:17 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45459 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbfA2E6R (ORCPT ); Mon, 28 Jan 2019 23:58:17 -0500 Received: by mail-wr1-f65.google.com with SMTP id t6so20472584wrr.12 for ; Mon, 28 Jan 2019 20:58: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=+jPKZ9vp1qOYYm4MVv+7Bda22318qKzwckjJAKIOCi0=; b=anE2vDQFGsF1XAH9CF3uxaknWOljYGMhl2CzciW+AY/hDoFhzqbpIBHB4a7QW3S8bl LzXlRKbR2mul+a6Puig7aadA8sQiu9FpEqXSzZhq+1XVpFjjltMi6bf+tkeo1p+ipT3C cQp2f1YPstwlKD2T7RT2Mdhqp+4aAANaszQ+g= 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=+jPKZ9vp1qOYYm4MVv+7Bda22318qKzwckjJAKIOCi0=; b=ICvqorJwKRGqFRafKPowik0f5ioH2aDGP51fkgc7EQs1RUBUNHFnPHxhErQLVtFqRj vObJCauH4q6NwEVQNI0wrJALqbM/k28Ga+Th9BjUhEsg4Nhtxvfb92etcAM9Q9LtYGm3 oRsWl2HmqSqnifbu6/o/9eYCdP4kzDea5PKqpUQFYPmYF6uv66VD/jzAZcPFa8sKUgri bu4VazV3Z+jSLJwcX+qVKkBOPJS7xpy9LhUjIbEgEF1xzFqogSU0lKVhYpMs7HNqc0PF fI8rSV0EJz2o7JW/EPB5xQmONTtGBjjenOo3kpZ0fMBTQ0PnxK8vLLwHfjyu+YLaMRVY Ly6w== X-Gm-Message-State: AJcUukcMbuVdScoYr6UJFthwuMiPrGOu9+XjBDwcz377ABfCMBFoSp+Y 5VY9lcr+dpZLNYRYystvD3QS0A== X-Google-Smtp-Source: ALg8bN5iW0BV+F0TjrVK5FWW51JWwOc6PxD2qUoFZ3RJ9thGLu66KEy7/JexxnljuVPUMsceXISG3A== X-Received: by 2002:adf:f449:: with SMTP id f9mr24838998wrp.40.1548737895053; Mon, 28 Jan 2019 20:58:15 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id a8sm2977581wme.23.2019.01.28.20.58.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:58:14 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Matthias Brugger , Daniel Lezcano , Sean Wang , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v5 6/9] cpufreq: mediatek: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:12 +0530 Message-Id: <36eb429112e84263bdbd26d8ea3027f71eeb862e.1548737236.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use the CPUFREQ_IS_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 Acked-by: Viresh Kumar Reviewed-by: Daniel Lezcano Reviewed-by: Matthias Brugger --- 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..4229fcc31310 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_IS_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, };