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: 156918 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4226148jaa; Mon, 28 Jan 2019 20:58:19 -0800 (PST) X-Google-Smtp-Source: ALg8bN5yn+n1TOqaBDp7byyRzZh7KuIArDVrMqNpmNHk9RzvfK9/YEfa8KFCEAsxVoMkJOyeibAy X-Received: by 2002:a63:4c5:: with SMTP id 188mr22576415pge.391.1548737899561; Mon, 28 Jan 2019 20:58:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548737899; cv=none; d=google.com; s=arc-20160816; b=YGs9MGqG9ZlQSEU5oGdxHM5IjI0RVzXD4vrw7skfCpxNtizqvFJfw9Itq6ubnkg5zs /ga5SdXbxjqw/g7w6A2zXTVQu9LKjswcys4Gimzm5chJca8cGEVL9AFwG5/PXW9UNPtV 11SZR/N+GjGvVxGO+SS69O3wsY6otgKwRoSv0z+1zA9aQTctGPbCuXojCgV9lLB1GvgX YdHLONYzXuNAR5CKv2e2eCMdF3b0cfLMzklTAiEJngHOta94CCCx0LIysf1G65oqo+3W Lee8fnlYb45xPKRK+ACJNZPDU51w3e4AnC3olrIG2r4CUbEOgZyqsFKGeuasdJm3IPs/ 872A== 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=+jPKZ9vp1qOYYm4MVv+7Bda22318qKzwckjJAKIOCi0=; b=WK2OjIRdc+TybdqmGG0stJDXu/40srffwTLESzJQWUO3al2nQZugsSJkESeXWFXNgc thrBy7QgSaeV2+br44b/oM/qZHRYS6BnxnHScfRXSOqmTkr/Qqa+sIJlId9hLdB0Skmf pAOjU3xJazmB+f+rm9XI9eo+l/dGm051nKHyhRZMBcxoT4oX39ZqZPMgIk8X5jjyjwfg B72FgeGcFNNHrFTEF38hsJLkfyq+SWysHTb6LY6Ks9EjBn0SIO2BCqVQg9LzqcasncEm clUrLpKalNyEoTUnMpyS9mBGLeUF9nGEmuPyZj2Dp5yNPgw9A8Y1OFPgsfrQKYWGx+4J u2Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=anE2vDQF; 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 h16si3552949pgj.203.2019.01.28.20.58.19; Mon, 28 Jan 2019 20:58:19 -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=anE2vDQF; 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 S1727588AbfA2E6R (ORCPT + 31 others); Mon, 28 Jan 2019 23:58:17 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36972 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727373AbfA2E6Q (ORCPT ); Mon, 28 Jan 2019 23:58:16 -0500 Received: by mail-wr1-f67.google.com with SMTP id s12so20503802wrt.4 for ; Mon, 28 Jan 2019 20:58:16 -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=m01X8Pi8y/vJAMX8Z/GfVSE8IhmyxE06TR+FhwYJRlF9r86w4+fMrtYBBxXDzBb7i7 Hs3D2buDgYCjuEs3oCLDQJAksPw0qRpC4rH6gMt2ESlc56k8TTJ+e3PnbvQcZ29u3N8v 0uTIyAbgaHO82/KnPr/yj/XVhXSyDA3hGdf/dbp8lExjuA2lnp+cU9rpI52/o5uRG4PB SsF3kmRyQ1/oM0fyLlcEyXkUe7/Wlybb8Q+NA964SBf7isYLB9FQU6JFiys1LLwDJh3g JyP6JvKhWn9Nij0A2TWpZjP9izxjmkPiUFRAF/+W5U412P2CD4U4DT3DW4khyIBHD3fK MYDQ== X-Gm-Message-State: AJcUukcF/AjVjXLU8eZMFuObxr86zc+we4QySmXnDToltJnO3/HP6XL4 N0mWxBnXE8g3UMJn2uxL8FlHqUitLDo= 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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..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, };