Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp140886imu; Thu, 24 Jan 2019 23:04:41 -0800 (PST) X-Google-Smtp-Source: ALg8bN5LiRP4ut03IlP1ZjlncXMZQtrjCqIRIYndDLtLQPSerzJQXdDqHlj6GOzIQmH6EfEYyvk1 X-Received: by 2002:a17:902:d697:: with SMTP id v23mr9644424ply.261.1548399881397; Thu, 24 Jan 2019 23:04:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548399881; cv=none; d=google.com; s=arc-20160816; b=BYY7hFFwcy/cy7KaJ1mlTpXJaIg2HuIEzNgotSolgJf2hwdS263S0GIhS8hNo/6Ilj bRlU/fCo/I1pSX+0JpfX4j6R8qAFAA+SsXmC7/S3BkS3UrWH8PZ80qdux7+1Zy13+IqT DCN4lwBSsiYclZd3/tCd8+smL+85tvQkYowZ6+uwicvdvKTesSXWEUDLRXt7aaeoFgAh pnP/pCZUpBfsi8FJ5bHppaXNVght7L1SAo8hrs9jJBJCE3SXXbQiYmvhMy2UXTAGYKmc 8t0RNMqj1YivQTP0FNWTeBDjpZ55Xkafj9x0OoPeta/pwOyYJ9gYsNdlms6DOr0spuNu m8Og== 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=QgIeq2hgf/ALQ8+wgAG5984e1EpFSVBUxN1z79Ef40cMIHk1vjL9oF3jdrn4jbsOKf ew3MiMx36qFj1KH/NVY6crI71wB19PVzKuld90AKDtsCa7SmISx/s7uSNO76VZQnJMsH WfRpmWxmRVeyh6D3gDOm6FAp1cNZKeK0/3U4XatIooqM4vrx9KvLQH3l8Tpyxg11XPbs ijSbwflFmIeMHaFcpmzZ9SRjvwrTL6JaYpex8fTiTQZMA+UhY9NnAIK6q5/PrOI/akjw SwonoF11nMR1cbDG5RetIKXL4UdFdhhvfoNcD5KTe5vKcaYeFnDAPOlnw6O/1Slo0uqU efWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sbigyd7J; 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 d13si15930013pgh.196.2019.01.24.23.04.23; Thu, 24 Jan 2019 23:04:41 -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=Sbigyd7J; 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 S1728468AbfAYHD0 (ORCPT + 99 others); Fri, 25 Jan 2019 02:03:26 -0500 Received: from mail-yb1-f196.google.com ([209.85.219.196]:40622 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728421AbfAYHD0 (ORCPT ); Fri, 25 Jan 2019 02:03:26 -0500 Received: by mail-yb1-f196.google.com with SMTP id i6so3446184ybo.7 for ; Thu, 24 Jan 2019 23:03:25 -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=Sbigyd7JmgLIlZ+I8Oa1biLl04Yqaku8qwP4GxQjehESlXzS4ZDj06HZsdDus/h5jp 6pchh/E0nJernzSmSS/DQOTeRvMl0jDrvFSc6TyL3twTCmUGu1Nc01rRiSKUv5Oj0qBY ouKw3DMoqh48jdgClJF2nCqK3oD35XsPX3Y10= 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=bnpBcTNNDWmhY5U7kkQkb4hjqu7RbKRC+DihG/yVuKIZSf+3NC95j9AzjZ0T4aIM5C KeoLJCLmKuOgIJUO1eu8Aws8SO7vUE9rScEOZx88LltOhPMAmBkQgIe8GXqR38ZTaxW7 lsgI87igKfovW9Wu+3MRZZNWzOK24PIrwCO1U7Wto5zV3zEEkdHceQfdM7bZ/t1IB71X 1jdL0OFKRWW9REtNBUUpfJJTfShSNKEe0fXX5E5Debp5Ig5+GDvCRJNC6skixI+ZbUkz fPiGaz96/3W9vxQ4xlrfQUdo3TR8s2cxQ9HgVzSGYz4n9hsOlrj2rMh1spGKaYnyVFX1 4EIQ== X-Gm-Message-State: AJcUukfuFcpJstBSa+C88L2m09GgKYcwfultFVFdrjvuzpfuwrkGsTzI 9X1olUrbBbumZGCCiJgz2lbGRmIyH34= X-Received: by 2002:a5b:412:: with SMTP id m18mr9106264ybp.243.1548399805154; Thu, 24 Jan 2019 23:03:25 -0800 (PST) Received: from localhost ([49.248.181.51]) by smtp.gmail.com with ESMTPSA id f62sm10310024ywd.68.2019.01.24.23.03.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 23:03:24 -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 , linux-pm@vger.kernel.org (open list:CPU FREQUENCY SCALING FRAMEWORK), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support), linux-mediatek@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCHv3 6/9] cpufreq: mediatek: Use auto-registration of thermal cooling device Date: Fri, 25 Jan 2019 12:32:26 +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