From patchwork Sun Mar 7 18:51:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 395150 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp1144983jai; Sun, 7 Mar 2021 10:57:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCcA3nz28bReVNG7dWZ+w+Ppg3hy6BdIwgG3jIw2S9ii5XvaEeAzTS9ovIC3TlGZUn6LEc X-Received: by 2002:a17:907:7684:: with SMTP id jv4mr12179963ejc.231.1615143419979; Sun, 07 Mar 2021 10:56:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615143419; cv=none; d=google.com; s=arc-20160816; b=04VG7Lr6n6/wpyTn36FIE0zuflUeKP22h6FRJ9Rk15dUfNodMbaqLHksUwFsLn5H5X ROKKkaLs4FKKBRO2WGZy4K5QeXdiUibADZamxSxYZ5UpFRmQ08buoEC6BbVymul0iTu8 GmM/RuQvffNXvOHgfQTTRJWZPRGSDtmR0yuSvBx53H7gktOMUX6nGFbn14ZpyWKAac7v pLUrz8MLLfTK3l+RP/U04TozoyZkCJQ5w4ukMq1HlM4rAD9Fi9RCzL2qRcsN7P6sAA+4 seUKO5sXlPW3zvIC8WSZ/pbS72pYvzj3+ymDLMmWSap0U4lMxb1cso5+rqX+EMQ42Ju2 3mKA== 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=Y2nnNS+GqT7TJyAzMEoj0JTe1ldgAoF/8NSEWFXeM7o=; b=HcYsR1PBORStn8/265c6i40GusaFG7BIzkqaRLCfgArt7EjrpHfwOTFmpwNb9zZ41e MCS+TmFAJ46XYXPX49mJaZDXXEvUV9gzzh9Ea2tgT32UTcZ7eNlXEVRvFA2ylUicU6a3 FGi0Q5u+TPvUHvHwmGTxx3T7YlXjM6br3iwJce706UFynWngeJo9s3QGBtLPAPWzq1IO OODg2ZUktqFhg//MoQq8pFU2UyR/sIGBOzpWWu3r1XR0wxBw/GWhbu2wpHa1tu8Incj/ 40nwnxq//4D5OhxgT02wGc7E/ru2UU5ecUdx6ZLk+M1G5BgKLWdCMa5IFVAO+dXlQyML mKtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XEQinZBv; 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 r21si5499639ejo.123.2021.03.07.10.56.59; Sun, 07 Mar 2021 10:56:59 -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=XEQinZBv; 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 S231628AbhCGSwJ (ORCPT + 7 others); Sun, 7 Mar 2021 13:52:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231542AbhCGSvn (ORCPT ); Sun, 7 Mar 2021 13:51:43 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10860C06174A for ; Sun, 7 Mar 2021 10:51:42 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id c76-20020a1c9a4f0000b029010c94499aedso2479745wme.0 for ; Sun, 07 Mar 2021 10:51:42 -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=Y2nnNS+GqT7TJyAzMEoj0JTe1ldgAoF/8NSEWFXeM7o=; b=XEQinZBvw40UemIVFSBuR4zO0PnieCrZhqNTiebm5YknyluAW+Qcf9Th1X6qlAp+Km 1loBQ1rTmQQIvAOJD9S1K/mZIe27BCd+bS5NfrD46SUPrDGvMLBs9ysvTqEPTueWYKTi fLTZkYWtw4HKxtS5z/GYZDdd1yv3H8B6MyIHguleBb8sVKZkyiUqpP2yJNDa/emhWrIB 3y0zvTXSlWkNpjCowItRt3ThbHtJYxndEfiJtEZY95LtYpv8CLbYF0zFDdUZt9KAmtIl jkNutdkdD/eZ0hUr58UOrXv6Odu4x57f9EugppBGsx1tezPGKMMIVYmGpPIkGtut00BB 8nag== 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=Y2nnNS+GqT7TJyAzMEoj0JTe1ldgAoF/8NSEWFXeM7o=; b=G1tjE+qNNCYPF1Jips2TW11KUEqYIBQ3cPK/TTNEvUUu4Q5SJDJuhrnLY09R3CrK+5 oxLL+rqlGv+AUU4emCl8LiK5EeIsF6DZVC64bxWUKl6RhodX8bGdJvdxTLmOitiW7iXf aUS2CtkW9CLliC1fSaqv5oc6G0/zYAPh5agDQjhWdmeQNFW6Qvj0oE+n/yYzYMZ1gNhL 1OZUGUH80KvdRF0p35rfRw8h+mF04qkm3cmoftbd+ciRowVPhJj0l1u5a3SGZG9jbbFq X7Kei55QJ6MhPIY4dZ+x1OfekM1eMW5Y+ZvWgASsh7Maz3xm4iXPd4m7cTlfuo33dNhw d5jQ== X-Gm-Message-State: AOAM532h6haIwEvqLk6XHqzghuhu3oeMbmglK3owFs1ZaB1yfZlONGbt ASd1CzLPYMfwWPR2gt9eTgHqHBwC9Q7bBg== X-Received: by 2002:a7b:c188:: with SMTP id y8mr18282898wmi.76.1615143101395; Sun, 07 Mar 2021 10:51:41 -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 v5sm14842965wmh.2.2021.03.07.10.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Mar 2021 10:51:41 -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 v4 1/4] devfreq: Register devfreq as a cooling device on demand Date: Sun, 7 Mar 2021 19:51:34 +0100 Message-Id: <20210307185137.24925-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 --- V4: - Replaced thermal_cooling_device_unregister() by devfreq_cooling_unregister() 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..8a535d4d6083 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; + devfreq_cooling_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 18:51:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 395780 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 DB5F3C433DB for ; Sun, 7 Mar 2021 18:56:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A325165177 for ; Sun, 7 Mar 2021 18:56:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231562AbhCGSwJ (ORCPT ); Sun, 7 Mar 2021 13:52:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231575AbhCGSvo (ORCPT ); Sun, 7 Mar 2021 13:51:44 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43A62C06174A for ; Sun, 7 Mar 2021 10:51:44 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id l22so4758232wme.1 for ; Sun, 07 Mar 2021 10:51: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; bh=RsjSwA8oB0o8PW0ry99uhxTdXQdH9BOaf5mimdTgeO0=; b=oWBnZ4aSczd7y5RxPFRzRlQVEwdtlC9a7PJ+FC4zThsk6IkpQmng+VE49/LomHtJMo KTXaLq3/6N4DkZfdmxylKLJBC9GmFaqke08d4pIGBWKxDWIz/16PL5zXFXcrBhi85x92 KrSgTVisjIQZRkKc6FnfU2NqKTyPV1RI4VtdCr9bhiIEBCv4u+OkZ4UEG7SyIhN22L7D 2InRHmS/NTCjCJ+uNOEcNKLnTrUYdn4vei5v2JFTFA6c0mJYcFPj/TUQgaJ6bc2cMxf7 bnrIhRfc8/EG7XJOp+tmPoVNBtn7WvepMRAfMS/xyy34bbLze1EvaURKwm++PtpDcIcS O6Ag== 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=I+NSEq5fF1uJCfoeTJMJ97R0FvSqwhg8+KWeos9e/B+XcV0NXe0oow7qYLks8uMbIo TAqyF+E/4nyTFDNMQVNwsDbTbfgGExtH5MOeEIt4ZUgZ59E1kELG7zcUDGqUPXdXvhlq 9KLw2ndiZqmGLRTsCUOqF2t2VF5AUyMQ0py8ffBWaSDZ00jA95O8k88Jp39jSulnULG2 Map6qHRu1WHJcIMMEJUw0FNsoiM0DfCnxrEgKh4UkfB9wDgsbqt1UipiNEtx42GgPYhf nsQRmiPiT7G8rsE69+WWtDCFcWWdJ3+gbLb2lZsbyZ9Oojd0ksPTcAW6vEyzgHLGhnUD tl4Q== X-Gm-Message-State: AOAM530O66JEG1Pihpb7AQ7FGpNP36BMrkxDWr5ikysEw/okIZDy+EH7 DVwmLEmPF/IQiH1J15wRsBy7HA== X-Google-Smtp-Source: ABdhPJyiWxW4LLC9cR5FfZEHHAga+VfDDG2o+o5y28Fnu6rWugw1VUFr3FMW44bTF7Odac0y9zFPjw== X-Received: by 2002:a1c:66c4:: with SMTP id a187mr18790206wmc.164.1615143102905; Sun, 07 Mar 2021 10:51:42 -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 v5sm14842965wmh.2.2021.03.07.10.51.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Mar 2021 10:51:42 -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 v4 2/4] devfreq/drivers/msm: Use devfreq cooling device registration Date: Sun, 7 Mar 2021 19:51:35 +0100 Message-Id: <20210307185137.24925-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210307185137.24925-1-daniel.lezcano@linaro.org> References: <20210307185137.24925-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 18:51:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 395265 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 63094C4332E for ; Sun, 7 Mar 2021 18:56:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3E36965172 for ; Sun, 7 Mar 2021 18:56:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231655AbhCGSwK (ORCPT ); Sun, 7 Mar 2021 13:52:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231610AbhCGSvq (ORCPT ); Sun, 7 Mar 2021 13:51:46 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAD4CC06175F for ; Sun, 7 Mar 2021 10:51:45 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id u14so9125028wri.3 for ; Sun, 07 Mar 2021 10:51:45 -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=pPFLIwCS9uAhBMaquy3ITzoD8Pe5Iah3HEBjZn7mIChQz+rYauMKqtQuAakhMt9o6V Y2DK9wBwKAIdPBo6B3xncMA2iAbsDW0LOoAmYzvD7rXXdmZtJyvLMjrlP1rfknHJQ6Hd JCBq4rxHLeyUhnElxm/bFoJcz/QfRHRSkG0f83d2QZs1tDJ87nqrMcJxk4Duy7GepGcO b15SlE1Rr7/KRQLs/CVIF342WFMsqPaOkf+qg4+YRacaAy59+h6/gk/Ln9uAUckCclAk kkHe7cFb1vGFZxsb6sSTuU7DbPCUrrIS29+ybxsaUgUyYid1pxakPwIiRvflLanZndaf loPg== 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=dgi8GUWuNCWmhWLcss5RMnCwMvcJTVpqmemLPyvGv7++E/MVzigggskQFr0tMzRxZl VQgFwetQ+AJkJirO3fPMzDb5zzWHusYpNcibrZTSOsqXTRCHw7YKBlym86JT30YNf841 heT++TYEi40qIKy27d33BsJ5p+dwFfg9kz2ptaKO0B6USDMnmddt+1RMufZMICCdu/Hj Z/VuTvhZK6AWNec1qEn6jopdxUFBbtaOb7GOurcD+/rDXDCX15T7VzjQDEx9Z6PTnled y7ygF2sG+YDdRxg9kBKAk220AsxDJqJdil5eVR/4uMDtEndfTvfiF+0Arkz03mkfROSl LeUg== X-Gm-Message-State: AOAM533QsCMv74adg9FtLXirZpZla+aOoFIwHtXy24mEdQwneIquk+y8 mBFGtkbI4N58O/ysdRD9ZnI28BIJVceoyw== X-Google-Smtp-Source: ABdhPJzJpkg8wtBhTMaUdn66zPEDMpQBLMZaZmKjxKN30X+1gT8di8t7bZe4+vqIGaLQaXjk1QYEfQ== X-Received: by 2002:a5d:6381:: with SMTP id p1mr19962295wru.266.1615143104380; Sun, 07 Mar 2021 10:51:44 -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 v5sm14842965wmh.2.2021.03.07.10.51.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Mar 2021 10:51:44 -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 v4 3/4] devfreq/drivers/panfrost: Use devfreq cooling device registration Date: Sun, 7 Mar 2021 19:51:36 +0100 Message-Id: <20210307185137.24925-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210307185137.24925-1-daniel.lezcano@linaro.org> References: <20210307185137.24925-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 18:51:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 395266 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 47FD8C43381 for ; Sun, 7 Mar 2021 18:56:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 07F226517D for ; Sun, 7 Mar 2021 18:56:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231664AbhCGSwK (ORCPT ); Sun, 7 Mar 2021 13:52:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231613AbhCGSvr (ORCPT ); Sun, 7 Mar 2021 13:51:47 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3082DC06174A for ; Sun, 7 Mar 2021 10:51:47 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id n22so4747164wmc.2 for ; Sun, 07 Mar 2021 10:51: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; bh=lZkNk3yYW/8ijhrD082tSx7qBCi8O3cbnVc/FrlwdlU=; b=dUczLlRtPi6GFZOr508UaxiYaO0yZ4r9MUeEXfzW3hreTYSlxeo1+b7ngfUiVx42v6 GFKFds08mpubQmKkfNrIFhnwnMU+/xogJRhp1B19uV1P6LOqUAAOfWkvoGv8Wz/q+OLP JwMxtmbLyohe859codg0DWPyCOr/gRSNB64qgc+aTVO05qc9rou/DQ/b6ARY5KUWrcnr WGCnm4ytZmzKra0Al/uAh6vPzKqYdEBU8Zj8WuYLmRxkqax60a9mk1Hs4synIWVlGwoI 9QJZtwtk9OEssbJgPS9X4vg3dqHFn0xOtyqFa3UnVvaupKU0XBBjEswFDIzNLq2k1Kf7 Wtqg== 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=gnuEgaZNN19l/ugfTfu/fw0tytKBBUF2lrGmInMU3AHchx1x6vZ9zOdjwKZqy7YhWw vo/tiHWEITcHmTvUyyqIF3SdIDXET/Y9rAUeJRmqP8zVT93/tlzeut/GknKuazWnztW0 EJ3ar7QoUrom2wdXHMSALJ7WuFWg0DBOMfMAiARj0MKA5c/NQkD7UrDl8Rl2v+SWN5zv lsUBtJ1oyFInueKKBh6zLaaMxGcJD1XAVYsAH9QytqRj4hQQYgy2X4mxUe7i3GB8EaJn DY+qD+WTd6oBFyl9Qwj7YPjEM0laiDAEjaGWjbHpqylqZfY9V+bCmP7Pxkz4gaIymGVT ORrg== X-Gm-Message-State: AOAM531yD1fMzAty/dWBoIIdrV6ub+MF7EUKYg7rjaj14dUhcLl4PNDf ZR6tWtYinHqtMcogtJwGPsWYtQ== X-Google-Smtp-Source: ABdhPJw7zRqDTtln8kCNCqMqvZNX1pG3+4zNqJfXoAASdGT4ByKjiUbvEBcid+QAZi1YYWqtYSP3OA== X-Received: by 2002:a05:600c:2247:: with SMTP id a7mr19090730wmm.131.1615143105859; Sun, 07 Mar 2021 10:51:45 -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 v5sm14842965wmh.2.2021.03.07.10.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Mar 2021 10:51:45 -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 v4 4/4] devfreq/drivers/lima: Use devfreq cooling device registration Date: Sun, 7 Mar 2021 19:51:37 +0100 Message-Id: <20210307185137.24925-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210307185137.24925-1-daniel.lezcano@linaro.org> References: <20210307185137.24925-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;