From patchwork Fri Jan 25 07:02:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 10780671 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 D512513B5 for ; Fri, 25 Jan 2019 07:03:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C1AB72F843 for ; Fri, 25 Jan 2019 07:03:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B565A2F862; Fri, 25 Jan 2019 07:03:43 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 62F232F843 for ; Fri, 25 Jan 2019 07:03:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=phpUCEtC+KHK8BKftCk6Mb2s5Y2rcBtAnop2sRaGzek=; b=EBOtlATcieuhwGshxXC7qgP0+z nmd1GCWHOjKHHZ9LULvFQ3mP1JgRxw4tZAriYud2EiPgm6g1D7fP94HDN6fLI5Y9bEqCegn3w9j7g yOduwW8VmDIrT0cx9kO/f7EEhEuu9dKRxk23pBU8Zo0vVlBINqNoPsI9CxCfcwNo1+cVrjw/Ko2eG shbkZXwXCRyU+1zfC1FQNiCviCvEpqq0GmJtA994keI4BPInh5Q3aSa/l+k1u+rJCsppNvReCg4HJ GJM4sLacoRRyO0fE62AaIj/4FkT3UjqZlyRFuze1JCQYesYlpkUJPHSDh1b+hog4fhmPLUKhwXn4X sdNPhbWA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gmvWg-00057C-D5; Fri, 25 Jan 2019 07:03:42 +0000 Received: from mail-yb1-xb43.google.com ([2607:f8b0:4864:20::b43]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gmvWR-0004sr-3z for linux-mediatek@lists.infradead.org; Fri, 25 Jan 2019 07:03:28 +0000 Received: by mail-yb1-xb43.google.com with SMTP id s17so3447218ybp.6 for ; Thu, 24 Jan 2019 23:03:26 -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=ZTO96/NG/AjonFQkuEK9624fCljb5Lm3dF3C53TbhTLVEAVi11x4+m7JVJVYOYSfH4 Cn/WnIWwMdBMswn0DoxGSB+xnLtk2VfHSL5y/KiI5zxPBU6KYMcuTwVuIo/VBsVy54F3 ArZostugCdD5zBJeVkLStNiLzM6LRNPYdGdCEhpCA1m0nPvof1UJvQyZAS17+CGDuhr6 TG1TEHieXwwH5E+XTlaEKEwdUjmzRdnazPhZ3xwBIR2YAS5br7m6bO/CNNH9MvenyyOW 76GV/WnSt7e73wJWM9IEE7Z+6csxbgt4m9UrQFqujtz3ldpcOpDsaQjlOghpSVTiLNwl yEnA== X-Gm-Message-State: AJcUukezVXJm8+dycy21q9NppBScaeJdq6E3u3mmOhRIDqzEfB3kpyh7 xopQoIGjHME1W+TBFhtu7BHCow== X-Google-Smtp-Source: ALg8bN58EbqqRRNEU3mB7QLSSmV6TAP0kmLn1/+IwmGM/Dg7drlFTgOUGrtSJLqTJKTTjCRc3wyIog== 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 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190124_230327_159771_63146933 X-CRM114-Status: GOOD ( 11.38 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:CPU FREQUENCY SCALING FRAMEWORK" , linux-arm-msm@vger.kernel.org, "Rafael J. Wysocki" , dianders@chromium.org, swboyd@chromium.org, edubezval@gmail.com, mka@chromium.org, "moderated list:ARM/Mediatek SoC support" , viresh.kumar@linaro.org, Matthias Brugger , "moderated list:ARM/Mediatek SoC support" MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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, };