From patchwork Tue Jan 29 04:55:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156914 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4225425jaa; Mon, 28 Jan 2019 20:57:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN4e8xisFxztGKmxIf6TTz04QUSgyIYS08URC8cV+BQxdKUhUr0O1Sd3K8rJZRxyhBFZEx74 X-Received: by 2002:a17:902:298a:: with SMTP id h10mr24747965plb.312.1548737829162; Mon, 28 Jan 2019 20:57:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548737829; cv=none; d=google.com; s=arc-20160816; b=0Uw6gl5X2iMMeHEYpFMH/HZp6UV3va4AS/9BrvRDg1x4sEWp2JgfqpzjraPAVqfW9e 8jRm4XL19EddRamieUjJOesktC9vL2KSXMu18KZyB28yBbZzc/Ki3xuBNN9gNdyOImGP WKUn5QSHQn13VuzG/LGx8YEDfwDA8IXQaMcDKkimFkzIkhEtzp4iEnLDabuovQCwyV2u i1XvjBN/MUF5F0HLJ5A7DZjYmH+yQpUUGb4IaAcJReLBVRQbC9lyDeQ4aGwT2dbce14+ Zu+gc06WuOzyf02mKyvl6NYMBTWDVs+ZjbWPdg65deRUIKq8jW9fnNlCrNkn9Y6QmY7J pmcg== 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=sZDXlqnH1fj24jYunxEgKg9iTnvnCWnhkKzCRQGaUNw=; b=Z15citnehgCDmx/t4caakMM6HKjow3HvIHbisknzDi4Ny69fc/A64dWYTyHH3YLbns adnUMri4fCa7Iyqsz5ubaXIZx8aPgyoMXQWmlaMa1MM1BHmHKVwWbI3czAFEYmw7yt6M Xbn6yybeQP7SKjkDR0nMkZEqkC8cQ6RzDfNsRg58BJFTp6qYQ8yuUykg67QxyOw+wcxH wlyWiIYJNTbNXiQKhI3ORdOGgpsIDYEvLVH9RvZDtJWsoTyIfnBEg4JDPWyUbKH6EXIU Rp7tEuH5KCr4JrwHUyBReyAlCBVudvdgaoj93+GHwK1kqr+/XcaQLJ9g6Hjg1N++FnWt jFpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="dugmhw/6"; 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 s66si26861696pgs.115.2019.01.28.20.57.08; Mon, 28 Jan 2019 20:57:09 -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="dugmhw/6"; 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 S1727402AbfA2E5F (ORCPT + 11 others); Mon, 28 Jan 2019 23:57:05 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36904 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727227AbfA2E5F (ORCPT ); Mon, 28 Jan 2019 23:57:05 -0500 Received: by mail-wr1-f65.google.com with SMTP id s12so20502255wrt.4 for ; Mon, 28 Jan 2019 20:57:04 -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=sZDXlqnH1fj24jYunxEgKg9iTnvnCWnhkKzCRQGaUNw=; b=dugmhw/6jrlx3hZh1S8+lDNGcaaJeEyKdpTAzYFvj8MdrXX4cbJ3LjAFvmxbXv8uZ8 g9U5qD6kTDf3N4N6p8Hcs7tc3njH1J/2iEOUb0orpv05Rh3NApFy5MlBQ4Ob/0CSEke6 l+D7RrxUcRxzO3v8QXFelqrncmWReP2gkECOI= 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=sZDXlqnH1fj24jYunxEgKg9iTnvnCWnhkKzCRQGaUNw=; b=aPMc+/xugF+Semx4bt6lbuYjF00C9X+yDAfmTOHGCn34T1OO3jpcewmtVLaPIzo20o IdmaRShrhbwTsOuhM2g92PdqUf+YU5F6hvN9h2oFqcOE+BHL35Aku7vGx0yCqdsAqaUM 2O5qXsgKVYD9q1eWH4D2iHHF/d7FSx4vWzUnhDE6pnKZ0O/voaRFdA3dcNzVrmMTVGOa yO4XFRLpcLkjjQI9e1BcPQJKm7lHmGuOdWjx6wc4MOirARslNAo9ikvf6MdBGsYmvT8H RMYw3IsR7nmcM7/q210+CDIsaLXfmT3qtOL8FQc1efee2TFJfy38SME3YYf2XPKbHhVk 76vA== X-Gm-Message-State: AJcUukcgthXW9tUsxVqnSzgWLvN7a43Wr4S6oR4wCZxM4BWjAWXx/6Hs gI+aFREx9Z60exBhAgiTb5k4TA== X-Received: by 2002:adf:db01:: with SMTP id s1mr23650280wri.214.1548737823567; Mon, 28 Jan 2019 20:57:03 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id 127sm2512264wmm.45.2019.01.28.20.57.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:57:03 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Sudeep Holla , linux-pm@vger.kernel.org Subject: [PATCH v5 2/9] cpufreq: Auto-register the driver as a thermal cooling device if asked Date: Tue, 29 Jan 2019 10:25:08 +0530 Message-Id: <6077cb33d7e078bb0e85776bad99fdb476f16d0c.1548737236.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 All cpufreq drivers do similar things to register as a cooling device. Provide a cpufreq driver flag so drivers can just ask the cpufreq core to register the cooling device on their behalf. This allows us to get rid of duplicated code in the drivers. In order to allow this, we add a struct thermal_cooling_device pointer to struct cpufreq_policy so that drivers don't need to store it in a private data structure. Suggested-by: Stephen Boyd Suggested-by: Viresh Kumar Signed-off-by: Amit Kucheria Reviewed-by: Matthias Kaehlcke Tested-by: Matthias Kaehlcke Acked-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 13 +++++++++++++ include/linux/cpufreq.h | 9 +++++++++ 2 files changed, 22 insertions(+) -- 2.17.1 diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index e35a886e00bc..0f9b50d3ee91 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -1318,6 +1319,11 @@ static int cpufreq_online(unsigned int cpu) if (cpufreq_driver->ready) cpufreq_driver->ready(policy); +#if IS_ENABLED(CONFIG_CPU_THERMAL) + if (cpufreq_driver->flags & CPUFREQ_IS_COOLING_DEV) + policy->cdev = of_cpufreq_cooling_register(policy); +#endif + pr_debug("initialization complete\n"); return 0; @@ -1405,6 +1411,13 @@ static int cpufreq_offline(unsigned int cpu) goto unlock; } +#if IS_ENABLED(CONFIG_CPU_THERMAL) + if (cpufreq_driver->flags & CPUFREQ_IS_COOLING_DEV) { + cpufreq_cooling_unregister(policy->cdev); + policy->cdev = NULL; + } +#endif + if (cpufreq_driver->stop_cpu) cpufreq_driver->stop_cpu(policy); diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index bd7fbd6a4478..6078eb07a7e4 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -151,6 +151,9 @@ struct cpufreq_policy { /* For cpufreq driver's internal use */ void *driver_data; + + /* Pointer to the cooling device if used for thermal mitigation */ + struct thermal_cooling_device *cdev; }; /* Only for ACPI */ @@ -386,6 +389,12 @@ struct cpufreq_driver { */ #define CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING BIT(6) +/* + * Set by drivers that want the core to automatically register the cpufreq + * driver as a thermal cooling device. + */ +#define CPUFREQ_IS_COOLING_DEV BIT(7) + int cpufreq_register_driver(struct cpufreq_driver *driver_data); int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); From patchwork Tue Jan 29 04:55:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156915 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4225633jaa; Mon, 28 Jan 2019 20:57:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN7jxMdnVDNj+1/JI/jGZVTmLpXNq67DfIfTxp3Tsd7KNNLTmfaUVHZ8m9QoxoEhKyFrS9ag X-Received: by 2002:a17:902:f20b:: with SMTP id gn11mr23563356plb.274.1548737848016; Mon, 28 Jan 2019 20:57:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548737848; cv=none; d=google.com; s=arc-20160816; b=Y7gsQDScbMALDUi4lozyKP+yjKgTAiKHiXNRx3naK3JdfZ7cP7Qo0vzEqLqtXAB++s fAmeYXkYGKnVUNfuWoRRoXtundVC1OtJ43qLTb81f/HlnATho+gP7e2gYIoqGqSJqHH9 ijsa6ar1RWI9cBguGzxy+30OTpqfAup5S3+fzGbmKz+6gEGLAJi8KOtl66Tc7kechsjP XW2zncsK0tCQQ3i0+fP0j2gA4cufIM/xm6bxgLqXHgi6+JRmh6WIjeduHeVc+DNRAUQX 8oWpLTG108+WMUxyrOnPejiFlTHV+TqleIgCrtBJ7UoLue3svqgveCYo+GQmSkqDQwQW WDSA== 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=f/AzGAh3ZudvUYw4T0qqJvy1cHtwmw9luwK7hINpsNI=; b=VyfMLlT4ccNmAc50bQKuGRM2oJAtt3jiccxxIGMTQE3xEw93DITJSh2GUU+qYLmwEE 4WFUGL2cTgUNHEN4FSTtsiEJuR4Blr6adooGu2VLjqcpiHD2IyueCTdb4qvXyK+q/ByR ha2zqvhOSRjqpRUUC1NrNTFJ9JA9ir89nu4goJFuOzcJYwQxw1xc+TaLLp1FH7XH7kmH 1AtscRPQQp9gLWf7TCIl9HvdnEL3hkxXMCpBTvlZ+XF85nYfUF9rbwcQZjUtU4jOaay8 kf2EMpqoc+Rqe3ejuM/H8mb5rJa3+D3HvTuokawg4xCihuF9zyXe30EDQwE3WlHgeXOp 4sHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YguGZwjm; 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 h75si13936637pfj.257.2019.01.28.20.57.27; Mon, 28 Jan 2019 20:57:28 -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=YguGZwjm; 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 S1727209AbfA2E51 (ORCPT + 11 others); Mon, 28 Jan 2019 23:57:27 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45402 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727162AbfA2E51 (ORCPT ); Mon, 28 Jan 2019 23:57:27 -0500 Received: by mail-wr1-f65.google.com with SMTP id t6so20471433wrr.12 for ; Mon, 28 Jan 2019 20:57: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=f/AzGAh3ZudvUYw4T0qqJvy1cHtwmw9luwK7hINpsNI=; b=YguGZwjmRGHbzKSRsmz+oxth3OP8Qd3nJF/HVLk4nVKRcrKFEYdezDxHQMpUfXuRa9 j9iZqlDxOSeG6nID3/KRGoDONxmOAulOC7XdDc0nlmWQUB8g30riWyYGhMjgHjDRYcQH NoMGNYgpLT8U7A2rgTIqs8aQQH/OIKQJrl2WU= 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=f/AzGAh3ZudvUYw4T0qqJvy1cHtwmw9luwK7hINpsNI=; b=BFkx5h/3pxXv3IRdP9+nDybAQlUwbBumZ2P+kHMgzQEqmKzC88pKiMXWYpi9DwEuXd FlsF0ucctjr/S29BAjwNMQvKmkafrBjBw1H/36mU7rR22MKXhqhX18a+vRduHeUG9iD9 8Gd3v0PEE3suhThziO5akCUngRoowhcUJeoKVvUr3X5thvuUMvqaEFcfxmsETDWMQYNp XVSlbgqbIv6URl3iizSAJOirFvEZsF3QLHZ6s02fYqC4Zu/pIXCx2hbFDG0r5pcYALuL nHG4ygAkZDv/XtkT1J71zHJXzQ2I6+iRo7tlPl1VrN02geyp53ULDht4DaXrcMBIcndx 7DRg== X-Gm-Message-State: AJcUukdYvzoLYvUoUQaoef99/TsRDQjukJbPtpQD1pU2Fxi7b2ctrQwO E4nwjkgDMNA8NF1af0B/ettqQw== X-Received: by 2002:adf:9d08:: with SMTP id k8mr25652098wre.203.1548737845146; Mon, 28 Jan 2019 20:57:25 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id i13sm96485915wrw.32.2019.01.28.20.57.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:57:24 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Stephen Boyd , Daniel Lezcano , Taniya Das , linux-pm@vger.kernel.org Subject: [PATCH v5 3/9] cpufreq: qcom-hw: Register as a cpufreq cooling device Date: Tue, 29 Jan 2019 10:25:09 +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 Add the CPUFREQ_IS_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 Acked-by: Viresh Kumar Reviewed-by: Daniel Lezcano --- 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..c88b51304d89 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_IS_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .target_index = qcom_cpufreq_hw_target_index, .get = qcom_cpufreq_hw_get, From patchwork Tue Jan 29 04:55:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156916 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4225902jaa; Mon, 28 Jan 2019 20:57:54 -0800 (PST) X-Google-Smtp-Source: ALg8bN6o9bwN2g1GcIFi9vwy3Yst5DUNfPwywnw6I+32wclzldrlzAbbyknAETc5jCn+IU0T1TUe X-Received: by 2002:a62:18ce:: with SMTP id 197mr25478776pfy.88.1548737874281; Mon, 28 Jan 2019 20:57:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548737874; cv=none; d=google.com; s=arc-20160816; b=jjrjYC782rwhOhzl0hmyCxChtgTWZ9c0t3E6Ts8US4rGir+A3hepNztNZYgkfRQBOu TdRpXw+rpTXruBC6m+21GPO82VXCfAd1VkVJY+LNJf4DpA0y3GCn8JU2dmM2pDK1Gbvu AW/AcRtbRDgZKkSnztuVwD/7i9pMVmmAdTaAVCsEEg2ZtTtDuOCjhOuftEqygSceLWuC P4BZGIpOaym/uVIi6esFfYs4UHTokGG4olm5BhEUClecuphYxlgls9jOzRAOShk7xVj7 +tTFfkyrtIVKrRo4fwGkWPIWwXs+253msM0h/E+EOo7WbqFg4wrub5ROaB97+oqNplf7 gMHw== 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=ApaWmXxCOUpMHFzKH4UJpFJJLIlZacYoSUov6fCItbE=; b=ospRw+9I52J3hBxoFsVxrRfPSxIV+9F7S6pu6F0fJYOJ3HPcqP276RmoK9Bf7Lfp2K MFMXkwYs7sJ3RVCdBl4IwWNVOgmAry+JmttKQ/OAywgrBNz7MwSvKjv45ULGrjDgM4Hv QJ94m6p+7F81CyVrx/zVd026jp4sDvDwmKsNj7KITdh7TIJhcWYXfpuulrv/bwGl4/hA hA9T1OfqDtkWrOoMxINdTVwtKtnxC/qXDEWkoxt85PXYjutZzBUR4KGnhOpBAYuUMFoC y09s0WIZYH/4CUrjAv/oIEF2aANvKue2ZBhBRwi3k5zE/So/w9FDfAZVuxdVtbwinOOx z3MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Pi8oySiw; 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 w189si33117008pfb.151.2019.01.28.20.57.54; Mon, 28 Jan 2019 20:57:54 -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=Pi8oySiw; 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 S1727082AbfA2E5x (ORCPT + 11 others); Mon, 28 Jan 2019 23:57:53 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36888 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727033AbfA2E5x (ORCPT ); Mon, 28 Jan 2019 23:57:53 -0500 Received: by mail-wm1-f66.google.com with SMTP id g67so16220478wmd.2 for ; Mon, 28 Jan 2019 20:57:52 -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=ApaWmXxCOUpMHFzKH4UJpFJJLIlZacYoSUov6fCItbE=; b=Pi8oySiwrxSw+U2E/uf7rNEBCB48Zun38AmHkp+cirwAt/dohdRzgc2BhyS+p8yyOb PoaOQrBBqTAzY7ZKxwJbxOKYk603CH4+hi3q3pWpX0qhltsPaQab3qt6VNF3jT2Y9g7J X9WDPQigzIF6bmN+2tdKdqf01L5K+Rou/RbqY= 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=ApaWmXxCOUpMHFzKH4UJpFJJLIlZacYoSUov6fCItbE=; b=FRe9CQrtcL1/kg7y6Dg8eVp/mIA9QsK2blowRwdTxD038ruVFxnFiUP9SZZU7sFGjk mvL1CbBDVzzJJEcTVKQQfBasOJbn0oVqmPzi9FOWgbQ9N733cWtZDp2p4hOZoXcsEfgG cv1kQMtw3XmB1bGGGvankGOh2CLL+dYJdx8P7R/aq0VNIO+sF/uQUFt/8owvtQBZSr2B p+bHwi/FwU5KMTXIw6iT+6qPedRa93dQTR7PqwgDCB/RddCnNsvVJmAwgnjDg1EABaSE TNRgaVM6JtLUQ+OzLoUHB4V0o1lqTTtpZwIdJi78QoAVIjRYcg8NzFYB3TiPM1iOdJIy 3PRw== X-Gm-Message-State: AJcUukdQ9Pe02pFPfT9/q+kAnjVpqf7EAaWLW7DBBVtMP+YIj22H7C0P efI3Ww/uuyERwY3kQ+3Wy3dx3g== X-Received: by 2002:a1c:6657:: with SMTP id a84mr18288519wmc.23.1548737871433; Mon, 28 Jan 2019 20:57:51 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id p10sm3929437wmd.14.2019.01.28.20.57.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:57:50 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Anson Huang , Bastian Stender , Fabio Estevam , linux-pm@vger.kernel.org Subject: [PATCH v5 4/9] cpufreq: imx6q: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:10 +0530 Message-Id: <37b9d8c8b580152246d988629ab52f58314f698c.1548737236.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_IS_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: Viresh Kumar Reviewed-by: Daniel Lezcano --- 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..ca955713e070 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_IS_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 Tue Jan 29 04:55:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156917 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4226012jaa; Mon, 28 Jan 2019 20:58:05 -0800 (PST) X-Google-Smtp-Source: ALg8bN4X6mH6Q4avkCH3sp1DEEMDiIzRsIpOTzXRQu97SjiY66+afm2Q0aFxxD8D7XxYj8kd65tT X-Received: by 2002:a63:5455:: with SMTP id e21mr22569373pgm.316.1548737885404; Mon, 28 Jan 2019 20:58:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548737885; cv=none; d=google.com; s=arc-20160816; b=sJ2jCIBkq+OFP+0B5qA4H1dxYWx7KfXRaRxXcVxhq+9/K+poI8+ZGtI1MsOMRtWRc4 Zo+Y8b9bNNuPdbTCF7eDmzWMooW7CO6bhQdjjyqSKEtBgVUB3viJn0CRpJbhI6GnXV0E cmza2wXqGRdv1oWK3ykCDPrKXHQYPjL0/prLINfPq4v5l1pJEIwBwykJDvS5aFuH5hIR 1zQ841QlwyJHY0O6mYwqBtQEV2k3BnVmajwXLb764WE05jGM+u+ejFL78TOUFXIPdVsv chu13gid/35/I2B0RrP6ZlRlbMz0FgUI3kGK6z9xcEPcDZiTaM6Eo8JRYUv9s+qMpVna Ta4Q== 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=q8zOwinb++dSY+a36ZLUxsOKoJRTDJm8Q+law10TDMs=; b=GS/qbaU5RNGF01JRqhvuORXk5b2xfzD01TuzSLbsj9KgLZhGQQUbHZNPopUJC3YbcG UY8zAqZ1m4+/ZmIs2xyMo2UkpojlShyaRhhp156VOWcuWdAYt1ixULc80dmN+NK/Qfm8 ktNsU+rZCc4IHO1IeQ6SWwVdwQk6dBCJOiEU4F+HmhLytStP4UlqWNegv3HnDmbtWmEL iO/YJkBoDr6MeHKPNpFf2QnW4hfHi2ElWp02DECSLpLOnF26h75jqd13gdGkOweG/3Bk eyzTeI2YCn7VNrQKqYZtubPnN+jIUS9Y0F6Vh0zIBN12W7zCmN3QhS1v8DjZDNCXYgoe OKwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z4HVrEsA; 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 w189si33117008pfb.151.2019.01.28.20.58.05; Mon, 28 Jan 2019 20:58:05 -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=Z4HVrEsA; 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 S1727402AbfA2E6E (ORCPT + 11 others); Mon, 28 Jan 2019 23:58:04 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:34296 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727048AbfA2E6E (ORCPT ); Mon, 28 Jan 2019 23:58:04 -0500 Received: by mail-wr1-f65.google.com with SMTP id f7so20598394wrp.1 for ; Mon, 28 Jan 2019 20:58:03 -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=q8zOwinb++dSY+a36ZLUxsOKoJRTDJm8Q+law10TDMs=; b=Z4HVrEsAJLZwLCWLjwhKeac6DiTO3NK15Ix6mCv8oaCWUMqLMOPX2ZXQSk/3MDXU/u d8EWT5UF9OUqAhBjgE6W91S+07pVgTlOWUd+OWeTF70aEEw1vdPTSVlLj/xdV1KOGPCm T+irIqzFGTBp4Rrz4A/n7Ko2BZDE0cvfWCLQo= 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=q8zOwinb++dSY+a36ZLUxsOKoJRTDJm8Q+law10TDMs=; b=Awox0JMTGzdjsUb4fMirNXPTTdIKRLv22/yZqtRAQ6zhqIa+vv52f1AcOWxjz7wRsO HMsQcQmpxhGVAOlXf1yP9aCseroLHBonfaS1JBYaK3f7WyMKDlTf1MvLX3R/8qbdWQWi Lc/8BPXSg/uBy2QRqXeKB0h2Y4vv3jF0SXO6EP1Gqc4KeK6W+lRbdcsSwcZ02uerzAr3 KEB/7ll1GjjwN1y+FvmB2FuVbbinGQ4H/nLPnppqFAX+a2PrILjYZNhxH2okkcoYNVuO dYkraOWFF8ChTYaifoSFluhkdKCs0wFVKGhFkEftdHY2Bkuwd2i5oLQAYkMmn9whXjgp 4iig== X-Gm-Message-State: AJcUukffBs2DZqAJ1Pl5iEc0LyzGXxt+twBGxcGca6m+QehXhiQoEPcl uT52sR0fNLQ0ns1NJ8CX3IlomQ== X-Received: by 2002:a5d:50c5:: with SMTP id f5mr23276547wrt.37.1548737882650; Mon, 28 Jan 2019 20:58:02 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id n6sm1320957wmk.9.2019.01.28.20.58.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:58:02 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Daniel Lezcano , linux-pm@vger.kernel.org Subject: [PATCH v5 5/9] cpufreq: cpufreq-dt: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:11 +0530 Message-Id: <4e19a2d9c5d929cdd87a984953c880c1e5a2e057.1548737236.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_IS_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: Viresh Kumar Reviewed-by: Daniel Lezcano --- drivers/cpufreq/cpufreq-dt.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index e58bfcb1169e..7ba392911cd0 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -13,7 +13,6 @@ #include #include -#include #include #include #include @@ -30,7 +29,6 @@ struct private_data { struct opp_table *opp_table; struct device *cpu_dev; - struct thermal_cooling_device *cdev; const char *reg_name; bool have_static_opps; }; @@ -301,7 +299,6 @@ static int cpufreq_exit(struct cpufreq_policy *policy) { struct private_data *priv = policy->driver_data; - cpufreq_cooling_unregister(priv->cdev); dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); if (priv->have_static_opps) dev_pm_opp_of_cpumask_remove_table(policy->related_cpus); @@ -314,21 +311,14 @@ static int cpufreq_exit(struct cpufreq_policy *policy) return 0; } -static void cpufreq_ready(struct cpufreq_policy *policy) -{ - struct private_data *priv = policy->driver_data; - - priv->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver dt_cpufreq_driver = { - .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK, + .flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK | + CPUFREQ_IS_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, .target_index = set_target, .get = cpufreq_generic_get, .init = cpufreq_init, .exit = cpufreq_exit, - .ready = cpufreq_ready, .name = "cpufreq-dt", .attr = cpufreq_dt_attr, .suspend = cpufreq_generic_suspend, From patchwork Tue Jan 29 04:55:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156919 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4226260jaa; Mon, 28 Jan 2019 20:58:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN4+dtPNH0pFQHMJv5xQpVQP9z/rbrp1jKv9alRdP265jRHQTIFHZ40zJnsvZQDgVxdUGWqx X-Received: by 2002:a65:47ca:: with SMTP id f10mr16123432pgs.166.1548737907554; Mon, 28 Jan 2019 20:58:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548737907; cv=none; d=google.com; s=arc-20160816; b=mnT6On74ABM1v2v6QL6Lvhgp8XY9MnG+HRsVIKWgwcmOvl7bl3NHJX6/63vbX9xCky CMkLJV2gaUCQV5y8FsG62zi+erv7E/KDoWUgSLgSp9aROGjXEm/RevmTA2jlhR/sVO6F U0nn5+NLWRn9FE77EBBzC2Uf0ZwYBbxUw74aKWhLPw2N65P2rTXYoMNJ927vtV+iiy63 y+SafT0eQ3VV7z/BSKIYtFykLT3bxCo8lLU3wEZ0SYvFEjQNWNNBmyaLDdIlPssvPyAh IAcTQGnzeM4aw+XmfuQcfEbpUoIJ6AneTQzGkYUJsxEyjqZEC1YB9Ps6gGwsfsBXOPAJ LbiQ== 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=l5jEfutaw0gwpPVDHGUPHj5GB9c2BDmfuxGAmeH9M7o=; b=UWgCbvnl4k0hA7qWs82Sc7uIr/vuhYrpIjv5gQv4On6FN8naVBB4Gr/TqYAYiVQ3v9 f4D6Q6f2WiRCl+bvii/oyYEef91wkWPNnwno5dlnwlSoUKywKMPYJA0VV2RAarTwt50k ngK1V0tSKLOrvpXzB0SG1V3metcq96IZr0QaMPD92eVl+yC2cpC9wPR7waWK32RG22fP unHSRZDaD3xJODtzeaEN/w4J0qWyT+bSxA76/Mcdbd4+4M8W+dCRVjcj9bx4Zgc87zkV ikhdE3zMSVUzlPn6Ac4ODtuCOwaTidv0fTC86+h0rW5vr0B/toSwQDNLTclnHAFKSnJw oLsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dQXJLEAi; 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 h16si3552949pgj.203.2019.01.28.20.58.27; Mon, 28 Jan 2019 20:58:27 -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=dQXJLEAi; 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 S1727253AbfA2E60 (ORCPT + 11 others); Mon, 28 Jan 2019 23:58:26 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33914 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727276AbfA2E60 (ORCPT ); Mon, 28 Jan 2019 23:58:26 -0500 Received: by mail-wm1-f65.google.com with SMTP id y185so12022827wmd.1 for ; Mon, 28 Jan 2019 20:58: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=l5jEfutaw0gwpPVDHGUPHj5GB9c2BDmfuxGAmeH9M7o=; b=dQXJLEAixZwDW8vnfsMujaz38Qi7FLMZzL8bgTPloe3dBBSIUcTbx42U1Iv/a9UhAO pfoo7bikilHw9yjxNLQpLVnSusJkqlaGiuapK19uUyJ5oEUuSgj3MkihYfY4xspaNMsR xdgJRQvr+8agBrmQWAaPOtY5uaua6LxsenkTc= 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=l5jEfutaw0gwpPVDHGUPHj5GB9c2BDmfuxGAmeH9M7o=; b=AzIuRupd+xnL6snsJYglYkrGSahRRM7F+iqk5CvfIvlj6sRFzIIvvySl3TD4FdHBa+ hMTm2vqdPgPYn7MgS9Kutx5/+ee2AnbLRCf/gVNjeLJ2S8yg+HTqO2O5gldQZc7Mi3m9 Hq9lTQUsiLQDEbTxOVtzUOhLV+dxqg3unJ7Fk4oQZlVRW9734kdSLTi7nzPQfiq1tqRe PHsanck0HaUIK9jVWaRPuXjLe4Xahmguv2niv/uR1J+SG3p+9xAKUlTr9z3feB36L+Iu kvwmbMD0yKIKTrKretbrmYul7SHKhMfJi8wyV8SHEwAZbZIzeCsxlHlTh/YT0spoWdr4 LZpQ== X-Gm-Message-State: AJcUukfMEbcTxKl1KGZEAskpxYt/tsd5NWNLRbFp8i95tviR3Ga6P9CS +N2Y31fcYcY+FwLfDHzasb7how== X-Received: by 2002:a1c:f518:: with SMTP id t24mr4101747wmh.26.1548737904717; Mon, 28 Jan 2019 20:58:24 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id n127sm1727856wmd.20.2019.01.28.20.58.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:58:23 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: "Rafael J. Wysocki" , Viresh Kumar , Daniel Lezcano , Markus Elfring , linux-pm@vger.kernel.org Subject: [PATCH v5 7/9] cpufreq: qoriq: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:13 +0530 Message-Id: <3c0f9702f2d68f684b16c4ab5dbb3222d64127e7.1548737236.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_IS_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: Viresh Kumar Reviewed-by: Daniel Lezcano --- drivers/cpufreq/qoriq-cpufreq.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) -- 2.17.1 diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c index 3d773f64b4df..4295e5476264 100644 --- a/drivers/cpufreq/qoriq-cpufreq.c +++ b/drivers/cpufreq/qoriq-cpufreq.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -31,7 +30,6 @@ struct cpu_data { struct clk **pclk; struct cpufreq_frequency_table *table; - struct thermal_cooling_device *cdev; }; /* @@ -239,7 +237,6 @@ static int qoriq_cpufreq_cpu_exit(struct cpufreq_policy *policy) { struct cpu_data *data = policy->driver_data; - cpufreq_cooling_unregister(data->cdev); kfree(data->pclk); kfree(data->table); kfree(data); @@ -258,23 +255,15 @@ static int qoriq_cpufreq_target(struct cpufreq_policy *policy, return clk_set_parent(policy->clk, parent); } - -static void qoriq_cpufreq_ready(struct cpufreq_policy *policy) -{ - struct cpu_data *cpud = policy->driver_data; - - cpud->cdev = of_cpufreq_cooling_register(policy); -} - static struct cpufreq_driver qoriq_cpufreq_driver = { .name = "qoriq_cpufreq", - .flags = CPUFREQ_CONST_LOOPS, + .flags = CPUFREQ_CONST_LOOPS | + CPUFREQ_IS_COOLING_DEV, .init = qoriq_cpufreq_cpu_init, .exit = qoriq_cpufreq_cpu_exit, .verify = cpufreq_generic_frequency_table_verify, .target_index = qoriq_cpufreq_target, .get = cpufreq_generic_get, - .ready = qoriq_cpufreq_ready, .attr = cpufreq_generic_attr, }; From patchwork Tue Jan 29 04:55:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156920 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4226474jaa; Mon, 28 Jan 2019 20:58:49 -0800 (PST) X-Google-Smtp-Source: ALg8bN41DtGfdQhxM2ggY8om9/JSxmHsUKBXOfWP1x9nJzTSIxQcstBrZ0W1XDHOXpH3StuMUqTN X-Received: by 2002:a17:902:4601:: with SMTP id o1mr24568369pld.243.1548737929431; Mon, 28 Jan 2019 20:58:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548737929; cv=none; d=google.com; s=arc-20160816; b=E5luchb5Xrh2kcx7uE/Am/thKMd2qD4f+PE8QS/3Pb2eWIT0/5HOHS+GnvLPblTvvE HnBgXq7ZeDaVwV8za7h0Nav+uUGcqYLr6Rw0pkxr/CZTeGps9uwULeWFsoZeyzF+Zz5Z 5scQKi5wCGak5d47E52VnyeN2PR+E0JfyZzTCyPRkeSUtwJGT6VWMcixegCvojQgHvAw mTDzyrTzABZDCd5euI3pd4uymIm7rYz+BjA8oGKVMLgNC7l78YzsgS4syGN+WySnEjsJ pWEcNPlfvs/bUs/pe0vCIyuGq4G9oCJQwMTxo57297H4bnlvVi5bBSKp97nOp83a8w3S +BAg== 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=q0Sq1ojzps17WKcX9i43B6VWlGzaqFa3Y99XQ3cE3s0=; b=ujhuTb6WB3eVATLBcOJwTzokYmCtJSH4xLTMtJ/8/72dHKFKsgJVdw7PeNEJ03Kkl5 /90jiY5izZj7ncuPrTYPmkELj0lQ9UA3s5L7UihRmKSLb+tg1G2CDQHJ2NCwJQTqQGwu 2Zz7V3SbFAzjz+HE3md9h1M+WGNzTsXooGLaimwDX5KfHZCP0g5SCROttDR20iofYR4v 9TCfpp+ofeAW5kDgaeV9foAFgSr4erBwa8MLHrrK7LhFu6zrLXzpgb86FPtAXDPTJDYM /zkaQ6S7ARgeQdoOKC0+9bCrDI6LpwIXwioOU2CoMvqltP5PkC5dYPilT7IaHbqVuFqu DwFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SKkw+bx9; 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 h191si28452992pgc.302.2019.01.28.20.58.49; Mon, 28 Jan 2019 20:58:49 -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=SKkw+bx9; 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 S1727283AbfA2E6s (ORCPT + 11 others); Mon, 28 Jan 2019 23:58:48 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:33944 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727209AbfA2E6s (ORCPT ); Mon, 28 Jan 2019 23:58:48 -0500 Received: by mail-wm1-f65.google.com with SMTP id y185so12023290wmd.1 for ; Mon, 28 Jan 2019 20:58:47 -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=q0Sq1ojzps17WKcX9i43B6VWlGzaqFa3Y99XQ3cE3s0=; b=SKkw+bx9M7a1C7KFz6NtETyB1HBgVDEedtQCAyZlJS20Esw+cYWkadE9BRpxg7FN9v fSTti4bcAemIotQ72wCEHy/4Ibs01qFlFne/uFQ0/dWsQ3O4hVXI40wKT9tQNZu7s0Q9 KZKZeWQZxlWlQ/LA/VRqGQ5c2PSEfdY4+SLDQ= 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=q0Sq1ojzps17WKcX9i43B6VWlGzaqFa3Y99XQ3cE3s0=; b=HX3leC7GfNkFR/AkFN2+t1EyfA4VMEJ3pryfCDPyfpdEDSlLPvFg354VRQgmTVmFKc R5AP0EL3WBinqURMoopJHV1qbwc8hKdzBtKAqenhcxjytublbEgHiotx4tz8EoteZMmY Rjc60yNYVmKtMJt7UJm9HaeG1D4CKPFL/6n229PKPxX1qS4LgtcBnYOvVFmBjwJ+W0mU wfqfkttfy2AOJvHBajK4XHWT0wAQDsy+j08BLvrSqKWTin8QFCqIVgRi5+F/mzX9aCy1 mNNwU2vFCfYYsj2ipR75Ik4ce/SYbHsq0BHaeBuP1CoDf1FAfpy2Lk3wfgNX1BjuBIlw I2cA== X-Gm-Message-State: AJcUukdvXrpLQJzkIA4lt3h/x8pFtGKWquV3XeUgXTmtmw5vm+r3cqSm meSNotoTK6mJB1pCp36JiX+7SxtQSTE= X-Received: by 2002:a1c:2314:: with SMTP id j20mr19221835wmj.142.1548737926560; Mon, 28 Jan 2019 20:58:46 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id 125sm1908131wmm.26.2019.01.28.20.58.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:58:46 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , "Rafael J. Wysocki" , Viresh Kumar , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v5 8/9] cpufreq: scmi: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:14 +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_IS_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 Acked-by: Viresh Kumar Reviewed-by: Daniel Lezcano --- 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..66b633b48eb1 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_IS_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 Tue Jan 29 04:55:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kucheria X-Patchwork-Id: 156921 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp4226699jaa; Mon, 28 Jan 2019 20:59:11 -0800 (PST) X-Google-Smtp-Source: ALg8bN6H1/TEqsQI2tD/R/HmFFL+So4q2Rnfrfd29EXaBGtbyMlRmaNtRxoJn3Ob6/KgVrnvwRfQ X-Received: by 2002:a63:d301:: with SMTP id b1mr21470650pgg.61.1548737951586; Mon, 28 Jan 2019 20:59:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548737951; cv=none; d=google.com; s=arc-20160816; b=Gve+GUxCgvyiTP6s8feh4xA3cbJ6yWzhylIQLwn33dqLzAfwkB2z1K9cOjn+F0pBkW n8O464AgtZE64isP8MliH03AH4Kl5SzeT16PRxlEHcifLLuZp7Gh8P8053LSJXRip3Gs 1lKXlmlCsssQokaqk8RQCuWX4x4yvAiK1YrnPAL0e/bWMMQxWdkowA2jNo+EX31DWex0 arTKSoP0Rh62T6El/gE6O7xbIsZ7ITNtRykA108Id6YIy21ox8X6fKJKtUOWFeNHeyfY RnQoPz+jygH0hc3+G8Y+pnBQXMqdV0I87b9E/iRZGL27eaYaIzFYcRgHIU1COS0XYHOt Xe4Q== 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=vcvqDibFD4J+UsvLzl4IPLt3+45i56JFsvwQyIv7Ies=; b=sWb4GffJDbw/ovawhfSPECB9moJsntDzps+fUVyUIyZus0ONWtcw2BOwlC4iDm8kBD njhjcQCs34ebE3rv4xzx4kFWUwbgTeicPEcTbD8l/baV341gFlS5q/5ha2dBykZESZja jSm59NvfSyHZvADzJRiAiQNIJb9ps1decvWCXoeZZEYlaSX2bTqqf6NtgqROqTAvX+jC /S2fAfqQuHStE+oHzZnbQxRaxpF0TLQMDfvxsoXaQnaeIr+f0B7G0Zdlll8Blbuw4KD0 Ya2hp7Gun0LrZDY2032bhiBTwDvYe/WCpmQcyAS8wNsA04++uNib8iOZl8Hhj8c8zoBg Vmiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OIQOgBgI; 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 h191si28452992pgc.302.2019.01.28.20.59.11; Mon, 28 Jan 2019 20:59:11 -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=OIQOgBgI; 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 S1727090AbfA2E7K (ORCPT + 11 others); Mon, 28 Jan 2019 23:59:10 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:54616 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727070AbfA2E7K (ORCPT ); Mon, 28 Jan 2019 23:59:10 -0500 Received: by mail-wm1-f68.google.com with SMTP id a62so16328738wmh.4 for ; Mon, 28 Jan 2019 20:59:08 -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=vcvqDibFD4J+UsvLzl4IPLt3+45i56JFsvwQyIv7Ies=; b=OIQOgBgIYGQMD5MsHLsxxua0J6GIoPteH87r+Nqm3iXi33wmq5/SA3xu6C8XWZeUE8 5BEPB+ixLyvmyN1VSzTniLJcAQ+MjLrbckzu2gqa6qKrt5+DdT5GzOYGwqFuuE/b8D9+ 9tSK6SeE3Z0bHjhe2bBP4bRqYLweIzNozPMnM= 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=vcvqDibFD4J+UsvLzl4IPLt3+45i56JFsvwQyIv7Ies=; b=F94Yf68Y9506mga6qhgUCe2UD+cbNyucrxIWhfX2oTZXHmtV6sQL1nf+sGIy2Qb4no FqK6hCbJ4AHI6eFHFPR9ibgJjU7eHUsw0TlituIhQ/YKkLAV2Um45CkyZ4c7DYlvcads Y4Han3VSe6G69I/h0RD4l6/a1TJAwYSzYagL4GG6wmMU+E+MmCMSxcrGoaCq+WbPoqrp zElMjUq5DFKxlis0Vfodw2Y8WMFGvqwHBlp1eoH4YLULg+VUF1DjuI/LX13ua8XrHmkO mz0N4gfpnqHJe5kZKlBeyJ13Vq+Ykrm1n6onfaG53mPhdmls6pU4QBJHfupteJ53XofA VSSg== X-Gm-Message-State: AJcUukci/amGx9rI+BVER7Gq678QioOGqO/TLmGL+UtOtWx+Ym+xq+Ls gshHQo+gHyGVgICTd7eQSXEEHQ== X-Received: by 2002:a1c:7dd6:: with SMTP id y205mr7116773wmc.121.1548737948077; Mon, 28 Jan 2019 20:59:08 -0800 (PST) Received: from localhost ([49.248.171.30]) by smtp.gmail.com with ESMTPSA id n127sm1733195wmd.20.2019.01.28.20.59.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 20:59:07 -0800 (PST) From: Amit Kucheria To: linux-kernel@vger.kernel.org Cc: Sudeep Holla , "Rafael J. Wysocki" , Viresh Kumar , Daniel Lezcano , linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v5 9/9] cpufreq: scpi: Use auto-registration of thermal cooling device Date: Tue, 29 Jan 2019 10:25:15 +0530 Message-Id: <082a9bae988061ea5465f7cdb4b0c61b4230cd59.1548737236.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_IS_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 Acked-by: Viresh Kumar Reviewed-by: Daniel Lezcano --- 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..1db2f6927e13 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_IS_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, };