From patchwork Mon Jan 14 16:34:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 155555 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3860436jaa; Mon, 14 Jan 2019 08:38:51 -0800 (PST) X-Google-Smtp-Source: ALg8bN5wdgMHh7kL4Wnaw2PTsuIEuEPEuxnXVzV4WTq4ae2far42ocNLF4psNlQnTRLtMs1R5UDu X-Received: by 2002:a62:7e13:: with SMTP id z19mr26052959pfc.94.1547483931894; Mon, 14 Jan 2019 08:38:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547483931; cv=none; d=google.com; s=arc-20160816; b=aGIxjcANJCZiRHJMlEux9cxHaiMTE8EaoZYAE2QkqPZ0jHwacmu6GMgdU7eRodrNuJ qmuyQpF2UfNvFZoeQ+l2NFsMD8M8OW00nxXP3wafYc9vJGzokA9G7p55X+ad4XHbmdv8 rQlSK0DSIVImRwewTawWtQaZLgTRvaz83WLi7lTiPVwECwZZ+Egw0RhqLNN3/H6B6sHs tcGBjD9dqwVkwKsmVBBvNIHsa2YGVzbw0pz6pJ8pBI+SyYHIP4DqkvrqFItyrYmsf0eu o20chtXcgtNsfjkSmyPdVbii5VBkHNZd+jUpiFz1mQRWCTiV8g9LA80OArdgYdcn8Qk4 lRxg== 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=UIVW5Jk3h063m2TjLZyvAJQQxY5HQB8LVsVnZkvA3R0=; b=QdPCfz6OSmiOgbsxTEtOUAs88aAqk07ad+DUi/UxXnOuOTHzUUJS3DUEzEOhhxkyd6 ZhKi9NJG7mbqnF0VUEZSoUjtaqKS5B+pOlcKFuGQu1oBeOjRVKy43UQHAdg2mluz1zhC umeiJsVe0dAbyUFB8uQnxPLKLnHQMSl3qQ6Zra2eycnkN/3tI7QPACoXycg+FdWiRGLk rc195cBGIGrd8ympfkkrakuXlWQqxwsg7ncoaTIH2asHvqKrwsS4hW2K/YsQaSHz0v2A pHx6eGEsJPvGpNrreI4D6/EUzxXq3cbE3keLqqMoKtIjDUeF31IZZ+uo1CIIoyzlHN/b RpDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Oe5N8JYA; 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 bc7si665347plb.120.2019.01.14.08.38.51; Mon, 14 Jan 2019 08:38:51 -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=Oe5N8JYA; 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 S1726736AbfANQiv (ORCPT + 15 others); Mon, 14 Jan 2019 11:38:51 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:38806 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726729AbfANQiu (ORCPT ); Mon, 14 Jan 2019 11:38:50 -0500 Received: by mail-wr1-f66.google.com with SMTP id v13so23654339wrw.5 for ; Mon, 14 Jan 2019 08:38:49 -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=UIVW5Jk3h063m2TjLZyvAJQQxY5HQB8LVsVnZkvA3R0=; b=Oe5N8JYAdaTMIzIXzxENuBPAAkXsaAkTXY1hQM2DXCEDtSRB8YPdZc1Z6ShWxktov2 ZR5kbfQP/Z5P2bFF+aECvR2FeAwTLxJfYGTN/b23rj/w3DzC6/CfVhH0RYRf86/RHvla 9LLdaJmiWToZ9s6mCd3GqK4FUZa4FppMCTyPQ= 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=UIVW5Jk3h063m2TjLZyvAJQQxY5HQB8LVsVnZkvA3R0=; b=OuBiIgzm/5iroFfqEoh/t+K7ZkEugAgj/J6xnOg3Y6l9P7kgkIDlr09QA40CC57FB4 P7KfFTyca+OyYSWmYzScs0IwnT6F1Bsq6EfLfsBNmfYBOV65yN8OC69uIgfR+v+iTr/V Wb6VSxDgew09/eFQVIb5th6yN7A3Tnl+X52YBIWgwZn2EDJKQgdEfENIXxV3cckaWgmg rzMHhzr9A2uA2KYP4kB/mmlePO3IPaC15xGnQkBfdnPZbTTwx2S1ZJFbLpKO5hqPbp0P fd9rmawbjHEOp9XkB69rKS9c95Akp7igytYWGStjjFeOvyaKlRJLetIBdj2uMb/KkDqs Nwsg== X-Gm-Message-State: AJcUukcQJNOBqxDzEG59/dN6RzkPqRUeKMpTQZIzf+kv7iYhB1ofF7jh 3PBmlJ+673qPfPQBrtGwsmJT5A== X-Received: by 2002:adf:cc91:: with SMTP id p17mr25446735wrj.118.1547483928892; Mon, 14 Jan 2019 08:38:48 -0800 (PST) Received: from localhost ([49.248.190.171]) by smtp.gmail.com with ESMTPSA id e9sm60948525wro.16.2019.01.14.08.38.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jan 2019 08:38:48 -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" , Anson Huang , linux-pm@vger.kernel.org Subject: [PATCH v1 05/10] cpufreq: imx6q: Use auto-registration of thermal cooling device Date: Mon, 14 Jan 2019 22:04:57 +0530 Message-Id: <49e531e140f299127ae6c0bc905b993b97c269e2.1547481320.git.amit.kucheria@linaro.org> 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/imx6q-cpufreq.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 9fedf627e000..ffb00291f48e 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -52,7 +51,6 @@ static struct clk_bulk_data clks[] = { }; static struct device *cpu_dev; -static struct thermal_cooling_device *cdev; static bool free_opp; static struct cpufreq_frequency_table *freq_table; static unsigned int max_freq; @@ -193,16 +191,6 @@ static int imx6q_set_target(struct cpufreq_policy *policy, unsigned int index) return 0; } -static void imx6q_cpufreq_ready(struct cpufreq_policy *policy) -{ - cdev = of_cpufreq_cooling_register(policy); - - if (!cdev) - dev_err(cpu_dev, - "running cpufreq without cooling device: %ld\n", - PTR_ERR(cdev)); -} - static int imx6q_cpufreq_init(struct cpufreq_policy *policy) { int ret; @@ -216,20 +204,18 @@ static int imx6q_cpufreq_init(struct cpufreq_policy *policy) static int imx6q_cpufreq_exit(struct cpufreq_policy *policy) { - cpufreq_cooling_unregister(cdev); - return 0; } static struct cpufreq_driver imx6q_cpufreq_driver = { - .flags = CPUFREQ_NEED_INITIAL_FREQ_CHECK, + .flags = CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_AUTO_REGISTER_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .target_index = imx6q_set_target, .get = cpufreq_generic_get, .init = imx6q_cpufreq_init, .exit = imx6q_cpufreq_exit, .name = "imx6q-cpufreq", - .ready = imx6q_cpufreq_ready, .attr = cpufreq_generic_attr, .suspend = cpufreq_generic_suspend, }; From patchwork Mon Jan 14 16:34:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 155557 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3863594jaa; Mon, 14 Jan 2019 08:42:07 -0800 (PST) X-Google-Smtp-Source: ALg8bN41EKfpUYW2CdbwGIL1s1SHxTBoTaGiwMcz2n/lzaYSocKOPtbCC4lQiTyOumjLc9Z4j4S+ X-Received: by 2002:a63:e21:: with SMTP id d33mr23515164pgl.272.1547484127309; Mon, 14 Jan 2019 08:42:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547484127; cv=none; d=google.com; s=arc-20160816; b=ju9batOs7R7tDTd9V9eo5B6G77drOE7kb9A4CIzEMRxtKiyF6NPaRUAQbO6NCi6sYE 0k+qwQTe13EgcLeRxtIqjWTp4eCj/lw0OZHxxstrPiaS02gWYfQ73YRc7Pz8qAXqqMDl SR8EXgH1cLJQaT5C19moyHvFqf2aYPEXCHDZ2nb2grmQQaoTJ9/RvQHjGA2gw0c198/J clrX05mL2ku1Yz7QxNcuqbwtD/lmN9fryZw6svDf8h/XgOzD9yGCH4YbYduFUDVVRAEN qNb5YNUQw4kgD3FMddKEx9PQxdjuHsAPlA80ovw9TRE4/+m5700ZxZUql275XKx+JpSU 4cKw== 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=tKLZv/PApJD8Rpyyr/+hm8XMw9L4JgFfOnfKHHwbuMDjMfej3iq4q3/poV91hsIMhc BSeACzGXSXevPZ7qElx+iC4Yy4hdzLHsF1/C6j8o0AHa64LHB0ZjO5RDCbQgB9zX18BO Ie7HnZGbEstjcgMoaLT6wQKf7SRdVmmQLuwMORF5RZjxCSBN6md52kxmCSvMMv76WPn6 oxpGMoFnC6AHs06Nl/wZ7Lzm55SUqjKevgYceh+WcfzODKbpvo4/okGI3esmniis33hW HP+qWgLC2eUIquS/3JF3BR2Mxl9CbCUqW69eoIgst6T++yTr3qJU/tIIBi3vh0qpb0Li xhyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Vn/oqcY/"; 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 l7si725033pfb.31.2019.01.14.08.42.07; Mon, 14 Jan 2019 08:42:07 -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="Vn/oqcY/"; 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 S1726751AbfANQmG (ORCPT + 15 others); Mon, 14 Jan 2019 11:42:06 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:40654 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726749AbfANQmG (ORCPT ); Mon, 14 Jan 2019 11:42:06 -0500 Received: by mail-wm1-f66.google.com with SMTP id f188so208475wmf.5 for ; Mon, 14 Jan 2019 08:42:05 -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=Vn/oqcY/P63zY8ZUM+xRQ9jA/yok6Av41I0Nbd/XBcMYaybRLswoqC+bZ7zFthiL99 AD8roHRXIq4z/jltTQDQy+bZ3SYq2XsqBoRpBPDqUlr3MrNNQ8pHTqOE2xiKwhPFJy1I +jhPvzj5X/ykiwTALhSNyEO8GSfyjhARHv/Z8= 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=Y+6hUOKumKtUSLg4tN1xscaTqJAD2o5xaWEp795QfoazIZmg8An0OA1BUGzWmYADJA /xpquG2dgnm4kLeqadlxziwyolnK800XCAkFiblAQS+IQn0K42239+sY3nIiQ/mfE6Df sJI+C1raqgZqR0djgQUHHxwlKg9DyGibJEMCY4/KF1EL98RqIgkSamrNnrqEAOQSpqF4 HggsjrPdqYMRhYgs9M3Sx7I/NA+hUBnHv6pxJ5IhSRiPBZfa6OQIipU7mP/NLtkUNC4D 7JB7WU4qBdMyXHlawBvd6GuiEo0jWxrCZv+8xqtBZAHeanSmFvydiMVXcmsKUsmfrSKf YsTw== X-Gm-Message-State: AJcUukewuAIbvsk/FhIWrwl3/o4XVrPIIVvSZKknbA5xx6n+/HtgzhdE IVStUQXuYy3xxDkNCCMyz6UfGA== X-Received: by 2002:a1c:2007:: with SMTP id g7mr12266919wmg.79.1547484124495; Mon, 14 Jan 2019 08:42:04 -0800 (PST) Received: from localhost ([49.248.190.171]) by smtp.gmail.com with ESMTPSA id k3sm110603159wrm.7.2019.01.14.08.42.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 Jan 2019 08:42:03 -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 v1 07/10] cpufreq: mediatek: Use auto-registration of thermal cooling device Date: Mon, 14 Jan 2019 22:04:59 +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 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, };