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: 156547 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp18411jaa; Thu, 24 Jan 2019 23:03:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN6NkYdGO3c+WyiSXlU5afkH7opCXMrilao0BCeFrjCWKskzFAnn2R3Ql9ibKhowN6vw2CPu X-Received: by 2002:a63:da14:: with SMTP id c20mr8490699pgh.233.1548399808991; Thu, 24 Jan 2019 23:03:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548399808; cv=none; d=google.com; s=arc-20160816; b=xVa4bgb9XWrZv62vHOr+YHyJtQIaTKsb0hykE3Jo3V8uVBOcWLBEWGiF0oM2Bhlt/Y ZobvtAotXB74vw20VmTEKns+T/iYqzjd6TURvRVZXrydFV02jrAuee0JDifqNGG28BkP dg7s82N/5vAxsMjZEapPD/biPSNFSNUwZSRjdRUy8LqaeXNSuS8E6uemDYyayfzF1ShJ oMY+byL2CVbbrD6iAYlnd17BFSDtCoe6OYa7Jh22KV9HSvh6ohk3xrI1wNDOa+s/yTbF TmrXYmgAnO1EvGCv/9hOwra0M3pZOncGdMGS1y3+2F/kF1oVgGRbacLn/EbpXCSwxTKg 0/GQ== 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 q16si23847739pgh.185.2019.01.24.23.03.28; Thu, 24 Jan 2019 23:03:28 -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 S1728481AbfAYHD1 (ORCPT + 31 others); Fri, 25 Jan 2019 02:03:27 -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(-) -- 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, }; From patchwork Fri Jan 25 07:02:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156549 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp19062jaa; Thu, 24 Jan 2019 23:04:14 -0800 (PST) X-Google-Smtp-Source: ALg8bN69MjjK3rmdrFARD0aARTZ2F+u044YBZsXX1O9PQIvDA+Y4WcEqZQDrNjEIzk/Z/JENVV5q X-Received: by 2002:a62:109b:: with SMTP id 27mr9602284pfq.227.1548399854500; Thu, 24 Jan 2019 23:04:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548399854; cv=none; d=google.com; s=arc-20160816; b=dUrizKoetXUPZiSCNn/kg18uhrR9Wj9l+HJJaxMotcTG+hnCEZ4CrBOk1No+8cDlz7 ohcD2u44pJdq9CtyBj27ZNQodkVSLHeRWpAyU5TkWURCcaKUYOOBMAyVLRetvkyUi+nv kFde8DAWCO9510a/+1zoAEg7RxsbX+339UgqfEv7ETFnBttbzfTFHW+DiGpsnBeoUnnj 37eTPL4rHdxzVGoOkIXSXaBj3AoeOLFO9RaIYnzURjlOuZKcC0tvdKRaKVeIh3kCVz2p XFzxUxDVOVELpknmrHRyyL/me01VosJUyFicDcT062cPa5dD1zxLnq+qIxXhGY6EU5mn 8v2A== 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=xA//1FlkdsXmsx5auTFeNL+jjZLqfN7vDldrYpONvm4=; b=bW2gwR+gQSrq7p6f0A/PhGE1snRdCrNWOjMkqbcJuo7zWVlu1xsVCrcV7kc+ZlsMQC SJawj7wlF1ovSoD0bYOjlu6msPLRLlC0eQMn696VtYKQItjYMsYUNnXkNTw+T8A6Dj/R tjk9ljEk0HEWethou/Wwo0qhgk4etQ8YIJvM6rLD8HZ9b2DTva6JUneOe0+aLXC/yKbO CY7+ZAW6GauEyxBrq10OHUJt5D4jBITXi/pc08onYfNMfujIMN029smKFkO57RkI0VXd 1nCthqonN/VjdCWuaAVelIgjpJ286YBsK3rwyvWQf0f2F4O5O6BCNtTpm7ofEMHXpYDe ZAqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cKCXamQs; 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 o19si20154240pfi.261.2019.01.24.23.04.14; Thu, 24 Jan 2019 23:04:14 -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=cKCXamQs; 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 S1728702AbfAYHEM (ORCPT + 31 others); Fri, 25 Jan 2019 02:04:12 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:40417 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728588AbfAYHEL (ORCPT ); Fri, 25 Jan 2019 02:04:11 -0500 Received: by mail-ed1-f66.google.com with SMTP id g22so6554806edr.7 for ; Thu, 24 Jan 2019 23:04:09 -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=xA//1FlkdsXmsx5auTFeNL+jjZLqfN7vDldrYpONvm4=; b=cKCXamQs27SFMCtXHsaEBtbiosOOItfG+tsJqXFmkDoPmAf2H+e73DJevygpbblnSt GFq4GplluPUoT3mbrGtJ1VHYGObCo8N/odzHXnGIQQ7Q5bx0BLnO7FMcKOk8Th/v5nbm 3jWu22wKm/ypacS7C8rwvGblxK9vpItxXi+Xs= 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=xA//1FlkdsXmsx5auTFeNL+jjZLqfN7vDldrYpONvm4=; b=fhRJesF8/rUqTT5z4PEy2gOAU9ngBKrcrFgFDryInko5Dl+QTOLV0w0MKlRULMN0md z3OyUXJo0p8EksM3IvS9siWOxyYI4+CqJOHEfQhlRnS1qj3zIRDfh1Q58MSvykRLJEEJ +dMfdiIiWZiK58g1/uHd9daahwdhVAENKecIAAkUQcr9q18JQd4TYx+aEkhNfh9KmdnH DzMA/+uRjbcu/n0dkIfbGlQB+OYC8dJSZS2SabNDDxr5IqrlMckHOsCW2qmgA4dWTqOR mjS80i9UQ1LqDWxSEdn/z5l7f36RjQVJHm2hAif5x+GOx8RgVzjzcy4ncgSyf6lrtfmJ xmmw== X-Gm-Message-State: AJcUukcza0xfGcnn/cgdO+wboxN9HA/Guxh5F57+1FIWdnrRUEMsNSg5 NNiLNnoPsrv8DaM0xXFil6zNOomS2pw= X-Received: by 2002:aa7:c55a:: with SMTP id s26mr9551675edr.132.1548399848614; Thu, 24 Jan 2019 23:04:08 -0800 (PST) Received: from localhost ([49.248.181.51]) by smtp.gmail.com with ESMTPSA id w56sm11734113edb.72.2019.01.24.23.04.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Jan 2019 23:04:08 -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, Sudeep Holla , "Rafael J. Wysocki" , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org (open list:CPU FREQUENCY SCALING FRAMEWORK) Subject: [PATCHv3 8/9] cpufreq: scmi: Use auto-registration of thermal cooling device Date: Fri, 25 Jan 2019 12:32:28 +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 Acked-by: Sudeep Holla --- drivers/cpufreq/scmi-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 242c3370544e..b19e9d129f8f 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -22,7 +21,6 @@ struct scmi_data { int domain_id; struct device *cpu_dev; - struct thermal_cooling_device *cdev; }; static const struct scmi_handle *handle; @@ -185,7 +183,6 @@ static int scmi_cpufreq_exit(struct cpufreq_policy *policy) { struct scmi_data *priv = policy->driver_data; - cpufreq_cooling_unregister(priv->cdev); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); kfree(priv); dev_pm_opp_remove_all_dynamic(priv->cpu_dev); @@ -193,17 +190,11 @@ static int scmi_cpufreq_exit(struct cpufreq_policy *policy) return 0; } -static void scmi_cpufreq_ready(struct cpufreq_policy *policy) -{ - struct scmi_data *priv = policy->driver_data; - - priv->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver scmi_cpufreq_driver = { .name = "scmi", .flags = CPUFREQ_STICKY | CPUFREQ_HAVE_GOVERNOR_PER_POLICY | - CPUFREQ_NEED_INITIAL_FREQ_CHECK, + CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_AUTO_REGISTER_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .attr = cpufreq_generic_attr, .target_index = scmi_cpufreq_set_target, @@ -211,7 +202,6 @@ static struct cpufreq_driver scmi_cpufreq_driver = { .get = scmi_cpufreq_get_rate, .init = scmi_cpufreq_init, .exit = scmi_cpufreq_exit, - .ready = scmi_cpufreq_ready, }; static int scmi_cpufreq_probe(struct scmi_device *sdev)