From patchwork Sun Mar 7 09:45:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 395142 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp858161jai; Sun, 7 Mar 2021 01:46:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwjowEQBfkE8NNyQxp2C70OmWTiNnNfsHEbXeqMxAa6ZOutNd1etXYxuyRX+TBpU+6a4GcO X-Received: by 2002:aa7:d445:: with SMTP id q5mr16976237edr.382.1615110403143; Sun, 07 Mar 2021 01:46:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615110403; cv=none; d=google.com; s=arc-20160816; b=YkADKKGE7Aram6qMvlBek6yLL9Q6eWiyjy/ujBC/oSLhQD6xbJaQwKaC5jDUJsD1X0 q0YsIbZaA/697aonrcPsoXKAYTNLhX1ymX6FkqLl5U2sPr+fdZSw1PTM4xYbE1lwVtsA ErFJVHuaLT9ayogzwsmGGRFR3lym2QjAptCYV9smUqoNOVQeA17hLYFSZQ9XHy78w7R1 HJ7fUIAWN7kphwQZc1nL93KwP30NV/OO6L8eQolf/NExw3ZkeIfKJoPb8iZwyDJNzVXt 0NXcmcbL94ouWWuXqvrZwliSxgnlYiVNMfhnivXYb8mVnuA9WxsjOFiX8DBCKOQL0L3E lPDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=ihXVSbxv7FyslBFnvseGR/NddNzkR/mnLj93t8UIBfA=; b=TF5oQ2CVoTbnS4BncQYyEvskMtlVSZOw9JwmxicW7UFHvonoAC019/dve4FLJkT+Pl er2esNfsQvTUZ2xdV37rK6fWx8hd8/07Cn8xGrGsaLLk1npYrXnLTBAXlcAmnvRSUJrO Ae2UZJoaE8PMjxIdd3PlKARVg2iL/hW7v46lOrtNmNcYCiq9wv3aQ+jESEMtbpXK4w0H 9k/pkIDmWI2T42PoGIfV00WdjkUNNguInfQa9efSXk68niuzw6yfBEPtqMv5mePiTSNF AyQPIX0Tbp02grtCTyJ5nGYMeCKVwnOAzYHOlz3DkYr9cA/IaPgR8HQ+lOXvbZnxDxYE 9BxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=frwiDO8D; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id d24si4848865ejw.372.2021.03.07.01.46.42; Sun, 07 Mar 2021 01:46:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=frwiDO8D; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 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 S230155AbhCGJpt (ORCPT + 7 others); Sun, 7 Mar 2021 04:45:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230252AbhCGJpg (ORCPT ); Sun, 7 Mar 2021 04:45:36 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46C4AC06175F for ; Sun, 7 Mar 2021 01:45:36 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id w7so4271226wmb.5 for ; Sun, 07 Mar 2021 01:45:36 -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; bh=ihXVSbxv7FyslBFnvseGR/NddNzkR/mnLj93t8UIBfA=; b=frwiDO8DtUKisLLH799ud1Ejtd7sw4X9i5GlRkez3twBY2FxIK/uv5WQWL+Ze1MWS+ n75Q6jepcRGJ0FEJ6YtjZJef2k5MWqipp3ezxDbDpcfO9q1oOL2na1qZAtej/GGOMqnn 66GgsQfHzt1iUbd1nkbhdR1HquKPCWXIS++kMaBOVFVtfUThedQyt2grF/pV7JIGvA9C JaxGgVf0ydByvZEB9P1Tc7w6rSkKxwCrC42h9gjlGHFXi/tZMTdveU/jEEGUms2FWwKP qtRBf2Wsh5BQKqFW1Frx5eZHd5BFWp20kSm/OWLlShp5UBbiMiOnmGkXBwKTEUDRzWqD gpoA== 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; bh=ihXVSbxv7FyslBFnvseGR/NddNzkR/mnLj93t8UIBfA=; b=Y8UxnluB3GZYJV05NfQsk/KniX+G+byHNIG3H14U5M0EPNvx/edVAI8jMAVQm9EwIf +JZSJzTrbUXIWkbiJlHXKVfqbOjaxw5tP92TTDqIFZL5sdq7aBicX08YfHJPIeXagbtc JmRaCEadIIn14QvB8eTZQ4MnQdqKXeV8pFMvc8vNAtVAR8/mLdEiy/xVDzHL/tPH9oNl H8Q6B+LeC5ewsv+mE86pgw5SVqJYLExlJowIgq4a4fU1l2egafDjgQlRpvUAbxVGWGK+ mEO11s1NK5LgW2LqvmFsUhJTeoXbNEvREw+CstEPf1B44WCe/s7bqXT/AZAkq3rbx1LO TqOw== X-Gm-Message-State: AOAM5308CQX7nh2hTuhHY33CGAYb2oc0mBAyhUECeP4yqu8dwpnKfae2 Zx8EPkSXAZpDu8uUAnHaLCeq2g== X-Received: by 2002:a1c:1dd4:: with SMTP id d203mr16885107wmd.83.1615110334754; Sun, 07 Mar 2021 01:45:34 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-141-80.adsl.proxad.net. [82.252.141.80]) by smtp.gmail.com with ESMTPSA id z7sm12790737wrt.70.2021.03.07.01.45.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Mar 2021 01:45:34 -0800 (PST) From: Daniel Lezcano To: cwchoi00@gmail.com Cc: lukasz.luba@arm.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, steven.price@arm.com, MyungJoo Ham , Kyungmin Park , Chanwoo Choi Subject: [PATCH v3 1/4] devfreq: Register devfreq as a cooling device on demand Date: Sun, 7 Mar 2021 10:45:15 +0100 Message-Id: <20210307094519.9032-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Currently the default behavior is to manually having the devfreq backend to register themselves as a devfreq cooling device. Instead of adding the code in the drivers for the thermal cooling device registering, let's provide a flag in the devfreq's profile to tell the common devfreq code to register the newly created devfreq as a cooling device. Suggested-by: Chanwoo Choi Signed-off-by: Daniel Lezcano --- V3: - Rebased on linux-pm branch without units.h - Set the cdev to NULL in case of error - Added description for the cdev field in the devfreq structure V2: - Added is_cooling_device boolean in profile structure - Register cooling device when the is_cooling_device boolean is set - Remove devfreq cooling device registration in the backend drivers V1: - Register devfreq as a cooling device unconditionnally --- drivers/devfreq/devfreq.c | 13 +++++++++++++ include/linux/devfreq.h | 8 ++++++++ 2 files changed, 21 insertions(+) -- 2.17.1 diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index bf3047896e41..cf64aeec468f 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,7 @@ #include #include #include +#include #include "governor.h" #define CREATE_TRACE_POINTS @@ -935,6 +937,15 @@ struct devfreq *devfreq_add_device(struct device *dev, mutex_unlock(&devfreq_list_lock); + if (devfreq->profile->is_cooling_device) { + devfreq->cdev = devfreq_cooling_em_register(devfreq, NULL); + if (IS_ERR(devfreq->cdev)) { + dev_info(dev, "Failed to register devfreq " + "cooling device\n"); + devfreq->cdev = NULL; + } + } + return devfreq; err_init: @@ -960,6 +971,8 @@ int devfreq_remove_device(struct devfreq *devfreq) if (!devfreq) return -EINVAL; + thermal_cooling_device_unregister(devfreq->cdev); + if (devfreq->governor) { devfreq->governor->event_handler(devfreq, DEVFREQ_GOV_STOP, NULL); diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 26ea0850be9b..aba7ace11b72 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -98,11 +98,15 @@ struct devfreq_dev_status { * @freq_table: Optional list of frequencies to support statistics * and freq_table must be generated in ascending order. * @max_state: The size of freq_table. + * + * @is_cooling_device: A self-explanatory boolean giving the device a + * cooling effect property. */ struct devfreq_dev_profile { unsigned long initial_freq; unsigned int polling_ms; enum devfreq_timer timer; + bool is_cooling_device; int (*target)(struct device *dev, unsigned long *freq, u32 flags); int (*get_dev_status)(struct device *dev, @@ -156,6 +160,7 @@ struct devfreq_stats { * @suspend_count: suspend requests counter for a device. * @stats: Statistics of devfreq device behavior * @transition_notifier_list: list head of DEVFREQ_TRANSITION_NOTIFIER notifier + * @cdev: Cooling device pointer if the devfreq has cooling property * @nb_min: Notifier block for DEV_PM_QOS_MIN_FREQUENCY * @nb_max: Notifier block for DEV_PM_QOS_MAX_FREQUENCY * @@ -198,6 +203,9 @@ struct devfreq { struct srcu_notifier_head transition_notifier_list; + /* Pointer to the cooling device if used for thermal mitigation */ + struct thermal_cooling_device *cdev; + struct notifier_block nb_min; struct notifier_block nb_max; }; From patchwork Sun Mar 7 09:45:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 395781 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DCB7C4332B for ; Sun, 7 Mar 2021 09:46:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2593965139 for ; Sun, 7 Mar 2021 09:46:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231368AbhCGJpu (ORCPT ); Sun, 7 Mar 2021 04:45:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231129AbhCGJpi (ORCPT ); Sun, 7 Mar 2021 04:45:38 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A948CC061760 for ; Sun, 7 Mar 2021 01:45:37 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id u14so8128250wri.3 for ; Sun, 07 Mar 2021 01:45:37 -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; bh=RsjSwA8oB0o8PW0ry99uhxTdXQdH9BOaf5mimdTgeO0=; b=cEZv1N9MT1tvcp5XXBU/gC/3IF30iDxLCSKZoGWnZBDvfMPIl/dDWocdAT518rBLib z9GfFnD7Vw4DdcLo6XWQ69SwwDSUG75kHjUnPLaR9OU6WdnNycO7Y8roscN1sMew0W9T n8yaXirXJTt640L5dqM2zyhVlDKbypVDKJQaCWeDlzBGnB0Kgf9RSTU5UjKuiLHebEyY ks0eFoAg7C0H4/gHHMtVmELgLhiqLCw6imgeP39zDlV+mzjWx5brsNRbSimT+hhXNZbn eXtGNYNgtSSGjIQJgD4xKtTyeRERc0I4pQTAdASh53z2pnWyPnR0IeaLzGxLmbuU9/CF jyqw== 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; bh=RsjSwA8oB0o8PW0ry99uhxTdXQdH9BOaf5mimdTgeO0=; b=Zs45CP5LOfOJ1Csk6Jc75g2Rr/75xg4H62XF+8UTIucgI1klrdo7chZ/yrEGRutbYN 8KV2Bg13NmTaWRCYpf5fRmH/nzv3+2FRjuVt9QrpTc4TXYIgj6TIZhI7d6I94NjzJF/r 965dbXfJrTsogJ7Hbmjn5UXP2Cx7rVWLG2CnqNSGUCpYN2D7XpiCi7+z/UebgjvVPPiy FgU+t3SNf5hMf1/GOwRAAspvBNCXgvq3xmzUhiPzN7hRbqCJ5KcW01G8hBqbBl1AJwrS M2jd/Z2ptQzjLZvjoi3ST8DcUhl5BpL1ID9CU4dvFcsplvBPnsx/e9YP5wrTlV0ZpLvz rKdA== X-Gm-Message-State: AOAM532GbrQfFzG4K5YtiBsk44vHG5GBwHou9sn2b0iO86aD/mSL1gRM qVI26duzWBJ271Is5woWmuDBpQ== X-Google-Smtp-Source: ABdhPJwXs/r34f0ulXMj7OuQIK3/3Xk18RKjsq+HUnzr5igiGn4bAPSoScW19dqf/oqDuniL3Vtm2Q== X-Received: by 2002:adf:a59a:: with SMTP id g26mr17670383wrc.271.1615110336310; Sun, 07 Mar 2021 01:45:36 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-141-80.adsl.proxad.net. [82.252.141.80]) by smtp.gmail.com with ESMTPSA id z7sm12790737wrt.70.2021.03.07.01.45.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Mar 2021 01:45:35 -0800 (PST) From: Daniel Lezcano To: cwchoi00@gmail.com Cc: lukasz.luba@arm.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, steven.price@arm.com, Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org (open list:DRM DRIVER FOR MSM ADRENO GPU), dri-devel@lists.freedesktop.org (open list:DRM DRIVER FOR MSM ADRENO GPU), freedreno@lists.freedesktop.org (open list:DRM DRIVER FOR MSM ADRENO GPU) Subject: [PATCH v3 2/4] devfreq/drivers/msm: Use devfreq cooling device registration Date: Sun, 7 Mar 2021 10:45:16 +0100 Message-Id: <20210307094519.9032-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210307094519.9032-1-daniel.lezcano@linaro.org> References: <20210307094519.9032-1-daniel.lezcano@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The devfreq core code is able to register the devfreq device as a cooling device if the 'is_cooling_device' flag is set in the profile. Use this flag and remove the cooling device registering code. Tested on dragonboard 845c Signed-off-by: Daniel Lezcano --- drivers/gpu/drm/msm/msm_gpu.c | 12 +----------- drivers/gpu/drm/msm/msm_gpu.h | 2 -- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c index ab7c167b0623..eade94271a60 100644 --- a/drivers/gpu/drm/msm/msm_gpu.c +++ b/drivers/gpu/drm/msm/msm_gpu.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -82,6 +81,7 @@ static struct devfreq_dev_profile msm_devfreq_profile = { .target = msm_devfreq_target, .get_dev_status = msm_devfreq_get_dev_status, .get_cur_freq = msm_devfreq_get_cur_freq, + .is_cooling_device = true, }; static void msm_devfreq_init(struct msm_gpu *gpu) @@ -112,14 +112,6 @@ static void msm_devfreq_init(struct msm_gpu *gpu) } devfreq_suspend_device(gpu->devfreq.devfreq); - - gpu->cooling = of_devfreq_cooling_register(gpu->pdev->dev.of_node, - gpu->devfreq.devfreq); - if (IS_ERR(gpu->cooling)) { - DRM_DEV_ERROR(&gpu->pdev->dev, - "Couldn't register GPU cooling device\n"); - gpu->cooling = NULL; - } } static int enable_pwrrail(struct msm_gpu *gpu) @@ -1056,6 +1048,4 @@ void msm_gpu_cleanup(struct msm_gpu *gpu) if (gpu->worker) { kthread_destroy_worker(gpu->worker); } - - devfreq_cooling_unregister(gpu->cooling); } diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h index d7cd02cd2109..93419368bac8 100644 --- a/drivers/gpu/drm/msm/msm_gpu.h +++ b/drivers/gpu/drm/msm/msm_gpu.h @@ -155,8 +155,6 @@ struct msm_gpu { struct msm_gpu_state *crashstate; /* True if the hardware supports expanded apriv (a650 and newer) */ bool hw_apriv; - - struct thermal_cooling_device *cooling; }; static inline struct msm_gpu *dev_to_gpu(struct device *dev) From patchwork Sun Mar 7 09:45:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 395267 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D212C43381 for ; Sun, 7 Mar 2021 09:46:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1274A64FC1 for ; Sun, 7 Mar 2021 09:46:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231382AbhCGJpu (ORCPT ); Sun, 7 Mar 2021 04:45:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231253AbhCGJpj (ORCPT ); Sun, 7 Mar 2021 04:45:39 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54F2EC06175F for ; Sun, 7 Mar 2021 01:45:39 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id l12so8109571wry.2 for ; Sun, 07 Mar 2021 01:45:39 -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; bh=ahYwzRQmSJrX4v8ks57+n/tweaGVoFJT9QTc8vhlUHg=; b=IMCG9brrQt9OXxOqUu9VRJQSaHO249Bi5pskoqucaUgqlSLXajvgNyj8fB5buczLrp NVzKgCJwG8EjWaUo5rmBNG9GjT98RRRikYuauNSDXyxBFgM3QAxKN1/BAmCP1yQcKV5y HJQbIvC+0sdx6bnuGncA1cURxt62iFmsLIXkdh4WgWW/1u/HpYi8XiZ0Rvjw8fQJMOSi OUVmQjNb6FqCNZTMJguKbtukfUWtL7y5ebBdfxq1gZ76G+4qJhEiWGAezl5cY1Us0jPb yw/KbYm6ulF7YkGN3s6IFni73fZttTj1qdwcAA0x3zqgCf+2wpvcV6M5ToWnvpEjBFn4 sUyg== 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; bh=ahYwzRQmSJrX4v8ks57+n/tweaGVoFJT9QTc8vhlUHg=; b=Qhg+A2e/Ho8KIHz8MjoS2O8Lp+sIZ69nxbo5a4hde69SUvBwa36uYjOfFgxC+rl8F8 x7riJw/FH553vwiLLpXYZJmoGJjLx4N0lcbR4OxC2fagie6N1wbgWm4MOJk5NGEa5f9U 6Nx2sKcEhgPefCf2/VMF2MewEvtAVKI5HI7ZDqEC/uIAfUVoaSRUuENyAag5TfUBtj9d M/WfeBO5ZCzHfuIlsGS+18ztf383Aj+1oIA3l16rLvqcRK8/8R9AAklNrn2zKYigukAe ikUNzarZtfgaZlC9vh3pAZk/PsaTJFCmS1YIH7H/QHNxJH1K2McNbmQ1tW/BDbitXPtS Acnw== X-Gm-Message-State: AOAM5300nAhZ3mJr3d9NrVCAJfQCd+yz+b8u1Nw/MurcnTY9GJ6nNJl0 XLD1M00A4dmfGoGRo9QTVfLmHQ== X-Google-Smtp-Source: ABdhPJyOGcafMeDaZLkMwnxAp2OBU2WWlF+NGAqbnYf+vb2lNG153g6/PTKMSqI0795e+xjNGw42eQ== X-Received: by 2002:a5d:5492:: with SMTP id h18mr6433869wrv.340.1615110338036; Sun, 07 Mar 2021 01:45:38 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-141-80.adsl.proxad.net. [82.252.141.80]) by smtp.gmail.com with ESMTPSA id z7sm12790737wrt.70.2021.03.07.01.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Mar 2021 01:45:37 -0800 (PST) From: Daniel Lezcano To: cwchoi00@gmail.com Cc: lukasz.luba@arm.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, steven.price@arm.com, Rob Herring , Tomeu Vizoso , Alyssa Rosenzweig , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org (open list:ARM MALI PANFROST DRM DRIVER) Subject: [PATCH v3 3/4] devfreq/drivers/panfrost: Use devfreq cooling device registration Date: Sun, 7 Mar 2021 10:45:17 +0100 Message-Id: <20210307094519.9032-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210307094519.9032-1-daniel.lezcano@linaro.org> References: <20210307094519.9032-1-daniel.lezcano@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The devfreq core code is able to register the devfreq device as a cooling device if the 'is_cooling_device' flag is set in the profile. Use this flag and remove the cooling device registering code. Tested on rock960. Signed-off-by: Daniel Lezcano --- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 14 +------------- drivers/gpu/drm/panfrost/panfrost_devfreq.h | 3 --- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c index 56b3f5935703..4d96edf1bc54 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c @@ -3,7 +3,6 @@ #include #include -#include #include #include @@ -80,6 +79,7 @@ static struct devfreq_dev_profile panfrost_devfreq_profile = { .polling_ms = 50, /* ~3 frames */ .target = panfrost_devfreq_target, .get_dev_status = panfrost_devfreq_get_dev_status, + .is_cooling_device = true, }; int panfrost_devfreq_init(struct panfrost_device *pfdev) @@ -90,7 +90,6 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) struct device *dev = &pfdev->pdev->dev; struct devfreq *devfreq; struct opp_table *opp_table; - struct thermal_cooling_device *cooling; struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; opp_table = dev_pm_opp_set_regulators(dev, pfdev->comp->supply_names, @@ -139,12 +138,6 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev) } pfdevfreq->devfreq = devfreq; - cooling = devfreq_cooling_em_register(devfreq, NULL); - if (IS_ERR(cooling)) - DRM_DEV_INFO(dev, "Failed to register cooling device\n"); - else - pfdevfreq->cooling = cooling; - return 0; err_fini: @@ -156,11 +149,6 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev) { struct panfrost_devfreq *pfdevfreq = &pfdev->pfdevfreq; - if (pfdevfreq->cooling) { - devfreq_cooling_unregister(pfdevfreq->cooling); - pfdevfreq->cooling = NULL; - } - if (pfdevfreq->opp_of_table_added) { dev_pm_opp_of_remove_table(&pfdev->pdev->dev); pfdevfreq->opp_of_table_added = false; diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h b/drivers/gpu/drm/panfrost/panfrost_devfreq.h index db6ea48e21f9..470f5c974703 100644 --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h @@ -9,14 +9,11 @@ struct devfreq; struct opp_table; -struct thermal_cooling_device; - struct panfrost_device; struct panfrost_devfreq { struct devfreq *devfreq; struct opp_table *regulators_opp_table; - struct thermal_cooling_device *cooling; bool opp_of_table_added; ktime_t busy_time; From patchwork Sun Mar 7 09:45:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 395782 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 364B8C433E9 for ; Sun, 7 Mar 2021 09:46:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EFD0B65015 for ; Sun, 7 Mar 2021 09:46:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231388AbhCGJpv (ORCPT ); Sun, 7 Mar 2021 04:45:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231296AbhCGJpl (ORCPT ); Sun, 7 Mar 2021 04:45:41 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCDBAC06174A for ; Sun, 7 Mar 2021 01:45:40 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id b18so8115094wrn.6 for ; Sun, 07 Mar 2021 01:45:40 -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; bh=lZkNk3yYW/8ijhrD082tSx7qBCi8O3cbnVc/FrlwdlU=; b=rwqG0rGjDKgDJMDgyrPuL6fMMJ8FUmrimYfMpceWe9MkQbKAflo6IkH5SMQ0xZy9XR opslnX4VVS00yl+S+cZsjXsVGexmEyL/1aA+2mQLXU/Hx63HARlTApMASp9/RIjQON8i 5sbeykvJEJzSN1AcprCRE+EgUGP90baUMv+1YStLGuOU7ffiFtNElY+IKz13LxrRnlgp U1MW5w7tJbgVHjKiv5xn25VEvnNCzvjsyzZ77TsZy3ox3BgXwJt4C6mCUT+NjK6I5B5n 7bf3hQMhcHKcA1rS+DUGAwqAdw+cwpt2L6p1hDgO7x2nR3dMJvZM8DeCAD8gLhyASedW tu9A== 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; bh=lZkNk3yYW/8ijhrD082tSx7qBCi8O3cbnVc/FrlwdlU=; b=BrG4ZkJDiDrpFLufZz642rdOYFxM0yemWxP4YKltpP4EnOR5bzW9bQqT0hKHfijhsE GhQ68WL87xF42tYIzKa3MdH+YuHr743nns3q8N+aLBdQTEJRJ3iFF0lDrhqhkG4QrY8r hAG4pZ2GfFk/TplrxUq22tVCH30xUY4Y30UW7JJAJg2c6wERtJdQtg3tZMBIlcRc1kfZ 50M+0RiS7YJNXtrDFexKqy12ZNGd0vySv5fb7ih4jhH3SLwZ+V6P3TO1ex26m9Gwa3q4 p9rbcEpnWSzo7oKRKnEb/Rid0u/epkfkBl9n21h2k42TYkCQjeoUMKnbK/xsQwoohbwM tWdg== X-Gm-Message-State: AOAM533eYIkDBmqmxTEc+nuy5Y+z4psVQzDgdx6zbQj8uyVKQddQ+M8c fYBvrwWcyi5PvfhXWrtyXqzUEA== X-Google-Smtp-Source: ABdhPJw99kGB8EMsZs3YEBktotNiQ5Quc/vbCuOVi/jHeofv++Ue1b0c6UMEtbJqQj4ihMOuVRQoVw== X-Received: by 2002:a5d:5043:: with SMTP id h3mr17350887wrt.120.1615110339583; Sun, 07 Mar 2021 01:45:39 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-141-80.adsl.proxad.net. [82.252.141.80]) by smtp.gmail.com with ESMTPSA id z7sm12790737wrt.70.2021.03.07.01.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Mar 2021 01:45:39 -0800 (PST) From: Daniel Lezcano To: cwchoi00@gmail.com Cc: lukasz.luba@arm.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, steven.price@arm.com, Qiang Yu , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS FOR LIMA), lima@lists.freedesktop.org (moderated list:DRM DRIVERS FOR LIMA) Subject: [PATCH v3 4/4] devfreq/drivers/lima: Use devfreq cooling device registration Date: Sun, 7 Mar 2021 10:45:18 +0100 Message-Id: <20210307094519.9032-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210307094519.9032-1-daniel.lezcano@linaro.org> References: <20210307094519.9032-1-daniel.lezcano@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The devfreq core code is able to register the devfreq device as a cooling device if the 'is_cooling_device' flag is set in the profile. Use this flag and remove the cooling device registering code. Signed-off-by: Daniel Lezcano --- drivers/gpu/drm/lima/lima_devfreq.c | 14 +------------- drivers/gpu/drm/lima/lima_devfreq.h | 2 -- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/drivers/gpu/drm/lima/lima_devfreq.c b/drivers/gpu/drm/lima/lima_devfreq.c index 5686ad4aaf7c..86aea1bdc4f4 100644 --- a/drivers/gpu/drm/lima/lima_devfreq.c +++ b/drivers/gpu/drm/lima/lima_devfreq.c @@ -7,7 +7,6 @@ */ #include #include -#include #include #include #include @@ -84,17 +83,13 @@ static struct devfreq_dev_profile lima_devfreq_profile = { .polling_ms = 50, /* ~3 frames */ .target = lima_devfreq_target, .get_dev_status = lima_devfreq_get_dev_status, + .is_cooling_device = true, }; void lima_devfreq_fini(struct lima_device *ldev) { struct lima_devfreq *devfreq = &ldev->devfreq; - if (devfreq->cooling) { - devfreq_cooling_unregister(devfreq->cooling); - devfreq->cooling = NULL; - } - if (devfreq->devfreq) { devm_devfreq_remove_device(ldev->dev, devfreq->devfreq); devfreq->devfreq = NULL; @@ -110,7 +105,6 @@ void lima_devfreq_fini(struct lima_device *ldev) int lima_devfreq_init(struct lima_device *ldev) { - struct thermal_cooling_device *cooling; struct device *dev = ldev->dev; struct opp_table *opp_table; struct devfreq *devfreq; @@ -173,12 +167,6 @@ int lima_devfreq_init(struct lima_device *ldev) ldevfreq->devfreq = devfreq; - cooling = of_devfreq_cooling_register(dev->of_node, devfreq); - if (IS_ERR(cooling)) - dev_info(dev, "Failed to register cooling device\n"); - else - ldevfreq->cooling = cooling; - return 0; err_fini: diff --git a/drivers/gpu/drm/lima/lima_devfreq.h b/drivers/gpu/drm/lima/lima_devfreq.h index 2d9b3008ce77..c43a2069e5d3 100644 --- a/drivers/gpu/drm/lima/lima_devfreq.h +++ b/drivers/gpu/drm/lima/lima_devfreq.h @@ -9,7 +9,6 @@ struct devfreq; struct opp_table; -struct thermal_cooling_device; struct lima_device; @@ -17,7 +16,6 @@ struct lima_devfreq { struct devfreq *devfreq; struct opp_table *clkname_opp_table; struct opp_table *regulators_opp_table; - struct thermal_cooling_device *cooling; ktime_t busy_time; ktime_t idle_time;