From patchwork Mon Jan 21 15:40: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: 156213 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6515975jaa; Mon, 21 Jan 2019 07:44:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN7R9mmTAzlLPd7WeypG58egnDgJHCsKWvshSvTou4WI5RnShe4E9mEu9phY7/xE5MvJ4htu X-Received: by 2002:a17:902:e002:: with SMTP id ca2mr31022365plb.103.1548085440299; Mon, 21 Jan 2019 07:44:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548085440; cv=none; d=google.com; s=arc-20160816; b=GdaG0HOe/O8JJgBhqfBOqpz438FEB9lZRR8ep+UG9518nxNM1gMJHgRJX8o//hMHdT +iSqcNLTVwNIRjN9kQlFN+JpGwmJhgY9qpkBhuUvG7sN+o91HBOzHYI+k4yfZM9wm234 P8rh7COkzTVf13q6+KOTFg9JUCecBDjuugRHslQIly4odbUY9X/DsMeCwzZc7IJRuWQl uTekJbSy4gBiWD4Y27w3BvFrIpedGmmk3tvqKeL3f/AVCwvICbMqgvUI/DWUI7tjI57O NgfG7GvgAmLBvG0XW8DU1rLRqy5OZqtDoMl6kGSCWeZhIC28IqpHokfqii15fjUiJ/t5 Rr+w== 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=zLqXF7SYoovkgBMNm7MtzJSzeE0VgZYQlKefNmrl8Go=; b=ciNTHEu6PAYP7vXa6qAYGuJa3i/21ii4XE4OHEVyXAvb0p8cNBngHxzFg6/n0kSOMm jvkmTkw7Uml71RG6N+vJZitaqfRval88sfEDTpCnASFEI9apJmWOCwgo8CK5xCE1RHgC Baje0Ll1/cOLCPKQamF2u5LlKnSCjDRI/uhd6knNeupt6ZLE1ZApDAW8wKU1Ge5Cwpca Qa/XBchwtFz1xcvfGDUBuOozLzOdk925HDIlAdlYLnrv0eGtSIQIh0uKPl7+EWJ11Gub ZJoGZ2ekqLRcFbbrGHWNCYry1xXc/i5wklXSCt+ix3jywaNaLkYL7oW9nkEykCW69//z QioA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MSRTlrDV; 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 n3si12654562pgk.405.2019.01.21.07.44.00; Mon, 21 Jan 2019 07:44:00 -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=MSRTlrDV; 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 S1729792AbfAUPn7 (ORCPT + 15 others); Mon, 21 Jan 2019 10:43:59 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:42737 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729534AbfAUPn7 (ORCPT ); Mon, 21 Jan 2019 10:43:59 -0500 Received: by mail-wr1-f65.google.com with SMTP id q18so23870701wrx.9 for ; Mon, 21 Jan 2019 07:43:58 -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=zLqXF7SYoovkgBMNm7MtzJSzeE0VgZYQlKefNmrl8Go=; b=MSRTlrDVky4wuhprrrQEcgS4g/A7iauwDUwHh2yTA2fvbfncJR+0YY/bCyhOfDD81i 6p2yhk24s9j+HJy0rPQkvX64Ac3b6OQfUFJh17Tm5vC8fLjAzF7EbNmAgGVNYikIV3At Pu8omYSPt/6n+u5VdPnEwpyp1tJ82t5ApivNg= 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=zLqXF7SYoovkgBMNm7MtzJSzeE0VgZYQlKefNmrl8Go=; b=eJQHBjxdIK7aiwxT0WfLqd9b6HMoG2Hh6dbAXyLEQH2JqtvONLVS5I/1AN33I5uh0x 4xrPvoQHlRsqQKGuD82KzZgxs62i+K+PCYFEpSgF0DUxNx1cWn/zaitKH5+V7YuVKI0g RBav3NtWVmteHkim9Z9W33zVDBNPjCV71xEhJzxsK10gbe03ej6OYovCzntXk+kbGZa1 2cwfrD69oLyrywQ2YIShYWBhehnt8pnK6HDn8wA2wasGq3Ph8Po+dyzMc++PaMK9uDS+ LaGWNH+47jdW8ZkvKtzUAA8F3GZbJF24S6Aocbplt3GsR+r2J67GXu2A5O05R6rYu5lR LE4Q== X-Gm-Message-State: AJcUukfW+bXYDmsLj8bNvSzpp8nMy2W01GrHhRtdYS7cc4sJVZsMUHMT ts3yQcVpKCxcH6Y5QUGv29hhdw== X-Received: by 2002:adf:d089:: with SMTP id y9mr29250380wrh.22.1548085437537; Mon, 21 Jan 2019 07:43:57 -0800 (PST) Received: from localhost ([49.248.61.1]) by smtp.gmail.com with ESMTPSA id j24sm116519156wrd.86.2019.01.21.07.43.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 07:43:57 -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" , Taniya Das , linux-pm@vger.kernel.org Subject: [PATCH v2 3/9] cpufreq: qcom-hw: Register as a cpufreq cooling device Date: Mon, 21 Jan 2019 21:10:28 +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 Add the CPUFREQ_AUTO_REGISTER_COOLING_DEV flag to allow the cpufreq core to auto-register the driver as a cooling device. Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke Tested-by: Matthias Kaehlcke Reviewed-by: Stephen Boyd --- drivers/cpufreq/qcom-cpufreq-hw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index d83939a1b3d4..ed32849a3d40 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -231,7 +231,8 @@ static struct freq_attr *qcom_cpufreq_hw_attr[] = { static struct cpufreq_driver cpufreq_qcom_hw_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 = qcom_cpufreq_hw_target_index, .get = qcom_cpufreq_hw_get, From patchwork Mon Jan 21 15:40:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156214 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6516676jaa; Mon, 21 Jan 2019 07:44:46 -0800 (PST) X-Google-Smtp-Source: ALg8bN5WkAKo4Y+TNBBYYsb15w5G3EfjyWdd4qH1pQTVudxDvlbmColoWBO5XaqilyGhMd/qwNHj X-Received: by 2002:a65:6417:: with SMTP id a23mr28649848pgv.236.1548085486478; Mon, 21 Jan 2019 07:44:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548085486; cv=none; d=google.com; s=arc-20160816; b=f0B71cFasKlgNqtr2u/+oMyCI4jOUE112piaY6TSm/5PvcAxKORHnfT6Ef2+iB2JB2 2Vi5GYYvF4tKoMiT+/k9nkbI88JTNoTL/4mZaZqbpoubdDywL6tvQwFGOIpDcm9wqOxJ bvN7SQuYvnlKB0M2JZQaAX5nU81wk848P0FRw/UpaZ4AKnEln3dccEMsSVToA4i5vcpj ByDGWYNl6A6tAbWurRWxuvGCstmyEYDHcZctTLGBsMPcSmQt3pCpmWcX5a1FRllXbWfZ bq0QXnA8lHrsKBNc1qsP7ESST1pxtpLdOzb7ErWO0Qt4SuwOyWXkubvNqV27PveMnvqE iOrQ== 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=1aBBJ84u3ymAhFuzjAtS5nCyk99H9ZXfxJBF/z7RCfY=; b=0qfrBnsbzRdfjKA0nIkfJX6r+BLfhTt7OrmBSq1aCYE+bYyk3PdpIZqD5XBU7bcYoS JukoDSZNMa88k/nenpbVoWLRGz8O+9OnLV2liO1QqITrmV+iRA8FXJnGBPKjKoDK3lmD ffYDlZUdzy1blq0Kh1+zZZblvG2yQkKhCZGiwdreTWjlETX24mi3JxE3jjR/4yY25vtY aReBy8dOUamDchKZFrK4mxTkoKEfQ3y3rHMfOgTGF9iawcZVRXP5qh7mOhDnLHSyt7wD bSfKnBsvVJQ23OXEhAGaeQGvYvIyl3o3KwxoHR1LcUhIb0Lh5gMVmm9157NO4mS9aAJo Bwkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jo0rQgiA; 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 i20si12748266pgh.187.2019.01.21.07.44.46; Mon, 21 Jan 2019 07:44:46 -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=Jo0rQgiA; 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 S1729515AbfAUPop (ORCPT + 15 others); Mon, 21 Jan 2019 10:44:45 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33969 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728967AbfAUPop (ORCPT ); Mon, 21 Jan 2019 10:44:45 -0500 Received: by mail-wr1-f65.google.com with SMTP id j2so24007303wrw.1 for ; Mon, 21 Jan 2019 07:44:44 -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=1aBBJ84u3ymAhFuzjAtS5nCyk99H9ZXfxJBF/z7RCfY=; b=Jo0rQgiA6XZhFFylUgmrP6E6Xzgb15dXRRevqTQJAUItH22QqT2xFJqIko6H3r1KqM zue+H7wGt+G2EkE7X96HcEWFrB+xXcJwXI0vAFtpmmIJM+ZrM7yCAMY7ekTTHxJwXvXf 6puWowuqDKRpwPEsuadb/Ann553jVHZ6f8RtU= 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=1aBBJ84u3ymAhFuzjAtS5nCyk99H9ZXfxJBF/z7RCfY=; b=qPm6JQYPW96pc+6g1VhhDOQniGoPailnpWDQ9sxi1NeCApjzf2Tew8vb/1PIe0/826 qS6+ygOYg0hoJsX9RGDASKHei+H9cLaloYF5DiKtf4KGJJD1rWZhhdt0NlfhOKuJAjEQ kPwpFbKsLBBTLnWbI4Hw3bLQRB0cASmhJc/WmEWRKYv1obN5nqAMrjl/L12v5cRUHHCa qBZqFwatMNasHbYGEMIFM5P8jxYcWAvG05gtrQ0w6xp6RxsINOsXfUJpvjCm9kGnidO+ LgcBYzmd5j8vIRNvEdI8+N7N0LBvk+d9NP4DFk6XpaUmLrQN1GiCARu0l+cRuRBlqaHi cNww== X-Gm-Message-State: AJcUukdd4iBKBNyAccOuWdmAT/CK03U20ptjLlwPiUufe8tOpo5/G4wg QugYTYDLZF6sq4wk+YWvcnWfPQ== X-Received: by 2002:adf:a78a:: with SMTP id j10mr29041502wrc.191.1548085483480; Mon, 21 Jan 2019 07:44:43 -0800 (PST) Received: from localhost ([49.248.61.1]) by smtp.gmail.com with ESMTPSA id v6sm76280857wro.57.2019.01.21.07.44.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 07:44:42 -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 , Bastian Stender , linux-pm@vger.kernel.org Subject: [PATCH v2 4/9] cpufreq: imx6q: Use auto-registration of thermal cooling device Date: Mon, 21 Jan 2019 21:10:29 +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/imx6q-cpufreq.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 9fedf627e000..9935df234fa1 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; @@ -214,22 +202,14 @@ static int imx6q_cpufreq_init(struct cpufreq_policy *policy) return ret; } -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 21 15:40:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156216 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6517074jaa; Mon, 21 Jan 2019 07:45:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN6pmR/hxb1VZK4gOXtGa0fw+enEss+lKVVF1BZIA/pd97FKvoEpffAxIgBfI+wprBEtn+r3 X-Received: by 2002:a17:902:2969:: with SMTP id g96mr30473683plb.295.1548085517491; Mon, 21 Jan 2019 07:45:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548085517; cv=none; d=google.com; s=arc-20160816; b=TZTJqdkh8i6M7f5AZIpxVKvXJn6JC7u+KIldQTbkDTkwI4Qz/7Sa0V0BmdRxnxttE5 NeF522VPtxHzfv0hNpCJxVwHxZcbfYF6pucCUuI9pEgi4RFeEsatawQKaLg/6f1Hanin OmpXP/CviY7YYIekPe0kCXWd8/+Pr8tGYBrH1KenxS0Egqm7mBXyOD//cgmuHiJYGuEc YeKDlU7sKT6oUORsfavbXsat9MUrTp5HNM1vOBulqVfZqN8JMpGOaTbMTmg9cB193N4V qGXeQ/T4KQIT/A3ySuuRnz/SdCQiON9VCJ5zTQ/Gs5IzVTIvinlXegeSncNSRcp+0juh c2mg== 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=I0ThSuPLgjykz/VCFy6G574PYDL2bP9+ifuEkhcy3CHo8jLypZE9IPo+E+xr8TDIjW Pf8HnX/6yV0KaePiaUkGmfocZ6P55IfJ0SBhm97mUZJUzLMjRVqgDsp1YqAslRZKf9Xg nFNabbEw4Sfj9WtdNeI/878dbD7ujVBj6KYvqTWHObB07r2gFQYsDfHa7I7ung6twO0z dNeHIqMna5UhA3gjfNutwP71h6GAXX1Rn4IUBryfHVpwqeYbYPeoxi+JBCHnurPsYsfA +krioa1dtAxwB0VWqVdgOru61ll3CGwYeFm3mDYmoC+ZZr7ohIB3o/dTRQ36+0SdKN0U qyaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WZrUCGY1; 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 c21si12324578plo.165.2019.01.21.07.45.17; Mon, 21 Jan 2019 07:45:17 -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=WZrUCGY1; 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 S1730373AbfAUPpQ (ORCPT + 15 others); Mon, 21 Jan 2019 10:45:16 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36603 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729813AbfAUPpQ (ORCPT ); Mon, 21 Jan 2019 10:45:16 -0500 Received: by mail-wr1-f65.google.com with SMTP id u4so23931601wrp.3 for ; Mon, 21 Jan 2019 07:45:15 -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=WZrUCGY19DdCA1w3IHmK8oICHtgLdphKhOGUd5vevBnrBwrSzPdnkuBmbMvPX8lyUJ gl2gYp4z2QWp6fpzF4xTqXXp1aWdW4A1icNf4057BL7T6Y0JC6fajhO44w6GvSJzq9kh mo+iF/5MENrCUeILCAUvYs9e1ty9iNJS79FpA= 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=ALnhM7m45StI4ZFIoM1S+G80MnlFazw7K1H0R6eDalWb1MbiIDS9Cw9DcbqTDYYDU4 G69LCno5W8/vhUJ+k9mXe6V768gV1z4buLp5aXgNceuLtqcV75h+ANCxBHUwNwZhnQ6R PaJzW3Q8MpcOxhqb5DsOyyg+HgiYmNvADYpIlPiWkU90b/ZumO8YbC2g0FNhlD7l1640 LL6qrcUpZREodpmMJzm0yPg5OmM6CuwIiitZkQixn1B3zZOfNPNuaWY0dK6Mg71o9Egv aNq9QS8O9OHDyovGBnVVC3NPBpLLwbpVRC1eIdsqSOYHRYqcdBLprgykLMwmxaWQ+xgH APsw== X-Gm-Message-State: AJcUukepNSfZldI51kVcg32wigDvuEGJHAFZphEdRICWvAD2Uj49delk MEkucmUXPFjO1wJ6NonNmcYEvA== X-Received: by 2002:adf:f785:: with SMTP id q5mr28138392wrp.9.1548085514799; Mon, 21 Jan 2019 07:45:14 -0800 (PST) Received: from localhost ([49.248.61.1]) by smtp.gmail.com with ESMTPSA id r12sm105023879wrq.3.2019.01.21.07.45.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Jan 2019 07:45:14 -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 v2 6/9] cpufreq: mediatek: Use auto-registration of thermal cooling device Date: Mon, 21 Jan 2019 21:10:31 +0530 Message-Id: <4253d7a24e9c85ca24cceef599ab8da8682e0bee.1548084260.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/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, };