From patchwork Mon Jan 28 06:41:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156702 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3090586jaa; Sun, 27 Jan 2019 22:46:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN6lRG6Bkhfh9CWbVxUxeFvUgPHWXY+2Ey/Tmywf8n6cL6F63vIQ8Jsfe58ixvXkgoccjKc1 X-Received: by 2002:a63:1f1c:: with SMTP id f28mr18801618pgf.193.1548657992913; Sun, 27 Jan 2019 22:46:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548657992; cv=none; d=google.com; s=arc-20160816; b=ZzEJzli1rLDiv9IfxHn54gj43pnbA3jgSRTLUWC+HAssk2/CAwKciriC+2hD1kjuPt 0OPDkp7M2SjBOxWFqON6NJCY/Y+QHQrKdWB7HP7OsKmmysmvE8HbaUEfdrRjsBlKhteZ ImxJ/syQc5neCCfYdv0nVrK9sRavymgSF1x5Q8YZnJOtXHUynkpwpIp3+u/pE95OcFQo J4ER859WUDyR3vaGORHGu/oEdttQpILhyNyn+oByrtiatRGNj+XX9RKfaDGTfrBRZuq5 eL8F4A/QQhx/M6CYXxJMTQy+OG6A2Qkz9j3U9UL2zjMChQvFIi1+hGlQkyLMY5lUapBt RGPA== 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=H/DyusfQfLSyzdbjqk2USsPgpY6OAq4IlsuK8y40ZJB0zMD4lTEcbvc9v7BF2IY6wA sFbwtj5P0NaB9oJkualMeEo1e3jYPmCIK8gQr8f2bJExofipZEQYnQgz7zhW8TdTh0St jKzy3WkUUPqasalnq4aVDr8LrmykluknMe/q4lp+DXwlUpBaGeoBhwTpjXPY5LLcqtO8 /JTEjG+H1p4od7tzRVP4d7NZFuGlXhV+55M7EFdXS9IHk+nFgMjPSMRMzB/eo3DojHF8 7ToeTuyKujOEJrKKEVtLGaphNtqUDyuomyHJ9AICC8ZFcRkjDWF0jrf+vcFVegbwofnh 5Yxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HUk3Secd; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 o33si32876512pld.121.2019.01.27.22.46.32; Sun, 27 Jan 2019 22:46:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=HUk3Secd; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1726667AbfA1Gqc (ORCPT + 11 others); Mon, 28 Jan 2019 01:46:32 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33303 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726627AbfA1Gqc (ORCPT ); Mon, 28 Jan 2019 01:46:32 -0500 Received: by mail-wr1-f67.google.com with SMTP id p7so16745912wru.0 for ; Sun, 27 Jan 2019 22:46:31 -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=HUk3SecdrvnJ83/Xwlvn4vLndaLEzSF546horDbu3kzayiHpAMhQUxQh8YokSO51GK 7zRXduNluXbueiKMdet2oOnFHJiqcONC2veU8IZoqsZG7m7eRyINj69EzaVuRX15m966 RP07Bw3PXe9tjtUejQGr/ESceHxIkDJ78SA38= 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=Q7JSlNWU+mu3HwQEx3W8vNybEdKeAr4T4doSxgB4XdUzf+2NsCEHFwYPMUPSZEjFTX 705n9c4+N4QUJZovb5al8KjQ1sw/JDsPTI+3zRrEurt1rrb5CmwtZaWF2ZnZT02z0jEJ 9ZOPDrgRrJjCmIWVfhw2xAa6ukDibrT3GCuDX8VdZUZGvppU7MDEfjkl7Koty57YPfWv GMMJk8NQe1386+KwYNSIV04J9POGWeKL+dePt5r/q1uODxhHLa8xJRoVsEFcdLI3495/ 39agiZ7ppFvThp5b+2j329JBnajMZKxyFKw1kCthG6HqJGrBGv2UvTeIGYf0bHhTzCyf 6B9A== X-Gm-Message-State: AHQUAuZQZxJbp7/KOQ630vJS5y7elcvOASjTnPA/ikKYiL/dpVGVmSjx wTNAZj9XttpB8HaInjIyxDLo5Q== X-Received: by 2002:adf:f401:: with SMTP id g1mr15063951wro.103.1548657990362; Sun, 27 Jan 2019 22:46:30 -0800 (PST) Received: from localhost ([49.248.191.44]) by smtp.gmail.com with ESMTPSA id 67sm185539371wra.37.2019.01.27.22.46.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 Jan 2019 22:46:29 -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 Subject: [PATCH v4 8/9] cpufreq: scmi: Use auto-registration of thermal cooling device Date: Mon, 28 Jan 2019 12:11:33 +0530 Message-Id: <81d81c0016fb275728b7b604020c22d8f53991b1.1548654899.git.amit.kucheria@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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) From patchwork Mon Jan 28 06:41:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156703 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3090833jaa; Sun, 27 Jan 2019 22:46:56 -0800 (PST) X-Google-Smtp-Source: ALg8bN69TLcN4GLjZ3bvbcxuL0GZ0cDKOLPyxuTeWdfn0EpYarXfbvbO/0siFUv2j3Ic3d/2jqPF X-Received: by 2002:a17:902:7005:: with SMTP id y5mr20766461plk.7.1548658016121; Sun, 27 Jan 2019 22:46:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548658016; cv=none; d=google.com; s=arc-20160816; b=s9GRzarz8e4VqoyaYLvkPx1pCW20XxQjyB+2r1AlmGMU8bY4H+4Bu9/Up//vLJ2/UU rBvPuTVGXC00WaZOzsuqWF30DA4lYdq8ODDcjvlNe0LBz3wLENuMYAP3vHaNs+6htynn N71w08X6x1o72sK8AGRM3WKdzMgNe7CbOsDV0iUyALjmChbXxWJdm7bllFhRf0AgRjml kmklwrdxiePTE+hevq1cQVm2EGD9yBa6/eSlZBVUFk5jkdvnYCyMxyMpSLpQtWPNQkJ3 x9sGHKjh8Y1fzbud13WjFwYV5abHnSyJshdh7T1jNNGLCX4hJnGISwuT+eA4PGQNO8+C kvSw== 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=lmDIKADatw1oUeQ5UHUMSZddpdBoEMSbYiY1RQRpnEA=; b=U9HhlCmah4j/uzFtg4qZcWQrWJ1QeWqx9Kd/jbqo0NlXbRpJLpeiJ9vKzTE7dQUHLU sRaytt2AUJBcXZcz5x6U74MaKJhcH4E2xoidElUxHbLcNcMAMje5FtSgRDh5YI5MYhBN u/bX2+MgTL3Pv/dNYM7TQ+rekW+VCYJ22XmAQBEF6yOGjywzAmG8K7KwD1uzlBvJ8Jqs FCDaOxHGmQsMdeoeHWjNw3OhARHsl00Kv005gtYJL4Xjf/oA1iaq9vqUgdDK4AvsPqGX UklAGeZHH02XGlCeYFihclW2VSHMwfDBzeom/KKkjr466mBm8vHkYDsjCnMMrZ9Edggg Uz4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ONUvgNzN; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 w12si4494229pfn.212.2019.01.27.22.46.55; Sun, 27 Jan 2019 22:46:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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=ONUvgNzN; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1726661AbfA1Gqz (ORCPT + 11 others); Mon, 28 Jan 2019 01:46:55 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:36202 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726647AbfA1Gqz (ORCPT ); Mon, 28 Jan 2019 01:46:55 -0500 Received: by mail-wm1-f67.google.com with SMTP id p6so12555065wmc.1 for ; Sun, 27 Jan 2019 22:46:53 -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=lmDIKADatw1oUeQ5UHUMSZddpdBoEMSbYiY1RQRpnEA=; b=ONUvgNzNgC8g3iZPKMxdM8Gx1l/rUdqraqCco0IlE7riwGoAF0KYN3xomg9e4bRUbc HrWCxAbbr1zI0fmM5bLxSSgRUC6DF35LLtHeDyu7OFOpNczyaJ+/k/FusKHXx77SZQB7 w/TyXnnGQDgbgQSAPvzpl4DTEkTgxXwYMKnMk= 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=lmDIKADatw1oUeQ5UHUMSZddpdBoEMSbYiY1RQRpnEA=; b=dZQlYbgZeqxB4xdR0odQWMdvT7ZSvd85PkDwe0QvDPx2aPOQUlwdzp2R+Ypjcm6t4H YZxyaqSpZDwlvYEx6sXv/o1FgFMw6+OOZZv7wk5y+8erfaieUREuiNOiC83aWpMplYjA PESTRrtzjoUsB9FMsO8OPQHTWkS/HGgQdblASsKq8+Pcs/Tffcy3utppjiVoI1lE8ZGZ jrMmP1AnoGUyC630ACJd9Mxz9anDCLMQ/0lGeA4hexd2DnP4iTlgN72JIigyGSlCXPdC UacCVCWT7xP6xCv73XV1rc+nnyLTrCZ3pScQyp0WRZUpZCFOvDN4aavkxGvdPhLI+xib GwEg== X-Gm-Message-State: AJcUukcyfcqZIVz/IKvqATpAKHLAnfjrylrhNvvFAGNHY4/Lxw2c973p YX7q8dXNh17SPN1ouAmlEjvgfQ== X-Received: by 2002:a1c:cbcb:: with SMTP id b194mr14651461wmg.64.1548658013127; Sun, 27 Jan 2019 22:46:53 -0800 (PST) Received: from localhost ([49.248.191.44]) by smtp.gmail.com with ESMTPSA id n5sm112413370wrr.94.2019.01.27.22.46.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 Jan 2019 22:46:52 -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 Subject: [PATCH v4 9/9] cpufreq: scpi: Use auto-registration of thermal cooling device Date: Mon, 28 Jan 2019 12:11:34 +0530 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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/scpi-cpufreq.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c index 99449738faa4..82420e8e5f0d 100644 --- a/drivers/cpufreq/scpi-cpufreq.c +++ b/drivers/cpufreq/scpi-cpufreq.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -34,7 +33,6 @@ struct scpi_data { struct clk *clk; struct device *cpu_dev; - struct thermal_cooling_device *cdev; }; static struct scpi_ops *scpi_ops; @@ -186,7 +184,6 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy) { struct scpi_data *priv = policy->driver_data; - cpufreq_cooling_unregister(priv->cdev); clk_put(priv->clk); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); kfree(priv); @@ -195,23 +192,16 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy) return 0; } -static void scpi_cpufreq_ready(struct cpufreq_policy *policy) -{ - struct scpi_data *priv = policy->driver_data; - - priv->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver scpi_cpufreq_driver = { .name = "scpi-cpufreq", .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, .get = scpi_cpufreq_get_rate, .init = scpi_cpufreq_init, .exit = scpi_cpufreq_exit, - .ready = scpi_cpufreq_ready, .target_index = scpi_cpufreq_set_target, };