From patchwork Fri Mar 5 17:03: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: 393530 Delivered-To: patch@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp597421jai; Fri, 5 Mar 2021 09:04:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJyd38hZ6BgpEvAjnp5GuFwYUc14nVgJh9KwT67aTKNj8yWYM9fN+zqejNRsUEcgd0+AgnO0 X-Received: by 2002:a17:906:b316:: with SMTP id n22mr2948989ejz.249.1614963879786; Fri, 05 Mar 2021 09:04:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614963879; cv=none; d=google.com; s=arc-20160816; b=aibk5+UsQ43DMHmyNtUG5mskrQvyrywUcMZVrnF146kq098fu8NRoCZmk9L5N11aQY TdsIdv8WcN6YCPNP93tPJTcxOyZ37yTRAVbN//pycwex3D/prCSe8O+hSOjU/nA/DpCT OP3JBATxKYlaXimSiKshfr5Ib4X+BbA6OOIAdVPhTObnbVtRQ+5LaG0ePxI4rP9O3kwe nxJLNI+ApCeEUmVQWGcrx/QJ1mpUeHcvO30lEFaPwtzK8BPon1lvWp6B7yeMp7X5chVB QJvv+fAOx5SBscgoLIjBfetUHq5A1vcUh+QZEjGFFVtVg6db+djc/RK6dusabBD1Fj82 xXdg== 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=FRb7ItoNyUYyhXCHU4qOqv4pUK8UWPoqe/ZnMREqgVA=; b=BdEpODjr+AL1WLZuyMOrRUR6w7RM9ydL8GeU6Q4pMdxiH1yzfjA2h5Ex3lMv6HFcU+ lVV/l5kMJNyWk2JlR6U0kZ1k4jUxiP1fNHt5f9yIDJgwt2U0YqrTwPMGmBYo7JpVVaUE n4DsIL7UG2mNbudfQboI/qxTehZpQqog6CW4PQDtmSjgpemcrUd5bwqd93IHUAkKjV5S iM4bUgQzTyXL6ARmu1OBlRIBXqG8M6nIdvo6KLbkDCTvtJ6Ezgf2tUt2bsAfYJWQOO1j gvHTIklkTns6dF76vnNYVbQ/qM4ZgVBslvQWWPsHPhX69wxdTXRPTChnbtvs+v2Szrdc wO2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EgUhOogo; 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 x13si1614270ejv.716.2021.03.05.09.04.39; Fri, 05 Mar 2021 09:04:39 -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=EgUhOogo; 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 S231384AbhCEREG (ORCPT + 7 others); Fri, 5 Mar 2021 12:04:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231367AbhCERDw (ORCPT ); Fri, 5 Mar 2021 12:03:52 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BA69C061574 for ; Fri, 5 Mar 2021 09:03:52 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id u187so2064526wmg.4 for ; Fri, 05 Mar 2021 09:03: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; bh=FRb7ItoNyUYyhXCHU4qOqv4pUK8UWPoqe/ZnMREqgVA=; b=EgUhOogowl99zpTzCzDFdUKufp8k9c2Gtw+KbklyRh9lG5Kpt5QaM9U79eUMWFyJKe OWSSPvd+BuEKkWrvoJO1Ivzf9Qe1vCZm08urwp9Zh0TGbbxSjjmo80dp5hrx4P/NWWnE 4NCqtnvVCUVsj80mq/qovHX9uVTKYdDxHUiJzm1rBr3vdLcSxoFpANUBJExljWclTCNU D8jyIdRzmUtn4FtjTC9wiWSqndGe2lDrn9vWi2ZWq4jv/jCuP+xaJuvMGyw/QEgqFgjC SUU67xpKbIHQ2v3685uL3a184kMuhCRtr6k3KxWWzA2EK3gfph8cMx/pUw6dxnA3YKzx 9p5A== 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=FRb7ItoNyUYyhXCHU4qOqv4pUK8UWPoqe/ZnMREqgVA=; b=hUAO43VTJLwZoYJ3EIAvF/xcr+MKKUyJPfjAzMaJ34zyoM/pQUCXVyDsTomS7NIh0M BgndMLhawFq8UtNn6QlB/mD7IUO0eZWLbE41JFvj589MQtlOO5avgUBCjrVyRf1H5904 h9fjHZszJKuqNCACYoH4GV0dniNVzuk8zSGCfxRa+7OgRYfijGSm0+2XUMSpyyYkmr1V km2SBDOCfnQqP6y/M3JUD4wMzpdjtv1kf4vW3/kmZ/Ndcin7qpSEUwJTGzaNaPT0wHDu cuJ9R5yj7WbGoZ+UWUcDGlQSJTMZE7JbxX96IbdvZJc3Dt4dGAw4c4Ri3U6DUQxoRoy8 OiRA== X-Gm-Message-State: AOAM530Zu0s/+DEM+e0oBrtHmN3FTvtdx3VWx7KxDruWpxAWRmtIuie4 FznsFlXd60wI1F0+Io4Q3EHjOA== X-Received: by 2002:a1c:2ed4:: with SMTP id u203mr10046088wmu.45.1614963830695; Fri, 05 Mar 2021 09:03:50 -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 p17sm4760934wmq.47.2021.03.05.09.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 09:03:50 -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 v2 1/4] devfreq: Register devfreq as a cooling device on demand Date: Fri, 5 Mar 2021 18:03:34 +0100 Message-Id: <20210305170338.13647-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 --- drivers/devfreq/devfreq.c | 11 +++++++++++ include/linux/devfreq.h | 7 +++++++ 2 files changed, 18 insertions(+) -- 2.17.1 diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index b6d63f02d293..5c0fdd3a48d2 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 #include "governor.h" @@ -935,6 +937,13 @@ 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"); + } + return devfreq; err_init: @@ -960,6 +969,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..554e7904b0c5 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, @@ -198,6 +202,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 Fri Mar 5 17:03: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: 393992 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, URIBL_BLOCKED, 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 78E6DC433E6 for ; Fri, 5 Mar 2021 17:04:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 38D0165094 for ; Fri, 5 Mar 2021 17:04:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231367AbhCEREH (ORCPT ); Fri, 5 Mar 2021 12:04:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231375AbhCERDy (ORCPT ); Fri, 5 Mar 2021 12:03:54 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C657CC061574 for ; Fri, 5 Mar 2021 09:03:53 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id m1so2082011wml.2 for ; Fri, 05 Mar 2021 09:03:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lZkNk3yYW/8ijhrD082tSx7qBCi8O3cbnVc/FrlwdlU=; b=TgZURChUGXUbgDO2bV0UsU+s1j/d5KKVOwy39jkcxWe/38xJxE8XgQo917QUm+QWZx 2rsQ+GfXyOcIsol9aos7nC+fVNMkUvQwzoG5Zz6McgO7oengrXe5q+vHiuUp+foGg+49 Sda8/VQh1uaa3anhia/BbnTRkLROiFiCh+yjAMM2y4Kt5Z0Vz/E9vgcbBTKTsFBN18Z3 us1vgkBE5QhZ3hUt66DqUWgUzb23W/10IX7tmRGQrOgYj/m6dnbsJfywsit+pgpB+JW1 koIJk3T02fYaDHy/Xf2D/JPPaD7P24OeeE/UgmWLHqJ7eLs/J6XJUXjBQPjrNY+FA4nl 3YoA== 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=gHeZbZhV5lwSKCZmBNl67mpJ8pEehFZM8jAKGTu7I8rM2NmBETTwmB+gn5yzm6GVvt bq9gKH5HbmZXqVRtTAhu03b3I0IoPKlKWEzYE8RJDPkXEQgaiB7bG5FMr66n/El91TW3 uCgOwHUUp4thpIXdEskSNNUKS5JAJfQ7AYKhsH0t0/QN2KO4x2iWFTeuv6+ZOijd+tku Om/luhN0zXiPAPZyfPaWa7GTOBrK/rcq7In5j8GHrXggCT4ZB78+HOYyEkMb8eb319zs EmF7JXE1AfrqQUMtF5vA6z5vri/y16uUKAOT3EcH+FydWwv9JwUMV9F1GGWazGuy/aPj XfIQ== X-Gm-Message-State: AOAM530zPWx3MuOgddQA/csgQL5aBowdJxBzLT8inTk9eG5BomL245UD TOKJUF/8a/Y3UExldZREUAfxW67ByS9llA== X-Google-Smtp-Source: ABdhPJweZmT9/DaMkRyVEAelVHMaLzH8C50RUNPjNl2+9ptTTzFrB7lyNizfKFE7Fyek/6A+5FD0Vg== X-Received: by 2002:a05:600c:35c1:: with SMTP id r1mr9670239wmq.60.1614963832386; Fri, 05 Mar 2021 09:03:52 -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 p17sm4760934wmq.47.2021.03.05.09.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 09:03:51 -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 v2 2/4] devfreq/drivers/lima: Use devfreq cooling device registration Date: Fri, 5 Mar 2021 18:03:35 +0100 Message-Id: <20210305170338.13647-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210305170338.13647-1-daniel.lezcano@linaro.org> References: <20210305170338.13647-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; From patchwork Fri Mar 5 17:03: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: 394783 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, URIBL_BLOCKED, 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 A1B2DC433E9 for ; Fri, 5 Mar 2021 17:04:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7A6FF64F51 for ; Fri, 5 Mar 2021 17:04:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231390AbhCEREH (ORCPT ); Fri, 5 Mar 2021 12:04:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231377AbhCERDz (ORCPT ); Fri, 5 Mar 2021 12:03:55 -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 49209C061574 for ; Fri, 5 Mar 2021 09:03:55 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id w11so2837778wrr.10 for ; Fri, 05 Mar 2021 09:03:55 -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=oNEKdz6xPt7rWWlY08YTlqJ+lKrJjFhTuySIUMQ0e+4R72ftmlHWkmFwbJE/yj/0L9 KQMDY7H55bE4DUmCGgWXZyl+eFIMBmfgbneFavsgAAhHFKhJqgZ0E2SRJFr8EYlYdBX3 HLYPLXCO66AqeADhGbMjohltUr1f+KTc3M9FN9QB1IMSKfgOS5XfD/kaKEdd5SRqmln3 ckKfK0l4tR15SPjWq+QWJuU49+H+lNH4Fuxx/IhwJfx6LBmYllz+9uOYVE1kgQg8wMgQ DUzBop11GMlwrMWg2owHd0e46fK8c8XFG/ErkGfIy15tj6hntwGkhRBFjr1eyuGxUJT6 9Pjw== 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=NU2bGq0JGMB7LgPgZFB98kqtotrzlip2GyJboB+AHhUxMA2LKNXzxIQvWSf+HqPsbO 8TfBWVwg7ss+zMN8g+AeuD2j8ohZAhLaQIhX0KOute7ksOw5FoBH4TkXjrH3/xjW4hR8 z0sxQzbGUL+L/5tq/K74CdKLYsod/TQhpVjt1gSuEWe0Kus1q0v2Mv2HNK6k2vKTzjvC FBRfUprWe8rW6H152mGFT+tmDGUQ4EHtFJB6bDob1FBLpHDtVfxd+Id0g0efe1MGA96t 1HfN7AUBDoI/EQaYkGWRmcEOCS0bB2AwFw2WEohF0ZYaUH3P6J1xm8W8HR0mOujYQ59i n+kA== X-Gm-Message-State: AOAM532z59WCOTZRSg7vFo4vbCxDtQ/uwqgaSKgePGqh7hGJ3rTkndN4 hbJaMl4eHZF0qvcJsvFMZLOhKA== X-Google-Smtp-Source: ABdhPJydYEppXPz3sewV0+dccHxbmeBJKVjPuVHQAf0k543BYpWsmppZxZNmbBiyB1toc0Djs2GAuA== X-Received: by 2002:a5d:68cd:: with SMTP id p13mr10821095wrw.247.1614963833977; Fri, 05 Mar 2021 09:03:53 -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 p17sm4760934wmq.47.2021.03.05.09.03.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 09:03:53 -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 v2 3/4] devfreq/drivers/msm: Use devfreq cooling device registration Date: Fri, 5 Mar 2021 18:03:36 +0100 Message-Id: <20210305170338.13647-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210305170338.13647-1-daniel.lezcano@linaro.org> References: <20210305170338.13647-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 Fri Mar 5 17:03: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: 394784 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 8C19BC43381 for ; Fri, 5 Mar 2021 17:04:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 650C465081 for ; Fri, 5 Mar 2021 17:04:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231366AbhCEREI (ORCPT ); Fri, 5 Mar 2021 12:04:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231380AbhCERD5 (ORCPT ); Fri, 5 Mar 2021 12:03:57 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3E70C061756 for ; Fri, 5 Mar 2021 09:03:56 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id v15so2860786wrx.4 for ; Fri, 05 Mar 2021 09:03:56 -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=swIYYukmXBPaja9sOQciBRpjvLCS+zDwCEO0LYBBETH1USSmuqSzF0c5EQfiCG2Wo2 GLUPdq8UftrXP9o9q2Eu3qYe6zVzpqQIbQPM3uClUG5+DcyhsuBHBe+fsv5Qrs5K5EfX oNfWy6b3fFjbQ6xAo4gIYcM9qYdOUwz3NJk84Bk3TbBXf8p7dSkL0pBOSDclsPQzWJ1z XM6+6xA4ghBTSuC6vRQ3m60/51XI68pU/kbjgztoQqNuUg7aWcj0EDDJFfl/Dp6W7Rvo 2iireZy5lAjM/nLHQ13lB3v80mBbVi2Ka4GHqjgQl87pIk4q0ChWX7Q/P3tHGPNuzOfP 2l1g== 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=OKZxbL5kKv2wOMAQOhOJM8wCUWmdf8/6y2S+U5DlyhT0DiX14XcoaDTmdqZYkZwvIP Sl48H70MFgNkVhW3BCFyhPz5QPgHqMw1cLd414Vn9+M/cPF8LwtjyXx0ttM9wzeI/k0g Lt5X6cD5Nga9gWzuD7OImIFZXXerMDRWFHmTPSEf6B8Co1cte03UBaz9xQAzRhR6R/BQ S8xiJmBkYMtxzk7CSebGe25rK+A5UoC7+N5lXc1lW4HIpIWX1QykQ/KRmSvPAcXRKQ8V FGybn40zi2MCasN6I8p9PDZh6jkNgYD4I9ea+HcfgiUBwMyW786CgdP5MHPOF3kgD4sA 7aVg== X-Gm-Message-State: AOAM530IpEXJZdOPyE7eQUwNJ6+QKzMAMP+5lfPJ8xQmPM0qUB8JCcd8 EXChRQG8sCQlJ33op0lhN1W4DA== X-Google-Smtp-Source: ABdhPJy7Len8gQJ8kSf2MO/PaGZMBla5J7H3YzDlCMYsreVJGMZXypBM7ZvREdzhXmXw5/qQmz+p0A== X-Received: by 2002:a5d:6b0a:: with SMTP id v10mr10296497wrw.183.1614963835502; Fri, 05 Mar 2021 09:03:55 -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 p17sm4760934wmq.47.2021.03.05.09.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 09:03:55 -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 v2 4/4] devfreq/drivers/panfrost: Use devfreq cooling device registration Date: Fri, 5 Mar 2021 18:03:37 +0100 Message-Id: <20210305170338.13647-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210305170338.13647-1-daniel.lezcano@linaro.org> References: <20210305170338.13647-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;